diff options
Diffstat (limited to 'drivers')
89 files changed, 1098 insertions, 1230 deletions
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c index 5055acf2163..048295ec370 100644 --- a/drivers/acpi/sleep/main.c +++ b/drivers/acpi/sleep/main.c @@ -50,7 +50,7 @@ int acpi_sleep_prepare(u32 acpi_state) } #ifdef CONFIG_SUSPEND -static struct pm_ops acpi_pm_ops; +static struct platform_suspend_ops acpi_pm_ops; extern void do_suspend_lowlevel(void); @@ -85,13 +85,12 @@ static int acpi_pm_set_target(suspend_state_t pm_state) /** * acpi_pm_prepare - Do preliminary suspend work. - * @pm_state: ignored * * If necessary, set the firmware waking vector and do arch-specific * nastiness to get the wakeup code to the waking vector. */ -static int acpi_pm_prepare(suspend_state_t pm_state) +static int acpi_pm_prepare(void) { int error = acpi_sleep_prepare(acpi_target_sleep_state); @@ -160,13 +159,12 @@ static int acpi_pm_enter(suspend_state_t pm_state) /** * acpi_pm_finish - Finish up suspend sequence. - * @pm_state: ignored * * This is called after we wake back up (or if entering the sleep state * failed). */ -static int acpi_pm_finish(suspend_state_t pm_state) +static void acpi_pm_finish(void) { u32 acpi_state = acpi_target_sleep_state; @@ -184,7 +182,6 @@ static int acpi_pm_finish(suspend_state_t pm_state) init_8259A(0); } #endif - return 0; } static int acpi_pm_state_valid(suspend_state_t pm_state) @@ -203,7 +200,7 @@ static int acpi_pm_state_valid(suspend_state_t pm_state) } } -static struct pm_ops acpi_pm_ops = { +static struct platform_suspend_ops acpi_pm_ops = { .valid = acpi_pm_state_valid, .set_target = acpi_pm_set_target, .prepare = acpi_pm_prepare, @@ -233,6 +230,12 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = { #endif /* CONFIG_SUSPEND */ #ifdef CONFIG_HIBERNATION +static int acpi_hibernation_start(void) +{ + acpi_target_sleep_state = ACPI_STATE_S4; + return 0; +} + static int acpi_hibernation_prepare(void) { return acpi_sleep_prepare(ACPI_STATE_S4); @@ -254,6 +257,15 @@ static int acpi_hibernation_enter(void) return ACPI_SUCCESS(status) ? 0 : -EFAULT; } +static void acpi_hibernation_leave(void) +{ + /* + * If ACPI is not enabled by the BIOS and the boot kernel, we need to + * enable it here. + */ + acpi_enable(); +} + static void acpi_hibernation_finish(void) { acpi_leave_sleep_state(ACPI_STATE_S4); @@ -261,6 +273,8 @@ static void acpi_hibernation_finish(void) /* reset firmware waking vector */ acpi_set_firmware_waking_vector((acpi_physical_address) 0); + + acpi_target_sleep_state = ACPI_STATE_S0; } static int acpi_hibernation_pre_restore(void) @@ -277,10 +291,13 @@ static void acpi_hibernation_restore_cleanup(void) acpi_hw_enable_all_runtime_gpes(); } -static struct hibernation_ops acpi_hibernation_ops = { +static struct platform_hibernation_ops acpi_hibernation_ops = { + .start = acpi_hibernation_start, + .pre_snapshot = acpi_hibernation_prepare, + .finish = acpi_hibernation_finish, .prepare = acpi_hibernation_prepare, .enter = acpi_hibernation_enter, - .finish = acpi_hibernation_finish, + .leave = acpi_hibernation_leave, .pre_restore = acpi_hibernation_pre_restore, .restore_cleanup = acpi_hibernation_restore_cleanup, }; @@ -417,7 +434,7 @@ int __init acpi_sleep_init(void) } } - pm_set_ops(&acpi_pm_ops); + suspend_set_ops(&acpi_pm_ops); #endif #ifdef CONFIG_HIBERNATION diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 026439e05af..c7501058d07 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c @@ -882,7 +882,7 @@ unsigned long ata_pci_default_filter(struct ata_device *adev, unsigned long xfer /* Filter out DMA modes if the device has been configured by the BIOS as PIO only */ - if (adev->link->ap->ioaddr.bmdma_addr == 0) + if (adev->link->ap->ioaddr.bmdma_addr == NULL) xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); return xfer_mask; } diff --git a/drivers/base/dmapool.c b/drivers/base/dmapool.c index fbae8674e49..5beddc322e6 100644 --- a/drivers/base/dmapool.c +++ b/drivers/base/dmapool.c @@ -366,7 +366,7 @@ dma_pool_free (struct dma_pool *pool, void *vaddr, dma_addr_t dma) unsigned long flags; int map, block; - if ((page = pool_find_page (pool, dma)) == 0) { + if ((page = pool_find_page(pool, dma)) == NULL) { if (pool->dev) dev_err(pool->dev, "dma_pool_free %s, %p/%lx (bad dma)\n", pool->name, vaddr, (unsigned long) dma); diff --git a/drivers/base/power/trace.c b/drivers/base/power/trace.c index 2b0c601e422..2b4b392dcbc 100644 --- a/drivers/base/power/trace.c +++ b/drivers/base/power/trace.c @@ -114,7 +114,7 @@ static unsigned int read_magic_time(void) get_rtc_time(&time); printk("Time: %2d:%02d:%02d Date: %02d/%02d/%02d\n", time.tm_hour, time.tm_min, time.tm_sec, - time.tm_mon, time.tm_mday, time.tm_year); + time.tm_mon + 1, time.tm_mday, time.tm_year % 100); val = time.tm_year; /* 100 years */ if (val > 100) val -= 100; diff --git a/drivers/base/topology.c b/drivers/base/topology.c index 8d8cdfec652..e1d3ad4db2f 100644 --- a/drivers/base/topology.c +++ b/drivers/base/topology.c @@ -94,27 +94,18 @@ static struct attribute_group topology_attr_group = { .name = "topology" }; -static cpumask_t topology_dev_map = CPU_MASK_NONE; - /* Add/Remove cpu_topology interface for CPU device */ static int __cpuinit topology_add_dev(unsigned int cpu) { - int rc; struct sys_device *sys_dev = get_cpu_sysdev(cpu); - rc = sysfs_create_group(&sys_dev->kobj, &topology_attr_group); - if (!rc) - cpu_set(cpu, topology_dev_map); - return rc; + return sysfs_create_group(&sys_dev->kobj, &topology_attr_group); } static void __cpuinit topology_remove_dev(unsigned int cpu) { struct sys_device *sys_dev = get_cpu_sysdev(cpu); - if (!cpu_isset(cpu, topology_dev_map)) - return; - cpu_clear(cpu, topology_dev_map); sysfs_remove_group(&sys_dev->kobj, &topology_attr_group); } diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c index 9e7652dcde6..82effce97c5 100644 --- a/drivers/block/xsysace.c +++ b/drivers/block/xsysace.c @@ -390,8 +390,8 @@ static inline void ace_dump_mem(void *base, int len) static void ace_dump_regs(struct ace_device *ace) { dev_info(ace->dev, " ctrl: %.8x seccnt/cmd: %.4x ver:%.4x\n" - " status:%.8x mpu_lba:%.8x busmode:%4x\n" - " error: %.8x cfg_lba:%.8x fatstat:%.4x\n", + KERN_INFO " status:%.8x mpu_lba:%.8x busmode:%4x\n" + KERN_INFO " error: %.8x cfg_lba:%.8x fatstat:%.4x\n", ace_in32(ace, ACE_CTRL), ace_in(ace, ACE_SECCNTCMD), ace_in(ace, ACE_VERSION), diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index 79245714f0a..d70745c8425 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c @@ -3458,47 +3458,19 @@ static void cdrom_update_settings(void) static int cdrom_sysctl_handler(ctl_table *ctl, int write, struct file * filp, void __user *buffer, size_t *lenp, loff_t *ppos) { - int *valp = ctl->data; - int val = *valp; int ret; ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); - if (write && *valp != val) { + if (write) { /* we only care for 1 or 0. */ - if (*valp) - *valp = 1; - else - *valp = 0; + autoclose = !!cdrom_sysctl_settings.autoclose; + autoeject = !!cdrom_sysctl_settings.autoeject; + debug = !!cdrom_sysctl_settings.debug; + lockdoor = !!cdrom_sysctl_settings.lock; + check_media_type = !!cdrom_sysctl_settings.check; - switch (ctl->ctl_name) { - case DEV_CDROM_AUTOCLOSE: { - if (valp == &cdrom_sysctl_settings.autoclose) - autoclose = cdrom_sysctl_settings.autoclose; - break; - } - case DEV_CDROM_AUTOEJECT: { - if (valp == &cdrom_sysctl_settings.autoeject) - autoeject = cdrom_sysctl_settings.autoeject; - break; - } - case DEV_CDROM_DEBUG: { - if (valp == &cdrom_sysctl_settings.debug) - debug = cdrom_sysctl_settings.debug; - break; - } - case DEV_CDROM_LOCK: { - if (valp == &cdrom_sysctl_settings.lock) - lockdoor = cdrom_sysctl_settings.lock; - break; - } - case DEV_CDROM_CHECK_MEDIA: { - if (valp == &cdrom_sysctl_settings.check) - check_media_type = cdrom_sysctl_settings.check; - break; - } - } /* update the option flags according to the changes. we don't have per device options through sysctl yet, but we will have and then this will disappear. */ @@ -3511,7 +3483,6 @@ static int cdrom_sysctl_handler(ctl_table *ctl, int write, struct file * filp, /* Place files in /proc/sys/dev/cdrom */ static ctl_table cdrom_table[] = { { - .ctl_name = DEV_CDROM_INFO, .procname = "info", .data = &cdrom_sysctl_settings.info, .maxlen = CDROM_STR_SIZE, @@ -3519,7 +3490,6 @@ static ctl_table cdrom_table[] = { .proc_handler = &cdrom_sysctl_info, }, { - .ctl_name = DEV_CDROM_AUTOCLOSE, .procname = "autoclose", .data = &cdrom_sysctl_settings.autoclose, .maxlen = sizeof(int), @@ -3527,7 +3497,6 @@ static ctl_table cdrom_table[] = { .proc_handler = &cdrom_sysctl_handler, }, { - .ctl_name = DEV_CDROM_AUTOEJECT, .procname = "autoeject", .data = &cdrom_sysctl_settings.autoeject, .maxlen = sizeof(int), @@ -3535,7 +3504,6 @@ static ctl_table cdrom_table[] = { .proc_handler = &cdrom_sysctl_handler, }, { - .ctl_name = DEV_CDROM_DEBUG, .procname = "debug", .data = &cdrom_sysctl_settings.debug, .maxlen = sizeof(int), @@ -3543,7 +3511,6 @@ static ctl_table cdrom_table[] = { .proc_handler = &cdrom_sysctl_handler, }, { - .ctl_name = DEV_CDROM_LOCK, .procname = "lock", .data = &cdrom_sysctl_settings.lock, .maxlen = sizeof(int), @@ -3551,7 +3518,6 @@ static ctl_table cdrom_table[] = { .proc_handler = &cdrom_sysctl_handler, }, { - .ctl_name = DEV_CDROM_CHECK_MEDIA, .procname = "check_media", .data = &cdrom_sysctl_settings.check, .maxlen = sizeof(int), diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 204d53e506d..4dbee616eac 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -36,23 +36,6 @@ config VT If unsure, say Y, or else you won't be able to do much with your new shiny Linux system :-) -config VT_UNICODE - bool "Virtual console is Unicode by default" - depends on VT - default n - ---help--- - If you say Y here, the virtual terminal will be in UTF-8 by default, - and the keyboard will run in unicode mode. - - If you say N here, the virtual terminal will not be in UTF-8 by - default, and the keyboard will run in XLATE mode. - - This can also be changed by passing 'default_utf8=<0|1>' on the - kernel command line. - - Historically, the kernel has defaulted to non-UTF8 and XLATE mode. - If unsure, say N here. - config VT_CONSOLE bool "Support for console on virtual terminal" if EMBEDDED depends on VT diff --git a/drivers/char/apm-emulation.c b/drivers/char/apm-emulation.c index ec116df919d..c99e43b837f 100644 --- a/drivers/char/apm-emulation.c +++ b/drivers/char/apm-emulation.c @@ -18,7 +18,7 @@ #include <linux/apm_bios.h> #include <linux/capability.h> #include <linux/sched.h> -#include <linux/pm.h> +#include <linux/suspend.h> #include <linux/apm-emulation.h> #include <linux/freezer.h> #include <linux/device.h> diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index 9e0adfe27c1..d15234c5965 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c @@ -662,7 +662,7 @@ static void cy_throttle(struct tty_struct *tty); static void cy_send_xchar(struct tty_struct *tty, char ch); -#define IS_CYC_Z(card) ((card).num_chips == -1) +#define IS_CYC_Z(card) ((card).num_chips == (unsigned int)-1) #define Z_FPGA_CHECK(card) \ ((readl(&((struct RUNTIME_9060 __iomem *) \ @@ -897,71 +897,6 @@ static inline int serial_paranoia_check(struct cyclades_port *info, return 0; } /* serial_paranoia_check */ -/* - * This routine is used by the interrupt handler to schedule - * processing in the software interrupt portion of the driver - * (also known as the "bottom half"). This can be called any - * number of times for any channel without harm. - */ -static inline void cy_sched_event(struct cyclades_port *info, int event) -{ - info->event |= 1 << event; /* remember what kind of event and who */ - schedule_work(&info->tqueue); -} /* cy_sched_event */ - -/* - * This routine is used to handle the "bottom half" processing for the - * serial driver, known also the "software interrupt" processing. - * This processing is done at the kernel interrupt level, after the - * cy#/_interrupt() has returned, BUT WITH INTERRUPTS TURNED ON. This - * is where time-consuming activities which can not be done in the - * interrupt driver proper are done; the interrupt driver schedules - * them using cy_sched_event(), and they get done here. - * - * This is done through one level of indirection--the task queue. - * When a hardware interrupt service routine wants service by the - * driver's bottom half, it enqueues the appropriate tq_struct (one - * per port) to the keventd work queue and sets a request flag - * that the work queue be processed. - * - * Although this may seem unwieldy, it gives the system a way to - * pass an argument (in this case the pointer to the cyclades_port - * structure) to the bottom half of the driver. Previous kernels - * had to poll every port to see if that port needed servicing. - */ -static void -do_softint(struct work_struct *work) -{ - struct cyclades_port *info = - container_of(work, struct cyclades_port, tqueue); - struct tty_struct *tty; - - tty = info->tty; - if (!tty) - return; - - if (test_and_clear_bit(Cy_EVENT_HANGUP, &info->event)) { - tty_hangup(info->tty); - wake_up_interruptible(&info->open_wait); - info->flags &= ~ASYNC_NORMAL_ACTIVE; - } - if (test_and_clear_bit(Cy_EVENT_OPEN_WAKEUP, &info->event)) - wake_up_interruptible(&info->open_wait); -#ifdef CONFIG_CYZ_INTR - if (test_and_clear_bit(Cy_EVENT_Z_RX_FULL, &info->event) && - !timer_pending(&cyz_rx_full_timer[info->line])) - mod_timer(&cyz_rx_full_timer[info->line], jiffies + 1); -#endif - if (test_and_clear_bit(Cy_EVENT_DELTA_WAKEUP, &info->event)) - wake_up_interruptible(&info->delta_msr_wait); - tty_wakeup(tty); -#ifdef Z_WAKE - if (test_and_clear_bit(Cy_EVENT_SHUTDOWN_WAKEUP, &info->event)) - complete(&info->shutdown_wait); -#endif -} /* do_softint */ - - /***********************************************************/ /********* Start of block of Cyclom-Y specific code ********/ @@ -1045,382 +980,332 @@ static unsigned detect_isa_irq(void __iomem * address) } #endif /* CONFIG_ISA */ -static void cyy_intr_chip(struct cyclades_card *cinfo, int chip, - void __iomem * base_addr, int status, int index) +static void cyy_chip_rx(struct cyclades_card *cinfo, int chip, + void __iomem *base_addr) { struct cyclades_port *info; struct tty_struct *tty; - int char_count; - int j, len, mdm_change, mdm_status, outch; - int save_xir, channel, save_car; - char data; + int len, index = cinfo->bus_index; + u8 save_xir, channel, save_car, data, char_count; - if (status & CySRReceive) { /* reception interrupt */ #ifdef CY_DEBUG_INTERRUPTS - printk(KERN_DEBUG "cyy_interrupt: rcvd intr, chip %d\n", chip); + printk(KERN_DEBUG "cyy_interrupt: rcvd intr, chip %d\n", chip); #endif - /* determine the channel & change to that context */ - spin_lock(&cinfo->card_lock); - save_xir = (u_char) readb(base_addr + (CyRIR << index)); - channel = (u_short) (save_xir & CyIRChannel); - info = &cinfo->ports[channel + chip * 4]; - save_car = readb(base_addr + (CyCAR << index)); - cy_writeb(base_addr + (CyCAR << index), save_xir); - - /* if there is nowhere to put the data, discard it */ - if (info->tty == NULL) { - j = (readb(base_addr + (CyRIVR << index)) & - CyIVRMask); - if (j == CyIVRRxEx) { /* exception */ + /* determine the channel & change to that context */ + save_xir = readb(base_addr + (CyRIR << index)); + channel = save_xir & CyIRChannel; + info = &cinfo->ports[channel + chip * 4]; + save_car = readb(base_addr + (CyCAR << index)); + cy_writeb(base_addr + (CyCAR << index), save_xir); + + /* if there is nowhere to put the data, discard it */ + if (info->tty == NULL) { + if ((readb(base_addr + (CyRIVR << index)) & CyIVRMask) == + CyIVRRxEx) { /* exception */ + data = readb(base_addr + (CyRDSR << index)); + } else { /* normal character reception */ + char_count = readb(base_addr + (CyRDCR << index)); + while (char_count--) data = readb(base_addr + (CyRDSR << index)); - } else { /* normal character reception */ - char_count = readb(base_addr + - (CyRDCR << index)); - while (char_count--) { - data = readb(base_addr + - (CyRDSR << index)); - } - } - } else { /* there is an open port for this data */ - tty = info->tty; - j = (readb(base_addr + (CyRIVR << index)) & - CyIVRMask); - if (j == CyIVRRxEx) { /* exception */ - data = readb(base_addr + (CyRDSR << index)); - - /* For statistics only */ - if (data & CyBREAK) - info->icount.brk++; - else if (data & CyFRAME) - info->icount.frame++; - else if (data & CyPARITY) - info->icount.parity++; - else if (data & CyOVERRUN) - info->icount.overrun++; - - if (data & info->ignore_status_mask) { + } + goto end; + } + /* there is an open port for this data */ + tty = info->tty; + if ((readb(base_addr + (CyRIVR << index)) & CyIVRMask) == + CyIVRRxEx) { /* exception */ + data = readb(base_addr + (CyRDSR << index)); + + /* For statistics only */ + if (data & CyBREAK) + info->icount.brk++; + else if (data & CyFRAME) + info->icount.frame++; + else if (data & CyPARITY) + info->icount.parity++; + else if (data & CyOVERRUN) + info->icount.overrun++; + + if (data & info->ignore_status_mask) { + info->icount.rx++; + return; + } + if (tty_buffer_request_room(tty, 1)) { + if (data & info->read_status_mask) { + if (data & CyBREAK) { + tty_insert_flip_char(tty, + readb(base_addr + (CyRDSR << + index)), TTY_BREAK); + info->icount.rx++; + if (info->flags & ASYNC_SAK) + do_SAK(tty); + } else if (data & CyFRAME) { + tty_insert_flip_char( tty, + readb(base_addr + (CyRDSR << + index)), TTY_FRAME); + info->icount.rx++; + info->idle_stats.frame_errs++; + } else if (data & CyPARITY) { + /* Pieces of seven... */ + tty_insert_flip_char(tty, + readb(base_addr + (CyRDSR << + index)), TTY_PARITY); + info->icount.rx++; + info->idle_stats.parity_errs++; + } else if (data & CyOVERRUN) { + tty_insert_flip_char(tty, 0, + TTY_OVERRUN); + info->icount.rx++; + /* If the flip buffer itself is + overflowing, we still lose + the next incoming character. + */ + tty_insert_flip_char(tty, + readb(base_addr + (CyRDSR << + index)), TTY_FRAME); info->icount.rx++; - spin_unlock(&cinfo->card_lock); - return; - } - if (tty_buffer_request_room(tty, 1)) { - if (data & info->read_status_mask) { - if (data & CyBREAK) { - tty_insert_flip_char( - tty, - readb( - base_addr + - (CyRDSR << - index)), - TTY_BREAK); - info->icount.rx++; - if (info->flags & - ASYNC_SAK) { - do_SAK(tty); - } - } else if (data & CyFRAME) { - tty_insert_flip_char( - tty, - readb( - base_addr + - (CyRDSR << - index)), - TTY_FRAME); - info->icount.rx++; - info->idle_stats. - frame_errs++; - } else if (data & CyPARITY) { - /* Pieces of seven... */ - tty_insert_flip_char( - tty, - readb( - base_addr + - (CyRDSR << - index)), - TTY_PARITY); - info->icount.rx++; - info->idle_stats. - parity_errs++; - } else if (data & CyOVERRUN) { - tty_insert_flip_char( - tty, 0, - TTY_OVERRUN); - info->icount.rx++; - /* If the flip buffer itself is - overflowing, we still lose - the next incoming character. - */ - tty_insert_flip_char( - tty, - readb( - base_addr + - (CyRDSR << - index)), - TTY_FRAME); - info->icount.rx++; - info->idle_stats. - overruns++; - /* These two conditions may imply */ - /* a normal read should be done. */ - /* }else if(data & CyTIMEOUT){ */ - /* }else if(data & CySPECHAR){ */ - } else { - tty_insert_flip_char( - tty, 0, - TTY_NORMAL); - info->icount.rx++; - } - } else { - tty_insert_flip_char(tty, 0, - TTY_NORMAL); - info->icount.rx++; - } - } else { - /* there was a software buffer - overrun and nothing could be - done about it!!! */ - info->icount.buf_overrun++; info->idle_stats.overruns++; + /* These two conditions may imply */ + /* a normal read should be done. */ + /* } else if(data & CyTIMEOUT) { */ + /* } else if(data & CySPECHAR) { */ + } else { + tty_insert_flip_char(tty, 0, + TTY_NORMAL); + info->icount.rx++; } - } else { /* normal character reception */ - /* load # chars available from the chip */ - char_count = readb(base_addr + - (CyRDCR << index)); + } else { + tty_insert_flip_char(tty, 0, TTY_NORMAL); + info->icount.rx++; + } + } else { + /* there was a software buffer overrun and nothing + * could be done about it!!! */ + info->icount.buf_overrun++; + info->idle_stats.overruns++; + } + } else { /* normal character reception */ + /* load # chars available from the chip */ + char_count = readb(base_addr + (CyRDCR << index)); #ifdef CY_ENABLE_MONITORING - ++info->mon.int_count; - info->mon.char_count += char_count; - if (char_count > info->mon.char_max) - info->mon.char_max = char_count; - info->mon.char_last = char_count; + ++info->mon.int_count; + info->mon.char_count += char_count; + if (char_count > info->mon.char_max) + info->mon.char_max = char_count; + info->mon.char_last = char_count; #endif - len = tty_buffer_request_room(tty, char_count); - while (len--) { - data = readb(base_addr + - (CyRDSR << index)); - tty_insert_flip_char(tty, data, - TTY_NORMAL); - info->idle_stats.recv_bytes++; - info->icount.rx++; + len = tty_buffer_request_room(tty, char_count); + while (len--) { + data = readb(base_addr + (CyRDSR << index)); + tty_insert_flip_char(tty, data, TTY_NORMAL); + info->idle_stats.recv_bytes++; + info->icount.rx++; #ifdef CY_16Y_HACK - udelay(10L); + udelay(10L); #endif - } - info->idle_stats.recv_idle = jiffies; - } - tty_schedule_flip(tty); } - /* end of service */ - cy_writeb(base_addr + (CyRIR << index), (save_xir & 0x3f)); - cy_writeb(base_addr + (CyCAR << index), (save_car)); - spin_unlock(&cinfo->card_lock); + info->idle_stats.recv_idle = jiffies; } + tty_schedule_flip(tty); +end: + /* end of service */ + cy_writeb(base_addr + (CyRIR << index), save_xir & 0x3f); + cy_writeb(base_addr + (CyCAR << index), save_car); +} + +static void cyy_chip_tx(struct cyclades_card *cinfo, unsigned int chip, + void __iomem *base_addr) +{ + struct cyclades_port *info; + int char_count, index = cinfo->bus_index; + u8 save_xir, channel, save_car, outch; - if (status & CySRTransmit) { /* transmission interrupt */ - /* Since we only get here when the transmit buffer - is empty, we know we can always stuff a dozen - characters. */ + /* Since we only get here when the transmit buffer + is empty, we know we can always stuff a dozen + characters. */ #ifdef CY_DEBUG_INTERRUPTS - printk(KERN_DEBUG "cyy_interrupt: xmit intr, chip %d\n", chip); + printk(KERN_DEBUG "cyy_interrupt: xmit intr, chip %d\n", chip); #endif - /* determine the channel & change to that context */ - spin_lock(&cinfo->card_lock); - save_xir = (u_char) readb(base_addr + (CyTIR << index)); - channel = (u_short) (save_xir & CyIRChannel); - save_car = readb(base_addr + (CyCAR << index)); - cy_writeb(base_addr + (CyCAR << index), save_xir); + /* determine the channel & change to that context */ + save_xir = readb(base_addr + (CyTIR << index)); + channel = save_xir & CyIRChannel; + save_car = readb(base_addr + (CyCAR << index)); + cy_writeb(base_addr + (CyCAR << index), save_xir); - /* validate the port# (as configured and open) */ - if (channel + chip * 4 >= cinfo->nports) { - cy_writeb(base_addr + (CySRER << index), - readb(base_addr + (CySRER << index)) & - ~CyTxRdy); - goto txend; - } - info = &cinfo->ports[channel + chip * 4]; - if (info->tty == NULL) { - cy_writeb(base_addr + (CySRER << index), - readb(base_addr + (CySRER << index)) & - ~CyTxRdy); - goto txdone; - } + /* validate the port# (as configured and open) */ + if (channel + chip * 4 >= cinfo->nports) { + cy_writeb(base_addr + (CySRER << index), + readb(base_addr + (CySRER << index)) & ~CyTxRdy); + goto end; + } + info = &cinfo->ports[channel + chip * 4]; + if (info->tty == NULL) { + cy_writeb(base_addr + (CySRER << index), + readb(base_addr + (CySRER << index)) & ~CyTxRdy); + goto end; + } - /* load the on-chip space for outbound data */ - char_count = info->xmit_fifo_size; + /* load the on-chip space for outbound data */ + char_count = info->xmit_fifo_size; - if (info->x_char) { /* send special char */ - outch = info->x_char; - cy_writeb(base_addr + (CyTDR << index), outch); - char_count--; - info->icount.tx++; - info->x_char = 0; - } + if (info->x_char) { /* send special char */ + outch = info->x_char; + cy_writeb(base_addr + (CyTDR << index), outch); + char_count--; + info->icount.tx++; + info->x_char = 0; + } - if (info->breakon || info->breakoff) { - if (info->breakon) { - cy_writeb(base_addr + (CyTDR << index), 0); - cy_writeb(base_addr + (CyTDR << index), 0x81); - info->breakon = 0; - char_count -= 2; - } - if (info->breakoff) { - cy_writeb(base_addr + (CyTDR << index), 0); - cy_writeb(base_addr + (CyTDR << index), 0x83); - info->breakoff = 0; - char_count -= 2; - } + if (info->breakon || info->breakoff) { + if (info->breakon) { + cy_writeb(base_addr + (CyTDR << index), 0); + cy_writeb(base_addr + (CyTDR << index), 0x81); + info->breakon = 0; + char_count -= 2; + } + if (info->breakoff) { + cy_writeb(base_addr + (CyTDR << index), 0); + cy_writeb(base_addr + (CyTDR << index), 0x83); + info->breakoff = 0; + char_count -= 2; } + } - while (char_count-- > 0) { - if (!info->xmit_cnt) { - if (readb(base_addr + (CySRER << index)) & - CyTxMpty) { - cy_writeb(base_addr + (CySRER << index), - readb(base_addr + - (CySRER << index)) & + while (char_count-- > 0) { + if (!info->xmit_cnt) { + if (readb(base_addr + (CySRER << index)) & CyTxMpty) { + cy_writeb(base_addr + (CySRER << index), + readb(base_addr + (CySRER << index)) & ~CyTxMpty); - } else { - cy_writeb(base_addr + (CySRER << index), - (readb(base_addr + - (CySRER << index)) & + } else { + cy_writeb(base_addr + (CySRER << index), + (readb(base_addr + (CySRER << index)) & ~CyTxRdy) | CyTxMpty); - } - goto txdone; } - if (info->xmit_buf == NULL) { - cy_writeb(base_addr + (CySRER << index), - readb(base_addr + (CySRER << index)) & + goto done; + } + if (info->xmit_buf == NULL) { + cy_writeb(base_addr + (CySRER << index), + readb(base_addr + (CySRER << index)) & ~CyTxRdy); - goto txdone; - } - if (info->tty->stopped || info->tty->hw_stopped) { - cy_writeb(base_addr + (CySRER << index), - readb(base_addr + (CySRER << index)) & + goto done; + } + if (info->tty->stopped || info->tty->hw_stopped) { + cy_writeb(base_addr + (CySRER << index), + readb(base_addr + (CySRER << index)) & ~CyTxRdy); - goto txdone; - } - /* Because the Embedded Transmit Commands have - been enabled, we must check to see if the - escape character, NULL, is being sent. If it - is, we must ensure that there is room for it - to be doubled in the output stream. Therefore - we no longer advance the pointer when the - character is fetched, but rather wait until - after the check for a NULL output character. - This is necessary because there may not be - room for the two chars needed to send a NULL.) - */ - outch = info->xmit_buf[info->xmit_tail]; - if (outch) { + goto done; + } + /* Because the Embedded Transmit Commands have been enabled, + * we must check to see if the escape character, NULL, is being + * sent. If it is, we must ensure that there is room for it to + * be doubled in the output stream. Therefore we no longer + * advance the pointer when the character is fetched, but + * rather wait until after the check for a NULL output + * character. This is necessary because there may not be room + * for the two chars needed to send a NULL.) + */ + outch = info->xmit_buf[info->xmit_tail]; + if (outch) { + info->xmit_cnt--; + info->xmit_tail = (info->xmit_tail + 1) & + (SERIAL_XMIT_SIZE - 1); + cy_writeb(base_addr + (CyTDR << index), outch); + info->icount.tx++; + } else { + if (char_count > 1) { info->xmit_cnt--; info->xmit_tail = (info->xmit_tail + 1) & - (SERIAL_XMIT_SIZE - 1); + (SERIAL_XMIT_SIZE - 1); cy_writeb(base_addr + (CyTDR << index), outch); + cy_writeb(base_addr + (CyTDR << index), 0); info->icount.tx++; - } else { - if (char_count > 1) { - info->xmit_cnt--; - info->xmit_tail = (info->xmit_tail + 1)& - (SERIAL_XMIT_SIZE - 1); - cy_writeb(base_addr + (CyTDR << index), - outch); - cy_writeb(base_addr + (CyTDR << index), - 0); - info->icount.tx++; - char_count--; - } + char_count--; } } - -txdone: - if (info->xmit_cnt < WAKEUP_CHARS) { - cy_sched_event(info, Cy_EVENT_WRITE_WAKEUP); - } -txend: - /* end of service */ - cy_writeb(base_addr + (CyTIR << index), (save_xir & 0x3f)); - cy_writeb(base_addr + (CyCAR << index), (save_car)); - spin_unlock(&cinfo->card_lock); } - if (status & CySRModem) { /* modem interrupt */ +done: + tty_wakeup(info->tty); +end: + /* end of service */ + cy_writeb(base_addr + (CyTIR << index), save_xir & 0x3f); + cy_writeb(base_addr + (CyCAR << index), save_car); +} - /* determine the channel & change to that context */ - spin_lock(&cinfo->card_lock); - save_xir = (u_char) readb(base_addr + (CyMIR << index)); - channel = (u_short) (save_xir & CyIRChannel); - info = &cinfo->ports[channel + chip * 4]; - save_car = readb(base_addr + (CyCAR << index)); - cy_writeb(base_addr + (CyCAR << index), save_xir); +static void cyy_chip_modem(struct cyclades_card *cinfo, int chip, + void __iomem *base_addr) +{ + struct cyclades_port *info; + int index = cinfo->bus_index; + u8 save_xir, channel, save_car, mdm_change, mdm_status; - mdm_change = readb(base_addr + (CyMISR << index)); - mdm_status = readb(base_addr + (CyMSVR1 << index)); + /* determine the channel & change to that context */ + save_xir = readb(base_addr + (CyMIR << index)); + channel = save_xir & CyIRChannel; + info = &cinfo->ports[channel + chip * 4]; + save_car = readb(base_addr + (CyCAR << index)); + cy_writeb(base_addr + (CyCAR << index), save_xir); - if (info->tty) { - if (mdm_change & CyANY_DELTA) { - /* For statistics only */ - if (mdm_change & CyDCD) - info->icount.dcd++; - if (mdm_change & CyCTS) - info->icount.cts++; - if (mdm_change & CyDSR) - info->icount.dsr++; - if (mdm_change & CyRI) - info->icount.rng++; - - cy_sched_event(info, Cy_EVENT_DELTA_WAKEUP); - } + mdm_change = readb(base_addr + (CyMISR << index)); + mdm_status = readb(base_addr + (CyMSVR1 << index)); - if ((mdm_change & CyDCD) && - (info->flags & ASYNC_CHECK_CD)) { - if (mdm_status & CyDCD) { - cy_sched_event(info, - Cy_EVENT_OPEN_WAKEUP); - } else { - cy_sched_event(info, Cy_EVENT_HANGUP); - } - } - if ((mdm_change & CyCTS) && - (info->flags & ASYNC_CTS_FLOW)) { - if (info->tty->hw_stopped) { - if (mdm_status & CyCTS) { - /* cy_start isn't used - because... !!! */ - info->tty->hw_stopped = 0; - cy_writeb(base_addr + - (CySRER << index), - readb(base_addr + - (CySRER << - index))| - CyTxRdy); - cy_sched_event(info, - Cy_EVENT_WRITE_WAKEUP); - } - } else { - if (!(mdm_status & CyCTS)) { - /* cy_stop isn't used - because ... !!! */ - info->tty->hw_stopped = 1; - cy_writeb(base_addr + - (CySRER << index), - readb(base_addr + - (CySRER << - index)) & - ~CyTxRdy); - } - } + if (!info->tty) + goto end; + + if (mdm_change & CyANY_DELTA) { + /* For statistics only */ + if (mdm_change & CyDCD) + info->icount.dcd++; + if (mdm_change & CyCTS) + info->icount.cts++; + if (mdm_change & CyDSR) + info->icount.dsr++; + if (mdm_change & CyRI) + info->icount.rng++; + + wake_up_interruptible(&info->delta_msr_wait); + } + + if ((mdm_change & CyDCD) && (info->flags & ASYNC_CHECK_CD)) { + if (!(mdm_status & CyDCD)) { + tty_hangup(info->tty); + info->flags &= ~ASYNC_NORMAL_ACTIVE; + } + wake_up_interruptible(&info->open_wait); + } + if ((mdm_change & CyCTS) && (info->flags & ASYNC_CTS_FLOW)) { + if (info->tty->hw_stopped) { + if (mdm_status & CyCTS) { + /* cy_start isn't used + because... !!! */ + info->tty->hw_stopped = 0; + cy_writeb(base_addr + (CySRER << index), + readb(base_addr + (CySRER << index)) | + CyTxRdy); + tty_wakeup(info->tty); } -/* if (mdm_change & CyDSR) { + } else { + if (!(mdm_status & CyCTS)) { + /* cy_stop isn't used + because ... !!! */ + info->tty->hw_stopped = 1; + cy_writeb(base_addr + (CySRER << index), + readb(base_addr + (CySRER << index)) & + ~CyTxRdy); } - if (mdm_change & CyRI) { - }*/ } - /* end of service */ - cy_writeb(base_addr + (CyMIR << index), (save_xir & 0x3f)); - cy_writeb(base_addr + (CyCAR << index), save_car); - spin_unlock(&cinfo->card_lock); } +/* if (mdm_change & CyDSR) { + } + if (mdm_change & CyRI) { + }*/ +end: + /* end of service */ + cy_writeb(base_addr + (CyMIR << index), save_xir & 0x3f); + cy_writeb(base_addr + (CyCAR << index), save_car); } /* The real interrupt service routine is called @@ -1432,10 +1317,8 @@ static irqreturn_t cyy_interrupt(int irq, void *dev_id) int status; struct cyclades_card *cinfo = dev_id; void __iomem *base_addr, *card_base_addr; - int chip; + unsigned int chip, too_many, had_work; int index; - int too_many; - int had_work; if (unlikely(cinfo == NULL)) { #ifdef CY_DEBUG_INTERRUPTS @@ -1470,11 +1353,16 @@ static irqreturn_t cyy_interrupt(int irq, void *dev_id) chips to be checked in a round-robin fashion (after draining each of a bunch (1000) of characters). */ - if (1000 < too_many++) { + if (1000 < too_many++) break; - } - cyy_intr_chip(cinfo, chip, base_addr, status, - index); + spin_lock(&cinfo->card_lock); + if (status & CySRReceive) /* rx intr */ + cyy_chip_rx(cinfo, chip, base_addr); + if (status & CySRTransmit) /* tx intr */ + cyy_chip_tx(cinfo, chip, base_addr); + if (status & CySRModem) /* modem intr */ + cyy_chip_modem(cinfo, chip, base_addr); + spin_unlock(&cinfo->card_lock); } } } while (had_work); @@ -1529,7 +1417,7 @@ cyz_issue_cmd(struct cyclades_card *cinfo, struct ZFW_CTRL __iomem *zfw_ctrl; struct BOARD_CTRL __iomem *board_ctrl; __u32 __iomem *pci_doorbell; - int index; + unsigned int index; firm_id = cinfo->base_addr + ID_ADDRESS; if (!ISZLOADED(*cinfo)) { @@ -1554,13 +1442,12 @@ cyz_issue_cmd(struct cyclades_card *cinfo, return 0; } /* cyz_issue_cmd */ -static void -cyz_handle_rx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl, +static void cyz_handle_rx(struct cyclades_port *info, struct BUF_CTRL __iomem *buf_ctrl) { struct cyclades_card *cinfo = info->card; struct tty_struct *tty = info->tty; - int char_count; + unsigned int char_count; int len; #ifdef BLOCKMOVE unsigned char *buf; @@ -1633,9 +1520,11 @@ cyz_handle_rx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl, char_count = rx_put - rx_get; else char_count = rx_put - rx_get + rx_bufsize; - if (char_count >= (int)readl(&buf_ctrl->rx_threshold)) { - cy_sched_event(info, Cy_EVENT_Z_RX_FULL); - } + if (char_count >= readl(&buf_ctrl->rx_threshold) && + !timer_pending(&cyz_rx_full_timer[ + info->line])) + mod_timer(&cyz_rx_full_timer[info->line], + jiffies + 1); #endif info->idle_stats.recv_idle = jiffies; tty_schedule_flip(tty); @@ -1645,14 +1534,13 @@ cyz_handle_rx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl, } } -static void -cyz_handle_tx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl, +static void cyz_handle_tx(struct cyclades_port *info, struct BUF_CTRL __iomem *buf_ctrl) { struct cyclades_card *cinfo = info->card; struct tty_struct *tty = info->tty; - char data; - int char_count; + u8 data; + unsigned int char_count; #ifdef BLOCKMOVE int small_count; #endif @@ -1717,9 +1605,7 @@ cyz_handle_tx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl, } #endif ztxdone: - if (info->xmit_cnt < WAKEUP_CHARS) { - cy_sched_event(info, Cy_EVENT_WRITE_WAKEUP); - } + tty_wakeup(tty); /* Update tx_put */ cy_writel(&buf_ctrl->tx_put, tx_put); } @@ -1781,10 +1667,11 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo) if ((fw_ver > 241 ? ((u_long) param) : readl(&ch_ctrl->rs_status)) & C_RS_DCD) { - cy_sched_event(info, - Cy_EVENT_OPEN_WAKEUP); + wake_up_interruptible(&info->open_wait); } else { - cy_sched_event(info, Cy_EVENT_HANGUP); + tty_hangup(info->tty); + wake_up_interruptible(&info->open_wait); + info->flags &= ~ASYNC_NORMAL_ACTIVE; } } break; @@ -1802,7 +1689,7 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo) break; #ifdef Z_WAKE case C_CM_IOCTLW: - cy_sched_event(info, Cy_EVENT_SHUTDOWN_WAKEUP); + complete(&info->shutdown_wait); break; #endif #ifdef CONFIG_CYZ_INTR @@ -1814,7 +1701,7 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo) printk(KERN_DEBUG "cyz_interrupt: rcvd intr, card %d, " "port %ld\n", info->card, channel); #endif - cyz_handle_rx(info, ch_ctrl, buf_ctrl); + cyz_handle_rx(info, buf_ctrl); break; case C_CM_TXBEMPTY: case C_CM_TXLOWWM: @@ -1824,7 +1711,7 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo) printk(KERN_DEBUG "cyz_interrupt: xmit intr, card %d, " "port %ld\n", info->card, channel); #endif - cyz_handle_tx(info, ch_ctrl, buf_ctrl); + cyz_handle_tx(info, buf_ctrl); break; #endif /* CONFIG_CYZ_INTR */ case C_CM_FATAL: @@ -1834,7 +1721,7 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo) break; } if (delta_count) - cy_sched_event(info, Cy_EVENT_DELTA_WAKEUP); + wake_up_interruptible(&info->delta_msr_wait); if (special_count) tty_schedule_flip(tty); } @@ -1893,10 +1780,9 @@ static void cyz_poll(unsigned long arg) struct FIRM_ID __iomem *firm_id; struct ZFW_CTRL __iomem *zfw_ctrl; struct BOARD_CTRL __iomem *board_ctrl; - struct CH_CTRL __iomem *ch_ctrl; struct BUF_CTRL __iomem *buf_ctrl; unsigned long expires = jiffies + HZ; - int card, port; + unsigned int port, card; for (card = 0; card < NR_CARDS; card++) { cinfo = &cy_card[card]; @@ -1923,12 +1809,11 @@ static void cyz_poll(unsigned long arg) for (port = 0; port < cinfo->nports; port++) { info = &cinfo->ports[port]; tty = info->tty; - ch_ctrl = &(zfw_ctrl->ch_ctrl[port]); buf_ctrl = &(zfw_ctrl->buf_ctrl[port]); if (!info->throttle) - cyz_handle_rx(info, ch_ctrl, buf_ctrl); - cyz_handle_tx(info, ch_ctrl, buf_ctrl); + cyz_handle_rx(info, buf_ctrl); + cyz_handle_tx(info, buf_ctrl); } /* poll every 'cyz_polling_cycle' period */ expires = jiffies + cyz_polling_cycle; @@ -2491,11 +2376,11 @@ block_til_ready(struct tty_struct *tty, struct file *filp, static int cy_open(struct tty_struct *tty, struct file *filp) { struct cyclades_port *info; - unsigned int i; - int retval, line; + unsigned int i, line; + int retval; line = tty->index; - if ((line < 0) || (NR_PORTS <= line)) { + if ((tty->index < 0) || (NR_PORTS <= line)) { return -ENODEV; } for (i = 0; i < NR_CARDS; i++) @@ -2812,7 +2697,6 @@ static void cy_close(struct tty_struct *tty, struct file *filp) spin_lock_irqsave(&card->card_lock, flags); tty->closing = 0; - info->event = 0; info->tty = NULL; if (info->blocked_open) { spin_unlock_irqrestore(&card->card_lock, flags); @@ -4444,7 +4328,6 @@ static void cy_hangup(struct tty_struct *tty) cy_flush_buffer(tty); shutdown(info); - info->event = 0; info->count = 0; #ifdef CY_DEBUG_COUNT printk(KERN_DEBUG "cyc:cy_hangup (%d): setting count to 0\n", @@ -4467,9 +4350,9 @@ static int __devinit cy_init_card(struct cyclades_card *cinfo) { struct cyclades_port *info; u32 uninitialized_var(mailbox); - unsigned int nports; + unsigned int nports, port; unsigned short chip_number; - int uninitialized_var(index), port; + int uninitialized_var(index); spin_lock_init(&cinfo->card_lock); @@ -4502,7 +4385,6 @@ static int __devinit cy_init_card(struct cyclades_card *cinfo) info->closing_wait = CLOSING_WAIT_DELAY; info->close_delay = 5 * HZ / 10; - INIT_WORK(&info->tqueue, do_softint); init_waitqueue_head(&info->open_wait); init_waitqueue_head(&info->close_wait); init_completion(&info->shutdown_wait); @@ -5236,7 +5118,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev, } } #endif /* CONFIG_CYZ_INTR */ - cy_card[card_no].num_chips = -1; + cy_card[card_no].num_chips = (unsigned int)-1; } /* set cy_card */ @@ -5480,13 +5362,13 @@ static int __init cy_init(void) #ifdef CONFIG_PCI /* look for pci boards */ retval = pci_register_driver(&cy_pci_driver); - if (retval && !nboards) - goto err_unr; + if (retval && !nboards) { + tty_unregister_driver(cy_serial_driver); + goto err_frtty; + } #endif return 0; -err_unr: - tty_unregister_driver(cy_serial_driver); err_frtty: put_tty_driver(cy_serial_driver); err: @@ -5496,7 +5378,7 @@ err: static void __exit cy_cleanup_module(void) { struct cyclades_card *card; - int i, e1; + unsigned int i, e1; #ifndef CONFIG_CYZ_INTR del_timer_sync(&cyz_timerlist); @@ -5524,8 +5406,7 @@ static void __exit cy_cleanup_module(void) #endif /* CONFIG_CYZ_INTR */ ) free_irq(card->irq, card); - for (e1 = card->first_line; - e1 < card->first_line + + for (e1 = card->first_line; e1 < card->first_line + card->nports; e1++) tty_unregister_device(cy_serial_driver, e1); kfree(card->ports); diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index 8435fba73da..5dc1265ce1d 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c @@ -221,10 +221,8 @@ struct ipmi_smi void *send_info; #ifdef CONFIG_PROC_FS - /* A list of proc entries for this interface. This does not - need a lock, only one thread creates it and only one thread - destroys it. */ - spinlock_t proc_entry_lock; + /* A list of proc entries for this interface. */ + struct mutex proc_entry_lock; struct ipmi_proc_entry *proc_entries; #endif @@ -1891,11 +1889,11 @@ int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name, file->write_proc = write_proc; file->owner = owner; - spin_lock(&smi->proc_entry_lock); + mutex_lock(&smi->proc_entry_lock); /* Stick it on the list. */ entry->next = smi->proc_entries; smi->proc_entries = entry; - spin_unlock(&smi->proc_entry_lock); + mutex_unlock(&smi->proc_entry_lock); } #endif /* CONFIG_PROC_FS */ @@ -1939,7 +1937,7 @@ static void remove_proc_entries(ipmi_smi_t smi) #ifdef CONFIG_PROC_FS struct ipmi_proc_entry *entry; - spin_lock(&smi->proc_entry_lock); + mutex_lock(&smi->proc_entry_lock); while (smi->proc_entries) { entry = smi->proc_entries; smi->proc_entries = entry->next; @@ -1948,7 +1946,7 @@ static void remove_proc_entries(ipmi_smi_t smi) kfree(entry->name); kfree(entry); } - spin_unlock(&smi->proc_entry_lock); + mutex_unlock(&smi->proc_entry_lock); remove_proc_entry(smi->proc_dir_name, proc_ipmi_root); #endif /* CONFIG_PROC_FS */ } @@ -2614,6 +2612,14 @@ channel_handler(ipmi_smi_t intf, struct ipmi_recv_msg *msg) return; } +void ipmi_poll_interface(ipmi_user_t user) +{ + ipmi_smi_t intf = user->intf; + + if (intf->handlers->poll) + intf->handlers->poll(intf->send_info); +} + int ipmi_register_smi(struct ipmi_smi_handlers *handlers, void *send_info, struct ipmi_device_id *device_id, @@ -2671,7 +2677,7 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers, } intf->curr_seq = 0; #ifdef CONFIG_PROC_FS - spin_lock_init(&intf->proc_entry_lock); + mutex_init(&intf->proc_entry_lock); #endif spin_lock_init(&intf->waiting_msgs_lock); INIT_LIST_HEAD(&intf->waiting_msgs); @@ -4166,6 +4172,7 @@ EXPORT_SYMBOL(ipmi_destroy_user); EXPORT_SYMBOL(ipmi_get_version); EXPORT_SYMBOL(ipmi_request_settime); EXPORT_SYMBOL(ipmi_request_supply_msgs); +EXPORT_SYMBOL(ipmi_poll_interface); EXPORT_SYMBOL(ipmi_register_smi); EXPORT_SYMBOL(ipmi_unregister_smi); EXPORT_SYMBOL(ipmi_register_for_cmd); diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index c1222e98525..4f560d0bb80 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c @@ -675,7 +675,8 @@ static void handle_transaction_done(struct smi_info *smi_info) } /* Called on timeouts and events. Timeouts should pass the elapsed - time, interrupts should pass in zero. */ + time, interrupts should pass in zero. Must be called with + si_lock held and interrupts disabled. */ static enum si_sm_result smi_event_handler(struct smi_info *smi_info, int time) { @@ -892,13 +893,16 @@ static int ipmi_thread(void *data) static void poll(void *send_info) { struct smi_info *smi_info = send_info; + unsigned long flags; /* * Make sure there is some delay in the poll loop so we can * drive time forward and timeout things. */ udelay(10); + spin_lock_irqsave(&smi_info->si_lock, flags); smi_event_handler(smi_info, 10); + spin_unlock_irqrestore(&smi_info->si_lock, flags); } static void request_events(void *send_info) @@ -1006,6 +1010,10 @@ static int smi_start_processing(void *send_info, new_smi->intf = intf; + /* Try to claim any interrupts. */ + if (new_smi->irq_setup) + new_smi->irq_setup(new_smi); + /* Set up the timer that drives the interface. */ setup_timer(&new_smi->si_timer, smi_timeout, (long)new_smi); new_smi->last_timeout_jiffies = jiffies; @@ -2372,20 +2380,9 @@ static int try_get_dev_id(struct smi_info *smi_info) /* Otherwise, we got some data. */ resp_len = smi_info->handlers->get_result(smi_info->si_sm, resp, IPMI_MAX_MSG_LENGTH); - if (resp_len < 14) { - /* That's odd, it should be longer. */ - rv = -EINVAL; - goto out; - } - if ((resp[1] != IPMI_GET_DEVICE_ID_CMD) || (resp[2] != 0)) { - /* That's odd, it shouldn't be able to fail. */ - rv = -EINVAL; - goto out; - } - - /* Record info from the get device id, in case we need it. */ - ipmi_demangle_device_id(resp+3, resp_len-3, &smi_info->device_id); + /* Check and record info from the get device id, in case we need it. */ + rv = ipmi_demangle_device_id(resp, resp_len, &smi_info->device_id); out: kfree(resp); @@ -2765,10 +2762,6 @@ static int try_smi_init(struct smi_info *new_smi) setup_oem_data_handler(new_smi); setup_xaction_handlers(new_smi); - /* Try to claim any interrupts. */ - if (new_smi->irq_setup) - new_smi->irq_setup(new_smi); - INIT_LIST_HEAD(&(new_smi->xmit_msgs)); INIT_LIST_HEAD(&(new_smi->hp_xmit_msgs)); new_smi->curr_msg = NULL; diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c index 41f78e2c158..e686fc92516 100644 --- a/drivers/char/ipmi/ipmi_watchdog.c +++ b/drivers/char/ipmi/ipmi_watchdog.c @@ -50,10 +50,19 @@ #include <linux/poll.h> #include <linux/string.h> #include <linux/ctype.h> +#include <linux/delay.h> #include <asm/atomic.h> -#ifdef CONFIG_X86_LOCAL_APIC -#include <asm/apic.h> +#ifdef CONFIG_X86 +/* This is ugly, but I've determined that x86 is the only architecture + that can reasonably support the IPMI NMI watchdog timeout at this + time. If another architecture adds this capability somehow, it + will have to be a somewhat different mechanism and I have no idea + how it will work. So in the unlikely event that another + architecture supports this, we can figure out a good generic + mechanism for it at that time. */ +#include <asm/kdebug.h> +#define HAVE_DIE_NMI #endif #define PFX "IPMI Watchdog: " @@ -166,8 +175,6 @@ static char expect_close; static int ifnum_to_use = -1; -static DECLARE_RWSEM(register_sem); - /* Parameters to ipmi_set_timeout */ #define IPMI_SET_TIMEOUT_NO_HB 0 #define IPMI_SET_TIMEOUT_HB_IF_NECESSARY 1 @@ -193,11 +200,9 @@ static int set_param_int(const char *val, struct kernel_param *kp) if (endp == val) return -EINVAL; - down_read(®ister_sem); *((int *)kp->arg) = l; if (watchdog_user) rv = ipmi_set_timeout(IPMI_SET_TIMEOUT_HB_IF_NECESSARY); - up_read(®ister_sem); return rv; } @@ -226,17 +231,15 @@ static int set_param_str(const char *val, struct kernel_param *kp) s = strstrip(valcp); - down_read(®ister_sem); rv = fn(s, NULL); if (rv) - goto out_unlock; + goto out; check_parms(); if (watchdog_user) rv = ipmi_set_timeout(IPMI_SET_TIMEOUT_HB_IF_NECESSARY); - out_unlock: - up_read(®ister_sem); + out: return rv; } @@ -319,9 +322,12 @@ static unsigned char ipmi_version_minor; /* If a pretimeout occurs, this is used to allow only one panic to happen. */ static atomic_t preop_panic_excl = ATOMIC_INIT(-1); -static int ipmi_heartbeat(void); -static void panic_halt_ipmi_heartbeat(void); +#ifdef HAVE_DIE_NMI +static int testing_nmi; +static int nmi_handler_registered; +#endif +static int ipmi_heartbeat(void); /* We use a mutex to make sure that only one thing can send a set timeout at one time, because we only have one copy of the data. @@ -360,6 +366,9 @@ static int i_ipmi_set_timeout(struct ipmi_smi_msg *smi_msg, int hbnow = 0; + /* These can be cleared as we are setting the timeout. */ + pretimeout_since_last_heartbeat = 0; + data[0] = 0; WDOG_SET_TIMER_USE(data[0], WDOG_TIMER_USE_SMS_OS); @@ -434,31 +443,75 @@ static int ipmi_set_timeout(int do_heartbeat) wait_for_completion(&set_timeout_wait); + mutex_unlock(&set_timeout_lock); + if ((do_heartbeat == IPMI_SET_TIMEOUT_FORCE_HB) || ((send_heartbeat_now) && (do_heartbeat == IPMI_SET_TIMEOUT_HB_IF_NECESSARY))) - { rv = ipmi_heartbeat(); - } - mutex_unlock(&set_timeout_lock); out: return rv; } -static void dummy_smi_free(struct ipmi_smi_msg *msg) +static atomic_t panic_done_count = ATOMIC_INIT(0); + +static void panic_smi_free(struct ipmi_smi_msg *msg) { + atomic_dec(&panic_done_count); } -static void dummy_recv_free(struct ipmi_recv_msg *msg) +static void panic_recv_free(struct ipmi_recv_msg *msg) { + atomic_dec(&panic_done_count); +} + +static struct ipmi_smi_msg panic_halt_heartbeat_smi_msg = +{ + .done = panic_smi_free +}; +static struct ipmi_recv_msg panic_halt_heartbeat_recv_msg = +{ + .done = panic_recv_free +}; + +static void panic_halt_ipmi_heartbeat(void) +{ + struct kernel_ipmi_msg msg; + struct ipmi_system_interface_addr addr; + int rv; + + /* Don't reset the timer if we have the timer turned off, that + re-enables the watchdog. */ + if (ipmi_watchdog_state == WDOG_TIMEOUT_NONE) + return; + + addr.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE; + addr.channel = IPMI_BMC_CHANNEL; + addr.lun = 0; + + msg.netfn = 0x06; + msg.cmd = IPMI_WDOG_RESET_TIMER; + msg.data = NULL; + msg.data_len = 0; + rv = ipmi_request_supply_msgs(watchdog_user, + (struct ipmi_addr *) &addr, + 0, + &msg, + NULL, + &panic_halt_heartbeat_smi_msg, + &panic_halt_heartbeat_recv_msg, + 1); + if (!rv) + atomic_add(2, &panic_done_count); } + static struct ipmi_smi_msg panic_halt_smi_msg = { - .done = dummy_smi_free + .done = panic_smi_free }; static struct ipmi_recv_msg panic_halt_recv_msg = { - .done = dummy_recv_free + .done = panic_recv_free }; /* Special call, doesn't claim any locks. This is only to be called @@ -470,13 +523,21 @@ static void panic_halt_ipmi_set_timeout(void) int send_heartbeat_now; int rv; + /* Wait for the messages to be free. */ + while (atomic_read(&panic_done_count) != 0) + ipmi_poll_interface(watchdog_user); rv = i_ipmi_set_timeout(&panic_halt_smi_msg, &panic_halt_recv_msg, &send_heartbeat_now); if (!rv) { + atomic_add(2, &panic_done_count); if (send_heartbeat_now) panic_halt_ipmi_heartbeat(); - } + } else + printk(KERN_WARNING PFX + "Unable to extend the watchdog timeout."); + while (atomic_read(&panic_done_count) != 0) + ipmi_poll_interface(watchdog_user); } /* We use a semaphore to make sure that only one thing can send a @@ -505,24 +566,14 @@ static struct ipmi_recv_msg heartbeat_recv_msg = .done = heartbeat_free_recv }; -static struct ipmi_smi_msg panic_halt_heartbeat_smi_msg = -{ - .done = dummy_smi_free -}; -static struct ipmi_recv_msg panic_halt_heartbeat_recv_msg = -{ - .done = dummy_recv_free -}; - static int ipmi_heartbeat(void) { struct kernel_ipmi_msg msg; int rv; struct ipmi_system_interface_addr addr; - if (ipmi_ignore_heartbeat) { + if (ipmi_ignore_heartbeat) return 0; - } if (ipmi_start_timer_on_heartbeat) { ipmi_start_timer_on_heartbeat = 0; @@ -533,7 +584,6 @@ static int ipmi_heartbeat(void) We don't want to set the action, though, we want to leave that alone (thus it can't be combined with the above operation. */ - pretimeout_since_last_heartbeat = 0; return ipmi_set_timeout(IPMI_SET_TIMEOUT_HB_IF_NECESSARY); } @@ -586,35 +636,6 @@ static int ipmi_heartbeat(void) return rv; } -static void panic_halt_ipmi_heartbeat(void) -{ - struct kernel_ipmi_msg msg; - struct ipmi_system_interface_addr addr; - - - /* Don't reset the timer if we have the timer turned off, that - re-enables the watchdog. */ - if (ipmi_watchdog_state == WDOG_TIMEOUT_NONE) - return; - - addr.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE; - addr.channel = IPMI_BMC_CHANNEL; - addr.lun = 0; - - msg.netfn = 0x06; - msg.cmd = IPMI_WDOG_RESET_TIMER; - msg.data = NULL; - msg.data_len = 0; - ipmi_request_supply_msgs(watchdog_user, - (struct ipmi_addr *) &addr, - 0, - &msg, - NULL, - &panic_halt_heartbeat_smi_msg, - &panic_halt_heartbeat_recv_msg, - 1); -} - static struct watchdog_info ident = { .options = 0, /* WDIOF_SETTIMEOUT, */ @@ -895,7 +916,6 @@ static void ipmi_register_watchdog(int ipmi_intf) { int rv = -EBUSY; - down_write(®ister_sem); if (watchdog_user) goto out; @@ -921,15 +941,56 @@ static void ipmi_register_watchdog(int ipmi_intf) printk(KERN_CRIT PFX "Unable to register misc device\n"); } - out: - up_write(®ister_sem); +#ifdef HAVE_DIE_NMI + if (nmi_handler_registered) { + int old_pretimeout = pretimeout; + int old_timeout = timeout; + int old_preop_val = preop_val; + + /* Set the pretimeout to go off in a second and give + ourselves plenty of time to stop the timer. */ + ipmi_watchdog_state = WDOG_TIMEOUT_RESET; + preop_val = WDOG_PREOP_NONE; /* Make sure nothing happens */ + pretimeout = 99; + timeout = 100; + + testing_nmi = 1; + + rv = ipmi_set_timeout(IPMI_SET_TIMEOUT_FORCE_HB); + if (rv) { + printk(KERN_WARNING PFX "Error starting timer to" + " test NMI: 0x%x. The NMI pretimeout will" + " likely not work\n", rv); + rv = 0; + goto out_restore; + } + + msleep(1500); + if (testing_nmi != 2) { + printk(KERN_WARNING PFX "IPMI NMI didn't seem to" + " occur. The NMI pretimeout will" + " likely not work\n"); + } + out_restore: + testing_nmi = 0; + preop_val = old_preop_val; + pretimeout = old_pretimeout; + timeout = old_timeout; + } +#endif + + out: if ((start_now) && (rv == 0)) { /* Run from startup, so start the timer now. */ start_now = 0; /* Disable this function after first startup. */ ipmi_watchdog_state = action_val; ipmi_set_timeout(IPMI_SET_TIMEOUT_FORCE_HB); printk(KERN_INFO PFX "Starting now!\n"); + } else { + /* Stop the timer now. */ + ipmi_watchdog_state = WDOG_TIMEOUT_NONE; + ipmi_set_timeout(IPMI_SET_TIMEOUT_NO_HB); } } @@ -937,8 +998,6 @@ static void ipmi_unregister_watchdog(int ipmi_intf) { int rv; - down_write(®ister_sem); - if (!watchdog_user) goto out; @@ -963,20 +1022,44 @@ static void ipmi_unregister_watchdog(int ipmi_intf) watchdog_user = NULL; out: - up_write(®ister_sem); + return; } -#ifdef HAVE_NMI_HANDLER +#ifdef HAVE_DIE_NMI static int -ipmi_nmi(void *dev_id, int cpu, int handled) +ipmi_nmi(struct notifier_block *self, unsigned long val, void *data) { + struct die_args *args = data; + + if (val != DIE_NMI) + return NOTIFY_OK; + + /* Hack, if it's a memory or I/O error, ignore it. */ + if (args->err & 0xc0) + return NOTIFY_OK; + + /* + * If we get here, it's an NMI that's not a memory or I/O + * error. We can't truly tell if it's from IPMI or not + * without sending a message, and sending a message is almost + * impossible because of locking. + */ + + if (testing_nmi) { + testing_nmi = 2; + return NOTIFY_STOP; + } + /* If we are not expecting a timeout, ignore it. */ if (ipmi_watchdog_state == WDOG_TIMEOUT_NONE) - return NOTIFY_DONE; + return NOTIFY_OK; + + if (preaction_val != WDOG_PRETIMEOUT_NMI) + return NOTIFY_OK; /* If no one else handled the NMI, we assume it was the IPMI watchdog. */ - if ((!handled) && (preop_val == WDOG_PREOP_PANIC)) { + if (preop_val == WDOG_PREOP_PANIC) { /* On some machines, the heartbeat will give an error and not work unless we re-enable the timer. So do so. */ @@ -985,18 +1068,12 @@ ipmi_nmi(void *dev_id, int cpu, int handled) panic(PFX "pre-timeout"); } - return NOTIFY_DONE; + return NOTIFY_STOP; } -static struct nmi_handler ipmi_nmi_handler = -{ - .link = LIST_HEAD_INIT(ipmi_nmi_handler.link), - .dev_name = "ipmi_watchdog", - .dev_id = NULL, - .handler = ipmi_nmi, - .priority = 0, /* Call us last. */ +static struct notifier_block ipmi_nmi_handler = { + .notifier_call = ipmi_nmi }; -int nmi_handler_registered; #endif static int wdog_reboot_handler(struct notifier_block *this, @@ -1009,7 +1086,7 @@ static int wdog_reboot_handler(struct notifier_block *this, /* Make sure we only do this once. */ reboot_event_handled = 1; - if (code == SYS_DOWN || code == SYS_HALT) { + if (code == SYS_POWER_OFF || code == SYS_HALT) { /* Disable the WDT if we are shutting down. */ ipmi_watchdog_state = WDOG_TIMEOUT_NONE; panic_halt_ipmi_set_timeout(); @@ -1113,7 +1190,7 @@ static int preaction_op(const char *inval, char *outval) preaction_val = WDOG_PRETIMEOUT_NONE; else if (strcmp(inval, "pre_smi") == 0) preaction_val = WDOG_PRETIMEOUT_SMI; -#ifdef HAVE_NMI_HANDLER +#ifdef HAVE_DIE_NMI else if (strcmp(inval, "pre_nmi") == 0) preaction_val = WDOG_PRETIMEOUT_NMI; #endif @@ -1147,7 +1224,7 @@ static int preop_op(const char *inval, char *outval) static void check_parms(void) { -#ifdef HAVE_NMI_HANDLER +#ifdef HAVE_DIE_NMI int do_nmi = 0; int rv; @@ -1160,20 +1237,9 @@ static void check_parms(void) preop_op("preop_none", NULL); do_nmi = 0; } -#ifdef CONFIG_X86_LOCAL_APIC - if (nmi_watchdog == NMI_IO_APIC) { - printk(KERN_WARNING PFX "nmi_watchdog is set to IO APIC" - " mode (value is %d), that is incompatible" - " with using NMI in the IPMI watchdog." - " Disabling IPMI nmi pretimeout.\n", - nmi_watchdog); - preaction_val = WDOG_PRETIMEOUT_NONE; - do_nmi = 0; - } -#endif } if (do_nmi && !nmi_handler_registered) { - rv = request_nmi(&ipmi_nmi_handler); + rv = register_die_notifier(&ipmi_nmi_handler); if (rv) { printk(KERN_WARNING PFX "Can't register nmi handler\n"); @@ -1181,7 +1247,7 @@ static void check_parms(void) } else nmi_handler_registered = 1; } else if (!do_nmi && nmi_handler_registered) { - release_nmi(&ipmi_nmi_handler); + unregister_die_notifier(&ipmi_nmi_handler); nmi_handler_registered = 0; } #endif @@ -1217,9 +1283,9 @@ static int __init ipmi_wdog_init(void) rv = ipmi_smi_watcher_register(&smi_watcher); if (rv) { -#ifdef HAVE_NMI_HANDLER - if (preaction_val == WDOG_PRETIMEOUT_NMI) - release_nmi(&ipmi_nmi_handler); +#ifdef HAVE_DIE_NMI + if (nmi_handler_registered) + unregister_die_notifier(&ipmi_nmi_handler); #endif atomic_notifier_chain_unregister(&panic_notifier_list, &wdog_panic_notifier); @@ -1238,9 +1304,9 @@ static void __exit ipmi_wdog_exit(void) ipmi_smi_watcher_unregister(&smi_watcher); ipmi_unregister_watchdog(watchdog_ifnum); -#ifdef HAVE_NMI_HANDLER +#ifdef HAVE_DIE_NMI if (nmi_handler_registered) - release_nmi(&ipmi_nmi_handler); + unregister_die_notifier(&ipmi_nmi_handler); #endif atomic_notifier_chain_unregister(&panic_notifier_list, diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c index 77a7a4a0662..85d596a3c18 100644 --- a/drivers/char/isicom.c +++ b/drivers/char/isicom.c @@ -1529,7 +1529,7 @@ static int __devinit reset_card(struct pci_dev *pdev, portcount = inw(base + 0x2); if (!inw(base + 0xe) & 0x1 || (portcount != 0 && portcount != 4 && portcount != 8 && portcount != 16)) { - dev_err(&pdev->dev, "ISILoad:PCI Card%d reset failure.", + dev_err(&pdev->dev, "ISILoad:PCI Card%d reset failure.\n", card + 1); retval = -EIO; goto end; @@ -1622,7 +1622,9 @@ static int __devinit load_firmware(struct pci_dev *pdev, if ((status = inw(base + 0x4)) != 0) { dev_warn(&pdev->dev, "Card%d rejected load header:\n" - "Address:0x%x\nCount:0x%x\nStatus:0x%x\n", + KERN_WARNING "Address:0x%x\n" + KERN_WARNING "Count:0x%x\n" + KERN_WARNING "Status:0x%x\n", index + 1, frame->addr, frame->count, status); goto errrelfw; } @@ -1666,7 +1668,9 @@ static int __devinit load_firmware(struct pci_dev *pdev, if ((status = inw(base + 0x4)) != 0) { dev_warn(&pdev->dev, "Card%d rejected verify header:\n" - "Address:0x%x\nCount:0x%x\nStatus: 0x%x\n", + KERN_WARNING "Address:0x%x\n" + KERN_WARNING "Count:0x%x\n" + KERN_WARNING "Status: 0x%x\n", index + 1, frame->addr, frame->count, status); goto errrelfw; } diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c index ed76f0a127f..2fc255a2148 100644 --- a/drivers/char/moxa.c +++ b/drivers/char/moxa.c @@ -41,6 +41,7 @@ #include <linux/pci.h> #include <linux/init.h> #include <linux/bitops.h> +#include <linux/completion.h> #include <asm/system.h> #include <asm/io.h> @@ -142,7 +143,7 @@ struct moxa_port { struct tty_struct *tty; int cflag; wait_queue_head_t open_wait; - wait_queue_head_t close_wait; + struct completion close_wait; struct timer_list emptyTimer; @@ -166,7 +167,6 @@ struct moxa_port { #define WAKEUP_CHARS 256 -static int verbose = 0; static int ttymajor = MOXAMAJOR; /* Variables for insmod */ #ifdef MODULE @@ -184,7 +184,6 @@ module_param_array(baseaddr, int, NULL, 0); module_param_array(numports, int, NULL, 0); #endif module_param(ttymajor, int, 0); -module_param(verbose, bool, 0644); /* * static functions: @@ -208,13 +207,13 @@ static int moxa_tiocmget(struct tty_struct *tty, struct file *file); static int moxa_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); static void moxa_poll(unsigned long); -static void set_tty_param(struct tty_struct *); -static int block_till_ready(struct tty_struct *, struct file *, +static void moxa_set_tty_param(struct tty_struct *); +static int moxa_block_till_ready(struct tty_struct *, struct file *, struct moxa_port *); -static void setup_empty_event(struct tty_struct *); -static void check_xmit_empty(unsigned long); -static void shut_down(struct moxa_port *); -static void receive_data(struct moxa_port *); +static void moxa_setup_empty_event(struct tty_struct *); +static void moxa_check_xmit_empty(unsigned long); +static void moxa_shut_down(struct moxa_port *); +static void moxa_receive_data(struct moxa_port *); /* * moxa board interface functions: */ @@ -283,8 +282,10 @@ static int __devinit moxa_pci_probe(struct pci_dev *pdev, int retval; retval = pci_enable_device(pdev); - if (retval) + if (retval) { + dev_err(&pdev->dev, "can't enable pci device\n"); goto err; + } for (i = 0; i < MAX_BOARDS; i++) if (moxa_boards[i].basemem == NULL) @@ -292,16 +293,17 @@ static int __devinit moxa_pci_probe(struct pci_dev *pdev, retval = -ENODEV; if (i >= MAX_BOARDS) { - if (verbose) - printk("More than %d MOXA Intellio family boards " + dev_warn(&pdev->dev, "more than %u MOXA Intellio family boards " "found. Board is ignored.\n", MAX_BOARDS); goto err; } board = &moxa_boards[i]; board->basemem = pci_iomap(pdev, 2, 0x4000); - if (board->basemem == NULL) + if (board->basemem == NULL) { + dev_err(&pdev->dev, "can't remap io space 2\n"); goto err; + } board->boardType = board_type; switch (board_type) { @@ -347,7 +349,8 @@ static int __init moxa_init(void) int i, numBoards, retval = 0; struct moxa_port *ch; - printk(KERN_INFO "MOXA Intellio family driver version %s\n", MOXA_VERSION); + printk(KERN_INFO "MOXA Intellio family driver version %s\n", + MOXA_VERSION); moxaDriver = alloc_tty_driver(MAX_PORTS + 1); if (!moxaDriver) return -ENOMEM; @@ -372,13 +375,13 @@ static int __init moxa_init(void) ch->closing_wait = 30 * HZ; ch->cflag = B9600 | CS8 | CREAD | CLOCAL | HUPCL; init_waitqueue_head(&ch->open_wait); - init_waitqueue_head(&ch->close_wait); + init_completion(&ch->close_wait); - setup_timer(&ch->emptyTimer, check_xmit_empty, + setup_timer(&ch->emptyTimer, moxa_check_xmit_empty, (unsigned long)ch); } - printk("Tty devices major number = %d\n", ttymajor); + pr_debug("Moxa tty devices major number = %d\n", ttymajor); if (tty_register_driver(moxaDriver)) { printk(KERN_ERR "Couldn't install MOXA Smartio family driver !\n"); @@ -400,11 +403,10 @@ static int __init moxa_init(void) moxa_boards[numBoards].numPorts = moxa_isa_boards[i].numPorts; moxa_boards[numBoards].busType = MOXA_BUS_TYPE_ISA; moxa_boards[numBoards].baseAddr = moxa_isa_boards[i].baseAddr; - if (verbose) - printk("Board %2d: %s board(baseAddr=%lx)\n", - numBoards + 1, - moxa_brdname[moxa_boards[numBoards].boardType - 1], - moxa_boards[numBoards].baseAddr); + pr_debug("Moxa board %2d: %s board(baseAddr=%lx)\n", + numBoards + 1, + moxa_brdname[moxa_boards[numBoards].boardType-1], + moxa_boards[numBoards].baseAddr); numBoards++; } } @@ -413,14 +415,13 @@ static int __init moxa_init(void) for (i = 0; i < MAX_BOARDS; i++) { if ((type[i] == MOXA_BOARD_C218_ISA) || (type[i] == MOXA_BOARD_C320_ISA)) { - if (verbose) - printk("Board %2d: %s board(baseAddr=%lx)\n", - numBoards + 1, - moxa_brdname[type[i] - 1], - (unsigned long) baseaddr[i]); + pr_debug("Moxa board %2d: %s board(baseAddr=%lx)\n", + numBoards + 1, moxa_brdname[type[i] - 1], + (unsigned long)baseaddr[i]); if (numBoards >= MAX_BOARDS) { - if (verbose) - printk("More than %d MOXA Intellio family boards found. Board is ignored.", MAX_BOARDS); + printk(KERN_WARNING "More than %d MOXA " + "Intellio family boards found. Board " + "is ignored.\n", MAX_BOARDS); continue; } moxa_boards[numBoards].boardType = type[i]; @@ -456,16 +457,14 @@ static void __exit moxa_exit(void) { int i; - if (verbose) - printk("Unloading module moxa ...\n"); - del_timer_sync(&moxaTimer); for (i = 0; i < MAX_PORTS; i++) del_timer_sync(&moxa_ports[i].emptyTimer); if (tty_unregister_driver(moxaDriver)) - printk("Couldn't unregister MOXA Intellio family serial driver\n"); + printk(KERN_ERR "Couldn't unregister MOXA Intellio family " + "serial driver\n"); put_tty_driver(moxaDriver); #ifdef CONFIG_PCI @@ -475,9 +474,6 @@ static void __exit moxa_exit(void) for (i = 0; i < MAX_BOARDS; i++) if (moxa_boards[i].basemem) iounmap(moxa_boards[i].basemem); - - if (verbose) - printk("Done\n"); } module_init(moxa_init); @@ -504,12 +500,12 @@ static int moxa_open(struct tty_struct *tty, struct file *filp) ch->tty = tty; if (!(ch->asyncflags & ASYNC_INITIALIZED)) { ch->statusflags = 0; - set_tty_param(tty); + moxa_set_tty_param(tty); MoxaPortLineCtrl(ch->port, 1, 1); MoxaPortEnable(ch->port); ch->asyncflags |= ASYNC_INITIALIZED; } - retval = block_till_ready(tty, filp, ch); + retval = moxa_block_till_ready(tty, filp, ch); moxa_unthrottle(tty); @@ -532,9 +528,7 @@ static void moxa_close(struct tty_struct *tty, struct file *filp) return; } if (!MoxaPortIsValid(port)) { -#ifdef SERIAL_DEBUG_CLOSE - printk("Invalid portno in moxa_close\n"); -#endif + pr_debug("Invalid portno in moxa_close\n"); tty->driver_data = NULL; return; } @@ -547,13 +541,13 @@ static void moxa_close(struct tty_struct *tty, struct file *filp) ch = (struct moxa_port *) tty->driver_data; if ((tty->count == 1) && (ch->count != 1)) { - printk("moxa_close: bad serial port count; tty->count is 1, " - "ch->count is %d\n", ch->count); + printk(KERN_WARNING "moxa_close: bad serial port count; " + "tty->count is 1, ch->count is %d\n", ch->count); ch->count = 1; } if (--ch->count < 0) { - printk("moxa_close: bad serial port count, device=%s\n", - tty->name); + printk(KERN_WARNING "moxa_close: bad serial port count, " + "device=%s\n", tty->name); ch->count = 0; } if (ch->count) { @@ -563,11 +557,11 @@ static void moxa_close(struct tty_struct *tty, struct file *filp) ch->cflag = tty->termios->c_cflag; if (ch->asyncflags & ASYNC_INITIALIZED) { - setup_empty_event(tty); + moxa_setup_empty_event(tty); tty_wait_until_sent(tty, 30 * HZ); /* 30 seconds timeout */ del_timer_sync(&moxa_ports[ch->port].emptyTimer); } - shut_down(ch); + moxa_shut_down(ch); MoxaPortFlushData(port, 2); if (tty->driver->flush_buffer) @@ -584,7 +578,7 @@ static void moxa_close(struct tty_struct *tty, struct file *filp) wake_up_interruptible(&ch->open_wait); } ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CLOSING); - wake_up_interruptible(&ch->close_wait); + complete_all(&ch->close_wait); } static int moxa_write(struct tty_struct *tty, @@ -653,7 +647,7 @@ static int moxa_chars_in_buffer(struct tty_struct *tty) * in tty_ioctl.c, etc. */ if (!(ch->statusflags & EMPTYWAIT)) - setup_empty_event(tty); + moxa_setup_empty_event(tty); } return (chars); } @@ -751,7 +745,7 @@ static int moxa_ioctl(struct tty_struct *tty, struct file *file, retval = tty_check_change(tty); if (retval) return (retval); - setup_empty_event(tty); + moxa_setup_empty_event(tty); tty_wait_until_sent(tty, 0); if (!arg) MoxaPortSendBreak(ch->port, 0); @@ -760,7 +754,7 @@ static int moxa_ioctl(struct tty_struct *tty, struct file *file, retval = tty_check_change(tty); if (retval) return (retval); - setup_empty_event(tty); + moxa_setup_empty_event(tty); tty_wait_until_sent(tty, 0); MoxaPortSendBreak(ch->port, arg); return (0); @@ -809,7 +803,7 @@ static void moxa_set_termios(struct tty_struct *tty, if (ch == NULL) return; - set_tty_param(tty); + moxa_set_tty_param(tty); if (!(old_termios->c_cflag & CLOCAL) && (tty->termios->c_cflag & CLOCAL)) wake_up_interruptible(&ch->open_wait); @@ -845,7 +839,7 @@ static void moxa_hangup(struct tty_struct *tty) struct moxa_port *ch = (struct moxa_port *) tty->driver_data; moxa_flush_buffer(tty); - shut_down(ch); + moxa_shut_down(ch); ch->event = 0; ch->count = 0; ch->asyncflags &= ~ASYNC_NORMAL_ACTIVE; @@ -875,7 +869,7 @@ static void moxa_poll(unsigned long ignored) continue; if (!(ch->statusflags & THROTTLE) && (MoxaPortRxQueue(ch->port) > 0)) - receive_data(ch); + moxa_receive_data(ch); if ((tp = ch->tty) == 0) continue; if (ch->statusflags & LOWWAIT) { @@ -909,7 +903,7 @@ static void moxa_poll(unsigned long ignored) /******************************************************************************/ -static void set_tty_param(struct tty_struct *tty) +static void moxa_set_tty_param(struct tty_struct *tty) { register struct ktermios *ts; struct moxa_port *ch; @@ -934,7 +928,7 @@ static void set_tty_param(struct tty_struct *tty) MoxaPortSetTermio(ch->port, ts, tty_get_baud_rate(tty)); } -static int block_till_ready(struct tty_struct *tty, struct file *filp, +static int moxa_block_till_ready(struct tty_struct *tty, struct file *filp, struct moxa_port *ch) { DECLARE_WAITQUEUE(wait,current); @@ -948,7 +942,7 @@ static int block_till_ready(struct tty_struct *tty, struct file *filp, */ if (tty_hung_up_p(filp) || (ch->asyncflags & ASYNC_CLOSING)) { if (ch->asyncflags & ASYNC_CLOSING) - interruptible_sleep_on(&ch->close_wait); + wait_for_completion_interruptible(&ch->close_wait); #ifdef SERIAL_DO_RESTART if (ch->asyncflags & ASYNC_HUP_NOTIFY) return (-EAGAIN); @@ -971,10 +965,8 @@ static int block_till_ready(struct tty_struct *tty, struct file *filp, */ retval = 0; add_wait_queue(&ch->open_wait, &wait); -#ifdef SERIAL_DEBUG_OPEN - printk("block_til_ready before block: ttys%d, count = %d\n", - ch->line, ch->count); -#endif + pr_debug("block_til_ready before block: ttys%d, count = %d\n", + ch->port, ch->count); spin_lock_irqsave(&moxa_lock, flags); if (!tty_hung_up_p(filp)) ch->count--; @@ -1013,10 +1005,8 @@ static int block_till_ready(struct tty_struct *tty, struct file *filp, ch->count++; ch->blocked_open--; spin_unlock_irqrestore(&moxa_lock, flags); -#ifdef SERIAL_DEBUG_OPEN - printk("block_til_ready after blocking: ttys%d, count = %d\n", - ch->line, ch->count); -#endif + pr_debug("block_til_ready after blocking: ttys%d, count = %d\n", + ch->port, ch->count); if (retval) return (retval); /* FIXME: review to see if we need to use set_bit on these */ @@ -1024,7 +1014,7 @@ static int block_till_ready(struct tty_struct *tty, struct file *filp, return 0; } -static void setup_empty_event(struct tty_struct *tty) +static void moxa_setup_empty_event(struct tty_struct *tty) { struct moxa_port *ch = tty->driver_data; unsigned long flags; @@ -1035,24 +1025,24 @@ static void setup_empty_event(struct tty_struct *tty) spin_unlock_irqrestore(&moxa_lock, flags); } -static void check_xmit_empty(unsigned long data) +static void moxa_check_xmit_empty(unsigned long data) { struct moxa_port *ch; ch = (struct moxa_port *) data; - del_timer_sync(&moxa_ports[ch->port].emptyTimer); if (ch->tty && (ch->statusflags & EMPTYWAIT)) { if (MoxaPortTxQueue(ch->port) == 0) { ch->statusflags &= ~EMPTYWAIT; tty_wakeup(ch->tty); return; } - mod_timer(&moxa_ports[ch->port].emptyTimer, jiffies + HZ); + mod_timer(&moxa_ports[ch->port].emptyTimer, + round_jiffies(jiffies + HZ)); } else ch->statusflags &= ~EMPTYWAIT; } -static void shut_down(struct moxa_port *ch) +static void moxa_shut_down(struct moxa_port *ch) { struct tty_struct *tp; @@ -1072,7 +1062,7 @@ static void shut_down(struct moxa_port *ch) ch->asyncflags &= ~ASYNC_INITIALIZED; } -static void receive_data(struct moxa_port *ch) +static void moxa_receive_data(struct moxa_port *ch) { struct tty_struct *tp; struct ktermios *ts; @@ -1406,8 +1396,8 @@ static struct mon_str moxaLog; static int moxaFuncTout = HZ / 2; static void moxafunc(void __iomem *, int, ushort); -static void wait_finish(void __iomem *); -static void low_water_check(void __iomem *); +static void moxa_wait_finish(void __iomem *); +static void moxa_low_water_check(void __iomem *); static int moxaloadbios(int, unsigned char __user *, int); static int moxafindcard(int); static int moxaload320b(int, unsigned char __user *, int); @@ -1473,7 +1463,7 @@ void MoxaPortFlushData(int port, int mode) moxafunc(ofsAddr, FC_FlushQueue, mode); if (mode != 1) { moxa_ports[port].lowChkFlag = 0; - low_water_check(ofsAddr); + moxa_low_water_check(ofsAddr); } } @@ -1654,7 +1644,7 @@ int MoxaDriverPoll(void) if (moxa_ports[p].lowChkFlag) { moxa_ports[p].lowChkFlag = 0; ofsAddr = moxa_ports[p].tableAddr; - low_water_check(ofsAddr); + moxa_low_water_check(ofsAddr); } } } @@ -2081,7 +2071,7 @@ int MoxaPortSetTermio(int port, struct ktermios *termio, speed_t baud) writeb(termio->c_cc[VSTART], ofsAddr + FuncArg); writeb(termio->c_cc[VSTOP], ofsAddr + FuncArg1); writeb(FC_SetXonXoff, ofsAddr + FuncCode); - wait_finish(ofsAddr); + moxa_wait_finish(ofsAddr); } return (0); @@ -2480,10 +2470,10 @@ static void moxafunc(void __iomem *ofsAddr, int cmd, ushort arg) writew(arg, ofsAddr + FuncArg); writew(cmd, ofsAddr + FuncCode); - wait_finish(ofsAddr); + moxa_wait_finish(ofsAddr); } -static void wait_finish(void __iomem *ofsAddr) +static void moxa_wait_finish(void __iomem *ofsAddr) { unsigned long i, j; @@ -2496,7 +2486,7 @@ static void wait_finish(void __iomem *ofsAddr) } } -static void low_water_check(void __iomem *ofsAddr) +static void moxa_low_water_check(void __iomem *ofsAddr) { int len; ushort rptr, wptr, mask; diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index 2aee3fef041..661aca0e155 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c @@ -383,7 +383,6 @@ static int mxser_init(void); /* static void mxser_poll(unsigned long); */ static int mxser_get_ISA_conf(int, struct mxser_hwconf *); -static int mxser_get_PCI_conf(int, int, int, struct mxser_hwconf *); static void mxser_do_softint(struct work_struct *); static int mxser_open(struct tty_struct *, struct file *); static void mxser_close(struct tty_struct *, struct file *); @@ -422,7 +421,7 @@ static void mxser_wait_until_sent(struct tty_struct *tty, int timeout); static void mxser_startrx(struct tty_struct *tty); static void mxser_stoprx(struct tty_struct *tty); - +#ifdef CONFIG_PCI static int CheckIsMoxaMust(int io) { u8 oldmcr, hwid; @@ -445,6 +444,7 @@ static int CheckIsMoxaMust(int io) } return MOXA_OTHER_UART; } +#endif /* above is modified by Victor Yu. 08-15-2002 */ @@ -1938,14 +1938,6 @@ static irqreturn_t mxser_interrupt(int irq, void *dev_id) inb(info->base + UART_MSR); continue; } - /* above add by Victor Yu. 09-13-2002 */ - /* - if (info->tty->flip.count < TTY_FLIPBUF_SIZE / 4) { - info->IER |= MOXA_MUST_RECV_ISR; - outb(info->IER, info->base + UART_IER); - } - */ - /* mask by Victor Yu. 09-13-2002 if ( !info->tty || @@ -2599,19 +2591,8 @@ static int mxser_change_speed(struct mxser_struct *info, struct ktermios *old_te info->IER |= UART_IER_MSI; if ((info->type == PORT_16550A) || (info->IsMoxaMustChipFlag)) { info->MCR |= UART_MCR_AFE; - /* status = mxser_get_msr(info->base, 0, info->port); */ -/* - save_flags(flags); - cli(); - status = inb(baseaddr + UART_MSR); - restore_flags(flags); -*/ - /* mxser_check_modem_status(info, status); */ } else { - /* status = mxser_get_msr(info->base, 0, info->port); */ - /* MX_LOCK(&info->slock); */ status = inb(info->base + UART_MSR); - /* MX_UNLOCK(&info->slock); */ if (info->tty->hw_stopped) { if (status & UART_MSR_CTS) { info->tty->hw_stopped = 0; diff --git a/drivers/char/mxser_new.c b/drivers/char/mxser_new.c index 6a563932ba1..854dbf59eb6 100644 --- a/drivers/char/mxser_new.c +++ b/drivers/char/mxser_new.c @@ -2,7 +2,7 @@ * mxser.c -- MOXA Smartio/Industio family multiport serial driver. * * Copyright (C) 1999-2006 Moxa Technologies (support@moxa.com.tw). - * Copyright (C) 2006 Jiri Slaby <jirislaby@gmail.com> + * Copyright (C) 2006-2007 Jiri Slaby <jirislaby@gmail.com> * * This code is loosely based on the 1.8 moxa driver which is based on * Linux serial driver, written by Linus Torvalds, Theodore T'so and @@ -48,7 +48,7 @@ #include "mxser_new.h" -#define MXSER_VERSION "2.0.1" /* 1.9.15 */ +#define MXSER_VERSION "2.0.2" /* 1.10 */ #define MXSERMAJOR 174 #define MXSERCUMAJOR 175 @@ -72,6 +72,12 @@ #define UART_MCR_AFE 0x20 #define UART_LSR_SPECIAL 0x1E +#define PCI_DEVICE_ID_CB108 0x1080 +#define PCI_DEVICE_ID_CB114 0x1142 +#define PCI_DEVICE_ID_CB134I 0x1341 +#define PCI_DEVICE_ID_CP138U 0x1380 +#define PCI_DEVICE_ID_POS104UL 0x1044 + #define C168_ASIC_ID 1 #define C104_ASIC_ID 2 @@ -107,71 +113,63 @@ struct mxser_cardinfo { }; static const struct mxser_cardinfo mxser_cards[] = { - { 8, "C168 series", }, /* C168-ISA */ - { 4, "C104 series", }, /* C104-ISA */ - { 4, "CI-104J series", }, /* CI104J */ - { 8, "C168H/PCI series", }, /* C168-PCI */ - { 4, "C104H/PCI series", }, /* C104-PCI */ - { 4, "C102 series", MXSER_HAS2 }, /* C102-ISA */ - { 4, "CI-132 series", MXSER_HAS2 }, /* CI132 */ - { 4, "CI-134 series", }, /* CI134 */ - { 2, "CP-132 series", }, /* CP132 */ - { 4, "CP-114 series", }, /* CP114 */ - { 4, "CT-114 series", }, /* CT114 */ - { 2, "CP-102 series", MXSER_HIGHBAUD }, /* CP102 */ - { 4, "CP-104U series", }, /* CP104U */ - { 8, "CP-168U series", }, /* CP168U */ - { 2, "CP-132U series", }, /* CP132U */ - { 4, "CP-134U series", }, /* CP134U */ - { 4, "CP-104JU series", }, /* CP104JU */ +/* 0*/ { 8, "C168 series", }, + { 4, "C104 series", }, + { 4, "CI-104J series", }, + { 8, "C168H/PCI series", }, + { 4, "C104H/PCI series", }, +/* 5*/ { 4, "C102 series", MXSER_HAS2 }, /* C102-ISA */ + { 4, "CI-132 series", MXSER_HAS2 }, + { 4, "CI-134 series", }, + { 2, "CP-132 series", }, + { 4, "CP-114 series", }, +/*10*/ { 4, "CT-114 series", }, + { 2, "CP-102 series", MXSER_HIGHBAUD }, + { 4, "CP-104U series", }, + { 8, "CP-168U series", }, + { 2, "CP-132U series", }, +/*15*/ { 4, "CP-134U series", }, + { 4, "CP-104JU series", }, { 8, "Moxa UC7000 Serial", }, /* RC7000 */ - { 8, "CP-118U series", }, /* CP118U */ - { 2, "CP-102UL series", }, /* CP102UL */ - { 2, "CP-102U series", }, /* CP102U */ - { 8, "CP-118EL series", }, /* CP118EL */ - { 8, "CP-168EL series", }, /* CP168EL */ - { 4, "CP-104EL series", } /* CP104EL */ + { 8, "CP-118U series", }, + { 2, "CP-102UL series", }, +/*20*/ { 2, "CP-102U series", }, + { 8, "CP-118EL series", }, + { 8, "CP-168EL series", }, + { 4, "CP-104EL series", }, + { 8, "CB-108 series", }, +/*25*/ { 4, "CB-114 series", }, + { 4, "CB-134I series", }, + { 8, "CP-138U series", }, + { 4, "POS-104UL series", } }; /* driver_data correspond to the lines in the structure above see also ISA probe function before you change something */ static struct pci_device_id mxser_pcibrds[] = { - { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_C168), - .driver_data = 3 }, - { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_C104), - .driver_data = 4 }, - { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP132), - .driver_data = 8 }, - { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP114), - .driver_data = 9 }, - { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CT114), - .driver_data = 10 }, - { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP102), - .driver_data = 11 }, - { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP104U), - .driver_data = 12 }, - { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP168U), - .driver_data = 13 }, - { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP132U), - .driver_data = 14 }, - { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP134U), - .driver_data = 15 }, - { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP104JU), - .driver_data = 16 }, - { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_RC7000), - .driver_data = 17 }, - { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP118U), - .driver_data = 18 }, - { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP102UL), - .driver_data = 19 }, - { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP102U), - .driver_data = 20 }, - { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP118EL), - .driver_data = 21 }, - { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP168EL), - .driver_data = 22 }, - { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP104EL), - .driver_data = 23 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_C168), .driver_data = 3 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_C104), .driver_data = 4 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP132), .driver_data = 8 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP114), .driver_data = 9 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CT114), .driver_data = 10 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP102), .driver_data = 11 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP104U), .driver_data = 12 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP168U), .driver_data = 13 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP132U), .driver_data = 14 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP134U), .driver_data = 15 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP104JU),.driver_data = 16 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_RC7000), .driver_data = 17 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP118U), .driver_data = 18 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP102UL),.driver_data = 19 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP102U), .driver_data = 20 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP118EL),.driver_data = 21 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP168EL),.driver_data = 22 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP104EL),.driver_data = 23 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CB108), .driver_data = 24 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CB114), .driver_data = 25 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CB134I), .driver_data = 26 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CP138U), .driver_data = 27 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_POS104UL), .driver_data = 28 }, { } }; MODULE_DEVICE_TABLE(pci, mxser_pcibrds); diff --git a/drivers/char/pty.c b/drivers/char/pty.c index 73de77105fe..706ff34728f 100644 --- a/drivers/char/pty.c +++ b/drivers/char/pty.c @@ -318,7 +318,7 @@ int pty_limit = NR_UNIX98_PTY_DEFAULT; static int pty_limit_min = 0; static int pty_limit_max = NR_UNIX98_PTY_MAX; -ctl_table pty_table[] = { +static struct ctl_table pty_table[] = { { .ctl_name = PTY_MAX, .procname = "max", @@ -340,6 +340,27 @@ ctl_table pty_table[] = { } }; +static struct ctl_table pty_kern_table[] = { + { + .ctl_name = KERN_PTY, + .procname = "pty", + .mode = 0555, + .child = pty_table, + }, + {} +}; + +static struct ctl_table pty_root_table[] = { + { + .ctl_name = CTL_KERN, + .procname = "kernel", + .mode = 0555, + .child = pty_kern_table, + }, + {} +}; + + static int pty_unix98_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) { @@ -404,6 +425,7 @@ static void __init unix98_pty_init(void) panic("Couldn't register Unix98 pts driver"); pty_table[1].data = &ptm_driver->refcount; + register_sysctl_table(pty_root_table); } #else static inline void unix98_pty_init(void) { } diff --git a/drivers/char/random.c b/drivers/char/random.c index af274e5a25e..1756b1f7cb7 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -649,7 +649,7 @@ EXPORT_SYMBOL_GPL(add_input_randomness); void add_interrupt_randomness(int irq) { - if (irq >= NR_IRQS || irq_timer_state[irq] == 0) + if (irq >= NR_IRQS || irq_timer_state[irq] == NULL) return; DEBUG_ENT("irq event %d\n", irq); diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c index 56cbba7b6ec..7e6a3a413bb 100644 --- a/drivers/char/rocket.c +++ b/drivers/char/rocket.c @@ -84,6 +84,7 @@ #include <linux/mutex.h> #include <linux/ioport.h> #include <linux/delay.h> +#include <linux/completion.h> #include <linux/wait.h> #include <linux/pci.h> #include <asm/uaccess.h> @@ -548,8 +549,8 @@ static void rp_handle_port(struct r_port *info) static void rp_do_poll(unsigned long dummy) { CONTROLLER_t *ctlp; - int ctrl, aiop, ch, line, i; - unsigned int xmitmask; + int ctrl, aiop, ch, line; + unsigned int xmitmask, i; unsigned int CtlMask; unsigned char AiopMask; Word_t bit; @@ -650,7 +651,7 @@ static void init_r_port(int board, int aiop, int chan, struct pci_dev *pci_dev) info->closing_wait = 3000; info->close_delay = 50; init_waitqueue_head(&info->open_wait); - init_waitqueue_head(&info->close_wait); + init_completion(&info->close_wait); info->flags &= ~ROCKET_MODE_MASK; switch (pc104[board][line]) { case 422: @@ -699,8 +700,8 @@ static void init_r_port(int board, int aiop, int chan, struct pci_dev *pci_dev) spin_lock_init(&info->slock); mutex_init(&info->write_mtx); rp_table[line] = info; - if (pci_dev) - tty_register_device(rocket_driver, line, &pci_dev->dev); + tty_register_device(rocket_driver, line, pci_dev ? &pci_dev->dev : + NULL); } /* @@ -878,7 +879,8 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, if (tty_hung_up_p(filp)) return ((info->flags & ROCKET_HUP_NOTIFY) ? -EAGAIN : -ERESTARTSYS); if (info->flags & ROCKET_CLOSING) { - interruptible_sleep_on(&info->close_wait); + if (wait_for_completion_interruptible(&info->close_wait)) + return -ERESTARTSYS; return ((info->flags & ROCKET_HUP_NOTIFY) ? -EAGAIN : -ERESTARTSYS); } @@ -983,8 +985,10 @@ static int rp_open(struct tty_struct *tty, struct file *filp) return -ENOMEM; if (info->flags & ROCKET_CLOSING) { - interruptible_sleep_on(&info->close_wait); + retval = wait_for_completion_interruptible(&info->close_wait); free_page(page); + if (retval) + return retval; return ((info->flags & ROCKET_HUP_NOTIFY) ? -EAGAIN : -ERESTARTSYS); } @@ -1176,7 +1180,7 @@ static void rp_close(struct tty_struct *tty, struct file *filp) } info->flags &= ~(ROCKET_INITIALIZED | ROCKET_CLOSING | ROCKET_NORMAL_ACTIVE); tty->closing = 0; - wake_up_interruptible(&info->close_wait); + complete_all(&info->close_wait); atomic_dec(&rp_num_ports_open); #ifdef ROCKET_DEBUG_OPEN @@ -1869,8 +1873,6 @@ static __init int register_PCI(int i, struct pci_dev *dev) int fast_clock = 0; int altChanRingIndicator = 0; int ports_per_aiop = 8; - int ret; - unsigned int class_rev; WordIO_t ConfigIO = 0; ByteIO_t UPCIRingInd = 0; @@ -1878,12 +1880,6 @@ static __init int register_PCI(int i, struct pci_dev *dev) return 0; rcktpt_io_addr[i] = pci_resource_start(dev, 0); - ret = pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev); - - if (ret) { - printk(KERN_INFO " Error during register_PCI(), unable to read config dword \n"); - return 0; - } rcktpt_type[i] = ROCKET_TYPE_NORMAL; rocketModel[i].loadrm2 = 0; @@ -2037,8 +2033,9 @@ static __init int register_PCI(int i, struct pci_dev *dev) ports_per_aiop = 6; str = "6-port"; - /* If class_rev is 1, the rocketmodem flash must be loaded. If it is 2 it is a "socketed" version. */ - if ((class_rev & 0xFF) == 1) { + /* If revision is 1, the rocketmodem flash must be loaded. + * If it is 2 it is a "socketed" version. */ + if (dev->revision == 1) { rcktpt_type[i] = ROCKET_TYPE_MODEMII; rocketModel[i].loadrm2 = 1; } else { @@ -2053,7 +2050,7 @@ static __init int register_PCI(int i, struct pci_dev *dev) max_num_aiops = 1; ports_per_aiop = 4; str = "4-port"; - if ((class_rev & 0xFF) == 1) { + if (dev->revision == 1) { rcktpt_type[i] = ROCKET_TYPE_MODEMII; rocketModel[i].loadrm2 = 1; } else { @@ -2362,26 +2359,14 @@ static const struct tty_operations rocket_ops = { */ static int __init rp_init(void) { - int retval, pci_boards_found, isa_boards_found, i; + int ret = -ENOMEM, pci_boards_found, isa_boards_found, i; printk(KERN_INFO "RocketPort device driver module, version %s, %s\n", ROCKET_VERSION, ROCKET_DATE); rocket_driver = alloc_tty_driver(MAX_RP_PORTS); if (!rocket_driver) - return -ENOMEM; - - /* - * Initialize the array of pointers to our own internal state - * structures. - */ - memset(rp_table, 0, sizeof (rp_table)); - memset(xmit_flags, 0, sizeof (xmit_flags)); - - for (i = 0; i < MAX_RP_PORTS; i++) - lineNumbers[i] = 0; - nextLineNumber = 0; - memset(rocketModel, 0, sizeof (rocketModel)); + goto err; /* * If board 1 is non-zero, there is at least one ISA configured. If controller is @@ -2396,8 +2381,11 @@ static int __init rp_init(void) /* If an ISA card is configured, reserve the 4 byte IO space for the Mudbac controller */ if (controller && (!request_region(controller, 4, "Comtrol RocketPort"))) { - printk(KERN_INFO "Unable to reserve IO region for first configured ISA RocketPort controller 0x%lx. Driver exiting \n", controller); - return -EBUSY; + printk(KERN_ERR "Unable to reserve IO region for first " + "configured ISA RocketPort controller 0x%lx. " + "Driver exiting\n", controller); + ret = -EBUSY; + goto err_tty; } /* Store ISA variable retrieved from command line or .conf file. */ @@ -2434,15 +2422,14 @@ static int __init rp_init(void) rocket_driver->init_termios.c_ispeed = 9600; rocket_driver->init_termios.c_ospeed = 9600; #ifdef ROCKET_SOFT_FLOW - rocket_driver->flags |= TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; + rocket_driver->flags |= TTY_DRIVER_REAL_RAW; #endif tty_set_operations(rocket_driver, &rocket_ops); - retval = tty_register_driver(rocket_driver); - if (retval < 0) { - printk(KERN_INFO "Couldn't install tty RocketPort driver (error %d)\n", -retval); - put_tty_driver(rocket_driver); - return -1; + ret = tty_register_driver(rocket_driver); + if (ret < 0) { + printk(KERN_ERR "Couldn't install tty RocketPort driver\n"); + goto err_tty; } #ifdef ROCKET_DEBUG_OPEN @@ -2469,14 +2456,18 @@ static int __init rp_init(void) max_board = pci_boards_found + isa_boards_found; if (max_board == 0) { - printk(KERN_INFO "No rocketport ports found; unloading driver.\n"); - del_timer_sync(&rocket_timer); - tty_unregister_driver(rocket_driver); - put_tty_driver(rocket_driver); - return -ENXIO; + printk(KERN_ERR "No rocketport ports found; unloading driver\n"); + ret = -ENXIO; + goto err_ttyu; } return 0; +err_ttyu: + tty_unregister_driver(rocket_driver); +err_tty: + put_tty_driver(rocket_driver); +err: + return ret; } @@ -2491,10 +2482,14 @@ static void rp_cleanup_module(void) if (retval) printk(KERN_INFO "Error %d while trying to unregister " "rocketport driver\n", -retval); - put_tty_driver(rocket_driver); for (i = 0; i < MAX_RP_PORTS; i++) - kfree(rp_table[i]); + if (rp_table[i]) { + tty_unregister_device(rocket_driver, i); + kfree(rp_table[i]); + } + + put_tty_driver(rocket_driver); for (i = 0; i < NUM_BOARDS; i++) { if (rcktpt_io_addr[i] <= 0 || is_PCI[i]) diff --git a/drivers/char/rocket_int.h b/drivers/char/rocket_int.h index b4c53dfa795..55b8f2d71a9 100644 --- a/drivers/char/rocket_int.h +++ b/drivers/char/rocket_int.h @@ -1163,13 +1163,8 @@ struct r_port { int read_status_mask; int cps; -#ifdef DECLARE_WAITQUEUE wait_queue_head_t open_wait; - wait_queue_head_t close_wait; -#else - struct wait_queue *open_wait; - struct wait_queue *close_wait; -#endif + struct completion close_wait; spinlock_t slock; struct mutex write_mtx; }; diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c index 745d552620b..0def089cc1f 100644 --- a/drivers/char/tty_ioctl.c +++ b/drivers/char/tty_ioctl.c @@ -228,7 +228,8 @@ EXPORT_SYMBOL(tty_termios_input_baud_rate); * and will all go away once this is done. */ -void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed_t obaud) +void tty_termios_encode_baud_rate(struct ktermios *termios, + speed_t ibaud, speed_t obaud) { int i = 0; int ifound = -1, ofound = -1; @@ -263,11 +264,15 @@ void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed */ do { - if (obaud - oclose >= baud_table[i] && obaud + oclose <= baud_table[i]) { + if (obaud - oclose <= baud_table[i] && + obaud + oclose >= baud_table[i]) { termios->c_cflag |= baud_bits[i]; ofound = i; } - if (ibaud - iclose >= baud_table[i] && ibaud + iclose <= baud_table[i]) { + if (ibaud - iclose <= baud_table[i] && + ibaud + iclose >= baud_table[i]) { + /* For the case input == output don't set IBAUD bits + if the user didn't do so */ if (ofound == i && !ibinput) ifound = i; #ifdef IBSHIFT diff --git a/drivers/char/vt.c b/drivers/char/vt.c index 645ad980898..1764c67b585 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c @@ -158,11 +158,7 @@ static void blank_screen_t(unsigned long dummy); static void set_palette(struct vc_data *vc); static int printable; /* Is console ready for printing? */ -#ifdef CONFIG_VT_UNICODE -int default_utf8 = 1; -#else -int default_utf8; -#endif +int default_utf8 = true; module_param(default_utf8, int, S_IRUGO | S_IWUSR); /* diff --git a/drivers/dma/ioat.c b/drivers/dma/ioat.c index f7276bf2fe7..f204c39fb41 100644 --- a/drivers/dma/ioat.c +++ b/drivers/dma/ioat.c @@ -34,7 +34,7 @@ #include "ioatdma_registers.h" #include "ioatdma_hw.h" -MODULE_VERSION("1.24"); +MODULE_VERSION(IOAT_DMA_VERSION); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Intel Corporation"); @@ -55,9 +55,7 @@ struct ioat_device { static int __devinit ioat_probe(struct pci_dev *pdev, const struct pci_device_id *id); -#ifdef IOAT_DMA_REMOVE static void __devexit ioat_remove(struct pci_dev *pdev); -#endif static int ioat_dca_enabled = 1; module_param(ioat_dca_enabled, int, 0644); @@ -73,7 +71,7 @@ static int ioat_setup_functionality(struct pci_dev *pdev, void __iomem *iobase) switch (version) { case IOAT_VER_1_2: device->dma = ioat_dma_probe(pdev, iobase); - if (ioat_dca_enabled) + if (device->dma && ioat_dca_enabled) device->dca = ioat_dca_init(pdev, iobase); break; default: @@ -87,27 +85,25 @@ static void ioat_shutdown_functionality(struct pci_dev *pdev) { struct ioat_device *device = pci_get_drvdata(pdev); - if (device->dma) { - ioat_dma_remove(device->dma); - device->dma = NULL; - } - + dev_err(&pdev->dev, "Removing dma and dca services\n"); if (device->dca) { unregister_dca_provider(device->dca); free_dca_provider(device->dca); device->dca = NULL; } + if (device->dma) { + ioat_dma_remove(device->dma); + device->dma = NULL; + } } -static struct pci_driver ioat_pci_drv = { +static struct pci_driver ioat_pci_driver = { .name = "ioatdma", .id_table = ioat_pci_tbl, .probe = ioat_probe, .shutdown = ioat_shutdown_functionality, -#ifdef IOAT_DMA_REMOVE .remove = __devexit_p(ioat_remove), -#endif }; static int __devinit ioat_probe(struct pci_dev *pdev, @@ -122,7 +118,7 @@ static int __devinit ioat_probe(struct pci_dev *pdev, if (err) goto err_enable_device; - err = pci_request_regions(pdev, ioat_pci_drv.name); + err = pci_request_regions(pdev, ioat_pci_driver.name); if (err) goto err_request_regions; @@ -176,13 +172,11 @@ err_enable_device: return err; } -#ifdef IOAT_DMA_REMOVE /* * It is unsafe to remove this module: if removed while a requested * dma is outstanding, esp. from tcp, it is possible to hang while - * waiting for something that will never finish, thus hanging at - * least one cpu. However, if you're feeling lucky and need to do - * some testing, this usually works just fine. + * waiting for something that will never finish. However, if you're + * feeling lucky, this usually works just fine. */ static void __devexit ioat_remove(struct pci_dev *pdev) { @@ -191,21 +185,16 @@ static void __devexit ioat_remove(struct pci_dev *pdev) ioat_shutdown_functionality(pdev); kfree(device); - - iounmap(device->iobase); - pci_release_regions(pdev); - pci_disable_device(pdev); } -#endif static int __init ioat_init_module(void) { - return pci_register_driver(&ioat_pci_drv); + return pci_register_driver(&ioat_pci_driver); } module_init(ioat_init_module); static void __exit ioat_exit_module(void) { - pci_unregister_driver(&ioat_pci_drv); + pci_unregister_driver(&ioat_pci_driver); } module_exit(ioat_exit_module); diff --git a/drivers/dma/ioat_dca.c b/drivers/dma/ioat_dca.c index 2ae04c30ede..ba985715b80 100644 --- a/drivers/dma/ioat_dca.c +++ b/drivers/dma/ioat_dca.c @@ -65,7 +65,7 @@ static inline u16 dcaid_from_pcidev(struct pci_dev *pci) return (pci->bus->number << 8) | pci->devfn; } -static int dca_enabled_in_bios(void) +static int dca_enabled_in_bios(struct pci_dev *pdev) { /* CPUID level 9 returns DCA configuration */ /* Bit 0 indicates DCA enabled by the BIOS */ @@ -75,17 +75,17 @@ static int dca_enabled_in_bios(void) cpuid_level_9 = cpuid_eax(9); res = test_bit(0, &cpuid_level_9); if (!res) - printk(KERN_ERR "ioat dma: DCA is disabled in BIOS\n"); + dev_err(&pdev->dev, "DCA is disabled in BIOS\n"); return res; } -static int system_has_dca_enabled(void) +static int system_has_dca_enabled(struct pci_dev *pdev) { if (boot_cpu_has(X86_FEATURE_DCA)) - return dca_enabled_in_bios(); + return dca_enabled_in_bios(pdev); - printk(KERN_ERR "ioat dma: boot cpu doesn't have X86_FEATURE_DCA\n"); + dev_err(&pdev->dev, "boot cpu doesn't have X86_FEATURE_DCA\n"); return 0; } @@ -208,7 +208,7 @@ struct dca_provider *ioat_dca_init(struct pci_dev *pdev, void __iomem *iobase) int i; int err; - if (!system_has_dca_enabled()) + if (!system_has_dca_enabled(pdev)) return NULL; /* I/OAT v1 systems must have a known tag_map to support DCA */ diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c index 66c5bb53211..7e4a785c2df 100644 --- a/drivers/dma/ioat_dma.c +++ b/drivers/dma/ioat_dma.c @@ -46,9 +46,12 @@ /* internal functions */ static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan); static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan); +static struct ioat_desc_sw * +ioat_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan); -static struct ioat_dma_chan *ioat_lookup_chan_by_index(struct ioatdma_device *device, - int index) +static inline struct ioat_dma_chan *ioat_lookup_chan_by_index( + struct ioatdma_device *device, + int index) { return device->idx[index]; } @@ -148,57 +151,102 @@ static void ioat_set_src(dma_addr_t addr, struct dma_async_tx_descriptor *tx, int index) { - struct ioat_desc_sw *iter, *desc = tx_to_ioat_desc(tx); - struct ioat_dma_chan *ioat_chan = to_ioat_chan(tx->chan); - - pci_unmap_addr_set(desc, src, addr); - - list_for_each_entry(iter, &desc->async_tx.tx_list, node) { - iter->hw->src_addr = addr; - addr += ioat_chan->xfercap; - } - + tx_to_ioat_desc(tx)->src = addr; } static void ioat_set_dest(dma_addr_t addr, struct dma_async_tx_descriptor *tx, int index) { - struct ioat_desc_sw *iter, *desc = tx_to_ioat_desc(tx); - struct ioat_dma_chan *ioat_chan = to_ioat_chan(tx->chan); - - pci_unmap_addr_set(desc, dst, addr); - - list_for_each_entry(iter, &desc->async_tx.tx_list, node) { - iter->hw->dst_addr = addr; - addr += ioat_chan->xfercap; - } + tx_to_ioat_desc(tx)->dst = addr; } static dma_cookie_t ioat_tx_submit(struct dma_async_tx_descriptor *tx) { struct ioat_dma_chan *ioat_chan = to_ioat_chan(tx->chan); - struct ioat_desc_sw *desc = tx_to_ioat_desc(tx); + struct ioat_desc_sw *first = tx_to_ioat_desc(tx); + struct ioat_desc_sw *prev, *new; + struct ioat_dma_descriptor *hw; int append = 0; dma_cookie_t cookie; - struct ioat_desc_sw *group_start; + LIST_HEAD(new_chain); + u32 copy; + size_t len; + dma_addr_t src, dst; + int orig_ack; + unsigned int desc_count = 0; + + /* src and dest and len are stored in the initial descriptor */ + len = first->len; + src = first->src; + dst = first->dst; + orig_ack = first->async_tx.ack; + new = first; - group_start = list_entry(desc->async_tx.tx_list.next, - struct ioat_desc_sw, node); spin_lock_bh(&ioat_chan->desc_lock); + prev = to_ioat_desc(ioat_chan->used_desc.prev); + prefetch(prev->hw); + do { + copy = min((u32) len, ioat_chan->xfercap); + + new->async_tx.ack = 1; + + hw = new->hw; + hw->size = copy; + hw->ctl = 0; + hw->src_addr = src; + hw->dst_addr = dst; + hw->next = 0; + + /* chain together the physical address list for the HW */ + wmb(); + prev->hw->next = (u64) new->async_tx.phys; + + len -= copy; + dst += copy; + src += copy; + + list_add_tail(&new->node, &new_chain); + desc_count++; + prev = new; + } while (len && (new = ioat_dma_get_next_descriptor(ioat_chan))); + + hw->ctl = IOAT_DMA_DESCRIPTOR_CTL_CP_STS; + if (new->async_tx.callback) { + hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_INT_GN; + if (first != new) { + /* move callback into to last desc */ + new->async_tx.callback = first->async_tx.callback; + new->async_tx.callback_param + = first->async_tx.callback_param; + first->async_tx.callback = NULL; + first->async_tx.callback_param = NULL; + } + } + + new->tx_cnt = desc_count; + new->async_tx.ack = orig_ack; /* client is in control of this ack */ + + /* store the original values for use in later cleanup */ + if (new != first) { + new->src = first->src; + new->dst = first->dst; + new->len = first->len; + } + /* cookie incr and addition to used_list must be atomic */ cookie = ioat_chan->common.cookie; cookie++; if (cookie < 0) cookie = 1; - ioat_chan->common.cookie = desc->async_tx.cookie = cookie; + ioat_chan->common.cookie = new->async_tx.cookie = cookie; /* write address into NextDescriptor field of last desc in chain */ to_ioat_desc(ioat_chan->used_desc.prev)->hw->next = - group_start->async_tx.phys; - list_splice_init(&desc->async_tx.tx_list, ioat_chan->used_desc.prev); + first->async_tx.phys; + __list_splice(&new_chain, ioat_chan->used_desc.prev); - ioat_chan->pending += desc->tx_cnt; + ioat_chan->pending += desc_count; if (ioat_chan->pending >= 4) { append = 1; ioat_chan->pending = 0; @@ -267,7 +315,7 @@ static int ioat_dma_alloc_chan_resources(struct dma_chan *chan) chanerr = readl(ioat_chan->reg_base + IOAT_CHANERR_OFFSET); if (chanerr) { dev_err(&ioat_chan->device->pdev->dev, - "ioatdma: CHANERR = %x, clearing\n", chanerr); + "CHANERR = %x, clearing\n", chanerr); writel(chanerr, ioat_chan->reg_base + IOAT_CHANERR_OFFSET); } @@ -276,7 +324,7 @@ static int ioat_dma_alloc_chan_resources(struct dma_chan *chan) desc = ioat_dma_alloc_descriptor(ioat_chan, GFP_KERNEL); if (!desc) { dev_err(&ioat_chan->device->pdev->dev, - "ioatdma: Only %d initial descriptors\n", i); + "Only %d initial descriptors\n", i); break; } list_add_tail(&desc->node, &tmp_list); @@ -342,12 +390,13 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan) /* one is ok since we left it on there on purpose */ if (in_use_descs > 1) dev_err(&ioat_chan->device->pdev->dev, - "ioatdma: Freeing %d in use descriptors!\n", + "Freeing %d in use descriptors!\n", in_use_descs - 1); ioat_chan->last_completion = ioat_chan->completion_addr = 0; ioat_chan->pending = 0; } + /** * ioat_dma_get_next_descriptor - return the next available descriptor * @ioat_chan: IOAT DMA channel handle @@ -356,8 +405,8 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan) * channel's desc_lock held. Allocates more descriptors if the channel * has run out. */ -static struct ioat_desc_sw *ioat_dma_get_next_descriptor( - struct ioat_dma_chan *ioat_chan) +static struct ioat_desc_sw * +ioat_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan) { struct ioat_desc_sw *new = NULL; @@ -382,51 +431,11 @@ static struct dma_async_tx_descriptor *ioat_dma_prep_memcpy( int int_en) { struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan); - struct ioat_desc_sw *first, *prev, *new; - LIST_HEAD(new_chain); - u32 copy; - size_t orig_len; - int desc_count = 0; - - if (!len) - return NULL; - - orig_len = len; - - first = NULL; - prev = NULL; + struct ioat_desc_sw *new; spin_lock_bh(&ioat_chan->desc_lock); - while (len) { - new = ioat_dma_get_next_descriptor(ioat_chan); - copy = min((u32) len, ioat_chan->xfercap); - - new->hw->size = copy; - new->hw->ctl = 0; - new->async_tx.cookie = 0; - new->async_tx.ack = 1; - - /* chain together the physical address list for the HW */ - if (!first) - first = new; - else - prev->hw->next = (u64) new->async_tx.phys; - - prev = new; - len -= copy; - list_add_tail(&new->node, &new_chain); - desc_count++; - } - - list_splice(&new_chain, &new->async_tx.tx_list); - - new->hw->ctl = IOAT_DMA_DESCRIPTOR_CTL_CP_STS; - new->hw->next = 0; - new->tx_cnt = desc_count; - new->async_tx.ack = 0; /* client is in control of this ack */ - new->async_tx.cookie = -EBUSY; - - pci_unmap_len_set(new, len, orig_len); + new = ioat_dma_get_next_descriptor(ioat_chan); + new->len = len; spin_unlock_bh(&ioat_chan->desc_lock); return new ? &new->async_tx : NULL; @@ -464,7 +473,7 @@ static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan) prefetch(ioat_chan->completion_virt); - if (!spin_trylock(&ioat_chan->cleanup_lock)) + if (!spin_trylock_bh(&ioat_chan->cleanup_lock)) return; /* The completion writeback can happen at any time, @@ -474,22 +483,25 @@ static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan) #if (BITS_PER_LONG == 64) phys_complete = - ioat_chan->completion_virt->full & IOAT_CHANSTS_COMPLETED_DESCRIPTOR_ADDR; + ioat_chan->completion_virt->full + & IOAT_CHANSTS_COMPLETED_DESCRIPTOR_ADDR; #else - phys_complete = ioat_chan->completion_virt->low & IOAT_LOW_COMPLETION_MASK; + phys_complete = + ioat_chan->completion_virt->low & IOAT_LOW_COMPLETION_MASK; #endif - if ((ioat_chan->completion_virt->full & IOAT_CHANSTS_DMA_TRANSFER_STATUS) == + if ((ioat_chan->completion_virt->full + & IOAT_CHANSTS_DMA_TRANSFER_STATUS) == IOAT_CHANSTS_DMA_TRANSFER_STATUS_HALTED) { dev_err(&ioat_chan->device->pdev->dev, - "ioatdma: Channel halted, chanerr = %x\n", + "Channel halted, chanerr = %x\n", readl(ioat_chan->reg_base + IOAT_CHANERR_OFFSET)); /* TODO do something to salvage the situation */ } if (phys_complete == ioat_chan->last_completion) { - spin_unlock(&ioat_chan->cleanup_lock); + spin_unlock_bh(&ioat_chan->cleanup_lock); return; } @@ -517,6 +529,11 @@ static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan) pci_unmap_addr(desc, src), pci_unmap_len(desc, len), PCI_DMA_TODEVICE); + if (desc->async_tx.callback) { + desc->async_tx.callback( + desc->async_tx.callback_param); + desc->async_tx.callback = NULL; + } } if (desc->async_tx.phys != phys_complete) { @@ -548,7 +565,7 @@ static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan) if (cookie != 0) ioat_chan->completed_cookie = cookie; - spin_unlock(&ioat_chan->cleanup_lock); + spin_unlock_bh(&ioat_chan->cleanup_lock); } static void ioat_dma_dependency_added(struct dma_chan *chan) @@ -613,8 +630,13 @@ static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan) spin_lock_bh(&ioat_chan->desc_lock); desc = ioat_dma_get_next_descriptor(ioat_chan); - desc->hw->ctl = IOAT_DMA_DESCRIPTOR_NUL; + desc->hw->ctl = IOAT_DMA_DESCRIPTOR_NUL + | IOAT_DMA_DESCRIPTOR_CTL_INT_GN + | IOAT_DMA_DESCRIPTOR_CTL_CP_STS; desc->hw->next = 0; + desc->hw->size = 0; + desc->hw->src_addr = 0; + desc->hw->dst_addr = 0; desc->async_tx.ack = 1; list_add_tail(&desc->node, &ioat_chan->used_desc); @@ -633,6 +655,12 @@ static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan) */ #define IOAT_TEST_SIZE 2000 +static void ioat_dma_test_callback(void *dma_async_param) +{ + printk(KERN_ERR "ioatdma: ioat_dma_test_callback(%p)\n", + dma_async_param); +} + /** * ioat_dma_self_test - Perform a IOAT transaction to verify the HW works. * @device: device to be tested @@ -643,7 +671,7 @@ static int ioat_dma_self_test(struct ioatdma_device *device) u8 *src; u8 *dest; struct dma_chan *dma_chan; - struct dma_async_tx_descriptor *tx; + struct dma_async_tx_descriptor *tx = NULL; dma_addr_t addr; dma_cookie_t cookie; int err = 0; @@ -673,6 +701,13 @@ static int ioat_dma_self_test(struct ioatdma_device *device) } tx = ioat_dma_prep_memcpy(dma_chan, IOAT_TEST_SIZE, 0); + if (!tx) { + dev_err(&device->pdev->dev, + "Self-test prep failed, disabling\n"); + err = -ENODEV; + goto free_resources; + } + async_tx_ack(tx); addr = dma_map_single(dma_chan->device->dev, src, IOAT_TEST_SIZE, DMA_TO_DEVICE); @@ -680,19 +715,27 @@ static int ioat_dma_self_test(struct ioatdma_device *device) addr = dma_map_single(dma_chan->device->dev, dest, IOAT_TEST_SIZE, DMA_FROM_DEVICE); ioat_set_dest(addr, tx, 0); + tx->callback = ioat_dma_test_callback; + tx->callback_param = (void *)0x8086; cookie = ioat_tx_submit(tx); + if (cookie < 0) { + dev_err(&device->pdev->dev, + "Self-test setup failed, disabling\n"); + err = -ENODEV; + goto free_resources; + } ioat_dma_memcpy_issue_pending(dma_chan); msleep(1); if (ioat_dma_is_complete(dma_chan, cookie, NULL, NULL) != DMA_SUCCESS) { dev_err(&device->pdev->dev, - "ioatdma: Self-test copy timed out, disabling\n"); + "Self-test copy timed out, disabling\n"); err = -ENODEV; goto free_resources; } if (memcmp(src, dest, IOAT_TEST_SIZE)) { dev_err(&device->pdev->dev, - "ioatdma: Self-test copy failed compare, disabling\n"); + "Self-test copy failed compare, disabling\n"); err = -ENODEV; goto free_resources; } @@ -730,6 +773,9 @@ static int ioat_dma_setup_interrupts(struct ioatdma_device *device) goto msi; if (!strcmp(ioat_interrupt_style, "intx")) goto intx; + dev_err(&device->pdev->dev, "invalid ioat_interrupt_style %s\n", + ioat_interrupt_style); + goto err_no_irq; msix: /* The number of MSI-X vectors should equal the number of channels */ @@ -906,9 +952,9 @@ struct ioatdma_device *ioat_dma_probe(struct pci_dev *pdev, device->common.device_dependency_added = ioat_dma_dependency_added; device->common.dev = &pdev->dev; dev_err(&device->pdev->dev, - "ioatdma: Intel(R) I/OAT DMA Engine found," - " %d channels, device version 0x%02x\n", - device->common.chancnt, device->version); + "Intel(R) I/OAT DMA Engine found," + " %d channels, device version 0x%02x, driver version %s\n", + device->common.chancnt, device->version, IOAT_DMA_VERSION); err = ioat_dma_setup_interrupts(device); if (err) @@ -931,9 +977,8 @@ err_completion_pool: err_dma_pool: kfree(device); err_kzalloc: - iounmap(iobase); dev_err(&device->pdev->dev, - "ioatdma: Intel(R) I/OAT DMA Engine initialization failed\n"); + "Intel(R) I/OAT DMA Engine initialization failed\n"); return NULL; } @@ -942,13 +987,17 @@ void ioat_dma_remove(struct ioatdma_device *device) struct dma_chan *chan, *_chan; struct ioat_dma_chan *ioat_chan; - dma_async_device_unregister(&device->common); - ioat_dma_remove_interrupts(device); + dma_async_device_unregister(&device->common); + pci_pool_destroy(device->dma_pool); pci_pool_destroy(device->completion_pool); + iounmap(device->reg_base); + pci_release_regions(device->pdev); + pci_disable_device(device->pdev); + list_for_each_entry_safe(chan, _chan, &device->common.channels, device_node) { ioat_chan = to_ioat_chan(chan); diff --git a/drivers/dma/ioatdma.h b/drivers/dma/ioatdma.h index 2a319e124ec..5f9881e7b0e 100644 --- a/drivers/dma/ioatdma.h +++ b/drivers/dma/ioatdma.h @@ -28,6 +28,8 @@ #include <linux/cache.h> #include <linux/pci_ids.h> +#define IOAT_DMA_VERSION "1.26" + enum ioat_interrupt { none = 0, msix_multi_vector = 1, @@ -122,9 +124,9 @@ struct ioat_desc_sw { struct ioat_dma_descriptor *hw; struct list_head node; int tx_cnt; - DECLARE_PCI_UNMAP_LEN(len) - DECLARE_PCI_UNMAP_ADDR(src) - DECLARE_PCI_UNMAP_ADDR(dst) + size_t len; + dma_addr_t src; + dma_addr_t dst; struct dma_async_tx_descriptor async_tx; }; diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c index aa875ca50d9..3e63c148677 100644 --- a/drivers/hwmon/adm1026.c +++ b/drivers/hwmon/adm1026.c @@ -1651,7 +1651,7 @@ static int adm1026_detect(struct i2c_adapter *adapter, int address, break; default : dev_err(&adapter->dev, ": Internal error, invalid " - "kind (%d)!", kind); + "kind (%d)!\n", kind); err = -EFAULT; goto exitfree; } diff --git a/drivers/hwmon/lm63.c b/drivers/hwmon/lm63.c index f207434730d..650b07d5b90 100644 --- a/drivers/hwmon/lm63.c +++ b/drivers/hwmon/lm63.c @@ -533,7 +533,7 @@ static void lm63_init_client(struct i2c_client *client) /* Start converting if needed */ if (data->config & 0x40) { /* standby */ - dev_dbg(&client->dev, "Switching to operational mode"); + dev_dbg(&client->dev, "Switching to operational mode\n"); data->config &= 0xA7; i2c_smbus_write_byte_data(client, LM63_REG_CONFIG1, data->config); diff --git a/drivers/hwmon/vt1211.c b/drivers/hwmon/vt1211.c index e69416465e6..7dfcc8dd316 100644 --- a/drivers/hwmon/vt1211.c +++ b/drivers/hwmon/vt1211.c @@ -795,7 +795,7 @@ static ssize_t set_pwm_auto_point_pwm(struct device *dev, if ((val < 0) || (val > 255)) { dev_err(dev, "pwm value %ld is out of range. " - "Choose a value between 0 and 255." , val); + "Choose a value between 0 and 255.\n" , val); return -EINVAL; } diff --git a/drivers/hwmon/w83791d.c b/drivers/hwmon/w83791d.c index b6f2ebf9f9c..a9c01a6f005 100644 --- a/drivers/hwmon/w83791d.c +++ b/drivers/hwmon/w83791d.c @@ -1096,7 +1096,7 @@ static int w83791d_detect(struct i2c_adapter *adapter, int address, int kind) if (kind == w83791d) { client_name = "w83791d"; } else { - dev_err(dev, "w83791d: Internal error: unknown kind (%d)?!?", + dev_err(dev, "w83791d: Internal error: unknown kind (%d)?!?\n", kind); goto error1; } diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c index f836198b705..007449d3e16 100644 --- a/drivers/hwmon/w83792d.c +++ b/drivers/hwmon/w83792d.c @@ -1385,8 +1385,8 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind) if (kind == w83792d) { client_name = "w83792d"; } else { - dev_err(dev, "w83792d: Internal error: unknown" - " kind (%d)?!?", kind); + dev_err(dev, "w83792d: Internal error: unknown kind (%d)?!?\n", + kind); goto ERROR1; } diff --git a/drivers/i2c/busses/i2c-pmcmsp.c b/drivers/i2c/busses/i2c-pmcmsp.c index 17cecf1ea79..be99c02ecac 100644 --- a/drivers/i2c/busses/i2c-pmcmsp.c +++ b/drivers/i2c/busses/i2c-pmcmsp.c @@ -591,18 +591,18 @@ static int pmcmsptwi_master_xfer(struct i2c_adapter *adap, if (msg->flags & I2C_M_TEN) pmcmsptwi_set_twi_config(&oldcfg, data); - dev_dbg(&adap->dev, "I2C %s of %d bytes ", - (msg->flags & I2C_M_RD) ? "read" : "write", msg->len); + dev_dbg(&adap->dev, "I2C %s of %d bytes %s\n", + (msg->flags & I2C_M_RD) ? "read" : "write", msg->len, + (ret == MSP_TWI_XFER_OK) ? "succeeded" : "failed"); + if (ret != MSP_TWI_XFER_OK) { /* * TODO: We could potentially loop and retry in the case * of MSP_TWI_XFER_TIMEOUT. */ - dev_dbg(&adap->dev, "failed\n"); return -1; } - dev_dbg(&adap->dev, "succeeded\n"); return 0; } diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c index 17376feb1ac..f8d0dff0de7 100644 --- a/drivers/i2c/busses/i2c-pnx.c +++ b/drivers/i2c/busses/i2c-pnx.c @@ -575,7 +575,7 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev) else { freq_mhz = PNX_DEFAULT_FREQ; dev_info(&pdev->dev, "Setting bus frequency to default value: " - "%d MHz", freq_mhz); + "%d MHz\n", freq_mhz); } i2c_pnx->adapter->algo = &pnx_algorithm; diff --git a/drivers/i2c/chips/menelaus.c b/drivers/i2c/chips/menelaus.c index 66436bae11a..2dea0123a95 100644 --- a/drivers/i2c/chips/menelaus.c +++ b/drivers/i2c/chips/menelaus.c @@ -1195,7 +1195,7 @@ static int menelaus_probe(struct i2c_client *client) err = request_irq(client->irq, menelaus_irq, IRQF_DISABLED, DRIVER_NAME, menelaus); if (err) { - dev_dbg(&client->dev, "can't get IRQ %d, err %d", + dev_dbg(&client->dev, "can't get IRQ %d, err %d\n", client->irq, err); goto fail1; } diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c index a3409fdb307..7a7dab890f6 100644 --- a/drivers/infiniband/hw/ehca/ehca_main.c +++ b/drivers/infiniband/hw/ehca/ehca_main.c @@ -579,12 +579,12 @@ static ssize_t ehca_show_##name(struct device *dev, \ \ rblock = ehca_alloc_fw_ctrlblock(GFP_KERNEL); \ if (!rblock) { \ - dev_err(dev, "Can't allocate rblock memory."); \ + dev_err(dev, "Can't allocate rblock memory.\n"); \ return 0; \ } \ \ if (hipz_h_query_hca(shca->ipz_hca_handle, rblock) != H_SUCCESS) { \ - dev_err(dev, "Can't query device properties"); \ + dev_err(dev, "Can't query device properties\n"); \ ehca_free_fw_ctrlblock(rblock); \ return 0; \ } \ diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c index 20896d5e5f0..ec1b6cfefcd 100644 --- a/drivers/input/gameport/gameport.c +++ b/drivers/input/gameport/gameport.c @@ -448,9 +448,8 @@ static int gameport_thread(void *nothing) set_freezable(); do { gameport_handle_event(); - wait_event_interruptible(gameport_wait, + wait_event_freezable(gameport_wait, kthread_should_stop() || !list_empty(&gameport_event_list)); - try_to_freeze(); } while (!kthread_should_stop()); printk(KERN_DEBUG "gameport: kgameportd exiting\n"); diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index b3bc15acd3f..7f5293828fb 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c @@ -387,9 +387,8 @@ static int serio_thread(void *nothing) set_freezable(); do { serio_handle_event(); - wait_event_interruptible(serio_wait, + wait_event_freezable(serio_wait, kthread_should_stop() || !list_empty(&serio_event_list)); - try_to_freeze(); } while (!kthread_should_stop()); printk(KERN_DEBUG "serio: kseriod exiting\n"); diff --git a/drivers/input/touchscreen/ucb1400_ts.c b/drivers/input/touchscreen/ucb1400_ts.c index 86aed64ec0f..89373b01d8f 100644 --- a/drivers/input/touchscreen/ucb1400_ts.c +++ b/drivers/input/touchscreen/ucb1400_ts.c @@ -333,10 +333,9 @@ static int ucb1400_ts_thread(void *_ucb) timeout = msecs_to_jiffies(10); } - wait_event_interruptible_timeout(ucb->ts_wait, + wait_event_freezable_timeout(ucb->ts_wait, ucb->irq_pending || ucb->ts_restart || kthread_should_stop(), timeout); - try_to_freeze(); } /* Send the "pen off" if we are stopping with the pen still active */ diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c index 6df336bdd57..acd417197d0 100644 --- a/drivers/isdn/gigaset/common.c +++ b/drivers/isdn/gigaset/common.c @@ -534,7 +534,8 @@ int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src, n = RBUFSIZE - tail; if (!n) { dev_err(inbuf->cs->dev, - "buffer overflow (%u bytes lost)", bytesleft); + "buffer overflow (%u bytes lost)\n", + bytesleft); break; } if (n > bytesleft) diff --git a/drivers/isdn/hardware/avm/b1.c b/drivers/isdn/hardware/avm/b1.c index 7a69a18d07e..4484a641723 100644 --- a/drivers/isdn/hardware/avm/b1.c +++ b/drivers/isdn/hardware/avm/b1.c @@ -321,12 +321,15 @@ void b1_reset_ctr(struct capi_ctr *ctrl) avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata); avmcard *card = cinfo->card; unsigned int port = card->port; + unsigned long flags; b1_reset(port); b1_reset(port); memset(cinfo->version, 0, sizeof(cinfo->version)); + spin_lock_irqsave(&card->lock, flags); capilib_release(&cinfo->ncci_head); + spin_unlock_irqrestore(&card->lock, flags); capi_ctr_reseted(ctrl); } @@ -361,9 +364,8 @@ void b1_release_appl(struct capi_ctr *ctrl, u16 appl) unsigned int port = card->port; unsigned long flags; - capilib_release_appl(&cinfo->ncci_head, appl); - spin_lock_irqsave(&card->lock, flags); + capilib_release_appl(&cinfo->ncci_head, appl); b1_put_byte(port, SEND_RELEASE); b1_put_word(port, appl); spin_unlock_irqrestore(&card->lock, flags); @@ -380,27 +382,27 @@ u16 b1_send_message(struct capi_ctr *ctrl, struct sk_buff *skb) u8 subcmd = CAPIMSG_SUBCOMMAND(skb->data); u16 dlen, retval; + spin_lock_irqsave(&card->lock, flags); if (CAPICMD(cmd, subcmd) == CAPI_DATA_B3_REQ) { retval = capilib_data_b3_req(&cinfo->ncci_head, CAPIMSG_APPID(skb->data), CAPIMSG_NCCI(skb->data), CAPIMSG_MSGID(skb->data)); - if (retval != CAPI_NOERROR) + if (retval != CAPI_NOERROR) { + spin_unlock_irqrestore(&card->lock, flags); return retval; + } dlen = CAPIMSG_DATALEN(skb->data); - spin_lock_irqsave(&card->lock, flags); b1_put_byte(port, SEND_DATA_B3_REQ); b1_put_slice(port, skb->data, len); b1_put_slice(port, skb->data + len, dlen); - spin_unlock_irqrestore(&card->lock, flags); } else { - spin_lock_irqsave(&card->lock, flags); b1_put_byte(port, SEND_MESSAGE); b1_put_slice(port, skb->data, len); - spin_unlock_irqrestore(&card->lock, flags); } + spin_unlock_irqrestore(&card->lock, flags); dev_kfree_skb_any(skb); return CAPI_NOERROR; @@ -534,17 +536,17 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr) ApplId = (unsigned) b1_get_word(card->port); MsgLen = b1_get_slice(card->port, card->msgbuf); - spin_unlock_irqrestore(&card->lock, flags); if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) { printk(KERN_ERR "%s: incoming packet dropped\n", card->name); + spin_unlock_irqrestore(&card->lock, flags); } else { memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_CONF) capilib_data_b3_conf(&cinfo->ncci_head, ApplId, CAPIMSG_NCCI(skb->data), CAPIMSG_MSGID(skb->data)); - + spin_unlock_irqrestore(&card->lock, flags); capi_ctr_handle_message(ctrl, ApplId, skb); } break; @@ -554,21 +556,17 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr) ApplId = b1_get_word(card->port); NCCI = b1_get_word(card->port); WindowSize = b1_get_word(card->port); - spin_unlock_irqrestore(&card->lock, flags); - capilib_new_ncci(&cinfo->ncci_head, ApplId, NCCI, WindowSize); - + spin_unlock_irqrestore(&card->lock, flags); break; case RECEIVE_FREE_NCCI: ApplId = b1_get_word(card->port); NCCI = b1_get_word(card->port); - spin_unlock_irqrestore(&card->lock, flags); - if (NCCI != 0xffffffff) capilib_free_ncci(&cinfo->ncci_head, ApplId, NCCI); - + spin_unlock_irqrestore(&card->lock, flags); break; case RECEIVE_START: diff --git a/drivers/isdn/hardware/avm/c4.c b/drivers/isdn/hardware/avm/c4.c index d58f927e766..8710cf6214d 100644 --- a/drivers/isdn/hardware/avm/c4.c +++ b/drivers/isdn/hardware/avm/c4.c @@ -727,6 +727,7 @@ static void c4_send_init(avmcard *card) { struct sk_buff *skb; void *p; + unsigned long flags; skb = alloc_skb(15, GFP_ATOMIC); if (!skb) { @@ -744,12 +745,15 @@ static void c4_send_init(avmcard *card) skb_put(skb, (u8 *)p - (u8 *)skb->data); skb_queue_tail(&card->dma->send_queue, skb); + spin_lock_irqsave(&card->lock, flags); c4_dispatch_tx(card); + spin_unlock_irqrestore(&card->lock, flags); } static int queue_sendconfigword(avmcard *card, u32 val) { struct sk_buff *skb; + unsigned long flags; void *p; skb = alloc_skb(3+4, GFP_ATOMIC); @@ -766,7 +770,9 @@ static int queue_sendconfigword(avmcard *card, u32 val) skb_put(skb, (u8 *)p - (u8 *)skb->data); skb_queue_tail(&card->dma->send_queue, skb); + spin_lock_irqsave(&card->lock, flags); c4_dispatch_tx(card); + spin_unlock_irqrestore(&card->lock, flags); return 0; } @@ -986,7 +992,9 @@ static void c4_release_appl(struct capi_ctr *ctrl, u16 appl) struct sk_buff *skb; void *p; + spin_lock_irqsave(&card->lock, flags); capilib_release_appl(&cinfo->ncci_head, appl); + spin_unlock_irqrestore(&card->lock, flags); if (ctrl->cnr == card->cardnr) { skb = alloc_skb(7, GFP_ATOMIC); @@ -1019,7 +1027,8 @@ static u16 c4_send_message(struct capi_ctr *ctrl, struct sk_buff *skb) u16 retval = CAPI_NOERROR; unsigned long flags; - if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_REQ) { + spin_lock_irqsave(&card->lock, flags); + if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_REQ) { retval = capilib_data_b3_req(&cinfo->ncci_head, CAPIMSG_APPID(skb->data), CAPIMSG_NCCI(skb->data), @@ -1027,10 +1036,9 @@ static u16 c4_send_message(struct capi_ctr *ctrl, struct sk_buff *skb) } if (retval == CAPI_NOERROR) { skb_queue_tail(&card->dma->send_queue, skb); - spin_lock_irqsave(&card->lock, flags); c4_dispatch_tx(card); - spin_unlock_irqrestore(&card->lock, flags); } + spin_unlock_irqrestore(&card->lock, flags); return retval; } diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index b203640ef1c..445f0266557 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c @@ -527,7 +527,8 @@ static int dvb_frontend_thread(void *data) up(&fepriv->sem); /* is locked when we enter the thread... */ restart: timeout = wait_event_interruptible_timeout(fepriv->wait_queue, - dvb_frontend_should_wakeup(fe) || kthread_should_stop(), + dvb_frontend_should_wakeup(fe) || kthread_should_stop() + || freezing(current), fepriv->delay); if (kthread_should_stop() || dvb_frontend_is_exiting(fe)) { diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c index 9eac65f34bf..dcf22a3b672 100644 --- a/drivers/media/video/v4l1-compat.c +++ b/drivers/media/video/v4l1-compat.c @@ -144,7 +144,7 @@ const static unsigned int palette2pixelformat[] = { [VIDEO_PALETTE_YUV422P] = V4L2_PIX_FMT_YUV422P, }; -static unsigned int __attribute_pure__ +static unsigned int __pure palette_to_pixelformat(unsigned int palette) { if (palette < ARRAY_SIZE(palette2pixelformat)) diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c index b79a9cf2d16..21b921dd6aa 100644 --- a/drivers/mtd/nand/s3c2410.c +++ b/drivers/mtd/nand/s3c2410.c @@ -696,7 +696,7 @@ static int s3c24xx_nand_probe(struct platform_device *pdev, info->clk = clk_get(&pdev->dev, "nand"); if (IS_ERR(info->clk)) { - dev_err(&pdev->dev, "failed to get clock"); + dev_err(&pdev->dev, "failed to get clock\n"); err = -ENOENT; goto exit_error; } diff --git a/drivers/net/ax88796.c b/drivers/net/ax88796.c index 9fe0517cf89..7495a9ee8f4 100644 --- a/drivers/net/ax88796.c +++ b/drivers/net/ax88796.c @@ -900,7 +900,7 @@ static int ax_probe(struct platform_device *pdev) ax->map2 = ioremap(res->start, size); if (ax->map2 == NULL) { - dev_err(&pdev->dev, "cannot map reset register"); + dev_err(&pdev->dev, "cannot map reset register\n"); ret = -ENXIO; goto exit_mem2; } diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 78ed633ceb8..fa0d69ab908 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c @@ -6428,7 +6428,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) /* enable device (incl. PCI PM wakeup), and bus-mastering */ rc = pci_enable_device(pdev); if (rc) { - dev_err(&pdev->dev, "Cannot enable PCI device, aborting."); + dev_err(&pdev->dev, "Cannot enable PCI device, aborting.\n"); goto err_out; } diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index fe5ffac7ac5..2809c99906e 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c @@ -3218,7 +3218,7 @@ static int __devinit ehea_probe_adapter(struct of_device *dev, /* get adapter properties */ ret = ehea_sense_adapter_attr(adapter); if (ret) { - dev_err(&dev->dev, "sense_adapter_attr failed: %d", ret); + dev_err(&dev->dev, "sense_adapter_attr failed: %d\n", ret); goto out_free_ad; } @@ -3226,7 +3226,7 @@ static int __devinit ehea_probe_adapter(struct of_device *dev, EHEA_NEQ, EHEA_MAX_ENTRIES_EQ, 1); if (!adapter->neq) { ret = -EIO; - dev_err(&dev->dev, "NEQ creation failed"); + dev_err(&dev->dev, "NEQ creation failed\n"); goto out_free_ad; } @@ -3237,7 +3237,7 @@ static int __devinit ehea_probe_adapter(struct of_device *dev, ehea_interrupt_neq, IRQF_DISABLED, "ehea_neq", adapter); if (ret) { - dev_err(&dev->dev, "requesting NEQ IRQ failed"); + dev_err(&dev->dev, "requesting NEQ IRQ failed\n"); goto out_kill_eq; } @@ -3247,7 +3247,7 @@ static int __devinit ehea_probe_adapter(struct of_device *dev, ret = ehea_setup_ports(adapter); if (ret) { - dev_err(&dev->dev, "setup_ports failed"); + dev_err(&dev->dev, "setup_ports failed\n"); goto out_rem_dev_sysfs; } diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index 64c8151f200..366e62a2b1e 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c @@ -3058,7 +3058,8 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (status != 0) { dac_enabled = 0; dev_err(&pdev->dev, - "64-bit pci address mask was refused, trying 32-bit"); + "64-bit pci address mask was refused, " + "trying 32-bit\n"); status = pci_set_dma_mask(pdev, DMA_32BIT_MASK); } if (status != 0) { diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 2a1d6d7ec35..601051c584e 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c @@ -53,9 +53,6 @@ static char netxen_nic_driver_string[] = "NetXen Network Driver version " #define NETXEN_ADAPTER_UP_MAGIC 777 #define NETXEN_NIC_PEG_TUNE 0 -#define DMA_32BIT_MASK 0x00000000ffffffffULL -#define DMA_35BIT_MASK 0x00000007ffffffffULL - /* Local functions to NetXen NIC driver */ static int __devinit netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent); diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 7967240534d..70d7e478a3e 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c @@ -3961,7 +3961,7 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw, struct net_device *dev = alloc_etherdev(sizeof(*sky2)); if (!dev) { - dev_err(&hw->pdev->dev, "etherdev alloc failed"); + dev_err(&hw->pdev->dev, "etherdev alloc failed\n"); return NULL; } diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c index 6240b978fe3..f55a5951733 100644 --- a/drivers/net/usb/mcs7830.c +++ b/drivers/net/usb/mcs7830.c @@ -114,8 +114,8 @@ static void mcs7830_async_cmd_callback(struct urb *urb) struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)urb->context; if (urb->status < 0) - printk(KERN_DEBUG "mcs7830_async_cmd_callback() failed with %d", - urb->status); + printk(KERN_DEBUG "%s() failed with %d\n", + __FUNCTION__, urb->status); kfree(req); usb_free_urb(urb); @@ -129,15 +129,15 @@ static void mcs7830_set_reg_async(struct usbnet *dev, u16 index, u16 size, void urb = usb_alloc_urb(0, GFP_ATOMIC); if (!urb) { - dev_dbg(&dev->udev->dev, "Error allocating URB " - "in write_cmd_async!"); + dev_dbg(&dev->udev->dev, + "Error allocating URB in write_cmd_async!\n"); return; } req = kmalloc(sizeof *req, GFP_ATOMIC); if (!req) { - dev_err(&dev->udev->dev, "Failed to allocate memory for " - "control request"); + dev_err(&dev->udev->dev, + "Failed to allocate memory for control request\n"); goto out; } req->bRequestType = MCS7830_WR_BMREQ; @@ -153,8 +153,8 @@ static void mcs7830_set_reg_async(struct usbnet *dev, u16 index, u16 size, void ret = usb_submit_urb(urb, GFP_ATOMIC); if (ret < 0) { - dev_err(&dev->udev->dev, "Error submitting the control " - "message: ret=%d", ret); + dev_err(&dev->udev->dev, + "Error submitting the control message: ret=%d\n", ret); goto out; } return; diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 7fd505cc4f7..2a8fc431099 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c @@ -1526,7 +1526,7 @@ static int xennet_connect(struct net_device *dev) if (!feature_rx_copy) { dev_info(&dev->dev, - "backend does not support copying recieve path"); + "backend does not support copying receive path\n"); return -ENODEV; } diff --git a/drivers/parport/daisy.c b/drivers/parport/daisy.c index ff9f3445353..5bbff2028f8 100644 --- a/drivers/parport/daisy.c +++ b/drivers/parport/daisy.c @@ -275,35 +275,6 @@ void parport_close(struct pardevice *dev) parport_unregister_device(dev); } -/** - * parport_device_num - convert device coordinates - * @parport: parallel port number - * @mux: multiplexor port number (-1 for no multiplexor) - * @daisy: daisy chain address (-1 for no daisy chain address) - * - * This tries to locate a device on the given parallel port, - * multiplexor port and daisy chain address, and returns its - * device number or %-ENXIO if no device with those coordinates - * exists. - **/ - -int parport_device_num(int parport, int mux, int daisy) -{ - int res = -ENXIO; - struct daisydev *dev; - - spin_lock(&topology_lock); - dev = topology; - while (dev && dev->port->portnum != parport && - dev->port->muxport != mux && dev->daisy != daisy) - dev = dev->next; - if (dev) - res = dev->devnum; - spin_unlock(&topology_lock); - - return res; -} - /* Send a daisy-chain-style CPP command packet. */ static int cpp_daisy(struct parport *port, int cmd) { diff --git a/drivers/parport/procfs.c b/drivers/parport/procfs.c index bdbdab9285c..ed82e41210d 100644 --- a/drivers/parport/procfs.c +++ b/drivers/parport/procfs.c @@ -237,7 +237,7 @@ static int do_hardware_modes (ctl_table *table, int write, #define PARPORT_PARPORT_DIR(CHILD) { .ctl_name = DEV_PARPORT, .procname = "parport", \ .mode = 0555, .child = CHILD } #define PARPORT_DEV_DIR(CHILD) { .ctl_name = CTL_DEV, .procname = "dev", .mode = 0555, .child = CHILD } -#define PARPORT_DEVICES_ROOT_DIR { .ctl_name = DEV_PARPORT_DEVICES, .procname = "devices", \ +#define PARPORT_DEVICES_ROOT_DIR { .procname = "devices", \ .mode = 0555, .child = NULL } static const unsigned long parport_min_timeslice_value = @@ -266,7 +266,6 @@ static const struct parport_sysctl_table parport_sysctl_template = { .sysctl_header = NULL, { { - .ctl_name = DEV_PARPORT_SPINTIME, .procname = "spintime", .data = NULL, .maxlen = sizeof(int), @@ -276,7 +275,6 @@ static const struct parport_sysctl_table parport_sysctl_template = { .extra2 = (void*) &parport_max_spintime_value }, { - .ctl_name = DEV_PARPORT_BASE_ADDR, .procname = "base-addr", .data = NULL, .maxlen = 0, @@ -284,7 +282,6 @@ static const struct parport_sysctl_table parport_sysctl_template = { .proc_handler = &do_hardware_base_addr }, { - .ctl_name = DEV_PARPORT_IRQ, .procname = "irq", .data = NULL, .maxlen = 0, @@ -292,7 +289,6 @@ static const struct parport_sysctl_table parport_sysctl_template = { .proc_handler = &do_hardware_irq }, { - .ctl_name = DEV_PARPORT_DMA, .procname = "dma", .data = NULL, .maxlen = 0, @@ -300,7 +296,6 @@ static const struct parport_sysctl_table parport_sysctl_template = { .proc_handler = &do_hardware_dma }, { - .ctl_name = DEV_PARPORT_MODES, .procname = "modes", .data = NULL, .maxlen = 0, @@ -310,7 +305,6 @@ static const struct parport_sysctl_table parport_sysctl_template = { PARPORT_DEVICES_ROOT_DIR, #ifdef CONFIG_PARPORT_1284 { - .ctl_name = DEV_PARPORT_AUTOPROBE, .procname = "autoprobe", .data = NULL, .maxlen = 0, @@ -318,7 +312,6 @@ static const struct parport_sysctl_table parport_sysctl_template = { .proc_handler = &do_autoprobe }, { - .ctl_name = DEV_PARPORT_AUTOPROBE + 1, .procname = "autoprobe0", .data = NULL, .maxlen = 0, @@ -326,7 +319,6 @@ static const struct parport_sysctl_table parport_sysctl_template = { .proc_handler = &do_autoprobe }, { - .ctl_name = DEV_PARPORT_AUTOPROBE + 2, .procname = "autoprobe1", .data = NULL, .maxlen = 0, @@ -334,7 +326,6 @@ static const struct parport_sysctl_table parport_sysctl_template = { .proc_handler = &do_autoprobe }, { - .ctl_name = DEV_PARPORT_AUTOPROBE + 3, .procname = "autoprobe2", .data = NULL, .maxlen = 0, @@ -342,7 +333,6 @@ static const struct parport_sysctl_table parport_sysctl_template = { .proc_handler = &do_autoprobe }, { - .ctl_name = DEV_PARPORT_AUTOPROBE + 4, .procname = "autoprobe3", .data = NULL, .maxlen = 0, @@ -354,7 +344,6 @@ static const struct parport_sysctl_table parport_sysctl_template = { }, { { - .ctl_name = DEV_PARPORT_DEVICES_ACTIVE, .procname = "active", .data = NULL, .maxlen = 0, @@ -393,7 +382,6 @@ parport_device_sysctl_template = { .sysctl_header = NULL, { { - .ctl_name = DEV_PARPORT_DEVICE_TIMESLICE, .procname = "timeslice", .data = NULL, .maxlen = sizeof(int), @@ -449,7 +437,6 @@ parport_default_sysctl_table = { .sysctl_header = NULL, { { - .ctl_name = DEV_PARPORT_DEFAULT_TIMESLICE, .procname = "timeslice", .data = &parport_default_timeslice, .maxlen = sizeof(parport_default_timeslice), @@ -459,7 +446,6 @@ parport_default_sysctl_table = { .extra2 = (void*) &parport_max_timeslice_value }, { - .ctl_name = DEV_PARPORT_DEFAULT_SPINTIME, .procname = "spintime", .data = &parport_default_spintime, .maxlen = sizeof(parport_default_spintime), @@ -502,7 +488,7 @@ int parport_proc_register(struct parport *port) t->device_dir[0].extra1 = port; - for (i = 0; i < 8; i++) + for (i = 0; i < 5; i++) t->vars[i].extra1 = port; t->vars[0].data = &port->spintime; @@ -512,7 +498,7 @@ int parport_proc_register(struct parport *port) t->vars[6 + i].extra2 = &port->probe_info[i]; t->port_dir[0].procname = port->name; - t->port_dir[0].ctl_name = port->number + 1; /* nb 0 isn't legal here */ + t->port_dir[0].ctl_name = 0; t->port_dir[0].child = t->vars; t->parport_dir[0].child = t->port_dir; @@ -551,26 +537,12 @@ int parport_device_proc_register(struct pardevice *device) t->dev_dir[0].child = t->parport_dir; t->parport_dir[0].child = t->port_dir; t->port_dir[0].procname = port->name; - t->port_dir[0].ctl_name = port->number + 1; /* nb 0 isn't legal here */ + t->port_dir[0].ctl_name = 0; t->port_dir[0].child = t->devices_root_dir; t->devices_root_dir[0].child = t->device_dir; -#ifdef CONFIG_PARPORT_1284 - - t->device_dir[0].ctl_name = - parport_device_num(port->number, port->muxport, - device->daisy) - + 1; /* nb 0 isn't legal here */ - -#else /* No IEEE 1284 support */ - - /* parport_device_num isn't available. */ - t->device_dir[0].ctl_name = 1; - -#endif /* IEEE 1284 support or not */ - + t->device_dir[0].ctl_name = 0; t->device_dir[0].procname = device->name; - t->device_dir[0].extra1 = device; t->device_dir[0].child = t->vars; t->vars[0].data = &device->timeslice; diff --git a/drivers/power/ds2760_battery.c b/drivers/power/ds2760_battery.c index be7021ee361..bdb9b7285b3 100644 --- a/drivers/power/ds2760_battery.c +++ b/drivers/power/ds2760_battery.c @@ -366,7 +366,7 @@ static int ds2760_battery_probe(struct platform_device *pdev) retval = power_supply_register(&pdev->dev, &di->bat); if (retval) { - dev_err(di->dev, "failed to register battery"); + dev_err(di->dev, "failed to register battery\n"); goto batt_failed; } diff --git a/drivers/ps3/ps3stor_lib.c b/drivers/ps3/ps3stor_lib.c index 3a9824e3b25..55955f16ad9 100644 --- a/drivers/ps3/ps3stor_lib.c +++ b/drivers/ps3/ps3stor_lib.c @@ -66,7 +66,7 @@ static int ps3stor_probe_access(struct ps3_storage_device *dev) if (n > 1) dev_info(&dev->sbd.core, "%s:%u: %lu accessible regions found. Only the first " - "one will be used", + "one will be used\n", __func__, __LINE__, n); dev->region_idx = __ffs(dev->accessible_regions); dev_info(&dev->sbd.core, diff --git a/drivers/rtc/rtc-sysfs.c b/drivers/rtc/rtc-sysfs.c index 6cad0841f3c..2ae0e8304d3 100644 --- a/drivers/rtc/rtc-sysfs.c +++ b/drivers/rtc/rtc-sysfs.c @@ -200,9 +200,8 @@ void rtc_sysfs_add_device(struct rtc_device *rtc) err = device_create_file(&rtc->dev, &dev_attr_wakealarm); if (err) - dev_err(rtc->dev.parent, "failed to create " - "alarm attribute, %d", - err); + dev_err(rtc->dev.parent, + "failed to create alarm attribute, %d\n", err); } void rtc_sysfs_del_device(struct rtc_device *rtc) diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index e5337ad4121..ce348c5c706 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -1243,7 +1243,8 @@ void lpfc_sli_poll_fcp_ring(struct lpfc_hba *phba) memset(adaptermsg, 0, LPFC_MAX_ADPTMSG); memcpy(&adaptermsg[0], (uint8_t *) irsp, MAX_MSG_DATA); - dev_warn(&((phba->pcidev)->dev), "lpfc%d: %s", + dev_warn(&((phba->pcidev)->dev), + "lpfc%d: %s\n", phba->brd_no, adaptermsg); } else { /* Unknown IOCB command */ @@ -1430,7 +1431,8 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba, memset(adaptermsg, 0, LPFC_MAX_ADPTMSG); memcpy(&adaptermsg[0], (uint8_t *) irsp, MAX_MSG_DATA); - dev_warn(&((phba->pcidev)->dev), "lpfc%d: %s", + dev_warn(&((phba->pcidev)->dev), + "lpfc%d: %s\n", phba->brd_no, adaptermsg); } else { /* Unknown IOCB command */ @@ -1681,7 +1683,7 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, memcpy(&adaptermsg[0], (uint8_t *) irsp, MAX_MSG_DATA); dev_warn(&((phba->pcidev)->dev), - "lpfc%d: %s", + "lpfc%d: %s\n", phba->brd_no, adaptermsg); } else { /* Unknown IOCB command */ diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 03b68d4f3bd..89460d27c68 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -1286,7 +1286,7 @@ static int __devinit qla4xxx_probe_adapter(struct pci_dev *pdev, ret = scsi_init_shared_tag_map(host, MAX_SRBS); if (ret) { - dev_warn(&ha->pdev->dev, "scsi_init_shared_tag_map failed"); + dev_warn(&ha->pdev->dev, "scsi_init_shared_tag_map failed\n"); goto probe_failed; } diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 68aa4da0186..103189095c8 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c @@ -1959,12 +1959,11 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port) mutex_lock(&state->mutex); -#ifdef CONFIG_DISABLE_CONSOLE_SUSPEND - if (uart_console(port)) { + if (!console_suspend_enabled && uart_console(port)) { + /* we're going to avoid suspending serial console */ mutex_unlock(&state->mutex); return 0; } -#endif tty_dev = device_find_child(port->dev, &match, serial_match_port); if (device_may_wakeup(tty_dev)) { @@ -2016,12 +2015,11 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port) mutex_lock(&state->mutex); -#ifdef CONFIG_DISABLE_CONSOLE_SUSPEND - if (uart_console(port)) { + if (!console_suspend_enabled && uart_console(port)) { + /* no need to resume serial console, it wasn't suspended */ mutex_unlock(&state->mutex); return 0; } -#endif if (!port->suspended) { disable_irq_wake(port->irq); diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index 6cb71d74738..2ef11bb70b2 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c @@ -1070,7 +1070,7 @@ static int setup(struct spi_device *spi) return -ENODEV; } - dev_dbg(&spi->dev, "setup spi chip %s, width is %d, dma is %d,", + dev_dbg(&spi->dev, "setup spi chip %s, width is %d, dma is %d\n", spi->modalias, chip->width, chip->enable_dma); dev_dbg(&spi->dev, "ctl_reg is 0x%x, flag_reg is 0x%x\n", chip->ctl_reg, chip->flag); diff --git a/drivers/spi/spi_imx.c b/drivers/spi/spi_imx.c index 3b4650ae6f1..7686ba34430 100644 --- a/drivers/spi/spi_imx.c +++ b/drivers/spi/spi_imx.c @@ -1194,7 +1194,7 @@ static int setup(struct spi_device *spi) chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL); if (!chip) { dev_err(&spi->dev, - "setup - cannot allocate controller state"); + "setup - cannot allocate controller state\n"); return -ENOMEM; } chip->control = SPI_DEFAULT_CONTROL; @@ -1206,7 +1206,7 @@ static int setup(struct spi_device *spi) if (!chip_info) { dev_err(&spi->dev, "setup - " - "cannot allocate controller data"); + "cannot allocate controller data\n"); status = -ENOMEM; goto err_first_setup; } diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index f51e22490ed..912d97aaf9b 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -332,7 +332,7 @@ static void acm_read_bulk(struct urb *urb) return; if (status) - dev_dbg(&acm->data->dev, "bulk rx status %d", status); + dev_dbg(&acm->data->dev, "bulk rx status %d\n", status); buf = rcv->buffer; buf->size = urb->actual_length; @@ -831,13 +831,13 @@ static int acm_probe (struct usb_interface *intf, /* normal probing*/ if (!buffer) { - err("Wierd descriptor references\n"); + err("Weird descriptor references\n"); return -EINVAL; } if (!buflen) { if (intf->cur_altsetting->endpoint->extralen && intf->cur_altsetting->endpoint->extra) { - dev_dbg(&intf->dev,"Seeking extra descriptors on endpoint"); + dev_dbg(&intf->dev,"Seeking extra descriptors on endpoint\n"); buflen = intf->cur_altsetting->endpoint->extralen; buffer = intf->cur_altsetting->endpoint->extra; } else { @@ -887,24 +887,24 @@ next_desc: if (!union_header) { if (call_interface_num > 0) { - dev_dbg(&intf->dev,"No union descriptor, using call management descriptor"); + dev_dbg(&intf->dev,"No union descriptor, using call management descriptor\n"); data_interface = usb_ifnum_to_if(usb_dev, (data_interface_num = call_interface_num)); control_interface = intf; } else { - dev_dbg(&intf->dev,"No union descriptor, giving up"); + dev_dbg(&intf->dev,"No union descriptor, giving up\n"); return -ENODEV; } } else { control_interface = usb_ifnum_to_if(usb_dev, union_header->bMasterInterface0); data_interface = usb_ifnum_to_if(usb_dev, (data_interface_num = union_header->bSlaveInterface0)); if (!control_interface || !data_interface) { - dev_dbg(&intf->dev,"no interfaces"); + dev_dbg(&intf->dev,"no interfaces\n"); return -ENODEV; } } if (data_interface_num != call_interface_num) - dev_dbg(&intf->dev,"Seperate call control interface. That is not fully supported."); + dev_dbg(&intf->dev,"Seperate call control interface. That is not fully supported.\n"); skip_normal_probe: @@ -912,7 +912,7 @@ skip_normal_probe: if (data_interface->cur_altsetting->desc.bInterfaceClass != CDC_DATA_INTERFACE_TYPE) { if (control_interface->cur_altsetting->desc.bInterfaceClass == CDC_DATA_INTERFACE_TYPE) { struct usb_interface *t; - dev_dbg(&intf->dev,"Your device has switched interfaces."); + dev_dbg(&intf->dev,"Your device has switched interfaces.\n"); t = control_interface; control_interface = data_interface; @@ -927,7 +927,7 @@ skip_normal_probe: return -ENODEV; if (usb_interface_claimed(data_interface)) { /* valid in this context */ - dev_dbg(&intf->dev,"The data interface isn't available"); + dev_dbg(&intf->dev,"The data interface isn't available\n"); return -EBUSY; } @@ -944,7 +944,7 @@ skip_normal_probe: if (!usb_endpoint_dir_in(epread)) { /* descriptors are swapped */ struct usb_endpoint_descriptor *t; - dev_dbg(&intf->dev,"The data interface has switched endpoints"); + dev_dbg(&intf->dev,"The data interface has switched endpoints\n"); t = epread; epread = epwrite; @@ -959,7 +959,7 @@ skip_normal_probe: } if (!(acm = kzalloc(sizeof(struct acm), GFP_KERNEL))) { - dev_dbg(&intf->dev, "out of memory (acm kzalloc)"); + dev_dbg(&intf->dev, "out of memory (acm kzalloc)\n"); goto alloc_fail; } @@ -985,26 +985,26 @@ skip_normal_probe: buf = usb_buffer_alloc(usb_dev, ctrlsize, GFP_KERNEL, &acm->ctrl_dma); if (!buf) { - dev_dbg(&intf->dev, "out of memory (ctrl buffer alloc)"); + dev_dbg(&intf->dev, "out of memory (ctrl buffer alloc)\n"); goto alloc_fail2; } acm->ctrl_buffer = buf; if (acm_write_buffers_alloc(acm) < 0) { - dev_dbg(&intf->dev, "out of memory (write buffer alloc)"); + dev_dbg(&intf->dev, "out of memory (write buffer alloc)\n"); goto alloc_fail4; } acm->ctrlurb = usb_alloc_urb(0, GFP_KERNEL); if (!acm->ctrlurb) { - dev_dbg(&intf->dev, "out of memory (ctrlurb kmalloc)"); + dev_dbg(&intf->dev, "out of memory (ctrlurb kmalloc)\n"); goto alloc_fail5; } for (i = 0; i < num_rx_buf; i++) { struct acm_ru *rcv = &(acm->ru[i]); if (!(rcv->urb = usb_alloc_urb(0, GFP_KERNEL))) { - dev_dbg(&intf->dev, "out of memory (read urbs usb_alloc_urb)"); + dev_dbg(&intf->dev, "out of memory (read urbs usb_alloc_urb)\n"); goto alloc_fail7; } @@ -1015,13 +1015,13 @@ skip_normal_probe: struct acm_rb *buf = &(acm->rb[i]); if (!(buf->base = usb_buffer_alloc(acm->dev, readsize, GFP_KERNEL, &buf->dma))) { - dev_dbg(&intf->dev, "out of memory (read bufs usb_buffer_alloc)"); + dev_dbg(&intf->dev, "out of memory (read bufs usb_buffer_alloc)\n"); goto alloc_fail7; } } acm->writeurb = usb_alloc_urb(0, GFP_KERNEL); if (!acm->writeurb) { - dev_dbg(&intf->dev, "out of memory (writeurb kmalloc)"); + dev_dbg(&intf->dev, "out of memory (writeurb kmalloc)\n"); goto alloc_fail7; } diff --git a/drivers/usb/core/endpoint.c b/drivers/usb/core/endpoint.c index 7dc123d6b2d..99e5a68a3f1 100644 --- a/drivers/usb/core/endpoint.c +++ b/drivers/usb/core/endpoint.c @@ -291,7 +291,7 @@ int usb_create_ep_files(struct device *parent, retval = endpoint_get_minor(ep_dev); if (retval) { - dev_err(parent, "can not allocate minor number for %s", + dev_err(parent, "can not allocate minor number for %s\n", ep_dev->dev.bus_id); goto error_register; } diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 60a8f55a0cc..036c3dea855 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -2870,10 +2870,9 @@ static int hub_thread(void *__unused) set_freezable(); do { hub_events(); - wait_event_interruptible(khubd_wait, + wait_event_freezable(khubd_wait, !list_empty(&hub_event_list) || kthread_should_stop()); - try_to_freeze(); } while (!kthread_should_stop() || !list_empty(&hub_event_list)); pr_debug("%s: khubd exiting\n", usbcore_name); diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index c021af39037..8dd5a6afd51 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -1526,7 +1526,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration) new_interfaces = kmalloc(nintf * sizeof(*new_interfaces), GFP_KERNEL); if (!new_interfaces) { - dev_err(&dev->dev, "Out of memory"); + dev_err(&dev->dev, "Out of memory\n"); return -ENOMEM; } @@ -1535,7 +1535,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration) sizeof(struct usb_interface), GFP_KERNEL); if (!new_interfaces[n]) { - dev_err(&dev->dev, "Out of memory"); + dev_err(&dev->dev, "Out of memory\n"); ret = -ENOMEM; free_interfaces: while (--n >= 0) diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c index 6829814b7aa..44b79e8a6e2 100644 --- a/drivers/usb/host/ohci-s3c2410.c +++ b/drivers/usb/host/ohci-s3c2410.c @@ -358,7 +358,7 @@ static int usb_hcd_s3c2410_probe (const struct hc_driver *driver, hcd->rsrc_len = dev->resource[0].end - dev->resource[0].start + 1; if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { - dev_err(&dev->dev, "request_mem_region failed"); + dev_err(&dev->dev, "request_mem_region failed\n"); retval = -EBUSY; goto err_put; } diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c index 5131cbfb2f5..c567aa7a41e 100644 --- a/drivers/usb/misc/adutux.c +++ b/drivers/usb/misc/adutux.c @@ -805,7 +805,7 @@ static int adu_probe(struct usb_interface *interface, dev->minor = interface->minor; /* let the user know what node this device is now attached to */ - dev_info(&interface->dev, "ADU%d %s now attached to /dev/usb/adutux%d", + dev_info(&interface->dev, "ADU%d %s now attached to /dev/usb/adutux%d\n", udev->descriptor.idProduct, dev->serial_number, (dev->minor - ADU_MINOR_BASE)); exit: @@ -851,7 +851,7 @@ static void adu_disconnect(struct usb_interface *interface) mutex_unlock(&dev->mtx); } - dev_info(&interface->dev, "ADU device adutux%d now disconnected", + dev_info(&interface->dev, "ADU device adutux%d now disconnected\n", (minor - ADU_MINOR_BASE)); dbg(2," %s : leave", __FUNCTION__); diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c index 46d9f27ec17..d372fbc4eff 100644 --- a/drivers/usb/misc/iowarrior.c +++ b/drivers/usb/misc/iowarrior.c @@ -216,7 +216,7 @@ static void iowarrior_callback(struct urb *urb) exit: retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) - dev_err(&dev->interface->dev, "%s - usb_submit_urb failed with result %d", + dev_err(&dev->interface->dev, "%s - usb_submit_urb failed with result %d\n", __FUNCTION__, retval); } @@ -451,7 +451,7 @@ static ssize_t iowarrior_write(struct file *file, break; default: /* what do we have here ? An unsupported Product-ID ? */ - dev_err(&dev->interface->dev, "%s - not supported for product=0x%x", + dev_err(&dev->interface->dev, "%s - not supported for product=0x%x\n", __FUNCTION__, dev->product_id); retval = -EFAULT; goto exit; @@ -526,7 +526,7 @@ static int iowarrior_ioctl(struct inode *inode, struct file *file, } else { retval = -EINVAL; dev_err(&dev->interface->dev, - "ioctl 'IOW_WRITE' is not supported for product=0x%x.", + "ioctl 'IOW_WRITE' is not supported for product=0x%x.\n", dev->product_id); } break; @@ -752,7 +752,7 @@ static int iowarrior_probe(struct usb_interface *interface, /* allocate memory for our device state and intialize it */ dev = kzalloc(sizeof(struct iowarrior), GFP_KERNEL); if (dev == NULL) { - dev_err(&interface->dev, "Out of memory"); + dev_err(&interface->dev, "Out of memory\n"); return retval; } diff --git a/drivers/usb/misc/phidgetmotorcontrol.c b/drivers/usb/misc/phidgetmotorcontrol.c index df0ebcdb9d6..2ad09b1f484 100644 --- a/drivers/usb/misc/phidgetmotorcontrol.c +++ b/drivers/usb/misc/phidgetmotorcontrol.c @@ -155,7 +155,7 @@ resubmit: retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) dev_err(&mc->intf->dev, - "can't resubmit intr, %s-%s/motorcontrol0, retval %d", + "can't resubmit intr, %s-%s/motorcontrol0, retval %d\n", mc->udev->bus->bus_name, mc->udev->devpath, retval); } diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index e4c248c98e8..65257867b34 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -1071,7 +1071,7 @@ static ssize_t show_latency_timer(struct device *dev, struct device_attribute *a (char*) &latency, 1, WDR_TIMEOUT); if (rv < 0) { - dev_err(dev, "Unable to read latency timer: %i", rv); + dev_err(dev, "Unable to read latency timer: %i\n", rv); return -EIO; } return sprintf(buf, "%i\n", latency); @@ -1098,7 +1098,7 @@ static ssize_t store_latency_timer(struct device *dev, struct device_attribute * buf, 0, WDR_TIMEOUT); if (rv < 0) { - dev_err(dev, "Unable to write latency timer: %i", rv); + dev_err(dev, "Unable to write latency timer: %i\n", rv); return -EIO; } diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index 2ecb1d2a034..8dd3abc99d6 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c @@ -2882,7 +2882,7 @@ static int edge_startup (struct usb_serial *serial) (edge_serial->product_info.NumPorts != serial->num_ports)) { dev_warn(&serial->dev->dev, "Device Reported %d serial ports " "vs. core thinking we have %d ports, email " - "greg@kroah.com this information.", + "greg@kroah.com this information.\n", edge_serial->product_info.NumPorts, serial->num_ports); } diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c index 1b94daa6158..cbe5530f3db 100644 --- a/drivers/usb/serial/ipw.c +++ b/drivers/usb/serial/ipw.c @@ -227,7 +227,7 @@ static int ipw_open(struct usb_serial_port *port, struct file *filp) 0, 100000); if (result < 0) - dev_err(&port->dev, "Init of modem failed (error = %d)", result); + dev_err(&port->dev, "Init of modem failed (error = %d)\n", result); /* reset the bulk pipes */ usb_clear_halt(dev, usb_rcvbulkpipe(dev, port->bulk_in_endpointAddress)); @@ -255,7 +255,7 @@ static int ipw_open(struct usb_serial_port *port, struct file *filp) 0, 100000); if (result < 0) - dev_err(&port->dev, "Enabling bulk RxRead failed (error = %d)", result); + dev_err(&port->dev, "Enabling bulk RxRead failed (error = %d)\n", result); /*--4: setup the initial flowcontrol */ dbg("%s:setting init flowcontrol (%s)",__FUNCTION__,buf_flow_init); @@ -268,7 +268,7 @@ static int ipw_open(struct usb_serial_port *port, struct file *filp) 0x10, 200000); if (result < 0) - dev_err(&port->dev, "initial flowcontrol failed (error = %d)", result); + dev_err(&port->dev, "initial flowcontrol failed (error = %d)\n", result); /*--5: raise the dtr */ @@ -282,7 +282,7 @@ static int ipw_open(struct usb_serial_port *port, struct file *filp) 0, 200000); if (result < 0) - dev_err(&port->dev, "setting dtr failed (error = %d)", result); + dev_err(&port->dev, "setting dtr failed (error = %d)\n", result); /*--6: raise the rts */ dbg("%s:raising rts",__FUNCTION__); @@ -295,7 +295,7 @@ static int ipw_open(struct usb_serial_port *port, struct file *filp) 0, 200000); if (result < 0) - dev_err(&port->dev, "setting dtr failed (error = %d)", result); + dev_err(&port->dev, "setting dtr failed (error = %d)\n", result); kfree(buf_flow_init); return 0; @@ -322,7 +322,7 @@ static void ipw_close(struct usb_serial_port *port, struct file * filp) 0, 200000); if (result < 0) - dev_err(&port->dev, "dropping dtr failed (error = %d)", result); + dev_err(&port->dev, "dropping dtr failed (error = %d)\n", result); /*--2: drop the rts */ dbg("%s:dropping rts",__FUNCTION__); @@ -334,7 +334,7 @@ static void ipw_close(struct usb_serial_port *port, struct file * filp) 0, 200000); if (result < 0) - dev_err(&port->dev, "dropping rts failed (error = %d)", result); + dev_err(&port->dev, "dropping rts failed (error = %d)\n", result); /*--3: purge */ @@ -347,7 +347,7 @@ static void ipw_close(struct usb_serial_port *port, struct file * filp) 0, 200000); if (result < 0) - dev_err(&port->dev, "purge failed (error = %d)", result); + dev_err(&port->dev, "purge failed (error = %d)\n", result); /* send RXBULK_off (tell modem to stop transmitting bulk data on rx chan) */ @@ -361,7 +361,7 @@ static void ipw_close(struct usb_serial_port *port, struct file * filp) 100000); if (result < 0) - dev_err(&port->dev, "Disabling bulk RxRead failed (error = %d)", result); + dev_err(&port->dev, "Disabling bulk RxRead failed (error = %d)\n", result); /* shutdown any in-flight urbs that we know about */ usb_kill_urb(port->read_urb); diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index 01e811becec..e02c198016b 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c @@ -478,7 +478,7 @@ static int mos7720_open(struct usb_serial_port *port, struct file * filp) response = usb_submit_urb(port0->interrupt_in_urb, GFP_KERNEL); if (response) dev_err(&port->dev, - "%s - Error %d submitting control urb", + "%s - Error %d submitting control urb\n", __FUNCTION__, response); } @@ -492,7 +492,7 @@ static int mos7720_open(struct usb_serial_port *port, struct file * filp) response = usb_submit_urb(port->read_urb, GFP_KERNEL); if (response) dev_err(&port->dev, - "%s - Error %d submitting read urb", __FUNCTION__, response); + "%s - Error %d submitting read urb\n", __FUNCTION__, response); /* initialize our icount structure */ memset(&(mos7720_port->icount), 0x00, sizeof(mos7720_port->icount)); diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c index d19861166b5..eea226ae37b 100644 --- a/drivers/usb/serial/oti6858.c +++ b/drivers/usb/serial/oti6858.c @@ -256,7 +256,7 @@ static void setup_line(struct work_struct *work) 100); if (result != OTI6858_CTRL_PKT_SIZE) { - dev_err(&port->dev, "%s(): error reading status", __FUNCTION__); + dev_err(&port->dev, "%s(): error reading status\n", __FUNCTION__); kfree(new_setup); /* we will try again */ schedule_delayed_work(&priv->delayed_setup_work, msecs_to_jiffies(2)); diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 0bb8de4cc52..959b3e4e907 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c @@ -48,7 +48,7 @@ enum devicetype { static int sierra_set_power_state(struct usb_device *udev, __u16 swiState) { int result; - dev_dbg(&udev->dev, "%s", "SET POWER STATE"); + dev_dbg(&udev->dev, "%s", "SET POWER STATE\n"); result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, /* __u8 request */ 0x40, /* __u8 request type */ @@ -63,7 +63,7 @@ static int sierra_set_power_state(struct usb_device *udev, __u16 swiState) static int sierra_set_ms_mode(struct usb_device *udev, __u16 eSocMode) { int result; - dev_dbg(&udev->dev, "%s", "DEVICE MODE SWITCH"); + dev_dbg(&udev->dev, "%s", "DEVICE MODE SWITCH\n"); result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), SWIMS_USB_REQUEST_SetMode, /* __u8 request */ SWIMS_USB_REQUEST_TYPE_SetMode, /* __u8 request type */ @@ -397,7 +397,7 @@ static void sierra_indat_callback(struct urb *urb) err = usb_submit_urb(urb, GFP_ATOMIC); if (err) dev_err(&port->dev, "resubmit read urb failed." - "(%d)", err); + "(%d)\n", err); } } return; @@ -525,7 +525,7 @@ static int sierra_open(struct usb_serial_port *port, struct file *filp) result = usb_submit_urb(urb, GFP_KERNEL); if (result) { - dev_err(&port->dev, "submit urb %d failed (%d) %d", + dev_err(&port->dev, "submit urb %d failed (%d) %d\n", i, result, urb->transfer_buffer_length); } } @@ -538,7 +538,7 @@ static int sierra_open(struct usb_serial_port *port, struct file *filp) if (port->interrupt_in_urb) { result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); if (result) - dev_err(&port->dev, "submit irq_in urb failed %d", + dev_err(&port->dev, "submit irq_in urb failed %d\n", result); } return 0; diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index 3451e8d03ab..ac6114eea0c 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c @@ -907,12 +907,9 @@ static int usb_stor_scan_thread(void * __us) if (delay_use > 0) { printk(KERN_DEBUG "usb-storage: waiting for device " "to settle before scanning\n"); -retry: - wait_event_interruptible_timeout(us->delay_wait, + wait_event_freezable_timeout(us->delay_wait, test_bit(US_FLIDX_DISCONNECTING, &us->flags), delay_use * HZ); - if (try_to_freeze()) - goto retry; } /* If the device is still connected, perform the scanning */ diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c index 832e4613673..62bd4441b5e 100644 --- a/drivers/video/au1100fb.c +++ b/drivers/video/au1100fb.c @@ -457,7 +457,7 @@ static struct fb_ops au1100fb_ops = /* AU1100 LCD controller device driver */ -int au1100fb_drv_probe(struct device *dev) +static int __init au1100fb_drv_probe(struct device *dev) { struct au1100fb_device *fbdev = NULL; struct resource *regs_res; diff --git a/drivers/video/console/newport_con.c b/drivers/video/console/newport_con.c index f57d7b2758b..d31b203bf65 100644 --- a/drivers/video/console/newport_con.c +++ b/drivers/video/console/newport_con.c @@ -98,7 +98,7 @@ static inline void newport_init_cmap(void) } } -static struct linux_logo *newport_show_logo(void) +static const struct linux_logo *newport_show_logo(void) { #ifdef CONFIG_LOGO_SGI_CLUT224 const struct linux_logo *logo = fb_find_logo(8); @@ -108,8 +108,8 @@ static struct linux_logo *newport_show_logo(void) if (!logo) return NULL; - *clut = logo->clut; - *data = logo->data; + clut = logo->clut; + data = logo->data; for (i = 0; i < logo->clutsize; i++) { newport_bfwait(npregs); diff --git a/drivers/video/gxt4500.c b/drivers/video/gxt4500.c index 23a6bcc3e3c..e92337bef50 100644 --- a/drivers/video/gxt4500.c +++ b/drivers/video/gxt4500.c @@ -636,7 +636,7 @@ static int __devinit gxt4500_probe(struct pci_dev *pdev, info = framebuffer_alloc(sizeof(struct gxt4500_par), &pdev->dev); if (!info) { - dev_err(&pdev->dev, "gxt4500: cannot alloc FB info record"); + dev_err(&pdev->dev, "gxt4500: cannot alloc FB info record\n"); goto err_free_fb; } par = info->par; diff --git a/drivers/video/logo/logo.c b/drivers/video/logo/logo.c index a9283bae779..fc72684aae5 100644 --- a/drivers/video/logo/logo.c +++ b/drivers/video/logo/logo.c @@ -78,10 +78,7 @@ const struct linux_logo * __init_refok fb_find_logo(int depth) #endif #ifdef CONFIG_LOGO_DEC_CLUT224 /* DEC Linux logo on MIPS/MIPS64 or ALPHA */ -#ifndef CONFIG_ALPHA - if (mips_machgroup == MACH_GROUP_DEC) -#endif - logo = &logo_dec_clut224; + logo = &logo_dec_clut224; #endif #ifdef CONFIG_LOGO_MAC_CLUT224 /* Macintosh Linux logo on m68k */ @@ -94,10 +91,7 @@ const struct linux_logo * __init_refok fb_find_logo(int depth) #endif #ifdef CONFIG_LOGO_SGI_CLUT224 /* SGI Linux logo on MIPS/MIPS64 and VISWS */ -#ifndef CONFIG_X86_VISWS - if (mips_machgroup == MACH_GROUP_SGI) -#endif - logo = &logo_sgi_clut224; + logo = &logo_sgi_clut224; #endif #ifdef CONFIG_LOGO_SUN_CLUT224 /* Sun Linux logo */ diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c index 42f5d76a877..8d81ef019c6 100644 --- a/drivers/video/modedb.c +++ b/drivers/video/modedb.c @@ -510,7 +510,9 @@ int fb_find_mode(struct fb_var_screeninfo *var, default_bpp = 8; /* Did the user specify a video mode? */ - if (mode_option || (mode_option = fb_mode_option)) { + if (!mode_option) + mode_option = fb_mode_option; + if (mode_option) { const char *name = mode_option; unsigned int namelen = strlen(name); int res_specified = 0, bpp_specified = 0, refresh_specified = 0; diff --git a/drivers/video/omap/blizzard.c b/drivers/video/omap/blizzard.c index e682940a97a..4d8ad9cd0e1 100644 --- a/drivers/video/omap/blizzard.c +++ b/drivers/video/omap/blizzard.c @@ -225,7 +225,7 @@ static void blizzard_restart_sdram(void) while (!(blizzard_read_reg(BLIZZARD_MEM_BANK0_STATUS) & 0x01)) { if (time_after(jiffies, tmo)) { dev_err(blizzard.fbdev->dev, - "s1d1374x: SDRAM not ready"); + "s1d1374x: SDRAM not ready\n"); break; } msleep(1); diff --git a/drivers/video/omap/dispc.c b/drivers/video/omap/dispc.c index f4c23434de6..ab32ceb0617 100644 --- a/drivers/video/omap/dispc.c +++ b/drivers/video/omap/dispc.c @@ -880,19 +880,19 @@ static irqreturn_t omap_dispc_irq_handler(int irq, void *dev) static int get_dss_clocks(void) { if (IS_ERR((dispc.dss_ick = clk_get(dispc.fbdev->dev, "dss_ick")))) { - dev_err(dispc.fbdev->dev, "can't get dss_ick"); + dev_err(dispc.fbdev->dev, "can't get dss_ick\n"); return PTR_ERR(dispc.dss_ick); } if (IS_ERR((dispc.dss1_fck = clk_get(dispc.fbdev->dev, "dss1_fck")))) { - dev_err(dispc.fbdev->dev, "can't get dss1_fck"); + dev_err(dispc.fbdev->dev, "can't get dss1_fck\n"); clk_put(dispc.dss_ick); return PTR_ERR(dispc.dss1_fck); } if (IS_ERR((dispc.dss_54m_fck = clk_get(dispc.fbdev->dev, "dss_54m_fck")))) { - dev_err(dispc.fbdev->dev, "can't get dss_54m_fck"); + dev_err(dispc.fbdev->dev, "can't get dss_54m_fck\n"); clk_put(dispc.dss_ick); clk_put(dispc.dss1_fck); return PTR_ERR(dispc.dss_54m_fck); diff --git a/drivers/video/omap/hwa742.c b/drivers/video/omap/hwa742.c index dc48e02f215..1e642b7a20f 100644 --- a/drivers/video/omap/hwa742.c +++ b/drivers/video/omap/hwa742.c @@ -508,7 +508,7 @@ int hwa742_update_window_async(struct fb_info *fbi, if (unlikely(win->format & ~(0x03 | OMAPFB_FORMAT_FLAG_DOUBLE | OMAPFB_FORMAT_FLAG_TEARSYNC | OMAPFB_FORMAT_FLAG_FORCE_VSYNC))) { - dev_dbg(hwa742.fbdev->dev, "invalid window flag"); + dev_dbg(hwa742.fbdev->dev, "invalid window flag\n"); r = -EINVAL; goto out; } diff --git a/drivers/video/omap/rfbi.c b/drivers/video/omap/rfbi.c index 2b4269813b2..789cfd23c36 100644 --- a/drivers/video/omap/rfbi.c +++ b/drivers/video/omap/rfbi.c @@ -84,12 +84,12 @@ static inline u32 rfbi_read_reg(int idx) static int rfbi_get_clocks(void) { if (IS_ERR((rfbi.dss_ick = clk_get(rfbi.fbdev->dev, "dss_ick")))) { - dev_err(rfbi.fbdev->dev, "can't get dss_ick"); + dev_err(rfbi.fbdev->dev, "can't get dss_ick\n"); return PTR_ERR(rfbi.dss_ick); } if (IS_ERR((rfbi.dss1_fck = clk_get(rfbi.fbdev->dev, "dss1_fck")))) { - dev_err(rfbi.fbdev->dev, "can't get dss1_fck"); + dev_err(rfbi.fbdev->dev, "can't get dss1_fck\n"); clk_put(rfbi.dss_ick); return PTR_ERR(rfbi.dss1_fck); } diff --git a/drivers/w1/masters/ds1wm.c b/drivers/w1/masters/ds1wm.c index 4b696641ce3..5747997f8d7 100644 --- a/drivers/w1/masters/ds1wm.c +++ b/drivers/w1/masters/ds1wm.c @@ -307,7 +307,7 @@ static void ds1wm_search(void *data, u8 search_type, rom_id |= (unsigned long long) r << (i * 4); } - dev_dbg(&ds1wm_data->pdev->dev, "found 0x%08llX", rom_id); + dev_dbg(&ds1wm_data->pdev->dev, "found 0x%08llX\n", rom_id); ds1wm_write_register(ds1wm_data, DS1WM_CMD, ~DS1WM_CMD_SRA); ds1wm_reset(ds1wm_data); diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c index 0b769f7c4a4..4750de316ad 100644 --- a/drivers/xen/xenbus/xenbus_probe.c +++ b/drivers/xen/xenbus/xenbus_probe.c @@ -185,13 +185,14 @@ static void otherend_changed(struct xenbus_watch *watch, if (!dev->otherend || strncmp(dev->otherend, vec[XS_WATCH_PATH], strlen(dev->otherend))) { - dev_dbg(&dev->dev, "Ignoring watch at %s", vec[XS_WATCH_PATH]); + dev_dbg(&dev->dev, "Ignoring watch at %s\n", + vec[XS_WATCH_PATH]); return; } state = xenbus_read_driver_state(dev->otherend); - dev_dbg(&dev->dev, "state is %d, (%s), %s, %s", + dev_dbg(&dev->dev, "state is %d, (%s), %s, %s\n", state, xenbus_strstate(state), dev->otherend_watch.node, vec[XS_WATCH_PATH]); |