diff options
Diffstat (limited to 'drivers')
44 files changed, 421 insertions, 397 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/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/char/mem.c b/drivers/char/mem.c index 91dd669273e0..29c3b631445a 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -591,7 +591,7 @@ static inline size_t read_zero_pagealigned(char __user * buf, size_t size) | |||
591 | 591 | ||
592 | if (vma->vm_start > addr || (vma->vm_flags & VM_WRITE) == 0) | 592 | if (vma->vm_start > addr || (vma->vm_flags & VM_WRITE) == 0) |
593 | goto out_up; | 593 | goto out_up; |
594 | if (vma->vm_flags & (VM_SHARED | VM_HUGETLB)) | 594 | if (vma->vm_flags & (VM_SHARED | VM_HUGETLB | VM_UNPAGED)) |
595 | break; | 595 | break; |
596 | count = vma->vm_end - addr; | 596 | count = vma->vm_end - addr; |
597 | if (count > size) | 597 | if (count > size) |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 23a63207d747..1c0f62d0f938 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 | ||
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/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/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/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/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/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/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_rotate.h b/drivers/video/console/fbcon_rotate.h index 90c672096c2e..e504fbf5c604 100644 --- a/drivers/video/console/fbcon_rotate.h +++ b/drivers/video/console/fbcon_rotate.h | |||
@@ -49,7 +49,7 @@ static inline void pattern_set_bit(u32 x, u32 y, u32 pitch, char *pat) | |||
49 | static inline void rotate_ud(const char *in, char *out, u32 width, u32 height) | 49 | static inline void rotate_ud(const char *in, char *out, u32 width, u32 height) |
50 | { | 50 | { |
51 | int i, j; | 51 | int i, j; |
52 | int shift = width % 8; | 52 | int shift = (8 - (width % 8)) & 7; |
53 | 53 | ||
54 | width = (width + 7) & ~7; | 54 | width = (width + 7) & ~7; |
55 | 55 | ||
@@ -85,7 +85,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) | 85 | static inline void rotate_ccw(const char *in, char *out, u32 width, u32 height) |
86 | { | 86 | { |
87 | int i, j, h = height, w = width; | 87 | int i, j, h = height, w = width; |
88 | int shift = width % 8; | 88 | int shift = (8 - (width % 8)) & 7; |
89 | 89 | ||
90 | width = (width + 7) & ~7; | 90 | width = (width + 7) & ~7; |
91 | height = (height + 7) & ~7; | 91 | 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 | } |