From e9eaea6b69fea19debd5731274baf7e6483c7129 Mon Sep 17 00:00:00 2001 From: Tony Luck Date: Wed, 28 Jun 2006 09:55:13 -0700 Subject: [PATCH] --- yaml --- r: 30984 b: refs/heads/master c: f1206641ef4a8cb7a7b15b75e8cfdc7c6bfaf213 h: refs/heads/master v: v3 --- [refs] | 2 +- .../feature-removal-schedule.txt | 10 - trunk/arch/i386/kernel/irq.c | 6 - trunk/arch/i386/kernel/sysenter.c | 10 +- trunk/arch/ia64/kernel/palinfo.c | 2 +- .../powerpc/platforms/powermac/backlight.c | 14 +- trunk/arch/x86_64/kernel/irq.c | 6 - trunk/arch/x86_64/kernel/nmi.c | 2 - trunk/drivers/block/loop.c | 4 +- trunk/drivers/block/rd.c | 2 +- trunk/drivers/char/ipmi/ipmi_msghandler.c | 7 +- trunk/drivers/char/ipmi/ipmi_si_intf.c | 67 + trunk/drivers/char/ipmi/ipmi_watchdog.c | 18 +- trunk/drivers/char/istallion.c | 1819 +++++++++++------ trunk/drivers/char/mxser.c | 1 + trunk/drivers/char/n_tty.c | 6 +- trunk/drivers/char/pty.c | 2 +- trunk/drivers/char/stallion.c | 3 - trunk/drivers/char/tty_io.c | 68 +- trunk/drivers/ide/ide-io.c | 2 +- trunk/drivers/ide/ide-iops.c | 4 - trunk/drivers/ide/pci/aec62xx.c | 16 +- trunk/drivers/ide/pci/cmd64x.c | 15 + trunk/drivers/ide/pci/pdc202xx_new.c | 2 - trunk/drivers/ide/pci/pdc202xx_old.c | 115 +- trunk/drivers/ide/pci/sc1200.c | 4 +- trunk/drivers/ide/pci/serverworks.c | 53 +- trunk/drivers/ide/pci/siimage.c | 62 +- trunk/drivers/ide/pci/sl82c105.c | 4 +- trunk/drivers/ide/pci/slc90e66.c | 11 +- trunk/drivers/rtc/Kconfig | 10 - trunk/drivers/rtc/Makefile | 1 - trunk/drivers/rtc/rtc-rs5c348.c | 246 --- trunk/drivers/serial/crisv10.c | 6 + trunk/drivers/serial/jsm/jsm_tty.c | 7 + trunk/drivers/usb/serial/ir-usb.c | 3 +- trunk/drivers/video/aty/radeon_backlight.c | 6 +- trunk/fs/9p/mux.c | 2 - trunk/fs/9p/v9fs_vfs.h | 2 +- trunk/fs/9p/vfs_addr.c | 2 +- trunk/fs/9p/vfs_inode.c | 2 +- trunk/fs/adfs/inode.c | 2 +- trunk/fs/affs/affs.h | 6 +- trunk/fs/affs/file.c | 4 +- trunk/fs/affs/symlink.c | 2 +- trunk/fs/afs/file.c | 2 +- trunk/fs/afs/internal.h | 2 +- trunk/fs/befs/linuxvfs.c | 2 +- trunk/fs/bfs/bfs.h | 2 +- trunk/fs/bfs/file.c | 2 +- trunk/fs/block_dev.c | 2 +- trunk/fs/buffer.c | 2 +- trunk/fs/cifs/cifsfs.h | 4 +- trunk/fs/cifs/file.c | 4 +- trunk/fs/coda/symlink.c | 2 +- trunk/fs/configfs/inode.c | 2 +- trunk/fs/cramfs/inode.c | 4 +- trunk/fs/efs/inode.c | 2 +- trunk/fs/efs/symlink.c | 2 +- trunk/fs/ext2/ext2.h | 6 +- trunk/fs/ext2/inode.c | 6 +- trunk/fs/ext3/inode.c | 6 +- trunk/fs/fat/inode.c | 2 +- trunk/fs/freevxfs/vxfs_immed.c | 2 +- trunk/fs/freevxfs/vxfs_inode.c | 6 +- trunk/fs/freevxfs/vxfs_subr.c | 2 +- trunk/fs/fuse/file.c | 2 +- trunk/fs/hfs/hfs_fs.h | 4 +- trunk/fs/hfs/inode.c | 4 +- trunk/fs/hfsplus/hfsplus_fs.h | 4 +- trunk/fs/hfsplus/inode.c | 4 +- trunk/fs/hostfs/hostfs_kern.c | 6 +- trunk/fs/hpfs/file.c | 2 +- trunk/fs/hpfs/hpfs_fn.h | 4 +- trunk/fs/hpfs/namei.c | 2 +- trunk/fs/hugetlbfs/inode.c | 4 +- trunk/fs/inode.c | 2 +- trunk/fs/isofs/compress.c | 2 +- trunk/fs/isofs/inode.c | 2 +- trunk/fs/isofs/isofs.h | 2 +- trunk/fs/isofs/rock.c | 2 +- trunk/fs/isofs/zisofs.h | 2 +- trunk/fs/jffs/inode-v23.c | 4 +- trunk/fs/jffs2/file.c | 2 +- trunk/fs/jffs2/os-linux.h | 2 +- trunk/fs/jfs/inode.c | 2 +- trunk/fs/jfs/jfs_inode.h | 2 +- trunk/fs/jfs/jfs_metapage.c | 2 +- trunk/fs/jfs/jfs_metapage.h | 2 +- trunk/fs/minix/inode.c | 2 +- trunk/fs/ncpfs/inode.c | 2 +- trunk/fs/ncpfs/symlink.c | 2 +- trunk/fs/nfs/file.c | 2 +- trunk/fs/ntfs/aops.c | 4 +- trunk/fs/ntfs/ntfs.h | 4 +- trunk/fs/ocfs2/aops.c | 2 +- trunk/fs/ocfs2/inode.h | 2 +- trunk/fs/qnx4/inode.c | 2 +- trunk/fs/ramfs/file-mmu.c | 2 +- trunk/fs/ramfs/file-nommu.c | 2 +- trunk/fs/ramfs/internal.h | 2 +- trunk/fs/reiserfs/inode.c | 2 +- trunk/fs/romfs/inode.c | 2 +- trunk/fs/smbfs/file.c | 2 +- trunk/fs/smbfs/proto.h | 2 +- trunk/fs/sysfs/inode.c | 2 +- trunk/fs/sysv/itree.c | 2 +- trunk/fs/sysv/sysv.h | 2 +- trunk/fs/udf/file.c | 2 +- trunk/fs/udf/inode.c | 2 +- trunk/fs/udf/symlink.c | 2 +- trunk/fs/udf/udfdecl.h | 6 +- trunk/fs/ufs/inode.c | 2 +- trunk/fs/xfs/linux-2.6/xfs_aops.c | 2 +- trunk/fs/xfs/linux-2.6/xfs_aops.h | 2 +- trunk/fs/xfs/linux-2.6/xfs_buf.c | 2 +- trunk/include/asm-generic/vmlinux.lds.h | 28 - trunk/include/linux/ac97_codec.h | 2 +- trunk/include/linux/coda_linux.h | 4 +- trunk/include/linux/efs_fs.h | 2 +- trunk/include/linux/fs.h | 4 +- trunk/include/linux/ide.h | 1 - trunk/include/linux/kbd_kern.h | 4 +- trunk/include/linux/module.h | 20 - trunk/include/linux/nfs_fs.h | 2 +- trunk/include/linux/reiserfs_fs.h | 2 +- trunk/include/linux/tty.h | 2 + trunk/include/linux/tty_flip.h | 2 +- trunk/include/linux/ufs_fs.h | 2 +- trunk/kernel/module.c | 101 +- trunk/lib/Kconfig.debug | 16 - trunk/mm/filemap.c | 4 +- trunk/mm/filemap_xip.c | 2 +- trunk/mm/shmem.c | 4 +- trunk/mm/swap_state.c | 2 +- trunk/net/bluetooth/rfcomm/tty.c | 8 +- trunk/sound/oss/cs4232.c | 2 +- trunk/sound/oss/via82cxxx_audio.c | 2 +- 138 files changed, 1683 insertions(+), 1361 deletions(-) delete mode 100644 trunk/drivers/rtc/rtc-rs5c348.c diff --git a/[refs] b/[refs] index ff2340767bb9..99861b9ca490 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d9a5685436b0dd08a6386a2f9423103cb4689dbc +refs/heads/master: f1206641ef4a8cb7a7b15b75e8cfdc7c6bfaf213 diff --git a/trunk/Documentation/feature-removal-schedule.txt b/trunk/Documentation/feature-removal-schedule.txt index 033ac91da07a..027285d0c26c 100644 --- a/trunk/Documentation/feature-removal-schedule.txt +++ b/trunk/Documentation/feature-removal-schedule.txt @@ -177,16 +177,6 @@ Who: Jean Delvare --------------------------- -What: Unused EXPORT_SYMBOL/EXPORT_SYMBOL_GPL exports - (temporary transition config option provided until then) - The transition config option will also be removed at the same time. -When: before 2.6.19 -Why: Unused symbols are both increasing the size of the kernel binary - and are often a sign of "wrong API" -Who: Arjan van de Ven - ---------------------------- - What: remove EXPORT_SYMBOL(tasklist_lock) When: August 2006 Files: kernel/fork.c diff --git a/trunk/arch/i386/kernel/irq.c b/trunk/arch/i386/kernel/irq.c index 9eec9435318e..c703bc7b0880 100644 --- a/trunk/arch/i386/kernel/irq.c +++ b/trunk/arch/i386/kernel/irq.c @@ -60,12 +60,6 @@ fastcall unsigned int do_IRQ(struct pt_regs *regs) u32 *isp; #endif - if (unlikely((unsigned)irq >= NR_IRQS)) { - printk(KERN_EMERG "%s: cannot handle IRQ %d\n", - __FUNCTION__, irq); - BUG(); - } - irq_enter(); #ifdef CONFIG_DEBUG_STACKOVERFLOW /* Debugging check for stack overflow: is there less than 1KB free? */ diff --git a/trunk/arch/i386/kernel/sysenter.c b/trunk/arch/i386/kernel/sysenter.c index 713ba39d32c6..c60419dee018 100644 --- a/trunk/arch/i386/kernel/sysenter.c +++ b/trunk/arch/i386/kernel/sysenter.c @@ -148,10 +148,8 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int exstack) vma->vm_mm = mm; ret = insert_vm_struct(mm, vma); - if (unlikely(ret)) { - kmem_cache_free(vm_area_cachep, vma); - goto up_fail; - } + if (ret) + goto free_vma; current->mm->context.vdso = (void *)addr; current_thread_info()->sysenter_return = @@ -160,6 +158,10 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int exstack) up_fail: up_write(&mm->mmap_sem); return ret; + +free_vma: + kmem_cache_free(vm_area_cachep, vma); + return ret; } const char *arch_vma_name(struct vm_area_struct *vma) diff --git a/trunk/arch/ia64/kernel/palinfo.c b/trunk/arch/ia64/kernel/palinfo.c index 303a9afcf2a1..8a1208419138 100644 --- a/trunk/arch/ia64/kernel/palinfo.c +++ b/trunk/arch/ia64/kernel/palinfo.c @@ -998,7 +998,7 @@ palinfo_init(void) } /* Register for future delivery via notify registration */ - register_cpu_notifier(&palinfo_cpu_notifier); + register_hotcpu_notifier(&palinfo_cpu_notifier); return 0; } diff --git a/trunk/arch/powerpc/platforms/powermac/backlight.c b/trunk/arch/powerpc/platforms/powermac/backlight.c index c7a27eddca6d..498b042e1837 100644 --- a/trunk/arch/powerpc/platforms/powermac/backlight.c +++ b/trunk/arch/powerpc/platforms/powermac/backlight.c @@ -119,14 +119,7 @@ int pmac_backlight_set_legacy_brightness(int brightness) down(&pmac_backlight->sem); props = pmac_backlight->props; props->brightness = brightness * - (props->max_brightness + 1) / - (OLD_BACKLIGHT_MAX + 1); - - if (props->brightness > props->max_brightness) - props->brightness = props->max_brightness; - else if (props->brightness < 0) - props->brightness = 0; - + props->max_brightness / OLD_BACKLIGHT_MAX; props->update_status(pmac_backlight); up(&pmac_backlight->sem); @@ -147,11 +140,8 @@ int pmac_backlight_get_legacy_brightness() down(&pmac_backlight->sem); props = pmac_backlight->props; - result = props->brightness * - (OLD_BACKLIGHT_MAX + 1) / - (props->max_brightness + 1); - + OLD_BACKLIGHT_MAX / props->max_brightness; up(&pmac_backlight->sem); } mutex_unlock(&pmac_backlight_mutex); diff --git a/trunk/arch/x86_64/kernel/irq.c b/trunk/arch/x86_64/kernel/irq.c index bfa82f52a5cc..3be0a7e4bf08 100644 --- a/trunk/arch/x86_64/kernel/irq.c +++ b/trunk/arch/x86_64/kernel/irq.c @@ -118,12 +118,6 @@ asmlinkage unsigned int do_IRQ(struct pt_regs *regs) /* high bit used in ret_from_ code */ unsigned irq = ~regs->orig_rax; - if (unlikely(irq >= NR_IRQS)) { - printk(KERN_EMERG "%s: cannot handle IRQ %d\n", - __FUNCTION__, irq); - BUG(); - } - exit_idle(); irq_enter(); #ifdef CONFIG_DEBUG_STACKOVERFLOW diff --git a/trunk/arch/x86_64/kernel/nmi.c b/trunk/arch/x86_64/kernel/nmi.c index 0ef9cf2bc45e..399489c93132 100644 --- a/trunk/arch/x86_64/kernel/nmi.c +++ b/trunk/arch/x86_64/kernel/nmi.c @@ -607,13 +607,11 @@ void set_nmi_callback(nmi_callback_t callback) vmalloc_sync_all(); rcu_assign_pointer(nmi_callback, callback); } -EXPORT_SYMBOL_GPL(set_nmi_callback); void unset_nmi_callback(void) { nmi_callback = dummy_nmi_callback; } -EXPORT_SYMBOL_GPL(unset_nmi_callback); #ifdef CONFIG_SYSCTL diff --git a/trunk/drivers/block/loop.c b/trunk/drivers/block/loop.c index 18dd026f470d..3c74ea729fc7 100644 --- a/trunk/drivers/block/loop.c +++ b/trunk/drivers/block/loop.c @@ -210,7 +210,7 @@ static int do_lo_send_aops(struct loop_device *lo, struct bio_vec *bvec, { struct file *file = lo->lo_backing_file; /* kudos to NFsckingS */ struct address_space *mapping = file->f_mapping; - const struct address_space_operations *aops = mapping->a_ops; + struct address_space_operations *aops = mapping->a_ops; pgoff_t index; unsigned offset, bv_offs; int len, ret; @@ -784,7 +784,7 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file, error = -EINVAL; if (S_ISREG(inode->i_mode) || S_ISBLK(inode->i_mode)) { - const struct address_space_operations *aops = mapping->a_ops; + struct address_space_operations *aops = mapping->a_ops; /* * If we can't read - sorry. If we only can't write - well, * it's going to be read-only. diff --git a/trunk/drivers/block/rd.c b/trunk/drivers/block/rd.c index 0378da04cfa2..940bfd7951e5 100644 --- a/trunk/drivers/block/rd.c +++ b/trunk/drivers/block/rd.c @@ -191,7 +191,7 @@ static int ramdisk_set_page_dirty(struct page *page) return 0; } -static const struct address_space_operations ramdisk_aops = { +static struct address_space_operations ramdisk_aops = { .readpage = ramdisk_readpage, .prepare_write = ramdisk_prepare_write, .commit_write = ramdisk_commit_write, diff --git a/trunk/drivers/char/ipmi/ipmi_msghandler.c b/trunk/drivers/char/ipmi/ipmi_msghandler.c index ad26f4b997c5..83ed6ae466a5 100644 --- a/trunk/drivers/char/ipmi/ipmi_msghandler.c +++ b/trunk/drivers/char/ipmi/ipmi_msghandler.c @@ -3738,8 +3738,11 @@ static int ipmi_init_msghandler(void) proc_ipmi_root->owner = THIS_MODULE; #endif /* CONFIG_PROC_FS */ - setup_timer(&ipmi_timer, ipmi_timeout, 0); - mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES); + init_timer(&ipmi_timer); + ipmi_timer.data = 0; + ipmi_timer.function = ipmi_timeout; + ipmi_timer.expires = jiffies + IPMI_TIMEOUT_JIFFIES; + add_timer(&ipmi_timer); atomic_notifier_chain_register(&panic_notifier_list, &panic_block); diff --git a/trunk/drivers/char/ipmi/ipmi_si_intf.c b/trunk/drivers/char/ipmi/ipmi_si_intf.c index bd4f2248b758..101c14b9b26d 100644 --- a/trunk/drivers/char/ipmi/ipmi_si_intf.c +++ b/trunk/drivers/char/ipmi/ipmi_si_intf.c @@ -55,6 +55,23 @@ #include #include #include +#ifdef CONFIG_HIGH_RES_TIMERS +#include +# if defined(schedule_next_int) +/* Old high-res timer code, do translations. */ +# define get_arch_cycles(a) quick_update_jiffies_sub(a) +# define arch_cycles_per_jiffy cycles_per_jiffies +# endif +static inline void add_usec_to_timer(struct timer_list *t, long v) +{ + t->arch_cycle_expires += nsec_to_arch_cycle(v * 1000); + while (t->arch_cycle_expires >= arch_cycles_per_jiffy) + { + t->expires++; + t->arch_cycle_expires -= arch_cycles_per_jiffy; + } +} +#endif #include #include #include @@ -226,6 +243,8 @@ static int register_xaction_notifier(struct notifier_block * nb) return atomic_notifier_chain_register(&xaction_notifier_list, nb); } +static void si_restart_short_timer(struct smi_info *smi_info); + static void deliver_recv_msg(struct smi_info *smi_info, struct ipmi_smi_msg *msg) { @@ -749,6 +768,7 @@ static void sender(void *send_info, && (smi_info->curr_msg == NULL)) { start_next_msg(smi_info); + si_restart_short_timer(smi_info); } spin_unlock_irqrestore(&(smi_info->si_lock), flags); } @@ -813,6 +833,37 @@ static void request_events(void *send_info) static int initialized = 0; +/* Must be called with interrupts off and with the si_lock held. */ +static void si_restart_short_timer(struct smi_info *smi_info) +{ +#if defined(CONFIG_HIGH_RES_TIMERS) + unsigned long flags; + unsigned long jiffies_now; + unsigned long seq; + + if (del_timer(&(smi_info->si_timer))) { + /* If we don't delete the timer, then it will go off + immediately, anyway. So we only process if we + actually delete the timer. */ + + do { + seq = read_seqbegin_irqsave(&xtime_lock, flags); + jiffies_now = jiffies; + smi_info->si_timer.expires = jiffies_now; + smi_info->si_timer.arch_cycle_expires + = get_arch_cycles(jiffies_now); + } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); + + add_usec_to_timer(&smi_info->si_timer, SI_SHORT_TIMEOUT_USEC); + + add_timer(&(smi_info->si_timer)); + spin_lock_irqsave(&smi_info->count_lock, flags); + smi_info->timeout_restarts++; + spin_unlock_irqrestore(&smi_info->count_lock, flags); + } +#endif +} + static void smi_timeout(unsigned long data) { struct smi_info *smi_info = (struct smi_info *) data; @@ -853,15 +904,31 @@ static void smi_timeout(unsigned long data) /* If the state machine asks for a short delay, then shorten the timer timeout. */ if (smi_result == SI_SM_CALL_WITH_DELAY) { +#if defined(CONFIG_HIGH_RES_TIMERS) + unsigned long seq; +#endif spin_lock_irqsave(&smi_info->count_lock, flags); smi_info->short_timeouts++; spin_unlock_irqrestore(&smi_info->count_lock, flags); +#if defined(CONFIG_HIGH_RES_TIMERS) + do { + seq = read_seqbegin_irqsave(&xtime_lock, flags); + smi_info->si_timer.expires = jiffies; + smi_info->si_timer.arch_cycle_expires + = get_arch_cycles(smi_info->si_timer.expires); + } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); + add_usec_to_timer(&smi_info->si_timer, SI_SHORT_TIMEOUT_USEC); +#else smi_info->si_timer.expires = jiffies + 1; +#endif } else { spin_lock_irqsave(&smi_info->count_lock, flags); smi_info->long_timeouts++; spin_unlock_irqrestore(&smi_info->count_lock, flags); smi_info->si_timer.expires = jiffies + SI_TIMEOUT_JIFFIES; +#if defined(CONFIG_HIGH_RES_TIMERS) + smi_info->si_timer.arch_cycle_expires = 0; +#endif } do_add_timer: diff --git a/trunk/drivers/char/ipmi/ipmi_watchdog.c b/trunk/drivers/char/ipmi/ipmi_watchdog.c index 1a0a19c53605..8f8867170973 100644 --- a/trunk/drivers/char/ipmi/ipmi_watchdog.c +++ b/trunk/drivers/char/ipmi/ipmi_watchdog.c @@ -949,10 +949,9 @@ static int wdog_reboot_handler(struct notifier_block *this, /* Disable the WDT if we are shutting down. */ ipmi_watchdog_state = WDOG_TIMEOUT_NONE; panic_halt_ipmi_set_timeout(); - } else if (ipmi_watchdog_state != WDOG_TIMEOUT_NONE) { + } else { /* Set a long timer to let the reboot happens, but - reboot if it hangs, but only if the watchdog - timer was already running. */ + reboot if it hangs. */ timeout = 120; pretimeout = 0; ipmi_watchdog_state = WDOG_TIMEOUT_RESET; @@ -974,17 +973,16 @@ static int wdog_panic_handler(struct notifier_block *this, { static int panic_event_handled = 0; - /* On a panic, if we have a panic timeout, make sure to extend - the watchdog timer to a reasonable value to complete the - panic, if the watchdog timer is running. Plus the - pretimeout is meaningless at panic time. */ - if (watchdog_user && !panic_event_handled && - ipmi_watchdog_state != WDOG_TIMEOUT_NONE) { - /* Make sure we do this only once. */ + /* On a panic, if we have a panic timeout, make sure that the thing + reboots, even if it hangs during that panic. */ + if (watchdog_user && !panic_event_handled) { + /* Make sure the panic doesn't hang, and make sure we + do this only once. */ panic_event_handled = 1; timeout = 255; pretimeout = 0; + ipmi_watchdog_state = WDOG_TIMEOUT_RESET; panic_halt_ipmi_set_timeout(); } diff --git a/trunk/drivers/char/istallion.c b/trunk/drivers/char/istallion.c index 216c79256de3..ef20c1fc9c4c 100644 --- a/trunk/drivers/char/istallion.c +++ b/trunk/drivers/char/istallion.c @@ -42,12 +42,13 @@ #include #include #include -#include #include #include +#ifdef CONFIG_PCI #include +#endif /*****************************************************************************/ @@ -136,10 +137,6 @@ static stlconf_t stli_brdconf[] = { static int stli_nrbrds = ARRAY_SIZE(stli_brdconf); -/* stli_lock must NOT be taken holding brd_lock */ -static spinlock_t stli_lock; /* TTY logic lock */ -static spinlock_t brd_lock; /* Board logic lock */ - /* * There is some experimental EISA board detection code in this driver. * By default it is disabled, but for those that want to try it out, @@ -176,6 +173,14 @@ static char *stli_serialname = "ttyE"; static struct tty_driver *stli_serial; +/* + * We will need to allocate a temporary write buffer for chars that + * come direct from user space. The problem is that a copy from user + * space might cause a page fault (typically on a system that is + * swapping!). All ports will share one buffer - since if the system + * is already swapping a shared buffer won't make things any worse. + */ +static char *stli_tmpwritebuf; #define STLI_TXBUFSIZE 4096 @@ -414,7 +419,7 @@ static int stli_eisamempsize = ARRAY_SIZE(stli_eisamemprobeaddrs); #endif static struct pci_device_id istallion_pci_tbl[] = { - { PCI_DEVICE(PCI_VENDOR_ID_STALLION, PCI_DEVICE_ID_ECRA), }, + { PCI_VENDOR_ID_STALLION, PCI_DEVICE_ID_ECRA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { 0 } }; MODULE_DEVICE_TABLE(pci, istallion_pci_tbl); @@ -677,7 +682,7 @@ static int stli_startbrd(stlibrd_t *brdp); static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, loff_t *offp); static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t count, loff_t *offp); static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg); -static void stli_brdpoll(stlibrd_t *brdp, cdkhdr_t __iomem *hdrp); +static void stli_brdpoll(stlibrd_t *brdp, volatile cdkhdr_t *hdrp); static void stli_poll(unsigned long arg); static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp); static int stli_initopen(stlibrd_t *brdp, stliport_t *portp); @@ -688,8 +693,7 @@ static void stli_dohangup(void *arg); static int stli_setport(stliport_t *portp); static int stli_cmdwait(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback); static void stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback); -static void __stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback); -static void stli_dodelaycmd(stliport_t *portp, cdkctrl_t __iomem *cp); +static void stli_dodelaycmd(stliport_t *portp, volatile cdkctrl_t *cp); static void stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tiosp); static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts); static long stli_mktiocm(unsigned long sigvalue); @@ -795,8 +799,18 @@ static struct class *istallion_class; static int __init istallion_module_init(void) { + unsigned long flags; + +#ifdef DEBUG + printk("init_module()\n"); +#endif + + save_flags(flags); + cli(); stli_init(); - return 0; + restore_flags(flags); + + return(0); } /*****************************************************************************/ @@ -805,24 +819,33 @@ static void __exit istallion_module_exit(void) { stlibrd_t *brdp; stliport_t *portp; + unsigned long flags; int i, j; +#ifdef DEBUG + printk("cleanup_module()\n"); +#endif + printk(KERN_INFO "Unloading %s: version %s\n", stli_drvtitle, stli_drvversion); - /* - * Free up all allocated resources used by the ports. This includes - * memory and interrupts. - */ + save_flags(flags); + cli(); + +/* + * Free up all allocated resources used by the ports. This includes + * memory and interrupts. + */ if (stli_timeron) { stli_timeron = 0; - del_timer_sync(&stli_timerlist); + del_timer(&stli_timerlist); } i = tty_unregister_driver(stli_serial); if (i) { printk("STALLION: failed to un-register tty driver, " "errno=%d\n", -i); + restore_flags(flags); return; } put_tty_driver(stli_serial); @@ -836,15 +859,16 @@ static void __exit istallion_module_exit(void) printk("STALLION: failed to un-register serial memory device, " "errno=%d\n", -i); + kfree(stli_tmpwritebuf); kfree(stli_txcookbuf); for (i = 0; (i < stli_nrbrds); i++) { - if ((brdp = stli_brds[i]) == NULL) + if ((brdp = stli_brds[i]) == (stlibrd_t *) NULL) continue; for (j = 0; (j < STL_MAXPORTS); j++) { portp = brdp->ports[j]; - if (portp != NULL) { - if (portp->tty != NULL) + if (portp != (stliport_t *) NULL) { + if (portp->tty != (struct tty_struct *) NULL) tty_hangup(portp->tty); kfree(portp); } @@ -854,8 +878,10 @@ static void __exit istallion_module_exit(void) if (brdp->iosize > 0) release_region(brdp->iobase, brdp->iosize); kfree(brdp); - stli_brds[i] = NULL; + stli_brds[i] = (stlibrd_t *) NULL; } + + restore_flags(flags); } module_init(istallion_module_init); @@ -869,15 +895,19 @@ module_exit(istallion_module_exit); static void stli_argbrds(void) { - stlconf_t conf; - stlibrd_t *brdp; - int i; + stlconf_t conf; + stlibrd_t *brdp; + int i; + +#ifdef DEBUG + printk("stli_argbrds()\n"); +#endif for (i = stli_nrbrds; i < ARRAY_SIZE(stli_brdsp); i++) { memset(&conf, 0, sizeof(conf)); if (stli_parsebrd(&conf, stli_brdsp[i]) == 0) continue; - if ((brdp = stli_allocbrd()) == NULL) + if ((brdp = stli_allocbrd()) == (stlibrd_t *) NULL) continue; stli_nrbrds = i + 1; brdp->brdnr = i; @@ -896,9 +926,9 @@ static void stli_argbrds(void) static unsigned long stli_atol(char *str) { - unsigned long val; - int base, c; - char *sp; + unsigned long val; + int base, c; + char *sp; val = 0; sp = str; @@ -932,11 +962,15 @@ static unsigned long stli_atol(char *str) static int stli_parsebrd(stlconf_t *confp, char **argp) { - char *sp; - int i; + char *sp; + int i; - if (argp[0] == NULL || *argp[0] == 0) - return 0; +#ifdef DEBUG + printk("stli_parsebrd(confp=%x,argp=%x)\n", (int) confp, (int) argp); +#endif + + if ((argp[0] == (char *) NULL) || (*argp[0] == 0)) + return(0); for (sp = argp[0], i = 0; ((*sp != 0) && (i < 25)); sp++, i++) *sp = TOLOWER(*sp); @@ -951,9 +985,9 @@ static int stli_parsebrd(stlconf_t *confp, char **argp) } confp->brdtype = stli_brdstr[i].type; - if (argp[1] != NULL && *argp[1] != 0) + if ((argp[1] != (char *) NULL) && (*argp[1] != 0)) confp->ioaddr1 = stli_atol(argp[1]); - if (argp[2] != NULL && *argp[2] != 0) + if ((argp[2] != (char *) NULL) && (*argp[2] != 0)) confp->memaddr = stli_atol(argp[2]); return(1); } @@ -964,29 +998,34 @@ static int stli_parsebrd(stlconf_t *confp, char **argp) static int stli_open(struct tty_struct *tty, struct file *filp) { - stlibrd_t *brdp; - stliport_t *portp; - unsigned int minordev; - int brdnr, portnr, rc; + stlibrd_t *brdp; + stliport_t *portp; + unsigned int minordev; + int brdnr, portnr, rc; + +#ifdef DEBUG + printk("stli_open(tty=%x,filp=%x): device=%s\n", (int) tty, + (int) filp, tty->name); +#endif minordev = tty->index; brdnr = MINOR2BRD(minordev); if (brdnr >= stli_nrbrds) - return -ENODEV; + return(-ENODEV); brdp = stli_brds[brdnr]; - if (brdp == NULL) - return -ENODEV; + if (brdp == (stlibrd_t *) NULL) + return(-ENODEV); if ((brdp->state & BST_STARTED) == 0) - return -ENODEV; + return(-ENODEV); portnr = MINOR2PORT(minordev); if ((portnr < 0) || (portnr > brdp->nrports)) - return -ENODEV; + return(-ENODEV); portp = brdp->ports[portnr]; - if (portp == NULL) - return -ENODEV; + if (portp == (stliport_t *) NULL) + return(-ENODEV); if (portp->devnr < 1) - return -ENODEV; + return(-ENODEV); /* @@ -998,8 +1037,8 @@ static int stli_open(struct tty_struct *tty, struct file *filp) if (portp->flags & ASYNC_CLOSING) { interruptible_sleep_on(&portp->close_wait); if (portp->flags & ASYNC_HUP_NOTIFY) - return -EAGAIN; - return -ERESTARTSYS; + return(-EAGAIN); + return(-ERESTARTSYS); } /* @@ -1015,7 +1054,7 @@ static int stli_open(struct tty_struct *tty, struct file *filp) wait_event_interruptible(portp->raw_wait, !test_bit(ST_INITIALIZING, &portp->state)); if (signal_pending(current)) - return -ERESTARTSYS; + return(-ERESTARTSYS); if ((portp->flags & ASYNC_INITIALIZED) == 0) { set_bit(ST_INITIALIZING, &portp->state); @@ -1026,7 +1065,7 @@ static int stli_open(struct tty_struct *tty, struct file *filp) clear_bit(ST_INITIALIZING, &portp->state); wake_up_interruptible(&portp->raw_wait); if (rc < 0) - return rc; + return(rc); } /* @@ -1038,8 +1077,8 @@ static int stli_open(struct tty_struct *tty, struct file *filp) if (portp->flags & ASYNC_CLOSING) { interruptible_sleep_on(&portp->close_wait); if (portp->flags & ASYNC_HUP_NOTIFY) - return -EAGAIN; - return -ERESTARTSYS; + return(-EAGAIN); + return(-ERESTARTSYS); } /* @@ -1049,33 +1088,38 @@ static int stli_open(struct tty_struct *tty, struct file *filp) */ if (!(filp->f_flags & O_NONBLOCK)) { if ((rc = stli_waitcarrier(brdp, portp, filp)) != 0) - return rc; + return(rc); } portp->flags |= ASYNC_NORMAL_ACTIVE; - return 0; + return(0); } /*****************************************************************************/ static void stli_close(struct tty_struct *tty, struct file *filp) { - stlibrd_t *brdp; - stliport_t *portp; - unsigned long flags; + stlibrd_t *brdp; + stliport_t *portp; + unsigned long flags; + +#ifdef DEBUG + printk("stli_close(tty=%x,filp=%x)\n", (int) tty, (int) filp); +#endif portp = tty->driver_data; - if (portp == NULL) + if (portp == (stliport_t *) NULL) return; - spin_lock_irqsave(&stli_lock, flags); + save_flags(flags); + cli(); if (tty_hung_up_p(filp)) { - spin_unlock_irqrestore(&stli_lock, flags); + restore_flags(flags); return; } if ((tty->count == 1) && (portp->refcount != 1)) portp->refcount = 1; if (portp->refcount-- > 1) { - spin_unlock_irqrestore(&stli_lock, flags); + restore_flags(flags); return; } @@ -1090,8 +1134,6 @@ static void stli_close(struct tty_struct *tty, struct file *filp) if (tty == stli_txcooktty) stli_flushchars(tty); tty->closing = 1; - spin_unlock_irqrestore(&stli_lock, flags); - if (portp->closing_wait != ASYNC_CLOSING_WAIT_NONE) tty_wait_until_sent(tty, portp->closing_wait); @@ -1115,7 +1157,7 @@ static void stli_close(struct tty_struct *tty, struct file *filp) stli_flushbuffer(tty); tty->closing = 0; - portp->tty = NULL; + portp->tty = (struct tty_struct *) NULL; if (portp->openwaitcnt) { if (portp->close_delay) @@ -1125,6 +1167,7 @@ static void stli_close(struct tty_struct *tty, struct file *filp) portp->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); wake_up_interruptible(&portp->close_wait); + restore_flags(flags); } /*****************************************************************************/ @@ -1139,41 +1182,45 @@ static void stli_close(struct tty_struct *tty, struct file *filp) static int stli_initopen(stlibrd_t *brdp, stliport_t *portp) { - struct tty_struct *tty; - asynotify_t nt; - asyport_t aport; - int rc; + struct tty_struct *tty; + asynotify_t nt; + asyport_t aport; + int rc; + +#ifdef DEBUG + printk("stli_initopen(brdp=%x,portp=%x)\n", (int) brdp, (int) portp); +#endif if ((rc = stli_rawopen(brdp, portp, 0, 1)) < 0) - return rc; + return(rc); memset(&nt, 0, sizeof(asynotify_t)); nt.data = (DT_TXLOW | DT_TXEMPTY | DT_RXBUSY | DT_RXBREAK); nt.signal = SG_DCD; if ((rc = stli_cmdwait(brdp, portp, A_SETNOTIFY, &nt, sizeof(asynotify_t), 0)) < 0) - return rc; + return(rc); tty = portp->tty; - if (tty == NULL) - return -ENODEV; + if (tty == (struct tty_struct *) NULL) + return(-ENODEV); stli_mkasyport(portp, &aport, tty->termios); if ((rc = stli_cmdwait(brdp, portp, A_SETPORT, &aport, sizeof(asyport_t), 0)) < 0) - return rc; + return(rc); set_bit(ST_GETSIGS, &portp->state); if ((rc = stli_cmdwait(brdp, portp, A_GETSIGNALS, &portp->asig, sizeof(asysigs_t), 1)) < 0) - return rc; + return(rc); if (test_and_clear_bit(ST_GETSIGS, &portp->state)) portp->sigs = stli_mktiocm(portp->asig.sigvalue); stli_mkasysigs(&portp->asig, 1, 1); if ((rc = stli_cmdwait(brdp, portp, A_SETSIGNALS, &portp->asig, sizeof(asysigs_t), 0)) < 0) - return rc; + return(rc); - return 0; + return(0); } /*****************************************************************************/ @@ -1187,15 +1234,22 @@ static int stli_initopen(stlibrd_t *brdp, stliport_t *portp) static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, int wait) { - cdkhdr_t __iomem *hdrp; - cdkctrl_t __iomem *cp; - unsigned char __iomem *bits; - unsigned long flags; - int rc; + volatile cdkhdr_t *hdrp; + volatile cdkctrl_t *cp; + volatile unsigned char *bits; + unsigned long flags; + int rc; + +#ifdef DEBUG + printk("stli_rawopen(brdp=%x,portp=%x,arg=%x,wait=%d)\n", + (int) brdp, (int) portp, (int) arg, wait); +#endif /* * Send a message to the slave to open this port. */ + save_flags(flags); + cli(); /* * Slave is already closing this port. This can happen if a hangup @@ -1206,6 +1260,7 @@ static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, i wait_event_interruptible(portp->raw_wait, !test_bit(ST_CLOSING, &portp->state)); if (signal_pending(current)) { + restore_flags(flags); return -ERESTARTSYS; } @@ -1214,20 +1269,19 @@ static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, i * memory. Once the message is in set the service bits to say that * this port wants service. */ - spin_lock_irqsave(&brd_lock, flags); EBRDENABLE(brdp); - cp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl; - writel(arg, &cp->openarg); - writeb(1, &cp->open); - hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); - bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset + + cp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl; + cp->openarg = arg; + cp->open = 1; + hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); + bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset + portp->portidx; - writeb(readb(bits) | portp->portbit, bits); + *bits |= portp->portbit; EBRDDISABLE(brdp); if (wait == 0) { - spin_unlock_irqrestore(&brd_lock, flags); - return 0; + restore_flags(flags); + return(0); } /* @@ -1236,16 +1290,15 @@ static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, i */ rc = 0; set_bit(ST_OPENING, &portp->state); - spin_unlock_irqrestore(&brd_lock, flags); - wait_event_interruptible(portp->raw_wait, !test_bit(ST_OPENING, &portp->state)); if (signal_pending(current)) rc = -ERESTARTSYS; + restore_flags(flags); if ((rc == 0) && (portp->rc != 0)) rc = -EIO; - return rc; + return(rc); } /*****************************************************************************/ @@ -1258,11 +1311,19 @@ static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, i static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, int wait) { - cdkhdr_t __iomem *hdrp; - cdkctrl_t __iomem *cp; - unsigned char __iomem *bits; - unsigned long flags; - int rc; + volatile cdkhdr_t *hdrp; + volatile cdkctrl_t *cp; + volatile unsigned char *bits; + unsigned long flags; + int rc; + +#ifdef DEBUG + printk("stli_rawclose(brdp=%x,portp=%x,arg=%x,wait=%d)\n", + (int) brdp, (int) portp, (int) arg, wait); +#endif + + save_flags(flags); + cli(); /* * Slave is already closing this port. This can happen if a hangup @@ -1272,6 +1333,7 @@ static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, wait_event_interruptible(portp->raw_wait, !test_bit(ST_CLOSING, &portp->state)); if (signal_pending(current)) { + restore_flags(flags); return -ERESTARTSYS; } } @@ -1279,22 +1341,21 @@ static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, /* * Write the close command into shared memory. */ - spin_lock_irqsave(&brd_lock, flags); EBRDENABLE(brdp); - cp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl; - writel(arg, &cp->closearg); - writeb(1, &cp->close); - hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); - bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset + + cp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl; + cp->closearg = arg; + cp->close = 1; + hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); + bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset + portp->portidx; - writeb(readb(bits) |portp->portbit, bits); + *bits |= portp->portbit; EBRDDISABLE(brdp); set_bit(ST_CLOSING, &portp->state); - spin_unlock_irqrestore(&brd_lock, flags); - - if (wait == 0) - return 0; + if (wait == 0) { + restore_flags(flags); + return(0); + } /* * Slave is in action, so now we must wait for the open acknowledgment @@ -1305,10 +1366,11 @@ static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, !test_bit(ST_CLOSING, &portp->state)); if (signal_pending(current)) rc = -ERESTARTSYS; + restore_flags(flags); if ((rc == 0) && (portp->rc != 0)) rc = -EIO; - return rc; + return(rc); } /*****************************************************************************/ @@ -1322,21 +1384,36 @@ static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, static int stli_cmdwait(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback) { + unsigned long flags; + +#ifdef DEBUG + printk("stli_cmdwait(brdp=%x,portp=%x,cmd=%x,arg=%x,size=%d," + "copyback=%d)\n", (int) brdp, (int) portp, (int) cmd, + (int) arg, size, copyback); +#endif + + save_flags(flags); + cli(); wait_event_interruptible(portp->raw_wait, !test_bit(ST_CMDING, &portp->state)); - if (signal_pending(current)) + if (signal_pending(current)) { + restore_flags(flags); return -ERESTARTSYS; + } stli_sendcmd(brdp, portp, cmd, arg, size, copyback); wait_event_interruptible(portp->raw_wait, !test_bit(ST_CMDING, &portp->state)); - if (signal_pending(current)) + if (signal_pending(current)) { + restore_flags(flags); return -ERESTARTSYS; + } + restore_flags(flags); if (portp->rc != 0) - return -EIO; - return 0; + return(-EIO); + return(0); } /*****************************************************************************/ @@ -1348,18 +1425,22 @@ static int stli_cmdwait(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, v static int stli_setport(stliport_t *portp) { - stlibrd_t *brdp; - asyport_t aport; + stlibrd_t *brdp; + asyport_t aport; - if (portp == NULL) - return -ENODEV; - if (portp->tty == NULL) - return -ENODEV; - if (portp->brdnr < 0 && portp->brdnr >= stli_nrbrds) - return -ENODEV; +#ifdef DEBUG + printk("stli_setport(portp=%x)\n", (int) portp); +#endif + + if (portp == (stliport_t *) NULL) + return(-ENODEV); + if (portp->tty == (struct tty_struct *) NULL) + return(-ENODEV); + if ((portp->brdnr < 0) && (portp->brdnr >= stli_nrbrds)) + return(-ENODEV); brdp = stli_brds[portp->brdnr]; - if (brdp == NULL) - return -ENODEV; + if (brdp == (stlibrd_t *) NULL) + return(-ENODEV); stli_mkasyport(portp, &aport, portp->tty->termios); return(stli_cmdwait(brdp, portp, A_SETPORT, &aport, sizeof(asyport_t), 0)); @@ -1374,8 +1455,13 @@ static int stli_setport(stliport_t *portp) static int stli_waitcarrier(stlibrd_t *brdp, stliport_t *portp, struct file *filp) { - unsigned long flags; - int rc, doclocal; + unsigned long flags; + int rc, doclocal; + +#ifdef DEBUG + printk("stli_waitcarrier(brdp=%x,portp=%x,filp=%x)\n", + (int) brdp, (int) portp, (int) filp); +#endif rc = 0; doclocal = 0; @@ -1383,11 +1469,11 @@ static int stli_waitcarrier(stlibrd_t *brdp, stliport_t *portp, struct file *fil if (portp->tty->termios->c_cflag & CLOCAL) doclocal++; - spin_lock_irqsave(&stli_lock, flags); + save_flags(flags); + cli(); portp->openwaitcnt++; if (! tty_hung_up_p(filp)) portp->refcount--; - spin_unlock_irqrestore(&stli_lock, flags); for (;;) { stli_mkasysigs(&portp->asig, 1, 1); @@ -1413,13 +1499,12 @@ static int stli_waitcarrier(stlibrd_t *brdp, stliport_t *portp, struct file *fil interruptible_sleep_on(&portp->open_wait); } - spin_lock_irqsave(&stli_lock, flags); if (! tty_hung_up_p(filp)) portp->refcount++; portp->openwaitcnt--; - spin_unlock_irqrestore(&stli_lock, flags); + restore_flags(flags); - return rc; + return(rc); } /*****************************************************************************/ @@ -1432,38 +1517,46 @@ static int stli_waitcarrier(stlibrd_t *brdp, stliport_t *portp, struct file *fil static int stli_write(struct tty_struct *tty, const unsigned char *buf, int count) { - cdkasy_t __iomem *ap; - cdkhdr_t __iomem *hdrp; - unsigned char __iomem *bits; - unsigned char __iomem *shbuf; - unsigned char *chbuf; - stliport_t *portp; - stlibrd_t *brdp; - unsigned int len, stlen, head, tail, size; - unsigned long flags; + volatile cdkasy_t *ap; + volatile cdkhdr_t *hdrp; + volatile unsigned char *bits; + unsigned char *shbuf, *chbuf; + stliport_t *portp; + stlibrd_t *brdp; + unsigned int len, stlen, head, tail, size; + unsigned long flags; +#ifdef DEBUG + printk("stli_write(tty=%x,buf=%x,count=%d)\n", + (int) tty, (int) buf, count); +#endif + + if ((tty == (struct tty_struct *) NULL) || + (stli_tmpwritebuf == (char *) NULL)) + return(0); if (tty == stli_txcooktty) stli_flushchars(tty); portp = tty->driver_data; - if (portp == NULL) - return 0; + if (portp == (stliport_t *) NULL) + return(0); if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) - return 0; + return(0); brdp = stli_brds[portp->brdnr]; - if (brdp == NULL) - return 0; + if (brdp == (stlibrd_t *) NULL) + return(0); chbuf = (unsigned char *) buf; /* * All data is now local, shove as much as possible into shared memory. */ - spin_lock_irqsave(&brd_lock, flags); + save_flags(flags); + cli(); EBRDENABLE(brdp); - ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr); - head = (unsigned int) readw(&ap->txq.head); - tail = (unsigned int) readw(&ap->txq.tail); - if (tail != ((unsigned int) readw(&ap->txq.tail))) - tail = (unsigned int) readw(&ap->txq.tail); + ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr); + head = (unsigned int) ap->txq.head; + tail = (unsigned int) ap->txq.tail; + if (tail != ((unsigned int) ap->txq.tail)) + tail = (unsigned int) ap->txq.tail; size = portp->txsize; if (head >= tail) { len = size - (head - tail) - 1; @@ -1475,11 +1568,11 @@ static int stli_write(struct tty_struct *tty, const unsigned char *buf, int coun len = MIN(len, count); count = 0; - shbuf = (char __iomem *) EBRDGETMEMPTR(brdp, portp->txoffset); + shbuf = (char *) EBRDGETMEMPTR(brdp, portp->txoffset); while (len > 0) { stlen = MIN(len, stlen); - memcpy_toio(shbuf + head, chbuf, stlen); + memcpy((shbuf + head), chbuf, stlen); chbuf += stlen; len -= stlen; count += stlen; @@ -1490,19 +1583,20 @@ static int stli_write(struct tty_struct *tty, const unsigned char *buf, int coun } } - ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr); - writew(head, &ap->txq.head); + ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr); + ap->txq.head = head; if (test_bit(ST_TXBUSY, &portp->state)) { - if (readl(&ap->changed.data) & DT_TXEMPTY) - writel(readl(&ap->changed.data) & ~DT_TXEMPTY, &ap->changed.data); + if (ap->changed.data & DT_TXEMPTY) + ap->changed.data &= ~DT_TXEMPTY; } - hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); - bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset + + hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); + bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset + portp->portidx; - writeb(readb(bits) | portp->portbit, bits); + *bits |= portp->portbit; set_bit(ST_TXBUSY, &portp->state); EBRDDISABLE(brdp); - spin_unlock_irqrestore(&brd_lock, flags); + + restore_flags(flags); return(count); } @@ -1519,8 +1613,14 @@ static int stli_write(struct tty_struct *tty, const unsigned char *buf, int coun static void stli_putchar(struct tty_struct *tty, unsigned char ch) { +#ifdef DEBUG + printk("stli_putchar(tty=%x,ch=%x)\n", (int) tty, (int) ch); +#endif + + if (tty == (struct tty_struct *) NULL) + return; if (tty != stli_txcooktty) { - if (stli_txcooktty != NULL) + if (stli_txcooktty != (struct tty_struct *) NULL) stli_flushchars(stli_txcooktty); stli_txcooktty = tty; } @@ -1540,26 +1640,29 @@ static void stli_putchar(struct tty_struct *tty, unsigned char ch) static void stli_flushchars(struct tty_struct *tty) { - cdkhdr_t __iomem *hdrp; - unsigned char __iomem *bits; - cdkasy_t __iomem *ap; - struct tty_struct *cooktty; - stliport_t *portp; - stlibrd_t *brdp; - unsigned int len, stlen, head, tail, size, count, cooksize; - unsigned char *buf; - unsigned char __iomem *shbuf; - unsigned long flags; + volatile cdkhdr_t *hdrp; + volatile unsigned char *bits; + volatile cdkasy_t *ap; + struct tty_struct *cooktty; + stliport_t *portp; + stlibrd_t *brdp; + unsigned int len, stlen, head, tail, size, count, cooksize; + unsigned char *buf, *shbuf; + unsigned long flags; + +#ifdef DEBUG + printk("stli_flushchars(tty=%x)\n", (int) tty); +#endif cooksize = stli_txcooksize; cooktty = stli_txcooktty; stli_txcooksize = 0; stli_txcookrealsize = 0; - stli_txcooktty = NULL; + stli_txcooktty = (struct tty_struct *) NULL; - if (tty == NULL) + if (tty == (struct tty_struct *) NULL) return; - if (cooktty == NULL) + if (cooktty == (struct tty_struct *) NULL) return; if (tty != cooktty) tty = cooktty; @@ -1567,22 +1670,23 @@ static void stli_flushchars(struct tty_struct *tty) return; portp = tty->driver_data; - if (portp == NULL) + if (portp == (stliport_t *) NULL) return; if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) return; brdp = stli_brds[portp->brdnr]; - if (brdp == NULL) + if (brdp == (stlibrd_t *) NULL) return; - spin_lock_irqsave(&brd_lock, flags); + save_flags(flags); + cli(); EBRDENABLE(brdp); - ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr); - head = (unsigned int) readw(&ap->txq.head); - tail = (unsigned int) readw(&ap->txq.tail); - if (tail != ((unsigned int) readw(&ap->txq.tail))) - tail = (unsigned int) readw(&ap->txq.tail); + ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr); + head = (unsigned int) ap->txq.head; + tail = (unsigned int) ap->txq.tail; + if (tail != ((unsigned int) ap->txq.tail)) + tail = (unsigned int) ap->txq.tail; size = portp->txsize; if (head >= tail) { len = size - (head - tail) - 1; @@ -1599,7 +1703,7 @@ static void stli_flushchars(struct tty_struct *tty) while (len > 0) { stlen = MIN(len, stlen); - memcpy_toio(shbuf + head, buf, stlen); + memcpy((shbuf + head), buf, stlen); buf += stlen; len -= stlen; count += stlen; @@ -1610,66 +1714,73 @@ static void stli_flushchars(struct tty_struct *tty) } } - ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr); - writew(head, &ap->txq.head); + ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr); + ap->txq.head = head; if (test_bit(ST_TXBUSY, &portp->state)) { - if (readl(&ap->changed.data) & DT_TXEMPTY) - writel(readl(&ap->changed.data) & ~DT_TXEMPTY, &ap->changed.data); + if (ap->changed.data & DT_TXEMPTY) + ap->changed.data &= ~DT_TXEMPTY; } - hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); - bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset + + hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); + bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset + portp->portidx; - writeb(readb(bits) | portp->portbit, bits); + *bits |= portp->portbit; set_bit(ST_TXBUSY, &portp->state); EBRDDISABLE(brdp); - spin_unlock_irqrestore(&brd_lock, flags); + restore_flags(flags); } /*****************************************************************************/ static int stli_writeroom(struct tty_struct *tty) { - cdkasyrq_t __iomem *rp; - stliport_t *portp; - stlibrd_t *brdp; - unsigned int head, tail, len; - unsigned long flags; + volatile cdkasyrq_t *rp; + stliport_t *portp; + stlibrd_t *brdp; + unsigned int head, tail, len; + unsigned long flags; + +#ifdef DEBUG + printk("stli_writeroom(tty=%x)\n", (int) tty); +#endif + if (tty == (struct tty_struct *) NULL) + return(0); if (tty == stli_txcooktty) { if (stli_txcookrealsize != 0) { len = stli_txcookrealsize - stli_txcooksize; - return len; + return(len); } } portp = tty->driver_data; - if (portp == NULL) - return 0; + if (portp == (stliport_t *) NULL) + return(0); if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) - return 0; + return(0); brdp = stli_brds[portp->brdnr]; - if (brdp == NULL) - return 0; + if (brdp == (stlibrd_t *) NULL) + return(0); - spin_lock_irqsave(&brd_lock, flags); + save_flags(flags); + cli(); EBRDENABLE(brdp); - rp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->txq; - head = (unsigned int) readw(&rp->head); - tail = (unsigned int) readw(&rp->tail); - if (tail != ((unsigned int) readw(&rp->tail))) - tail = (unsigned int) readw(&rp->tail); + rp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->txq; + head = (unsigned int) rp->head; + tail = (unsigned int) rp->tail; + if (tail != ((unsigned int) rp->tail)) + tail = (unsigned int) rp->tail; len = (head >= tail) ? (portp->txsize - (head - tail)) : (tail - head); len--; EBRDDISABLE(brdp); - spin_unlock_irqrestore(&brd_lock, flags); + restore_flags(flags); if (tty == stli_txcooktty) { stli_txcookrealsize = len; len -= stli_txcooksize; } - return len; + return(len); } /*****************************************************************************/ @@ -1684,37 +1795,44 @@ static int stli_writeroom(struct tty_struct *tty) static int stli_charsinbuffer(struct tty_struct *tty) { - cdkasyrq_t __iomem *rp; - stliport_t *portp; - stlibrd_t *brdp; - unsigned int head, tail, len; - unsigned long flags; + volatile cdkasyrq_t *rp; + stliport_t *portp; + stlibrd_t *brdp; + unsigned int head, tail, len; + unsigned long flags; +#ifdef DEBUG + printk("stli_charsinbuffer(tty=%x)\n", (int) tty); +#endif + + if (tty == (struct tty_struct *) NULL) + return(0); if (tty == stli_txcooktty) stli_flushchars(tty); portp = tty->driver_data; - if (portp == NULL) - return 0; + if (portp == (stliport_t *) NULL) + return(0); if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) - return 0; + return(0); brdp = stli_brds[portp->brdnr]; - if (brdp == NULL) - return 0; + if (brdp == (stlibrd_t *) NULL) + return(0); - spin_lock_irqsave(&brd_lock, flags); + save_flags(flags); + cli(); EBRDENABLE(brdp); - rp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->txq; - head = (unsigned int) readw(&rp->head); - tail = (unsigned int) readw(&rp->tail); - if (tail != ((unsigned int) readw(&rp->tail))) - tail = (unsigned int) readw(&rp->tail); + rp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->txq; + head = (unsigned int) rp->head; + tail = (unsigned int) rp->tail; + if (tail != ((unsigned int) rp->tail)) + tail = (unsigned int) rp->tail; len = (head >= tail) ? (head - tail) : (portp->txsize - (tail - head)); if ((len == 0) && test_bit(ST_TXBUSY, &portp->state)) len = 1; EBRDDISABLE(brdp); - spin_unlock_irqrestore(&brd_lock, flags); + restore_flags(flags); - return len; + return(len); } /*****************************************************************************/ @@ -1725,8 +1843,12 @@ static int stli_charsinbuffer(struct tty_struct *tty) static int stli_getserial(stliport_t *portp, struct serial_struct __user *sp) { - struct serial_struct sio; - stlibrd_t *brdp; + struct serial_struct sio; + stlibrd_t *brdp; + +#ifdef DEBUG + printk("stli_getserial(portp=%x,sp=%x)\n", (int) portp, (int) sp); +#endif memset(&sio, 0, sizeof(struct serial_struct)); sio.type = PORT_UNKNOWN; @@ -1741,7 +1863,7 @@ static int stli_getserial(stliport_t *portp, struct serial_struct __user *sp) sio.hub6 = 0; brdp = stli_brds[portp->brdnr]; - if (brdp != NULL) + if (brdp != (stlibrd_t *) NULL) sio.port = brdp->iobase; return copy_to_user(sp, &sio, sizeof(struct serial_struct)) ? @@ -1758,8 +1880,12 @@ static int stli_getserial(stliport_t *portp, struct serial_struct __user *sp) static int stli_setserial(stliport_t *portp, struct serial_struct __user *sp) { - struct serial_struct sio; - int rc; + struct serial_struct sio; + int rc; + +#ifdef DEBUG + printk("stli_setserial(portp=%p,sp=%p)\n", portp, sp); +#endif if (copy_from_user(&sio, sp, sizeof(struct serial_struct))) return -EFAULT; @@ -1768,7 +1894,7 @@ static int stli_setserial(stliport_t *portp, struct serial_struct __user *sp) (sio.close_delay != portp->close_delay) || ((sio.flags & ~ASYNC_USR_MASK) != (portp->flags & ~ASYNC_USR_MASK))) - return -EPERM; + return(-EPERM); } portp->flags = (portp->flags & ~ASYNC_USR_MASK) | @@ -1779,8 +1905,8 @@ static int stli_setserial(stliport_t *portp, struct serial_struct __user *sp) portp->custom_divisor = sio.custom_divisor; if ((rc = stli_setport(portp)) < 0) - return rc; - return 0; + return(rc); + return(0); } /*****************************************************************************/ @@ -1791,19 +1917,19 @@ static int stli_tiocmget(struct tty_struct *tty, struct file *file) stlibrd_t *brdp; int rc; - if (portp == NULL) - return -ENODEV; - if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) - return 0; + if (portp == (stliport_t *) NULL) + return(-ENODEV); + if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) + return(0); brdp = stli_brds[portp->brdnr]; - if (brdp == NULL) - return 0; + if (brdp == (stlibrd_t *) NULL) + return(0); if (tty->flags & (1 << TTY_IO_ERROR)) - return -EIO; + return(-EIO); if ((rc = stli_cmdwait(brdp, portp, A_GETSIGNALS, &portp->asig, sizeof(asysigs_t), 1)) < 0) - return rc; + return(rc); return stli_mktiocm(portp->asig.sigvalue); } @@ -1815,15 +1941,15 @@ static int stli_tiocmset(struct tty_struct *tty, struct file *file, stlibrd_t *brdp; int rts = -1, dtr = -1; - if (portp == NULL) - return -ENODEV; - if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) - return 0; + if (portp == (stliport_t *) NULL) + return(-ENODEV); + if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) + return(0); brdp = stli_brds[portp->brdnr]; - if (brdp == NULL) - return 0; + if (brdp == (stlibrd_t *) NULL) + return(0); if (tty->flags & (1 << TTY_IO_ERROR)) - return -EIO; + return(-EIO); if (set & TIOCM_RTS) rts = 1; @@ -1842,25 +1968,32 @@ static int stli_tiocmset(struct tty_struct *tty, struct file *file, static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) { - stliport_t *portp; - stlibrd_t *brdp; - unsigned int ival; - int rc; + stliport_t *portp; + stlibrd_t *brdp; + unsigned int ival; + int rc; void __user *argp = (void __user *)arg; +#ifdef DEBUG + printk("stli_ioctl(tty=%x,file=%x,cmd=%x,arg=%x)\n", + (int) tty, (int) file, cmd, (int) arg); +#endif + + if (tty == (struct tty_struct *) NULL) + return(-ENODEV); portp = tty->driver_data; - if (portp == NULL) - return -ENODEV; - if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) - return 0; + if (portp == (stliport_t *) NULL) + return(-ENODEV); + if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) + return(0); brdp = stli_brds[portp->brdnr]; - if (brdp == NULL) - return 0; + if (brdp == (stlibrd_t *) NULL) + return(0); if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && (cmd != COM_GETPORTSTATS) && (cmd != COM_CLRPORTSTATS)) { if (tty->flags & (1 << TTY_IO_ERROR)) - return -EIO; + return(-EIO); } rc = 0; @@ -1907,7 +2040,7 @@ static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm break; } - return rc; + return(rc); } /*****************************************************************************/ @@ -1919,20 +2052,24 @@ static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm static void stli_settermios(struct tty_struct *tty, struct termios *old) { - stliport_t *portp; - stlibrd_t *brdp; - struct termios *tiosp; - asyport_t aport; + stliport_t *portp; + stlibrd_t *brdp; + struct termios *tiosp; + asyport_t aport; - if (tty == NULL) +#ifdef DEBUG + printk("stli_settermios(tty=%x,old=%x)\n", (int) tty, (int) old); +#endif + + if (tty == (struct tty_struct *) NULL) return; portp = tty->driver_data; - if (portp == NULL) + if (portp == (stliport_t *) NULL) return; - if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) + if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) return; brdp = stli_brds[portp->brdnr]; - if (brdp == NULL) + if (brdp == (stlibrd_t *) NULL) return; tiosp = tty->termios; @@ -1965,9 +2102,18 @@ static void stli_settermios(struct tty_struct *tty, struct termios *old) static void stli_throttle(struct tty_struct *tty) { - stliport_t *portp = tty->driver_data; - if (portp == NULL) + stliport_t *portp; + +#ifdef DEBUG + printk("stli_throttle(tty=%x)\n", (int) tty); +#endif + + if (tty == (struct tty_struct *) NULL) + return; + portp = tty->driver_data; + if (portp == (stliport_t *) NULL) return; + set_bit(ST_RXSTOP, &portp->state); } @@ -1981,30 +2127,88 @@ static void stli_throttle(struct tty_struct *tty) static void stli_unthrottle(struct tty_struct *tty) { - stliport_t *portp = tty->driver_data; - if (portp == NULL) + stliport_t *portp; + +#ifdef DEBUG + printk("stli_unthrottle(tty=%x)\n", (int) tty); +#endif + + if (tty == (struct tty_struct *) NULL) return; + portp = tty->driver_data; + if (portp == (stliport_t *) NULL) + return; + clear_bit(ST_RXSTOP, &portp->state); } /*****************************************************************************/ /* - * Stop the transmitter. + * Stop the transmitter. Basically to do this we will just turn TX + * interrupts off. */ static void stli_stop(struct tty_struct *tty) { + stlibrd_t *brdp; + stliport_t *portp; + asyctrl_t actrl; + +#ifdef DEBUG + printk("stli_stop(tty=%x)\n", (int) tty); +#endif + + if (tty == (struct tty_struct *) NULL) + return; + portp = tty->driver_data; + if (portp == (stliport_t *) NULL) + return; + if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) + return; + brdp = stli_brds[portp->brdnr]; + if (brdp == (stlibrd_t *) NULL) + return; + + memset(&actrl, 0, sizeof(asyctrl_t)); + actrl.txctrl = CT_STOPFLOW; +#if 0 + stli_cmdwait(brdp, portp, A_PORTCTRL, &actrl, sizeof(asyctrl_t), 0); +#endif } /*****************************************************************************/ /* - * Start the transmitter again. + * Start the transmitter again. Just turn TX interrupts back on. */ static void stli_start(struct tty_struct *tty) { + stliport_t *portp; + stlibrd_t *brdp; + asyctrl_t actrl; + +#ifdef DEBUG + printk("stli_start(tty=%x)\n", (int) tty); +#endif + + if (tty == (struct tty_struct *) NULL) + return; + portp = tty->driver_data; + if (portp == (stliport_t *) NULL) + return; + if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) + return; + brdp = stli_brds[portp->brdnr]; + if (brdp == (stlibrd_t *) NULL) + return; + + memset(&actrl, 0, sizeof(asyctrl_t)); + actrl.txctrl = CT_STARTFLOW; +#if 0 + stli_cmdwait(brdp, portp, A_PORTCTRL, &actrl, sizeof(asyctrl_t), 0); +#endif } /*****************************************************************************/ @@ -2020,9 +2224,22 @@ static void stli_start(struct tty_struct *tty) static void stli_dohangup(void *arg) { - stliport_t *portp = (stliport_t *) arg; - if (portp->tty != NULL) { - tty_hangup(portp->tty); + stliport_t *portp; + +#ifdef DEBUG + printk(KERN_DEBUG "stli_dohangup(portp=%x)\n", (int) arg); +#endif + + /* + * FIXME: There's a module removal race here: tty_hangup + * calls schedule_work which will call into this + * driver later. + */ + portp = (stliport_t *) arg; + if (portp != (stliport_t *) NULL) { + if (portp->tty != (struct tty_struct *) NULL) { + tty_hangup(portp->tty); + } } } @@ -2037,25 +2254,31 @@ static void stli_dohangup(void *arg) static void stli_hangup(struct tty_struct *tty) { - stliport_t *portp; - stlibrd_t *brdp; - unsigned long flags; + stliport_t *portp; + stlibrd_t *brdp; + unsigned long flags; + +#ifdef DEBUG + printk(KERN_DEBUG "stli_hangup(tty=%x)\n", (int) tty); +#endif + if (tty == (struct tty_struct *) NULL) + return; portp = tty->driver_data; - if (portp == NULL) + if (portp == (stliport_t *) NULL) return; - if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) + if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) return; brdp = stli_brds[portp->brdnr]; - if (brdp == NULL) + if (brdp == (stlibrd_t *) NULL) return; portp->flags &= ~ASYNC_INITIALIZED; - if (!test_bit(ST_CLOSING, &portp->state)) + save_flags(flags); + cli(); + if (! test_bit(ST_CLOSING, &portp->state)) stli_rawclose(brdp, portp, 0, 0); - - spin_lock_irqsave(&stli_lock, flags); if (tty->termios->c_cflag & HUPCL) { stli_mkasysigs(&portp->asig, 0, 0); if (test_bit(ST_CMDING, &portp->state)) { @@ -2067,15 +2290,14 @@ static void stli_hangup(struct tty_struct *tty) &portp->asig, sizeof(asysigs_t), 0); } } + restore_flags(flags); clear_bit(ST_TXBUSY, &portp->state); clear_bit(ST_RXSTOP, &portp->state); set_bit(TTY_IO_ERROR, &tty->flags); - portp->tty = NULL; + portp->tty = (struct tty_struct *) NULL; portp->flags &= ~ASYNC_NORMAL_ACTIVE; portp->refcount = 0; - spin_unlock_irqrestore(&stli_lock, flags); - wake_up_interruptible(&portp->open_wait); } @@ -2090,22 +2312,29 @@ static void stli_hangup(struct tty_struct *tty) static void stli_flushbuffer(struct tty_struct *tty) { - stliport_t *portp; - stlibrd_t *brdp; - unsigned long ftype, flags; + stliport_t *portp; + stlibrd_t *brdp; + unsigned long ftype, flags; + +#ifdef DEBUG + printk(KERN_DEBUG "stli_flushbuffer(tty=%x)\n", (int) tty); +#endif + if (tty == (struct tty_struct *) NULL) + return; portp = tty->driver_data; - if (portp == NULL) + if (portp == (stliport_t *) NULL) return; - if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) + if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) return; brdp = stli_brds[portp->brdnr]; - if (brdp == NULL) + if (brdp == (stlibrd_t *) NULL) return; - spin_lock_irqsave(&brd_lock, flags); + save_flags(flags); + cli(); if (tty == stli_txcooktty) { - stli_txcooktty = NULL; + stli_txcooktty = (struct tty_struct *) NULL; stli_txcooksize = 0; stli_txcookrealsize = 0; } @@ -2117,10 +2346,15 @@ static void stli_flushbuffer(struct tty_struct *tty) ftype |= FLUSHRX; clear_bit(ST_DOFLUSHRX, &portp->state); } - __stli_sendcmd(brdp, portp, A_FLUSH, &ftype, sizeof(u32), 0); + stli_sendcmd(brdp, portp, A_FLUSH, &ftype, + sizeof(unsigned long), 0); } - spin_unlock_irqrestore(&brd_lock, flags); - tty_wakeup(tty); + restore_flags(flags); + + wake_up_interruptible(&tty->write_wait); + if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && + tty->ldisc.write_wakeup) + (tty->ldisc.write_wakeup)(tty); } /*****************************************************************************/ @@ -2130,31 +2364,55 @@ static void stli_breakctl(struct tty_struct *tty, int state) stlibrd_t *brdp; stliport_t *portp; long arg; + /* long savestate, savetime; */ +#ifdef DEBUG + printk(KERN_DEBUG "stli_breakctl(tty=%x,state=%d)\n", (int) tty, state); +#endif + + if (tty == (struct tty_struct *) NULL) + return; portp = tty->driver_data; - if (portp == NULL) + if (portp == (stliport_t *) NULL) return; - if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) + if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) return; brdp = stli_brds[portp->brdnr]; - if (brdp == NULL) + if (brdp == (stlibrd_t *) NULL) return; +/* + * Due to a bug in the tty send_break() code we need to preserve + * the current process state and timeout... + savetime = current->timeout; + savestate = current->state; + */ + arg = (state == -1) ? BREAKON : BREAKOFF; stli_cmdwait(brdp, portp, A_BREAK, &arg, sizeof(long), 0); + +/* + * + current->timeout = savetime; + current->state = savestate; + */ } /*****************************************************************************/ static void stli_waituntilsent(struct tty_struct *tty, int timeout) { - stliport_t *portp; - unsigned long tend; + stliport_t *portp; + unsigned long tend; + +#ifdef DEBUG + printk(KERN_DEBUG "stli_waituntilsent(tty=%x,timeout=%x)\n", (int) tty, timeout); +#endif - if (tty == NULL) + if (tty == (struct tty_struct *) NULL) return; portp = tty->driver_data; - if (portp == NULL) + if (portp == (stliport_t *) NULL) return; if (timeout == 0) @@ -2178,13 +2436,19 @@ static void stli_sendxchar(struct tty_struct *tty, char ch) stliport_t *portp; asyctrl_t actrl; +#ifdef DEBUG + printk(KERN_DEBUG "stli_sendxchar(tty=%x,ch=%x)\n", (int) tty, ch); +#endif + + if (tty == (struct tty_struct *) NULL) + return; portp = tty->driver_data; - if (portp == NULL) + if (portp == (stliport_t *) NULL) return; - if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) + if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) return; brdp = stli_brds[portp->brdnr]; - if (brdp == NULL) + if (brdp == (stlibrd_t *) NULL) return; memset(&actrl, 0, sizeof(asyctrl_t)); @@ -2196,6 +2460,7 @@ static void stli_sendxchar(struct tty_struct *tty, char ch) actrl.txctrl = CT_SENDCHR; actrl.tximdch = ch; } + stli_cmdwait(brdp, portp, A_PORTCTRL, &actrl, sizeof(asyctrl_t), 0); } @@ -2211,17 +2476,17 @@ static void stli_sendxchar(struct tty_struct *tty, char ch) static int stli_portinfo(stlibrd_t *brdp, stliport_t *portp, int portnr, char *pos) { - char *sp, *uart; - int rc, cnt; + char *sp, *uart; + int rc, cnt; rc = stli_portcmdstats(portp); uart = "UNKNOWN"; if (brdp->state & BST_STARTED) { switch (stli_comstats.hwid) { - case 0: uart = "2681"; break; - case 1: uart = "SC26198"; break; - default:uart = "CD1400"; break; + case 0: uart = "2681"; break; + case 1: uart = "SC26198"; break; + default: uart = "CD1400"; break; } } @@ -2272,11 +2537,17 @@ static int stli_portinfo(stlibrd_t *brdp, stliport_t *portp, int portnr, char *p static int stli_readproc(char *page, char **start, off_t off, int count, int *eof, void *data) { - stlibrd_t *brdp; - stliport_t *portp; - int brdnr, portnr, totalport; - int curoff, maxoff; - char *pos; + stlibrd_t *brdp; + stliport_t *portp; + int brdnr, portnr, totalport; + int curoff, maxoff; + char *pos; + +#ifdef DEBUG + printk(KERN_DEBUG "stli_readproc(page=%x,start=%x,off=%x,count=%d,eof=%x," + "data=%x\n", (int) page, (int) start, (int) off, count, + (int) eof, (int) data); +#endif pos = page; totalport = 0; @@ -2297,7 +2568,7 @@ static int stli_readproc(char *page, char **start, off_t off, int count, int *eo */ for (brdnr = 0; (brdnr < stli_nrbrds); brdnr++) { brdp = stli_brds[brdnr]; - if (brdp == NULL) + if (brdp == (stlibrd_t *) NULL) continue; if (brdp->state == 0) continue; @@ -2312,7 +2583,7 @@ static int stli_readproc(char *page, char **start, off_t off, int count, int *eo for (portnr = 0; (portnr < brdp->nrports); portnr++, totalport++) { portp = brdp->ports[portnr]; - if (portp == NULL) + if (portp == (stliport_t *) NULL) continue; if (off >= (curoff += MAXLINE)) continue; @@ -2339,54 +2610,49 @@ static int stli_readproc(char *page, char **start, off_t off, int count, int *eo * a poll routine that does not have user context. Therefore you cannot * copy back directly into user space, or to the kernel stack of a * process. This routine does not sleep, so can be called from anywhere. - * - * The caller must hold the brd_lock (see also stli_sendcmd the usual - * entry point) */ -static void __stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback) +static void stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback) { - cdkhdr_t __iomem *hdrp; - cdkctrl_t __iomem *cp; - unsigned char __iomem *bits; - unsigned long flags; + volatile cdkhdr_t *hdrp; + volatile cdkctrl_t *cp; + volatile unsigned char *bits; + unsigned long flags; - spin_lock_irqsave(&brd_lock, flags); +#ifdef DEBUG + printk(KERN_DEBUG "stli_sendcmd(brdp=%x,portp=%x,cmd=%x,arg=%x,size=%d," + "copyback=%d)\n", (int) brdp, (int) portp, (int) cmd, + (int) arg, size, copyback); +#endif + + save_flags(flags); + cli(); if (test_bit(ST_CMDING, &portp->state)) { printk(KERN_ERR "STALLION: command already busy, cmd=%x!\n", (int) cmd); - spin_unlock_irqrestore(&brd_lock, flags); + restore_flags(flags); return; } EBRDENABLE(brdp); - cp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl; + cp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl; if (size > 0) { - memcpy_toio((void __iomem *) &(cp->args[0]), arg, size); + memcpy((void *) &(cp->args[0]), arg, size); if (copyback) { portp->argp = arg; portp->argsize = size; } } - writel(0, &cp->status); - writel(cmd, &cp->cmd); - hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); - bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset + + cp->status = 0; + cp->cmd = cmd; + hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); + bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset + portp->portidx; - writeb(readb(bits) | portp->portbit, bits); + *bits |= portp->portbit; set_bit(ST_CMDING, &portp->state); EBRDDISABLE(brdp); - spin_unlock_irqrestore(&brd_lock, flags); -} - -static void stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback) -{ - unsigned long flags; - - spin_lock_irqsave(&brd_lock, flags); - __stli_sendcmd(brdp, portp, cmd, arg, size, copyback); - spin_unlock_irqrestore(&brd_lock, flags); + restore_flags(flags); } /*****************************************************************************/ @@ -2401,23 +2667,28 @@ static void stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, static void stli_read(stlibrd_t *brdp, stliport_t *portp) { - cdkasyrq_t __iomem *rp; - char __iomem *shbuf; + volatile cdkasyrq_t *rp; + volatile char *shbuf; struct tty_struct *tty; - unsigned int head, tail, size; - unsigned int len, stlen; + unsigned int head, tail, size; + unsigned int len, stlen; + +#ifdef DEBUG + printk(KERN_DEBUG "stli_read(brdp=%x,portp=%d)\n", + (int) brdp, (int) portp); +#endif if (test_bit(ST_RXSTOP, &portp->state)) return; tty = portp->tty; - if (tty == NULL) + if (tty == (struct tty_struct *) NULL) return; - rp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->rxq; - head = (unsigned int) readw(&rp->head); - if (head != ((unsigned int) readw(&rp->head))) - head = (unsigned int) readw(&rp->head); - tail = (unsigned int) readw(&rp->tail); + rp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->rxq; + head = (unsigned int) rp->head; + if (head != ((unsigned int) rp->head)) + head = (unsigned int) rp->head; + tail = (unsigned int) rp->tail; size = portp->rxsize; if (head >= tail) { len = head - tail; @@ -2428,15 +2699,12 @@ static void stli_read(stlibrd_t *brdp, stliport_t *portp) } len = tty_buffer_request_room(tty, len); - - shbuf = (char __iomem *) EBRDGETMEMPTR(brdp, portp->rxoffset); + /* FIXME : iomap ? */ + shbuf = (volatile char *) EBRDGETMEMPTR(brdp, portp->rxoffset); while (len > 0) { - unsigned char *cptr; - stlen = MIN(len, stlen); - tty_prepare_flip_string(tty, &cptr, stlen); - memcpy_fromio(cptr, shbuf + tail, stlen); + tty_insert_flip_string(tty, (char *)(shbuf + tail), stlen); len -= stlen; tail += stlen; if (tail >= size) { @@ -2444,8 +2712,8 @@ static void stli_read(stlibrd_t *brdp, stliport_t *portp) stlen = head; } } - rp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->rxq; - writew(tail, &rp->tail); + rp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->rxq; + rp->tail = tail; if (head != tail) set_bit(ST_RXING, &portp->state); @@ -2461,9 +2729,9 @@ static void stli_read(stlibrd_t *brdp, stliport_t *portp) * difficult to deal with them here. */ -static void stli_dodelaycmd(stliport_t *portp, cdkctrl_t __iomem *cp) +static void stli_dodelaycmd(stliport_t *portp, volatile cdkctrl_t *cp) { - int cmd; + int cmd; if (test_bit(ST_DOSIGS, &portp->state)) { if (test_bit(ST_DOFLUSHTX, &portp->state) && @@ -2478,10 +2746,10 @@ static void stli_dodelaycmd(stliport_t *portp, cdkctrl_t __iomem *cp) clear_bit(ST_DOFLUSHTX, &portp->state); clear_bit(ST_DOFLUSHRX, &portp->state); clear_bit(ST_DOSIGS, &portp->state); - memcpy_toio((void __iomem *) &(cp->args[0]), (void *) &portp->asig, + memcpy((void *) &(cp->args[0]), (void *) &portp->asig, sizeof(asysigs_t)); - writel(0, &cp->status); - writel(cmd, &cp->cmd); + cp->status = 0; + cp->cmd = cmd; set_bit(ST_CMDING, &portp->state); } else if (test_bit(ST_DOFLUSHTX, &portp->state) || test_bit(ST_DOFLUSHRX, &portp->state)) { @@ -2489,9 +2757,9 @@ static void stli_dodelaycmd(stliport_t *portp, cdkctrl_t __iomem *cp) cmd |= ((test_bit(ST_DOFLUSHRX, &portp->state)) ? FLUSHRX : 0); clear_bit(ST_DOFLUSHTX, &portp->state); clear_bit(ST_DOFLUSHRX, &portp->state); - memcpy_toio((void __iomem *) &(cp->args[0]), (void *) &cmd, sizeof(int)); - writel(0, &cp->status); - writel(A_FLUSH, &cp->cmd); + memcpy((void *) &(cp->args[0]), (void *) &cmd, sizeof(int)); + cp->status = 0; + cp->cmd = A_FLUSH; set_bit(ST_CMDING, &portp->state); } } @@ -2511,25 +2779,30 @@ static void stli_dodelaycmd(stliport_t *portp, cdkctrl_t __iomem *cp) static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp) { - cdkasy_t __iomem *ap; - cdkctrl_t __iomem *cp; - struct tty_struct *tty; - asynotify_t nt; - unsigned long oldsigs; - int rc, donerx; - - ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr); + volatile cdkasy_t *ap; + volatile cdkctrl_t *cp; + struct tty_struct *tty; + asynotify_t nt; + unsigned long oldsigs; + int rc, donerx; + +#ifdef DEBUG + printk(KERN_DEBUG "stli_hostcmd(brdp=%x,channr=%d)\n", + (int) brdp, channr); +#endif + + ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr); cp = &ap->ctrl; /* * Check if we are waiting for an open completion message. */ if (test_bit(ST_OPENING, &portp->state)) { - rc = readl(&cp->openarg); - if (readb(&cp->open) == 0 && rc != 0) { + rc = (int) cp->openarg; + if ((cp->open == 0) && (rc != 0)) { if (rc > 0) rc--; - writel(0, &cp->openarg); + cp->openarg = 0; portp->rc = rc; clear_bit(ST_OPENING, &portp->state); wake_up_interruptible(&portp->raw_wait); @@ -2540,11 +2813,11 @@ static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp) * Check if we are waiting for a close completion message. */ if (test_bit(ST_CLOSING, &portp->state)) { - rc = (int) readl(&cp->closearg); - if (readb(&cp->close) == 0 && rc != 0) { + rc = (int) cp->closearg; + if ((cp->close == 0) && (rc != 0)) { if (rc > 0) rc--; - writel(0, &cp->closearg); + cp->closearg = 0; portp->rc = rc; clear_bit(ST_CLOSING, &portp->state); wake_up_interruptible(&portp->raw_wait); @@ -2556,16 +2829,16 @@ static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp) * need to copy out the command results associated with this command. */ if (test_bit(ST_CMDING, &portp->state)) { - rc = readl(&cp->status); - if (readl(&cp->cmd) == 0 && rc != 0) { + rc = cp->status; + if ((cp->cmd == 0) && (rc != 0)) { if (rc > 0) rc--; - if (portp->argp != NULL) { - memcpy_fromio(portp->argp, (void __iomem *) &(cp->args[0]), + if (portp->argp != (void *) NULL) { + memcpy(portp->argp, (void *) &(cp->args[0]), portp->argsize); - portp->argp = NULL; + portp->argp = (void *) NULL; } - writel(0, &cp->status); + cp->status = 0; portp->rc = rc; clear_bit(ST_CMDING, &portp->state); stli_dodelaycmd(portp, cp); @@ -2604,15 +2877,18 @@ static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp) if (nt.data & DT_TXEMPTY) clear_bit(ST_TXBUSY, &portp->state); if (nt.data & (DT_TXEMPTY | DT_TXLOW)) { - if (tty != NULL) { - tty_wakeup(tty); - EBRDENABLE(brdp); + if (tty != (struct tty_struct *) NULL) { + if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && + tty->ldisc.write_wakeup) { + (tty->ldisc.write_wakeup)(tty); + EBRDENABLE(brdp); + } wake_up_interruptible(&tty->write_wait); } } if ((nt.data & DT_RXBREAK) && (portp->rxmarkmsk & BRKINT)) { - if (tty != NULL) { + if (tty != (struct tty_struct *) NULL) { tty_insert_flip_char(tty, 0, TTY_BREAK); if (portp->flags & ASYNC_SAK) { do_SAK(tty); @@ -2656,14 +2932,14 @@ static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp) * at the cdk header structure. */ -static void stli_brdpoll(stlibrd_t *brdp, cdkhdr_t __iomem *hdrp) +static void stli_brdpoll(stlibrd_t *brdp, volatile cdkhdr_t *hdrp) { - stliport_t *portp; - unsigned char hostbits[(STL_MAXCHANS / 8) + 1]; - unsigned char slavebits[(STL_MAXCHANS / 8) + 1]; - unsigned char __iomem *slavep; - int bitpos, bitat, bitsize; - int channr, nrdevs, slavebitchange; + stliport_t *portp; + unsigned char hostbits[(STL_MAXCHANS / 8) + 1]; + unsigned char slavebits[(STL_MAXCHANS / 8) + 1]; + unsigned char *slavep; + int bitpos, bitat, bitsize; + int channr, nrdevs, slavebitchange; bitsize = brdp->bitsize; nrdevs = brdp->nrdevs; @@ -2675,7 +2951,7 @@ static void stli_brdpoll(stlibrd_t *brdp, cdkhdr_t __iomem *hdrp) * 8 service bits at a time in the inner loop, so we can bypass * the lot if none of them want service. */ - memcpy_fromio(&hostbits[0], (((unsigned char __iomem *) hdrp) + brdp->hostoffset), + memcpy(&hostbits[0], (((unsigned char *) hdrp) + brdp->hostoffset), bitsize); memset(&slavebits[0], 0, bitsize); @@ -2702,11 +2978,11 @@ static void stli_brdpoll(stlibrd_t *brdp, cdkhdr_t __iomem *hdrp) * service may initiate more slave requests. */ if (slavebitchange) { - hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); - slavep = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset; + hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); + slavep = ((unsigned char *) hdrp) + brdp->slaveoffset; for (bitpos = 0; (bitpos < bitsize); bitpos++) { - if (readb(slavebits + bitpos)) - writeb(readb(slavep + bitpos) & ~slavebits[bitpos], slavebits + bitpos); + if (slavebits[bitpos]) + slavep[bitpos] &= ~slavebits[bitpos]; } } } @@ -2724,9 +3000,9 @@ static void stli_brdpoll(stlibrd_t *brdp, cdkhdr_t __iomem *hdrp) static void stli_poll(unsigned long arg) { - cdkhdr_t __iomem *hdrp; - stlibrd_t *brdp; - int brdnr; + volatile cdkhdr_t *hdrp; + stlibrd_t *brdp; + int brdnr; stli_timerlist.expires = STLI_TIMEOUT; add_timer(&stli_timerlist); @@ -2736,18 +3012,16 @@ static void stli_poll(unsigned long arg) */ for (brdnr = 0; (brdnr < stli_nrbrds); brdnr++) { brdp = stli_brds[brdnr]; - if (brdp == NULL) + if (brdp == (stlibrd_t *) NULL) continue; if ((brdp->state & BST_STARTED) == 0) continue; - spin_lock(&brd_lock); EBRDENABLE(brdp); - hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); - if (readb(&hdrp->hostreq)) + hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); + if (hdrp->hostreq) stli_brdpoll(brdp, hdrp); EBRDDISABLE(brdp); - spin_unlock(&brd_lock); } } @@ -2760,6 +3034,11 @@ static void stli_poll(unsigned long arg) static void stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tiosp) { +#ifdef DEBUG + printk(KERN_DEBUG "stli_mkasyport(portp=%x,pp=%x,tiosp=%d)\n", + (int) portp, (int) pp, (int) tiosp); +#endif + memset(pp, 0, sizeof(asyport_t)); /* @@ -2878,6 +3157,11 @@ static void stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tio static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts) { +#ifdef DEBUG + printk(KERN_DEBUG "stli_mkasysigs(sp=%x,dtr=%d,rts=%d)\n", + (int) sp, dtr, rts); +#endif + memset(sp, 0, sizeof(asysigs_t)); if (dtr >= 0) { sp->signal |= SG_DTR; @@ -2898,7 +3182,13 @@ static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts) static long stli_mktiocm(unsigned long sigvalue) { - long tiocm = 0; + long tiocm; + +#ifdef DEBUG + printk(KERN_DEBUG "stli_mktiocm(sigvalue=%x)\n", (int) sigvalue); +#endif + + tiocm = 0; tiocm |= ((sigvalue & SG_DCD) ? TIOCM_CD : 0); tiocm |= ((sigvalue & SG_CTS) ? TIOCM_CTS : 0); tiocm |= ((sigvalue & SG_RI) ? TIOCM_RI : 0); @@ -2920,6 +3210,10 @@ static int stli_initports(stlibrd_t *brdp) stliport_t *portp; int i, panelnr, panelport; +#ifdef DEBUG + printk(KERN_DEBUG "stli_initports(brdp=%x)\n", (int) brdp); +#endif + for (i = 0, panelnr = 0, panelport = 0; (i < brdp->nrports); i++) { portp = kzalloc(sizeof(stliport_t), GFP_KERNEL); if (!portp) { @@ -2946,7 +3240,7 @@ static int stli_initports(stlibrd_t *brdp) brdp->ports[i] = portp; } - return 0; + return(0); } /*****************************************************************************/ @@ -2959,6 +3253,10 @@ static void stli_ecpinit(stlibrd_t *brdp) { unsigned long memconf; +#ifdef DEBUG + printk(KERN_DEBUG "stli_ecpinit(brdp=%d)\n", (int) brdp); +#endif + outb(ECP_ATSTOP, (brdp->iobase + ECP_ATCONFR)); udelay(10); outb(ECP_ATDISABLE, (brdp->iobase + ECP_ATCONFR)); @@ -2972,6 +3270,9 @@ static void stli_ecpinit(stlibrd_t *brdp) static void stli_ecpenable(stlibrd_t *brdp) { +#ifdef DEBUG + printk(KERN_DEBUG "stli_ecpenable(brdp=%x)\n", (int) brdp); +#endif outb(ECP_ATENABLE, (brdp->iobase + ECP_ATCONFR)); } @@ -2979,6 +3280,9 @@ static void stli_ecpenable(stlibrd_t *brdp) static void stli_ecpdisable(stlibrd_t *brdp) { +#ifdef DEBUG + printk(KERN_DEBUG "stli_ecpdisable(brdp=%x)\n", (int) brdp); +#endif outb(ECP_ATDISABLE, (brdp->iobase + ECP_ATCONFR)); } @@ -2986,8 +3290,13 @@ static void stli_ecpdisable(stlibrd_t *brdp) static char *stli_ecpgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) { - void *ptr; - unsigned char val; + void *ptr; + unsigned char val; + +#ifdef DEBUG + printk(KERN_DEBUG "stli_ecpgetmemptr(brdp=%x,offset=%x)\n", (int) brdp, + (int) offset); +#endif if (offset > brdp->memsize) { printk(KERN_ERR "STALLION: shared memory pointer=%x out of " @@ -3007,6 +3316,10 @@ static char *stli_ecpgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) static void stli_ecpreset(stlibrd_t *brdp) { +#ifdef DEBUG + printk(KERN_DEBUG "stli_ecpreset(brdp=%x)\n", (int) brdp); +#endif + outb(ECP_ATSTOP, (brdp->iobase + ECP_ATCONFR)); udelay(10); outb(ECP_ATDISABLE, (brdp->iobase + ECP_ATCONFR)); @@ -3017,6 +3330,9 @@ static void stli_ecpreset(stlibrd_t *brdp) static void stli_ecpintr(stlibrd_t *brdp) { +#ifdef DEBUG + printk(KERN_DEBUG "stli_ecpintr(brdp=%x)\n", (int) brdp); +#endif outb(0x1, brdp->iobase); } @@ -3030,6 +3346,10 @@ static void stli_ecpeiinit(stlibrd_t *brdp) { unsigned long memconf; +#ifdef DEBUG + printk(KERN_DEBUG "stli_ecpeiinit(brdp=%x)\n", (int) brdp); +#endif + outb(0x1, (brdp->iobase + ECP_EIBRDENAB)); outb(ECP_EISTOP, (brdp->iobase + ECP_EICONFR)); udelay(10); @@ -3063,6 +3383,11 @@ static char *stli_ecpeigetmemptr(stlibrd_t *brdp, unsigned long offset, int line void *ptr; unsigned char val; +#ifdef DEBUG + printk(KERN_DEBUG "stli_ecpeigetmemptr(brdp=%x,offset=%x,line=%d)\n", + (int) brdp, (int) offset, line); +#endif + if (offset > brdp->memsize) { printk(KERN_ERR "STALLION: shared memory pointer=%x out of " "range at line=%d(%d), brd=%d\n", @@ -3112,8 +3437,8 @@ static void stli_ecpmcdisable(stlibrd_t *brdp) static char *stli_ecpmcgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) { - void *ptr; - unsigned char val; + void *ptr; + unsigned char val; if (offset > brdp->memsize) { printk(KERN_ERR "STALLION: shared memory pointer=%x out of " @@ -3147,6 +3472,10 @@ static void stli_ecpmcreset(stlibrd_t *brdp) static void stli_ecppciinit(stlibrd_t *brdp) { +#ifdef DEBUG + printk(KERN_DEBUG "stli_ecppciinit(brdp=%x)\n", (int) brdp); +#endif + outb(ECP_PCISTOP, (brdp->iobase + ECP_PCICONFR)); udelay(10); outb(0, (brdp->iobase + ECP_PCICONFR)); @@ -3160,6 +3489,11 @@ static char *stli_ecppcigetmemptr(stlibrd_t *brdp, unsigned long offset, int lin void *ptr; unsigned char val; +#ifdef DEBUG + printk(KERN_DEBUG "stli_ecppcigetmemptr(brdp=%x,offset=%x,line=%d)\n", + (int) brdp, (int) offset, line); +#endif + if (offset > brdp->memsize) { printk(KERN_ERR "STALLION: shared memory pointer=%x out of " "range at line=%d(%d), board=%d\n", @@ -3194,6 +3528,10 @@ static void stli_onbinit(stlibrd_t *brdp) { unsigned long memconf; +#ifdef DEBUG + printk(KERN_DEBUG "stli_onbinit(brdp=%d)\n", (int) brdp); +#endif + outb(ONB_ATSTOP, (brdp->iobase + ONB_ATCONFR)); udelay(10); outb(ONB_ATDISABLE, (brdp->iobase + ONB_ATCONFR)); @@ -3209,6 +3547,9 @@ static void stli_onbinit(stlibrd_t *brdp) static void stli_onbenable(stlibrd_t *brdp) { +#ifdef DEBUG + printk(KERN_DEBUG "stli_onbenable(brdp=%x)\n", (int) brdp); +#endif outb((brdp->enabval | ONB_ATENABLE), (brdp->iobase + ONB_ATCONFR)); } @@ -3216,6 +3557,9 @@ static void stli_onbenable(stlibrd_t *brdp) static void stli_onbdisable(stlibrd_t *brdp) { +#ifdef DEBUG + printk(KERN_DEBUG "stli_onbdisable(brdp=%x)\n", (int) brdp); +#endif outb((brdp->enabval | ONB_ATDISABLE), (brdp->iobase + ONB_ATCONFR)); } @@ -3225,6 +3569,11 @@ static char *stli_onbgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) { void *ptr; +#ifdef DEBUG + printk(KERN_DEBUG "stli_onbgetmemptr(brdp=%x,offset=%x)\n", (int) brdp, + (int) offset); +#endif + if (offset > brdp->memsize) { printk(KERN_ERR "STALLION: shared memory pointer=%x out of " "range at line=%d(%d), brd=%d\n", @@ -3240,6 +3589,11 @@ static char *stli_onbgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) static void stli_onbreset(stlibrd_t *brdp) { + +#ifdef DEBUG + printk(KERN_DEBUG "stli_onbreset(brdp=%x)\n", (int) brdp); +#endif + outb(ONB_ATSTOP, (brdp->iobase + ONB_ATCONFR)); udelay(10); outb(ONB_ATDISABLE, (brdp->iobase + ONB_ATCONFR)); @@ -3256,6 +3610,10 @@ static void stli_onbeinit(stlibrd_t *brdp) { unsigned long memconf; +#ifdef DEBUG + printk(KERN_DEBUG "stli_onbeinit(brdp=%d)\n", (int) brdp); +#endif + outb(0x1, (brdp->iobase + ONB_EIBRDENAB)); outb(ONB_EISTOP, (brdp->iobase + ONB_EICONFR)); udelay(10); @@ -3274,6 +3632,9 @@ static void stli_onbeinit(stlibrd_t *brdp) static void stli_onbeenable(stlibrd_t *brdp) { +#ifdef DEBUG + printk(KERN_DEBUG "stli_onbeenable(brdp=%x)\n", (int) brdp); +#endif outb(ONB_EIENABLE, (brdp->iobase + ONB_EICONFR)); } @@ -3281,6 +3642,9 @@ static void stli_onbeenable(stlibrd_t *brdp) static void stli_onbedisable(stlibrd_t *brdp) { +#ifdef DEBUG + printk(KERN_DEBUG "stli_onbedisable(brdp=%x)\n", (int) brdp); +#endif outb(ONB_EIDISABLE, (brdp->iobase + ONB_EICONFR)); } @@ -3288,8 +3652,13 @@ static void stli_onbedisable(stlibrd_t *brdp) static char *stli_onbegetmemptr(stlibrd_t *brdp, unsigned long offset, int line) { - void *ptr; - unsigned char val; + void *ptr; + unsigned char val; + +#ifdef DEBUG + printk(KERN_DEBUG "stli_onbegetmemptr(brdp=%x,offset=%x,line=%d)\n", + (int) brdp, (int) offset, line); +#endif if (offset > brdp->memsize) { printk(KERN_ERR "STALLION: shared memory pointer=%x out of " @@ -3312,6 +3681,11 @@ static char *stli_onbegetmemptr(stlibrd_t *brdp, unsigned long offset, int line) static void stli_onbereset(stlibrd_t *brdp) { + +#ifdef DEBUG + printk(KERN_ERR "stli_onbereset(brdp=%x)\n", (int) brdp); +#endif + outb(ONB_EISTOP, (brdp->iobase + ONB_EICONFR)); udelay(10); outb(ONB_EIDISABLE, (brdp->iobase + ONB_EICONFR)); @@ -3326,6 +3700,11 @@ static void stli_onbereset(stlibrd_t *brdp) static void stli_bbyinit(stlibrd_t *brdp) { + +#ifdef DEBUG + printk(KERN_ERR "stli_bbyinit(brdp=%d)\n", (int) brdp); +#endif + outb(BBY_ATSTOP, (brdp->iobase + BBY_ATCONFR)); udelay(10); outb(0, (brdp->iobase + BBY_ATCONFR)); @@ -3338,13 +3717,24 @@ static void stli_bbyinit(stlibrd_t *brdp) static char *stli_bbygetmemptr(stlibrd_t *brdp, unsigned long offset, int line) { - void *ptr; - unsigned char val; + void *ptr; + unsigned char val; - BUG_ON(offset > brdp->memsize); +#ifdef DEBUG + printk(KERN_ERR "stli_bbygetmemptr(brdp=%x,offset=%x)\n", (int) brdp, + (int) offset); +#endif - ptr = brdp->membase + (offset % BBY_PAGESIZE); - val = (unsigned char) (offset / BBY_PAGESIZE); + if (offset > brdp->memsize) { + printk(KERN_ERR "STALLION: shared memory pointer=%x out of " + "range at line=%d(%d), brd=%d\n", + (int) offset, line, __LINE__, brdp->brdnr); + ptr = NULL; + val = 0; + } else { + ptr = brdp->membase + (offset % BBY_PAGESIZE); + val = (unsigned char) (offset / BBY_PAGESIZE); + } outb(val, (brdp->iobase + BBY_ATCONFR)); return(ptr); } @@ -3353,6 +3743,11 @@ static char *stli_bbygetmemptr(stlibrd_t *brdp, unsigned long offset, int line) static void stli_bbyreset(stlibrd_t *brdp) { + +#ifdef DEBUG + printk(KERN_DEBUG "stli_bbyreset(brdp=%x)\n", (int) brdp); +#endif + outb(BBY_ATSTOP, (brdp->iobase + BBY_ATCONFR)); udelay(10); outb(0, (brdp->iobase + BBY_ATCONFR)); @@ -3367,6 +3762,11 @@ static void stli_bbyreset(stlibrd_t *brdp) static void stli_stalinit(stlibrd_t *brdp) { + +#ifdef DEBUG + printk(KERN_DEBUG "stli_stalinit(brdp=%d)\n", (int) brdp); +#endif + outb(0x1, brdp->iobase); mdelay(1000); } @@ -3375,18 +3775,36 @@ static void stli_stalinit(stlibrd_t *brdp) static char *stli_stalgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) { - BUG_ON(offset > brdp->memsize); - return brdp->membase + (offset % STAL_PAGESIZE); + void *ptr; + +#ifdef DEBUG + printk(KERN_DEBUG "stli_stalgetmemptr(brdp=%x,offset=%x)\n", (int) brdp, + (int) offset); +#endif + + if (offset > brdp->memsize) { + printk(KERN_ERR "STALLION: shared memory pointer=%x out of " + "range at line=%d(%d), brd=%d\n", + (int) offset, line, __LINE__, brdp->brdnr); + ptr = NULL; + } else { + ptr = brdp->membase + (offset % STAL_PAGESIZE); + } + return(ptr); } /*****************************************************************************/ static void stli_stalreset(stlibrd_t *brdp) { - u32 __iomem *vecp; + volatile unsigned long *vecp; - vecp = (u32 __iomem *) (brdp->membase + 0x30); - writel(0xffff0000, vecp); +#ifdef DEBUG + printk(KERN_DEBUG "stli_stalreset(brdp=%x)\n", (int) brdp); +#endif + + vecp = (volatile unsigned long *) (brdp->membase + 0x30); + *vecp = 0xffff0000; outb(0, brdp->iobase); mdelay(1000); } @@ -3400,11 +3818,15 @@ static void stli_stalreset(stlibrd_t *brdp) static int stli_initecp(stlibrd_t *brdp) { - cdkecpsig_t sig; - cdkecpsig_t __iomem *sigsp; - unsigned int status, nxtid; - char *name; - int panelnr, nrports; + cdkecpsig_t sig; + cdkecpsig_t *sigsp; + unsigned int status, nxtid; + char *name; + int panelnr, nrports; + +#ifdef DEBUG + printk(KERN_DEBUG "stli_initecp(brdp=%x)\n", (int) brdp); +#endif if (!request_region(brdp->iobase, brdp->iosize, "istallion")) return -EIO; @@ -3412,7 +3834,7 @@ static int stli_initecp(stlibrd_t *brdp) if ((brdp->iobase == 0) || (brdp->memaddr == 0)) { release_region(brdp->iobase, brdp->iosize); - return -ENODEV; + return(-ENODEV); } brdp->iosize = ECP_IOSIZE; @@ -3481,7 +3903,7 @@ static int stli_initecp(stlibrd_t *brdp) default: release_region(brdp->iobase, brdp->iosize); - return -EINVAL; + return(-EINVAL); } /* @@ -3493,10 +3915,10 @@ static int stli_initecp(stlibrd_t *brdp) EBRDINIT(brdp); brdp->membase = ioremap(brdp->memaddr, brdp->memsize); - if (brdp->membase == NULL) + if (brdp->membase == (void *) NULL) { release_region(brdp->iobase, brdp->iosize); - return -ENOMEM; + return(-ENOMEM); } /* @@ -3505,14 +3927,23 @@ static int stli_initecp(stlibrd_t *brdp) * this is, and what it is connected to it. */ EBRDENABLE(brdp); - sigsp = (cdkecpsig_t __iomem *) EBRDGETMEMPTR(brdp, CDK_SIGADDR); + sigsp = (cdkecpsig_t *) EBRDGETMEMPTR(brdp, CDK_SIGADDR); memcpy(&sig, sigsp, sizeof(cdkecpsig_t)); EBRDDISABLE(brdp); - if (sig.magic != cpu_to_le32(ECP_MAGIC)) +#if 0 + printk("%s(%d): sig-> magic=%x rom=%x panel=%x,%x,%x,%x,%x,%x,%x,%x\n", + __FILE__, __LINE__, (int) sig.magic, sig.romver, sig.panelid[0], + (int) sig.panelid[1], (int) sig.panelid[2], + (int) sig.panelid[3], (int) sig.panelid[4], + (int) sig.panelid[5], (int) sig.panelid[6], + (int) sig.panelid[7]); +#endif + + if (sig.magic != ECP_MAGIC) { release_region(brdp->iobase, brdp->iosize); - return -ENODEV; + return(-ENODEV); } /* @@ -3536,7 +3967,7 @@ static int stli_initecp(stlibrd_t *brdp) brdp->state |= BST_FOUND; - return 0; + return(0); } /*****************************************************************************/ @@ -3548,16 +3979,20 @@ static int stli_initecp(stlibrd_t *brdp) static int stli_initonb(stlibrd_t *brdp) { - cdkonbsig_t sig; - cdkonbsig_t __iomem *sigsp; - char *name; - int i; + cdkonbsig_t sig; + cdkonbsig_t *sigsp; + char *name; + int i; + +#ifdef DEBUG + printk(KERN_DEBUG "stli_initonb(brdp=%x)\n", (int) brdp); +#endif /* * Do a basic sanity check on the IO and memory addresses. */ - if (brdp->iobase == 0 || brdp->memaddr == 0) - return -ENODEV; + if ((brdp->iobase == 0) || (brdp->memaddr == 0)) + return(-ENODEV); brdp->iosize = ONB_IOSIZE; @@ -3575,6 +4010,7 @@ static int stli_initonb(stlibrd_t *brdp) case BRD_ONBOARD2: case BRD_ONBOARD2_32: case BRD_ONBOARDRS: + brdp->membase = (void *) brdp->memaddr; brdp->memsize = ONB_MEMSIZE; brdp->pagesize = ONB_ATPAGESIZE; brdp->init = stli_onbinit; @@ -3592,6 +4028,7 @@ static int stli_initonb(stlibrd_t *brdp) break; case BRD_ONBOARDE: + brdp->membase = (void *) brdp->memaddr; brdp->memsize = ONB_EIMEMSIZE; brdp->pagesize = ONB_EIPAGESIZE; brdp->init = stli_onbeinit; @@ -3607,6 +4044,7 @@ static int stli_initonb(stlibrd_t *brdp) case BRD_BRUMBY4: case BRD_BRUMBY8: case BRD_BRUMBY16: + brdp->membase = (void *) brdp->memaddr; brdp->memsize = BBY_MEMSIZE; brdp->pagesize = BBY_PAGESIZE; brdp->init = stli_bbyinit; @@ -3620,6 +4058,7 @@ static int stli_initonb(stlibrd_t *brdp) break; case BRD_STALLION: + brdp->membase = (void *) brdp->memaddr; brdp->memsize = STAL_MEMSIZE; brdp->pagesize = STAL_PAGESIZE; brdp->init = stli_stalinit; @@ -3634,7 +4073,7 @@ static int stli_initonb(stlibrd_t *brdp) default: release_region(brdp->iobase, brdp->iosize); - return -EINVAL; + return(-EINVAL); } /* @@ -3646,10 +4085,10 @@ static int stli_initonb(stlibrd_t *brdp) EBRDINIT(brdp); brdp->membase = ioremap(brdp->memaddr, brdp->memsize); - if (brdp->membase == NULL) + if (brdp->membase == (void *) NULL) { release_region(brdp->iobase, brdp->iosize); - return -ENOMEM; + return(-ENOMEM); } /* @@ -3658,17 +4097,21 @@ static int stli_initonb(stlibrd_t *brdp) * this is, and how many ports. */ EBRDENABLE(brdp); - sigsp = (cdkonbsig_t __iomem *) EBRDGETMEMPTR(brdp, CDK_SIGADDR); - memcpy_fromio(&sig, sigsp, sizeof(cdkonbsig_t)); + sigsp = (cdkonbsig_t *) EBRDGETMEMPTR(brdp, CDK_SIGADDR); + memcpy(&sig, sigsp, sizeof(cdkonbsig_t)); EBRDDISABLE(brdp); - if (sig.magic0 != cpu_to_le16(ONB_MAGIC0) || - sig.magic1 != cpu_to_le16(ONB_MAGIC1) || - sig.magic2 != cpu_to_le16(ONB_MAGIC2) || - sig.magic3 != cpu_to_le16(ONB_MAGIC3)) +#if 0 + printk("%s(%d): sig-> magic=%x:%x:%x:%x romver=%x amask=%x:%x:%x\n", + __FILE__, __LINE__, sig.magic0, sig.magic1, sig.magic2, + sig.magic3, sig.romver, sig.amask0, sig.amask1, sig.amask2); +#endif + + if ((sig.magic0 != ONB_MAGIC0) || (sig.magic1 != ONB_MAGIC1) || + (sig.magic2 != ONB_MAGIC2) || (sig.magic3 != ONB_MAGIC3)) { release_region(brdp->iobase, brdp->iosize); - return -ENODEV; + return(-ENODEV); } /* @@ -3689,7 +4132,7 @@ static int stli_initonb(stlibrd_t *brdp) brdp->state |= BST_FOUND; - return 0; + return(0); } /*****************************************************************************/ @@ -3702,25 +4145,31 @@ static int stli_initonb(stlibrd_t *brdp) static int stli_startbrd(stlibrd_t *brdp) { - cdkhdr_t __iomem *hdrp; - cdkmem_t __iomem *memp; - cdkasy_t __iomem *ap; - unsigned long flags; - stliport_t *portp; - int portnr, nrdevs, i, rc = 0; - u32 memoff; - - spin_lock_irqsave(&brd_lock, flags); + volatile cdkhdr_t *hdrp; + volatile cdkmem_t *memp; + volatile cdkasy_t *ap; + unsigned long flags; + stliport_t *portp; + int portnr, nrdevs, i, rc; + +#ifdef DEBUG + printk(KERN_DEBUG "stli_startbrd(brdp=%x)\n", (int) brdp); +#endif + + rc = 0; + + save_flags(flags); + cli(); EBRDENABLE(brdp); - hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); + hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); nrdevs = hdrp->nrdevs; #if 0 printk("%s(%d): CDK version %d.%d.%d --> " "nrdevs=%d memp=%x hostp=%x slavep=%x\n", - __FILE__, __LINE__, readb(&hdrp->ver_release), readb(&hdrp->ver_modification), - readb(&hdrp->ver_fix), nrdevs, (int) readl(&hdrp->memp), readl(&hdrp->hostp), - readl(&hdrp->slavep)); + __FILE__, __LINE__, hdrp->ver_release, hdrp->ver_modification, + hdrp->ver_fix, nrdevs, (int) hdrp->memp, (int) hdrp->hostp, + (int) hdrp->slavep); #endif if (nrdevs < (brdp->nrports + 1)) { @@ -3732,14 +4181,14 @@ static int stli_startbrd(stlibrd_t *brdp) brdp->hostoffset = hdrp->hostp - CDK_CDKADDR; brdp->slaveoffset = hdrp->slavep - CDK_CDKADDR; brdp->bitsize = (nrdevs + 7) / 8; - memoff = readl(&hdrp->memp); - if (memoff > brdp->memsize) { + memp = (volatile cdkmem_t *) hdrp->memp; + if (((unsigned long) memp) > brdp->memsize) { printk(KERN_ERR "STALLION: corrupted shared memory region?\n"); rc = -EIO; goto stli_donestartup; } - memp = (cdkmem_t __iomem *) EBRDGETMEMPTR(brdp, memoff); - if (readw(&memp->dtype) != TYP_ASYNCTRL) { + memp = (volatile cdkmem_t *) EBRDGETMEMPTR(brdp, (unsigned long) memp); + if (memp->dtype != TYP_ASYNCTRL) { printk(KERN_ERR "STALLION: no slave control device found\n"); goto stli_donestartup; } @@ -3751,19 +4200,19 @@ static int stli_startbrd(stlibrd_t *brdp) * change pages while reading memory map. */ for (i = 1, portnr = 0; (i < nrdevs); i++, portnr++, memp++) { - if (readw(&memp->dtype) != TYP_ASYNC) + if (memp->dtype != TYP_ASYNC) break; portp = brdp->ports[portnr]; - if (portp == NULL) + if (portp == (stliport_t *) NULL) break; portp->devnr = i; - portp->addr = readl(&memp->offset); + portp->addr = memp->offset; portp->reqbit = (unsigned char) (0x1 << (i * 8 / nrdevs)); portp->portidx = (unsigned char) (i / 8); portp->portbit = (unsigned char) (0x1 << (i % 8)); } - writeb(0xff, &hdrp->slavereq); + hdrp->slavereq = 0xff; /* * For each port setup a local copy of the RX and TX buffer offsets @@ -3772,22 +4221,22 @@ static int stli_startbrd(stlibrd_t *brdp) */ for (i = 1, portnr = 0; (i < nrdevs); i++, portnr++) { portp = brdp->ports[portnr]; - if (portp == NULL) + if (portp == (stliport_t *) NULL) break; if (portp->addr == 0) break; - ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr); - if (ap != NULL) { - portp->rxsize = readw(&ap->rxq.size); - portp->txsize = readw(&ap->txq.size); - portp->rxoffset = readl(&ap->rxq.offset); - portp->txoffset = readl(&ap->txq.offset); + ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr); + if (ap != (volatile cdkasy_t *) NULL) { + portp->rxsize = ap->rxq.size; + portp->txsize = ap->txq.size; + portp->rxoffset = ap->rxq.offset; + portp->txoffset = ap->txq.offset; } } stli_donestartup: EBRDDISABLE(brdp); - spin_unlock_irqrestore(&brd_lock, flags); + restore_flags(flags); if (rc == 0) brdp->state |= BST_STARTED; @@ -3798,7 +4247,7 @@ static int stli_startbrd(stlibrd_t *brdp) add_timer(&stli_timerlist); } - return rc; + return(rc); } /*****************************************************************************/ @@ -3809,6 +4258,10 @@ static int stli_startbrd(stlibrd_t *brdp) static int __init stli_brdinit(stlibrd_t *brdp) { +#ifdef DEBUG + printk(KERN_DEBUG "stli_brdinit(brdp=%x)\n", (int) brdp); +#endif + stli_brds[brdp->brdnr] = brdp; switch (brdp->brdtype) { @@ -3836,11 +4289,11 @@ static int __init stli_brdinit(stlibrd_t *brdp) case BRD_ECHPCI: printk(KERN_ERR "STALLION: %s board type not supported in " "this driver\n", stli_brdnames[brdp->brdtype]); - return -ENODEV; + return(ENODEV); default: printk(KERN_ERR "STALLION: board=%d is unknown board " "type=%d\n", brdp->brdnr, brdp->brdtype); - return -ENODEV; + return(ENODEV); } if ((brdp->state & BST_FOUND) == 0) { @@ -3848,7 +4301,7 @@ static int __init stli_brdinit(stlibrd_t *brdp) "io=%x mem=%x\n", stli_brdnames[brdp->brdtype], brdp->brdnr, brdp->iobase, (int) brdp->memaddr); - return -ENODEV; + return(ENODEV); } stli_initports(brdp); @@ -3856,7 +4309,7 @@ static int __init stli_brdinit(stlibrd_t *brdp) "nrpanels=%d nrports=%d\n", stli_brdnames[brdp->brdtype], brdp->brdnr, brdp->iobase, (int) brdp->memaddr, brdp->nrpanels, brdp->nrports); - return 0; + return(0); } /*****************************************************************************/ @@ -3868,10 +4321,14 @@ static int __init stli_brdinit(stlibrd_t *brdp) static int stli_eisamemprobe(stlibrd_t *brdp) { - cdkecpsig_t ecpsig, __iomem *ecpsigp; - cdkonbsig_t onbsig, __iomem *onbsigp; + cdkecpsig_t ecpsig, *ecpsigp; + cdkonbsig_t onbsig, *onbsigp; int i, foundit; +#ifdef DEBUG + printk(KERN_DEBUG "stli_eisamemprobe(brdp=%x)\n", (int) brdp); +#endif + /* * First up we reset the board, to get it into a known state. There * is only 2 board types here we need to worry about. Don;t use the @@ -3895,7 +4352,7 @@ static int stli_eisamemprobe(stlibrd_t *brdp) mdelay(1); stli_onbeenable(brdp); } else { - return -ENODEV; + return(-ENODEV); } foundit = 0; @@ -3907,24 +4364,25 @@ static int stli_eisamemprobe(stlibrd_t *brdp) */ for (i = 0; (i < stli_eisamempsize); i++) { brdp->memaddr = stli_eisamemprobeaddrs[i]; + brdp->membase = (void *) brdp->memaddr; brdp->membase = ioremap(brdp->memaddr, brdp->memsize); - if (brdp->membase == NULL) + if (brdp->membase == (void *) NULL) continue; if (brdp->brdtype == BRD_ECPE) { - ecpsigp = (cdkecpsig_t __iomem *) stli_ecpeigetmemptr(brdp, + ecpsigp = (cdkecpsig_t *) stli_ecpeigetmemptr(brdp, CDK_SIGADDR, __LINE__); - memcpy_fromio(&ecpsig, ecpsigp, sizeof(cdkecpsig_t)); - if (ecpsig.magic == cpu_to_le32(ECP_MAGIC)) + memcpy(&ecpsig, ecpsigp, sizeof(cdkecpsig_t)); + if (ecpsig.magic == ECP_MAGIC) foundit = 1; } else { - onbsigp = (cdkonbsig_t __iomem *) stli_onbegetmemptr(brdp, + onbsigp = (cdkonbsig_t *) stli_onbegetmemptr(brdp, CDK_SIGADDR, __LINE__); - memcpy_fromio(&onbsig, onbsigp, sizeof(cdkonbsig_t)); - if ((onbsig.magic0 == cpu_to_le16(ONB_MAGIC0)) && - (onbsig.magic1 == cpu_to_le16(ONB_MAGIC1)) && - (onbsig.magic2 == cpu_to_le16(ONB_MAGIC2)) && - (onbsig.magic3 == cpu_to_le16(ONB_MAGIC3))) + memcpy(&onbsig, onbsigp, sizeof(cdkonbsig_t)); + if ((onbsig.magic0 == ONB_MAGIC0) && + (onbsig.magic1 == ONB_MAGIC1) && + (onbsig.magic2 == ONB_MAGIC2) && + (onbsig.magic3 == ONB_MAGIC3)) foundit = 1; } @@ -3948,9 +4406,9 @@ static int stli_eisamemprobe(stlibrd_t *brdp) printk(KERN_ERR "STALLION: failed to probe shared memory " "region for %s in EISA slot=%d\n", stli_brdnames[brdp->brdtype], (brdp->iobase >> 12)); - return -ENODEV; + return(-ENODEV); } - return 0; + return(0); } static int stli_getbrdnr(void) @@ -3981,16 +4439,22 @@ static int stli_getbrdnr(void) static int stli_findeisabrds(void) { - stlibrd_t *brdp; - unsigned int iobase, eid; - int i; + stlibrd_t *brdp; + unsigned int iobase, eid; + int i; + +#ifdef DEBUG + printk(KERN_DEBUG "stli_findeisabrds()\n"); +#endif /* - * Firstly check if this is an EISA system. If this is not an EISA system then + * Firstly check if this is an EISA system. Do this by probing for + * the system board EISA ID. If this is not an EISA system then * don't bother going any further! */ - if (EISA_bus) - return 0; + outb(0xff, 0xc80); + if (inb(0xc80) == 0xff) + return(0); /* * Looks like an EISA system, so go searching for EISA boards. @@ -4008,7 +4472,7 @@ static int stli_findeisabrds(void) */ for (i = 0; (i < STL_MAXBRDS); i++) { brdp = stli_brds[i]; - if (brdp == NULL) + if (brdp == (stlibrd_t *) NULL) continue; if (brdp->iobase == iobase) break; @@ -4020,10 +4484,10 @@ static int stli_findeisabrds(void) * We have found a Stallion board and it is not configured already. * Allocate a board structure and initialize it. */ - if ((brdp = stli_allocbrd()) == NULL) - return -ENOMEM; + if ((brdp = stli_allocbrd()) == (stlibrd_t *) NULL) + return(-ENOMEM); if ((brdp->brdnr = stli_getbrdnr()) < 0) - return -ENOMEM; + return(-ENOMEM); eid = inb(iobase + 0xc82); if (eid == ECP_EISAID) brdp->brdtype = BRD_ECPE; @@ -4038,7 +4502,7 @@ static int stli_findeisabrds(void) stli_brdinit(brdp); } - return 0; + return(0); } /*****************************************************************************/ @@ -4059,18 +4523,32 @@ static int stli_findeisabrds(void) static int stli_initpcibrd(int brdtype, struct pci_dev *devp) { - stlibrd_t *brdp; + stlibrd_t *brdp; + +#ifdef DEBUG + printk(KERN_DEBUG "stli_initpcibrd(brdtype=%d,busnr=%x,devnr=%x)\n", + brdtype, dev->bus->number, dev->devfn); +#endif if (pci_enable_device(devp)) - return -EIO; - if ((brdp = stli_allocbrd()) == NULL) - return -ENOMEM; + return(-EIO); + if ((brdp = stli_allocbrd()) == (stlibrd_t *) NULL) + return(-ENOMEM); if ((brdp->brdnr = stli_getbrdnr()) < 0) { printk(KERN_INFO "STALLION: too many boards found, " "maximum supported %d\n", STL_MAXBRDS); - return 0; + return(0); } brdp->brdtype = brdtype; + +#ifdef DEBUG + printk(KERN_DEBUG "%s(%d): BAR[]=%lx,%lx,%lx,%lx\n", __FILE__, __LINE__, + pci_resource_start(devp, 0), + pci_resource_start(devp, 1), + pci_resource_start(devp, 2), + pci_resource_start(devp, 3)); +#endif + /* * We have all resources from the board, so lets setup the actual * board structure now. @@ -4079,7 +4557,7 @@ static int stli_initpcibrd(int brdtype, struct pci_dev *devp) brdp->memaddr = pci_resource_start(devp, 2); stli_brdinit(brdp); - return 0; + return(0); } /*****************************************************************************/ @@ -4091,12 +4569,20 @@ static int stli_initpcibrd(int brdtype, struct pci_dev *devp) static int stli_findpcibrds(void) { - struct pci_dev *dev = NULL; + struct pci_dev *dev = NULL; + int rc; + +#ifdef DEBUG + printk("stli_findpcibrds()\n"); +#endif - while ((dev = pci_get_device(PCI_VENDOR_ID_STALLION, PCI_DEVICE_ID_ECRA, dev))) { - stli_initpcibrd(BRD_ECPPCI, dev); + while ((dev = pci_find_device(PCI_VENDOR_ID_STALLION, + PCI_DEVICE_ID_ECRA, dev))) { + if ((rc = stli_initpcibrd(BRD_ECPPCI, dev))) + return(rc); } - return 0; + + return(0); } #endif @@ -4109,16 +4595,17 @@ static int stli_findpcibrds(void) static stlibrd_t *stli_allocbrd(void) { - stlibrd_t *brdp; + stlibrd_t *brdp; brdp = kzalloc(sizeof(stlibrd_t), GFP_KERNEL); if (!brdp) { printk(KERN_ERR "STALLION: failed to allocate memory " - "(size=%Zd)\n", sizeof(stlibrd_t)); + "(size=%d)\n", sizeof(stlibrd_t)); return NULL; } + brdp->magic = STLI_BOARDMAGIC; - return brdp; + return(brdp); } /*****************************************************************************/ @@ -4130,9 +4617,13 @@ static stlibrd_t *stli_allocbrd(void) static int stli_initbrds(void) { - stlibrd_t *brdp, *nxtbrdp; - stlconf_t *confp; - int i, j; + stlibrd_t *brdp, *nxtbrdp; + stlconf_t *confp; + int i, j; + +#ifdef DEBUG + printk(KERN_DEBUG "stli_initbrds()\n"); +#endif if (stli_nrbrds > STL_MAXBRDS) { printk(KERN_INFO "STALLION: too many boards in configuration " @@ -4147,9 +4638,11 @@ static int stli_initbrds(void) */ for (i = 0; (i < stli_nrbrds); i++) { confp = &stli_brdconf[i]; +#ifdef MODULE stli_parsebrd(confp, stli_brdsp[i]); - if ((brdp = stli_allocbrd()) == NULL) - return -ENOMEM; +#endif + if ((brdp = stli_allocbrd()) == (stlibrd_t *) NULL) + return(-ENOMEM); brdp->brdnr = i; brdp->brdtype = confp->brdtype; brdp->iobase = confp->ioaddr1; @@ -4161,7 +4654,9 @@ static int stli_initbrds(void) * Static configuration table done, so now use dynamic methods to * see if any more boards should be configured. */ +#ifdef MODULE stli_argbrds(); +#endif if (STLI_EISAPROBE) stli_findeisabrds(); #ifdef CONFIG_PCI @@ -4177,11 +4672,11 @@ static int stli_initbrds(void) if (stli_nrbrds > 1) { for (i = 0; (i < stli_nrbrds); i++) { brdp = stli_brds[i]; - if (brdp == NULL) + if (brdp == (stlibrd_t *) NULL) continue; for (j = i + 1; (j < stli_nrbrds); j++) { nxtbrdp = stli_brds[j]; - if (nxtbrdp == NULL) + if (nxtbrdp == (stlibrd_t *) NULL) continue; if ((brdp->membase >= nxtbrdp->membase) && (brdp->membase <= (nxtbrdp->membase + @@ -4196,7 +4691,7 @@ static int stli_initbrds(void) if (stli_shared == 0) { for (i = 0; (i < stli_nrbrds); i++) { brdp = stli_brds[i]; - if (brdp == NULL) + if (brdp == (stlibrd_t *) NULL) continue; if (brdp->state & BST_FOUND) { EBRDENABLE(brdp); @@ -4206,7 +4701,7 @@ static int stli_initbrds(void) } } - return 0; + return(0); } /*****************************************************************************/ @@ -4219,55 +4714,48 @@ static int stli_initbrds(void) static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, loff_t *offp) { - unsigned long flags; - void *memptr; - stlibrd_t *brdp; - int brdnr, size, n; - void *p; - loff_t off = *offp; + unsigned long flags; + void *memptr; + stlibrd_t *brdp; + int brdnr, size, n; + +#ifdef DEBUG + printk(KERN_DEBUG "stli_memread(fp=%x,buf=%x,count=%x,offp=%x)\n", + (int) fp, (int) buf, count, (int) offp); +#endif brdnr = iminor(fp->f_dentry->d_inode); if (brdnr >= stli_nrbrds) - return -ENODEV; + return(-ENODEV); brdp = stli_brds[brdnr]; - if (brdp == NULL) - return -ENODEV; + if (brdp == (stlibrd_t *) NULL) + return(-ENODEV); if (brdp->state == 0) - return -ENODEV; - if (off >= brdp->memsize || off + count < off) - return 0; - - size = MIN(count, (brdp->memsize - off)); - - /* - * Copy the data a page at a time - */ + return(-ENODEV); + if (fp->f_pos >= brdp->memsize) + return(0); - p = (void *)__get_free_page(GFP_KERNEL); - if(p == NULL) - return -ENOMEM; + size = MIN(count, (brdp->memsize - fp->f_pos)); + save_flags(flags); + cli(); + EBRDENABLE(brdp); while (size > 0) { - spin_lock_irqsave(&brd_lock, flags); - EBRDENABLE(brdp); - memptr = (void *) EBRDGETMEMPTR(brdp, off); - n = MIN(size, (brdp->pagesize - (((unsigned long) off) % brdp->pagesize))); - n = MIN(n, PAGE_SIZE); - memcpy_fromio(p, memptr, n); - EBRDDISABLE(brdp); - spin_unlock_irqrestore(&brd_lock, flags); - if (copy_to_user(buf, p, n)) { + memptr = (void *) EBRDGETMEMPTR(brdp, fp->f_pos); + n = MIN(size, (brdp->pagesize - (((unsigned long) fp->f_pos) % brdp->pagesize))); + if (copy_to_user(buf, memptr, n)) { count = -EFAULT; goto out; } - off += n; + fp->f_pos += n; buf += n; size -= n; } out: - *offp = off; - free_page((unsigned long)p); - return count; + EBRDDISABLE(brdp); + restore_flags(flags); + + return(count); } /*****************************************************************************/ @@ -4276,65 +4764,54 @@ static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, lof * Code to handle an "staliomem" write operation. This device is the * contents of the board shared memory. It is used for down loading * the slave image (and debugging :-) - * - * FIXME: copy under lock */ static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t count, loff_t *offp) { - unsigned long flags; - void *memptr; - stlibrd_t *brdp; - char __user *chbuf; - int brdnr, size, n; - void *p; - loff_t off = *offp; + unsigned long flags; + void *memptr; + stlibrd_t *brdp; + char __user *chbuf; + int brdnr, size, n; - brdnr = iminor(fp->f_dentry->d_inode); +#ifdef DEBUG + printk(KERN_DEBUG "stli_memwrite(fp=%x,buf=%x,count=%x,offp=%x)\n", + (int) fp, (int) buf, count, (int) offp); +#endif + brdnr = iminor(fp->f_dentry->d_inode); if (brdnr >= stli_nrbrds) - return -ENODEV; + return(-ENODEV); brdp = stli_brds[brdnr]; - if (brdp == NULL) - return -ENODEV; + if (brdp == (stlibrd_t *) NULL) + return(-ENODEV); if (brdp->state == 0) - return -ENODEV; - if (off >= brdp->memsize || off + count < off) - return 0; + return(-ENODEV); + if (fp->f_pos >= brdp->memsize) + return(0); chbuf = (char __user *) buf; - size = MIN(count, (brdp->memsize - off)); - - /* - * Copy the data a page at a time - */ - - p = (void *)__get_free_page(GFP_KERNEL); - if(p == NULL) - return -ENOMEM; + size = MIN(count, (brdp->memsize - fp->f_pos)); + save_flags(flags); + cli(); + EBRDENABLE(brdp); while (size > 0) { - n = MIN(size, (brdp->pagesize - (((unsigned long) off) % brdp->pagesize))); - n = MIN(n, PAGE_SIZE); - if (copy_from_user(p, chbuf, n)) { - if (count == 0) - count = -EFAULT; + memptr = (void *) EBRDGETMEMPTR(brdp, fp->f_pos); + n = MIN(size, (brdp->pagesize - (((unsigned long) fp->f_pos) % brdp->pagesize))); + if (copy_from_user(memptr, chbuf, n)) { + count = -EFAULT; goto out; } - spin_lock_irqsave(&brd_lock, flags); - EBRDENABLE(brdp); - memptr = (void *) EBRDGETMEMPTR(brdp, off); - memcpy_toio(memptr, p, n); - EBRDDISABLE(brdp); - spin_unlock_irqrestore(&brd_lock, flags); - off += n; + fp->f_pos += n; chbuf += n; size -= n; } out: - free_page((unsigned long) p); - *offp = off; - return count; + EBRDDISABLE(brdp); + restore_flags(flags); + + return(count); } /*****************************************************************************/ @@ -4345,16 +4822,16 @@ static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t cou static int stli_getbrdstats(combrd_t __user *bp) { - stlibrd_t *brdp; - int i; + stlibrd_t *brdp; + int i; if (copy_from_user(&stli_brdstats, bp, sizeof(combrd_t))) return -EFAULT; if (stli_brdstats.brd >= STL_MAXBRDS) - return -ENODEV; + return(-ENODEV); brdp = stli_brds[stli_brdstats.brd]; - if (brdp == NULL) - return -ENODEV; + if (brdp == (stlibrd_t *) NULL) + return(-ENODEV); memset(&stli_brdstats, 0, sizeof(combrd_t)); stli_brdstats.brd = brdp->brdnr; @@ -4373,7 +4850,7 @@ static int stli_getbrdstats(combrd_t __user *bp) if (copy_to_user(bp, &stli_brdstats, sizeof(combrd_t))) return -EFAULT; - return 0; + return(0); } /*****************************************************************************/ @@ -4384,19 +4861,19 @@ static int stli_getbrdstats(combrd_t __user *bp) static stliport_t *stli_getport(int brdnr, int panelnr, int portnr) { - stlibrd_t *brdp; - int i; + stlibrd_t *brdp; + int i; - if (brdnr < 0 || brdnr >= STL_MAXBRDS) - return NULL; + if ((brdnr < 0) || (brdnr >= STL_MAXBRDS)) + return((stliport_t *) NULL); brdp = stli_brds[brdnr]; - if (brdp == NULL) - return NULL; + if (brdp == (stlibrd_t *) NULL) + return((stliport_t *) NULL); for (i = 0; (i < panelnr); i++) portnr += brdp->panels[i]; if ((portnr < 0) || (portnr >= brdp->nrports)) - return NULL; - return brdp->ports[portnr]; + return((stliport_t *) NULL); + return(brdp->ports[portnr]); } /*****************************************************************************/ @@ -4415,16 +4892,16 @@ static int stli_portcmdstats(stliport_t *portp) memset(&stli_comstats, 0, sizeof(comstats_t)); - if (portp == NULL) - return -ENODEV; + if (portp == (stliport_t *) NULL) + return(-ENODEV); brdp = stli_brds[portp->brdnr]; - if (brdp == NULL) - return -ENODEV; + if (brdp == (stlibrd_t *) NULL) + return(-ENODEV); if (brdp->state & BST_STARTED) { if ((rc = stli_cmdwait(brdp, portp, A_GETSTATS, &stli_cdkstats, sizeof(asystats_t), 1)) < 0) - return rc; + return(rc); } else { memset(&stli_cdkstats, 0, sizeof(asystats_t)); } @@ -4435,12 +4912,13 @@ static int stli_portcmdstats(stliport_t *portp) stli_comstats.state = portp->state; stli_comstats.flags = portp->flags; - spin_lock_irqsave(&brd_lock, flags); - if (portp->tty != NULL) { + save_flags(flags); + cli(); + if (portp->tty != (struct tty_struct *) NULL) { if (portp->tty->driver_data == portp) { stli_comstats.ttystate = portp->tty->flags; - stli_comstats.rxbuffered = -1; - if (portp->tty->termios != NULL) { + stli_comstats.rxbuffered = -1 /*portp->tty->flip.count*/; + if (portp->tty->termios != (struct termios *) NULL) { stli_comstats.cflags = portp->tty->termios->c_cflag; stli_comstats.iflags = portp->tty->termios->c_iflag; stli_comstats.oflags = portp->tty->termios->c_oflag; @@ -4448,7 +4926,7 @@ static int stli_portcmdstats(stliport_t *portp) } } } - spin_unlock_irqrestore(&brd_lock, flags); + restore_flags(flags); stli_comstats.txtotal = stli_cdkstats.txchars; stli_comstats.rxtotal = stli_cdkstats.rxchars + stli_cdkstats.ringover; @@ -4470,7 +4948,7 @@ static int stli_portcmdstats(stliport_t *portp) stli_comstats.hwid = stli_cdkstats.hwid; stli_comstats.signals = stli_mktiocm(stli_cdkstats.signals); - return 0; + return(0); } /*****************************************************************************/ @@ -4483,8 +4961,8 @@ static int stli_portcmdstats(stliport_t *portp) static int stli_getportstats(stliport_t *portp, comstats_t __user *cp) { - stlibrd_t *brdp; - int rc; + stlibrd_t *brdp; + int rc; if (!portp) { if (copy_from_user(&stli_comstats, cp, sizeof(comstats_t))) @@ -4514,8 +4992,8 @@ static int stli_getportstats(stliport_t *portp, comstats_t __user *cp) static int stli_clrportstats(stliport_t *portp, comstats_t __user *cp) { - stlibrd_t *brdp; - int rc; + stlibrd_t *brdp; + int rc; if (!portp) { if (copy_from_user(&stli_comstats, cp, sizeof(comstats_t))) @@ -4553,7 +5031,7 @@ static int stli_clrportstats(stliport_t *portp, comstats_t __user *cp) static int stli_getportstruct(stliport_t __user *arg) { - stliport_t *portp; + stliport_t *portp; if (copy_from_user(&stli_dummyport, arg, sizeof(stliport_t))) return -EFAULT; @@ -4574,7 +5052,7 @@ static int stli_getportstruct(stliport_t __user *arg) static int stli_getbrdstruct(stlibrd_t __user *arg) { - stlibrd_t *brdp; + stlibrd_t *brdp; if (copy_from_user(&stli_dummybrd, arg, sizeof(stlibrd_t))) return -EFAULT; @@ -4598,10 +5076,15 @@ static int stli_getbrdstruct(stlibrd_t __user *arg) static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg) { - stlibrd_t *brdp; - int brdnr, rc, done; + stlibrd_t *brdp; + int brdnr, rc, done; void __user *argp = (void __user *)arg; +#ifdef DEBUG + printk(KERN_DEBUG "stli_memioctl(ip=%x,fp=%x,cmd=%x,arg=%x)\n", + (int) ip, (int) fp, cmd, (int) arg); +#endif + /* * First up handle the board independent ioctls. */ @@ -4632,7 +5115,7 @@ static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, un } if (done) - return rc; + return(rc); /* * Now handle the board specific ioctls. These all depend on the @@ -4640,12 +5123,12 @@ static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, un */ brdnr = iminor(ip); if (brdnr >= STL_MAXBRDS) - return -ENODEV; + return(-ENODEV); brdp = stli_brds[brdnr]; if (!brdp) - return -ENODEV; + return(-ENODEV); if (brdp->state == 0) - return -ENODEV; + return(-ENODEV); switch (cmd) { case STL_BINTR: @@ -4669,7 +5152,8 @@ static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, un rc = -ENOIOCTLCMD; break; } - return rc; + + return(rc); } static struct tty_operations stli_ops = { @@ -4703,9 +5187,6 @@ int __init stli_init(void) int i; printk(KERN_INFO "%s: version %s\n", stli_drvtitle, stli_drvversion); - spin_lock_init(&stli_lock); - spin_lock_init(&brd_lock); - stli_initbrds(); stli_serial = alloc_tty_driver(STL_MAXBRDS * STL_MAXPORTS); @@ -4715,6 +5196,10 @@ int __init stli_init(void) /* * Allocate a temporary write buffer. */ + stli_tmpwritebuf = kmalloc(STLI_TXBUFSIZE, GFP_KERNEL); + if (!stli_tmpwritebuf) + printk(KERN_ERR "STALLION: failed to allocate memory " + "(size=%d)\n", STLI_TXBUFSIZE); stli_txcookbuf = kmalloc(STLI_TXBUFSIZE, GFP_KERNEL); if (!stli_txcookbuf) printk(KERN_ERR "STALLION: failed to allocate memory " @@ -4758,7 +5243,7 @@ int __init stli_init(void) printk(KERN_ERR "STALLION: failed to register serial driver\n"); return -EBUSY; } - return 0; + return(0); } /*****************************************************************************/ diff --git a/trunk/drivers/char/mxser.c b/trunk/drivers/char/mxser.c index 72cfd09091e0..645d9d713aec 100644 --- a/trunk/drivers/char/mxser.c +++ b/trunk/drivers/char/mxser.c @@ -996,6 +996,7 @@ static int mxser_open(struct tty_struct *tty, struct file *filp) info->session = current->signal->session; info->pgrp = process_group(current); + clear_bit(TTY_DONT_FLIP, &tty->flags); /* status = mxser_get_msr(info->base, 0, info->port); diff --git a/trunk/drivers/char/n_tty.c b/trunk/drivers/char/n_tty.c index 603b9ade5eb0..b9371d5bf790 100644 --- a/trunk/drivers/char/n_tty.c +++ b/trunk/drivers/char/n_tty.c @@ -1132,7 +1132,7 @@ static inline int input_available_p(struct tty_struct *tty, int amt) * buffer, and once to drain the space from the (physical) beginning of * the buffer to head pointer. * - * Called under the tty->atomic_read_lock sem + * Called under the tty->atomic_read_lock sem and with TTY_DONT_FLIP set * */ @@ -1271,6 +1271,7 @@ static ssize_t read_chan(struct tty_struct *tty, struct file *file, } add_wait_queue(&tty->read_wait, &wait); + set_bit(TTY_DONT_FLIP, &tty->flags); while (nr) { /* First test for status change. */ if (tty->packet && tty->link->ctrl_status) { @@ -1314,7 +1315,9 @@ static ssize_t read_chan(struct tty_struct *tty, struct file *file, break; } n_tty_set_room(tty); + clear_bit(TTY_DONT_FLIP, &tty->flags); timeout = schedule_timeout(timeout); + set_bit(TTY_DONT_FLIP, &tty->flags); continue; } __set_current_state(TASK_RUNNING); @@ -1391,6 +1394,7 @@ static ssize_t read_chan(struct tty_struct *tty, struct file *file, if (time) timeout = time; } + clear_bit(TTY_DONT_FLIP, &tty->flags); mutex_unlock(&tty->atomic_read_lock); remove_wait_queue(&tty->read_wait, &wait); diff --git a/trunk/drivers/char/pty.c b/trunk/drivers/char/pty.c index 0c17f61549b4..9b5a2c0e7008 100644 --- a/trunk/drivers/char/pty.c +++ b/trunk/drivers/char/pty.c @@ -101,7 +101,7 @@ static void pty_unthrottle(struct tty_struct * tty) * * FIXME: Our pty_write method is called with our ldisc lock held but * not our partners. We can't just take the other one blindly without - * risking deadlocks. + * risking deadlocks. There is also the small matter of TTY_DONT_FLIP */ static int pty_write(struct tty_struct * tty, const unsigned char *buf, int count) { diff --git a/trunk/drivers/char/stallion.c b/trunk/drivers/char/stallion.c index 00b4a2187164..bf361a5ba70d 100644 --- a/trunk/drivers/char/stallion.c +++ b/trunk/drivers/char/stallion.c @@ -3029,9 +3029,6 @@ static int __init stl_init(void) int i; printk(KERN_INFO "%s: version %s\n", stl_drvtitle, stl_drvversion); - spin_lock_init(&stallion_lock); - spin_lock_init(&brd_lock); - stl_initbrds(); stl_serial = alloc_tty_driver(STL_MAXBRDS * STL_MAXPORTS); diff --git a/trunk/drivers/char/tty_io.c b/trunk/drivers/char/tty_io.c index 8d19f7281f0b..bd74e82d8a72 100644 --- a/trunk/drivers/char/tty_io.c +++ b/trunk/drivers/char/tty_io.c @@ -267,6 +267,7 @@ static struct tty_buffer *tty_buffer_alloc(size_t size) p->used = 0; p->size = size; p->next = NULL; + p->active = 0; p->commit = 0; p->read = 0; p->char_buf_ptr = (char *)(p->data); @@ -326,9 +327,10 @@ int tty_buffer_request_room(struct tty_struct *tty, size_t size) /* OPTIMISATION: We could keep a per tty "zero" sized buffer to remove this conditional if its worth it. This would be invisible to the callers */ - if ((b = tty->buf.tail) != NULL) + if ((b = tty->buf.tail) != NULL) { left = b->size - b->used; - else + b->active = 1; + } else left = 0; if (left < size) { @@ -336,10 +338,12 @@ int tty_buffer_request_room(struct tty_struct *tty, size_t size) if ((n = tty_buffer_find(tty, size)) != NULL) { if (b != NULL) { b->next = n; + b->active = 0; b->commit = b->used; } else tty->buf.head = n; tty->buf.tail = n; + n->active = 1; } else size = left; } @@ -400,8 +404,10 @@ void tty_schedule_flip(struct tty_struct *tty) { unsigned long flags; spin_lock_irqsave(&tty->buf.lock, flags); - if (tty->buf.tail != NULL) + if (tty->buf.tail != NULL) { + tty->buf.tail->active = 0; tty->buf.tail->commit = tty->buf.tail->used; + } spin_unlock_irqrestore(&tty->buf.lock, flags); schedule_delayed_work(&tty->buf.work, 1); } @@ -778,8 +784,11 @@ static int tty_set_ldisc(struct tty_struct *tty, int ldisc) } clear_bit(TTY_LDISC, &tty->flags); - if (o_tty) + clear_bit(TTY_DONT_FLIP, &tty->flags); + if (o_tty) { clear_bit(TTY_LDISC, &o_tty->flags); + clear_bit(TTY_DONT_FLIP, &o_tty->flags); + } spin_unlock_irqrestore(&tty_ldisc_lock, flags); /* @@ -1946,6 +1955,7 @@ static void release_dev(struct file * filp) * race with the set_ldisc code path. */ clear_bit(TTY_LDISC, &tty->flags); + clear_bit(TTY_DONT_FLIP, &tty->flags); cancel_delayed_work(&tty->buf.work); /* @@ -2765,7 +2775,8 @@ static void flush_to_ldisc(void *private_) struct tty_struct *tty = (struct tty_struct *) private_; unsigned long flags; struct tty_ldisc *disc; - struct tty_buffer *tbuf, *head; + struct tty_buffer *tbuf; + int count; char *char_buf; unsigned char *flag_buf; @@ -2773,37 +2784,32 @@ static void flush_to_ldisc(void *private_) if (disc == NULL) /* !TTY_LDISC */ return; + if (test_bit(TTY_DONT_FLIP, &tty->flags)) { + /* + * Do it after the next timer tick: + */ + schedule_delayed_work(&tty->buf.work, 1); + goto out; + } spin_lock_irqsave(&tty->buf.lock, flags); - head = tty->buf.head; - if (head != NULL) { - tty->buf.head = NULL; - for (;;) { - int count = head->commit - head->read; - if (!count) { - if (head->next == NULL) - break; - tbuf = head; - head = head->next; - tty_buffer_free(tty, tbuf); - continue; - } - if (!tty->receive_room) { - schedule_delayed_work(&tty->buf.work, 1); - break; - } - if (count > tty->receive_room) - count = tty->receive_room; - char_buf = head->char_buf_ptr + head->read; - flag_buf = head->flag_buf_ptr + head->read; - head->read += count; + while((tbuf = tty->buf.head) != NULL) { + while ((count = tbuf->commit - tbuf->read) != 0) { + char_buf = tbuf->char_buf_ptr + tbuf->read; + flag_buf = tbuf->flag_buf_ptr + tbuf->read; + tbuf->read += count; spin_unlock_irqrestore(&tty->buf.lock, flags); disc->receive_buf(tty, char_buf, flag_buf, count); spin_lock_irqsave(&tty->buf.lock, flags); } - tty->buf.head = head; + if (tbuf->active) + break; + tty->buf.head = tbuf->next; + if (tty->buf.head == NULL) + tty->buf.tail = NULL; + tty_buffer_free(tty, tbuf); } spin_unlock_irqrestore(&tty->buf.lock, flags); - +out: tty_ldisc_deref(disc); } @@ -2896,8 +2902,10 @@ void tty_flip_buffer_push(struct tty_struct *tty) { unsigned long flags; spin_lock_irqsave(&tty->buf.lock, flags); - if (tty->buf.tail != NULL) + if (tty->buf.tail != NULL) { + tty->buf.tail->active = 0; tty->buf.tail->commit = tty->buf.tail->used; + } spin_unlock_irqrestore(&tty->buf.lock, flags); if (tty->low_latency) diff --git a/trunk/drivers/ide/ide-io.c b/trunk/drivers/ide/ide-io.c index 26ceab1e90bb..935cb2583770 100644 --- a/trunk/drivers/ide/ide-io.c +++ b/trunk/drivers/ide/ide-io.c @@ -505,7 +505,7 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8 } } - if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ && hwif->err_stops_fifo == 0) + if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ) try_to_flush_leftover_data(drive); if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT)) diff --git a/trunk/drivers/ide/ide-iops.c b/trunk/drivers/ide/ide-iops.c index 32117f0ec5c0..97a49e77a8f1 100644 --- a/trunk/drivers/ide/ide-iops.c +++ b/trunk/drivers/ide/ide-iops.c @@ -597,10 +597,6 @@ u8 eighty_ninty_three (ide_drive_t *drive) { if(HWIF(drive)->udma_four == 0) return 0; - - /* Check for SATA but only if we are ATA5 or higher */ - if (drive->id->hw_config == 0 && (drive->id->major_rev_num & 0x7FE0)) - return 1; if (!(drive->id->hw_config & 0x6000)) return 0; #ifndef CONFIG_IDEDMA_IVB diff --git a/trunk/drivers/ide/pci/aec62xx.c b/trunk/drivers/ide/pci/aec62xx.c index ff0cdc142f17..c743e68c33aa 100644 --- a/trunk/drivers/ide/pci/aec62xx.c +++ b/trunk/drivers/ide/pci/aec62xx.c @@ -22,7 +22,7 @@ struct chipset_bus_clock_list_entry { u8 ultra_settings; }; -static const struct chipset_bus_clock_list_entry aec6xxx_33_base [] = { +static struct chipset_bus_clock_list_entry aec6xxx_33_base [] = { { XFER_UDMA_6, 0x31, 0x07 }, { XFER_UDMA_5, 0x31, 0x06 }, { XFER_UDMA_4, 0x31, 0x05 }, @@ -42,7 +42,7 @@ static const struct chipset_bus_clock_list_entry aec6xxx_33_base [] = { { 0, 0x00, 0x00 } }; -static const struct chipset_bus_clock_list_entry aec6xxx_34_base [] = { +static struct chipset_bus_clock_list_entry aec6xxx_34_base [] = { { XFER_UDMA_6, 0x41, 0x06 }, { XFER_UDMA_5, 0x41, 0x05 }, { XFER_UDMA_4, 0x41, 0x04 }, @@ -425,12 +425,12 @@ static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_devi return d->init_setup(dev, d); } -static const struct pci_device_id aec62xx_pci_tbl[] = { - { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP850UF), 0 }, - { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP860), 1 }, - { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP860R), 2 }, - { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP865), 3 }, - { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP865R), 4 }, +static struct pci_device_id aec62xx_pci_tbl[] = { + { PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP850UF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + { PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP860, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1 }, + { PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP860R, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2 }, + { PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP865, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3 }, + { PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_ATP865R, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4 }, { 0, }, }; MODULE_DEVICE_TABLE(pci, aec62xx_pci_tbl); diff --git a/trunk/drivers/ide/pci/cmd64x.c b/trunk/drivers/ide/pci/cmd64x.c index 92b7b1549b16..3d9c7afc8695 100644 --- a/trunk/drivers/ide/pci/cmd64x.c +++ b/trunk/drivers/ide/pci/cmd64x.c @@ -189,6 +189,14 @@ static int cmd64x_get_info (char *buffer, char **addr, off_t offset, int count) #endif /* defined(DISPLAY_CMD64X_TIMINGS) && defined(CONFIG_PROC_FS) */ +/* + * Registers and masks for easy access by drive index: + */ +#if 0 +static u8 prefetch_regs[4] = {CNTRL, CNTRL, ARTTIM23, ARTTIM23}; +static u8 prefetch_masks[4] = {CNTRL_DIS_RA0, CNTRL_DIS_RA1, ARTTIM23_DIS_RA2, ARTTIM23_DIS_RA3}; +#endif + /* * This routine writes the prepared setup/active/recovery counts * for a drive into the cmd646 chipset registers to active them. @@ -598,6 +606,13 @@ static unsigned int __devinit init_chipset_cmd64x(struct pci_dev *dev, const cha pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev); class_rev &= 0xff; +#ifdef __i386__ + if (dev->resource[PCI_ROM_RESOURCE].start) { + pci_write_config_dword(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE); + printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", name, dev->resource[PCI_ROM_RESOURCE].start); + } +#endif + switch(dev->device) { case PCI_DEVICE_ID_CMD_643: break; diff --git a/trunk/drivers/ide/pci/pdc202xx_new.c b/trunk/drivers/ide/pci/pdc202xx_new.c index 2c9e938dd1cd..acd63173199b 100644 --- a/trunk/drivers/ide/pci/pdc202xx_new.c +++ b/trunk/drivers/ide/pci/pdc202xx_new.c @@ -338,8 +338,6 @@ static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif) hwif->ultra_mask = 0x7f; hwif->mwdma_mask = 0x07; - hwif->err_stops_fifo = 1; - hwif->ide_dma_check = &pdcnew_config_drive_xfer_rate; hwif->ide_dma_lostirq = &pdcnew_ide_dma_lostirq; hwif->ide_dma_timeout = &pdcnew_ide_dma_timeout; diff --git a/trunk/drivers/ide/pci/pdc202xx_old.c b/trunk/drivers/ide/pci/pdc202xx_old.c index 26bc688a1821..22d17548ecdb 100644 --- a/trunk/drivers/ide/pci/pdc202xx_old.c +++ b/trunk/drivers/ide/pci/pdc202xx_old.c @@ -101,6 +101,31 @@ static const char *pdc_quirk_drives[] = { #define MC1 0x02 /* DMA"C" timing */ #define MC0 0x01 /* DMA"C" timing */ +#if 0 + unsigned long bibma = pci_resource_start(dev, 4); + u8 hi = 0, lo = 0; + + u8 sc1c = inb_p((u16)bibma + 0x1c); + u8 sc1e = inb_p((u16)bibma + 0x1e); + u8 sc1f = inb_p((u16)bibma + 0x1f); + + p += sprintf(p, "Host Mode : %s\n", + (sc1f & 0x08) ? "Tri-Stated" : "Normal"); + p += sprintf(p, "Bus Clocking : %s\n", + ((sc1f & 0xC0) == 0xC0) ? "100 External" : + ((sc1f & 0x80) == 0x80) ? "66 External" : + ((sc1f & 0x40) == 0x40) ? "33 External" : "33 PCI Internal"); + p += sprintf(p, "IO pad select : %s mA\n", + ((sc1c & 0x03) == 0x03) ? "10" : + ((sc1c & 0x02) == 0x02) ? "8" : + ((sc1c & 0x01) == 0x01) ? "6" : + ((sc1c & 0x00) == 0x00) ? "4" : "??"); + hi = sc1e >> 4; + lo = sc1e & 0xf; + p += sprintf(p, "Status Polling Period : %d\n", hi); + p += sprintf(p, "Interrupt Check Status Polling Delay : %d\n", lo); +#endif + static u8 pdc202xx_ratemask (ide_drive_t *drive) { u8 mode; @@ -480,13 +505,42 @@ static void pdc202xx_reset (ide_drive_t *drive) pdc202xx_reset_host(hwif); pdc202xx_reset_host(mate); +#if 0 + /* + * FIXME: Have to kick all the drives again :-/ + * What a pain in the ACE! + */ + if (hwif->present) { + u16 hunit = 0; + for (hunit = 0; hunit < MAX_DRIVES; ++hunit) { + ide_drive_t *hdrive = &hwif->drives[hunit]; + if (hdrive->present) { + if (hwif->ide_dma_check) + hwif->ide_dma_check(hdrive); + else + hwif->tuneproc(hdrive, 5); + } + } + } + if (mate->present) { + u16 munit = 0; + for (munit = 0; munit < MAX_DRIVES; ++munit) { + ide_drive_t *mdrive = &mate->drives[munit]; + if (mdrive->present) { + if (mate->ide_dma_check) + mate->ide_dma_check(mdrive); + else + mate->tuneproc(mdrive, 5); + } + } + } +#else hwif->tuneproc(drive, 5); +#endif } -static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev, - const char *name) +static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev, const char *name) { - /* This doesn't appear needed */ if (dev->resource[PCI_ROM_RESOURCE].start) { pci_write_config_dword(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE); @@ -494,6 +548,30 @@ static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev, name, dev->resource[PCI_ROM_RESOURCE].start); } + /* + * software reset - this is required because the bios + * will set UDMA timing on if the hdd supports it. The + * user may want to turn udma off. A bug in the pdc20262 + * is that it cannot handle a downgrade in timing from + * UDMA to DMA. Disk accesses after issuing a set + * feature command will result in errors. A software + * reset leaves the timing registers intact, + * but resets the drives. + */ +#if 0 + if ((dev->device == PCI_DEVICE_ID_PROMISE_20267) || + (dev->device == PCI_DEVICE_ID_PROMISE_20265) || + (dev->device == PCI_DEVICE_ID_PROMISE_20263) || + (dev->device == PCI_DEVICE_ID_PROMISE_20262)) { + unsigned long high_16 = pci_resource_start(dev, 4); + byte udma_speed_flag = inb(high_16 + 0x001f); + outb(udma_speed_flag | 0x10, high_16 + 0x001f); + mdelay(100); + outb(udma_speed_flag & ~0x10, high_16 + 0x001f); + mdelay(2000); /* 2 seconds ?! */ + } + +#endif return dev->irq; } @@ -521,8 +599,6 @@ static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif) hwif->mwdma_mask = 0x07; hwif->swdma_mask = 0x07; - hwif->err_stops_fifo = 1; - hwif->ide_dma_check = &pdc202xx_config_drive_xfer_rate; hwif->ide_dma_lostirq = &pdc202xx_ide_dma_lostirq; hwif->ide_dma_timeout = &pdc202xx_ide_dma_timeout; @@ -611,6 +687,19 @@ static int __devinit init_setup_pdc202ata4(struct pci_dev *dev, "mirror fixed.\n", d->name); } } + +#if 0 + if (dev->device == PCI_DEVICE_ID_PROMISE_20262) + if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) || + (tmp & e->mask) != e->val)) + + if (d->enablebits[0].reg != d->enablebits[1].reg) { + d->enablebits[0].reg = d->enablebits[1].reg; + d->enablebits[0].mask = d->enablebits[1].mask; + d->enablebits[0].val = d->enablebits[1].val; + } +#endif + return ide_setup_pci_device(dev, d); } @@ -625,6 +714,22 @@ static int __devinit init_setup_pdc20265(struct pci_dev *dev, "attached to I2O RAID controller.\n"); return -ENODEV; } + +#if 0 + { + u8 pri = 0, sec = 0; + + if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) || + (tmp & e->mask) != e->val)) + + if (d->enablebits[0].reg != d->enablebits[1].reg) { + d->enablebits[0].reg = d->enablebits[1].reg; + d->enablebits[0].mask = d->enablebits[1].mask; + d->enablebits[0].val = d->enablebits[1].val; + } + } +#endif + return ide_setup_pci_device(dev, d); } diff --git a/trunk/drivers/ide/pci/sc1200.c b/trunk/drivers/ide/pci/sc1200.c index 778b82ae964d..24e21b2838c1 100644 --- a/trunk/drivers/ide/pci/sc1200.c +++ b/trunk/drivers/ide/pci/sc1200.c @@ -395,6 +395,7 @@ static int sc1200_resume (struct pci_dev *dev) { ide_hwif_t *hwif = NULL; +printk("SC1200: resume\n"); pci_set_power_state(dev, PCI_D0); // bring chip back from sleep state dev->current_state = PM_EVENT_ON; pci_enable_device(dev); @@ -404,6 +405,7 @@ static int sc1200_resume (struct pci_dev *dev) while ((hwif = lookup_pci_dev(hwif, dev)) != NULL) { unsigned int basereg, r, d, format; sc1200_saved_state_t *ss = (sc1200_saved_state_t *)hwif->config_data; +printk("%s: SC1200: resume\n", hwif->name); // // Restore timing registers: this may be unnecessary if BIOS also does it @@ -491,7 +493,7 @@ static int __devinit sc1200_init_one(struct pci_dev *dev, const struct pci_devic } static struct pci_device_id sc1200_pci_tbl[] = { - { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SCx200_IDE), 0}, + { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SCx200_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { 0, }, }; MODULE_DEVICE_TABLE(pci, sc1200_pci_tbl); diff --git a/trunk/drivers/ide/pci/serverworks.c b/trunk/drivers/ide/pci/serverworks.c index 5100b827a935..0d3073f4eab4 100644 --- a/trunk/drivers/ide/pci/serverworks.c +++ b/trunk/drivers/ide/pci/serverworks.c @@ -123,11 +123,11 @@ static u8 svwks_csb_check (struct pci_dev *dev) } static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed) { - static const u8 udma_modes[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 }; - static const u8 dma_modes[] = { 0x77, 0x21, 0x20 }; - static const u8 pio_modes[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 }; - static const u8 drive_pci[] = { 0x41, 0x40, 0x43, 0x42 }; - static const u8 drive_pci2[] = { 0x45, 0x44, 0x47, 0x46 }; + u8 udma_modes[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 }; + u8 dma_modes[] = { 0x77, 0x21, 0x20 }; + u8 pio_modes[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 }; + u8 drive_pci[] = { 0x41, 0x40, 0x43, 0x42 }; + u8 drive_pci2[] = { 0x45, 0x44, 0x47, 0x46 }; ide_hwif_t *hwif = HWIF(drive); struct pci_dev *dev = hwif->pci_dev; @@ -392,6 +392,16 @@ static unsigned int __devinit init_chipset_svwks (struct pci_dev *dev, const cha } outb_p(0x06, 0x0c00); dev->irq = inb_p(0x0c01); +#if 0 + printk("%s: device class (0x%04x)\n", + name, dev->class); + if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE) { + dev->class &= ~0x000F0F00; + // dev->class |= ~0x00000400; + dev->class |= ~0x00010100; + /**/ + } +#endif } else { struct pci_dev * findev = NULL; u8 reg41 = 0; @@ -442,7 +452,7 @@ static unsigned int __devinit init_chipset_svwks (struct pci_dev *dev, const cha pci_write_config_byte(dev, 0x5A, btr); } - return dev->irq; + return (dev->irq) ? dev->irq : 0; } static unsigned int __devinit ata66_svwks_svwks (ide_hwif_t *hwif) @@ -490,6 +500,11 @@ static unsigned int __devinit ata66_svwks (ide_hwif_t *hwif) { struct pci_dev *dev = hwif->pci_dev; + /* Per Specified Design by OEM, and ASIC Architect */ + if ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) || + (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)) + return 1; + /* Server Works */ if (dev->subsystem_vendor == PCI_VENDOR_ID_SERVERWORKS) return ata66_svwks_svwks (hwif); @@ -502,14 +517,10 @@ static unsigned int __devinit ata66_svwks (ide_hwif_t *hwif) if (dev->subsystem_vendor == PCI_VENDOR_ID_SUN) return ata66_svwks_cobalt (hwif); - /* Per Specified Design by OEM, and ASIC Architect */ - if ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) || - (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)) - return 1; - return 0; } +#undef CAN_SW_DMA static void __devinit init_hwif_svwks (ide_hwif_t *hwif) { u8 dma_stat = 0; @@ -526,6 +537,9 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif) hwif->ultra_mask = 0x3f; hwif->mwdma_mask = 0x07; +#ifdef CAN_SW_DMA + hwif->swdma_mask = 0x07; +#endif /* CAN_SW_DMA */ hwif->autodma = 0; @@ -548,6 +562,8 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif) hwif->drives[1].autodma = (dma_stat & 0x40); hwif->drives[0].autotune = (!(dma_stat & 0x20)); hwif->drives[1].autotune = (!(dma_stat & 0x40)); +// hwif->drives[0].autodma = hwif->autodma; +// hwif->drives[1].autodma = hwif->autodma; } /* @@ -577,6 +593,11 @@ static int __devinit init_setup_csb6 (struct pci_dev *dev, ide_pci_device_t *d) if (dev->resource[0].start == 0x01f1) d->bootable = ON_BOARD; } +#if 0 + if ((IDE_PCI_DEVID_EQ(d->devid, DEVID_CSB6) && + (!(PCI_FUNC(dev->devfn) & 1))) + d->autodma = AUTODMA; +#endif d->channels = ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE || dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) && @@ -650,11 +671,11 @@ static int __devinit svwks_init_one(struct pci_dev *dev, const struct pci_device } static struct pci_device_id svwks_pci_tbl[] = { - { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4IDE), 0}, - { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5IDE), 1}, - { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE), 2}, - { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2), 3}, - { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000IDE), 4}, + { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, + { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2}, + { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3}, + { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4}, { 0, }, }; MODULE_DEVICE_TABLE(pci, svwks_pci_tbl); diff --git a/trunk/drivers/ide/pci/siimage.c b/trunk/drivers/ide/pci/siimage.c index 72dade14c725..f1ca154dd52c 100644 --- a/trunk/drivers/ide/pci/siimage.c +++ b/trunk/drivers/ide/pci/siimage.c @@ -38,6 +38,9 @@ #include +#undef SIIMAGE_VIRTUAL_DMAPIO +#undef SIIMAGE_LARGE_DMA + /** * pdev_is_sata - check if device is SATA * @pdev: PCI device to check @@ -458,6 +461,36 @@ static int siimage_io_ide_dma_test_irq (ide_drive_t *drive) return 0; } +#if 0 +/** + * siimage_mmio_ide_dma_count - DMA bytes done + * @drive + * + * If we are doing VDMA the CMD680 requires a little bit + * of more careful handling and we have to read the counts + * off ourselves. For non VDMA life is normal. + */ + +static int siimage_mmio_ide_dma_count (ide_drive_t *drive) +{ +#ifdef SIIMAGE_VIRTUAL_DMAPIO + struct request *rq = HWGROUP(drive)->rq; + ide_hwif_t *hwif = HWIF(drive); + u32 count = (rq->nr_sectors * SECTOR_SIZE); + u32 rcount = 0; + unsigned long addr = siimage_selreg(hwif, 0x1C); + + hwif->OUTL(count, addr); + rcount = hwif->INL(addr); + + printk("\n%s: count = %d, rcount = %d, nr_sectors = %lu\n", + drive->name, count, rcount, rq->nr_sectors); + +#endif /* SIIMAGE_VIRTUAL_DMAPIO */ + return __ide_dma_count(drive); +} +#endif + /** * siimage_mmio_ide_dma_test_irq - check we caused an IRQ * @drive: drive we are testing @@ -479,10 +512,12 @@ static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive) u32 sata_error = hwif->INL(SATA_ERROR_REG); hwif->OUTL(sata_error, SATA_ERROR_REG); watchdog = (sata_error & 0x00680000) ? 1 : 0; +#if 1 printk(KERN_WARNING "%s: sata_error = 0x%08x, " "watchdog = %d, %s\n", drive->name, sata_error, watchdog, __FUNCTION__); +#endif } else { watchdog = (ext_stat & 0x8000) ? 1 : 0; @@ -828,7 +863,7 @@ static unsigned int __devinit init_chipset_siimage(struct pci_dev *dev, const ch * time. * * The hardware supports buffered taskfiles and also some rather nice - * extended PRD tables. For better SI3112 support use the libata driver + * extended PRD tables. Unfortunately right now we don't. */ static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif) @@ -865,6 +900,9 @@ static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif) * so we can't currently use it sanely since we want to * use LBA48 mode. */ +// base += 0x10; +// hwif->no_lba48 = 1; + hw.io_ports[IDE_DATA_OFFSET] = base; hw.io_ports[IDE_ERROR_OFFSET] = base + 1; hw.io_ports[IDE_NSECTOR_OFFSET] = base + 2; @@ -898,8 +936,15 @@ static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif) base = (unsigned long) addr; +#ifdef SIIMAGE_LARGE_DMA +/* Watch the brackets - even Ken and Dennis get some language design wrong */ + hwif->dma_base = base + (ch ? 0x18 : 0x10); + hwif->dma_base2 = base + (ch ? 0x08 : 0x00); + hwif->dma_prdtable = hwif->dma_base2 + 4; +#else /* ! SIIMAGE_LARGE_DMA */ hwif->dma_base = base + (ch ? 0x08 : 0x00); hwif->dma_base2 = base + (ch ? 0x18 : 0x10); +#endif /* SIIMAGE_LARGE_DMA */ hwif->mmio = 2; } @@ -1007,16 +1052,9 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif) hwif->reset_poll = &siimage_reset_poll; hwif->pre_reset = &siimage_pre_reset; - if(is_sata(hwif)) { - static int first = 1; - + if(is_sata(hwif)) hwif->busproc = &siimage_busproc; - if (first) { - printk(KERN_INFO "siimage: For full SATA support you should use the libata sata_sil module.\n"); - first = 0; - } - } if (!hwif->dma_base) { hwif->drives[0].autotune = 1; hwif->drives[1].autotune = 1; @@ -1083,10 +1121,10 @@ static int __devinit siimage_init_one(struct pci_dev *dev, const struct pci_devi } static struct pci_device_id siimage_pci_tbl[] = { - { PCI_DEVICE(PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_680), 0}, + { PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_680, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, #ifdef CONFIG_BLK_DEV_IDE_SATA - { PCI_DEVICE(PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_3112), 1}, - { PCI_DEVICE(PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_1210SA), 2}, + { PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, + { PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_1210SA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2}, #endif { 0, }, }; diff --git a/trunk/drivers/ide/pci/sl82c105.c b/trunk/drivers/ide/pci/sl82c105.c index 900301e43818..8a5c7b286b2b 100644 --- a/trunk/drivers/ide/pci/sl82c105.c +++ b/trunk/drivers/ide/pci/sl82c105.c @@ -447,6 +447,7 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif) printk(" %s: Winbond 553 bridge revision %d, BM-DMA disabled\n", hwif->name, rev); } else { +#ifdef CONFIG_BLK_DEV_IDEDMA dma_state |= 0x60; hwif->atapi_dma = 1; @@ -467,6 +468,7 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif) if (hwif->mate) hwif->serialized = hwif->mate->serialized = 1; +#endif /* CONFIG_BLK_DEV_IDEDMA */ } hwif->OUTB(dma_state, hwif->dma_base + 2); } @@ -487,7 +489,7 @@ static int __devinit sl82c105_init_one(struct pci_dev *dev, const struct pci_dev } static struct pci_device_id sl82c105_pci_tbl[] = { - { PCI_DEVICE(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105), 0}, + { PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { 0, }, }; MODULE_DEVICE_TABLE(pci, sl82c105_pci_tbl); diff --git a/trunk/drivers/ide/pci/slc90e66.c b/trunk/drivers/ide/pci/slc90e66.c index 0968f6bc669a..5112c726633b 100644 --- a/trunk/drivers/ide/pci/slc90e66.c +++ b/trunk/drivers/ide/pci/slc90e66.c @@ -72,8 +72,7 @@ static void slc90e66_tune_drive (ide_drive_t *drive, u8 pio) u16 master_data; u8 slave_data; /* ISP RTC */ - static const u8 timings[][2]= { - { 0, 0 }, + u8 timings[][2] = { { 0, 0 }, { 0, 0 }, { 1, 0 }, { 2, 1 }, @@ -120,6 +119,7 @@ static int slc90e66_tune_chipset (ide_drive_t *drive, u8 xferspeed) pci_read_config_word(dev, 0x4a, ®4a); switch(speed) { +#ifdef CONFIG_BLK_DEV_IDEDMA case XFER_UDMA_4: u_speed = 4 << (drive->dn * 4); break; case XFER_UDMA_3: u_speed = 3 << (drive->dn * 4); break; case XFER_UDMA_2: u_speed = 2 << (drive->dn * 4); break; @@ -128,6 +128,7 @@ static int slc90e66_tune_chipset (ide_drive_t *drive, u8 xferspeed) case XFER_MW_DMA_2: case XFER_MW_DMA_1: case XFER_SW_DMA_2: break; +#endif /* CONFIG_BLK_DEV_IDEDMA */ case XFER_PIO_4: case XFER_PIO_3: case XFER_PIO_2: @@ -155,6 +156,7 @@ static int slc90e66_tune_chipset (ide_drive_t *drive, u8 xferspeed) return (ide_config_drive_speed(drive, speed)); } +#ifdef CONFIG_BLK_DEV_IDEDMA static int slc90e66_config_drive_for_dma (ide_drive_t *drive) { u8 speed = ide_dma_speed(drive, slc90e66_ratemask(drive)); @@ -192,6 +194,7 @@ static int slc90e66_config_drive_xfer_rate (ide_drive_t *drive) /* IORDY not supported */ return 0; } +#endif /* CONFIG_BLK_DEV_IDEDMA */ static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif) { @@ -219,6 +222,7 @@ static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif) hwif->mwdma_mask = 0x07; hwif->swdma_mask = 0x07; +#ifdef CONFIG_BLK_DEV_IDEDMA if (!(hwif->udma_four)) /* bit[0(1)]: 0:80, 1:40 */ hwif->udma_four = (reg47 & mask) ? 0 : 1; @@ -228,6 +232,7 @@ static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif) hwif->autodma = 1; hwif->drives[0].autodma = hwif->autodma; hwif->drives[1].autodma = hwif->autodma; +#endif /* !CONFIG_BLK_DEV_IDEDMA */ } static ide_pci_device_t slc90e66_chipset __devinitdata = { @@ -245,7 +250,7 @@ static int __devinit slc90e66_init_one(struct pci_dev *dev, const struct pci_dev } static struct pci_device_id slc90e66_pci_tbl[] = { - { PCI_DEVICE(PCI_VENDOR_ID_EFAR, PCI_DEVICE_ID_EFAR_SLC90E66_1), 0}, + { PCI_VENDOR_ID_EFAR, PCI_DEVICE_ID_EFAR_SLC90E66_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { 0, }, }; MODULE_DEVICE_TABLE(pci, slc90e66_pci_tbl); diff --git a/trunk/drivers/rtc/Kconfig b/trunk/drivers/rtc/Kconfig index f2fc81a9074d..bccff400b198 100644 --- a/trunk/drivers/rtc/Kconfig +++ b/trunk/drivers/rtc/Kconfig @@ -162,16 +162,6 @@ config RTC_DRV_PCF8583 This driver can also be built as a module. If so, the module will be called rtc-pcf8583. -config RTC_DRV_RS5C348 - tristate "Ricoh RS5C348A/B" - depends on RTC_CLASS && SPI - help - If you say yes here you get support for the - Ricoh RS5C348A and RS5C348B RTC chips. - - This driver can also be built as a module. If so, the module - will be called rtc-rs5c348. - config RTC_DRV_RS5C372 tristate "Ricoh RS5C372A/B" depends on RTC_CLASS && I2C diff --git a/trunk/drivers/rtc/Makefile b/trunk/drivers/rtc/Makefile index da5e38774e13..900d210dd1a2 100644 --- a/trunk/drivers/rtc/Makefile +++ b/trunk/drivers/rtc/Makefile @@ -19,7 +19,6 @@ obj-$(CONFIG_RTC_DRV_DS1742) += rtc-ds1742.o obj-$(CONFIG_RTC_DRV_PCF8563) += rtc-pcf8563.o obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o obj-$(CONFIG_RTC_DRV_RS5C372) += rtc-rs5c372.o -obj-$(CONFIG_RTC_DRV_RS5C348) += rtc-rs5c348.o obj-$(CONFIG_RTC_DRV_M48T86) += rtc-m48t86.o obj-$(CONFIG_RTC_DRV_DS1553) += rtc-ds1553.o obj-$(CONFIG_RTC_DRV_EP93XX) += rtc-ep93xx.o diff --git a/trunk/drivers/rtc/rtc-rs5c348.c b/trunk/drivers/rtc/rtc-rs5c348.c deleted file mode 100644 index 0964d1dba925..000000000000 --- a/trunk/drivers/rtc/rtc-rs5c348.c +++ /dev/null @@ -1,246 +0,0 @@ -/* - * A SPI driver for the Ricoh RS5C348 RTC - * - * Copyright (C) 2006 Atsushi Nemoto - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * The board specific init code should provide characteristics of this - * device: - * Mode 1 (High-Active, Shift-Then-Sample), High Avtive CS - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define DRV_VERSION "0.1" - -#define RS5C348_REG_SECS 0 -#define RS5C348_REG_MINS 1 -#define RS5C348_REG_HOURS 2 -#define RS5C348_REG_WDAY 3 -#define RS5C348_REG_DAY 4 -#define RS5C348_REG_MONTH 5 -#define RS5C348_REG_YEAR 6 -#define RS5C348_REG_CTL1 14 -#define RS5C348_REG_CTL2 15 - -#define RS5C348_SECS_MASK 0x7f -#define RS5C348_MINS_MASK 0x7f -#define RS5C348_HOURS_MASK 0x3f -#define RS5C348_WDAY_MASK 0x03 -#define RS5C348_DAY_MASK 0x3f -#define RS5C348_MONTH_MASK 0x1f - -#define RS5C348_BIT_PM 0x20 /* REG_HOURS */ -#define RS5C348_BIT_Y2K 0x80 /* REG_MONTH */ -#define RS5C348_BIT_24H 0x20 /* REG_CTL1 */ -#define RS5C348_BIT_XSTP 0x10 /* REG_CTL2 */ -#define RS5C348_BIT_VDET 0x40 /* REG_CTL2 */ - -#define RS5C348_CMD_W(addr) (((addr) << 4) | 0x08) /* single write */ -#define RS5C348_CMD_R(addr) (((addr) << 4) | 0x0c) /* single read */ -#define RS5C348_CMD_MW(addr) (((addr) << 4) | 0x00) /* burst write */ -#define RS5C348_CMD_MR(addr) (((addr) << 4) | 0x04) /* burst read */ - -struct rs5c348_plat_data { - struct rtc_device *rtc; - int rtc_24h; -}; - -static int -rs5c348_rtc_set_time(struct device *dev, struct rtc_time *tm) -{ - struct spi_device *spi = to_spi_device(dev); - struct rs5c348_plat_data *pdata = spi->dev.platform_data; - u8 txbuf[5+7], *txp; - int ret; - - /* Transfer 5 bytes before writing SEC. This gives 31us for carry. */ - txp = txbuf; - txbuf[0] = RS5C348_CMD_R(RS5C348_REG_CTL2); /* cmd, ctl2 */ - txbuf[1] = 0; /* dummy */ - txbuf[2] = RS5C348_CMD_R(RS5C348_REG_CTL2); /* cmd, ctl2 */ - txbuf[3] = 0; /* dummy */ - txbuf[4] = RS5C348_CMD_MW(RS5C348_REG_SECS); /* cmd, sec, ... */ - txp = &txbuf[5]; - txp[RS5C348_REG_SECS] = BIN2BCD(tm->tm_sec); - txp[RS5C348_REG_MINS] = BIN2BCD(tm->tm_min); - if (pdata->rtc_24h) { - txp[RS5C348_REG_HOURS] = BIN2BCD(tm->tm_hour); - } else { - /* hour 0 is AM12, noon is PM12 */ - txp[RS5C348_REG_HOURS] = BIN2BCD((tm->tm_hour + 11) % 12 + 1) | - (tm->tm_hour >= 12 ? RS5C348_BIT_PM : 0); - } - txp[RS5C348_REG_WDAY] = BIN2BCD(tm->tm_wday); - txp[RS5C348_REG_DAY] = BIN2BCD(tm->tm_mday); - txp[RS5C348_REG_MONTH] = BIN2BCD(tm->tm_mon + 1) | - (tm->tm_year >= 100 ? RS5C348_BIT_Y2K : 0); - txp[RS5C348_REG_YEAR] = BIN2BCD(tm->tm_year % 100); - /* write in one transfer to avoid data inconsistency */ - ret = spi_write_then_read(spi, txbuf, sizeof(txbuf), NULL, 0); - udelay(62); /* Tcsr 62us */ - return ret; -} - -static int -rs5c348_rtc_read_time(struct device *dev, struct rtc_time *tm) -{ - struct spi_device *spi = to_spi_device(dev); - struct rs5c348_plat_data *pdata = spi->dev.platform_data; - u8 txbuf[5], rxbuf[7]; - int ret; - - /* Transfer 5 byte befores reading SEC. This gives 31us for carry. */ - txbuf[0] = RS5C348_CMD_R(RS5C348_REG_CTL2); /* cmd, ctl2 */ - txbuf[1] = 0; /* dummy */ - txbuf[2] = RS5C348_CMD_R(RS5C348_REG_CTL2); /* cmd, ctl2 */ - txbuf[3] = 0; /* dummy */ - txbuf[4] = RS5C348_CMD_MR(RS5C348_REG_SECS); /* cmd, sec, ... */ - - /* read in one transfer to avoid data inconsistency */ - ret = spi_write_then_read(spi, txbuf, sizeof(txbuf), - rxbuf, sizeof(rxbuf)); - udelay(62); /* Tcsr 62us */ - if (ret < 0) - return ret; - - tm->tm_sec = BCD2BIN(rxbuf[RS5C348_REG_SECS] & RS5C348_SECS_MASK); - tm->tm_min = BCD2BIN(rxbuf[RS5C348_REG_MINS] & RS5C348_MINS_MASK); - tm->tm_hour = BCD2BIN(rxbuf[RS5C348_REG_HOURS] & RS5C348_HOURS_MASK); - if (!pdata->rtc_24h) { - tm->tm_hour %= 12; - if (rxbuf[RS5C348_REG_HOURS] & RS5C348_BIT_PM) - tm->tm_hour += 12; - } - tm->tm_wday = BCD2BIN(rxbuf[RS5C348_REG_WDAY] & RS5C348_WDAY_MASK); - tm->tm_mday = BCD2BIN(rxbuf[RS5C348_REG_DAY] & RS5C348_DAY_MASK); - tm->tm_mon = - BCD2BIN(rxbuf[RS5C348_REG_MONTH] & RS5C348_MONTH_MASK) - 1; - /* year is 1900 + tm->tm_year */ - tm->tm_year = BCD2BIN(rxbuf[RS5C348_REG_YEAR]) + - ((rxbuf[RS5C348_REG_MONTH] & RS5C348_BIT_Y2K) ? 100 : 0); - - if (rtc_valid_tm(tm) < 0) { - dev_err(&spi->dev, "retrieved date/time is not valid.\n"); - rtc_time_to_tm(0, tm); - } - - return 0; -} - -static struct rtc_class_ops rs5c348_rtc_ops = { - .read_time = rs5c348_rtc_read_time, - .set_time = rs5c348_rtc_set_time, -}; - -static struct spi_driver rs5c348_driver; - -static int __devinit rs5c348_probe(struct spi_device *spi) -{ - int ret; - struct rtc_device *rtc; - struct rs5c348_plat_data *pdata; - - pdata = kzalloc(sizeof(struct rs5c348_plat_data), GFP_KERNEL); - if (!pdata) - return -ENOMEM; - spi->dev.platform_data = pdata; - - /* Check D7 of SECOND register */ - ret = spi_w8r8(spi, RS5C348_CMD_R(RS5C348_REG_SECS)); - if (ret < 0 || (ret & 0x80)) { - dev_err(&spi->dev, "not found.\n"); - goto kfree_exit; - } - - dev_info(&spi->dev, "chip found, driver version " DRV_VERSION "\n"); - dev_info(&spi->dev, "spiclk %u KHz.\n", - (spi->max_speed_hz + 500) / 1000); - - /* turn RTC on if it was not on */ - ret = spi_w8r8(spi, RS5C348_CMD_R(RS5C348_REG_CTL2)); - if (ret < 0) - goto kfree_exit; - if (ret & (RS5C348_BIT_XSTP | RS5C348_BIT_VDET)) { - u8 buf[2]; - if (ret & RS5C348_BIT_VDET) - dev_warn(&spi->dev, "voltage-low detected.\n"); - buf[0] = RS5C348_CMD_W(RS5C348_REG_CTL2); - buf[1] = 0; - ret = spi_write_then_read(spi, buf, sizeof(buf), NULL, 0); - if (ret < 0) - goto kfree_exit; - } - - ret = spi_w8r8(spi, RS5C348_CMD_R(RS5C348_REG_CTL1)); - if (ret < 0) - goto kfree_exit; - if (ret & RS5C348_BIT_24H) - pdata->rtc_24h = 1; - - rtc = rtc_device_register(rs5c348_driver.driver.name, &spi->dev, - &rs5c348_rtc_ops, THIS_MODULE); - - if (IS_ERR(rtc)) { - ret = PTR_ERR(rtc); - goto kfree_exit; - } - - pdata->rtc = rtc; - - return 0; - kfree_exit: - kfree(pdata); - return ret; -} - -static int __devexit rs5c348_remove(struct spi_device *spi) -{ - struct rs5c348_plat_data *pdata = spi->dev.platform_data; - struct rtc_device *rtc = pdata->rtc; - - if (rtc) - rtc_device_unregister(rtc); - kfree(pdata); - return 0; -} - -static struct spi_driver rs5c348_driver = { - .driver = { - .name = "rs5c348", - .bus = &spi_bus_type, - .owner = THIS_MODULE, - }, - .probe = rs5c348_probe, - .remove = __devexit_p(rs5c348_remove), -}; - -static __init int rs5c348_init(void) -{ - return spi_register_driver(&rs5c348_driver); -} - -static __exit void rs5c348_exit(void) -{ - spi_unregister_driver(&rs5c348_driver); -} - -module_init(rs5c348_init); -module_exit(rs5c348_exit); - -MODULE_AUTHOR("Atsushi Nemoto "); -MODULE_DESCRIPTION("Ricoh RS5C348 RTC driver"); -MODULE_LICENSE("GPL"); -MODULE_VERSION(DRV_VERSION); diff --git a/trunk/drivers/serial/crisv10.c b/trunk/drivers/serial/crisv10.c index 5cacc5e74a92..89700141f87e 100644 --- a/trunk/drivers/serial/crisv10.c +++ b/trunk/drivers/serial/crisv10.c @@ -2573,6 +2573,12 @@ static void flush_to_flip_buffer(struct e100_serial *info) DFLIP( if (1) { + + if (test_bit(TTY_DONT_FLIP, &tty->flags)) { + DEBUG_LOG(info->line, "*** TTY_DONT_FLIP set flip.count %i ***\n", tty->flip.count); + DEBUG_LOG(info->line, "*** recv_cnt %i\n", info->recv_cnt); + } else { + } DEBUG_LOG(info->line, "*** rxtot %i\n", info->icount.rx); DEBUG_LOG(info->line, "ldisc %lu\n", tty->ldisc.chars_in_buffer(tty)); DEBUG_LOG(info->line, "room %lu\n", tty->ldisc.receive_room(tty)); diff --git a/trunk/drivers/serial/jsm/jsm_tty.c b/trunk/drivers/serial/jsm/jsm_tty.c index f8262e6ad8d3..7d823705193c 100644 --- a/trunk/drivers/serial/jsm/jsm_tty.c +++ b/trunk/drivers/serial/jsm/jsm_tty.c @@ -588,6 +588,13 @@ void jsm_input(struct jsm_channel *ch) len = min(len, (N_TTY_BUF_SIZE - 1) - tp->read_cnt); ld = tty_ldisc_ref(tp); + /* + * If the DONT_FLIP flag is on, don't flush our buffer, and act + * like the ld doesn't have any space to put the data right now. + */ + if (test_bit(TTY_DONT_FLIP, &tp->flags)) + len = 0; + /* * If we were unable to get a reference to the ld, * don't flush our buffer, and act like the ld doesn't diff --git a/trunk/drivers/usb/serial/ir-usb.c b/trunk/drivers/usb/serial/ir-usb.c index d7f3f736a692..9432c7302275 100644 --- a/trunk/drivers/usb/serial/ir-usb.c +++ b/trunk/drivers/usb/serial/ir-usb.c @@ -453,7 +453,8 @@ static void ir_read_bulk_callback (struct urb *urb, struct pt_regs *regs) tty = port->tty; /* - * FIXME: must not do this in IRQ context + * FIXME: must not do this in IRQ context, + * must honour TTY_DONT_FLIP */ tty->ldisc.receive_buf( tty, diff --git a/trunk/drivers/video/aty/radeon_backlight.c b/trunk/drivers/video/aty/radeon_backlight.c index 1755dddf1899..7de66b855d4e 100644 --- a/trunk/drivers/video/aty/radeon_backlight.c +++ b/trunk/drivers/video/aty/radeon_backlight.c @@ -40,14 +40,14 @@ static int radeon_bl_get_level_brightness(struct radeon_bl_privdata *pdata, mutex_unlock(&info->bl_mutex); + if (pdata->negative) + rlevel = MAX_RADEON_LEVEL - rlevel; + if (rlevel < 0) rlevel = 0; else if (rlevel > MAX_RADEON_LEVEL) rlevel = MAX_RADEON_LEVEL; - if (pdata->negative) - rlevel = MAX_RADEON_LEVEL - rlevel; - return rlevel; } diff --git a/trunk/fs/9p/mux.c b/trunk/fs/9p/mux.c index 8d45ed668837..12e1baa4508d 100644 --- a/trunk/fs/9p/mux.c +++ b/trunk/fs/9p/mux.c @@ -932,8 +932,6 @@ v9fs_mux_rpc(struct v9fs_mux_data *m, struct v9fs_fcall *tc, r.rcall || r.err); } while (!r.rcall && !r.err && err==-ERESTARTSYS && m->trans->status==Connected && !m->err); - - err = -ERESTARTSYS; } sigpending = 1; } diff --git a/trunk/fs/9p/v9fs_vfs.h b/trunk/fs/9p/v9fs_vfs.h index 450b0c1b385e..f867b8d3e973 100644 --- a/trunk/fs/9p/v9fs_vfs.h +++ b/trunk/fs/9p/v9fs_vfs.h @@ -38,7 +38,7 @@ */ extern struct file_system_type v9fs_fs_type; -extern const struct address_space_operations v9fs_addr_operations; +extern struct address_space_operations v9fs_addr_operations; extern const struct file_operations v9fs_file_operations; extern const struct file_operations v9fs_dir_operations; extern struct dentry_operations v9fs_dentry_operations; diff --git a/trunk/fs/9p/vfs_addr.c b/trunk/fs/9p/vfs_addr.c index d4f0aa3c87f2..efda46fb64d9 100644 --- a/trunk/fs/9p/vfs_addr.c +++ b/trunk/fs/9p/vfs_addr.c @@ -103,6 +103,6 @@ static int v9fs_vfs_readpage(struct file *filp, struct page *page) return retval; } -const struct address_space_operations v9fs_addr_operations = { +struct address_space_operations v9fs_addr_operations = { .readpage = v9fs_vfs_readpage, }; diff --git a/trunk/fs/9p/vfs_inode.c b/trunk/fs/9p/vfs_inode.c index 2f580a197b8d..5c6bdf82146c 100644 --- a/trunk/fs/9p/vfs_inode.c +++ b/trunk/fs/9p/vfs_inode.c @@ -300,7 +300,7 @@ v9fs_create(struct v9fs_session_info *v9ses, u32 pfid, char *name, u32 perm, fid = V9FS_NOFID; put_fid: - if (fid != V9FS_NOFID) + if (fid >= 0) v9fs_put_idpool(fid, &v9ses->fidpool); kfree(fcall); diff --git a/trunk/fs/adfs/inode.c b/trunk/fs/adfs/inode.c index 534f3eecc985..a02802a30798 100644 --- a/trunk/fs/adfs/inode.c +++ b/trunk/fs/adfs/inode.c @@ -72,7 +72,7 @@ static sector_t _adfs_bmap(struct address_space *mapping, sector_t block) return generic_block_bmap(mapping, block, adfs_get_block); } -static const struct address_space_operations adfs_aops = { +static struct address_space_operations adfs_aops = { .readpage = adfs_readpage, .writepage = adfs_writepage, .sync_page = block_sync_page, diff --git a/trunk/fs/affs/affs.h b/trunk/fs/affs/affs.h index 0ddd4cc0d1a0..a43a876742b8 100644 --- a/trunk/fs/affs/affs.h +++ b/trunk/fs/affs/affs.h @@ -195,9 +195,9 @@ extern struct inode_operations affs_symlink_inode_operations; extern const struct file_operations affs_file_operations; extern const struct file_operations affs_file_operations_ofs; extern const struct file_operations affs_dir_operations; -extern const struct address_space_operations affs_symlink_aops; -extern const struct address_space_operations affs_aops; -extern const struct address_space_operations affs_aops_ofs; +extern struct address_space_operations affs_symlink_aops; +extern struct address_space_operations affs_aops; +extern struct address_space_operations affs_aops_ofs; extern struct dentry_operations affs_dentry_operations; extern struct dentry_operations affs_dentry_operations_intl; diff --git a/trunk/fs/affs/file.c b/trunk/fs/affs/file.c index 3de8590e4f6a..7076262af39b 100644 --- a/trunk/fs/affs/file.c +++ b/trunk/fs/affs/file.c @@ -406,7 +406,7 @@ static sector_t _affs_bmap(struct address_space *mapping, sector_t block) { return generic_block_bmap(mapping,block,affs_get_block); } -const struct address_space_operations affs_aops = { +struct address_space_operations affs_aops = { .readpage = affs_readpage, .writepage = affs_writepage, .sync_page = block_sync_page, @@ -759,7 +759,7 @@ static int affs_commit_write_ofs(struct file *file, struct page *page, unsigned goto done; } -const struct address_space_operations affs_aops_ofs = { +struct address_space_operations affs_aops_ofs = { .readpage = affs_readpage_ofs, //.writepage = affs_writepage_ofs, //.sync_page = affs_sync_page_ofs, diff --git a/trunk/fs/affs/symlink.c b/trunk/fs/affs/symlink.c index f802256a5933..426f0f094f23 100644 --- a/trunk/fs/affs/symlink.c +++ b/trunk/fs/affs/symlink.c @@ -66,7 +66,7 @@ static int affs_symlink_readpage(struct file *file, struct page *page) return err; } -const struct address_space_operations affs_symlink_aops = { +struct address_space_operations affs_symlink_aops = { .readpage = affs_symlink_readpage, }; diff --git a/trunk/fs/afs/file.c b/trunk/fs/afs/file.c index 67d6634101fd..7bb716887e29 100644 --- a/trunk/fs/afs/file.c +++ b/trunk/fs/afs/file.c @@ -35,7 +35,7 @@ struct inode_operations afs_file_inode_operations = { .getattr = afs_inode_getattr, }; -const struct address_space_operations afs_fs_aops = { +struct address_space_operations afs_fs_aops = { .readpage = afs_file_readpage, .sync_page = block_sync_page, .set_page_dirty = __set_page_dirty_nobuffers, diff --git a/trunk/fs/afs/internal.h b/trunk/fs/afs/internal.h index e88b3b65ae49..72febdf9a35a 100644 --- a/trunk/fs/afs/internal.h +++ b/trunk/fs/afs/internal.h @@ -69,7 +69,7 @@ extern const struct file_operations afs_dir_file_operations; /* * file.c */ -extern const struct address_space_operations afs_fs_aops; +extern struct address_space_operations afs_fs_aops; extern struct inode_operations afs_file_inode_operations; #ifdef AFS_CACHING_SUPPORT diff --git a/trunk/fs/befs/linuxvfs.c b/trunk/fs/befs/linuxvfs.c index a83e889a97cd..08201fab26cd 100644 --- a/trunk/fs/befs/linuxvfs.c +++ b/trunk/fs/befs/linuxvfs.c @@ -73,7 +73,7 @@ static struct inode_operations befs_dir_inode_operations = { .lookup = befs_lookup, }; -static const struct address_space_operations befs_aops = { +static struct address_space_operations befs_aops = { .readpage = befs_readpage, .sync_page = block_sync_page, .bmap = befs_bmap, diff --git a/trunk/fs/bfs/bfs.h b/trunk/fs/bfs/bfs.h index 31973bbbf057..9d791004b21c 100644 --- a/trunk/fs/bfs/bfs.h +++ b/trunk/fs/bfs/bfs.h @@ -50,7 +50,7 @@ static inline struct bfs_inode_info *BFS_I(struct inode *inode) /* file.c */ extern struct inode_operations bfs_file_inops; extern const struct file_operations bfs_file_operations; -extern const struct address_space_operations bfs_aops; +extern struct address_space_operations bfs_aops; /* dir.c */ extern struct inode_operations bfs_dir_inops; diff --git a/trunk/fs/bfs/file.c b/trunk/fs/bfs/file.c index 3d5aca28a0a0..d83cd74a2e4e 100644 --- a/trunk/fs/bfs/file.c +++ b/trunk/fs/bfs/file.c @@ -153,7 +153,7 @@ static sector_t bfs_bmap(struct address_space *mapping, sector_t block) return generic_block_bmap(mapping, block, bfs_get_block); } -const struct address_space_operations bfs_aops = { +struct address_space_operations bfs_aops = { .readpage = bfs_readpage, .writepage = bfs_writepage, .sync_page = block_sync_page, diff --git a/trunk/fs/block_dev.c b/trunk/fs/block_dev.c index 7f7600e2381c..028d9fb9c2d5 100644 --- a/trunk/fs/block_dev.c +++ b/trunk/fs/block_dev.c @@ -1095,7 +1095,7 @@ static long block_ioctl(struct file *file, unsigned cmd, unsigned long arg) return blkdev_ioctl(file->f_mapping->host, file, cmd, arg); } -const struct address_space_operations def_blk_aops = { +struct address_space_operations def_blk_aops = { .readpage = blkdev_readpage, .writepage = blkdev_writepage, .sync_page = block_sync_page, diff --git a/trunk/fs/buffer.c b/trunk/fs/buffer.c index e9994722f4a3..f23bb647db47 100644 --- a/trunk/fs/buffer.c +++ b/trunk/fs/buffer.c @@ -2598,7 +2598,7 @@ int nobh_truncate_page(struct address_space *mapping, loff_t from) unsigned offset = from & (PAGE_CACHE_SIZE-1); unsigned to; struct page *page; - const struct address_space_operations *a_ops = mapping->a_ops; + struct address_space_operations *a_ops = mapping->a_ops; char *kaddr; int ret = 0; diff --git a/trunk/fs/cifs/cifsfs.h b/trunk/fs/cifs/cifsfs.h index 8f75c6f24701..a6384d83fdef 100644 --- a/trunk/fs/cifs/cifsfs.h +++ b/trunk/fs/cifs/cifsfs.h @@ -32,8 +32,8 @@ #define TRUE 1 #endif -extern const struct address_space_operations cifs_addr_ops; -extern const struct address_space_operations cifs_addr_ops_smallbuf; +extern struct address_space_operations cifs_addr_ops; +extern struct address_space_operations cifs_addr_ops_smallbuf; /* Functions related to super block operations */ extern struct super_operations cifs_super_ops; diff --git a/trunk/fs/cifs/file.c b/trunk/fs/cifs/file.c index 5861eb42e626..e9c1573f6aa7 100644 --- a/trunk/fs/cifs/file.c +++ b/trunk/fs/cifs/file.c @@ -1942,7 +1942,7 @@ static int cifs_prepare_write(struct file *file, struct page *page, return 0; } -const struct address_space_operations cifs_addr_ops = { +struct address_space_operations cifs_addr_ops = { .readpage = cifs_readpage, .readpages = cifs_readpages, .writepage = cifs_writepage, @@ -1959,7 +1959,7 @@ const struct address_space_operations cifs_addr_ops = { * contain the header plus one complete page of data. Otherwise, we need * to leave cifs_readpages out of the address space operations. */ -const struct address_space_operations cifs_addr_ops_smallbuf = { +struct address_space_operations cifs_addr_ops_smallbuf = { .readpage = cifs_readpage, .writepage = cifs_writepage, .writepages = cifs_writepages, diff --git a/trunk/fs/coda/symlink.c b/trunk/fs/coda/symlink.c index 76e00a65a75b..b35e5bbd9c99 100644 --- a/trunk/fs/coda/symlink.c +++ b/trunk/fs/coda/symlink.c @@ -50,6 +50,6 @@ static int coda_symlink_filler(struct file *file, struct page *page) return error; } -const struct address_space_operations coda_symlink_aops = { +struct address_space_operations coda_symlink_aops = { .readpage = coda_symlink_filler, }; diff --git a/trunk/fs/configfs/inode.c b/trunk/fs/configfs/inode.c index e14488ca6411..c153bd9534cb 100644 --- a/trunk/fs/configfs/inode.c +++ b/trunk/fs/configfs/inode.c @@ -38,7 +38,7 @@ extern struct super_block * configfs_sb; -static const struct address_space_operations configfs_aops = { +static struct address_space_operations configfs_aops = { .readpage = simple_readpage, .prepare_write = simple_prepare_write, .commit_write = simple_commit_write diff --git a/trunk/fs/cramfs/inode.c b/trunk/fs/cramfs/inode.c index 223c0431042d..c45d73860803 100644 --- a/trunk/fs/cramfs/inode.c +++ b/trunk/fs/cramfs/inode.c @@ -30,7 +30,7 @@ static struct super_operations cramfs_ops; static struct inode_operations cramfs_dir_inode_operations; static const struct file_operations cramfs_directory_operations; -static const struct address_space_operations cramfs_aops; +static struct address_space_operations cramfs_aops; static DEFINE_MUTEX(read_mutex); @@ -501,7 +501,7 @@ static int cramfs_readpage(struct file *file, struct page * page) return 0; } -static const struct address_space_operations cramfs_aops = { +static struct address_space_operations cramfs_aops = { .readpage = cramfs_readpage }; diff --git a/trunk/fs/efs/inode.c b/trunk/fs/efs/inode.c index 174696f9bf14..180607f9314d 100644 --- a/trunk/fs/efs/inode.c +++ b/trunk/fs/efs/inode.c @@ -21,7 +21,7 @@ static sector_t _efs_bmap(struct address_space *mapping, sector_t block) { return generic_block_bmap(mapping,block,efs_get_block); } -static const struct address_space_operations efs_aops = { +static struct address_space_operations efs_aops = { .readpage = efs_readpage, .sync_page = block_sync_page, .bmap = _efs_bmap diff --git a/trunk/fs/efs/symlink.c b/trunk/fs/efs/symlink.c index e249cf733a6b..3d9a350e3e7f 100644 --- a/trunk/fs/efs/symlink.c +++ b/trunk/fs/efs/symlink.c @@ -53,6 +53,6 @@ static int efs_symlink_readpage(struct file *file, struct page *page) return err; } -const struct address_space_operations efs_symlink_aops = { +struct address_space_operations efs_symlink_aops = { .readpage = efs_symlink_readpage }; diff --git a/trunk/fs/ext2/ext2.h b/trunk/fs/ext2/ext2.h index e65a019fc7a5..9f74a62be555 100644 --- a/trunk/fs/ext2/ext2.h +++ b/trunk/fs/ext2/ext2.h @@ -162,9 +162,9 @@ extern const struct file_operations ext2_file_operations; extern const struct file_operations ext2_xip_file_operations; /* inode.c */ -extern const struct address_space_operations ext2_aops; -extern const struct address_space_operations ext2_aops_xip; -extern const struct address_space_operations ext2_nobh_aops; +extern struct address_space_operations ext2_aops; +extern struct address_space_operations ext2_aops_xip; +extern struct address_space_operations ext2_nobh_aops; /* namei.c */ extern struct inode_operations ext2_dir_inode_operations; diff --git a/trunk/fs/ext2/inode.c b/trunk/fs/ext2/inode.c index fb4d3220eb8d..04af9c45dce2 100644 --- a/trunk/fs/ext2/inode.c +++ b/trunk/fs/ext2/inode.c @@ -684,7 +684,7 @@ ext2_writepages(struct address_space *mapping, struct writeback_control *wbc) return mpage_writepages(mapping, wbc, ext2_get_block); } -const struct address_space_operations ext2_aops = { +struct address_space_operations ext2_aops = { .readpage = ext2_readpage, .readpages = ext2_readpages, .writepage = ext2_writepage, @@ -697,12 +697,12 @@ const struct address_space_operations ext2_aops = { .migratepage = buffer_migrate_page, }; -const struct address_space_operations ext2_aops_xip = { +struct address_space_operations ext2_aops_xip = { .bmap = ext2_bmap, .get_xip_page = ext2_get_xip_page, }; -const struct address_space_operations ext2_nobh_aops = { +struct address_space_operations ext2_nobh_aops = { .readpage = ext2_readpage, .readpages = ext2_readpages, .writepage = ext2_nobh_writepage, diff --git a/trunk/fs/ext3/inode.c b/trunk/fs/ext3/inode.c index f804d5e9d60c..0321e1b9034a 100644 --- a/trunk/fs/ext3/inode.c +++ b/trunk/fs/ext3/inode.c @@ -1698,7 +1698,7 @@ static int ext3_journalled_set_page_dirty(struct page *page) return __set_page_dirty_nobuffers(page); } -static const struct address_space_operations ext3_ordered_aops = { +static struct address_space_operations ext3_ordered_aops = { .readpage = ext3_readpage, .readpages = ext3_readpages, .writepage = ext3_ordered_writepage, @@ -1712,7 +1712,7 @@ static const struct address_space_operations ext3_ordered_aops = { .migratepage = buffer_migrate_page, }; -static const struct address_space_operations ext3_writeback_aops = { +static struct address_space_operations ext3_writeback_aops = { .readpage = ext3_readpage, .readpages = ext3_readpages, .writepage = ext3_writeback_writepage, @@ -1726,7 +1726,7 @@ static const struct address_space_operations ext3_writeback_aops = { .migratepage = buffer_migrate_page, }; -static const struct address_space_operations ext3_journalled_aops = { +static struct address_space_operations ext3_journalled_aops = { .readpage = ext3_readpage, .readpages = ext3_readpages, .writepage = ext3_journalled_writepage, diff --git a/trunk/fs/fat/inode.c b/trunk/fs/fat/inode.c index 31b7174176ba..7c35d582ec10 100644 --- a/trunk/fs/fat/inode.c +++ b/trunk/fs/fat/inode.c @@ -196,7 +196,7 @@ static sector_t _fat_bmap(struct address_space *mapping, sector_t block) return generic_block_bmap(mapping, block, fat_get_block); } -static const struct address_space_operations fat_aops = { +static struct address_space_operations fat_aops = { .readpage = fat_readpage, .readpages = fat_readpages, .writepage = fat_writepage, diff --git a/trunk/fs/freevxfs/vxfs_immed.c b/trunk/fs/freevxfs/vxfs_immed.c index 4e25f3fbed86..6f5df1700e95 100644 --- a/trunk/fs/freevxfs/vxfs_immed.c +++ b/trunk/fs/freevxfs/vxfs_immed.c @@ -56,7 +56,7 @@ struct inode_operations vxfs_immed_symlink_iops = { /* * Adress space operations for immed files and directories. */ -const struct address_space_operations vxfs_immed_aops = { +struct address_space_operations vxfs_immed_aops = { .readpage = vxfs_immed_readpage, }; diff --git a/trunk/fs/freevxfs/vxfs_inode.c b/trunk/fs/freevxfs/vxfs_inode.c index ca6a39714771..f544aae9169f 100644 --- a/trunk/fs/freevxfs/vxfs_inode.c +++ b/trunk/fs/freevxfs/vxfs_inode.c @@ -41,8 +41,8 @@ #include "vxfs_extern.h" -extern const struct address_space_operations vxfs_aops; -extern const struct address_space_operations vxfs_immed_aops; +extern struct address_space_operations vxfs_aops; +extern struct address_space_operations vxfs_immed_aops; extern struct inode_operations vxfs_immed_symlink_iops; @@ -295,7 +295,7 @@ vxfs_read_inode(struct inode *ip) { struct super_block *sbp = ip->i_sb; struct vxfs_inode_info *vip; - const struct address_space_operations *aops; + struct address_space_operations *aops; ino_t ino = ip->i_ino; if (!(vip = __vxfs_iget(ino, VXFS_SBI(sbp)->vsi_ilist))) diff --git a/trunk/fs/freevxfs/vxfs_subr.c b/trunk/fs/freevxfs/vxfs_subr.c index decac62efe57..c1be118fc067 100644 --- a/trunk/fs/freevxfs/vxfs_subr.c +++ b/trunk/fs/freevxfs/vxfs_subr.c @@ -42,7 +42,7 @@ static int vxfs_readpage(struct file *, struct page *); static sector_t vxfs_bmap(struct address_space *, sector_t); -const struct address_space_operations vxfs_aops = { +struct address_space_operations vxfs_aops = { .readpage = vxfs_readpage, .bmap = vxfs_bmap, .sync_page = block_sync_page, diff --git a/trunk/fs/fuse/file.c b/trunk/fs/fuse/file.c index 63614ed16336..28aa81eae2cc 100644 --- a/trunk/fs/fuse/file.c +++ b/trunk/fs/fuse/file.c @@ -770,7 +770,7 @@ static const struct file_operations fuse_direct_io_file_operations = { /* no mmap and sendfile */ }; -static const struct address_space_operations fuse_file_aops = { +static struct address_space_operations fuse_file_aops = { .readpage = fuse_readpage, .prepare_write = fuse_prepare_write, .commit_write = fuse_commit_write, diff --git a/trunk/fs/hfs/hfs_fs.h b/trunk/fs/hfs/hfs_fs.h index 735332dfd1b8..3ed8663a8db1 100644 --- a/trunk/fs/hfs/hfs_fs.h +++ b/trunk/fs/hfs/hfs_fs.h @@ -182,8 +182,8 @@ extern void hfs_file_truncate(struct inode *); extern int hfs_get_block(struct inode *, sector_t, struct buffer_head *, int); /* inode.c */ -extern const struct address_space_operations hfs_aops; -extern const struct address_space_operations hfs_btree_aops; +extern struct address_space_operations hfs_aops; +extern struct address_space_operations hfs_btree_aops; extern struct inode *hfs_new_inode(struct inode *, struct qstr *, int); extern void hfs_inode_write_fork(struct inode *, struct hfs_extent *, __be32 *, __be32 *); diff --git a/trunk/fs/hfs/inode.c b/trunk/fs/hfs/inode.c index 315cf44a90b2..2d4ced22201b 100644 --- a/trunk/fs/hfs/inode.c +++ b/trunk/fs/hfs/inode.c @@ -114,7 +114,7 @@ static int hfs_writepages(struct address_space *mapping, return mpage_writepages(mapping, wbc, hfs_get_block); } -const struct address_space_operations hfs_btree_aops = { +struct address_space_operations hfs_btree_aops = { .readpage = hfs_readpage, .writepage = hfs_writepage, .sync_page = block_sync_page, @@ -124,7 +124,7 @@ const struct address_space_operations hfs_btree_aops = { .releasepage = hfs_releasepage, }; -const struct address_space_operations hfs_aops = { +struct address_space_operations hfs_aops = { .readpage = hfs_readpage, .writepage = hfs_writepage, .sync_page = block_sync_page, diff --git a/trunk/fs/hfsplus/hfsplus_fs.h b/trunk/fs/hfsplus/hfsplus_fs.h index 8a1ca5ef7ada..7ae393637a0c 100644 --- a/trunk/fs/hfsplus/hfsplus_fs.h +++ b/trunk/fs/hfsplus/hfsplus_fs.h @@ -323,8 +323,8 @@ int hfsplus_file_extend(struct inode *); void hfsplus_file_truncate(struct inode *); /* inode.c */ -extern const struct address_space_operations hfsplus_aops; -extern const struct address_space_operations hfsplus_btree_aops; +extern struct address_space_operations hfsplus_aops; +extern struct address_space_operations hfsplus_btree_aops; void hfsplus_inode_read_fork(struct inode *, struct hfsplus_fork_raw *); void hfsplus_inode_write_fork(struct inode *, struct hfsplus_fork_raw *); diff --git a/trunk/fs/hfsplus/inode.c b/trunk/fs/hfsplus/inode.c index 924ecdef8091..acf66dba3e01 100644 --- a/trunk/fs/hfsplus/inode.c +++ b/trunk/fs/hfsplus/inode.c @@ -109,7 +109,7 @@ static int hfsplus_writepages(struct address_space *mapping, return mpage_writepages(mapping, wbc, hfsplus_get_block); } -const struct address_space_operations hfsplus_btree_aops = { +struct address_space_operations hfsplus_btree_aops = { .readpage = hfsplus_readpage, .writepage = hfsplus_writepage, .sync_page = block_sync_page, @@ -119,7 +119,7 @@ const struct address_space_operations hfsplus_btree_aops = { .releasepage = hfsplus_releasepage, }; -const struct address_space_operations hfsplus_aops = { +struct address_space_operations hfsplus_aops = { .readpage = hfsplus_readpage, .writepage = hfsplus_writepage, .sync_page = block_sync_page, diff --git a/trunk/fs/hostfs/hostfs_kern.c b/trunk/fs/hostfs/hostfs_kern.c index b82e3d9c8790..8e0d37743e7c 100644 --- a/trunk/fs/hostfs/hostfs_kern.c +++ b/trunk/fs/hostfs/hostfs_kern.c @@ -54,7 +54,7 @@ static int append = 0; static struct inode_operations hostfs_iops; static struct inode_operations hostfs_dir_iops; -static const struct address_space_operations hostfs_link_aops; +static struct address_space_operations hostfs_link_aops; #ifndef MODULE static int __init hostfs_args(char *options, int *add) @@ -518,7 +518,7 @@ int hostfs_commit_write(struct file *file, struct page *page, unsigned from, return(err); } -static const struct address_space_operations hostfs_aops = { +static struct address_space_operations hostfs_aops = { .writepage = hostfs_writepage, .readpage = hostfs_readpage, .set_page_dirty = __set_page_dirty_nobuffers, @@ -935,7 +935,7 @@ int hostfs_link_readpage(struct file *file, struct page *page) return(err); } -static const struct address_space_operations hostfs_link_aops = { +static struct address_space_operations hostfs_link_aops = { .readpage = hostfs_link_readpage, }; diff --git a/trunk/fs/hpfs/file.c b/trunk/fs/hpfs/file.c index d9eb19b7b8ae..d3b9fffe45a1 100644 --- a/trunk/fs/hpfs/file.c +++ b/trunk/fs/hpfs/file.c @@ -99,7 +99,7 @@ static sector_t _hpfs_bmap(struct address_space *mapping, sector_t block) { return generic_block_bmap(mapping,block,hpfs_get_block); } -const struct address_space_operations hpfs_aops = { +struct address_space_operations hpfs_aops = { .readpage = hpfs_readpage, .writepage = hpfs_writepage, .sync_page = block_sync_page, diff --git a/trunk/fs/hpfs/hpfs_fn.h b/trunk/fs/hpfs/hpfs_fn.h index f687d54ed442..29b7a3e55173 100644 --- a/trunk/fs/hpfs/hpfs_fn.h +++ b/trunk/fs/hpfs/hpfs_fn.h @@ -268,7 +268,7 @@ void hpfs_set_ea(struct inode *, struct fnode *, char *, char *, int); int hpfs_file_fsync(struct file *, struct dentry *, int); extern const struct file_operations hpfs_file_ops; extern struct inode_operations hpfs_file_iops; -extern const struct address_space_operations hpfs_aops; +extern struct address_space_operations hpfs_aops; /* inode.c */ @@ -304,7 +304,7 @@ void hpfs_decide_conv(struct inode *, unsigned char *, unsigned); /* namei.c */ extern struct inode_operations hpfs_dir_iops; -extern const struct address_space_operations hpfs_symlink_aops; +extern struct address_space_operations hpfs_symlink_aops; static inline struct hpfs_inode_info *hpfs_i(struct inode *inode) { diff --git a/trunk/fs/hpfs/namei.c b/trunk/fs/hpfs/namei.c index 59e7dc182a0c..a03abb12c610 100644 --- a/trunk/fs/hpfs/namei.c +++ b/trunk/fs/hpfs/namei.c @@ -538,7 +538,7 @@ static int hpfs_symlink_readpage(struct file *file, struct page *page) return err; } -const struct address_space_operations hpfs_symlink_aops = { +struct address_space_operations hpfs_symlink_aops = { .readpage = hpfs_symlink_readpage }; diff --git a/trunk/fs/hugetlbfs/inode.c b/trunk/fs/hugetlbfs/inode.c index 6449cb697967..e6410d8edd0e 100644 --- a/trunk/fs/hugetlbfs/inode.c +++ b/trunk/fs/hugetlbfs/inode.c @@ -34,7 +34,7 @@ #define HUGETLBFS_MAGIC 0x958458f6 static struct super_operations hugetlbfs_ops; -static const struct address_space_operations hugetlbfs_aops; +static struct address_space_operations hugetlbfs_aops; const struct file_operations hugetlbfs_file_operations; static struct inode_operations hugetlbfs_dir_inode_operations; static struct inode_operations hugetlbfs_inode_operations; @@ -547,7 +547,7 @@ static void hugetlbfs_destroy_inode(struct inode *inode) kmem_cache_free(hugetlbfs_inode_cachep, HUGETLBFS_I(inode)); } -static const struct address_space_operations hugetlbfs_aops = { +static struct address_space_operations hugetlbfs_aops = { .readpage = hugetlbfs_readpage, .prepare_write = hugetlbfs_prepare_write, .commit_write = hugetlbfs_commit_write, diff --git a/trunk/fs/inode.c b/trunk/fs/inode.c index f42961eb983b..3a2446a27d2c 100644 --- a/trunk/fs/inode.c +++ b/trunk/fs/inode.c @@ -102,7 +102,7 @@ static kmem_cache_t * inode_cachep __read_mostly; static struct inode *alloc_inode(struct super_block *sb) { - static const struct address_space_operations empty_aops; + static struct address_space_operations empty_aops; static struct inode_operations empty_iops; static const struct file_operations empty_fops; struct inode *inode; diff --git a/trunk/fs/isofs/compress.c b/trunk/fs/isofs/compress.c index 3a39158cca96..4917315db732 100644 --- a/trunk/fs/isofs/compress.c +++ b/trunk/fs/isofs/compress.c @@ -312,7 +312,7 @@ static int zisofs_readpage(struct file *file, struct page *page) return err; } -const struct address_space_operations zisofs_aops = { +struct address_space_operations zisofs_aops = { .readpage = zisofs_readpage, /* No sync_page operation supported? */ /* No bmap operation supported */ diff --git a/trunk/fs/isofs/inode.c b/trunk/fs/isofs/inode.c index bb11c7fb4019..3f9c8ba1fa1f 100644 --- a/trunk/fs/isofs/inode.c +++ b/trunk/fs/isofs/inode.c @@ -1054,7 +1054,7 @@ static sector_t _isofs_bmap(struct address_space *mapping, sector_t block) return generic_block_bmap(mapping,block,isofs_get_block); } -static const struct address_space_operations isofs_aops = { +static struct address_space_operations isofs_aops = { .readpage = isofs_readpage, .sync_page = block_sync_page, .bmap = _isofs_bmap diff --git a/trunk/fs/isofs/isofs.h b/trunk/fs/isofs/isofs.h index e6308c8b5735..b87ba066f5e7 100644 --- a/trunk/fs/isofs/isofs.h +++ b/trunk/fs/isofs/isofs.h @@ -176,5 +176,5 @@ isofs_normalize_block_and_offset(struct iso_directory_record* de, extern struct inode_operations isofs_dir_inode_operations; extern const struct file_operations isofs_dir_operations; -extern const struct address_space_operations isofs_symlink_aops; +extern struct address_space_operations isofs_symlink_aops; extern struct export_operations isofs_export_ops; diff --git a/trunk/fs/isofs/rock.c b/trunk/fs/isofs/rock.c index f3a1db3098de..4326cb47f8fa 100644 --- a/trunk/fs/isofs/rock.c +++ b/trunk/fs/isofs/rock.c @@ -754,6 +754,6 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page) return -EIO; } -const struct address_space_operations isofs_symlink_aops = { +struct address_space_operations isofs_symlink_aops = { .readpage = rock_ridge_symlink_readpage }; diff --git a/trunk/fs/isofs/zisofs.h b/trunk/fs/isofs/zisofs.h index 273795709155..d78485d101c2 100644 --- a/trunk/fs/isofs/zisofs.h +++ b/trunk/fs/isofs/zisofs.h @@ -15,7 +15,7 @@ */ #ifdef CONFIG_ZISOFS -extern const struct address_space_operations zisofs_aops; +extern struct address_space_operations zisofs_aops; extern int __init zisofs_init(void); extern void zisofs_cleanup(void); #endif diff --git a/trunk/fs/jffs/inode-v23.c b/trunk/fs/jffs/inode-v23.c index 93068697a9bf..9e46ea6da752 100644 --- a/trunk/fs/jffs/inode-v23.c +++ b/trunk/fs/jffs/inode-v23.c @@ -59,7 +59,7 @@ static const struct file_operations jffs_file_operations; static struct inode_operations jffs_file_inode_operations; static const struct file_operations jffs_dir_operations; static struct inode_operations jffs_dir_inode_operations; -static const struct address_space_operations jffs_address_operations; +static struct address_space_operations jffs_address_operations; kmem_cache_t *node_cache = NULL; kmem_cache_t *fm_cache = NULL; @@ -1614,7 +1614,7 @@ jffs_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, } /* jffs_ioctl() */ -static const struct address_space_operations jffs_address_operations = { +static struct address_space_operations jffs_address_operations = { .readpage = jffs_readpage, .prepare_write = jffs_prepare_write, .commit_write = jffs_commit_write, diff --git a/trunk/fs/jffs2/file.c b/trunk/fs/jffs2/file.c index 3ed6e3e120b6..bb8844f40e48 100644 --- a/trunk/fs/jffs2/file.c +++ b/trunk/fs/jffs2/file.c @@ -62,7 +62,7 @@ struct inode_operations jffs2_file_inode_operations = .removexattr = jffs2_removexattr }; -const struct address_space_operations jffs2_file_address_operations = +struct address_space_operations jffs2_file_address_operations = { .readpage = jffs2_readpage, .prepare_write =jffs2_prepare_write, diff --git a/trunk/fs/jffs2/os-linux.h b/trunk/fs/jffs2/os-linux.h index 9f41fc01a371..6b5223565405 100644 --- a/trunk/fs/jffs2/os-linux.h +++ b/trunk/fs/jffs2/os-linux.h @@ -158,7 +158,7 @@ extern struct inode_operations jffs2_dir_inode_operations; /* file.c */ extern const struct file_operations jffs2_file_operations; extern struct inode_operations jffs2_file_inode_operations; -extern const struct address_space_operations jffs2_file_address_operations; +extern struct address_space_operations jffs2_file_address_operations; int jffs2_fsync(struct file *, struct dentry *, int); int jffs2_do_readpage_unlock (struct inode *inode, struct page *pg); diff --git a/trunk/fs/jfs/inode.c b/trunk/fs/jfs/inode.c index 43e3f566aad6..04eb78f1252e 100644 --- a/trunk/fs/jfs/inode.c +++ b/trunk/fs/jfs/inode.c @@ -305,7 +305,7 @@ static ssize_t jfs_direct_IO(int rw, struct kiocb *iocb, offset, nr_segs, jfs_get_block, NULL); } -const struct address_space_operations jfs_aops = { +struct address_space_operations jfs_aops = { .readpage = jfs_readpage, .readpages = jfs_readpages, .writepage = jfs_writepage, diff --git a/trunk/fs/jfs/jfs_inode.h b/trunk/fs/jfs/jfs_inode.h index b5c7da6190dc..c30072674464 100644 --- a/trunk/fs/jfs/jfs_inode.h +++ b/trunk/fs/jfs/jfs_inode.h @@ -33,7 +33,7 @@ extern void jfs_free_zero_link(struct inode *); extern struct dentry *jfs_get_parent(struct dentry *dentry); extern void jfs_set_inode_flags(struct inode *); -extern const struct address_space_operations jfs_aops; +extern struct address_space_operations jfs_aops; extern struct inode_operations jfs_dir_inode_operations; extern const struct file_operations jfs_dir_operations; extern struct inode_operations jfs_file_inode_operations; diff --git a/trunk/fs/jfs/jfs_metapage.c b/trunk/fs/jfs/jfs_metapage.c index e1e0a6e6ebdf..7f6e88039700 100644 --- a/trunk/fs/jfs/jfs_metapage.c +++ b/trunk/fs/jfs/jfs_metapage.c @@ -577,7 +577,7 @@ static void metapage_invalidatepage(struct page *page, unsigned long offset) metapage_releasepage(page, 0); } -const struct address_space_operations jfs_metapage_aops = { +struct address_space_operations jfs_metapage_aops = { .readpage = metapage_readpage, .writepage = metapage_writepage, .sync_page = block_sync_page, diff --git a/trunk/fs/jfs/jfs_metapage.h b/trunk/fs/jfs/jfs_metapage.h index d17a3290f5aa..f0b7d3282b07 100644 --- a/trunk/fs/jfs/jfs_metapage.h +++ b/trunk/fs/jfs/jfs_metapage.h @@ -139,7 +139,7 @@ static inline void metapage_homeok(struct metapage *mp) put_metapage(mp); } -extern const struct address_space_operations jfs_metapage_aops; +extern struct address_space_operations jfs_metapage_aops; /* * This routines invalidate all pages for an extent. diff --git a/trunk/fs/minix/inode.c b/trunk/fs/minix/inode.c index 9ea91c5eeb7b..a6fb509b7341 100644 --- a/trunk/fs/minix/inode.c +++ b/trunk/fs/minix/inode.c @@ -335,7 +335,7 @@ static sector_t minix_bmap(struct address_space *mapping, sector_t block) { return generic_block_bmap(mapping,block,minix_get_block); } -static const struct address_space_operations minix_aops = { +static struct address_space_operations minix_aops = { .readpage = minix_readpage, .writepage = minix_writepage, .sync_page = block_sync_page, diff --git a/trunk/fs/ncpfs/inode.c b/trunk/fs/ncpfs/inode.c index 6c51c1198464..90d2ea28f333 100644 --- a/trunk/fs/ncpfs/inode.c +++ b/trunk/fs/ncpfs/inode.c @@ -105,7 +105,7 @@ static struct super_operations ncp_sops = extern struct dentry_operations ncp_root_dentry_operations; #if defined(CONFIG_NCPFS_EXTRAS) || defined(CONFIG_NCPFS_NFS_NS) -extern const struct address_space_operations ncp_symlink_aops; +extern struct address_space_operations ncp_symlink_aops; extern int ncp_symlink(struct inode*, struct dentry*, const char*); #endif diff --git a/trunk/fs/ncpfs/symlink.c b/trunk/fs/ncpfs/symlink.c index f76b1392a012..e935f1b34bc2 100644 --- a/trunk/fs/ncpfs/symlink.c +++ b/trunk/fs/ncpfs/symlink.c @@ -99,7 +99,7 @@ static int ncp_symlink_readpage(struct file *file, struct page *page) /* * symlinks can't do much... */ -const struct address_space_operations ncp_symlink_aops = { +struct address_space_operations ncp_symlink_aops = { .readpage = ncp_symlink_readpage, }; diff --git a/trunk/fs/nfs/file.c b/trunk/fs/nfs/file.c index cc2b874ad5a4..add289138836 100644 --- a/trunk/fs/nfs/file.c +++ b/trunk/fs/nfs/file.c @@ -315,7 +315,7 @@ static int nfs_release_page(struct page *page, gfp_t gfp) return !nfs_wb_page(page->mapping->host, page); } -const struct address_space_operations nfs_file_aops = { +struct address_space_operations nfs_file_aops = { .readpage = nfs_readpage, .readpages = nfs_readpages, .set_page_dirty = __set_page_dirty_nobuffers, diff --git a/trunk/fs/ntfs/aops.c b/trunk/fs/ntfs/aops.c index bc579bfdfbd8..580412d330cb 100644 --- a/trunk/fs/ntfs/aops.c +++ b/trunk/fs/ntfs/aops.c @@ -1544,7 +1544,7 @@ static int ntfs_writepage(struct page *page, struct writeback_control *wbc) /** * ntfs_aops - general address space operations for inodes and attributes */ -const struct address_space_operations ntfs_aops = { +struct address_space_operations ntfs_aops = { .readpage = ntfs_readpage, /* Fill page with data. */ .sync_page = block_sync_page, /* Currently, just unplugs the disk request queue. */ @@ -1560,7 +1560,7 @@ const struct address_space_operations ntfs_aops = { * ntfs_mst_aops - general address space operations for mst protecteed inodes * and attributes */ -const struct address_space_operations ntfs_mst_aops = { +struct address_space_operations ntfs_mst_aops = { .readpage = ntfs_readpage, /* Fill page with data. */ .sync_page = block_sync_page, /* Currently, just unplugs the disk request queue. */ diff --git a/trunk/fs/ntfs/ntfs.h b/trunk/fs/ntfs/ntfs.h index ddd3d503097c..bf7b3d7c0930 100644 --- a/trunk/fs/ntfs/ntfs.h +++ b/trunk/fs/ntfs/ntfs.h @@ -57,8 +57,8 @@ extern struct kmem_cache *ntfs_attr_ctx_cache; extern struct kmem_cache *ntfs_index_ctx_cache; /* The various operations structs defined throughout the driver files. */ -extern const struct address_space_operations ntfs_aops; -extern const struct address_space_operations ntfs_mst_aops; +extern struct address_space_operations ntfs_aops; +extern struct address_space_operations ntfs_mst_aops; extern const struct file_operations ntfs_file_ops; extern struct inode_operations ntfs_file_inode_ops; diff --git a/trunk/fs/ocfs2/aops.c b/trunk/fs/ocfs2/aops.c index cca71317b6d6..47152bf9a7f2 100644 --- a/trunk/fs/ocfs2/aops.c +++ b/trunk/fs/ocfs2/aops.c @@ -666,7 +666,7 @@ static ssize_t ocfs2_direct_IO(int rw, return ret; } -const struct address_space_operations ocfs2_aops = { +struct address_space_operations ocfs2_aops = { .readpage = ocfs2_readpage, .writepage = ocfs2_writepage, .prepare_write = ocfs2_prepare_write, diff --git a/trunk/fs/ocfs2/inode.h b/trunk/fs/ocfs2/inode.h index 35140f6cf840..84c507961287 100644 --- a/trunk/fs/ocfs2/inode.h +++ b/trunk/fs/ocfs2/inode.h @@ -114,7 +114,7 @@ static inline struct ocfs2_inode_info *OCFS2_I(struct inode *inode) extern kmem_cache_t *ocfs2_inode_cache; -extern const struct address_space_operations ocfs2_aops; +extern struct address_space_operations ocfs2_aops; struct buffer_head *ocfs2_bread(struct inode *inode, int block, int *err, int reada); diff --git a/trunk/fs/qnx4/inode.c b/trunk/fs/qnx4/inode.c index 8bc182a88748..2f24c46f72a1 100644 --- a/trunk/fs/qnx4/inode.c +++ b/trunk/fs/qnx4/inode.c @@ -450,7 +450,7 @@ static sector_t qnx4_bmap(struct address_space *mapping, sector_t block) { return generic_block_bmap(mapping,block,qnx4_get_block); } -static const struct address_space_operations qnx4_aops = { +static struct address_space_operations qnx4_aops = { .readpage = qnx4_readpage, .writepage = qnx4_writepage, .sync_page = block_sync_page, diff --git a/trunk/fs/ramfs/file-mmu.c b/trunk/fs/ramfs/file-mmu.c index 86f14cacf641..00a933eb820c 100644 --- a/trunk/fs/ramfs/file-mmu.c +++ b/trunk/fs/ramfs/file-mmu.c @@ -26,7 +26,7 @@ #include -const struct address_space_operations ramfs_aops = { +struct address_space_operations ramfs_aops = { .readpage = simple_readpage, .prepare_write = simple_prepare_write, .commit_write = simple_commit_write diff --git a/trunk/fs/ramfs/file-nommu.c b/trunk/fs/ramfs/file-nommu.c index 99fffc9e1bfd..f443a84b98a5 100644 --- a/trunk/fs/ramfs/file-nommu.c +++ b/trunk/fs/ramfs/file-nommu.c @@ -27,7 +27,7 @@ static int ramfs_nommu_setattr(struct dentry *, struct iattr *); -const struct address_space_operations ramfs_aops = { +struct address_space_operations ramfs_aops = { .readpage = simple_readpage, .prepare_write = simple_prepare_write, .commit_write = simple_commit_write diff --git a/trunk/fs/ramfs/internal.h b/trunk/fs/ramfs/internal.h index c2bb58e74653..313237631b49 100644 --- a/trunk/fs/ramfs/internal.h +++ b/trunk/fs/ramfs/internal.h @@ -10,6 +10,6 @@ */ -extern const struct address_space_operations ramfs_aops; +extern struct address_space_operations ramfs_aops; extern const struct file_operations ramfs_file_operations; extern struct inode_operations ramfs_file_inode_operations; diff --git a/trunk/fs/reiserfs/inode.c b/trunk/fs/reiserfs/inode.c index a24858a632fa..9857e50f85e7 100644 --- a/trunk/fs/reiserfs/inode.c +++ b/trunk/fs/reiserfs/inode.c @@ -2996,7 +2996,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) return error; } -const struct address_space_operations reiserfs_address_space_operations = { +struct address_space_operations reiserfs_address_space_operations = { .writepage = reiserfs_writepage, .readpage = reiserfs_readpage, .readpages = reiserfs_readpages, diff --git a/trunk/fs/romfs/inode.c b/trunk/fs/romfs/inode.c index 22eed61ebf69..283fbc6b8eea 100644 --- a/trunk/fs/romfs/inode.c +++ b/trunk/fs/romfs/inode.c @@ -459,7 +459,7 @@ romfs_readpage(struct file *file, struct page * page) /* Mapping from our types to the kernel */ -static const struct address_space_operations romfs_aops = { +static struct address_space_operations romfs_aops = { .readpage = romfs_readpage }; diff --git a/trunk/fs/smbfs/file.c b/trunk/fs/smbfs/file.c index dae67048baba..ed9a24d19d7d 100644 --- a/trunk/fs/smbfs/file.c +++ b/trunk/fs/smbfs/file.c @@ -306,7 +306,7 @@ static int smb_commit_write(struct file *file, struct page *page, return status; } -const struct address_space_operations smb_file_aops = { +struct address_space_operations smb_file_aops = { .readpage = smb_readpage, .writepage = smb_writepage, .prepare_write = smb_prepare_write, diff --git a/trunk/fs/smbfs/proto.h b/trunk/fs/smbfs/proto.h index 34fb462b2379..972ed7dad388 100644 --- a/trunk/fs/smbfs/proto.h +++ b/trunk/fs/smbfs/proto.h @@ -63,7 +63,7 @@ extern int smb_revalidate_inode(struct dentry *dentry); extern int smb_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat); extern int smb_notify_change(struct dentry *dentry, struct iattr *attr); /* file.c */ -extern const struct address_space_operations smb_file_aops; +extern struct address_space_operations smb_file_aops; extern const struct file_operations smb_file_operations; extern struct inode_operations smb_file_inode_operations; /* ioctl.c */ diff --git a/trunk/fs/sysfs/inode.c b/trunk/fs/sysfs/inode.c index 5e0e31cc46f5..f0b347bd12ca 100644 --- a/trunk/fs/sysfs/inode.c +++ b/trunk/fs/sysfs/inode.c @@ -16,7 +16,7 @@ extern struct super_block * sysfs_sb; -static const struct address_space_operations sysfs_aops = { +static struct address_space_operations sysfs_aops = { .readpage = simple_readpage, .prepare_write = simple_prepare_write, .commit_write = simple_commit_write diff --git a/trunk/fs/sysv/itree.c b/trunk/fs/sysv/itree.c index f2bcccd1d6fc..86f5f8d43d0f 100644 --- a/trunk/fs/sysv/itree.c +++ b/trunk/fs/sysv/itree.c @@ -465,7 +465,7 @@ static sector_t sysv_bmap(struct address_space *mapping, sector_t block) { return generic_block_bmap(mapping,block,get_block); } -const struct address_space_operations sysv_aops = { +struct address_space_operations sysv_aops = { .readpage = sysv_readpage, .writepage = sysv_writepage, .sync_page = block_sync_page, diff --git a/trunk/fs/sysv/sysv.h b/trunk/fs/sysv/sysv.h index 9dcc82120935..393a480e4deb 100644 --- a/trunk/fs/sysv/sysv.h +++ b/trunk/fs/sysv/sysv.h @@ -161,7 +161,7 @@ extern struct inode_operations sysv_dir_inode_operations; extern struct inode_operations sysv_fast_symlink_inode_operations; extern const struct file_operations sysv_file_operations; extern const struct file_operations sysv_dir_operations; -extern const struct address_space_operations sysv_aops; +extern struct address_space_operations sysv_aops; extern struct super_operations sysv_sops; extern struct dentry_operations sysv_dentry_operations; diff --git a/trunk/fs/udf/file.c b/trunk/fs/udf/file.c index a59e5f33daf6..e34b00e303f1 100644 --- a/trunk/fs/udf/file.c +++ b/trunk/fs/udf/file.c @@ -95,7 +95,7 @@ static int udf_adinicb_commit_write(struct file *file, struct page *page, unsign return 0; } -const struct address_space_operations udf_adinicb_aops = { +struct address_space_operations udf_adinicb_aops = { .readpage = udf_adinicb_readpage, .writepage = udf_adinicb_writepage, .sync_page = block_sync_page, diff --git a/trunk/fs/udf/inode.c b/trunk/fs/udf/inode.c index 605f5111b6d8..2983afd5e7fd 100644 --- a/trunk/fs/udf/inode.c +++ b/trunk/fs/udf/inode.c @@ -132,7 +132,7 @@ static sector_t udf_bmap(struct address_space *mapping, sector_t block) return generic_block_bmap(mapping,block,udf_get_block); } -const struct address_space_operations udf_aops = { +struct address_space_operations udf_aops = { .readpage = udf_readpage, .writepage = udf_writepage, .sync_page = block_sync_page, diff --git a/trunk/fs/udf/symlink.c b/trunk/fs/udf/symlink.c index ba068a786563..674bb40edc83 100644 --- a/trunk/fs/udf/symlink.c +++ b/trunk/fs/udf/symlink.c @@ -113,6 +113,6 @@ static int udf_symlink_filler(struct file *file, struct page *page) /* * symlinks can't do much... */ -const struct address_space_operations udf_symlink_aops = { +struct address_space_operations udf_symlink_aops = { .readpage = udf_symlink_filler, }; diff --git a/trunk/fs/udf/udfdecl.h b/trunk/fs/udf/udfdecl.h index 2f992387cc9e..023e19ba5a2e 100644 --- a/trunk/fs/udf/udfdecl.h +++ b/trunk/fs/udf/udfdecl.h @@ -47,9 +47,9 @@ extern struct inode_operations udf_dir_inode_operations; extern const struct file_operations udf_dir_operations; extern struct inode_operations udf_file_inode_operations; extern const struct file_operations udf_file_operations; -extern const struct address_space_operations udf_aops; -extern const struct address_space_operations udf_adinicb_aops; -extern const struct address_space_operations udf_symlink_aops; +extern struct address_space_operations udf_aops; +extern struct address_space_operations udf_adinicb_aops; +extern struct address_space_operations udf_symlink_aops; struct udf_fileident_bh { diff --git a/trunk/fs/ufs/inode.c b/trunk/fs/ufs/inode.c index 8e1f90e42040..259bd196099d 100644 --- a/trunk/fs/ufs/inode.c +++ b/trunk/fs/ufs/inode.c @@ -574,7 +574,7 @@ static sector_t ufs_bmap(struct address_space *mapping, sector_t block) { return generic_block_bmap(mapping,block,ufs_getfrag_block); } -const struct address_space_operations ufs_aops = { +struct address_space_operations ufs_aops = { .readpage = ufs_readpage, .writepage = ufs_writepage, .sync_page = block_sync_page, diff --git a/trunk/fs/xfs/linux-2.6/xfs_aops.c b/trunk/fs/xfs/linux-2.6/xfs_aops.c index c40f81ba9b13..3e807b828e22 100644 --- a/trunk/fs/xfs/linux-2.6/xfs_aops.c +++ b/trunk/fs/xfs/linux-2.6/xfs_aops.c @@ -1454,7 +1454,7 @@ xfs_vm_invalidatepage( block_invalidatepage(page, offset); } -const struct address_space_operations xfs_address_space_operations = { +struct address_space_operations xfs_address_space_operations = { .readpage = xfs_vm_readpage, .readpages = xfs_vm_readpages, .writepage = xfs_vm_writepage, diff --git a/trunk/fs/xfs/linux-2.6/xfs_aops.h b/trunk/fs/xfs/linux-2.6/xfs_aops.h index 2244e516b66a..706d8c781b8a 100644 --- a/trunk/fs/xfs/linux-2.6/xfs_aops.h +++ b/trunk/fs/xfs/linux-2.6/xfs_aops.h @@ -40,7 +40,7 @@ typedef struct xfs_ioend { struct work_struct io_work; /* xfsdatad work queue */ } xfs_ioend_t; -extern const struct address_space_operations xfs_address_space_operations; +extern struct address_space_operations xfs_address_space_operations; extern int xfs_get_blocks(struct inode *, sector_t, struct buffer_head *, int); #endif /* __XFS_AOPS_H__ */ diff --git a/trunk/fs/xfs/linux-2.6/xfs_buf.c b/trunk/fs/xfs/linux-2.6/xfs_buf.c index 2af528dcfb04..26fed0756f01 100644 --- a/trunk/fs/xfs/linux-2.6/xfs_buf.c +++ b/trunk/fs/xfs/linux-2.6/xfs_buf.c @@ -1520,7 +1520,7 @@ xfs_mapping_buftarg( struct backing_dev_info *bdi; struct inode *inode; struct address_space *mapping; - static const struct address_space_operations mapping_aops = { + static struct address_space_operations mapping_aops = { .sync_page = block_sync_page, .migratepage = fail_migrate_page, }; diff --git a/trunk/include/asm-generic/vmlinux.lds.h b/trunk/include/asm-generic/vmlinux.lds.h index db5a3732f106..9d11550b4818 100644 --- a/trunk/include/asm-generic/vmlinux.lds.h +++ b/trunk/include/asm-generic/vmlinux.lds.h @@ -58,20 +58,6 @@ VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \ } \ \ - /* Kernel symbol table: Normal unused symbols */ \ - __ksymtab_unused : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___ksymtab_unused) = .; \ - *(__ksymtab_unused) \ - VMLINUX_SYMBOL(__stop___ksymtab_unused) = .; \ - } \ - \ - /* Kernel symbol table: GPL-only unused symbols */ \ - __ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___ksymtab_unused_gpl) = .; \ - *(__ksymtab_unused_gpl) \ - VMLINUX_SYMBOL(__stop___ksymtab_unused_gpl) = .; \ - } \ - \ /* Kernel symbol table: GPL-future-only symbols */ \ __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \ VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \ @@ -93,20 +79,6 @@ VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \ } \ \ - /* Kernel symbol table: Normal unused symbols */ \ - __kcrctab_unused : AT(ADDR(__kcrctab_unused) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___kcrctab_unused) = .; \ - *(__kcrctab_unused) \ - VMLINUX_SYMBOL(__stop___kcrctab_unused) = .; \ - } \ - \ - /* Kernel symbol table: GPL-only unused symbols */ \ - __kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - LOAD_OFFSET) { \ - VMLINUX_SYMBOL(__start___kcrctab_unused_gpl) = .; \ - *(__kcrctab_unused_gpl) \ - VMLINUX_SYMBOL(__stop___kcrctab_unused_gpl) = .; \ - } \ - \ /* Kernel symbol table: GPL-future-only symbols */ \ __kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \ VMLINUX_SYMBOL(__start___kcrctab_gpl_future) = .; \ diff --git a/trunk/include/linux/ac97_codec.h b/trunk/include/linux/ac97_codec.h index 2ed2fd855133..c35833824e11 100644 --- a/trunk/include/linux/ac97_codec.h +++ b/trunk/include/linux/ac97_codec.h @@ -259,7 +259,7 @@ struct ac97_codec { int type; u32 model; - unsigned int modem:1; + int modem:1; struct ac97_ops *codec_ops; diff --git a/trunk/include/linux/coda_linux.h b/trunk/include/linux/coda_linux.h index be512cc98791..7b5c5df5cb69 100644 --- a/trunk/include/linux/coda_linux.h +++ b/trunk/include/linux/coda_linux.h @@ -27,8 +27,8 @@ extern struct inode_operations coda_dir_inode_operations; extern struct inode_operations coda_file_inode_operations; extern struct inode_operations coda_ioctl_inode_operations; -extern const struct address_space_operations coda_file_aops; -extern const struct address_space_operations coda_symlink_aops; +extern struct address_space_operations coda_file_aops; +extern struct address_space_operations coda_symlink_aops; extern const struct file_operations coda_dir_operations; extern const struct file_operations coda_file_operations; diff --git a/trunk/include/linux/efs_fs.h b/trunk/include/linux/efs_fs.h index 278ef4495819..fbfa6b52e2fb 100644 --- a/trunk/include/linux/efs_fs.h +++ b/trunk/include/linux/efs_fs.h @@ -38,7 +38,7 @@ struct statfs; extern struct inode_operations efs_dir_inode_operations; extern const struct file_operations efs_dir_operations; -extern const struct address_space_operations efs_symlink_aops; +extern struct address_space_operations efs_symlink_aops; extern void efs_read_inode(struct inode *); extern efs_block_t efs_map_block(struct inode *, efs_block_t); diff --git a/trunk/include/linux/fs.h b/trunk/include/linux/fs.h index e04a5cfe874f..2d8b348c1192 100644 --- a/trunk/include/linux/fs.h +++ b/trunk/include/linux/fs.h @@ -392,7 +392,7 @@ struct address_space { unsigned int truncate_count; /* Cover race condition with truncate */ unsigned long nrpages; /* number of total pages */ pgoff_t writeback_index;/* writeback starts here */ - const struct address_space_operations *a_ops; /* methods */ + struct address_space_operations *a_ops; /* methods */ unsigned long flags; /* error bits/gfp mask */ struct backing_dev_info *backing_dev_info; /* device readahead, etc */ spinlock_t private_lock; /* for use by the address_space */ @@ -1405,7 +1405,7 @@ extern void bd_forget(struct inode *inode); extern void bdput(struct block_device *); extern struct block_device *open_by_devnum(dev_t, unsigned); extern const struct file_operations def_blk_fops; -extern const struct address_space_operations def_blk_aops; +extern struct address_space_operations def_blk_aops; extern const struct file_operations def_chr_fops; extern const struct file_operations bad_sock_fops; extern const struct file_operations def_fifo_fops; diff --git a/trunk/include/linux/ide.h b/trunk/include/linux/ide.h index 0c100168c0cf..ef7bef207f48 100644 --- a/trunk/include/linux/ide.h +++ b/trunk/include/linux/ide.h @@ -793,7 +793,6 @@ typedef struct hwif_s { unsigned auto_poll : 1; /* supports nop auto-poll */ unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ unsigned no_io_32bit : 1; /* 1 = can not do 32-bit IO ops */ - unsigned err_stops_fifo : 1; /* 1=data FIFO is cleared by an error */ struct device gendev; struct completion gendev_rel_comp; /* To deal with device release() */ diff --git a/trunk/include/linux/kbd_kern.h b/trunk/include/linux/kbd_kern.h index efe0ee4cc80b..4eb851ece080 100644 --- a/trunk/include/linux/kbd_kern.h +++ b/trunk/include/linux/kbd_kern.h @@ -155,8 +155,10 @@ static inline void con_schedule_flip(struct tty_struct *t) { unsigned long flags; spin_lock_irqsave(&t->buf.lock, flags); - if (t->buf.tail != NULL) + if (t->buf.tail != NULL) { + t->buf.tail->active = 0; t->buf.tail->commit = t->buf.tail->used; + } spin_unlock_irqrestore(&t->buf.lock, flags); schedule_work(&t->buf.work); } diff --git a/trunk/include/linux/module.h b/trunk/include/linux/module.h index 9e9dc7c24d95..9ebbb74b7b72 100644 --- a/trunk/include/linux/module.h +++ b/trunk/include/linux/module.h @@ -203,15 +203,6 @@ void *__symbol_get_gpl(const char *symbol); #define EXPORT_SYMBOL_GPL_FUTURE(sym) \ __EXPORT_SYMBOL(sym, "_gpl_future") - -#ifdef CONFIG_UNUSED_SYMBOLS -#define EXPORT_UNUSED_SYMBOL(sym) __EXPORT_SYMBOL(sym, "_unused") -#define EXPORT_UNUSED_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_unused_gpl") -#else -#define EXPORT_UNUSED_SYMBOL(sym) -#define EXPORT_UNUSED_SYMBOL_GPL(sym) -#endif - #endif struct module_ref @@ -270,15 +261,6 @@ struct module unsigned int num_gpl_syms; const unsigned long *gpl_crcs; - /* unused exported symbols. */ - const struct kernel_symbol *unused_syms; - unsigned int num_unused_syms; - const unsigned long *unused_crcs; - /* GPL-only, unused exported symbols. */ - const struct kernel_symbol *unused_gpl_syms; - unsigned int num_unused_gpl_syms; - const unsigned long *unused_gpl_crcs; - /* symbols that will be GPL-only in the near future. */ const struct kernel_symbol *gpl_future_syms; unsigned int num_gpl_future_syms; @@ -474,8 +456,6 @@ void module_remove_driver(struct device_driver *); #define EXPORT_SYMBOL(sym) #define EXPORT_SYMBOL_GPL(sym) #define EXPORT_SYMBOL_GPL_FUTURE(sym) -#define EXPORT_UNUSED_SYMBOL(sym) -#define EXPORT_UNUSED_SYMBOL_GPL(sym) /* Given an address, look for it in the exception tables. */ static inline const struct exception_table_entry * diff --git a/trunk/include/linux/nfs_fs.h b/trunk/include/linux/nfs_fs.h index d90b1bb37563..0a1740b2532e 100644 --- a/trunk/include/linux/nfs_fs.h +++ b/trunk/include/linux/nfs_fs.h @@ -335,7 +335,7 @@ extern struct inode_operations nfs_file_inode_operations; extern struct inode_operations nfs3_file_inode_operations; #endif /* CONFIG_NFS_V3 */ extern const struct file_operations nfs_file_operations; -extern const struct address_space_operations nfs_file_aops; +extern struct address_space_operations nfs_file_aops; static inline struct rpc_cred *nfs_file_cred(struct file *file) { diff --git a/trunk/include/linux/reiserfs_fs.h b/trunk/include/linux/reiserfs_fs.h index daa2d83cefe8..5676c4210e2c 100644 --- a/trunk/include/linux/reiserfs_fs.h +++ b/trunk/include/linux/reiserfs_fs.h @@ -1973,7 +1973,7 @@ void reiserfs_unmap_buffer(struct buffer_head *); /* file.c */ extern struct inode_operations reiserfs_file_inode_operations; extern const struct file_operations reiserfs_file_operations; -extern const struct address_space_operations reiserfs_address_space_operations; +extern struct address_space_operations reiserfs_address_space_operations; /* fix_nodes.c */ diff --git a/trunk/include/linux/tty.h b/trunk/include/linux/tty.h index b3b807e4b050..cb35ca50a0a6 100644 --- a/trunk/include/linux/tty.h +++ b/trunk/include/linux/tty.h @@ -57,6 +57,7 @@ struct tty_buffer { unsigned char *flag_buf_ptr; int used; int size; + int active; int commit; int read; /* Data points here */ @@ -258,6 +259,7 @@ struct tty_struct { #define TTY_DO_WRITE_WAKEUP 5 /* Call write_wakeup after queuing new */ #define TTY_PUSH 6 /* n_tty private */ #define TTY_CLOSING 7 /* ->close() in progress */ +#define TTY_DONT_FLIP 8 /* Defer buffer flip */ #define TTY_LDISC 9 /* Line discipline attached */ #define TTY_HW_COOK_OUT 14 /* Hardware can do output cooking */ #define TTY_HW_COOK_IN 15 /* Hardware can do input cooking */ diff --git a/trunk/include/linux/tty_flip.h b/trunk/include/linux/tty_flip.h index eb677cf56106..31548303ee37 100644 --- a/trunk/include/linux/tty_flip.h +++ b/trunk/include/linux/tty_flip.h @@ -12,7 +12,7 @@ static inline int tty_insert_flip_char(struct tty_struct *tty, unsigned char ch, char flag) { struct tty_buffer *tb = tty->buf.tail; - if (tb && tb->used < tb->size) { + if (tb && tb->active && tb->used < tb->size) { tb->flag_buf_ptr[tb->used] = flag; tb->char_buf_ptr[tb->used++] = ch; return 1; diff --git a/trunk/include/linux/ufs_fs.h b/trunk/include/linux/ufs_fs.h index e39b7cc43390..914f911325be 100644 --- a/trunk/include/linux/ufs_fs.h +++ b/trunk/include/linux/ufs_fs.h @@ -966,7 +966,7 @@ extern void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de, extern struct inode_operations ufs_file_inode_operations; extern const struct file_operations ufs_file_operations; -extern const struct address_space_operations ufs_aops; +extern struct address_space_operations ufs_aops; /* ialloc.c */ extern void ufs_free_inode (struct inode *inode); diff --git a/trunk/kernel/module.c b/trunk/kernel/module.c index 99c022ac3d21..10e5b872adf6 100644 --- a/trunk/kernel/module.c +++ b/trunk/kernel/module.c @@ -1,4 +1,4 @@ -/* +/* Rewritten by Rusty Russell, on the backs of many others... Copyright (C) 2002 Richard Henderson Copyright (C) 2001 Rusty Russell, 2002 Rusty Russell IBM. @@ -122,17 +122,9 @@ extern const struct kernel_symbol __start___ksymtab_gpl[]; extern const struct kernel_symbol __stop___ksymtab_gpl[]; extern const struct kernel_symbol __start___ksymtab_gpl_future[]; extern const struct kernel_symbol __stop___ksymtab_gpl_future[]; -extern const struct kernel_symbol __start___ksymtab_unused[]; -extern const struct kernel_symbol __stop___ksymtab_unused[]; -extern const struct kernel_symbol __start___ksymtab_unused_gpl[]; -extern const struct kernel_symbol __stop___ksymtab_unused_gpl[]; -extern const struct kernel_symbol __start___ksymtab_gpl_future[]; -extern const struct kernel_symbol __stop___ksymtab_gpl_future[]; extern const unsigned long __start___kcrctab[]; extern const unsigned long __start___kcrctab_gpl[]; extern const unsigned long __start___kcrctab_gpl_future[]; -extern const unsigned long __start___kcrctab_unused[]; -extern const unsigned long __start___kcrctab_unused_gpl[]; #ifndef CONFIG_MODVERSIONS #define symversion(base, idx) NULL @@ -152,17 +144,6 @@ static const struct kernel_symbol *lookup_symbol(const char *name, return NULL; } -static void printk_unused_warning(const char *name) -{ - printk(KERN_WARNING "Symbol %s is marked as UNUSED, " - "however this module is using it.\n", name); - printk(KERN_WARNING "This symbol will go away in the future.\n"); - printk(KERN_WARNING "Please evalute if this is the right api to use, " - "and if it really is, submit a report the linux kernel " - "mailinglist together with submitting your code for " - "inclusion.\n"); -} - /* Find a symbol, return value, crc and module which owns it */ static unsigned long __find_symbol(const char *name, struct module **owner, @@ -205,25 +186,6 @@ static unsigned long __find_symbol(const char *name, return ks->value; } - ks = lookup_symbol(name, __start___ksymtab_unused, - __stop___ksymtab_unused); - if (ks) { - printk_unused_warning(name); - *crc = symversion(__start___kcrctab_unused, - (ks - __start___ksymtab_unused)); - return ks->value; - } - - if (gplok) - ks = lookup_symbol(name, __start___ksymtab_unused_gpl, - __stop___ksymtab_unused_gpl); - if (ks) { - printk_unused_warning(name); - *crc = symversion(__start___kcrctab_unused_gpl, - (ks - __start___ksymtab_unused_gpl)); - return ks->value; - } - /* Now try modules. */ list_for_each_entry(mod, &modules, list) { *owner = mod; @@ -242,23 +204,6 @@ static unsigned long __find_symbol(const char *name, return ks->value; } } - ks = lookup_symbol(name, mod->unused_syms, mod->unused_syms + mod->num_unused_syms); - if (ks) { - printk_unused_warning(name); - *crc = symversion(mod->unused_crcs, (ks - mod->unused_syms)); - return ks->value; - } - - if (gplok) { - ks = lookup_symbol(name, mod->unused_gpl_syms, - mod->unused_gpl_syms + mod->num_unused_gpl_syms); - if (ks) { - printk_unused_warning(name); - *crc = symversion(mod->unused_gpl_crcs, - (ks - mod->unused_gpl_syms)); - return ks->value; - } - } ks = lookup_symbol(name, mod->gpl_future_syms, (mod->gpl_future_syms + mod->num_gpl_future_syms)); @@ -1458,27 +1403,10 @@ static struct module *load_module(void __user *umod, Elf_Ehdr *hdr; Elf_Shdr *sechdrs; char *secstrings, *args, *modmagic, *strtab = NULL; - unsigned int i; - unsigned int symindex = 0; - unsigned int strindex = 0; - unsigned int setupindex; - unsigned int exindex; - unsigned int exportindex; - unsigned int modindex; - unsigned int obsparmindex; - unsigned int infoindex; - unsigned int gplindex; - unsigned int crcindex; - unsigned int gplcrcindex; - unsigned int versindex; - unsigned int pcpuindex; - unsigned int gplfutureindex; - unsigned int gplfuturecrcindex; - unsigned int unwindex = 0; - unsigned int unusedindex; - unsigned int unusedcrcindex; - unsigned int unusedgplindex; - unsigned int unusedgplcrcindex; + unsigned int i, symindex = 0, strindex = 0, setupindex, exindex, + exportindex, modindex, obsparmindex, infoindex, gplindex, + crcindex, gplcrcindex, versindex, pcpuindex, gplfutureindex, + gplfuturecrcindex, unwindex = 0; struct module *mod; long err = 0; void *percpu = NULL, *ptr = NULL; /* Stops spurious gcc warning */ @@ -1559,13 +1487,9 @@ static struct module *load_module(void __user *umod, exportindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab"); gplindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_gpl"); gplfutureindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_gpl_future"); - unusedindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_unused"); - unusedgplindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_unused_gpl"); crcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab"); gplcrcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab_gpl"); gplfuturecrcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab_gpl_future"); - unusedcrcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab_unused"); - unusedgplcrcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab_unused_gpl"); setupindex = find_sec(hdr, sechdrs, secstrings, "__param"); exindex = find_sec(hdr, sechdrs, secstrings, "__ex_table"); obsparmindex = find_sec(hdr, sechdrs, secstrings, "__obsparm"); @@ -1714,27 +1638,14 @@ static struct module *load_module(void __user *umod, mod->gpl_crcs = (void *)sechdrs[gplcrcindex].sh_addr; mod->num_gpl_future_syms = sechdrs[gplfutureindex].sh_size / sizeof(*mod->gpl_future_syms); - mod->num_unused_syms = sechdrs[unusedindex].sh_size / - sizeof(*mod->unused_syms); - mod->num_unused_gpl_syms = sechdrs[unusedgplindex].sh_size / - sizeof(*mod->unused_gpl_syms); mod->gpl_future_syms = (void *)sechdrs[gplfutureindex].sh_addr; if (gplfuturecrcindex) mod->gpl_future_crcs = (void *)sechdrs[gplfuturecrcindex].sh_addr; - mod->unused_syms = (void *)sechdrs[unusedindex].sh_addr; - if (unusedcrcindex) - mod->unused_crcs = (void *)sechdrs[unusedcrcindex].sh_addr; - mod->unused_gpl_syms = (void *)sechdrs[unusedgplindex].sh_addr; - if (unusedgplcrcindex) - mod->unused_crcs = (void *)sechdrs[unusedgplcrcindex].sh_addr; - #ifdef CONFIG_MODVERSIONS if ((mod->num_syms && !crcindex) || (mod->num_gpl_syms && !gplcrcindex) || - (mod->num_gpl_future_syms && !gplfuturecrcindex) || - (mod->num_unused_syms && !unusedcrcindex) || - (mod->num_unused_gpl_syms && !unusedgplcrcindex)) { + (mod->num_gpl_future_syms && !gplfuturecrcindex)) { printk(KERN_WARNING "%s: No versions for exported symbols." " Tainting kernel.\n", mod->name); add_taint(TAINT_FORCED_MODULE); diff --git a/trunk/lib/Kconfig.debug b/trunk/lib/Kconfig.debug index e4fcbd12cf6e..5330911ebd30 100644 --- a/trunk/lib/Kconfig.debug +++ b/trunk/lib/Kconfig.debug @@ -23,22 +23,6 @@ config MAGIC_SYSRQ keys are documented in . Don't say Y unless you really know what this hack does. -config UNUSED_SYMBOLS - bool "Enable unused/obsolete exported symbols" - default y if X86 - help - Unused but exported symbols make the kernel needlessly bigger. For - that reason most of these unused exports will soon be removed. This - option is provided temporarily to provide a transition period in case - some external kernel module needs one of these symbols anyway. If you - encounter such a case in your module, consider if you are actually - using the right API. (rationale: since nobody in the kernel is using - this in a module, there is a pretty good chance it's actually the - wrong interface to use). If you really need the symbol, please send a - mail to the linux kernel mailing list mentioning the symbol and why - you really need it, and what the merge plan to the mainline kernel for - your module is. - config DEBUG_KERNEL bool "Kernel debugging" help diff --git a/trunk/mm/filemap.c b/trunk/mm/filemap.c index 4082b3b3cea7..d504d6e98886 100644 --- a/trunk/mm/filemap.c +++ b/trunk/mm/filemap.c @@ -2069,7 +2069,7 @@ generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov, { struct file *file = iocb->ki_filp; struct address_space * mapping = file->f_mapping; - const struct address_space_operations *a_ops = mapping->a_ops; + struct address_space_operations *a_ops = mapping->a_ops; struct inode *inode = mapping->host; long status = 0; struct page *page; @@ -2219,7 +2219,7 @@ __generic_file_aio_write_nolock(struct kiocb *iocb, const struct iovec *iov, unsigned long nr_segs, loff_t *ppos) { struct file *file = iocb->ki_filp; - const struct address_space * mapping = file->f_mapping; + struct address_space * mapping = file->f_mapping; size_t ocount; /* original count */ size_t count; /* after file limit checks */ struct inode *inode = mapping->host; diff --git a/trunk/mm/filemap_xip.c b/trunk/mm/filemap_xip.c index b4fd0d7c9bfb..b960ac8e5918 100644 --- a/trunk/mm/filemap_xip.c +++ b/trunk/mm/filemap_xip.c @@ -273,7 +273,7 @@ __xip_file_write(struct file *filp, const char __user *buf, size_t count, loff_t pos, loff_t *ppos) { struct address_space * mapping = filp->f_mapping; - const struct address_space_operations *a_ops = mapping->a_ops; + struct address_space_operations *a_ops = mapping->a_ops; struct inode *inode = mapping->host; long status = 0; struct page *page; diff --git a/trunk/mm/shmem.c b/trunk/mm/shmem.c index ea64c07cbe72..38bc3334f263 100644 --- a/trunk/mm/shmem.c +++ b/trunk/mm/shmem.c @@ -174,7 +174,7 @@ static inline void shmem_unacct_blocks(unsigned long flags, long pages) } static struct super_operations shmem_ops; -static const struct address_space_operations shmem_aops; +static struct address_space_operations shmem_aops; static struct file_operations shmem_file_operations; static struct inode_operations shmem_inode_operations; static struct inode_operations shmem_dir_inode_operations; @@ -2162,7 +2162,7 @@ static void destroy_inodecache(void) printk(KERN_INFO "shmem_inode_cache: not all structures were freed\n"); } -static const struct address_space_operations shmem_aops = { +static struct address_space_operations shmem_aops = { .writepage = shmem_writepage, .set_page_dirty = __set_page_dirty_nobuffers, #ifdef CONFIG_TMPFS diff --git a/trunk/mm/swap_state.c b/trunk/mm/swap_state.c index 7535211bb495..e0e1583f32c2 100644 --- a/trunk/mm/swap_state.c +++ b/trunk/mm/swap_state.c @@ -24,7 +24,7 @@ * vmscan's shrink_list, to make sync_page look nicer, and to allow * future use of radix_tree tags in the swap cache. */ -static const struct address_space_operations swap_aops = { +static struct address_space_operations swap_aops = { .writepage = swap_writepage, .sync_page = block_sync_page, .set_page_dirty = __set_page_dirty_nobuffers, diff --git a/trunk/net/bluetooth/rfcomm/tty.c b/trunk/net/bluetooth/rfcomm/tty.c index b81fad893328..74368f79ee5d 100644 --- a/trunk/net/bluetooth/rfcomm/tty.c +++ b/trunk/net/bluetooth/rfcomm/tty.c @@ -480,8 +480,12 @@ static void rfcomm_dev_data_ready(struct rfcomm_dlc *dlc, struct sk_buff *skb) BT_DBG("dlc %p tty %p len %d", dlc, tty, skb->len); - tty_insert_flip_string(tty, skb->data, skb->len); - tty_flip_buffer_push(tty); + if (test_bit(TTY_DONT_FLIP, &tty->flags)) { + tty_buffer_request_room(tty, skb->len); + tty_insert_flip_string(tty, skb->data, skb->len); + tty_flip_buffer_push(tty); + } else + tty->ldisc.receive_buf(tty, skb->data, NULL, skb->len); kfree_skb(skb); } diff --git a/trunk/sound/oss/cs4232.c b/trunk/sound/oss/cs4232.c index 80f6c08e26e7..c7f86f09c28d 100644 --- a/trunk/sound/oss/cs4232.c +++ b/trunk/sound/oss/cs4232.c @@ -405,7 +405,7 @@ static const struct pnp_device_id cs4232_pnp_table[] = { MODULE_DEVICE_TABLE(pnp, cs4232_pnp_table); -static int __init cs4232_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) +static int cs4232_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) { struct address_info *isapnpcfg; diff --git a/trunk/sound/oss/via82cxxx_audio.c b/trunk/sound/oss/via82cxxx_audio.c index 29a6e0cff79f..2343dedd44ae 100644 --- a/trunk/sound/oss/via82cxxx_audio.c +++ b/trunk/sound/oss/via82cxxx_audio.c @@ -309,7 +309,7 @@ struct via_info { unsigned sixchannel: 1; /* 8233/35 with 6 channel support */ unsigned volume: 1; - unsigned locked_rate : 1; + int locked_rate : 1; int mixer_vol; /* 8233/35 volume - not yet implemented */