diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-11-29 03:55:47 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-11-29 03:55:47 -0500 |
commit | b71d4da092801634d04190693a38ca03bdbe2505 (patch) | |
tree | e4adc88ade5832b844768c114b15d4d97253c4d0 /drivers | |
parent | 656563e32c3f1dfdc35b3944305ece1c5dfeade5 (diff) | |
parent | 624f54be206adf970cd8eece16446b027913e533 (diff) |
Merge branch 'master'
Diffstat (limited to 'drivers')
76 files changed, 1391 insertions, 708 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 03204bfd17af..fa601b085eba 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c | |||
@@ -133,7 +133,7 @@ static struct kobj_type ktype_bus = { | |||
133 | decl_subsys(bus, &ktype_bus, NULL); | 133 | decl_subsys(bus, &ktype_bus, NULL); |
134 | 134 | ||
135 | 135 | ||
136 | /* Manually detach a device from it's associated driver. */ | 136 | /* Manually detach a device from its associated driver. */ |
137 | static int driver_helper(struct device *dev, void *data) | 137 | static int driver_helper(struct device *dev, void *data) |
138 | { | 138 | { |
139 | const char *name = data; | 139 | const char *name = data; |
@@ -151,14 +151,13 @@ static ssize_t driver_unbind(struct device_driver *drv, | |||
151 | int err = -ENODEV; | 151 | int err = -ENODEV; |
152 | 152 | ||
153 | dev = bus_find_device(bus, NULL, (void *)buf, driver_helper); | 153 | dev = bus_find_device(bus, NULL, (void *)buf, driver_helper); |
154 | if ((dev) && | 154 | if (dev && dev->driver == drv) { |
155 | (dev->driver == drv)) { | ||
156 | device_release_driver(dev); | 155 | device_release_driver(dev); |
157 | err = count; | 156 | err = count; |
158 | } | 157 | } |
159 | if (err) | 158 | put_device(dev); |
160 | return err; | 159 | put_bus(bus); |
161 | return count; | 160 | return err; |
162 | } | 161 | } |
163 | static DRIVER_ATTR(unbind, S_IWUSR, NULL, driver_unbind); | 162 | static DRIVER_ATTR(unbind, S_IWUSR, NULL, driver_unbind); |
164 | 163 | ||
@@ -175,16 +174,14 @@ static ssize_t driver_bind(struct device_driver *drv, | |||
175 | int err = -ENODEV; | 174 | int err = -ENODEV; |
176 | 175 | ||
177 | dev = bus_find_device(bus, NULL, (void *)buf, driver_helper); | 176 | dev = bus_find_device(bus, NULL, (void *)buf, driver_helper); |
178 | if ((dev) && | 177 | if (dev && dev->driver == NULL) { |
179 | (dev->driver == NULL)) { | ||
180 | down(&dev->sem); | 178 | down(&dev->sem); |
181 | err = driver_probe_device(drv, dev); | 179 | err = driver_probe_device(drv, dev); |
182 | up(&dev->sem); | 180 | up(&dev->sem); |
183 | put_device(dev); | ||
184 | } | 181 | } |
185 | if (err) | 182 | put_device(dev); |
186 | return err; | 183 | put_bus(bus); |
187 | return count; | 184 | return err; |
188 | } | 185 | } |
189 | static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind); | 186 | static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind); |
190 | 187 | ||
diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 3565e9795301..3b419c9a1e7e 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c | |||
@@ -62,7 +62,6 @@ void device_bind_driver(struct device * dev) | |||
62 | * because we don't know the format of the ID structures, nor what | 62 | * because we don't know the format of the ID structures, nor what |
63 | * is to be considered a match and what is not. | 63 | * is to be considered a match and what is not. |
64 | * | 64 | * |
65 | * | ||
66 | * This function returns 1 if a match is found, an error if one | 65 | * This function returns 1 if a match is found, an error if one |
67 | * occurs (that is not -ENODEV or -ENXIO), and 0 otherwise. | 66 | * occurs (that is not -ENODEV or -ENXIO), and 0 otherwise. |
68 | * | 67 | * |
@@ -158,7 +157,6 @@ static int __driver_attach(struct device * dev, void * data) | |||
158 | driver_probe_device(drv, dev); | 157 | driver_probe_device(drv, dev); |
159 | up(&dev->sem); | 158 | up(&dev->sem); |
160 | 159 | ||
161 | |||
162 | return 0; | 160 | return 0; |
163 | } | 161 | } |
164 | 162 | ||
@@ -225,15 +223,15 @@ void driver_detach(struct device_driver * drv) | |||
225 | struct device * dev; | 223 | struct device * dev; |
226 | 224 | ||
227 | for (;;) { | 225 | for (;;) { |
228 | spin_lock_irq(&drv->klist_devices.k_lock); | 226 | spin_lock(&drv->klist_devices.k_lock); |
229 | if (list_empty(&drv->klist_devices.k_list)) { | 227 | if (list_empty(&drv->klist_devices.k_list)) { |
230 | spin_unlock_irq(&drv->klist_devices.k_lock); | 228 | spin_unlock(&drv->klist_devices.k_lock); |
231 | break; | 229 | break; |
232 | } | 230 | } |
233 | dev = list_entry(drv->klist_devices.k_list.prev, | 231 | dev = list_entry(drv->klist_devices.k_list.prev, |
234 | struct device, knode_driver.n_node); | 232 | struct device, knode_driver.n_node); |
235 | get_device(dev); | 233 | get_device(dev); |
236 | spin_unlock_irq(&drv->klist_devices.k_lock); | 234 | spin_unlock(&drv->klist_devices.k_lock); |
237 | 235 | ||
238 | down(&dev->sem); | 236 | down(&dev->sem); |
239 | if (dev->driver == drv) | 237 | if (dev->driver == drv) |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 13b8a9bed66e..f7e765a1d313 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -3714,12 +3714,6 @@ static int floppy_open(struct inode *inode, struct file *filp) | |||
3714 | USETF(FD_VERIFY); | 3714 | USETF(FD_VERIFY); |
3715 | } | 3715 | } |
3716 | 3716 | ||
3717 | /* set underlying gendisk policy to reflect real ro/rw status */ | ||
3718 | if (UTESTF(FD_DISK_WRITABLE)) | ||
3719 | inode->i_bdev->bd_disk->policy = 0; | ||
3720 | else | ||
3721 | inode->i_bdev->bd_disk->policy = 1; | ||
3722 | |||
3723 | if (UDRS->fd_ref == -1 || (UDRS->fd_ref && (filp->f_flags & O_EXCL))) | 3717 | if (UDRS->fd_ref == -1 || (UDRS->fd_ref && (filp->f_flags & O_EXCL))) |
3724 | goto out2; | 3718 | goto out2; |
3725 | 3719 | ||
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c index 76589782adcb..810679dcbbb0 100644 --- a/drivers/char/agp/amd64-agp.c +++ b/drivers/char/agp/amd64-agp.c | |||
@@ -416,7 +416,7 @@ static void __devinit amd8151_init(struct pci_dev *pdev, struct agp_bridge_data | |||
416 | } | 416 | } |
417 | 417 | ||
418 | 418 | ||
419 | static struct aper_size_info_32 uli_sizes[7] = | 419 | static const struct aper_size_info_32 uli_sizes[7] = |
420 | { | 420 | { |
421 | {256, 65536, 6, 10}, | 421 | {256, 65536, 6, 10}, |
422 | {128, 32768, 5, 9}, | 422 | {128, 32768, 5, 9}, |
@@ -470,7 +470,7 @@ static int __devinit uli_agp_init(struct pci_dev *pdev) | |||
470 | } | 470 | } |
471 | 471 | ||
472 | 472 | ||
473 | static struct aper_size_info_32 nforce3_sizes[5] = | 473 | static const struct aper_size_info_32 nforce3_sizes[5] = |
474 | { | 474 | { |
475 | {512, 131072, 7, 0x00000000 }, | 475 | {512, 131072, 7, 0x00000000 }, |
476 | {256, 65536, 6, 0x00000008 }, | 476 | {256, 65536, 6, 0x00000008 }, |
diff --git a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c index 27bca34b4a65..80ee17a8fc23 100644 --- a/drivers/char/agp/backend.c +++ b/drivers/char/agp/backend.c | |||
@@ -97,7 +97,7 @@ void agp_backend_release(struct agp_bridge_data *bridge) | |||
97 | EXPORT_SYMBOL(agp_backend_release); | 97 | EXPORT_SYMBOL(agp_backend_release); |
98 | 98 | ||
99 | 99 | ||
100 | static struct { int mem, agp; } maxes_table[] = { | 100 | static const struct { int mem, agp; } maxes_table[] = { |
101 | {0, 0}, | 101 | {0, 0}, |
102 | {32, 4}, | 102 | {32, 4}, |
103 | {64, 28}, | 103 | {64, 28}, |
diff --git a/drivers/char/agp/via-agp.c b/drivers/char/agp/via-agp.c index c847df575cf5..97b0a890ba7f 100644 --- a/drivers/char/agp/via-agp.c +++ b/drivers/char/agp/via-agp.c | |||
@@ -371,6 +371,11 @@ static struct agp_device_ids via_agp_device_ids[] __devinitdata = | |||
371 | .device_id = PCI_DEVICE_ID_VIA_3296_0, | 371 | .device_id = PCI_DEVICE_ID_VIA_3296_0, |
372 | .chipset_name = "P4M800", | 372 | .chipset_name = "P4M800", |
373 | }, | 373 | }, |
374 | /* P4M800CE */ | ||
375 | { | ||
376 | .device_id = PCI_DEVICE_ID_VIA_P4M800CE, | ||
377 | .chipset_name = "P4M800CE", | ||
378 | }, | ||
374 | 379 | ||
375 | { }, /* dummy final entry, always present */ | 380 | { }, /* dummy final entry, always present */ |
376 | }; | 381 | }; |
@@ -511,6 +516,7 @@ static struct pci_device_id agp_via_pci_table[] = { | |||
511 | ID(PCI_DEVICE_ID_VIA_3269_0), | 516 | ID(PCI_DEVICE_ID_VIA_3269_0), |
512 | ID(PCI_DEVICE_ID_VIA_83_87XX_1), | 517 | ID(PCI_DEVICE_ID_VIA_83_87XX_1), |
513 | ID(PCI_DEVICE_ID_VIA_3296_0), | 518 | ID(PCI_DEVICE_ID_VIA_3296_0), |
519 | ID(PCI_DEVICE_ID_VIA_P4M800CE), | ||
514 | { } | 520 | { } |
515 | }; | 521 | }; |
516 | 522 | ||
diff --git a/drivers/char/drm/drm_lock.c b/drivers/char/drm/drm_lock.c index b276ae8a6633..b48a595d54ec 100644 --- a/drivers/char/drm/drm_lock.c +++ b/drivers/char/drm/drm_lock.c | |||
@@ -104,6 +104,10 @@ int drm_lock(struct inode *inode, struct file *filp, | |||
104 | __set_current_state(TASK_RUNNING); | 104 | __set_current_state(TASK_RUNNING); |
105 | remove_wait_queue(&dev->lock.lock_queue, &entry); | 105 | remove_wait_queue(&dev->lock.lock_queue, &entry); |
106 | 106 | ||
107 | DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock"); | ||
108 | if (ret) | ||
109 | return ret; | ||
110 | |||
107 | sigemptyset(&dev->sigmask); | 111 | sigemptyset(&dev->sigmask); |
108 | sigaddset(&dev->sigmask, SIGSTOP); | 112 | sigaddset(&dev->sigmask, SIGSTOP); |
109 | sigaddset(&dev->sigmask, SIGTSTP); | 113 | sigaddset(&dev->sigmask, SIGTSTP); |
@@ -116,8 +120,12 @@ int drm_lock(struct inode *inode, struct file *filp, | |||
116 | if (dev->driver->dma_ready && (lock.flags & _DRM_LOCK_READY)) | 120 | if (dev->driver->dma_ready && (lock.flags & _DRM_LOCK_READY)) |
117 | dev->driver->dma_ready(dev); | 121 | dev->driver->dma_ready(dev); |
118 | 122 | ||
119 | if (dev->driver->dma_quiescent && (lock.flags & _DRM_LOCK_QUIESCENT)) | 123 | if (dev->driver->dma_quiescent && (lock.flags & _DRM_LOCK_QUIESCENT)) { |
120 | return dev->driver->dma_quiescent(dev); | 124 | if (dev->driver->dma_quiescent(dev)) { |
125 | DRM_DEBUG("%d waiting for DMA quiescent\n", lock.context); | ||
126 | return DRM_ERR(EBUSY); | ||
127 | } | ||
128 | } | ||
121 | 129 | ||
122 | /* dev->driver->kernel_context_switch isn't used by any of the x86 | 130 | /* dev->driver->kernel_context_switch isn't used by any of the x86 |
123 | * drivers but is used by the Sparc driver. | 131 | * drivers but is used by the Sparc driver. |
@@ -128,9 +136,7 @@ int drm_lock(struct inode *inode, struct file *filp, | |||
128 | dev->driver->kernel_context_switch(dev, dev->last_context, | 136 | dev->driver->kernel_context_switch(dev, dev->last_context, |
129 | lock.context); | 137 | lock.context); |
130 | } | 138 | } |
131 | DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock"); | 139 | return 0; |
132 | |||
133 | return ret; | ||
134 | } | 140 | } |
135 | 141 | ||
136 | /** | 142 | /** |
diff --git a/drivers/char/drm/drm_memory.c b/drivers/char/drm/drm_memory.c index 2c74155aa84f..abef2acf99f5 100644 --- a/drivers/char/drm/drm_memory.c +++ b/drivers/char/drm/drm_memory.c | |||
@@ -95,7 +95,7 @@ unsigned long drm_alloc_pages(int order, int area) | |||
95 | unsigned long addr; | 95 | unsigned long addr; |
96 | unsigned int sz; | 96 | unsigned int sz; |
97 | 97 | ||
98 | address = __get_free_pages(GFP_KERNEL, order); | 98 | address = __get_free_pages(GFP_KERNEL|__GFP_COMP, order); |
99 | if (!address) | 99 | if (!address) |
100 | return 0; | 100 | return 0; |
101 | 101 | ||
diff --git a/drivers/char/drm/drm_memory_debug.h b/drivers/char/drm/drm_memory_debug.h index 4542353195bd..b370aca718d2 100644 --- a/drivers/char/drm/drm_memory_debug.h +++ b/drivers/char/drm/drm_memory_debug.h | |||
@@ -221,7 +221,7 @@ unsigned long DRM(alloc_pages) (int order, int area) { | |||
221 | } | 221 | } |
222 | spin_unlock(&DRM(mem_lock)); | 222 | spin_unlock(&DRM(mem_lock)); |
223 | 223 | ||
224 | address = __get_free_pages(GFP_KERNEL, order); | 224 | address = __get_free_pages(GFP_KERNEL|__GFP_COMP, order); |
225 | if (!address) { | 225 | if (!address) { |
226 | spin_lock(&DRM(mem_lock)); | 226 | spin_lock(&DRM(mem_lock)); |
227 | ++DRM(mem_stats)[area].fail_count; | 227 | ++DRM(mem_stats)[area].fail_count; |
diff --git a/drivers/char/drm/mga_drv.c b/drivers/char/drm/mga_drv.c index 0cc7c305a7f6..1713451a5cc6 100644 --- a/drivers/char/drm/mga_drv.c +++ b/drivers/char/drm/mga_drv.c | |||
@@ -161,7 +161,7 @@ static int mga_driver_device_is_agp(drm_device_t * dev) | |||
161 | * device. | 161 | * device. |
162 | */ | 162 | */ |
163 | 163 | ||
164 | if ((pdev->device == 0x0525) | 164 | if ((pdev->device == 0x0525) && pdev->bus->self |
165 | && (pdev->bus->self->vendor == 0x3388) | 165 | && (pdev->bus->self->vendor == 0x3388) |
166 | && (pdev->bus->self->device == 0x0021)) { | 166 | && (pdev->bus->self->device == 0x0021)) { |
167 | return 0; | 167 | return 0; |
diff --git a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h index 120ee5a8ebcc..7bda7e33d2bd 100644 --- a/drivers/char/drm/radeon_drv.h +++ b/drivers/char/drm/radeon_drv.h | |||
@@ -214,8 +214,6 @@ typedef struct drm_radeon_private { | |||
214 | 214 | ||
215 | int microcode_version; | 215 | int microcode_version; |
216 | 216 | ||
217 | int is_pci; | ||
218 | |||
219 | struct { | 217 | struct { |
220 | u32 boxes; | 218 | u32 boxes; |
221 | int freelist_timeouts; | 219 | int freelist_timeouts; |
@@ -275,6 +273,7 @@ typedef struct drm_radeon_private { | |||
275 | 273 | ||
276 | /* starting from here on, data is preserved accross an open */ | 274 | /* starting from here on, data is preserved accross an open */ |
277 | uint32_t flags; /* see radeon_chip_flags */ | 275 | uint32_t flags; /* see radeon_chip_flags */ |
276 | int is_pci; | ||
278 | } drm_radeon_private_t; | 277 | } drm_radeon_private_t; |
279 | 278 | ||
280 | typedef struct drm_radeon_buf_priv { | 279 | typedef struct drm_radeon_buf_priv { |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 23a63207d747..815902c2c856 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -693,8 +693,8 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev) | |||
693 | unsigned int cpu = sys_dev->id; | 693 | unsigned int cpu = sys_dev->id; |
694 | unsigned long flags; | 694 | unsigned long flags; |
695 | struct cpufreq_policy *data; | 695 | struct cpufreq_policy *data; |
696 | struct sys_device *cpu_sys_dev; | ||
697 | #ifdef CONFIG_SMP | 696 | #ifdef CONFIG_SMP |
697 | struct sys_device *cpu_sys_dev; | ||
698 | unsigned int j; | 698 | unsigned int j; |
699 | #endif | 699 | #endif |
700 | 700 | ||
@@ -1113,21 +1113,13 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy, | |||
1113 | { | 1113 | { |
1114 | int retval = -EINVAL; | 1114 | int retval = -EINVAL; |
1115 | 1115 | ||
1116 | /* | 1116 | lock_cpu_hotplug(); |
1117 | * If we are already in context of hotplug thread, we dont need to | ||
1118 | * acquire the hotplug lock. Otherwise acquire cpucontrol to prevent | ||
1119 | * hotplug from removing this cpu that we are working on. | ||
1120 | */ | ||
1121 | if (!current_in_cpu_hotplug()) | ||
1122 | lock_cpu_hotplug(); | ||
1123 | |||
1124 | dprintk("target for CPU %u: %u kHz, relation %u\n", policy->cpu, | 1117 | dprintk("target for CPU %u: %u kHz, relation %u\n", policy->cpu, |
1125 | target_freq, relation); | 1118 | target_freq, relation); |
1126 | if (cpu_online(policy->cpu) && cpufreq_driver->target) | 1119 | if (cpu_online(policy->cpu) && cpufreq_driver->target) |
1127 | retval = cpufreq_driver->target(policy, target_freq, relation); | 1120 | retval = cpufreq_driver->target(policy, target_freq, relation); |
1128 | 1121 | ||
1129 | if (!current_in_cpu_hotplug()) | 1122 | unlock_cpu_hotplug(); |
1130 | unlock_cpu_hotplug(); | ||
1131 | 1123 | ||
1132 | return retval; | 1124 | return retval; |
1133 | } | 1125 | } |
diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig index b6815c6c29a2..1e371a510dd2 100644 --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig | |||
@@ -60,6 +60,7 @@ config EFI_PCDP | |||
60 | 60 | ||
61 | config DELL_RBU | 61 | config DELL_RBU |
62 | tristate "BIOS update support for DELL systems via sysfs" | 62 | tristate "BIOS update support for DELL systems via sysfs" |
63 | depends on X86 | ||
63 | select FW_LOADER | 64 | select FW_LOADER |
64 | help | 65 | help |
65 | Say m if you want to have the option of updating the BIOS for your | 66 | Say m if you want to have the option of updating the BIOS for your |
diff --git a/drivers/hwmon/hdaps.c b/drivers/hwmon/hdaps.c index c81bd4bce1b8..23a9e1ea8e32 100644 --- a/drivers/hwmon/hdaps.c +++ b/drivers/hwmon/hdaps.c | |||
@@ -570,7 +570,7 @@ static int __init hdaps_init(void) | |||
570 | hdaps_idev->evbit[0] = BIT(EV_ABS); | 570 | hdaps_idev->evbit[0] = BIT(EV_ABS); |
571 | input_set_abs_params(hdaps_idev, ABS_X, | 571 | input_set_abs_params(hdaps_idev, ABS_X, |
572 | -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT); | 572 | -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT); |
573 | input_set_abs_params(hdaps_idev, ABS_X, | 573 | input_set_abs_params(hdaps_idev, ABS_Y, |
574 | -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT); | 574 | -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT); |
575 | 575 | ||
576 | input_register_device(hdaps_idev); | 576 | input_register_device(hdaps_idev); |
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index 6c41e25e670b..a61f5d00f10a 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c | |||
@@ -522,8 +522,15 @@ static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr, | |||
522 | struct i2c_client *client = to_i2c_client(dev); | 522 | struct i2c_client *client = to_i2c_client(dev); |
523 | struct it87_data *data = i2c_get_clientdata(client); | 523 | struct it87_data *data = i2c_get_clientdata(client); |
524 | int val = simple_strtol(buf, NULL, 10); | 524 | int val = simple_strtol(buf, NULL, 10); |
525 | u8 reg = it87_read_value(client, IT87_REG_FAN_DIV); | ||
525 | 526 | ||
526 | down(&data->update_lock); | 527 | down(&data->update_lock); |
528 | switch (nr) { | ||
529 | case 0: data->fan_div[nr] = reg & 0x07; break; | ||
530 | case 1: data->fan_div[nr] = (reg >> 3) & 0x07; break; | ||
531 | case 2: data->fan_div[nr] = (reg & 0x40) ? 3 : 1; break; | ||
532 | } | ||
533 | |||
527 | data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr])); | 534 | data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr])); |
528 | it87_write_value(client, IT87_REG_FAN_MIN(nr), data->fan_min[nr]); | 535 | it87_write_value(client, IT87_REG_FAN_MIN(nr), data->fan_min[nr]); |
529 | up(&data->update_lock); | 536 | up(&data->update_lock); |
diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c index bde0cda9477e..78cdd506439f 100644 --- a/drivers/hwmon/lm78.c +++ b/drivers/hwmon/lm78.c | |||
@@ -451,7 +451,7 @@ static DEVICE_ATTR(fan3_div, S_IRUGO, show_fan_3_div, NULL); | |||
451 | static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf) | 451 | static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf) |
452 | { | 452 | { |
453 | struct lm78_data *data = lm78_update_device(dev); | 453 | struct lm78_data *data = lm78_update_device(dev); |
454 | return sprintf(buf, "%d\n", vid_from_reg(82, data->vid)); | 454 | return sprintf(buf, "%d\n", vid_from_reg(data->vid, 82)); |
455 | } | 455 | } |
456 | static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); | 456 | static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); |
457 | 457 | ||
diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c index 4e9a04e1f08e..bbb3dcde146b 100644 --- a/drivers/hwmon/w83627hf.c +++ b/drivers/hwmon/w83627hf.c | |||
@@ -456,7 +456,9 @@ static ssize_t store_regs_in_min0(struct device *dev, struct device_attribute *a | |||
456 | (w83627thf == data->type || w83637hf == data->type)) | 456 | (w83627thf == data->type || w83637hf == data->type)) |
457 | 457 | ||
458 | /* use VRM9 calculation */ | 458 | /* use VRM9 calculation */ |
459 | data->in_min[0] = (u8)(((val * 100) - 70000 + 244) / 488); | 459 | data->in_min[0] = |
460 | SENSORS_LIMIT(((val * 100) - 70000 + 244) / 488, 0, | ||
461 | 255); | ||
460 | else | 462 | else |
461 | /* use VRM8 (standard) calculation */ | 463 | /* use VRM8 (standard) calculation */ |
462 | data->in_min[0] = IN_TO_REG(val); | 464 | data->in_min[0] = IN_TO_REG(val); |
@@ -481,7 +483,9 @@ static ssize_t store_regs_in_max0(struct device *dev, struct device_attribute *a | |||
481 | (w83627thf == data->type || w83637hf == data->type)) | 483 | (w83627thf == data->type || w83637hf == data->type)) |
482 | 484 | ||
483 | /* use VRM9 calculation */ | 485 | /* use VRM9 calculation */ |
484 | data->in_max[0] = (u8)(((val * 100) - 70000 + 244) / 488); | 486 | data->in_max[0] = |
487 | SENSORS_LIMIT(((val * 100) - 70000 + 244) / 488, 0, | ||
488 | 255); | ||
485 | else | 489 | else |
486 | /* use VRM8 (standard) calculation */ | 490 | /* use VRM8 (standard) calculation */ |
487 | data->in_max[0] = IN_TO_REG(val); | 491 | data->in_max[0] = IN_TO_REG(val); |
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index 12cec7c4a342..f7e18ccc5c0a 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -2350,6 +2350,7 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid, int dest | |||
2350 | struct scsi_cmnd *SCpnt = NULL; | 2350 | struct scsi_cmnd *SCpnt = NULL; |
2351 | u32 scsi_status = SBP2_SCSI_STATUS_GOOD; | 2351 | u32 scsi_status = SBP2_SCSI_STATUS_GOOD; |
2352 | struct sbp2_command_info *command; | 2352 | struct sbp2_command_info *command; |
2353 | unsigned long flags; | ||
2353 | 2354 | ||
2354 | SBP2_DEBUG("sbp2_handle_status_write"); | 2355 | SBP2_DEBUG("sbp2_handle_status_write"); |
2355 | 2356 | ||
@@ -2451,9 +2452,11 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid, int dest | |||
2451 | * null out last orb so that next time around we write directly to the orb pointer... | 2452 | * null out last orb so that next time around we write directly to the orb pointer... |
2452 | * Quick start saves one 1394 bus transaction. | 2453 | * Quick start saves one 1394 bus transaction. |
2453 | */ | 2454 | */ |
2455 | spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); | ||
2454 | if (list_empty(&scsi_id->sbp2_command_orb_inuse)) { | 2456 | if (list_empty(&scsi_id->sbp2_command_orb_inuse)) { |
2455 | scsi_id->last_orb = NULL; | 2457 | scsi_id->last_orb = NULL; |
2456 | } | 2458 | } |
2459 | spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); | ||
2457 | 2460 | ||
2458 | } else { | 2461 | } else { |
2459 | 2462 | ||
@@ -2563,9 +2566,11 @@ static void sbp2scsi_complete_all_commands(struct scsi_id_instance_data *scsi_id | |||
2563 | struct sbp2scsi_host_info *hi = scsi_id->hi; | 2566 | struct sbp2scsi_host_info *hi = scsi_id->hi; |
2564 | struct list_head *lh; | 2567 | struct list_head *lh; |
2565 | struct sbp2_command_info *command; | 2568 | struct sbp2_command_info *command; |
2569 | unsigned long flags; | ||
2566 | 2570 | ||
2567 | SBP2_DEBUG("sbp2scsi_complete_all_commands"); | 2571 | SBP2_DEBUG("sbp2scsi_complete_all_commands"); |
2568 | 2572 | ||
2573 | spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); | ||
2569 | while (!list_empty(&scsi_id->sbp2_command_orb_inuse)) { | 2574 | while (!list_empty(&scsi_id->sbp2_command_orb_inuse)) { |
2570 | SBP2_DEBUG("Found pending command to complete"); | 2575 | SBP2_DEBUG("Found pending command to complete"); |
2571 | lh = scsi_id->sbp2_command_orb_inuse.next; | 2576 | lh = scsi_id->sbp2_command_orb_inuse.next; |
@@ -2582,6 +2587,7 @@ static void sbp2scsi_complete_all_commands(struct scsi_id_instance_data *scsi_id | |||
2582 | command->Current_done(command->Current_SCpnt); | 2587 | command->Current_done(command->Current_SCpnt); |
2583 | } | 2588 | } |
2584 | } | 2589 | } |
2590 | spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); | ||
2585 | 2591 | ||
2586 | return; | 2592 | return; |
2587 | } | 2593 | } |
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index 41d6b4017acb..d393b504bf26 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c | |||
@@ -355,9 +355,9 @@ error4: | |||
355 | spin_unlock_irqrestore(&port_priv->reg_lock, flags); | 355 | spin_unlock_irqrestore(&port_priv->reg_lock, flags); |
356 | kfree(reg_req); | 356 | kfree(reg_req); |
357 | error3: | 357 | error3: |
358 | kfree(mad_agent_priv); | ||
359 | error2: | ||
360 | ib_dereg_mr(mad_agent_priv->agent.mr); | 358 | ib_dereg_mr(mad_agent_priv->agent.mr); |
359 | error2: | ||
360 | kfree(mad_agent_priv); | ||
361 | error1: | 361 | error1: |
362 | return ret; | 362 | return ret; |
363 | } | 363 | } |
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c index 0506934244f0..caac6d63d46f 100644 --- a/drivers/input/gameport/gameport.c +++ b/drivers/input/gameport/gameport.c | |||
@@ -339,14 +339,20 @@ static struct gameport_event *gameport_get_event(void) | |||
339 | return event; | 339 | return event; |
340 | } | 340 | } |
341 | 341 | ||
342 | static void gameport_handle_events(void) | 342 | static void gameport_handle_event(void) |
343 | { | 343 | { |
344 | struct gameport_event *event; | 344 | struct gameport_event *event; |
345 | struct gameport_driver *gameport_drv; | 345 | struct gameport_driver *gameport_drv; |
346 | 346 | ||
347 | down(&gameport_sem); | 347 | down(&gameport_sem); |
348 | 348 | ||
349 | while ((event = gameport_get_event())) { | 349 | /* |
350 | * Note that we handle only one event here to give swsusp | ||
351 | * a chance to freeze kgameportd thread. Gameport events | ||
352 | * should be pretty rare so we are not concerned about | ||
353 | * taking performance hit. | ||
354 | */ | ||
355 | if ((event = gameport_get_event())) { | ||
350 | 356 | ||
351 | switch (event->type) { | 357 | switch (event->type) { |
352 | case GAMEPORT_REGISTER_PORT: | 358 | case GAMEPORT_REGISTER_PORT: |
@@ -433,7 +439,7 @@ static struct gameport *gameport_get_pending_child(struct gameport *parent) | |||
433 | static int gameport_thread(void *nothing) | 439 | static int gameport_thread(void *nothing) |
434 | { | 440 | { |
435 | do { | 441 | do { |
436 | gameport_handle_events(); | 442 | gameport_handle_event(); |
437 | wait_event_interruptible(gameport_wait, | 443 | wait_event_interruptible(gameport_wait, |
438 | kthread_should_stop() || !list_empty(&gameport_event_list)); | 444 | kthread_should_stop() || !list_empty(&gameport_event_list)); |
439 | try_to_freeze(); | 445 | try_to_freeze(); |
diff --git a/drivers/input/input.c b/drivers/input/input.c index c8ae2bb054e0..bdd2a7fc268d 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -536,7 +536,7 @@ static struct attribute *input_dev_attrs[] = { | |||
536 | NULL | 536 | NULL |
537 | }; | 537 | }; |
538 | 538 | ||
539 | static struct attribute_group input_dev_group = { | 539 | static struct attribute_group input_dev_attr_group = { |
540 | .attrs = input_dev_attrs, | 540 | .attrs = input_dev_attrs, |
541 | }; | 541 | }; |
542 | 542 | ||
@@ -717,35 +717,14 @@ struct input_dev *input_allocate_device(void) | |||
717 | return dev; | 717 | return dev; |
718 | } | 718 | } |
719 | 719 | ||
720 | static void input_register_classdevice(struct input_dev *dev) | ||
721 | { | ||
722 | static atomic_t input_no = ATOMIC_INIT(0); | ||
723 | const char *path; | ||
724 | |||
725 | __module_get(THIS_MODULE); | ||
726 | |||
727 | dev->dev = dev->cdev.dev; | ||
728 | |||
729 | snprintf(dev->cdev.class_id, sizeof(dev->cdev.class_id), | ||
730 | "input%ld", (unsigned long) atomic_inc_return(&input_no) - 1); | ||
731 | |||
732 | path = kobject_get_path(&dev->cdev.class->subsys.kset.kobj, GFP_KERNEL); | ||
733 | printk(KERN_INFO "input: %s as %s/%s\n", | ||
734 | dev->name ? dev->name : "Unspecified device", | ||
735 | path ? path : "", dev->cdev.class_id); | ||
736 | kfree(path); | ||
737 | |||
738 | class_device_add(&dev->cdev); | ||
739 | sysfs_create_group(&dev->cdev.kobj, &input_dev_group); | ||
740 | sysfs_create_group(&dev->cdev.kobj, &input_dev_id_attr_group); | ||
741 | sysfs_create_group(&dev->cdev.kobj, &input_dev_caps_attr_group); | ||
742 | } | ||
743 | |||
744 | int input_register_device(struct input_dev *dev) | 720 | int input_register_device(struct input_dev *dev) |
745 | { | 721 | { |
722 | static atomic_t input_no = ATOMIC_INIT(0); | ||
746 | struct input_handle *handle; | 723 | struct input_handle *handle; |
747 | struct input_handler *handler; | 724 | struct input_handler *handler; |
748 | struct input_device_id *id; | 725 | struct input_device_id *id; |
726 | const char *path; | ||
727 | int error; | ||
749 | 728 | ||
750 | if (!dev->dynalloc) { | 729 | if (!dev->dynalloc) { |
751 | printk(KERN_WARNING "input: device %s is statically allocated, will not register\n" | 730 | printk(KERN_WARNING "input: device %s is statically allocated, will not register\n" |
@@ -773,7 +752,32 @@ int input_register_device(struct input_dev *dev) | |||
773 | INIT_LIST_HEAD(&dev->h_list); | 752 | INIT_LIST_HEAD(&dev->h_list); |
774 | list_add_tail(&dev->node, &input_dev_list); | 753 | list_add_tail(&dev->node, &input_dev_list); |
775 | 754 | ||
776 | input_register_classdevice(dev); | 755 | dev->cdev.class = &input_class; |
756 | snprintf(dev->cdev.class_id, sizeof(dev->cdev.class_id), | ||
757 | "input%ld", (unsigned long) atomic_inc_return(&input_no) - 1); | ||
758 | |||
759 | error = class_device_add(&dev->cdev); | ||
760 | if (error) | ||
761 | return error; | ||
762 | |||
763 | error = sysfs_create_group(&dev->cdev.kobj, &input_dev_attr_group); | ||
764 | if (error) | ||
765 | goto fail1; | ||
766 | |||
767 | error = sysfs_create_group(&dev->cdev.kobj, &input_dev_id_attr_group); | ||
768 | if (error) | ||
769 | goto fail2; | ||
770 | |||
771 | error = sysfs_create_group(&dev->cdev.kobj, &input_dev_caps_attr_group); | ||
772 | if (error) | ||
773 | goto fail3; | ||
774 | |||
775 | __module_get(THIS_MODULE); | ||
776 | |||
777 | path = kobject_get_path(&dev->cdev.kobj, GFP_KERNEL); | ||
778 | printk(KERN_INFO "input: %s as %s\n", | ||
779 | dev->name ? dev->name : "Unspecified device", path ? path : "N/A"); | ||
780 | kfree(path); | ||
777 | 781 | ||
778 | list_for_each_entry(handler, &input_handler_list, node) | 782 | list_for_each_entry(handler, &input_handler_list, node) |
779 | if (!handler->blacklist || !input_match_device(handler->blacklist, dev)) | 783 | if (!handler->blacklist || !input_match_device(handler->blacklist, dev)) |
@@ -784,6 +788,11 @@ int input_register_device(struct input_dev *dev) | |||
784 | input_wakeup_procfs_readers(); | 788 | input_wakeup_procfs_readers(); |
785 | 789 | ||
786 | return 0; | 790 | return 0; |
791 | |||
792 | fail3: sysfs_remove_group(&dev->cdev.kobj, &input_dev_id_attr_group); | ||
793 | fail2: sysfs_remove_group(&dev->cdev.kobj, &input_dev_attr_group); | ||
794 | fail1: class_device_del(&dev->cdev); | ||
795 | return error; | ||
787 | } | 796 | } |
788 | 797 | ||
789 | void input_unregister_device(struct input_dev *dev) | 798 | void input_unregister_device(struct input_dev *dev) |
@@ -805,7 +814,7 @@ void input_unregister_device(struct input_dev *dev) | |||
805 | 814 | ||
806 | sysfs_remove_group(&dev->cdev.kobj, &input_dev_caps_attr_group); | 815 | sysfs_remove_group(&dev->cdev.kobj, &input_dev_caps_attr_group); |
807 | sysfs_remove_group(&dev->cdev.kobj, &input_dev_id_attr_group); | 816 | sysfs_remove_group(&dev->cdev.kobj, &input_dev_id_attr_group); |
808 | sysfs_remove_group(&dev->cdev.kobj, &input_dev_group); | 817 | sysfs_remove_group(&dev->cdev.kobj, &input_dev_attr_group); |
809 | class_device_unregister(&dev->cdev); | 818 | class_device_unregister(&dev->cdev); |
810 | 819 | ||
811 | input_wakeup_procfs_readers(); | 820 | input_wakeup_procfs_readers(); |
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index 820c7fd9a604..a0256f8de8ef 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c | |||
@@ -166,6 +166,9 @@ static unsigned char atkbd_unxlate_table[128] = { | |||
166 | 166 | ||
167 | #define ATKBD_SPECIAL 248 | 167 | #define ATKBD_SPECIAL 248 |
168 | 168 | ||
169 | #define ATKBD_LED_EVENT_BIT 0 | ||
170 | #define ATKBD_REP_EVENT_BIT 1 | ||
171 | |||
169 | static struct { | 172 | static struct { |
170 | unsigned char keycode; | 173 | unsigned char keycode; |
171 | unsigned char set2; | 174 | unsigned char set2; |
@@ -211,6 +214,10 @@ struct atkbd { | |||
211 | unsigned char err_xl; | 214 | unsigned char err_xl; |
212 | unsigned int last; | 215 | unsigned int last; |
213 | unsigned long time; | 216 | unsigned long time; |
217 | |||
218 | struct work_struct event_work; | ||
219 | struct semaphore event_sem; | ||
220 | unsigned long event_mask; | ||
214 | }; | 221 | }; |
215 | 222 | ||
216 | static ssize_t atkbd_attr_show_helper(struct device *dev, char *buf, | 223 | static ssize_t atkbd_attr_show_helper(struct device *dev, char *buf, |
@@ -424,58 +431,86 @@ out: | |||
424 | } | 431 | } |
425 | 432 | ||
426 | /* | 433 | /* |
427 | * Event callback from the input module. Events that change the state of | 434 | * atkbd_event_work() is used to complete processing of events that |
428 | * the hardware are processed here. | 435 | * can not be processed by input_event() which is often called from |
436 | * interrupt context. | ||
429 | */ | 437 | */ |
430 | 438 | ||
431 | static int atkbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) | 439 | static void atkbd_event_work(void *data) |
432 | { | 440 | { |
433 | struct atkbd *atkbd = dev->private; | ||
434 | const short period[32] = | 441 | const short period[32] = |
435 | { 33, 37, 42, 46, 50, 54, 58, 63, 67, 75, 83, 92, 100, 109, 116, 125, | 442 | { 33, 37, 42, 46, 50, 54, 58, 63, 67, 75, 83, 92, 100, 109, 116, 125, |
436 | 133, 149, 167, 182, 200, 217, 232, 250, 270, 303, 333, 370, 400, 435, 470, 500 }; | 443 | 133, 149, 167, 182, 200, 217, 232, 250, 270, 303, 333, 370, 400, 435, 470, 500 }; |
437 | const short delay[4] = | 444 | const short delay[4] = |
438 | { 250, 500, 750, 1000 }; | 445 | { 250, 500, 750, 1000 }; |
446 | |||
447 | struct atkbd *atkbd = data; | ||
448 | struct input_dev *dev = atkbd->dev; | ||
439 | unsigned char param[2]; | 449 | unsigned char param[2]; |
440 | int i, j; | 450 | int i, j; |
441 | 451 | ||
452 | down(&atkbd->event_sem); | ||
453 | |||
454 | if (test_and_clear_bit(ATKBD_LED_EVENT_BIT, &atkbd->event_mask)) { | ||
455 | param[0] = (test_bit(LED_SCROLLL, dev->led) ? 1 : 0) | ||
456 | | (test_bit(LED_NUML, dev->led) ? 2 : 0) | ||
457 | | (test_bit(LED_CAPSL, dev->led) ? 4 : 0); | ||
458 | ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_SETLEDS); | ||
459 | |||
460 | if (atkbd->extra) { | ||
461 | param[0] = 0; | ||
462 | param[1] = (test_bit(LED_COMPOSE, dev->led) ? 0x01 : 0) | ||
463 | | (test_bit(LED_SLEEP, dev->led) ? 0x02 : 0) | ||
464 | | (test_bit(LED_SUSPEND, dev->led) ? 0x04 : 0) | ||
465 | | (test_bit(LED_MISC, dev->led) ? 0x10 : 0) | ||
466 | | (test_bit(LED_MUTE, dev->led) ? 0x20 : 0); | ||
467 | ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_EX_SETLEDS); | ||
468 | } | ||
469 | } | ||
470 | |||
471 | if (test_and_clear_bit(ATKBD_REP_EVENT_BIT, &atkbd->event_mask)) { | ||
472 | i = j = 0; | ||
473 | while (i < 31 && period[i] < dev->rep[REP_PERIOD]) | ||
474 | i++; | ||
475 | while (j < 3 && delay[j] < dev->rep[REP_DELAY]) | ||
476 | j++; | ||
477 | dev->rep[REP_PERIOD] = period[i]; | ||
478 | dev->rep[REP_DELAY] = delay[j]; | ||
479 | param[0] = i | (j << 5); | ||
480 | ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_SETREP); | ||
481 | } | ||
482 | |||
483 | up(&atkbd->event_sem); | ||
484 | } | ||
485 | |||
486 | /* | ||
487 | * Event callback from the input module. Events that change the state of | ||
488 | * the hardware are processed here. If action can not be performed in | ||
489 | * interrupt context it is offloaded to atkbd_event_work. | ||
490 | */ | ||
491 | |||
492 | static int atkbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) | ||
493 | { | ||
494 | struct atkbd *atkbd = dev->private; | ||
495 | |||
442 | if (!atkbd->write) | 496 | if (!atkbd->write) |
443 | return -1; | 497 | return -1; |
444 | 498 | ||
445 | switch (type) { | 499 | switch (type) { |
446 | 500 | ||
447 | case EV_LED: | 501 | case EV_LED: |
448 | 502 | set_bit(ATKBD_LED_EVENT_BIT, &atkbd->event_mask); | |
449 | param[0] = (test_bit(LED_SCROLLL, dev->led) ? 1 : 0) | 503 | wmb(); |
450 | | (test_bit(LED_NUML, dev->led) ? 2 : 0) | 504 | schedule_work(&atkbd->event_work); |
451 | | (test_bit(LED_CAPSL, dev->led) ? 4 : 0); | ||
452 | ps2_schedule_command(&atkbd->ps2dev, param, ATKBD_CMD_SETLEDS); | ||
453 | |||
454 | if (atkbd->extra) { | ||
455 | param[0] = 0; | ||
456 | param[1] = (test_bit(LED_COMPOSE, dev->led) ? 0x01 : 0) | ||
457 | | (test_bit(LED_SLEEP, dev->led) ? 0x02 : 0) | ||
458 | | (test_bit(LED_SUSPEND, dev->led) ? 0x04 : 0) | ||
459 | | (test_bit(LED_MISC, dev->led) ? 0x10 : 0) | ||
460 | | (test_bit(LED_MUTE, dev->led) ? 0x20 : 0); | ||
461 | ps2_schedule_command(&atkbd->ps2dev, param, ATKBD_CMD_EX_SETLEDS); | ||
462 | } | ||
463 | |||
464 | return 0; | 505 | return 0; |
465 | 506 | ||
466 | case EV_REP: | 507 | case EV_REP: |
467 | 508 | ||
468 | if (atkbd->softrepeat) return 0; | 509 | if (!atkbd->softrepeat) { |
469 | 510 | set_bit(ATKBD_REP_EVENT_BIT, &atkbd->event_mask); | |
470 | i = j = 0; | 511 | wmb(); |
471 | while (i < 31 && period[i] < dev->rep[REP_PERIOD]) | 512 | schedule_work(&atkbd->event_work); |
472 | i++; | 513 | } |
473 | while (j < 3 && delay[j] < dev->rep[REP_DELAY]) | ||
474 | j++; | ||
475 | dev->rep[REP_PERIOD] = period[i]; | ||
476 | dev->rep[REP_DELAY] = delay[j]; | ||
477 | param[0] = i | (j << 5); | ||
478 | ps2_schedule_command(&atkbd->ps2dev, param, ATKBD_CMD_SETREP); | ||
479 | 514 | ||
480 | return 0; | 515 | return 0; |
481 | } | 516 | } |
@@ -810,6 +845,8 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv) | |||
810 | 845 | ||
811 | atkbd->dev = dev; | 846 | atkbd->dev = dev; |
812 | ps2_init(&atkbd->ps2dev, serio); | 847 | ps2_init(&atkbd->ps2dev, serio); |
848 | INIT_WORK(&atkbd->event_work, atkbd_event_work, atkbd); | ||
849 | init_MUTEX(&atkbd->event_sem); | ||
813 | 850 | ||
814 | switch (serio->id.type) { | 851 | switch (serio->id.type) { |
815 | 852 | ||
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index b3eaac1b35b6..07813fc0523f 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig | |||
@@ -40,6 +40,16 @@ config INPUT_M68K_BEEP | |||
40 | tristate "M68k Beeper support" | 40 | tristate "M68k Beeper support" |
41 | depends on M68K | 41 | depends on M68K |
42 | 42 | ||
43 | config INPUT_WISTRON_BTNS | ||
44 | tristate "x86 Wistron laptop button interface" | ||
45 | depends on X86 && !X86_64 | ||
46 | help | ||
47 | Say Y here for support of Winstron laptop button interface, used on | ||
48 | laptops of various brands, including Acer and Fujitsu-Siemens. | ||
49 | |||
50 | To compile this driver as a module, choose M here: the module will | ||
51 | be called wistron_btns. | ||
52 | |||
43 | config INPUT_UINPUT | 53 | config INPUT_UINPUT |
44 | tristate "User level driver support" | 54 | tristate "User level driver support" |
45 | help | 55 | help |
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile index f8d01c69f349..ce44cce01285 100644 --- a/drivers/input/misc/Makefile +++ b/drivers/input/misc/Makefile | |||
@@ -9,4 +9,5 @@ obj-$(CONFIG_INPUT_PCSPKR) += pcspkr.o | |||
9 | obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o | 9 | obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o |
10 | obj-$(CONFIG_INPUT_98SPKR) += 98spkr.o | 10 | obj-$(CONFIG_INPUT_98SPKR) += 98spkr.o |
11 | obj-$(CONFIG_INPUT_UINPUT) += uinput.o | 11 | obj-$(CONFIG_INPUT_UINPUT) += uinput.o |
12 | obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o | ||
12 | obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o | 13 | obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o |
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c index 948c1cc01bc9..546ed9b4901d 100644 --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c | |||
@@ -92,24 +92,19 @@ static void uinput_request_done(struct uinput_device *udev, struct uinput_reques | |||
92 | { | 92 | { |
93 | /* Mark slot as available */ | 93 | /* Mark slot as available */ |
94 | udev->requests[request->id] = NULL; | 94 | udev->requests[request->id] = NULL; |
95 | wake_up_interruptible(&udev->requests_waitq); | 95 | wake_up(&udev->requests_waitq); |
96 | 96 | ||
97 | complete(&request->done); | 97 | complete(&request->done); |
98 | } | 98 | } |
99 | 99 | ||
100 | static int uinput_request_submit(struct input_dev *dev, struct uinput_request *request) | 100 | static int uinput_request_submit(struct input_dev *dev, struct uinput_request *request) |
101 | { | 101 | { |
102 | int retval; | ||
103 | |||
104 | /* Tell our userspace app about this new request by queueing an input event */ | 102 | /* Tell our userspace app about this new request by queueing an input event */ |
105 | uinput_dev_event(dev, EV_UINPUT, request->code, request->id); | 103 | uinput_dev_event(dev, EV_UINPUT, request->code, request->id); |
106 | 104 | ||
107 | /* Wait for the request to complete */ | 105 | /* Wait for the request to complete */ |
108 | retval = wait_for_completion_interruptible(&request->done); | 106 | wait_for_completion(&request->done); |
109 | if (!retval) | 107 | return request->retval; |
110 | retval = request->retval; | ||
111 | |||
112 | return retval; | ||
113 | } | 108 | } |
114 | 109 | ||
115 | static int uinput_dev_upload_effect(struct input_dev *dev, struct ff_effect *effect) | 110 | static int uinput_dev_upload_effect(struct input_dev *dev, struct ff_effect *effect) |
@@ -152,67 +147,62 @@ static int uinput_dev_erase_effect(struct input_dev *dev, int effect_id) | |||
152 | return retval; | 147 | return retval; |
153 | } | 148 | } |
154 | 149 | ||
155 | static int uinput_create_device(struct uinput_device *udev) | 150 | static void uinput_destroy_device(struct uinput_device *udev) |
156 | { | 151 | { |
157 | if (!udev->dev->name) { | 152 | const char *name, *phys; |
158 | printk(KERN_DEBUG "%s: write device info first\n", UINPUT_NAME); | 153 | |
159 | return -EINVAL; | 154 | if (udev->dev) { |
155 | name = udev->dev->name; | ||
156 | phys = udev->dev->phys; | ||
157 | if (udev->state == UIST_CREATED) | ||
158 | input_unregister_device(udev->dev); | ||
159 | else | ||
160 | input_free_device(udev->dev); | ||
161 | kfree(name); | ||
162 | kfree(phys); | ||
163 | udev->dev = NULL; | ||
160 | } | 164 | } |
161 | 165 | ||
162 | udev->dev->event = uinput_dev_event; | 166 | udev->state = UIST_NEW_DEVICE; |
163 | udev->dev->upload_effect = uinput_dev_upload_effect; | ||
164 | udev->dev->erase_effect = uinput_dev_erase_effect; | ||
165 | udev->dev->private = udev; | ||
166 | |||
167 | init_waitqueue_head(&udev->waitq); | ||
168 | |||
169 | input_register_device(udev->dev); | ||
170 | |||
171 | set_bit(UIST_CREATED, &udev->state); | ||
172 | |||
173 | return 0; | ||
174 | } | 167 | } |
175 | 168 | ||
176 | static int uinput_destroy_device(struct uinput_device *udev) | 169 | static int uinput_create_device(struct uinput_device *udev) |
177 | { | 170 | { |
178 | if (!test_bit(UIST_CREATED, &udev->state)) { | 171 | int error; |
179 | printk(KERN_WARNING "%s: create the device first\n", UINPUT_NAME); | 172 | |
173 | if (udev->state != UIST_SETUP_COMPLETE) { | ||
174 | printk(KERN_DEBUG "%s: write device info first\n", UINPUT_NAME); | ||
180 | return -EINVAL; | 175 | return -EINVAL; |
181 | } | 176 | } |
182 | 177 | ||
183 | input_unregister_device(udev->dev); | 178 | error = input_register_device(udev->dev); |
179 | if (error) { | ||
180 | uinput_destroy_device(udev); | ||
181 | return error; | ||
182 | } | ||
184 | 183 | ||
185 | clear_bit(UIST_CREATED, &udev->state); | 184 | udev->state = UIST_CREATED; |
186 | 185 | ||
187 | return 0; | 186 | return 0; |
188 | } | 187 | } |
189 | 188 | ||
190 | static int uinput_open(struct inode *inode, struct file *file) | 189 | static int uinput_open(struct inode *inode, struct file *file) |
191 | { | 190 | { |
192 | struct uinput_device *newdev; | 191 | struct uinput_device *newdev; |
193 | struct input_dev *newinput; | ||
194 | 192 | ||
195 | newdev = kmalloc(sizeof(struct uinput_device), GFP_KERNEL); | 193 | newdev = kzalloc(sizeof(struct uinput_device), GFP_KERNEL); |
196 | if (!newdev) | 194 | if (!newdev) |
197 | goto error; | 195 | return -ENOMEM; |
198 | memset(newdev, 0, sizeof(struct uinput_device)); | 196 | |
197 | init_MUTEX(&newdev->sem); | ||
199 | spin_lock_init(&newdev->requests_lock); | 198 | spin_lock_init(&newdev->requests_lock); |
200 | init_waitqueue_head(&newdev->requests_waitq); | 199 | init_waitqueue_head(&newdev->requests_waitq); |
201 | 200 | init_waitqueue_head(&newdev->waitq); | |
202 | newinput = kmalloc(sizeof(struct input_dev), GFP_KERNEL); | 201 | newdev->state = UIST_NEW_DEVICE; |
203 | if (!newinput) | ||
204 | goto cleanup; | ||
205 | memset(newinput, 0, sizeof(struct input_dev)); | ||
206 | |||
207 | newdev->dev = newinput; | ||
208 | 202 | ||
209 | file->private_data = newdev; | 203 | file->private_data = newdev; |
210 | 204 | ||
211 | return 0; | 205 | return 0; |
212 | cleanup: | ||
213 | kfree(newdev); | ||
214 | error: | ||
215 | return -ENOMEM; | ||
216 | } | 206 | } |
217 | 207 | ||
218 | static int uinput_validate_absbits(struct input_dev *dev) | 208 | static int uinput_validate_absbits(struct input_dev *dev) |
@@ -246,34 +236,55 @@ static int uinput_validate_absbits(struct input_dev *dev) | |||
246 | return retval; | 236 | return retval; |
247 | } | 237 | } |
248 | 238 | ||
249 | static int uinput_alloc_device(struct file *file, const char __user *buffer, size_t count) | 239 | static int uinput_allocate_device(struct uinput_device *udev) |
240 | { | ||
241 | udev->dev = input_allocate_device(); | ||
242 | if (!udev->dev) | ||
243 | return -ENOMEM; | ||
244 | |||
245 | udev->dev->event = uinput_dev_event; | ||
246 | udev->dev->upload_effect = uinput_dev_upload_effect; | ||
247 | udev->dev->erase_effect = uinput_dev_erase_effect; | ||
248 | udev->dev->private = udev; | ||
249 | |||
250 | return 0; | ||
251 | } | ||
252 | |||
253 | static int uinput_setup_device(struct uinput_device *udev, const char __user *buffer, size_t count) | ||
250 | { | 254 | { |
251 | struct uinput_user_dev *user_dev; | 255 | struct uinput_user_dev *user_dev; |
252 | struct input_dev *dev; | 256 | struct input_dev *dev; |
253 | struct uinput_device *udev; | ||
254 | char *name; | 257 | char *name; |
255 | int size; | 258 | int size; |
256 | int retval; | 259 | int retval; |
257 | 260 | ||
258 | retval = count; | 261 | if (count != sizeof(struct uinput_user_dev)) |
262 | return -EINVAL; | ||
263 | |||
264 | if (!udev->dev) { | ||
265 | retval = uinput_allocate_device(udev); | ||
266 | if (retval) | ||
267 | return retval; | ||
268 | } | ||
259 | 269 | ||
260 | udev = file->private_data; | ||
261 | dev = udev->dev; | 270 | dev = udev->dev; |
262 | 271 | ||
263 | user_dev = kmalloc(sizeof(struct uinput_user_dev), GFP_KERNEL); | 272 | user_dev = kmalloc(sizeof(struct uinput_user_dev), GFP_KERNEL); |
264 | if (!user_dev) { | 273 | if (!user_dev) |
265 | retval = -ENOMEM; | 274 | return -ENOMEM; |
266 | goto exit; | ||
267 | } | ||
268 | 275 | ||
269 | if (copy_from_user(user_dev, buffer, sizeof(struct uinput_user_dev))) { | 276 | if (copy_from_user(user_dev, buffer, sizeof(struct uinput_user_dev))) { |
270 | retval = -EFAULT; | 277 | retval = -EFAULT; |
271 | goto exit; | 278 | goto exit; |
272 | } | 279 | } |
273 | 280 | ||
274 | kfree(dev->name); | ||
275 | |||
276 | size = strnlen(user_dev->name, UINPUT_MAX_NAME_SIZE) + 1; | 281 | size = strnlen(user_dev->name, UINPUT_MAX_NAME_SIZE) + 1; |
282 | if (!size) { | ||
283 | retval = -EINVAL; | ||
284 | goto exit; | ||
285 | } | ||
286 | |||
287 | kfree(dev->name); | ||
277 | dev->name = name = kmalloc(size, GFP_KERNEL); | 288 | dev->name = name = kmalloc(size, GFP_KERNEL); |
278 | if (!name) { | 289 | if (!name) { |
279 | retval = -ENOMEM; | 290 | retval = -ENOMEM; |
@@ -296,32 +307,50 @@ static int uinput_alloc_device(struct file *file, const char __user *buffer, siz | |||
296 | /* check if absmin/absmax/absfuzz/absflat are filled as | 307 | /* check if absmin/absmax/absfuzz/absflat are filled as |
297 | * told in Documentation/input/input-programming.txt */ | 308 | * told in Documentation/input/input-programming.txt */ |
298 | if (test_bit(EV_ABS, dev->evbit)) { | 309 | if (test_bit(EV_ABS, dev->evbit)) { |
299 | int err = uinput_validate_absbits(dev); | 310 | retval = uinput_validate_absbits(dev); |
300 | if (err < 0) { | 311 | if (retval < 0) |
301 | retval = err; | 312 | goto exit; |
302 | kfree(dev->name); | ||
303 | } | ||
304 | } | 313 | } |
305 | 314 | ||
306 | exit: | 315 | udev->state = UIST_SETUP_COMPLETE; |
316 | retval = count; | ||
317 | |||
318 | exit: | ||
307 | kfree(user_dev); | 319 | kfree(user_dev); |
308 | return retval; | 320 | return retval; |
309 | } | 321 | } |
310 | 322 | ||
323 | static inline ssize_t uinput_inject_event(struct uinput_device *udev, const char __user *buffer, size_t count) | ||
324 | { | ||
325 | struct input_event ev; | ||
326 | |||
327 | if (count != sizeof(struct input_event)) | ||
328 | return -EINVAL; | ||
329 | |||
330 | if (copy_from_user(&ev, buffer, sizeof(struct input_event))) | ||
331 | return -EFAULT; | ||
332 | |||
333 | input_event(udev->dev, ev.type, ev.code, ev.value); | ||
334 | |||
335 | return sizeof(struct input_event); | ||
336 | } | ||
337 | |||
311 | static ssize_t uinput_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) | 338 | static ssize_t uinput_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) |
312 | { | 339 | { |
313 | struct uinput_device *udev = file->private_data; | 340 | struct uinput_device *udev = file->private_data; |
341 | int retval; | ||
342 | |||
343 | retval = down_interruptible(&udev->sem); | ||
344 | if (retval) | ||
345 | return retval; | ||
314 | 346 | ||
315 | if (test_bit(UIST_CREATED, &udev->state)) { | 347 | retval = udev->state == UIST_CREATED ? |
316 | struct input_event ev; | 348 | uinput_inject_event(udev, buffer, count) : |
349 | uinput_setup_device(udev, buffer, count); | ||
317 | 350 | ||
318 | if (copy_from_user(&ev, buffer, sizeof(struct input_event))) | 351 | up(&udev->sem); |
319 | return -EFAULT; | ||
320 | input_event(udev->dev, ev.type, ev.code, ev.value); | ||
321 | } else | ||
322 | count = uinput_alloc_device(file, buffer, count); | ||
323 | 352 | ||
324 | return count; | 353 | return retval; |
325 | } | 354 | } |
326 | 355 | ||
327 | static ssize_t uinput_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) | 356 | static ssize_t uinput_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) |
@@ -329,28 +358,38 @@ static ssize_t uinput_read(struct file *file, char __user *buffer, size_t count, | |||
329 | struct uinput_device *udev = file->private_data; | 358 | struct uinput_device *udev = file->private_data; |
330 | int retval = 0; | 359 | int retval = 0; |
331 | 360 | ||
332 | if (!test_bit(UIST_CREATED, &udev->state)) | 361 | if (udev->state != UIST_CREATED) |
333 | return -ENODEV; | 362 | return -ENODEV; |
334 | 363 | ||
335 | if (udev->head == udev->tail && (file->f_flags & O_NONBLOCK)) | 364 | if (udev->head == udev->tail && (file->f_flags & O_NONBLOCK)) |
336 | return -EAGAIN; | 365 | return -EAGAIN; |
337 | 366 | ||
338 | retval = wait_event_interruptible(udev->waitq, | 367 | retval = wait_event_interruptible(udev->waitq, |
339 | udev->head != udev->tail || !test_bit(UIST_CREATED, &udev->state)); | 368 | udev->head != udev->tail || udev->state != UIST_CREATED); |
340 | if (retval) | 369 | if (retval) |
341 | return retval; | 370 | return retval; |
342 | 371 | ||
343 | if (!test_bit(UIST_CREATED, &udev->state)) | 372 | retval = down_interruptible(&udev->sem); |
344 | return -ENODEV; | 373 | if (retval) |
374 | return retval; | ||
345 | 375 | ||
346 | while ((udev->head != udev->tail) && | 376 | if (udev->state != UIST_CREATED) { |
347 | (retval + sizeof(struct input_event) <= count)) { | 377 | retval = -ENODEV; |
348 | if (copy_to_user(buffer + retval, &udev->buff[udev->tail], sizeof(struct input_event))) | 378 | goto out; |
349 | return -EFAULT; | 379 | } |
380 | |||
381 | while (udev->head != udev->tail && retval + sizeof(struct input_event) <= count) { | ||
382 | if (copy_to_user(buffer + retval, &udev->buff[udev->tail], sizeof(struct input_event))) { | ||
383 | retval = -EFAULT; | ||
384 | goto out; | ||
385 | } | ||
350 | udev->tail = (udev->tail + 1) % UINPUT_BUFFER_SIZE; | 386 | udev->tail = (udev->tail + 1) % UINPUT_BUFFER_SIZE; |
351 | retval += sizeof(struct input_event); | 387 | retval += sizeof(struct input_event); |
352 | } | 388 | } |
353 | 389 | ||
390 | out: | ||
391 | up(&udev->sem); | ||
392 | |||
354 | return retval; | 393 | return retval; |
355 | } | 394 | } |
356 | 395 | ||
@@ -366,28 +405,30 @@ static unsigned int uinput_poll(struct file *file, poll_table *wait) | |||
366 | return 0; | 405 | return 0; |
367 | } | 406 | } |
368 | 407 | ||
369 | static int uinput_burn_device(struct uinput_device *udev) | 408 | static int uinput_release(struct inode *inode, struct file *file) |
370 | { | 409 | { |
371 | if (test_bit(UIST_CREATED, &udev->state)) | 410 | struct uinput_device *udev = file->private_data; |
372 | uinput_destroy_device(udev); | ||
373 | 411 | ||
374 | kfree(udev->dev->name); | 412 | uinput_destroy_device(udev); |
375 | kfree(udev->dev->phys); | ||
376 | kfree(udev->dev); | ||
377 | kfree(udev); | 413 | kfree(udev); |
378 | 414 | ||
379 | return 0; | 415 | return 0; |
380 | } | 416 | } |
381 | 417 | ||
382 | static int uinput_close(struct inode *inode, struct file *file) | 418 | #define uinput_set_bit(_arg, _bit, _max) \ |
419 | ({ \ | ||
420 | int __ret = 0; \ | ||
421 | if (udev->state == UIST_CREATED) \ | ||
422 | __ret = -EINVAL; \ | ||
423 | else if ((_arg) > (_max)) \ | ||
424 | __ret = -EINVAL; \ | ||
425 | else set_bit((_arg), udev->dev->_bit); \ | ||
426 | __ret; \ | ||
427 | }) | ||
428 | |||
429 | static long uinput_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | ||
383 | { | 430 | { |
384 | uinput_burn_device(file->private_data); | 431 | int retval; |
385 | return 0; | ||
386 | } | ||
387 | |||
388 | static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) | ||
389 | { | ||
390 | int retval = 0; | ||
391 | struct uinput_device *udev; | 432 | struct uinput_device *udev; |
392 | void __user *p = (void __user *)arg; | 433 | void __user *p = (void __user *)arg; |
393 | struct uinput_ff_upload ff_up; | 434 | struct uinput_ff_upload ff_up; |
@@ -398,19 +439,14 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
398 | 439 | ||
399 | udev = file->private_data; | 440 | udev = file->private_data; |
400 | 441 | ||
401 | /* device attributes can not be changed after the device is created */ | 442 | retval = down_interruptible(&udev->sem); |
402 | switch (cmd) { | 443 | if (retval) |
403 | case UI_SET_EVBIT: | 444 | return retval; |
404 | case UI_SET_KEYBIT: | 445 | |
405 | case UI_SET_RELBIT: | 446 | if (!udev->dev) { |
406 | case UI_SET_ABSBIT: | 447 | retval = uinput_allocate_device(udev); |
407 | case UI_SET_MSCBIT: | 448 | if (retval) |
408 | case UI_SET_LEDBIT: | 449 | goto out; |
409 | case UI_SET_SNDBIT: | ||
410 | case UI_SET_FFBIT: | ||
411 | case UI_SET_PHYS: | ||
412 | if (test_bit(UIST_CREATED, &udev->state)) | ||
413 | return -EINVAL; | ||
414 | } | 450 | } |
415 | 451 | ||
416 | switch (cmd) { | 452 | switch (cmd) { |
@@ -419,74 +455,50 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
419 | break; | 455 | break; |
420 | 456 | ||
421 | case UI_DEV_DESTROY: | 457 | case UI_DEV_DESTROY: |
422 | retval = uinput_destroy_device(udev); | 458 | uinput_destroy_device(udev); |
423 | break; | 459 | break; |
424 | 460 | ||
425 | case UI_SET_EVBIT: | 461 | case UI_SET_EVBIT: |
426 | if (arg > EV_MAX) { | 462 | retval = uinput_set_bit(arg, evbit, EV_MAX); |
427 | retval = -EINVAL; | ||
428 | break; | ||
429 | } | ||
430 | set_bit(arg, udev->dev->evbit); | ||
431 | break; | 463 | break; |
432 | 464 | ||
433 | case UI_SET_KEYBIT: | 465 | case UI_SET_KEYBIT: |
434 | if (arg > KEY_MAX) { | 466 | retval = uinput_set_bit(arg, keybit, KEY_MAX); |
435 | retval = -EINVAL; | ||
436 | break; | ||
437 | } | ||
438 | set_bit(arg, udev->dev->keybit); | ||
439 | break; | 467 | break; |
440 | 468 | ||
441 | case UI_SET_RELBIT: | 469 | case UI_SET_RELBIT: |
442 | if (arg > REL_MAX) { | 470 | retval = uinput_set_bit(arg, relbit, REL_MAX); |
443 | retval = -EINVAL; | ||
444 | break; | ||
445 | } | ||
446 | set_bit(arg, udev->dev->relbit); | ||
447 | break; | 471 | break; |
448 | 472 | ||
449 | case UI_SET_ABSBIT: | 473 | case UI_SET_ABSBIT: |
450 | if (arg > ABS_MAX) { | 474 | retval = uinput_set_bit(arg, absbit, ABS_MAX); |
451 | retval = -EINVAL; | ||
452 | break; | ||
453 | } | ||
454 | set_bit(arg, udev->dev->absbit); | ||
455 | break; | 475 | break; |
456 | 476 | ||
457 | case UI_SET_MSCBIT: | 477 | case UI_SET_MSCBIT: |
458 | if (arg > MSC_MAX) { | 478 | retval = uinput_set_bit(arg, mscbit, MSC_MAX); |
459 | retval = -EINVAL; | ||
460 | break; | ||
461 | } | ||
462 | set_bit(arg, udev->dev->mscbit); | ||
463 | break; | 479 | break; |
464 | 480 | ||
465 | case UI_SET_LEDBIT: | 481 | case UI_SET_LEDBIT: |
466 | if (arg > LED_MAX) { | 482 | retval = uinput_set_bit(arg, ledbit, LED_MAX); |
467 | retval = -EINVAL; | ||
468 | break; | ||
469 | } | ||
470 | set_bit(arg, udev->dev->ledbit); | ||
471 | break; | 483 | break; |
472 | 484 | ||
473 | case UI_SET_SNDBIT: | 485 | case UI_SET_SNDBIT: |
474 | if (arg > SND_MAX) { | 486 | retval = uinput_set_bit(arg, sndbit, SND_MAX); |
475 | retval = -EINVAL; | ||
476 | break; | ||
477 | } | ||
478 | set_bit(arg, udev->dev->sndbit); | ||
479 | break; | 487 | break; |
480 | 488 | ||
481 | case UI_SET_FFBIT: | 489 | case UI_SET_FFBIT: |
482 | if (arg > FF_MAX) { | 490 | retval = uinput_set_bit(arg, ffbit, FF_MAX); |
483 | retval = -EINVAL; | 491 | break; |
484 | break; | 492 | |
485 | } | 493 | case UI_SET_SWBIT: |
486 | set_bit(arg, udev->dev->ffbit); | 494 | retval = uinput_set_bit(arg, swbit, SW_MAX); |
487 | break; | 495 | break; |
488 | 496 | ||
489 | case UI_SET_PHYS: | 497 | case UI_SET_PHYS: |
498 | if (udev->state == UIST_CREATED) { | ||
499 | retval = -EINVAL; | ||
500 | goto out; | ||
501 | } | ||
490 | length = strnlen_user(p, 1024); | 502 | length = strnlen_user(p, 1024); |
491 | if (length <= 0) { | 503 | if (length <= 0) { |
492 | retval = -EFAULT; | 504 | retval = -EFAULT; |
@@ -575,23 +587,26 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
575 | default: | 587 | default: |
576 | retval = -EINVAL; | 588 | retval = -EINVAL; |
577 | } | 589 | } |
590 | |||
591 | out: | ||
592 | up(&udev->sem); | ||
578 | return retval; | 593 | return retval; |
579 | } | 594 | } |
580 | 595 | ||
581 | static struct file_operations uinput_fops = { | 596 | static struct file_operations uinput_fops = { |
582 | .owner = THIS_MODULE, | 597 | .owner = THIS_MODULE, |
583 | .open = uinput_open, | 598 | .open = uinput_open, |
584 | .release = uinput_close, | 599 | .release = uinput_release, |
585 | .read = uinput_read, | 600 | .read = uinput_read, |
586 | .write = uinput_write, | 601 | .write = uinput_write, |
587 | .poll = uinput_poll, | 602 | .poll = uinput_poll, |
588 | .ioctl = uinput_ioctl, | 603 | .unlocked_ioctl = uinput_ioctl, |
589 | }; | 604 | }; |
590 | 605 | ||
591 | static struct miscdevice uinput_misc = { | 606 | static struct miscdevice uinput_misc = { |
592 | .fops = &uinput_fops, | 607 | .fops = &uinput_fops, |
593 | .minor = UINPUT_MINOR, | 608 | .minor = UINPUT_MINOR, |
594 | .name = UINPUT_NAME, | 609 | .name = UINPUT_NAME, |
595 | }; | 610 | }; |
596 | 611 | ||
597 | static int __init uinput_init(void) | 612 | static int __init uinput_init(void) |
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c new file mode 100644 index 000000000000..49d0416a2a9a --- /dev/null +++ b/drivers/input/misc/wistron_btns.c | |||
@@ -0,0 +1,561 @@ | |||
1 | /* | ||
2 | * Wistron laptop button driver | ||
3 | * Copyright (C) 2005 Miloslav Trmac <mitr@volny.cz> | ||
4 | * Copyright (C) 2005 Bernhard Rosenkraenzer <bero@arklinux.org> | ||
5 | * Copyright (C) 2005 Dmitry Torokhov <dtor@mail.ru> | ||
6 | * | ||
7 | * You can redistribute and/or modify this program under the terms of the | ||
8 | * GNU General Public License version 2 as published by the Free Software | ||
9 | * Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but | ||
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
14 | * Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along | ||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | * 59 Temple Place Suite 330, Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | #include <asm/io.h> | ||
21 | #include <linux/dmi.h> | ||
22 | #include <linux/init.h> | ||
23 | #include <linux/input.h> | ||
24 | #include <linux/interrupt.h> | ||
25 | #include <linux/kernel.h> | ||
26 | #include <linux/mc146818rtc.h> | ||
27 | #include <linux/module.h> | ||
28 | #include <linux/preempt.h> | ||
29 | #include <linux/string.h> | ||
30 | #include <linux/timer.h> | ||
31 | #include <linux/types.h> | ||
32 | #include <linux/platform_device.h> | ||
33 | |||
34 | /* | ||
35 | * Number of attempts to read data from queue per poll; | ||
36 | * the queue can hold up to 31 entries | ||
37 | */ | ||
38 | #define MAX_POLL_ITERATIONS 64 | ||
39 | |||
40 | #define POLL_FREQUENCY 10 /* Number of polls per second */ | ||
41 | |||
42 | #if POLL_FREQUENCY > HZ | ||
43 | #error "POLL_FREQUENCY too high" | ||
44 | #endif | ||
45 | |||
46 | /* BIOS subsystem IDs */ | ||
47 | #define WIFI 0x35 | ||
48 | #define BLUETOOTH 0x34 | ||
49 | |||
50 | MODULE_AUTHOR("Miloslav Trmac <mitr@volny.cz>"); | ||
51 | MODULE_DESCRIPTION("Wistron laptop button driver"); | ||
52 | MODULE_LICENSE("GPL v2"); | ||
53 | MODULE_VERSION("0.1"); | ||
54 | |||
55 | static int force; /* = 0; */ | ||
56 | module_param(force, bool, 0); | ||
57 | MODULE_PARM_DESC(force, "Load even if computer is not in database"); | ||
58 | |||
59 | static char *keymap_name; /* = NULL; */ | ||
60 | module_param_named(keymap, keymap_name, charp, 0); | ||
61 | MODULE_PARM_DESC(keymap, "Keymap name, if it can't be autodetected"); | ||
62 | |||
63 | static struct platform_device *wistron_device; | ||
64 | |||
65 | /* BIOS interface implementation */ | ||
66 | |||
67 | static void __iomem *bios_entry_point; /* BIOS routine entry point */ | ||
68 | static void __iomem *bios_code_map_base; | ||
69 | static void __iomem *bios_data_map_base; | ||
70 | |||
71 | static u8 cmos_address; | ||
72 | |||
73 | struct regs { | ||
74 | u32 eax, ebx, ecx; | ||
75 | }; | ||
76 | |||
77 | static void call_bios(struct regs *regs) | ||
78 | { | ||
79 | unsigned long flags; | ||
80 | |||
81 | preempt_disable(); | ||
82 | local_irq_save(flags); | ||
83 | asm volatile ("pushl %%ebp;" | ||
84 | "movl %7, %%ebp;" | ||
85 | "call *%6;" | ||
86 | "popl %%ebp" | ||
87 | : "=a" (regs->eax), "=b" (regs->ebx), "=c" (regs->ecx) | ||
88 | : "0" (regs->eax), "1" (regs->ebx), "2" (regs->ecx), | ||
89 | "m" (bios_entry_point), "m" (bios_data_map_base) | ||
90 | : "edx", "edi", "esi", "memory"); | ||
91 | local_irq_restore(flags); | ||
92 | preempt_enable(); | ||
93 | } | ||
94 | |||
95 | static size_t __init locate_wistron_bios(void __iomem *base) | ||
96 | { | ||
97 | static const unsigned char __initdata signature[] = | ||
98 | { 0x42, 0x21, 0x55, 0x30 }; | ||
99 | size_t offset; | ||
100 | |||
101 | for (offset = 0; offset < 0x10000; offset += 0x10) { | ||
102 | if (check_signature(base + offset, signature, | ||
103 | sizeof(signature)) != 0) | ||
104 | return offset; | ||
105 | } | ||
106 | return -1; | ||
107 | } | ||
108 | |||
109 | static int __init map_bios(void) | ||
110 | { | ||
111 | void __iomem *base; | ||
112 | size_t offset; | ||
113 | u32 entry_point; | ||
114 | |||
115 | base = ioremap(0xF0000, 0x10000); /* Can't fail */ | ||
116 | offset = locate_wistron_bios(base); | ||
117 | if (offset < 0) { | ||
118 | printk(KERN_ERR "wistron_btns: BIOS entry point not found\n"); | ||
119 | iounmap(base); | ||
120 | return -ENODEV; | ||
121 | } | ||
122 | |||
123 | entry_point = readl(base + offset + 5); | ||
124 | printk(KERN_DEBUG | ||
125 | "wistron_btns: BIOS signature found at %p, entry point %08X\n", | ||
126 | base + offset, entry_point); | ||
127 | |||
128 | if (entry_point >= 0xF0000) { | ||
129 | bios_code_map_base = base; | ||
130 | bios_entry_point = bios_code_map_base + (entry_point & 0xFFFF); | ||
131 | } else { | ||
132 | iounmap(base); | ||
133 | bios_code_map_base = ioremap(entry_point & ~0x3FFF, 0x4000); | ||
134 | if (bios_code_map_base == NULL) { | ||
135 | printk(KERN_ERR | ||
136 | "wistron_btns: Can't map BIOS code at %08X\n", | ||
137 | entry_point & ~0x3FFF); | ||
138 | goto err; | ||
139 | } | ||
140 | bios_entry_point = bios_code_map_base + (entry_point & 0x3FFF); | ||
141 | } | ||
142 | /* The Windows driver maps 0x10000 bytes, we keep only one page... */ | ||
143 | bios_data_map_base = ioremap(0x400, 0xc00); | ||
144 | if (bios_data_map_base == NULL) { | ||
145 | printk(KERN_ERR "wistron_btns: Can't map BIOS data\n"); | ||
146 | goto err_code; | ||
147 | } | ||
148 | return 0; | ||
149 | |||
150 | err_code: | ||
151 | iounmap(bios_code_map_base); | ||
152 | err: | ||
153 | return -ENOMEM; | ||
154 | } | ||
155 | |||
156 | static inline void unmap_bios(void) | ||
157 | { | ||
158 | iounmap(bios_code_map_base); | ||
159 | iounmap(bios_data_map_base); | ||
160 | } | ||
161 | |||
162 | /* BIOS calls */ | ||
163 | |||
164 | static u16 bios_pop_queue(void) | ||
165 | { | ||
166 | struct regs regs; | ||
167 | |||
168 | memset(®s, 0, sizeof (regs)); | ||
169 | regs.eax = 0x9610; | ||
170 | regs.ebx = 0x061C; | ||
171 | regs.ecx = 0x0000; | ||
172 | call_bios(®s); | ||
173 | |||
174 | return regs.eax; | ||
175 | } | ||
176 | |||
177 | static void __init bios_attach(void) | ||
178 | { | ||
179 | struct regs regs; | ||
180 | |||
181 | memset(®s, 0, sizeof (regs)); | ||
182 | regs.eax = 0x9610; | ||
183 | regs.ebx = 0x012E; | ||
184 | call_bios(®s); | ||
185 | } | ||
186 | |||
187 | static void bios_detach(void) | ||
188 | { | ||
189 | struct regs regs; | ||
190 | |||
191 | memset(®s, 0, sizeof (regs)); | ||
192 | regs.eax = 0x9610; | ||
193 | regs.ebx = 0x002E; | ||
194 | call_bios(®s); | ||
195 | } | ||
196 | |||
197 | static u8 __init bios_get_cmos_address(void) | ||
198 | { | ||
199 | struct regs regs; | ||
200 | |||
201 | memset(®s, 0, sizeof (regs)); | ||
202 | regs.eax = 0x9610; | ||
203 | regs.ebx = 0x051C; | ||
204 | call_bios(®s); | ||
205 | |||
206 | return regs.ecx; | ||
207 | } | ||
208 | |||
209 | static u16 __init bios_get_default_setting(u8 subsys) | ||
210 | { | ||
211 | struct regs regs; | ||
212 | |||
213 | memset(®s, 0, sizeof (regs)); | ||
214 | regs.eax = 0x9610; | ||
215 | regs.ebx = 0x0200 | subsys; | ||
216 | call_bios(®s); | ||
217 | |||
218 | return regs.eax; | ||
219 | } | ||
220 | |||
221 | static void bios_set_state(u8 subsys, int enable) | ||
222 | { | ||
223 | struct regs regs; | ||
224 | |||
225 | memset(®s, 0, sizeof (regs)); | ||
226 | regs.eax = 0x9610; | ||
227 | regs.ebx = (enable ? 0x0100 : 0x0000) | subsys; | ||
228 | call_bios(®s); | ||
229 | } | ||
230 | |||
231 | /* Hardware database */ | ||
232 | |||
233 | struct key_entry { | ||
234 | char type; /* See KE_* below */ | ||
235 | u8 code; | ||
236 | unsigned keycode; /* For KE_KEY */ | ||
237 | }; | ||
238 | |||
239 | enum { KE_END, KE_KEY, KE_WIFI, KE_BLUETOOTH }; | ||
240 | |||
241 | static const struct key_entry *keymap; /* = NULL; Current key map */ | ||
242 | static int have_wifi; | ||
243 | static int have_bluetooth; | ||
244 | |||
245 | static int __init dmi_matched(struct dmi_system_id *dmi) | ||
246 | { | ||
247 | const struct key_entry *key; | ||
248 | |||
249 | keymap = dmi->driver_data; | ||
250 | for (key = keymap; key->type != KE_END; key++) { | ||
251 | if (key->type == KE_WIFI) { | ||
252 | have_wifi = 1; | ||
253 | break; | ||
254 | } else if (key->type == KE_BLUETOOTH) { | ||
255 | have_bluetooth = 1; | ||
256 | break; | ||
257 | } | ||
258 | } | ||
259 | return 1; | ||
260 | } | ||
261 | |||
262 | static struct key_entry keymap_empty[] = { | ||
263 | { KE_END, 0 } | ||
264 | }; | ||
265 | |||
266 | static struct key_entry keymap_fs_amilo_pro_v2000[] = { | ||
267 | { KE_KEY, 0x01, KEY_HELP }, | ||
268 | { KE_KEY, 0x11, KEY_PROG1 }, | ||
269 | { KE_KEY, 0x12, KEY_PROG2 }, | ||
270 | { KE_WIFI, 0x30, 0 }, | ||
271 | { KE_KEY, 0x31, KEY_MAIL }, | ||
272 | { KE_KEY, 0x36, KEY_WWW }, | ||
273 | { KE_END, 0 } | ||
274 | }; | ||
275 | |||
276 | static struct key_entry keymap_wistron_ms2141[] = { | ||
277 | { KE_KEY, 0x11, KEY_PROG1 }, | ||
278 | { KE_KEY, 0x12, KEY_PROG2 }, | ||
279 | { KE_WIFI, 0x30, 0 }, | ||
280 | { KE_KEY, 0x22, KEY_REWIND }, | ||
281 | { KE_KEY, 0x23, KEY_FORWARD }, | ||
282 | { KE_KEY, 0x24, KEY_PLAYPAUSE }, | ||
283 | { KE_KEY, 0x25, KEY_STOPCD }, | ||
284 | { KE_KEY, 0x31, KEY_MAIL }, | ||
285 | { KE_KEY, 0x36, KEY_WWW }, | ||
286 | { KE_END, 0 } | ||
287 | }; | ||
288 | |||
289 | static struct key_entry keymap_acer_aspire_1500[] = { | ||
290 | { KE_KEY, 0x11, KEY_PROG1 }, | ||
291 | { KE_KEY, 0x12, KEY_PROG2 }, | ||
292 | { KE_WIFI, 0x30, 0 }, | ||
293 | { KE_KEY, 0x31, KEY_MAIL }, | ||
294 | { KE_KEY, 0x36, KEY_WWW }, | ||
295 | { KE_BLUETOOTH, 0x44, 0 }, | ||
296 | { KE_END, 0 } | ||
297 | }; | ||
298 | |||
299 | /* | ||
300 | * If your machine is not here (which is currently rather likely), please send | ||
301 | * a list of buttons and their key codes (reported when loading this module | ||
302 | * with force=1) and the output of dmidecode to $MODULE_AUTHOR. | ||
303 | */ | ||
304 | static struct dmi_system_id dmi_ids[] = { | ||
305 | { | ||
306 | .callback = dmi_matched, | ||
307 | .ident = "Fujitsu-Siemens Amilo Pro V2000", | ||
308 | .matches = { | ||
309 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), | ||
310 | DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro V2000"), | ||
311 | }, | ||
312 | .driver_data = keymap_fs_amilo_pro_v2000 | ||
313 | }, | ||
314 | { | ||
315 | .callback = dmi_matched, | ||
316 | .ident = "Acer Aspire 1500", | ||
317 | .matches = { | ||
318 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
319 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1500"), | ||
320 | }, | ||
321 | .driver_data = keymap_acer_aspire_1500 | ||
322 | }, | ||
323 | { 0, } | ||
324 | }; | ||
325 | |||
326 | static int __init select_keymap(void) | ||
327 | { | ||
328 | if (keymap_name != NULL) { | ||
329 | if (strcmp (keymap_name, "1557/MS2141") == 0) | ||
330 | keymap = keymap_wistron_ms2141; | ||
331 | else { | ||
332 | printk(KERN_ERR "wistron_btns: Keymap unknown\n"); | ||
333 | return -EINVAL; | ||
334 | } | ||
335 | } | ||
336 | dmi_check_system(dmi_ids); | ||
337 | if (keymap == NULL) { | ||
338 | if (!force) { | ||
339 | printk(KERN_ERR "wistron_btns: System unknown\n"); | ||
340 | return -ENODEV; | ||
341 | } | ||
342 | keymap = keymap_empty; | ||
343 | } | ||
344 | return 0; | ||
345 | } | ||
346 | |||
347 | /* Input layer interface */ | ||
348 | |||
349 | static struct input_dev *input_dev; | ||
350 | |||
351 | static int __init setup_input_dev(void) | ||
352 | { | ||
353 | const struct key_entry *key; | ||
354 | int error; | ||
355 | |||
356 | input_dev = input_allocate_device(); | ||
357 | if (!input_dev) | ||
358 | return -ENOMEM; | ||
359 | |||
360 | input_dev->name = "Wistron laptop buttons"; | ||
361 | input_dev->phys = "wistron/input0"; | ||
362 | input_dev->id.bustype = BUS_HOST; | ||
363 | input_dev->cdev.dev = &wistron_device->dev; | ||
364 | |||
365 | for (key = keymap; key->type != KE_END; key++) { | ||
366 | if (key->type == KE_KEY) { | ||
367 | input_dev->evbit[LONG(EV_KEY)] = BIT(EV_KEY); | ||
368 | set_bit(key->keycode, input_dev->keybit); | ||
369 | } | ||
370 | } | ||
371 | |||
372 | error = input_register_device(input_dev); | ||
373 | if (error) { | ||
374 | input_free_device(input_dev); | ||
375 | return error; | ||
376 | } | ||
377 | |||
378 | return 0; | ||
379 | } | ||
380 | |||
381 | static void report_key(unsigned keycode) | ||
382 | { | ||
383 | input_report_key(input_dev, keycode, 1); | ||
384 | input_sync(input_dev); | ||
385 | input_report_key(input_dev, keycode, 0); | ||
386 | input_sync(input_dev); | ||
387 | } | ||
388 | |||
389 | /* Driver core */ | ||
390 | |||
391 | static int wifi_enabled; | ||
392 | static int bluetooth_enabled; | ||
393 | |||
394 | static void poll_bios(unsigned long); | ||
395 | |||
396 | static struct timer_list poll_timer = TIMER_INITIALIZER(poll_bios, 0, 0); | ||
397 | |||
398 | static void handle_key(u8 code) | ||
399 | { | ||
400 | const struct key_entry *key; | ||
401 | |||
402 | for (key = keymap; key->type != KE_END; key++) { | ||
403 | if (code == key->code) { | ||
404 | switch (key->type) { | ||
405 | case KE_KEY: | ||
406 | report_key(key->keycode); | ||
407 | break; | ||
408 | |||
409 | case KE_WIFI: | ||
410 | if (have_wifi) { | ||
411 | wifi_enabled = !wifi_enabled; | ||
412 | bios_set_state(WIFI, wifi_enabled); | ||
413 | } | ||
414 | break; | ||
415 | |||
416 | case KE_BLUETOOTH: | ||
417 | if (have_bluetooth) { | ||
418 | bluetooth_enabled = !bluetooth_enabled; | ||
419 | bios_set_state(BLUETOOTH, bluetooth_enabled); | ||
420 | } | ||
421 | break; | ||
422 | |||
423 | case KE_END: | ||
424 | default: | ||
425 | BUG(); | ||
426 | } | ||
427 | return; | ||
428 | } | ||
429 | } | ||
430 | printk(KERN_NOTICE "wistron_btns: Unknown key code %02X\n", code); | ||
431 | } | ||
432 | |||
433 | static void poll_bios(unsigned long discard) | ||
434 | { | ||
435 | u8 qlen; | ||
436 | u16 val; | ||
437 | |||
438 | for (;;) { | ||
439 | qlen = CMOS_READ(cmos_address); | ||
440 | if (qlen == 0) | ||
441 | break; | ||
442 | val = bios_pop_queue(); | ||
443 | if (val != 0 && !discard) | ||
444 | handle_key((u8)val); | ||
445 | } | ||
446 | |||
447 | mod_timer(&poll_timer, jiffies + HZ / POLL_FREQUENCY); | ||
448 | } | ||
449 | |||
450 | static int wistron_suspend(struct platform_device *dev, pm_message_t state) | ||
451 | { | ||
452 | del_timer_sync(&poll_timer); | ||
453 | |||
454 | if (have_wifi) | ||
455 | bios_set_state(WIFI, 0); | ||
456 | |||
457 | if (have_bluetooth) | ||
458 | bios_set_state(BLUETOOTH, 0); | ||
459 | |||
460 | return 0; | ||
461 | } | ||
462 | |||
463 | static int wistron_resume(struct platform_device *dev) | ||
464 | { | ||
465 | if (have_wifi) | ||
466 | bios_set_state(WIFI, wifi_enabled); | ||
467 | |||
468 | if (have_bluetooth) | ||
469 | bios_set_state(BLUETOOTH, bluetooth_enabled); | ||
470 | |||
471 | poll_bios(1); | ||
472 | |||
473 | return 0; | ||
474 | } | ||
475 | |||
476 | static struct platform_driver wistron_driver = { | ||
477 | .suspend = wistron_suspend, | ||
478 | .resume = wistron_resume, | ||
479 | .driver = { | ||
480 | .name = "wistron-bios", | ||
481 | }, | ||
482 | }; | ||
483 | |||
484 | static int __init wb_module_init(void) | ||
485 | { | ||
486 | int err; | ||
487 | |||
488 | err = select_keymap(); | ||
489 | if (err) | ||
490 | return err; | ||
491 | |||
492 | err = map_bios(); | ||
493 | if (err) | ||
494 | return err; | ||
495 | |||
496 | bios_attach(); | ||
497 | cmos_address = bios_get_cmos_address(); | ||
498 | |||
499 | err = platform_driver_register(&wistron_driver); | ||
500 | if (err) | ||
501 | goto err_detach_bios; | ||
502 | |||
503 | wistron_device = platform_device_register_simple("wistron-bios", -1, NULL, 0); | ||
504 | if (IS_ERR(wistron_device)) { | ||
505 | err = PTR_ERR(wistron_device); | ||
506 | goto err_unregister_driver; | ||
507 | } | ||
508 | |||
509 | if (have_wifi) { | ||
510 | u16 wifi = bios_get_default_setting(WIFI); | ||
511 | if (wifi & 1) | ||
512 | wifi_enabled = (wifi & 2) ? 1 : 0; | ||
513 | else | ||
514 | have_wifi = 0; | ||
515 | |||
516 | if (have_wifi) | ||
517 | bios_set_state(WIFI, wifi_enabled); | ||
518 | } | ||
519 | |||
520 | if (have_bluetooth) { | ||
521 | u16 bt = bios_get_default_setting(BLUETOOTH); | ||
522 | if (bt & 1) | ||
523 | bluetooth_enabled = (bt & 2) ? 1 : 0; | ||
524 | else | ||
525 | have_bluetooth = 0; | ||
526 | |||
527 | if (have_bluetooth) | ||
528 | bios_set_state(BLUETOOTH, bluetooth_enabled); | ||
529 | } | ||
530 | |||
531 | err = setup_input_dev(); | ||
532 | if (err) | ||
533 | goto err_unregister_device; | ||
534 | |||
535 | poll_bios(1); /* Flush stale event queue and arm timer */ | ||
536 | |||
537 | return 0; | ||
538 | |||
539 | err_unregister_device: | ||
540 | platform_device_unregister(wistron_device); | ||
541 | err_unregister_driver: | ||
542 | platform_driver_unregister(&wistron_driver); | ||
543 | err_detach_bios: | ||
544 | bios_detach(); | ||
545 | unmap_bios(); | ||
546 | |||
547 | return err; | ||
548 | } | ||
549 | |||
550 | static void __exit wb_module_exit(void) | ||
551 | { | ||
552 | del_timer_sync(&poll_timer); | ||
553 | input_unregister_device(input_dev); | ||
554 | platform_device_unregister(wistron_device); | ||
555 | platform_driver_unregister(&wistron_driver); | ||
556 | bios_detach(); | ||
557 | unmap_bios(); | ||
558 | } | ||
559 | |||
560 | module_init(wb_module_init); | ||
561 | module_exit(wb_module_exit); | ||
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index edd15db17715..fbb69ef6a77b 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c | |||
@@ -269,14 +269,20 @@ static struct serio_event *serio_get_event(void) | |||
269 | return event; | 269 | return event; |
270 | } | 270 | } |
271 | 271 | ||
272 | static void serio_handle_events(void) | 272 | static void serio_handle_event(void) |
273 | { | 273 | { |
274 | struct serio_event *event; | 274 | struct serio_event *event; |
275 | struct serio_driver *serio_drv; | 275 | struct serio_driver *serio_drv; |
276 | 276 | ||
277 | down(&serio_sem); | 277 | down(&serio_sem); |
278 | 278 | ||
279 | while ((event = serio_get_event())) { | 279 | /* |
280 | * Note that we handle only one event here to give swsusp | ||
281 | * a chance to freeze kseriod thread. Serio events should | ||
282 | * be pretty rare so we are not concerned about taking | ||
283 | * performance hit. | ||
284 | */ | ||
285 | if ((event = serio_get_event())) { | ||
280 | 286 | ||
281 | switch (event->type) { | 287 | switch (event->type) { |
282 | case SERIO_REGISTER_PORT: | 288 | case SERIO_REGISTER_PORT: |
@@ -368,7 +374,7 @@ static struct serio *serio_get_pending_child(struct serio *parent) | |||
368 | static int serio_thread(void *nothing) | 374 | static int serio_thread(void *nothing) |
369 | { | 375 | { |
370 | do { | 376 | do { |
371 | serio_handle_events(); | 377 | serio_handle_event(); |
372 | wait_event_interruptible(serio_wait, | 378 | wait_event_interruptible(serio_wait, |
373 | kthread_should_stop() || !list_empty(&serio_event_list)); | 379 | kthread_should_stop() || !list_empty(&serio_event_list)); |
374 | try_to_freeze(); | 380 | try_to_freeze(); |
diff --git a/drivers/md/dm-bio-list.h b/drivers/md/dm-bio-list.h index bc021e1fd4d1..bbf4615f0e30 100644 --- a/drivers/md/dm-bio-list.h +++ b/drivers/md/dm-bio-list.h | |||
@@ -33,6 +33,9 @@ static inline void bio_list_add(struct bio_list *bl, struct bio *bio) | |||
33 | 33 | ||
34 | static inline void bio_list_merge(struct bio_list *bl, struct bio_list *bl2) | 34 | static inline void bio_list_merge(struct bio_list *bl, struct bio_list *bl2) |
35 | { | 35 | { |
36 | if (!bl2->head) | ||
37 | return; | ||
38 | |||
36 | if (bl->tail) | 39 | if (bl->tail) |
37 | bl->tail->bi_next = bl2->head; | 40 | bl->tail->bi_next = bl2->head; |
38 | else | 41 | else |
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c index 54ec737195e0..07d44e19536e 100644 --- a/drivers/md/dm-ioctl.c +++ b/drivers/md/dm-ioctl.c | |||
@@ -425,8 +425,8 @@ static void list_version_get_needed(struct target_type *tt, void *needed_param) | |||
425 | { | 425 | { |
426 | size_t *needed = needed_param; | 426 | size_t *needed = needed_param; |
427 | 427 | ||
428 | *needed += sizeof(struct dm_target_versions); | ||
428 | *needed += strlen(tt->name); | 429 | *needed += strlen(tt->name); |
429 | *needed += sizeof(tt->version); | ||
430 | *needed += ALIGN_MASK; | 430 | *needed += ALIGN_MASK; |
431 | } | 431 | } |
432 | 432 | ||
@@ -974,6 +974,7 @@ static int table_load(struct dm_ioctl *param, size_t param_size) | |||
974 | if (!hc) { | 974 | if (!hc) { |
975 | DMWARN("device doesn't appear to be in the dev hash table."); | 975 | DMWARN("device doesn't appear to be in the dev hash table."); |
976 | up_write(&_hash_lock); | 976 | up_write(&_hash_lock); |
977 | dm_table_put(t); | ||
977 | return -ENXIO; | 978 | return -ENXIO; |
978 | } | 979 | } |
979 | 980 | ||
diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c index e110655eabdb..a76349cb10a5 100644 --- a/drivers/md/dm-log.c +++ b/drivers/md/dm-log.c | |||
@@ -333,10 +333,10 @@ static int core_ctr(struct dirty_log *log, struct dm_target *ti, | |||
333 | lc->sync = sync; | 333 | lc->sync = sync; |
334 | 334 | ||
335 | /* | 335 | /* |
336 | * Work out how many words we need to hold the bitset. | 336 | * Work out how many "unsigned long"s we need to hold the bitset. |
337 | */ | 337 | */ |
338 | bitset_size = dm_round_up(region_count, | 338 | bitset_size = dm_round_up(region_count, |
339 | sizeof(*lc->clean_bits) << BYTE_SHIFT); | 339 | sizeof(unsigned long) << BYTE_SHIFT); |
340 | bitset_size >>= BYTE_SHIFT; | 340 | bitset_size >>= BYTE_SHIFT; |
341 | 341 | ||
342 | lc->bitset_uint32_count = bitset_size / 4; | 342 | lc->bitset_uint32_count = bitset_size / 4; |
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index f9b7b32d5d5c..f72a82fb9434 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
@@ -1000,6 +1000,7 @@ static int do_end_io(struct multipath *m, struct bio *bio, | |||
1000 | { | 1000 | { |
1001 | struct hw_handler *hwh = &m->hw_handler; | 1001 | struct hw_handler *hwh = &m->hw_handler; |
1002 | unsigned err_flags = MP_FAIL_PATH; /* Default behavior */ | 1002 | unsigned err_flags = MP_FAIL_PATH; /* Default behavior */ |
1003 | unsigned long flags; | ||
1003 | 1004 | ||
1004 | if (!error) | 1005 | if (!error) |
1005 | return 0; /* I/O complete */ | 1006 | return 0; /* I/O complete */ |
@@ -1010,17 +1011,17 @@ static int do_end_io(struct multipath *m, struct bio *bio, | |||
1010 | if (error == -EOPNOTSUPP) | 1011 | if (error == -EOPNOTSUPP) |
1011 | return error; | 1012 | return error; |
1012 | 1013 | ||
1013 | spin_lock(&m->lock); | 1014 | spin_lock_irqsave(&m->lock, flags); |
1014 | if (!m->nr_valid_paths) { | 1015 | if (!m->nr_valid_paths) { |
1015 | if (!m->queue_if_no_path) { | 1016 | if (!m->queue_if_no_path) { |
1016 | spin_unlock(&m->lock); | 1017 | spin_unlock_irqrestore(&m->lock, flags); |
1017 | return -EIO; | 1018 | return -EIO; |
1018 | } else { | 1019 | } else { |
1019 | spin_unlock(&m->lock); | 1020 | spin_unlock_irqrestore(&m->lock, flags); |
1020 | goto requeue; | 1021 | goto requeue; |
1021 | } | 1022 | } |
1022 | } | 1023 | } |
1023 | spin_unlock(&m->lock); | 1024 | spin_unlock_irqrestore(&m->lock, flags); |
1024 | 1025 | ||
1025 | if (hwh->type && hwh->type->error) | 1026 | if (hwh->type && hwh->type->error) |
1026 | err_flags = hwh->type->error(hwh, bio); | 1027 | err_flags = hwh->type->error(hwh, bio); |
@@ -1040,12 +1041,12 @@ static int do_end_io(struct multipath *m, struct bio *bio, | |||
1040 | dm_bio_restore(&mpio->details, bio); | 1041 | dm_bio_restore(&mpio->details, bio); |
1041 | 1042 | ||
1042 | /* queue for the daemon to resubmit or fail */ | 1043 | /* queue for the daemon to resubmit or fail */ |
1043 | spin_lock(&m->lock); | 1044 | spin_lock_irqsave(&m->lock, flags); |
1044 | bio_list_add(&m->queued_ios, bio); | 1045 | bio_list_add(&m->queued_ios, bio); |
1045 | m->queue_size++; | 1046 | m->queue_size++; |
1046 | if (!m->queue_io) | 1047 | if (!m->queue_io) |
1047 | queue_work(kmultipathd, &m->process_queued_ios); | 1048 | queue_work(kmultipathd, &m->process_queued_ios); |
1048 | spin_unlock(&m->lock); | 1049 | spin_unlock_irqrestore(&m->lock, flags); |
1049 | 1050 | ||
1050 | return 1; /* io not complete */ | 1051 | return 1; /* io not complete */ |
1051 | } | 1052 | } |
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index 2375709a392c..6b0fc1670929 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c | |||
@@ -376,16 +376,18 @@ static void rh_inc(struct region_hash *rh, region_t region) | |||
376 | read_lock(&rh->hash_lock); | 376 | read_lock(&rh->hash_lock); |
377 | reg = __rh_find(rh, region); | 377 | reg = __rh_find(rh, region); |
378 | 378 | ||
379 | spin_lock_irq(&rh->region_lock); | ||
379 | atomic_inc(®->pending); | 380 | atomic_inc(®->pending); |
380 | 381 | ||
381 | spin_lock_irq(&rh->region_lock); | ||
382 | if (reg->state == RH_CLEAN) { | 382 | if (reg->state == RH_CLEAN) { |
383 | rh->log->type->mark_region(rh->log, reg->key); | ||
384 | |||
385 | reg->state = RH_DIRTY; | 383 | reg->state = RH_DIRTY; |
386 | list_del_init(®->list); /* take off the clean list */ | 384 | list_del_init(®->list); /* take off the clean list */ |
387 | } | 385 | spin_unlock_irq(&rh->region_lock); |
388 | spin_unlock_irq(&rh->region_lock); | 386 | |
387 | rh->log->type->mark_region(rh->log, reg->key); | ||
388 | } else | ||
389 | spin_unlock_irq(&rh->region_lock); | ||
390 | |||
389 | 391 | ||
390 | read_unlock(&rh->hash_lock); | 392 | read_unlock(&rh->hash_lock); |
391 | } | 393 | } |
@@ -408,21 +410,17 @@ static void rh_dec(struct region_hash *rh, region_t region) | |||
408 | reg = __rh_lookup(rh, region); | 410 | reg = __rh_lookup(rh, region); |
409 | read_unlock(&rh->hash_lock); | 411 | read_unlock(&rh->hash_lock); |
410 | 412 | ||
413 | spin_lock_irqsave(&rh->region_lock, flags); | ||
411 | if (atomic_dec_and_test(®->pending)) { | 414 | if (atomic_dec_and_test(®->pending)) { |
412 | spin_lock_irqsave(&rh->region_lock, flags); | ||
413 | if (atomic_read(®->pending)) { /* check race */ | ||
414 | spin_unlock_irqrestore(&rh->region_lock, flags); | ||
415 | return; | ||
416 | } | ||
417 | if (reg->state == RH_RECOVERING) { | 415 | if (reg->state == RH_RECOVERING) { |
418 | list_add_tail(®->list, &rh->quiesced_regions); | 416 | list_add_tail(®->list, &rh->quiesced_regions); |
419 | } else { | 417 | } else { |
420 | reg->state = RH_CLEAN; | 418 | reg->state = RH_CLEAN; |
421 | list_add(®->list, &rh->clean_regions); | 419 | list_add(®->list, &rh->clean_regions); |
422 | } | 420 | } |
423 | spin_unlock_irqrestore(&rh->region_lock, flags); | ||
424 | should_wake = 1; | 421 | should_wake = 1; |
425 | } | 422 | } |
423 | spin_unlock_irqrestore(&rh->region_lock, flags); | ||
426 | 424 | ||
427 | if (should_wake) | 425 | if (should_wake) |
428 | wake(); | 426 | wake(); |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 78c7418478d6..cd12fca73b0d 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -1028,7 +1028,6 @@ static int super_1_validate(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1028 | mddev->size = le64_to_cpu(sb->size)/2; | 1028 | mddev->size = le64_to_cpu(sb->size)/2; |
1029 | mddev->events = le64_to_cpu(sb->events); | 1029 | mddev->events = le64_to_cpu(sb->events); |
1030 | mddev->bitmap_offset = 0; | 1030 | mddev->bitmap_offset = 0; |
1031 | mddev->default_bitmap_offset = 0; | ||
1032 | mddev->default_bitmap_offset = 1024; | 1031 | mddev->default_bitmap_offset = 1024; |
1033 | 1032 | ||
1034 | mddev->recovery_cp = le64_to_cpu(sb->resync_offset); | 1033 | mddev->recovery_cp = le64_to_cpu(sb->resync_offset); |
@@ -2932,6 +2931,9 @@ static int set_array_info(mddev_t * mddev, mdu_array_info_t *info) | |||
2932 | 2931 | ||
2933 | mddev->sb_dirty = 1; | 2932 | mddev->sb_dirty = 1; |
2934 | 2933 | ||
2934 | mddev->default_bitmap_offset = MD_SB_BYTES >> 9; | ||
2935 | mddev->bitmap_offset = 0; | ||
2936 | |||
2935 | /* | 2937 | /* |
2936 | * Generate a 128 bit UUID | 2938 | * Generate a 128 bit UUID |
2937 | */ | 2939 | */ |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 2da9d3ba902d..3066c587b539 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -953,9 +953,6 @@ static int raid1_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
953 | int mirror = 0; | 953 | int mirror = 0; |
954 | mirror_info_t *p; | 954 | mirror_info_t *p; |
955 | 955 | ||
956 | if (rdev->saved_raid_disk >= 0 && | ||
957 | conf->mirrors[rdev->saved_raid_disk].rdev == NULL) | ||
958 | mirror = rdev->saved_raid_disk; | ||
959 | for (mirror=0; mirror < mddev->raid_disks; mirror++) | 956 | for (mirror=0; mirror < mddev->raid_disks; mirror++) |
960 | if ( !(p=conf->mirrors+mirror)->rdev) { | 957 | if ( !(p=conf->mirrors+mirror)->rdev) { |
961 | 958 | ||
@@ -972,7 +969,10 @@ static int raid1_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
972 | p->head_position = 0; | 969 | p->head_position = 0; |
973 | rdev->raid_disk = mirror; | 970 | rdev->raid_disk = mirror; |
974 | found = 1; | 971 | found = 1; |
975 | if (rdev->saved_raid_disk != mirror) | 972 | /* As all devices are equivalent, we don't need a full recovery |
973 | * if this was recently any drive of the array | ||
974 | */ | ||
975 | if (rdev->saved_raid_disk < 0) | ||
976 | conf->fullsync = 1; | 976 | conf->fullsync = 1; |
977 | rcu_assign_pointer(p->rdev, rdev); | 977 | rcu_assign_pointer(p->rdev, rdev); |
978 | break; | 978 | break; |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 867f06ae33d9..713dc9c2c730 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -552,7 +552,11 @@ static int read_balance(conf_t *conf, r10bio_t *r10_bio) | |||
552 | !test_bit(In_sync, &rdev->flags)) | 552 | !test_bit(In_sync, &rdev->flags)) |
553 | continue; | 553 | continue; |
554 | 554 | ||
555 | if (!atomic_read(&rdev->nr_pending)) { | 555 | /* This optimisation is debatable, and completely destroys |
556 | * sequential read speed for 'far copies' arrays. So only | ||
557 | * keep it for 'near' arrays, and review those later. | ||
558 | */ | ||
559 | if (conf->near_copies > 1 && !atomic_read(&rdev->nr_pending)) { | ||
556 | disk = ndisk; | 560 | disk = ndisk; |
557 | slot = nslot; | 561 | slot = nslot; |
558 | break; | 562 | break; |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index e2a40283e323..36d5f8ac8265 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -1704,7 +1704,9 @@ static void raid5d (mddev_t *mddev) | |||
1704 | 1704 | ||
1705 | if (conf->seq_flush - conf->seq_write > 0) { | 1705 | if (conf->seq_flush - conf->seq_write > 0) { |
1706 | int seq = conf->seq_flush; | 1706 | int seq = conf->seq_flush; |
1707 | spin_unlock_irq(&conf->device_lock); | ||
1707 | bitmap_unplug(mddev->bitmap); | 1708 | bitmap_unplug(mddev->bitmap); |
1709 | spin_lock_irq(&conf->device_lock); | ||
1708 | conf->seq_write = seq; | 1710 | conf->seq_write = seq; |
1709 | activate_bit_delay(conf); | 1711 | activate_bit_delay(conf); |
1710 | } | 1712 | } |
diff --git a/drivers/md/raid6main.c b/drivers/md/raid6main.c index eae5a35629c5..0000d162d198 100644 --- a/drivers/md/raid6main.c +++ b/drivers/md/raid6main.c | |||
@@ -1702,6 +1702,8 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i | |||
1702 | int data_disks = raid_disks - 2; | 1702 | int data_disks = raid_disks - 2; |
1703 | sector_t max_sector = mddev->size << 1; | 1703 | sector_t max_sector = mddev->size << 1; |
1704 | int sync_blocks; | 1704 | int sync_blocks; |
1705 | int still_degraded = 0; | ||
1706 | int i; | ||
1705 | 1707 | ||
1706 | if (sector_nr >= max_sector) { | 1708 | if (sector_nr >= max_sector) { |
1707 | /* just being told to finish up .. nothing much to do */ | 1709 | /* just being told to finish up .. nothing much to do */ |
@@ -1710,7 +1712,7 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i | |||
1710 | if (mddev->curr_resync < max_sector) /* aborted */ | 1712 | if (mddev->curr_resync < max_sector) /* aborted */ |
1711 | bitmap_end_sync(mddev->bitmap, mddev->curr_resync, | 1713 | bitmap_end_sync(mddev->bitmap, mddev->curr_resync, |
1712 | &sync_blocks, 1); | 1714 | &sync_blocks, 1); |
1713 | else /* compelted sync */ | 1715 | else /* completed sync */ |
1714 | conf->fullsync = 0; | 1716 | conf->fullsync = 0; |
1715 | bitmap_close_sync(mddev->bitmap); | 1717 | bitmap_close_sync(mddev->bitmap); |
1716 | 1718 | ||
@@ -1748,7 +1750,16 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i | |||
1748 | */ | 1750 | */ |
1749 | schedule_timeout_uninterruptible(1); | 1751 | schedule_timeout_uninterruptible(1); |
1750 | } | 1752 | } |
1751 | bitmap_start_sync(mddev->bitmap, sector_nr, &sync_blocks, 0); | 1753 | /* Need to check if array will still be degraded after recovery/resync |
1754 | * We don't need to check the 'failed' flag as when that gets set, | ||
1755 | * recovery aborts. | ||
1756 | */ | ||
1757 | for (i=0; i<mddev->raid_disks; i++) | ||
1758 | if (conf->disks[i].rdev == NULL) | ||
1759 | still_degraded = 1; | ||
1760 | |||
1761 | bitmap_start_sync(mddev->bitmap, sector_nr, &sync_blocks, still_degraded); | ||
1762 | |||
1752 | spin_lock(&sh->lock); | 1763 | spin_lock(&sh->lock); |
1753 | set_bit(STRIPE_SYNCING, &sh->state); | 1764 | set_bit(STRIPE_SYNCING, &sh->state); |
1754 | clear_bit(STRIPE_INSYNC, &sh->state); | 1765 | clear_bit(STRIPE_INSYNC, &sh->state); |
@@ -1784,7 +1795,9 @@ static void raid6d (mddev_t *mddev) | |||
1784 | 1795 | ||
1785 | if (conf->seq_flush - conf->seq_write > 0) { | 1796 | if (conf->seq_flush - conf->seq_write > 0) { |
1786 | int seq = conf->seq_flush; | 1797 | int seq = conf->seq_flush; |
1798 | spin_unlock_irq(&conf->device_lock); | ||
1787 | bitmap_unplug(mddev->bitmap); | 1799 | bitmap_unplug(mddev->bitmap); |
1800 | spin_lock_irq(&conf->device_lock); | ||
1788 | conf->seq_write = seq; | 1801 | conf->seq_write = seq; |
1789 | activate_bit_delay(conf); | 1802 | activate_bit_delay(conf); |
1790 | } | 1803 | } |
@@ -2145,9 +2158,15 @@ static int raid6_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
2145 | /* no point adding a device */ | 2158 | /* no point adding a device */ |
2146 | return 0; | 2159 | return 0; |
2147 | /* | 2160 | /* |
2148 | * find the disk ... | 2161 | * find the disk ... but prefer rdev->saved_raid_disk |
2162 | * if possible. | ||
2149 | */ | 2163 | */ |
2150 | for (disk=0; disk < mddev->raid_disks; disk++) | 2164 | if (rdev->saved_raid_disk >= 0 && |
2165 | conf->disks[rdev->saved_raid_disk].rdev == NULL) | ||
2166 | disk = rdev->saved_raid_disk; | ||
2167 | else | ||
2168 | disk = 0; | ||
2169 | for ( ; disk < mddev->raid_disks; disk++) | ||
2151 | if ((p=conf->disks + disk)->rdev == NULL) { | 2170 | if ((p=conf->disks + disk)->rdev == NULL) { |
2152 | clear_bit(In_sync, &rdev->flags); | 2171 | clear_bit(In_sync, &rdev->flags); |
2153 | rdev->raid_disk = disk; | 2172 | rdev->raid_disk = disk; |
diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c index fb394a0d838c..336fc284fa52 100644 --- a/drivers/media/dvb/cinergyT2/cinergyT2.c +++ b/drivers/media/dvb/cinergyT2/cinergyT2.c | |||
@@ -772,7 +772,7 @@ static int cinergyt2_register_rc(struct cinergyt2 *cinergyt2) | |||
772 | input_dev->name = DRIVER_NAME " remote control"; | 772 | input_dev->name = DRIVER_NAME " remote control"; |
773 | input_dev->phys = cinergyt2->phys; | 773 | input_dev->phys = cinergyt2->phys; |
774 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); | 774 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); |
775 | for (i = 0; ARRAY_SIZE(rc_keys); i += 3) | 775 | for (i = 0; i < ARRAY_SIZE(rc_keys); i += 3) |
776 | set_bit(rc_keys[i + 2], input_dev->keybit); | 776 | set_bit(rc_keys[i + 2], input_dev->keybit); |
777 | input_dev->keycodesize = 0; | 777 | input_dev->keycodesize = 0; |
778 | input_dev->keycodemax = 0; | 778 | input_dev->keycodemax = 0; |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 1a3b3c7e5e99..ecb9a31dd003 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -26,7 +26,7 @@ config VIDEO_BT848 | |||
26 | module will be called bttv. | 26 | module will be called bttv. |
27 | 27 | ||
28 | config VIDEO_BT848_DVB | 28 | config VIDEO_BT848_DVB |
29 | tristate "DVB/ATSC Support for bt878 based TV cards" | 29 | bool "DVB/ATSC Support for bt878 based TV cards" |
30 | depends on VIDEO_BT848 && DVB_CORE | 30 | depends on VIDEO_BT848 && DVB_CORE |
31 | select DVB_BT8XX | 31 | select DVB_BT8XX |
32 | ---help--- | 32 | ---help--- |
diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig index 41818b6205b3..85ba4106dc79 100644 --- a/drivers/media/video/cx88/Kconfig +++ b/drivers/media/video/cx88/Kconfig | |||
@@ -46,8 +46,8 @@ config VIDEO_CX88_DVB_ALL_FRONTENDS | |||
46 | If you are unsure, choose Y. | 46 | If you are unsure, choose Y. |
47 | 47 | ||
48 | config VIDEO_CX88_DVB_MT352 | 48 | config VIDEO_CX88_DVB_MT352 |
49 | tristate "Zarlink MT352 DVB-T Support" | 49 | bool "Zarlink MT352 DVB-T Support" |
50 | default m | 50 | default y |
51 | depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS | 51 | depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS |
52 | select DVB_MT352 | 52 | select DVB_MT352 |
53 | ---help--- | 53 | ---help--- |
@@ -55,8 +55,8 @@ config VIDEO_CX88_DVB_MT352 | |||
55 | Connexant 2388x chip and the MT352 demodulator. | 55 | Connexant 2388x chip and the MT352 demodulator. |
56 | 56 | ||
57 | config VIDEO_CX88_DVB_OR51132 | 57 | config VIDEO_CX88_DVB_OR51132 |
58 | tristate "OR51132 ATSC Support" | 58 | bool "OR51132 ATSC Support" |
59 | default m | 59 | default y |
60 | depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS | 60 | depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS |
61 | select DVB_OR51132 | 61 | select DVB_OR51132 |
62 | ---help--- | 62 | ---help--- |
@@ -64,8 +64,8 @@ config VIDEO_CX88_DVB_OR51132 | |||
64 | Connexant 2388x chip and the OR51132 demodulator. | 64 | Connexant 2388x chip and the OR51132 demodulator. |
65 | 65 | ||
66 | config VIDEO_CX88_DVB_CX22702 | 66 | config VIDEO_CX88_DVB_CX22702 |
67 | tristate "Conexant CX22702 DVB-T Support" | 67 | bool "Conexant CX22702 DVB-T Support" |
68 | default m | 68 | default y |
69 | depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS | 69 | depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS |
70 | select DVB_CX22702 | 70 | select DVB_CX22702 |
71 | ---help--- | 71 | ---help--- |
@@ -73,8 +73,8 @@ config VIDEO_CX88_DVB_CX22702 | |||
73 | Connexant 2388x chip and the CX22702 demodulator. | 73 | Connexant 2388x chip and the CX22702 demodulator. |
74 | 74 | ||
75 | config VIDEO_CX88_DVB_LGDT330X | 75 | config VIDEO_CX88_DVB_LGDT330X |
76 | tristate "LG Electronics DT3302/DT3303 ATSC Support" | 76 | bool "LG Electronics DT3302/DT3303 ATSC Support" |
77 | default m | 77 | default y |
78 | depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS | 78 | depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS |
79 | select DVB_LGDT330X | 79 | select DVB_LGDT330X |
80 | ---help--- | 80 | ---help--- |
@@ -82,8 +82,8 @@ config VIDEO_CX88_DVB_LGDT330X | |||
82 | Connexant 2388x chip and the LGDT3302/LGDT3303 demodulator. | 82 | Connexant 2388x chip and the LGDT3302/LGDT3303 demodulator. |
83 | 83 | ||
84 | config VIDEO_CX88_DVB_NXT200X | 84 | config VIDEO_CX88_DVB_NXT200X |
85 | tristate "NXT2002/NXT2004 ATSC Support" | 85 | bool "NXT2002/NXT2004 ATSC Support" |
86 | default m | 86 | default y |
87 | depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS | 87 | depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS |
88 | select DVB_NXT200X | 88 | select DVB_NXT200X |
89 | ---help--- | 89 | ---help--- |
diff --git a/drivers/media/video/cx88/Makefile b/drivers/media/video/cx88/Makefile index 0df40b773454..54401b02b7ce 100644 --- a/drivers/media/video/cx88/Makefile +++ b/drivers/media/video/cx88/Makefile | |||
@@ -9,21 +9,12 @@ obj-$(CONFIG_VIDEO_CX88_DVB) += cx88-dvb.o | |||
9 | EXTRA_CFLAGS += -I$(src)/.. | 9 | EXTRA_CFLAGS += -I$(src)/.. |
10 | EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core | 10 | EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core |
11 | EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/frontends | 11 | EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/frontends |
12 | ifneq ($(CONFIG_VIDEO_BUF_DVB),n) | 12 | |
13 | EXTRA_CFLAGS += -DHAVE_VIDEO_BUF_DVB=1 | 13 | extra-cflags-$(CONFIG_VIDEO_BUF_DVB) += -DHAVE_VIDEO_BUF_DVB=1 |
14 | endif | 14 | extra-cflags-$(CONFIG_DVB_CX22702) += -DHAVE_CX22702=1 |
15 | ifneq ($(CONFIG_DVB_CX22702),n) | 15 | extra-cflags-$(CONFIG_DVB_OR51132) += -DHAVE_OR51132=1 |
16 | EXTRA_CFLAGS += -DHAVE_CX22702=1 | 16 | extra-cflags-$(CONFIG_DVB_LGDT330X) += -DHAVE_LGDT330X=1 |
17 | endif | 17 | extra-cflags-$(CONFIG_DVB_MT352) += -DHAVE_MT352=1 |
18 | ifneq ($(CONFIG_DVB_OR51132),n) | 18 | extra-cflags-$(CONFIG_DVB_NXT200X) += -DHAVE_NXT200X=1 |
19 | EXTRA_CFLAGS += -DHAVE_OR51132=1 | 19 | |
20 | endif | 20 | EXTRA_CFLAGS += $(extra-cflags-y) $(extra-cflags-m) |
21 | ifneq ($(CONFIG_DVB_LGDT330X),n) | ||
22 | EXTRA_CFLAGS += -DHAVE_LGDT330X=1 | ||
23 | endif | ||
24 | ifneq ($(CONFIG_DVB_MT352),n) | ||
25 | EXTRA_CFLAGS += -DHAVE_MT352=1 | ||
26 | endif | ||
27 | ifneq ($(CONFIG_DVB_NXT200X),n) | ||
28 | EXTRA_CFLAGS += -DHAVE_NXT200X=1 | ||
29 | endif | ||
diff --git a/drivers/media/video/ir-kbd-gpio.c b/drivers/media/video/ir-kbd-gpio.c index 5abfc0fbf6de..6345e29e4951 100644 --- a/drivers/media/video/ir-kbd-gpio.c +++ b/drivers/media/video/ir-kbd-gpio.c | |||
@@ -673,7 +673,6 @@ static int ir_probe(struct device *dev) | |||
673 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", | 673 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", |
674 | pci_name(sub->core->pci)); | 674 | pci_name(sub->core->pci)); |
675 | 675 | ||
676 | ir->sub = sub; | ||
677 | ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); | 676 | ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); |
678 | input_dev->name = ir->name; | 677 | input_dev->name = ir->name; |
679 | input_dev->phys = ir->phys; | 678 | input_dev->phys = ir->phys; |
@@ -688,6 +687,9 @@ static int ir_probe(struct device *dev) | |||
688 | } | 687 | } |
689 | input_dev->cdev.dev = &sub->core->pci->dev; | 688 | input_dev->cdev.dev = &sub->core->pci->dev; |
690 | 689 | ||
690 | ir->input = input_dev; | ||
691 | ir->sub = sub; | ||
692 | |||
691 | if (ir->polling) { | 693 | if (ir->polling) { |
692 | INIT_WORK(&ir->work, ir_work, ir); | 694 | INIT_WORK(&ir->work, ir_work, ir); |
693 | init_timer(&ir->timer); | 695 | init_timer(&ir->timer); |
@@ -708,7 +710,6 @@ static int ir_probe(struct device *dev) | |||
708 | /* all done */ | 710 | /* all done */ |
709 | dev_set_drvdata(dev, ir); | 711 | dev_set_drvdata(dev, ir); |
710 | input_register_device(ir->input); | 712 | input_register_device(ir->input); |
711 | printk(DEVNAME ": %s detected at %s\n",ir->name,ir->phys); | ||
712 | 713 | ||
713 | /* the remote isn't as bouncy as a keyboard */ | 714 | /* the remote isn't as bouncy as a keyboard */ |
714 | ir->input->rep[REP_DELAY] = repeat_delay; | 715 | ir->input->rep[REP_DELAY] = repeat_delay; |
diff --git a/drivers/media/video/saa7134/Kconfig b/drivers/media/video/saa7134/Kconfig index 7bdeabe638ca..c512c4411b38 100644 --- a/drivers/media/video/saa7134/Kconfig +++ b/drivers/media/video/saa7134/Kconfig | |||
@@ -42,8 +42,8 @@ config VIDEO_SAA7134_DVB_ALL_FRONTENDS | |||
42 | If you are unsure, choose Y. | 42 | If you are unsure, choose Y. |
43 | 43 | ||
44 | config VIDEO_SAA7134_DVB_MT352 | 44 | config VIDEO_SAA7134_DVB_MT352 |
45 | tristate "Zarlink MT352 DVB-T Support" | 45 | bool "Zarlink MT352 DVB-T Support" |
46 | default m | 46 | default y |
47 | depends on VIDEO_SAA7134_DVB && !VIDEO_SAA7134_DVB_ALL_FRONTENDS | 47 | depends on VIDEO_SAA7134_DVB && !VIDEO_SAA7134_DVB_ALL_FRONTENDS |
48 | select DVB_MT352 | 48 | select DVB_MT352 |
49 | ---help--- | 49 | ---help--- |
@@ -51,8 +51,8 @@ config VIDEO_SAA7134_DVB_MT352 | |||
51 | Philips saa7134 chip and the MT352 demodulator. | 51 | Philips saa7134 chip and the MT352 demodulator. |
52 | 52 | ||
53 | config VIDEO_SAA7134_DVB_TDA1004X | 53 | config VIDEO_SAA7134_DVB_TDA1004X |
54 | tristate "Phillips TDA10045H/TDA10046H DVB-T Support" | 54 | bool "Phillips TDA10045H/TDA10046H DVB-T Support" |
55 | default m | 55 | default y |
56 | depends on VIDEO_SAA7134_DVB && !VIDEO_SAA7134_DVB_ALL_FRONTENDS | 56 | depends on VIDEO_SAA7134_DVB && !VIDEO_SAA7134_DVB_ALL_FRONTENDS |
57 | select DVB_TDA1004X | 57 | select DVB_TDA1004X |
58 | ---help--- | 58 | ---help--- |
@@ -60,8 +60,8 @@ config VIDEO_SAA7134_DVB_TDA1004X | |||
60 | Philips saa7134 chip and the TDA10045H/TDA10046H demodulator. | 60 | Philips saa7134 chip and the TDA10045H/TDA10046H demodulator. |
61 | 61 | ||
62 | config VIDEO_SAA7134_DVB_NXT200X | 62 | config VIDEO_SAA7134_DVB_NXT200X |
63 | tristate "NXT2002/NXT2004 ATSC Support" | 63 | bool "NXT2002/NXT2004 ATSC Support" |
64 | default m | 64 | default y |
65 | depends on VIDEO_SAA7134_DVB && !VIDEO_SAA7134_DVB_ALL_FRONTENDS | 65 | depends on VIDEO_SAA7134_DVB && !VIDEO_SAA7134_DVB_ALL_FRONTENDS |
66 | select DVB_NXT200X | 66 | select DVB_NXT200X |
67 | ---help--- | 67 | ---help--- |
diff --git a/drivers/media/video/saa7134/Makefile b/drivers/media/video/saa7134/Makefile index 4226b61cc613..134f83a96218 100644 --- a/drivers/media/video/saa7134/Makefile +++ b/drivers/media/video/saa7134/Makefile | |||
@@ -11,15 +11,10 @@ obj-$(CONFIG_VIDEO_SAA7134_DVB) += saa7134-dvb.o | |||
11 | EXTRA_CFLAGS += -I$(src)/.. | 11 | EXTRA_CFLAGS += -I$(src)/.. |
12 | EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core | 12 | EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core |
13 | EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/frontends | 13 | EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/frontends |
14 | ifneq ($(CONFIG_VIDEO_BUF_DVB),n) | 14 | |
15 | EXTRA_CFLAGS += -DHAVE_VIDEO_BUF_DVB=1 | 15 | extra-cflags-$(CONFIG_VIDEO_BUF_DVB) += -DHAVE_VIDEO_BUF_DVB=1 |
16 | endif | 16 | extra-cflags-$(CONFIG_DVB_MT352) += -DHAVE_MT352=1 |
17 | ifneq ($(CONFIG_DVB_MT352),n) | 17 | extra-cflags-$(CONFIG_DVB_TDA1004X) += -DHAVE_TDA1004X=1 |
18 | EXTRA_CFLAGS += -DHAVE_MT352=1 | 18 | extra-cflags-$(CONFIG_DVB_NXT200X) += -DHAVE_NXT200X=1 |
19 | endif | 19 | |
20 | ifneq ($(CONFIG_DVB_TDA1004X),n) | 20 | EXTRA_CFLAGS += $(extra-cflags-y) $(extra-cflags-m) |
21 | EXTRA_CFLAGS += -DHAVE_TDA1004X=1 | ||
22 | endif | ||
23 | ifneq ($(CONFIG_DVB_NXT200X),n) | ||
24 | EXTRA_CFLAGS += -DHAVE_NXT200X=1 | ||
25 | endif | ||
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index e648cc3bc96d..ab75ca5ac356 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c | |||
@@ -713,6 +713,8 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
713 | return -ENOMEM; | 713 | return -ENOMEM; |
714 | } | 714 | } |
715 | 715 | ||
716 | ir->dev = input_dev; | ||
717 | |||
716 | /* init hardware-specific stuff */ | 718 | /* init hardware-specific stuff */ |
717 | ir->mask_keycode = mask_keycode; | 719 | ir->mask_keycode = mask_keycode; |
718 | ir->mask_keydown = mask_keydown; | 720 | ir->mask_keydown = mask_keydown; |
diff --git a/drivers/message/i2o/pci.c b/drivers/message/i2o/pci.c index 66c03e882570..81ef306cb124 100644 --- a/drivers/message/i2o/pci.c +++ b/drivers/message/i2o/pci.c | |||
@@ -421,8 +421,8 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev, | |||
421 | i2o_pci_free(c); | 421 | i2o_pci_free(c); |
422 | 422 | ||
423 | free_controller: | 423 | free_controller: |
424 | i2o_iop_free(c); | ||
425 | put_device(c->device.parent); | 424 | put_device(c->device.parent); |
425 | i2o_iop_free(c); | ||
426 | 426 | ||
427 | disable: | 427 | disable: |
428 | pci_disable_device(pdev); | 428 | pci_disable_device(pdev); |
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index da528390acf8..d336a1d65dc7 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c | |||
@@ -816,7 +816,7 @@ static void mmc_discover_cards(struct mmc_host *host) | |||
816 | 816 | ||
817 | cmd.opcode = SD_SEND_RELATIVE_ADDR; | 817 | cmd.opcode = SD_SEND_RELATIVE_ADDR; |
818 | cmd.arg = 0; | 818 | cmd.arg = 0; |
819 | cmd.flags = MMC_RSP_R1; | 819 | cmd.flags = MMC_RSP_R6; |
820 | 820 | ||
821 | err = mmc_wait_for_cmd(host, &cmd, CMD_RETRIES); | 821 | err = mmc_wait_for_cmd(host, &cmd, CMD_RETRIES); |
822 | if (err != MMC_ERR_NONE) | 822 | if (err != MMC_ERR_NONE) |
diff --git a/drivers/net/dgrs.c b/drivers/net/dgrs.c index 2a290cc397ad..70b47e4c4e9c 100644 --- a/drivers/net/dgrs.c +++ b/drivers/net/dgrs.c | |||
@@ -1458,6 +1458,8 @@ static struct pci_driver dgrs_pci_driver = { | |||
1458 | .probe = dgrs_pci_probe, | 1458 | .probe = dgrs_pci_probe, |
1459 | .remove = __devexit_p(dgrs_pci_remove), | 1459 | .remove = __devexit_p(dgrs_pci_remove), |
1460 | }; | 1460 | }; |
1461 | #else | ||
1462 | static struct pci_driver dgrs_pci_driver = {}; | ||
1461 | #endif | 1463 | #endif |
1462 | 1464 | ||
1463 | 1465 | ||
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h index c42b68d3aa24..6a61b9f286e1 100644 --- a/drivers/pci/hotplug/pciehp.h +++ b/drivers/pci/hotplug/pciehp.h | |||
@@ -59,7 +59,6 @@ struct slot { | |||
59 | struct slot *next; | 59 | struct slot *next; |
60 | u8 bus; | 60 | u8 bus; |
61 | u8 device; | 61 | u8 device; |
62 | u16 status; | ||
63 | u32 number; | 62 | u32 number; |
64 | u8 state; | 63 | u8 state; |
65 | struct timer_list task_event; | 64 | struct timer_list task_event; |
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index 5e582eca21d8..83c4b865718a 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c | |||
@@ -207,7 +207,6 @@ u8 pciehp_handle_power_fault(u8 hp_slot, void *inst_id) | |||
207 | * power fault Cleared | 207 | * power fault Cleared |
208 | */ | 208 | */ |
209 | info("Power fault cleared on Slot(%d)\n", ctrl->first_slot + hp_slot); | 209 | info("Power fault cleared on Slot(%d)\n", ctrl->first_slot + hp_slot); |
210 | p_slot->status = 0x00; | ||
211 | taskInfo->event_type = INT_POWER_FAULT_CLEAR; | 210 | taskInfo->event_type = INT_POWER_FAULT_CLEAR; |
212 | } else { | 211 | } else { |
213 | /* | 212 | /* |
@@ -215,8 +214,6 @@ u8 pciehp_handle_power_fault(u8 hp_slot, void *inst_id) | |||
215 | */ | 214 | */ |
216 | info("Power fault on Slot(%d)\n", ctrl->first_slot + hp_slot); | 215 | info("Power fault on Slot(%d)\n", ctrl->first_slot + hp_slot); |
217 | taskInfo->event_type = INT_POWER_FAULT; | 216 | taskInfo->event_type = INT_POWER_FAULT; |
218 | /* set power fault status for this board */ | ||
219 | p_slot->status = 0xFF; | ||
220 | info("power fault bit %x set\n", hp_slot); | 217 | info("power fault bit %x set\n", hp_slot); |
221 | } | 218 | } |
222 | if (rc) | 219 | if (rc) |
@@ -317,13 +314,10 @@ static int board_added(struct slot *p_slot) | |||
317 | return rc; | 314 | return rc; |
318 | } | 315 | } |
319 | 316 | ||
320 | dbg("%s: slot status = %x\n", __FUNCTION__, p_slot->status); | ||
321 | |||
322 | /* Check for a power fault */ | 317 | /* Check for a power fault */ |
323 | if (p_slot->status == 0xFF) { | 318 | if (p_slot->hpc_ops->query_power_fault(p_slot)) { |
324 | /* power fault occurred, but it was benign */ | 319 | dbg("%s: power fault detected\n", __FUNCTION__); |
325 | rc = POWER_FAILURE; | 320 | rc = POWER_FAILURE; |
326 | p_slot->status = 0; | ||
327 | goto err_exit; | 321 | goto err_exit; |
328 | } | 322 | } |
329 | 323 | ||
@@ -334,8 +328,6 @@ static int board_added(struct slot *p_slot) | |||
334 | goto err_exit; | 328 | goto err_exit; |
335 | } | 329 | } |
336 | 330 | ||
337 | p_slot->status = 0; | ||
338 | |||
339 | /* | 331 | /* |
340 | * Some PCI Express root ports require fixup after hot-plug operation. | 332 | * Some PCI Express root ports require fixup after hot-plug operation. |
341 | */ | 333 | */ |
@@ -382,9 +374,6 @@ static int remove_board(struct slot *p_slot) | |||
382 | 374 | ||
383 | dbg("In %s, hp_slot = %d\n", __FUNCTION__, hp_slot); | 375 | dbg("In %s, hp_slot = %d\n", __FUNCTION__, hp_slot); |
384 | 376 | ||
385 | /* Change status to shutdown */ | ||
386 | p_slot->status = 0x01; | ||
387 | |||
388 | /* Wait for exclusive access to hardware */ | 377 | /* Wait for exclusive access to hardware */ |
389 | down(&ctrl->crit_sect); | 378 | down(&ctrl->crit_sect); |
390 | 379 | ||
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 2387e75da0fe..0b8b26beb163 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c | |||
@@ -750,7 +750,7 @@ static int hpc_power_on_slot(struct slot * slot) | |||
750 | { | 750 | { |
751 | struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle; | 751 | struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle; |
752 | u16 slot_cmd; | 752 | u16 slot_cmd; |
753 | u16 slot_ctrl; | 753 | u16 slot_ctrl, slot_status; |
754 | 754 | ||
755 | int retval = 0; | 755 | int retval = 0; |
756 | 756 | ||
@@ -767,6 +767,14 @@ static int hpc_power_on_slot(struct slot * slot) | |||
767 | return -1; | 767 | return -1; |
768 | } | 768 | } |
769 | 769 | ||
770 | /* Clear sticky power-fault bit from previous power failures */ | ||
771 | hp_register_read_word(php_ctlr->pci_dev, | ||
772 | SLOT_STATUS(slot->ctrl->cap_base), slot_status); | ||
773 | slot_status &= PWR_FAULT_DETECTED; | ||
774 | if (slot_status) | ||
775 | hp_register_write_word(php_ctlr->pci_dev, | ||
776 | SLOT_STATUS(slot->ctrl->cap_base), slot_status); | ||
777 | |||
770 | retval = hp_register_read_word(php_ctlr->pci_dev, SLOT_CTRL(slot->ctrl->cap_base), slot_ctrl); | 778 | retval = hp_register_read_word(php_ctlr->pci_dev, SLOT_CTRL(slot->ctrl->cap_base), slot_ctrl); |
771 | 779 | ||
772 | if (retval) { | 780 | if (retval) { |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index a9b00cc2d885..6917c6cb0912 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -178,6 +178,7 @@ EXPORT_SYMBOL(pci_osc_support_set); | |||
178 | 178 | ||
179 | /** | 179 | /** |
180 | * pci_osc_control_set - commit requested control to Firmware | 180 | * pci_osc_control_set - commit requested control to Firmware |
181 | * @handle: acpi_handle for the target ACPI object | ||
181 | * @flags: driver's requested control bits | 182 | * @flags: driver's requested control bits |
182 | * | 183 | * |
183 | * Attempt to take control from Firmware on requested control bits. | 184 | * Attempt to take control from Firmware on requested control bits. |
diff --git a/drivers/pcmcia/m32r_cfc.c b/drivers/pcmcia/m32r_cfc.c index 2c22b4b3619d..078579ae6359 100644 --- a/drivers/pcmcia/m32r_cfc.c +++ b/drivers/pcmcia/m32r_cfc.c | |||
@@ -355,9 +355,10 @@ static void add_pcc_socket(ulong base, int irq, ulong mapaddr, kio_addr_t ioaddr | |||
355 | #ifndef CONFIG_PLAT_USRV | 355 | #ifndef CONFIG_PLAT_USRV |
356 | /* insert interrupt */ | 356 | /* insert interrupt */ |
357 | request_irq(irq, pcc_interrupt, 0, "m32r_cfc", pcc_interrupt); | 357 | request_irq(irq, pcc_interrupt, 0, "m32r_cfc", pcc_interrupt); |
358 | #ifndef CONFIG_PLAT_MAPPI3 | ||
358 | /* eject interrupt */ | 359 | /* eject interrupt */ |
359 | request_irq(irq+1, pcc_interrupt, 0, "m32r_cfc", pcc_interrupt); | 360 | request_irq(irq+1, pcc_interrupt, 0, "m32r_cfc", pcc_interrupt); |
360 | 361 | #endif | |
361 | debug(3, "m32r_cfc: enable CFMSK, RDYSEL\n"); | 362 | debug(3, "m32r_cfc: enable CFMSK, RDYSEL\n"); |
362 | pcc_set(pcc_sockets, (unsigned int)PLD_CFIMASK, 0x01); | 363 | pcc_set(pcc_sockets, (unsigned int)PLD_CFIMASK, 0x01); |
363 | #endif /* CONFIG_PLAT_USRV */ | 364 | #endif /* CONFIG_PLAT_USRV */ |
diff --git a/drivers/sbus/char/aurora.c b/drivers/sbus/char/aurora.c index 672f9f2b2163..92e6c5639dd3 100644 --- a/drivers/sbus/char/aurora.c +++ b/drivers/sbus/char/aurora.c | |||
@@ -124,25 +124,25 @@ static inline int aurora_paranoia_check(struct Aurora_port const * port, | |||
124 | */ | 124 | */ |
125 | 125 | ||
126 | /* Get board number from pointer */ | 126 | /* Get board number from pointer */ |
127 | extern inline int board_No (struct Aurora_board const * bp) | 127 | static inline int board_No (struct Aurora_board const * bp) |
128 | { | 128 | { |
129 | return bp - aurora_board; | 129 | return bp - aurora_board; |
130 | } | 130 | } |
131 | 131 | ||
132 | /* Get port number from pointer */ | 132 | /* Get port number from pointer */ |
133 | extern inline int port_No (struct Aurora_port const * port) | 133 | static inline int port_No (struct Aurora_port const * port) |
134 | { | 134 | { |
135 | return AURORA_PORT(port - aurora_port); | 135 | return AURORA_PORT(port - aurora_port); |
136 | } | 136 | } |
137 | 137 | ||
138 | /* Get pointer to board from pointer to port */ | 138 | /* Get pointer to board from pointer to port */ |
139 | extern inline struct Aurora_board * port_Board(struct Aurora_port const * port) | 139 | static inline struct Aurora_board * port_Board(struct Aurora_port const * port) |
140 | { | 140 | { |
141 | return &aurora_board[AURORA_BOARD(port - aurora_port)]; | 141 | return &aurora_board[AURORA_BOARD(port - aurora_port)]; |
142 | } | 142 | } |
143 | 143 | ||
144 | /* Wait for Channel Command Register ready */ | 144 | /* Wait for Channel Command Register ready */ |
145 | extern inline void aurora_wait_CCR(struct aurora_reg128 * r) | 145 | static inline void aurora_wait_CCR(struct aurora_reg128 * r) |
146 | { | 146 | { |
147 | unsigned long delay; | 147 | unsigned long delay; |
148 | 148 | ||
@@ -161,7 +161,7 @@ printk("aurora_wait_CCR\n"); | |||
161 | */ | 161 | */ |
162 | 162 | ||
163 | /* Must be called with enabled interrupts */ | 163 | /* Must be called with enabled interrupts */ |
164 | extern inline void aurora_long_delay(unsigned long delay) | 164 | static inline void aurora_long_delay(unsigned long delay) |
165 | { | 165 | { |
166 | unsigned long i; | 166 | unsigned long i; |
167 | 167 | ||
@@ -420,7 +420,7 @@ static void aurora_release_io_range(struct Aurora_board *bp) | |||
420 | sbus_iounmap((unsigned long)bp->r3, 4); | 420 | sbus_iounmap((unsigned long)bp->r3, 4); |
421 | } | 421 | } |
422 | 422 | ||
423 | extern inline void aurora_mark_event(struct Aurora_port * port, int event) | 423 | static inline void aurora_mark_event(struct Aurora_port * port, int event) |
424 | { | 424 | { |
425 | #ifdef AURORA_DEBUG | 425 | #ifdef AURORA_DEBUG |
426 | printk("aurora_mark_event: start\n"); | 426 | printk("aurora_mark_event: start\n"); |
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index c28e3aea1c3c..418fc7b896ac 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c | |||
@@ -816,7 +816,7 @@ static int adpt_hba_reset(adpt_hba* pHba) | |||
816 | static void adpt_i2o_sys_shutdown(void) | 816 | static void adpt_i2o_sys_shutdown(void) |
817 | { | 817 | { |
818 | adpt_hba *pHba, *pNext; | 818 | adpt_hba *pHba, *pNext; |
819 | struct adpt_i2o_post_wait_data *p1, *p2; | 819 | struct adpt_i2o_post_wait_data *p1, *old; |
820 | 820 | ||
821 | printk(KERN_INFO"Shutting down Adaptec I2O controllers.\n"); | 821 | printk(KERN_INFO"Shutting down Adaptec I2O controllers.\n"); |
822 | printk(KERN_INFO" This could take a few minutes if there are many devices attached\n"); | 822 | printk(KERN_INFO" This could take a few minutes if there are many devices attached\n"); |
@@ -830,13 +830,14 @@ static void adpt_i2o_sys_shutdown(void) | |||
830 | } | 830 | } |
831 | 831 | ||
832 | /* Remove any timedout entries from the wait queue. */ | 832 | /* Remove any timedout entries from the wait queue. */ |
833 | p2 = NULL; | ||
834 | // spin_lock_irqsave(&adpt_post_wait_lock, flags); | 833 | // spin_lock_irqsave(&adpt_post_wait_lock, flags); |
835 | /* Nothing should be outstanding at this point so just | 834 | /* Nothing should be outstanding at this point so just |
836 | * free them | 835 | * free them |
837 | */ | 836 | */ |
838 | for(p1 = adpt_post_wait_queue; p1; p2 = p1, p1 = p2->next) { | 837 | for(p1 = adpt_post_wait_queue; p1;) { |
839 | kfree(p1); | 838 | old = p1; |
839 | p1 = p1->next; | ||
840 | kfree(old); | ||
840 | } | 841 | } |
841 | // spin_unlock_irqrestore(&adpt_post_wait_lock, flags); | 842 | // spin_unlock_irqrestore(&adpt_post_wait_lock, flags); |
842 | adpt_post_wait_queue = NULL; | 843 | adpt_post_wait_queue = NULL; |
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 0be60bba58d3..180676d7115a 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
@@ -265,10 +265,10 @@ struct scsi_cmnd *scsi_get_command(struct scsi_device *dev, gfp_t gfp_mask) | |||
265 | spin_lock_irqsave(&dev->list_lock, flags); | 265 | spin_lock_irqsave(&dev->list_lock, flags); |
266 | list_add_tail(&cmd->list, &dev->cmd_list); | 266 | list_add_tail(&cmd->list, &dev->cmd_list); |
267 | spin_unlock_irqrestore(&dev->list_lock, flags); | 267 | spin_unlock_irqrestore(&dev->list_lock, flags); |
268 | cmd->jiffies_at_alloc = jiffies; | ||
268 | } else | 269 | } else |
269 | put_device(&dev->sdev_gendev); | 270 | put_device(&dev->sdev_gendev); |
270 | 271 | ||
271 | cmd->jiffies_at_alloc = jiffies; | ||
272 | return cmd; | 272 | return cmd; |
273 | } | 273 | } |
274 | EXPORT_SYMBOL(scsi_get_command); | 274 | EXPORT_SYMBOL(scsi_get_command); |
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index e08510d09ff6..d2bcd1f87cd6 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -102,7 +102,7 @@ static unsigned int share_irqs = SERIAL8250_SHARE_IRQS; | |||
102 | #define SERIAL_PORT_DFNS | 102 | #define SERIAL_PORT_DFNS |
103 | #endif | 103 | #endif |
104 | 104 | ||
105 | static struct old_serial_port old_serial_port[] = { | 105 | static const struct old_serial_port old_serial_port[] = { |
106 | SERIAL_PORT_DFNS /* defined in asm/serial.h */ | 106 | SERIAL_PORT_DFNS /* defined in asm/serial.h */ |
107 | }; | 107 | }; |
108 | 108 | ||
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c index 5c3c03932d6d..8d92adfbb8bd 100644 --- a/drivers/serial/8250_pci.c +++ b/drivers/serial/8250_pci.c | |||
@@ -468,7 +468,7 @@ static unsigned short timedia_eight_port[] = { | |||
468 | 0x9167, 0x9168, 0xA066, 0xA167, 0xA168, 0 | 468 | 0x9167, 0x9168, 0xA066, 0xA167, 0xA168, 0 |
469 | }; | 469 | }; |
470 | 470 | ||
471 | static struct timedia_struct { | 471 | static const struct timedia_struct { |
472 | int num; | 472 | int num; |
473 | unsigned short *ids; | 473 | unsigned short *ids; |
474 | } timedia_data[] = { | 474 | } timedia_data[] = { |
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c index 355cd93a8a87..83c4c1216587 100644 --- a/drivers/serial/imx.c +++ b/drivers/serial/imx.c | |||
@@ -994,7 +994,7 @@ static int __init imx_serial_init(void) | |||
994 | static void __exit imx_serial_exit(void) | 994 | static void __exit imx_serial_exit(void) |
995 | { | 995 | { |
996 | uart_unregister_driver(&imx_reg); | 996 | uart_unregister_driver(&imx_reg); |
997 | driver_unregister(&serial_imx_driver); | 997 | platform_driver_unregister(&serial_imx_driver); |
998 | } | 998 | } |
999 | 999 | ||
1000 | module_init(imx_serial_init); | 1000 | module_init(imx_serial_init); |
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 2331296e1e17..c17d680e3f04 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -1779,7 +1779,7 @@ struct baud_rates { | |||
1779 | unsigned int cflag; | 1779 | unsigned int cflag; |
1780 | }; | 1780 | }; |
1781 | 1781 | ||
1782 | static struct baud_rates baud_rates[] = { | 1782 | static const struct baud_rates baud_rates[] = { |
1783 | { 921600, B921600 }, | 1783 | { 921600, B921600 }, |
1784 | { 460800, B460800 }, | 1784 | { 460800, B460800 }, |
1785 | { 230400, B230400 }, | 1785 | { 230400, B230400 }, |
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index 2c7d3ef76e8e..7ce0c7e66d37 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c | |||
@@ -85,7 +85,7 @@ struct multi_id { | |||
85 | int multi; /* 1 = multifunction, > 1 = # ports */ | 85 | int multi; /* 1 = multifunction, > 1 = # ports */ |
86 | }; | 86 | }; |
87 | 87 | ||
88 | static struct multi_id multi_id[] = { | 88 | static const struct multi_id multi_id[] = { |
89 | { MANFID_OMEGA, PRODID_OMEGA_QSP_100, 4 }, | 89 | { MANFID_OMEGA, PRODID_OMEGA_QSP_100, 4 }, |
90 | { MANFID_QUATECH, PRODID_QUATECH_DUAL_RS232, 2 }, | 90 | { MANFID_QUATECH, PRODID_QUATECH_DUAL_RS232, 2 }, |
91 | { MANFID_QUATECH, PRODID_QUATECH_DUAL_RS232_D1, 2 }, | 91 | { MANFID_QUATECH, PRODID_QUATECH_DUAL_RS232_D1, 2 }, |
@@ -354,8 +354,8 @@ next_tuple(client_handle_t handle, tuple_t * tuple, cisparse_t * parse) | |||
354 | 354 | ||
355 | static int simple_config(dev_link_t *link) | 355 | static int simple_config(dev_link_t *link) |
356 | { | 356 | { |
357 | static kio_addr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; | 357 | static const kio_addr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; |
358 | static int size_table[2] = { 8, 16 }; | 358 | static const int size_table[2] = { 8, 16 }; |
359 | client_handle_t handle = link->handle; | 359 | client_handle_t handle = link->handle; |
360 | struct serial_info *info = link->priv; | 360 | struct serial_info *info = link->priv; |
361 | struct serial_cfg_mem *cfg_mem; | 361 | struct serial_cfg_mem *cfg_mem; |
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index 7feb829362d6..5131d88e8c5b 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
@@ -20,9 +20,17 @@ | |||
20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/pci.h> | 22 | #include <linux/pci.h> |
23 | #include <linux/usb.h> | ||
24 | |||
23 | #include <asm/io.h> | 25 | #include <asm/io.h> |
24 | #include <asm/irq.h> | 26 | #include <asm/irq.h> |
25 | #include <linux/usb.h> | 27 | |
28 | #ifdef CONFIG_PPC_PMAC | ||
29 | #include <asm/machdep.h> | ||
30 | #include <asm/pmac_feature.h> | ||
31 | #include <asm/pci-bridge.h> | ||
32 | #include <asm/prom.h> | ||
33 | #endif | ||
26 | 34 | ||
27 | #include "usb.h" | 35 | #include "usb.h" |
28 | #include "hcd.h" | 36 | #include "hcd.h" |
@@ -277,8 +285,22 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message) | |||
277 | } | 285 | } |
278 | 286 | ||
279 | done: | 287 | done: |
280 | if (retval == 0) | 288 | if (retval == 0) { |
281 | dev->dev.power.power_state = PMSG_SUSPEND; | 289 | dev->dev.power.power_state = PMSG_SUSPEND; |
290 | |||
291 | #ifdef CONFIG_PPC_PMAC | ||
292 | /* Disable ASIC clocks for USB */ | ||
293 | if (_machine == _MACH_Pmac) { | ||
294 | struct device_node *of_node; | ||
295 | |||
296 | of_node = pci_device_to_OF_node (dev); | ||
297 | if (of_node) | ||
298 | pmac_call_feature(PMAC_FTR_USB_ENABLE, | ||
299 | of_node, 0, 0); | ||
300 | } | ||
301 | #endif | ||
302 | } | ||
303 | |||
282 | return retval; | 304 | return retval; |
283 | } | 305 | } |
284 | EXPORT_SYMBOL (usb_hcd_pci_suspend); | 306 | EXPORT_SYMBOL (usb_hcd_pci_suspend); |
@@ -301,6 +323,18 @@ int usb_hcd_pci_resume (struct pci_dev *dev) | |||
301 | return 0; | 323 | return 0; |
302 | } | 324 | } |
303 | 325 | ||
326 | #ifdef CONFIG_PPC_PMAC | ||
327 | /* Reenable ASIC clocks for USB */ | ||
328 | if (_machine == _MACH_Pmac) { | ||
329 | struct device_node *of_node; | ||
330 | |||
331 | of_node = pci_device_to_OF_node (dev); | ||
332 | if (of_node) | ||
333 | pmac_call_feature (PMAC_FTR_USB_ENABLE, | ||
334 | of_node, 0, 1); | ||
335 | } | ||
336 | #endif | ||
337 | |||
304 | /* NOTE: chip docs cover clean "real suspend" cases (what Linux | 338 | /* NOTE: chip docs cover clean "real suspend" cases (what Linux |
305 | * calls "standby", "suspend to RAM", and so on). There are also | 339 | * calls "standby", "suspend to RAM", and so on). There are also |
306 | * dirty cases when swsusp fakes a suspend in "shutdown" mode. | 340 | * dirty cases when swsusp fakes a suspend in "shutdown" mode. |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 840727948d84..f78bd124d290 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -1669,7 +1669,6 @@ int usb_suspend_device(struct usb_device *udev) | |||
1669 | return 0; | 1669 | return 0; |
1670 | #endif | 1670 | #endif |
1671 | } | 1671 | } |
1672 | EXPORT_SYMBOL_GPL(usb_suspend_device); | ||
1673 | 1672 | ||
1674 | /* | 1673 | /* |
1675 | * If the USB "suspend" state is in use (rather than "global suspend"), | 1674 | * If the USB "suspend" state is in use (rather than "global suspend"), |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index af3c05eb86fc..29f52a44b928 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -411,50 +411,39 @@ static void ehci_stop (struct usb_hcd *hcd) | |||
411 | dbg_status (ehci, "ehci_stop completed", readl (&ehci->regs->status)); | 411 | dbg_status (ehci, "ehci_stop completed", readl (&ehci->regs->status)); |
412 | } | 412 | } |
413 | 413 | ||
414 | static int ehci_run (struct usb_hcd *hcd) | 414 | /* one-time init, only for memory state */ |
415 | static int ehci_init(struct usb_hcd *hcd) | ||
415 | { | 416 | { |
416 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); | 417 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); |
417 | u32 temp; | 418 | u32 temp; |
418 | int retval; | 419 | int retval; |
419 | u32 hcc_params; | 420 | u32 hcc_params; |
420 | int first; | 421 | |
421 | 422 | spin_lock_init(&ehci->lock); | |
422 | /* skip some things on restart paths */ | 423 | |
423 | first = (ehci->watchdog.data == 0); | 424 | init_timer(&ehci->watchdog); |
424 | if (first) { | 425 | ehci->watchdog.function = ehci_watchdog; |
425 | init_timer (&ehci->watchdog); | 426 | ehci->watchdog.data = (unsigned long) ehci; |
426 | ehci->watchdog.function = ehci_watchdog; | ||
427 | ehci->watchdog.data = (unsigned long) ehci; | ||
428 | } | ||
429 | 427 | ||
430 | /* | 428 | /* |
431 | * hw default: 1K periodic list heads, one per frame. | 429 | * hw default: 1K periodic list heads, one per frame. |
432 | * periodic_size can shrink by USBCMD update if hcc_params allows. | 430 | * periodic_size can shrink by USBCMD update if hcc_params allows. |
433 | */ | 431 | */ |
434 | ehci->periodic_size = DEFAULT_I_TDPS; | 432 | ehci->periodic_size = DEFAULT_I_TDPS; |
435 | if (first && (retval = ehci_mem_init (ehci, GFP_KERNEL)) < 0) | 433 | if ((retval = ehci_mem_init(ehci, GFP_KERNEL)) < 0) |
436 | return retval; | 434 | return retval; |
437 | 435 | ||
438 | /* controllers may cache some of the periodic schedule ... */ | 436 | /* controllers may cache some of the periodic schedule ... */ |
439 | hcc_params = readl (&ehci->caps->hcc_params); | 437 | hcc_params = readl(&ehci->caps->hcc_params); |
440 | if (HCC_ISOC_CACHE (hcc_params)) // full frame cache | 438 | if (HCC_ISOC_CACHE(hcc_params)) // full frame cache |
441 | ehci->i_thresh = 8; | 439 | ehci->i_thresh = 8; |
442 | else // N microframes cached | 440 | else // N microframes cached |
443 | ehci->i_thresh = 2 + HCC_ISOC_THRES (hcc_params); | 441 | ehci->i_thresh = 2 + HCC_ISOC_THRES(hcc_params); |
444 | 442 | ||
445 | ehci->reclaim = NULL; | 443 | ehci->reclaim = NULL; |
446 | ehci->reclaim_ready = 0; | 444 | ehci->reclaim_ready = 0; |
447 | ehci->next_uframe = -1; | 445 | ehci->next_uframe = -1; |
448 | 446 | ||
449 | /* controller state: unknown --> reset */ | ||
450 | |||
451 | /* EHCI spec section 4.1 */ | ||
452 | if ((retval = ehci_reset (ehci)) != 0) { | ||
453 | ehci_mem_cleanup (ehci); | ||
454 | return retval; | ||
455 | } | ||
456 | writel (ehci->periodic_dma, &ehci->regs->frame_list); | ||
457 | |||
458 | /* | 447 | /* |
459 | * dedicate a qh for the async ring head, since we couldn't unlink | 448 | * dedicate a qh for the async ring head, since we couldn't unlink |
460 | * a 'real' qh without stopping the async schedule [4.8]. use it | 449 | * a 'real' qh without stopping the async schedule [4.8]. use it |
@@ -462,37 +451,13 @@ static int ehci_run (struct usb_hcd *hcd) | |||
462 | * its dummy is used in hw_alt_next of many tds, to prevent the qh | 451 | * its dummy is used in hw_alt_next of many tds, to prevent the qh |
463 | * from automatically advancing to the next td after short reads. | 452 | * from automatically advancing to the next td after short reads. |
464 | */ | 453 | */ |
465 | if (first) { | 454 | ehci->async->qh_next.qh = NULL; |
466 | ehci->async->qh_next.qh = NULL; | 455 | ehci->async->hw_next = QH_NEXT(ehci->async->qh_dma); |
467 | ehci->async->hw_next = QH_NEXT (ehci->async->qh_dma); | 456 | ehci->async->hw_info1 = cpu_to_le32(QH_HEAD); |
468 | ehci->async->hw_info1 = cpu_to_le32 (QH_HEAD); | 457 | ehci->async->hw_token = cpu_to_le32(QTD_STS_HALT); |
469 | ehci->async->hw_token = cpu_to_le32 (QTD_STS_HALT); | 458 | ehci->async->hw_qtd_next = EHCI_LIST_END; |
470 | ehci->async->hw_qtd_next = EHCI_LIST_END; | 459 | ehci->async->qh_state = QH_STATE_LINKED; |
471 | ehci->async->qh_state = QH_STATE_LINKED; | 460 | ehci->async->hw_alt_next = QTD_NEXT(ehci->async->dummy->qtd_dma); |
472 | ehci->async->hw_alt_next = QTD_NEXT (ehci->async->dummy->qtd_dma); | ||
473 | } | ||
474 | writel ((u32)ehci->async->qh_dma, &ehci->regs->async_next); | ||
475 | |||
476 | /* | ||
477 | * hcc_params controls whether ehci->regs->segment must (!!!) | ||
478 | * be used; it constrains QH/ITD/SITD and QTD locations. | ||
479 | * pci_pool consistent memory always uses segment zero. | ||
480 | * streaming mappings for I/O buffers, like pci_map_single(), | ||
481 | * can return segments above 4GB, if the device allows. | ||
482 | * | ||
483 | * NOTE: the dma mask is visible through dma_supported(), so | ||
484 | * drivers can pass this info along ... like NETIF_F_HIGHDMA, | ||
485 | * Scsi_Host.highmem_io, and so forth. It's readonly to all | ||
486 | * host side drivers though. | ||
487 | */ | ||
488 | if (HCC_64BIT_ADDR (hcc_params)) { | ||
489 | writel (0, &ehci->regs->segment); | ||
490 | #if 0 | ||
491 | // this is deeply broken on almost all architectures | ||
492 | if (!dma_set_mask (hcd->self.controller, DMA_64BIT_MASK)) | ||
493 | ehci_info (ehci, "enabled 64bit DMA\n"); | ||
494 | #endif | ||
495 | } | ||
496 | 461 | ||
497 | /* clear interrupt enables, set irq latency */ | 462 | /* clear interrupt enables, set irq latency */ |
498 | if (log2_irq_thresh < 0 || log2_irq_thresh > 6) | 463 | if (log2_irq_thresh < 0 || log2_irq_thresh > 6) |
@@ -507,13 +472,13 @@ static int ehci_run (struct usb_hcd *hcd) | |||
507 | * make problems: throughput reduction (!), data errors... | 472 | * make problems: throughput reduction (!), data errors... |
508 | */ | 473 | */ |
509 | if (park) { | 474 | if (park) { |
510 | park = min (park, (unsigned) 3); | 475 | park = min(park, (unsigned) 3); |
511 | temp |= CMD_PARK; | 476 | temp |= CMD_PARK; |
512 | temp |= park << 8; | 477 | temp |= park << 8; |
513 | } | 478 | } |
514 | ehci_info (ehci, "park %d\n", park); | 479 | ehci_dbg(ehci, "park %d\n", park); |
515 | } | 480 | } |
516 | if (HCC_PGM_FRAMELISTLEN (hcc_params)) { | 481 | if (HCC_PGM_FRAMELISTLEN(hcc_params)) { |
517 | /* periodic schedule size can be smaller than default */ | 482 | /* periodic schedule size can be smaller than default */ |
518 | temp &= ~(3 << 2); | 483 | temp &= ~(3 << 2); |
519 | temp |= (EHCI_TUNE_FLS << 2); | 484 | temp |= (EHCI_TUNE_FLS << 2); |
@@ -521,16 +486,63 @@ static int ehci_run (struct usb_hcd *hcd) | |||
521 | case 0: ehci->periodic_size = 1024; break; | 486 | case 0: ehci->periodic_size = 1024; break; |
522 | case 1: ehci->periodic_size = 512; break; | 487 | case 1: ehci->periodic_size = 512; break; |
523 | case 2: ehci->periodic_size = 256; break; | 488 | case 2: ehci->periodic_size = 256; break; |
524 | default: BUG (); | 489 | default: BUG(); |
525 | } | 490 | } |
526 | } | 491 | } |
492 | ehci->command = temp; | ||
493 | |||
494 | ehci->reboot_notifier.notifier_call = ehci_reboot; | ||
495 | register_reboot_notifier(&ehci->reboot_notifier); | ||
496 | |||
497 | return 0; | ||
498 | } | ||
499 | |||
500 | /* start HC running; it's halted, ehci_init() has been run (once) */ | ||
501 | static int ehci_run (struct usb_hcd *hcd) | ||
502 | { | ||
503 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); | ||
504 | int retval; | ||
505 | u32 temp; | ||
506 | u32 hcc_params; | ||
507 | |||
508 | /* EHCI spec section 4.1 */ | ||
509 | if ((retval = ehci_reset(ehci)) != 0) { | ||
510 | unregister_reboot_notifier(&ehci->reboot_notifier); | ||
511 | ehci_mem_cleanup(ehci); | ||
512 | return retval; | ||
513 | } | ||
514 | writel(ehci->periodic_dma, &ehci->regs->frame_list); | ||
515 | writel((u32)ehci->async->qh_dma, &ehci->regs->async_next); | ||
516 | |||
517 | /* | ||
518 | * hcc_params controls whether ehci->regs->segment must (!!!) | ||
519 | * be used; it constrains QH/ITD/SITD and QTD locations. | ||
520 | * pci_pool consistent memory always uses segment zero. | ||
521 | * streaming mappings for I/O buffers, like pci_map_single(), | ||
522 | * can return segments above 4GB, if the device allows. | ||
523 | * | ||
524 | * NOTE: the dma mask is visible through dma_supported(), so | ||
525 | * drivers can pass this info along ... like NETIF_F_HIGHDMA, | ||
526 | * Scsi_Host.highmem_io, and so forth. It's readonly to all | ||
527 | * host side drivers though. | ||
528 | */ | ||
529 | hcc_params = readl(&ehci->caps->hcc_params); | ||
530 | if (HCC_64BIT_ADDR(hcc_params)) { | ||
531 | writel(0, &ehci->regs->segment); | ||
532 | #if 0 | ||
533 | // this is deeply broken on almost all architectures | ||
534 | if (!dma_set_mask(hcd->self.controller, DMA_64BIT_MASK)) | ||
535 | ehci_info(ehci, "enabled 64bit DMA\n"); | ||
536 | #endif | ||
537 | } | ||
538 | |||
539 | |||
527 | // Philips, Intel, and maybe others need CMD_RUN before the | 540 | // Philips, Intel, and maybe others need CMD_RUN before the |
528 | // root hub will detect new devices (why?); NEC doesn't | 541 | // root hub will detect new devices (why?); NEC doesn't |
529 | temp |= CMD_RUN; | 542 | ehci->command &= ~(CMD_LRESET|CMD_IAAD|CMD_PSE|CMD_ASE|CMD_RESET); |
530 | writel (temp, &ehci->regs->command); | 543 | ehci->command |= CMD_RUN; |
531 | dbg_cmd (ehci, "init", temp); | 544 | writel (ehci->command, &ehci->regs->command); |
532 | 545 | dbg_cmd (ehci, "init", ehci->command); | |
533 | /* set async sleep time = 10 us ... ? */ | ||
534 | 546 | ||
535 | /* | 547 | /* |
536 | * Start, enabling full USB 2.0 functionality ... usb 1.1 devices | 548 | * Start, enabling full USB 2.0 functionality ... usb 1.1 devices |
@@ -538,26 +550,23 @@ static int ehci_run (struct usb_hcd *hcd) | |||
538 | * involved with the root hub. (Except where one is integrated, | 550 | * involved with the root hub. (Except where one is integrated, |
539 | * and there's no companion controller unless maybe for USB OTG.) | 551 | * and there's no companion controller unless maybe for USB OTG.) |
540 | */ | 552 | */ |
541 | if (first) { | ||
542 | ehci->reboot_notifier.notifier_call = ehci_reboot; | ||
543 | register_reboot_notifier (&ehci->reboot_notifier); | ||
544 | } | ||
545 | |||
546 | hcd->state = HC_STATE_RUNNING; | 553 | hcd->state = HC_STATE_RUNNING; |
547 | writel (FLAG_CF, &ehci->regs->configured_flag); | 554 | writel (FLAG_CF, &ehci->regs->configured_flag); |
548 | readl (&ehci->regs->command); /* unblock posted write */ | 555 | readl (&ehci->regs->command); /* unblock posted writes */ |
549 | 556 | ||
550 | temp = HC_VERSION(readl (&ehci->caps->hc_capbase)); | 557 | temp = HC_VERSION(readl (&ehci->caps->hc_capbase)); |
551 | ehci_info (ehci, | 558 | ehci_info (ehci, |
552 | "USB %x.%x %s, EHCI %x.%02x, driver %s\n", | 559 | "USB %x.%x started, EHCI %x.%02x, driver %s\n", |
553 | ((ehci->sbrn & 0xf0)>>4), (ehci->sbrn & 0x0f), | 560 | ((ehci->sbrn & 0xf0)>>4), (ehci->sbrn & 0x0f), |
554 | first ? "initialized" : "restarted", | ||
555 | temp >> 8, temp & 0xff, DRIVER_VERSION); | 561 | temp >> 8, temp & 0xff, DRIVER_VERSION); |
556 | 562 | ||
557 | writel (INTR_MASK, &ehci->regs->intr_enable); /* Turn On Interrupts */ | 563 | writel (INTR_MASK, &ehci->regs->intr_enable); /* Turn On Interrupts */ |
558 | 564 | ||
559 | if (first) | 565 | /* GRR this is run-once init(), being done every time the HC starts. |
560 | create_debug_files (ehci); | 566 | * So long as they're part of class devices, we can't do it init() |
567 | * since the class device isn't created that early. | ||
568 | */ | ||
569 | create_debug_files(ehci); | ||
561 | 570 | ||
562 | return 0; | 571 | return 0; |
563 | } | 572 | } |
@@ -636,9 +645,8 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs) | |||
636 | * stop that signaling. | 645 | * stop that signaling. |
637 | */ | 646 | */ |
638 | ehci->reset_done [i] = jiffies + msecs_to_jiffies (20); | 647 | ehci->reset_done [i] = jiffies + msecs_to_jiffies (20); |
639 | mod_timer (&hcd->rh_timer, | ||
640 | ehci->reset_done [i] + 1); | ||
641 | ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); | 648 | ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); |
649 | usb_hcd_resume_root_hub(hcd); | ||
642 | } | 650 | } |
643 | } | 651 | } |
644 | 652 | ||
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 88cb4ada686e..82caf336e9b6 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
@@ -94,6 +94,13 @@ static int ehci_bus_resume (struct usb_hcd *hcd) | |||
94 | msleep(5); | 94 | msleep(5); |
95 | spin_lock_irq (&ehci->lock); | 95 | spin_lock_irq (&ehci->lock); |
96 | 96 | ||
97 | /* Ideally and we've got a real resume here, and no port's power | ||
98 | * was lost. (For PCI, that means Vaux was maintained.) But we | ||
99 | * could instead be restoring a swsusp snapshot -- so that BIOS was | ||
100 | * the last user of the controller, not reset/pm hardware keeping | ||
101 | * state we gave to it. | ||
102 | */ | ||
103 | |||
97 | /* re-init operational registers in case we lost power */ | 104 | /* re-init operational registers in case we lost power */ |
98 | if (readl (&ehci->regs->intr_enable) == 0) { | 105 | if (readl (&ehci->regs->intr_enable) == 0) { |
99 | /* at least some APM implementations will try to deliver | 106 | /* at least some APM implementations will try to deliver |
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index dfd9bd0b1828..441c26064b44 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -27,7 +27,7 @@ | |||
27 | /* EHCI 0.96 (and later) section 5.1 says how to kick BIOS/SMM/... | 27 | /* EHCI 0.96 (and later) section 5.1 says how to kick BIOS/SMM/... |
28 | * off the controller (maybe it can boot from highspeed USB disks). | 28 | * off the controller (maybe it can boot from highspeed USB disks). |
29 | */ | 29 | */ |
30 | static int bios_handoff (struct ehci_hcd *ehci, int where, u32 cap) | 30 | static int bios_handoff(struct ehci_hcd *ehci, int where, u32 cap) |
31 | { | 31 | { |
32 | struct pci_dev *pdev = to_pci_dev(ehci_to_hcd(ehci)->self.controller); | 32 | struct pci_dev *pdev = to_pci_dev(ehci_to_hcd(ehci)->self.controller); |
33 | 33 | ||
@@ -48,7 +48,7 @@ static int bios_handoff (struct ehci_hcd *ehci, int where, u32 cap) | |||
48 | where, cap); | 48 | where, cap); |
49 | // some BIOS versions seem buggy... | 49 | // some BIOS versions seem buggy... |
50 | // return 1; | 50 | // return 1; |
51 | ehci_warn (ehci, "continuing after BIOS bug...\n"); | 51 | ehci_warn(ehci, "continuing after BIOS bug...\n"); |
52 | /* disable all SMIs, and clear "BIOS owns" flag */ | 52 | /* disable all SMIs, and clear "BIOS owns" flag */ |
53 | pci_write_config_dword(pdev, where + 4, 0); | 53 | pci_write_config_dword(pdev, where + 4, 0); |
54 | pci_write_config_byte(pdev, where + 2, 0); | 54 | pci_write_config_byte(pdev, where + 2, 0); |
@@ -58,96 +58,47 @@ static int bios_handoff (struct ehci_hcd *ehci, int where, u32 cap) | |||
58 | return 0; | 58 | return 0; |
59 | } | 59 | } |
60 | 60 | ||
61 | /* called by khubd or root hub init threads */ | 61 | /* called after powerup, by probe or system-pm "wakeup" */ |
62 | static int ehci_pci_reset (struct usb_hcd *hcd) | 62 | static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev) |
63 | { | 63 | { |
64 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); | ||
65 | u32 temp; | 64 | u32 temp; |
65 | int retval; | ||
66 | unsigned count = 256/4; | 66 | unsigned count = 256/4; |
67 | 67 | ||
68 | spin_lock_init (&ehci->lock); | 68 | /* optional debug port, normally in the first BAR */ |
69 | 69 | temp = pci_find_capability(pdev, 0x0a); | |
70 | ehci->caps = hcd->regs; | 70 | if (temp) { |
71 | ehci->regs = hcd->regs + HC_LENGTH (readl (&ehci->caps->hc_capbase)); | 71 | pci_read_config_dword(pdev, temp, &temp); |
72 | dbg_hcs_params (ehci, "reset"); | 72 | temp >>= 16; |
73 | dbg_hcc_params (ehci, "reset"); | 73 | if ((temp & (3 << 13)) == (1 << 13)) { |
74 | 74 | temp &= 0x1fff; | |
75 | /* cache this readonly data; minimize chip reads */ | 75 | ehci->debug = ehci_to_hcd(ehci)->regs + temp; |
76 | ehci->hcs_params = readl (&ehci->caps->hcs_params); | 76 | temp = readl(&ehci->debug->control); |
77 | 77 | ehci_info(ehci, "debug port %d%s\n", | |
78 | if (hcd->self.controller->bus == &pci_bus_type) { | 78 | HCS_DEBUG_PORT(ehci->hcs_params), |
79 | struct pci_dev *pdev = to_pci_dev(hcd->self.controller); | 79 | (temp & DBGP_ENABLED) |
80 | 80 | ? " IN USE" | |
81 | switch (pdev->vendor) { | 81 | : ""); |
82 | case PCI_VENDOR_ID_TDI: | 82 | if (!(temp & DBGP_ENABLED)) |
83 | if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { | 83 | ehci->debug = NULL; |
84 | ehci->is_tdi_rh_tt = 1; | ||
85 | tdi_reset (ehci); | ||
86 | } | ||
87 | break; | ||
88 | case PCI_VENDOR_ID_AMD: | ||
89 | /* AMD8111 EHCI doesn't work, according to AMD errata */ | ||
90 | if (pdev->device == 0x7463) { | ||
91 | ehci_info (ehci, "ignoring AMD8111 (errata)\n"); | ||
92 | return -EIO; | ||
93 | } | ||
94 | break; | ||
95 | case PCI_VENDOR_ID_NVIDIA: | ||
96 | /* NVidia reports that certain chips don't handle | ||
97 | * QH, ITD, or SITD addresses above 2GB. (But TD, | ||
98 | * data buffer, and periodic schedule are normal.) | ||
99 | */ | ||
100 | switch (pdev->device) { | ||
101 | case 0x003c: /* MCP04 */ | ||
102 | case 0x005b: /* CK804 */ | ||
103 | case 0x00d8: /* CK8 */ | ||
104 | case 0x00e8: /* CK8S */ | ||
105 | if (pci_set_consistent_dma_mask(pdev, | ||
106 | DMA_31BIT_MASK) < 0) | ||
107 | ehci_warn (ehci, "can't enable NVidia " | ||
108 | "workaround for >2GB RAM\n"); | ||
109 | break; | ||
110 | } | ||
111 | break; | ||
112 | } | ||
113 | |||
114 | /* optional debug port, normally in the first BAR */ | ||
115 | temp = pci_find_capability (pdev, 0x0a); | ||
116 | if (temp) { | ||
117 | pci_read_config_dword(pdev, temp, &temp); | ||
118 | temp >>= 16; | ||
119 | if ((temp & (3 << 13)) == (1 << 13)) { | ||
120 | temp &= 0x1fff; | ||
121 | ehci->debug = hcd->regs + temp; | ||
122 | temp = readl (&ehci->debug->control); | ||
123 | ehci_info (ehci, "debug port %d%s\n", | ||
124 | HCS_DEBUG_PORT(ehci->hcs_params), | ||
125 | (temp & DBGP_ENABLED) | ||
126 | ? " IN USE" | ||
127 | : ""); | ||
128 | if (!(temp & DBGP_ENABLED)) | ||
129 | ehci->debug = NULL; | ||
130 | } | ||
131 | } | 84 | } |
85 | } | ||
132 | 86 | ||
133 | temp = HCC_EXT_CAPS (readl (&ehci->caps->hcc_params)); | 87 | temp = HCC_EXT_CAPS(readl(&ehci->caps->hcc_params)); |
134 | } else | ||
135 | temp = 0; | ||
136 | 88 | ||
137 | /* EHCI 0.96 and later may have "extended capabilities" */ | 89 | /* EHCI 0.96 and later may have "extended capabilities" */ |
138 | while (temp && count--) { | 90 | while (temp && count--) { |
139 | u32 cap; | 91 | u32 cap; |
140 | 92 | ||
141 | pci_read_config_dword (to_pci_dev(hcd->self.controller), | 93 | pci_read_config_dword(pdev, temp, &cap); |
142 | temp, &cap); | 94 | ehci_dbg(ehci, "capability %04x at %02x\n", cap, temp); |
143 | ehci_dbg (ehci, "capability %04x at %02x\n", cap, temp); | ||
144 | switch (cap & 0xff) { | 95 | switch (cap & 0xff) { |
145 | case 1: /* BIOS/SMM/... handoff */ | 96 | case 1: /* BIOS/SMM/... handoff */ |
146 | if (bios_handoff (ehci, temp, cap) != 0) | 97 | if (bios_handoff(ehci, temp, cap) != 0) |
147 | return -EOPNOTSUPP; | 98 | return -EOPNOTSUPP; |
148 | break; | 99 | break; |
149 | case 0: /* illegal reserved capability */ | 100 | case 0: /* illegal reserved capability */ |
150 | ehci_warn (ehci, "illegal capability!\n"); | 101 | ehci_dbg(ehci, "illegal capability!\n"); |
151 | cap = 0; | 102 | cap = 0; |
152 | /* FALLTHROUGH */ | 103 | /* FALLTHROUGH */ |
153 | default: /* unknown */ | 104 | default: /* unknown */ |
@@ -156,77 +107,109 @@ static int ehci_pci_reset (struct usb_hcd *hcd) | |||
156 | temp = (cap >> 8) & 0xff; | 107 | temp = (cap >> 8) & 0xff; |
157 | } | 108 | } |
158 | if (!count) { | 109 | if (!count) { |
159 | ehci_err (ehci, "bogus capabilities ... PCI problems!\n"); | 110 | ehci_err(ehci, "bogus capabilities ... PCI problems!\n"); |
160 | return -EIO; | 111 | return -EIO; |
161 | } | 112 | } |
162 | if (ehci_is_TDI(ehci)) | ||
163 | ehci_reset (ehci); | ||
164 | 113 | ||
165 | ehci_port_power (ehci, 0); | 114 | /* PCI Memory-Write-Invalidate cycle support is optional (uncommon) */ |
115 | retval = pci_set_mwi(pdev); | ||
116 | if (!retval) | ||
117 | ehci_dbg(ehci, "MWI active\n"); | ||
118 | |||
119 | ehci_port_power(ehci, 0); | ||
120 | |||
121 | return 0; | ||
122 | } | ||
123 | |||
124 | /* called by khubd or root hub (re)init threads; leaves HC in halt state */ | ||
125 | static int ehci_pci_reset(struct usb_hcd *hcd) | ||
126 | { | ||
127 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | ||
128 | struct pci_dev *pdev = to_pci_dev(hcd->self.controller); | ||
129 | u32 temp; | ||
130 | int retval; | ||
131 | |||
132 | ehci->caps = hcd->regs; | ||
133 | ehci->regs = hcd->regs + HC_LENGTH(readl(&ehci->caps->hc_capbase)); | ||
134 | dbg_hcs_params(ehci, "reset"); | ||
135 | dbg_hcc_params(ehci, "reset"); | ||
136 | |||
137 | /* cache this readonly data; minimize chip reads */ | ||
138 | ehci->hcs_params = readl(&ehci->caps->hcs_params); | ||
139 | |||
140 | retval = ehci_halt(ehci); | ||
141 | if (retval) | ||
142 | return retval; | ||
143 | |||
144 | /* NOTE: only the parts below this line are PCI-specific */ | ||
145 | |||
146 | switch (pdev->vendor) { | ||
147 | case PCI_VENDOR_ID_TDI: | ||
148 | if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { | ||
149 | ehci->is_tdi_rh_tt = 1; | ||
150 | tdi_reset(ehci); | ||
151 | } | ||
152 | break; | ||
153 | case PCI_VENDOR_ID_AMD: | ||
154 | /* AMD8111 EHCI doesn't work, according to AMD errata */ | ||
155 | if (pdev->device == 0x7463) { | ||
156 | ehci_info(ehci, "ignoring AMD8111 (errata)\n"); | ||
157 | return -EIO; | ||
158 | } | ||
159 | break; | ||
160 | case PCI_VENDOR_ID_NVIDIA: | ||
161 | /* NVidia reports that certain chips don't handle | ||
162 | * QH, ITD, or SITD addresses above 2GB. (But TD, | ||
163 | * data buffer, and periodic schedule are normal.) | ||
164 | */ | ||
165 | switch (pdev->device) { | ||
166 | case 0x003c: /* MCP04 */ | ||
167 | case 0x005b: /* CK804 */ | ||
168 | case 0x00d8: /* CK8 */ | ||
169 | case 0x00e8: /* CK8S */ | ||
170 | if (pci_set_consistent_dma_mask(pdev, | ||
171 | DMA_31BIT_MASK) < 0) | ||
172 | ehci_warn(ehci, "can't enable NVidia " | ||
173 | "workaround for >2GB RAM\n"); | ||
174 | break; | ||
175 | } | ||
176 | break; | ||
177 | } | ||
178 | |||
179 | if (ehci_is_TDI(ehci)) | ||
180 | ehci_reset(ehci); | ||
166 | 181 | ||
167 | /* at least the Genesys GL880S needs fixup here */ | 182 | /* at least the Genesys GL880S needs fixup here */ |
168 | temp = HCS_N_CC(ehci->hcs_params) * HCS_N_PCC(ehci->hcs_params); | 183 | temp = HCS_N_CC(ehci->hcs_params) * HCS_N_PCC(ehci->hcs_params); |
169 | temp &= 0x0f; | 184 | temp &= 0x0f; |
170 | if (temp && HCS_N_PORTS(ehci->hcs_params) > temp) { | 185 | if (temp && HCS_N_PORTS(ehci->hcs_params) > temp) { |
171 | ehci_dbg (ehci, "bogus port configuration: " | 186 | ehci_dbg(ehci, "bogus port configuration: " |
172 | "cc=%d x pcc=%d < ports=%d\n", | 187 | "cc=%d x pcc=%d < ports=%d\n", |
173 | HCS_N_CC(ehci->hcs_params), | 188 | HCS_N_CC(ehci->hcs_params), |
174 | HCS_N_PCC(ehci->hcs_params), | 189 | HCS_N_PCC(ehci->hcs_params), |
175 | HCS_N_PORTS(ehci->hcs_params)); | 190 | HCS_N_PORTS(ehci->hcs_params)); |
176 | 191 | ||
177 | if (hcd->self.controller->bus == &pci_bus_type) { | 192 | switch (pdev->vendor) { |
178 | struct pci_dev *pdev; | 193 | case 0x17a0: /* GENESYS */ |
179 | 194 | /* GL880S: should be PORTS=2 */ | |
180 | pdev = to_pci_dev(hcd->self.controller); | 195 | temp |= (ehci->hcs_params & ~0xf); |
181 | switch (pdev->vendor) { | 196 | ehci->hcs_params = temp; |
182 | case 0x17a0: /* GENESYS */ | 197 | break; |
183 | /* GL880S: should be PORTS=2 */ | 198 | case PCI_VENDOR_ID_NVIDIA: |
184 | temp |= (ehci->hcs_params & ~0xf); | 199 | /* NF4: should be PCC=10 */ |
185 | ehci->hcs_params = temp; | 200 | break; |
186 | break; | ||
187 | case PCI_VENDOR_ID_NVIDIA: | ||
188 | /* NF4: should be PCC=10 */ | ||
189 | break; | ||
190 | } | ||
191 | } | 201 | } |
192 | } | 202 | } |
193 | 203 | ||
194 | /* force HC to halt state */ | 204 | /* Serial Bus Release Number is at PCI 0x60 offset */ |
195 | return ehci_halt (ehci); | 205 | pci_read_config_byte(pdev, 0x60, &ehci->sbrn); |
196 | } | ||
197 | |||
198 | static int ehci_pci_start (struct usb_hcd *hcd) | ||
199 | { | ||
200 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); | ||
201 | int result = 0; | ||
202 | |||
203 | if (hcd->self.controller->bus == &pci_bus_type) { | ||
204 | struct pci_dev *pdev; | ||
205 | u16 port_wake; | ||
206 | |||
207 | pdev = to_pci_dev(hcd->self.controller); | ||
208 | |||
209 | /* Serial Bus Release Number is at PCI 0x60 offset */ | ||
210 | pci_read_config_byte(pdev, 0x60, &ehci->sbrn); | ||
211 | |||
212 | /* port wake capability, reported by boot firmware */ | ||
213 | pci_read_config_word(pdev, 0x62, &port_wake); | ||
214 | hcd->can_wakeup = (port_wake & 1) != 0; | ||
215 | 206 | ||
216 | /* help hc dma work well with cachelines */ | 207 | /* REVISIT: per-port wake capability (PCI 0x62) currently unused */ |
217 | result = pci_set_mwi(pdev); | ||
218 | if (result) | ||
219 | ehci_dbg(ehci, "unable to enable MWI - not fatal.\n"); | ||
220 | } | ||
221 | |||
222 | return ehci_run (hcd); | ||
223 | } | ||
224 | 208 | ||
225 | /* always called by thread; normally rmmod */ | 209 | retval = ehci_pci_reinit(ehci, pdev); |
226 | 210 | ||
227 | static void ehci_pci_stop (struct usb_hcd *hcd) | 211 | /* finish init */ |
228 | { | 212 | return ehci_init(hcd); |
229 | ehci_stop (hcd); | ||
230 | } | 213 | } |
231 | 214 | ||
232 | /*-------------------------------------------------------------------------*/ | 215 | /*-------------------------------------------------------------------------*/ |
@@ -235,90 +218,88 @@ static void ehci_pci_stop (struct usb_hcd *hcd) | |||
235 | 218 | ||
236 | /* suspend/resume, section 4.3 */ | 219 | /* suspend/resume, section 4.3 */ |
237 | 220 | ||
238 | /* These routines rely on the bus (pci, platform, etc) | 221 | /* These routines rely on the PCI bus glue |
239 | * to handle powerdown and wakeup, and currently also on | 222 | * to handle powerdown and wakeup, and currently also on |
240 | * transceivers that don't need any software attention to set up | 223 | * transceivers that don't need any software attention to set up |
241 | * the right sort of wakeup. | 224 | * the right sort of wakeup. |
225 | * Also they depend on separate root hub suspend/resume. | ||
242 | */ | 226 | */ |
243 | 227 | ||
244 | static int ehci_pci_suspend (struct usb_hcd *hcd, pm_message_t message) | 228 | static int ehci_pci_suspend(struct usb_hcd *hcd, pm_message_t message) |
245 | { | 229 | { |
246 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); | 230 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); |
247 | 231 | ||
248 | if (time_before (jiffies, ehci->next_statechange)) | 232 | if (time_before(jiffies, ehci->next_statechange)) |
249 | msleep (100); | 233 | msleep(10); |
250 | 234 | ||
251 | #ifdef CONFIG_USB_SUSPEND | 235 | // could save FLADJ in case of Vaux power loss |
252 | (void) usb_suspend_device (hcd->self.root_hub); | ||
253 | #else | ||
254 | usb_lock_device (hcd->self.root_hub); | ||
255 | (void) ehci_bus_suspend (hcd); | ||
256 | usb_unlock_device (hcd->self.root_hub); | ||
257 | #endif | ||
258 | |||
259 | // save (PCI) FLADJ in case of Vaux power loss | ||
260 | // ... we'd only use it to handle clock skew | 236 | // ... we'd only use it to handle clock skew |
261 | 237 | ||
262 | return 0; | 238 | return 0; |
263 | } | 239 | } |
264 | 240 | ||
265 | static int ehci_pci_resume (struct usb_hcd *hcd) | 241 | static int ehci_pci_resume(struct usb_hcd *hcd) |
266 | { | 242 | { |
267 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); | 243 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); |
268 | unsigned port; | 244 | unsigned port; |
269 | struct usb_device *root = hcd->self.root_hub; | 245 | struct usb_device *root = hcd->self.root_hub; |
246 | struct pci_dev *pdev = to_pci_dev(hcd->self.controller); | ||
270 | int retval = -EINVAL; | 247 | int retval = -EINVAL; |
271 | 248 | ||
272 | // maybe restore (PCI) FLADJ | 249 | // maybe restore FLADJ |
273 | 250 | ||
274 | if (time_before (jiffies, ehci->next_statechange)) | 251 | if (time_before(jiffies, ehci->next_statechange)) |
275 | msleep (100); | 252 | msleep(100); |
253 | |||
254 | /* If CF is clear, we lost PCI Vaux power and need to restart. */ | ||
255 | if (readl(&ehci->regs->configured_flag) != FLAG_CF) | ||
256 | goto restart; | ||
276 | 257 | ||
277 | /* If any port is suspended (or owned by the companion), | 258 | /* If any port is suspended (or owned by the companion), |
278 | * we know we can/must resume the HC (and mustn't reset it). | 259 | * we know we can/must resume the HC (and mustn't reset it). |
260 | * We just defer that to the root hub code. | ||
279 | */ | 261 | */ |
280 | for (port = HCS_N_PORTS (ehci->hcs_params); port > 0; ) { | 262 | for (port = HCS_N_PORTS(ehci->hcs_params); port > 0; ) { |
281 | u32 status; | 263 | u32 status; |
282 | port--; | 264 | port--; |
283 | status = readl (&ehci->regs->port_status [port]); | 265 | status = readl(&ehci->regs->port_status [port]); |
284 | if (!(status & PORT_POWER)) | 266 | if (!(status & PORT_POWER)) |
285 | continue; | 267 | continue; |
286 | if (status & (PORT_SUSPEND | PORT_OWNER)) { | 268 | if (status & (PORT_SUSPEND | PORT_RESUME | PORT_OWNER)) { |
287 | down (&hcd->self.root_hub->serialize); | 269 | usb_hcd_resume_root_hub(hcd); |
288 | retval = ehci_bus_resume (hcd); | 270 | return 0; |
289 | up (&hcd->self.root_hub->serialize); | ||
290 | break; | ||
291 | } | 271 | } |
272 | } | ||
273 | |||
274 | restart: | ||
275 | ehci_dbg(ehci, "lost power, restarting\n"); | ||
276 | for (port = HCS_N_PORTS(ehci->hcs_params); port > 0; ) { | ||
277 | port--; | ||
292 | if (!root->children [port]) | 278 | if (!root->children [port]) |
293 | continue; | 279 | continue; |
294 | dbg_port (ehci, __FUNCTION__, port + 1, status); | 280 | usb_set_device_state(root->children[port], |
295 | usb_set_device_state (root->children[port], | ||
296 | USB_STATE_NOTATTACHED); | 281 | USB_STATE_NOTATTACHED); |
297 | } | 282 | } |
298 | 283 | ||
299 | /* Else reset, to cope with power loss or flush-to-storage | 284 | /* Else reset, to cope with power loss or flush-to-storage |
300 | * style "resume" having activated BIOS during reboot. | 285 | * style "resume" having let BIOS kick in during reboot. |
301 | */ | 286 | */ |
302 | if (port == 0) { | 287 | (void) ehci_halt(ehci); |
303 | (void) ehci_halt (ehci); | 288 | (void) ehci_reset(ehci); |
304 | (void) ehci_reset (ehci); | 289 | (void) ehci_pci_reinit(ehci, pdev); |
305 | (void) ehci_pci_reset (hcd); | 290 | |
306 | 291 | /* emptying the schedule aborts any urbs */ | |
307 | /* emptying the schedule aborts any urbs */ | 292 | spin_lock_irq(&ehci->lock); |
308 | spin_lock_irq (&ehci->lock); | 293 | if (ehci->reclaim) |
309 | if (ehci->reclaim) | 294 | ehci->reclaim_ready = 1; |
310 | ehci->reclaim_ready = 1; | 295 | ehci_work(ehci, NULL); |
311 | ehci_work (ehci, NULL); | 296 | spin_unlock_irq(&ehci->lock); |
312 | spin_unlock_irq (&ehci->lock); | 297 | |
313 | 298 | /* restart; khubd will disconnect devices */ | |
314 | /* restart; khubd will disconnect devices */ | 299 | retval = ehci_run(hcd); |
315 | retval = ehci_run (hcd); | 300 | |
316 | 301 | /* here we "know" root ports should always stay powered */ | |
317 | /* here we "know" root ports should always stay powered; | 302 | ehci_port_power(ehci, 1); |
318 | * but some controllers may lose all power. | ||
319 | */ | ||
320 | ehci_port_power (ehci, 1); | ||
321 | } | ||
322 | 303 | ||
323 | return retval; | 304 | return retval; |
324 | } | 305 | } |
@@ -339,12 +320,12 @@ static const struct hc_driver ehci_pci_hc_driver = { | |||
339 | * basic lifecycle operations | 320 | * basic lifecycle operations |
340 | */ | 321 | */ |
341 | .reset = ehci_pci_reset, | 322 | .reset = ehci_pci_reset, |
342 | .start = ehci_pci_start, | 323 | .start = ehci_run, |
343 | #ifdef CONFIG_PM | 324 | #ifdef CONFIG_PM |
344 | .suspend = ehci_pci_suspend, | 325 | .suspend = ehci_pci_suspend, |
345 | .resume = ehci_pci_resume, | 326 | .resume = ehci_pci_resume, |
346 | #endif | 327 | #endif |
347 | .stop = ehci_pci_stop, | 328 | .stop = ehci_stop, |
348 | 329 | ||
349 | /* | 330 | /* |
350 | * managing i/o requests and associated device resources | 331 | * managing i/o requests and associated device resources |
@@ -377,7 +358,7 @@ static const struct pci_device_id pci_ids [] = { { | |||
377 | }, | 358 | }, |
378 | { /* end: all zeroes */ } | 359 | { /* end: all zeroes */ } |
379 | }; | 360 | }; |
380 | MODULE_DEVICE_TABLE (pci, pci_ids); | 361 | MODULE_DEVICE_TABLE(pci, pci_ids); |
381 | 362 | ||
382 | /* pci driver glue; this is a "new style" PCI driver module */ | 363 | /* pci driver glue; this is a "new style" PCI driver module */ |
383 | static struct pci_driver ehci_pci_driver = { | 364 | static struct pci_driver ehci_pci_driver = { |
@@ -393,22 +374,22 @@ static struct pci_driver ehci_pci_driver = { | |||
393 | #endif | 374 | #endif |
394 | }; | 375 | }; |
395 | 376 | ||
396 | static int __init ehci_hcd_pci_init (void) | 377 | static int __init ehci_hcd_pci_init(void) |
397 | { | 378 | { |
398 | if (usb_disabled()) | 379 | if (usb_disabled()) |
399 | return -ENODEV; | 380 | return -ENODEV; |
400 | 381 | ||
401 | pr_debug ("%s: block sizes: qh %Zd qtd %Zd itd %Zd sitd %Zd\n", | 382 | pr_debug("%s: block sizes: qh %Zd qtd %Zd itd %Zd sitd %Zd\n", |
402 | hcd_name, | 383 | hcd_name, |
403 | sizeof (struct ehci_qh), sizeof (struct ehci_qtd), | 384 | sizeof(struct ehci_qh), sizeof(struct ehci_qtd), |
404 | sizeof (struct ehci_itd), sizeof (struct ehci_sitd)); | 385 | sizeof(struct ehci_itd), sizeof(struct ehci_sitd)); |
405 | 386 | ||
406 | return pci_register_driver (&ehci_pci_driver); | 387 | return pci_register_driver(&ehci_pci_driver); |
407 | } | 388 | } |
408 | module_init (ehci_hcd_pci_init); | 389 | module_init(ehci_hcd_pci_init); |
409 | 390 | ||
410 | static void __exit ehci_hcd_pci_cleanup (void) | 391 | static void __exit ehci_hcd_pci_cleanup(void) |
411 | { | 392 | { |
412 | pci_unregister_driver (&ehci_pci_driver); | 393 | pci_unregister_driver(&ehci_pci_driver); |
413 | } | 394 | } |
414 | module_exit (ehci_hcd_pci_cleanup); | 395 | module_exit(ehci_hcd_pci_cleanup); |
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c index a59e536441e1..5f22e6590cd1 100644 --- a/drivers/usb/host/ohci-pci.c +++ b/drivers/usb/host/ohci-pci.c | |||
@@ -14,15 +14,6 @@ | |||
14 | * This file is licenced under the GPL. | 14 | * This file is licenced under the GPL. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/jiffies.h> | ||
18 | |||
19 | #ifdef CONFIG_PPC_PMAC | ||
20 | #include <asm/machdep.h> | ||
21 | #include <asm/pmac_feature.h> | ||
22 | #include <asm/pci-bridge.h> | ||
23 | #include <asm/prom.h> | ||
24 | #endif | ||
25 | |||
26 | #ifndef CONFIG_PCI | 17 | #ifndef CONFIG_PCI |
27 | #error "This file is PCI bus glue. CONFIG_PCI must be defined." | 18 | #error "This file is PCI bus glue. CONFIG_PCI must be defined." |
28 | #endif | 19 | #endif |
@@ -115,39 +106,12 @@ ohci_pci_start (struct usb_hcd *hcd) | |||
115 | static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message) | 106 | static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message) |
116 | { | 107 | { |
117 | /* root hub was already suspended */ | 108 | /* root hub was already suspended */ |
118 | |||
119 | /* FIXME these PMAC things get called in the wrong places. ASIC | ||
120 | * clocks should be turned off AFTER entering D3, and on BEFORE | ||
121 | * trying to enter D0. Evidently the PCI layer doesn't currently | ||
122 | * provide the right sort of platform hooks for this ... | ||
123 | */ | ||
124 | #ifdef CONFIG_PPC_PMAC | ||
125 | if (_machine == _MACH_Pmac) { | ||
126 | struct device_node *of_node; | ||
127 | |||
128 | /* Disable USB PAD & cell clock */ | ||
129 | of_node = pci_device_to_OF_node (to_pci_dev(hcd->self.controller)); | ||
130 | if (of_node) | ||
131 | pmac_call_feature(PMAC_FTR_USB_ENABLE, of_node, 0, 0); | ||
132 | } | ||
133 | #endif /* CONFIG_PPC_PMAC */ | ||
134 | return 0; | 109 | return 0; |
135 | } | 110 | } |
136 | 111 | ||
137 | 112 | ||
138 | static int ohci_pci_resume (struct usb_hcd *hcd) | 113 | static int ohci_pci_resume (struct usb_hcd *hcd) |
139 | { | 114 | { |
140 | #ifdef CONFIG_PPC_PMAC | ||
141 | if (_machine == _MACH_Pmac) { | ||
142 | struct device_node *of_node; | ||
143 | |||
144 | /* Re-enable USB PAD & cell clock */ | ||
145 | of_node = pci_device_to_OF_node (to_pci_dev(hcd->self.controller)); | ||
146 | if (of_node) | ||
147 | pmac_call_feature (PMAC_FTR_USB_ENABLE, of_node, 0, 1); | ||
148 | } | ||
149 | #endif /* CONFIG_PPC_PMAC */ | ||
150 | |||
151 | usb_hcd_resume_root_hub(hcd); | 115 | usb_hcd_resume_root_hub(hcd); |
152 | return 0; | 116 | return 0; |
153 | } | 117 | } |
diff --git a/drivers/usb/media/sn9c102_core.c b/drivers/usb/media/sn9c102_core.c index cf8cfbabefde..b2e66e3b90aa 100644 --- a/drivers/usb/media/sn9c102_core.c +++ b/drivers/usb/media/sn9c102_core.c | |||
@@ -199,7 +199,7 @@ static void sn9c102_release_buffers(struct sn9c102_device* cam) | |||
199 | { | 199 | { |
200 | if (cam->nbuffers) { | 200 | if (cam->nbuffers) { |
201 | rvfree(cam->frame[0].bufmem, | 201 | rvfree(cam->frame[0].bufmem, |
202 | cam->nbuffers * cam->frame[0].buf.length); | 202 | cam->nbuffers * PAGE_ALIGN(cam->frame[0].buf.length)); |
203 | cam->nbuffers = 0; | 203 | cam->nbuffers = 0; |
204 | } | 204 | } |
205 | } | 205 | } |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 61204bf7cd78..06e04b442ff1 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -475,6 +475,8 @@ static struct usb_device_id id_table_combined [] = { | |||
475 | { USB_DEVICE(FTDI_VID, FTDI_ARTEMIS_PID) }, | 475 | { USB_DEVICE(FTDI_VID, FTDI_ARTEMIS_PID) }, |
476 | { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16_PID) }, | 476 | { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16_PID) }, |
477 | { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16HR_PID) }, | 477 | { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16HR_PID) }, |
478 | { USB_DEVICE(KOBIL_VID, KOBIL_CONV_B1_PID) }, | ||
479 | { USB_DEVICE(KOBIL_VID, KOBIL_CONV_KAAN_PID) }, | ||
478 | { }, /* Optional parameter entry */ | 480 | { }, /* Optional parameter entry */ |
479 | { } /* Terminating entry */ | 481 | { } /* Terminating entry */ |
480 | }; | 482 | }; |
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h index ddb63df31ce6..773ea3eca086 100644 --- a/drivers/usb/serial/ftdi_sio.h +++ b/drivers/usb/serial/ftdi_sio.h | |||
@@ -128,6 +128,13 @@ | |||
128 | #define SEALEVEL_2803_8_PID 0X2883 /* SeaLINK+8 (2803) Port 8 */ | 128 | #define SEALEVEL_2803_8_PID 0X2883 /* SeaLINK+8 (2803) Port 8 */ |
129 | 129 | ||
130 | /* | 130 | /* |
131 | * The following are the values for two KOBIL chipcard terminals. | ||
132 | */ | ||
133 | #define KOBIL_VID 0x0d46 /* KOBIL Vendor ID */ | ||
134 | #define KOBIL_CONV_B1_PID 0x2020 /* KOBIL Konverter for B1 */ | ||
135 | #define KOBIL_CONV_KAAN_PID 0x2021 /* KOBIL_Konverter for KAAN */ | ||
136 | |||
137 | /* | ||
131 | * DSS-20 Sync Station for Sony Ericsson P800 | 138 | * DSS-20 Sync Station for Sony Ericsson P800 |
132 | */ | 139 | */ |
133 | 140 | ||
diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c index a02fada85362..7744b8148bc5 100644 --- a/drivers/usb/serial/ipw.c +++ b/drivers/usb/serial/ipw.c | |||
@@ -46,7 +46,6 @@ | |||
46 | #include <linux/module.h> | 46 | #include <linux/module.h> |
47 | #include <linux/spinlock.h> | 47 | #include <linux/spinlock.h> |
48 | #include <linux/usb.h> | 48 | #include <linux/usb.h> |
49 | #include <linux/usb.h> | ||
50 | #include <asm/uaccess.h> | 49 | #include <asm/uaccess.h> |
51 | #include "usb-serial.h" | 50 | #include "usb-serial.h" |
52 | 51 | ||
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 0a9858f69a9b..f5f47a34b168 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -1118,6 +1118,15 @@ UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999, | |||
1118 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 1118 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
1119 | US_FL_GO_SLOW ), | 1119 | US_FL_GO_SLOW ), |
1120 | 1120 | ||
1121 | /* | ||
1122 | * David Härdeman <david@2gen.com> | ||
1123 | * The key makes the SCSI stack print confusing (but harmless) messages | ||
1124 | */ | ||
1125 | UNUSUAL_DEV( 0x4146, 0xba01, 0x0100, 0x0100, | ||
1126 | "Iomega", | ||
1127 | "Micro Mini 1GB", | ||
1128 | US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_NOT_LOCKABLE ), | ||
1129 | |||
1121 | #ifdef CONFIG_USB_STORAGE_SDDR55 | 1130 | #ifdef CONFIG_USB_STORAGE_SDDR55 |
1122 | UNUSUAL_DEV( 0x55aa, 0xa103, 0x0000, 0x9999, | 1131 | UNUSUAL_DEV( 0x55aa, 0xa103, 0x0000, 0x9999, |
1123 | "Sandisk", | 1132 | "Sandisk", |
diff --git a/drivers/video/console/fbcon_ccw.c b/drivers/video/console/fbcon_ccw.c index 3afd1eeb1ade..4952b66ae206 100644 --- a/drivers/video/console/fbcon_ccw.c +++ b/drivers/video/console/fbcon_ccw.c | |||
@@ -34,7 +34,7 @@ static inline void ccw_update_attr(u8 *dst, u8 *src, int attribute, | |||
34 | msk <<= (8 - mod); | 34 | msk <<= (8 - mod); |
35 | 35 | ||
36 | if (offset > mod) | 36 | if (offset > mod) |
37 | set_bit(FBCON_BIT(7), (void *)&msk1); | 37 | msk1 |= 0x01; |
38 | 38 | ||
39 | for (i = 0; i < vc->vc_font.width; i++) { | 39 | for (i = 0; i < vc->vc_font.width; i++) { |
40 | for (j = 0; j < width; j++) { | 40 | for (j = 0; j < width; j++) { |
diff --git a/drivers/video/console/fbcon_rotate.h b/drivers/video/console/fbcon_rotate.h index 90c672096c2e..1b8f92fdc6a8 100644 --- a/drivers/video/console/fbcon_rotate.h +++ b/drivers/video/console/fbcon_rotate.h | |||
@@ -21,21 +21,13 @@ | |||
21 | (s == SCROLL_REDRAW || s == SCROLL_MOVE || !(i)->fix.xpanstep) ? \ | 21 | (s == SCROLL_REDRAW || s == SCROLL_MOVE || !(i)->fix.xpanstep) ? \ |
22 | (i)->var.xres : (i)->var.xres_virtual; }) | 22 | (i)->var.xres : (i)->var.xres_virtual; }) |
23 | 23 | ||
24 | /* | ||
25 | * The bitmap is always big endian | ||
26 | */ | ||
27 | #if defined(__LITTLE_ENDIAN) | ||
28 | #define FBCON_BIT(b) (7 - (b)) | ||
29 | #else | ||
30 | #define FBCON_BIT(b) (b) | ||
31 | #endif | ||
32 | 24 | ||
33 | static inline int pattern_test_bit(u32 x, u32 y, u32 pitch, const char *pat) | 25 | static inline int pattern_test_bit(u32 x, u32 y, u32 pitch, const char *pat) |
34 | { | 26 | { |
35 | u32 tmp = (y * pitch) + x, index = tmp / 8, bit = tmp % 8; | 27 | u32 tmp = (y * pitch) + x, index = tmp / 8, bit = tmp % 8; |
36 | 28 | ||
37 | pat +=index; | 29 | pat +=index; |
38 | return (test_bit(FBCON_BIT(bit), (void *)pat)); | 30 | return (*pat) & (0x80 >> bit); |
39 | } | 31 | } |
40 | 32 | ||
41 | static inline void pattern_set_bit(u32 x, u32 y, u32 pitch, char *pat) | 33 | static inline void pattern_set_bit(u32 x, u32 y, u32 pitch, char *pat) |
@@ -43,13 +35,14 @@ static inline void pattern_set_bit(u32 x, u32 y, u32 pitch, char *pat) | |||
43 | u32 tmp = (y * pitch) + x, index = tmp / 8, bit = tmp % 8; | 35 | u32 tmp = (y * pitch) + x, index = tmp / 8, bit = tmp % 8; |
44 | 36 | ||
45 | pat += index; | 37 | pat += index; |
46 | set_bit(FBCON_BIT(bit), (void *)pat); | 38 | |
39 | (*pat) |= 0x80 >> bit; | ||
47 | } | 40 | } |
48 | 41 | ||
49 | static inline void rotate_ud(const char *in, char *out, u32 width, u32 height) | 42 | static inline void rotate_ud(const char *in, char *out, u32 width, u32 height) |
50 | { | 43 | { |
51 | int i, j; | 44 | int i, j; |
52 | int shift = width % 8; | 45 | int shift = (8 - (width % 8)) & 7; |
53 | 46 | ||
54 | width = (width + 7) & ~7; | 47 | width = (width + 7) & ~7; |
55 | 48 | ||
@@ -85,7 +78,7 @@ static inline void rotate_cw(const char *in, char *out, u32 width, u32 height) | |||
85 | static inline void rotate_ccw(const char *in, char *out, u32 width, u32 height) | 78 | static inline void rotate_ccw(const char *in, char *out, u32 width, u32 height) |
86 | { | 79 | { |
87 | int i, j, h = height, w = width; | 80 | int i, j, h = height, w = width; |
88 | int shift = width % 8; | 81 | int shift = (8 - (width % 8)) & 7; |
89 | 82 | ||
90 | width = (width + 7) & ~7; | 83 | width = (width + 7) & ~7; |
91 | height = (height + 7) & ~7; | 84 | height = (height + 7) & ~7; |
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index 274f90543e32..167de397e4b4 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c | |||
@@ -966,6 +966,7 @@ static int vgacon_adjust_height(struct vc_data *vc, unsigned fontheight) | |||
966 | outb_p(0x12, vga_video_port_reg); /* Vertical display limit */ | 966 | outb_p(0x12, vga_video_port_reg); /* Vertical display limit */ |
967 | outb_p(vde, vga_video_port_val); | 967 | outb_p(vde, vga_video_port_val); |
968 | spin_unlock_irq(&vga_lock); | 968 | spin_unlock_irq(&vga_lock); |
969 | vga_video_font_height = fontheight; | ||
969 | 970 | ||
970 | for (i = 0; i < MAX_NR_CONSOLES; i++) { | 971 | for (i = 0; i < MAX_NR_CONSOLES; i++) { |
971 | struct vc_data *c = vc_cons[i].d; | 972 | struct vc_data *c = vc_cons[i].d; |
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 9f180096c896..6240aedb4154 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
@@ -452,13 +452,17 @@ int fb_prepare_logo(struct fb_info *info, int rotate) | |||
452 | 452 | ||
453 | /* Return if no suitable logo was found */ | 453 | /* Return if no suitable logo was found */ |
454 | fb_logo.logo = fb_find_logo(depth); | 454 | fb_logo.logo = fb_find_logo(depth); |
455 | |||
456 | if (!fb_logo.logo) { | ||
457 | return 0; | ||
458 | } | ||
455 | 459 | ||
456 | if (rotate == FB_ROTATE_UR || rotate == FB_ROTATE_UD) | 460 | if (rotate == FB_ROTATE_UR || rotate == FB_ROTATE_UD) |
457 | yres = info->var.yres; | 461 | yres = info->var.yres; |
458 | else | 462 | else |
459 | yres = info->var.xres; | 463 | yres = info->var.xres; |
460 | 464 | ||
461 | if (fb_logo.logo && fb_logo.logo->height > yres) { | 465 | if (fb_logo.logo->height > yres) { |
462 | fb_logo.logo = NULL; | 466 | fb_logo.logo = NULL; |
463 | return 0; | 467 | return 0; |
464 | } | 468 | } |