diff options
Diffstat (limited to 'drivers')
205 files changed, 2177 insertions, 1152 deletions
diff --git a/drivers/acpi/acpica/acconfig.h b/drivers/acpi/acpica/acconfig.h index bc533dde16c4..f895a244ca7e 100644 --- a/drivers/acpi/acpica/acconfig.h +++ b/drivers/acpi/acpica/acconfig.h | |||
| @@ -121,7 +121,7 @@ | |||
| 121 | 121 | ||
| 122 | /* Maximum sleep allowed via Sleep() operator */ | 122 | /* Maximum sleep allowed via Sleep() operator */ |
| 123 | 123 | ||
| 124 | #define ACPI_MAX_SLEEP 20000 /* Two seconds */ | 124 | #define ACPI_MAX_SLEEP 2000 /* Two seconds */ |
| 125 | 125 | ||
| 126 | /****************************************************************************** | 126 | /****************************************************************************** |
| 127 | * | 127 | * |
diff --git a/drivers/acpi/apei/Kconfig b/drivers/acpi/apei/Kconfig index c34aa51af4ee..e3f47872ec22 100644 --- a/drivers/acpi/apei/Kconfig +++ b/drivers/acpi/apei/Kconfig | |||
| @@ -13,6 +13,7 @@ config ACPI_APEI_GHES | |||
| 13 | bool "APEI Generic Hardware Error Source" | 13 | bool "APEI Generic Hardware Error Source" |
| 14 | depends on ACPI_APEI && X86 | 14 | depends on ACPI_APEI && X86 |
| 15 | select ACPI_HED | 15 | select ACPI_HED |
| 16 | select IRQ_WORK | ||
| 16 | select LLIST | 17 | select LLIST |
| 17 | select GENERIC_ALLOCATOR | 18 | select GENERIC_ALLOCATOR |
| 18 | help | 19 | help |
diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c index 8041248fce9b..61540360d5ce 100644 --- a/drivers/acpi/apei/apei-base.c +++ b/drivers/acpi/apei/apei-base.c | |||
| @@ -618,7 +618,7 @@ int apei_osc_setup(void) | |||
| 618 | }; | 618 | }; |
| 619 | 619 | ||
| 620 | capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE; | 620 | capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE; |
| 621 | capbuf[OSC_SUPPORT_TYPE] = 0; | 621 | capbuf[OSC_SUPPORT_TYPE] = 1; |
| 622 | capbuf[OSC_CONTROL_TYPE] = 0; | 622 | capbuf[OSC_CONTROL_TYPE] = 0; |
| 623 | 623 | ||
| 624 | if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle)) | 624 | if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle)) |
diff --git a/drivers/base/devres.c b/drivers/base/devres.c index cf7a0c788052..65cd74832450 100644 --- a/drivers/base/devres.c +++ b/drivers/base/devres.c | |||
| @@ -397,6 +397,7 @@ static int remove_nodes(struct device *dev, | |||
| 397 | 397 | ||
| 398 | static int release_nodes(struct device *dev, struct list_head *first, | 398 | static int release_nodes(struct device *dev, struct list_head *first, |
| 399 | struct list_head *end, unsigned long flags) | 399 | struct list_head *end, unsigned long flags) |
| 400 | __releases(&dev->devres_lock) | ||
| 400 | { | 401 | { |
| 401 | LIST_HEAD(todo); | 402 | LIST_HEAD(todo); |
| 402 | int cnt; | 403 | int cnt; |
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c index 33e1bed68fdd..a4760e095ff5 100644 --- a/drivers/base/devtmpfs.c +++ b/drivers/base/devtmpfs.c | |||
| @@ -376,7 +376,7 @@ int devtmpfs_mount(const char *mntdir) | |||
| 376 | return err; | 376 | return err; |
| 377 | } | 377 | } |
| 378 | 378 | ||
| 379 | static __initdata DECLARE_COMPLETION(setup_done); | 379 | static DECLARE_COMPLETION(setup_done); |
| 380 | 380 | ||
| 381 | static int handle(const char *name, mode_t mode, struct device *dev) | 381 | static int handle(const char *name, mode_t mode, struct device *dev) |
| 382 | { | 382 | { |
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index bbb03e6f7255..06ed6b4e7df5 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
| @@ -521,11 +521,6 @@ static int _request_firmware(const struct firmware **firmware_p, | |||
| 521 | if (!firmware_p) | 521 | if (!firmware_p) |
| 522 | return -EINVAL; | 522 | return -EINVAL; |
| 523 | 523 | ||
| 524 | if (WARN_ON(usermodehelper_is_disabled())) { | ||
| 525 | dev_err(device, "firmware: %s will not be loaded\n", name); | ||
| 526 | return -EBUSY; | ||
| 527 | } | ||
| 528 | |||
| 529 | *firmware_p = firmware = kzalloc(sizeof(*firmware), GFP_KERNEL); | 524 | *firmware_p = firmware = kzalloc(sizeof(*firmware), GFP_KERNEL); |
| 530 | if (!firmware) { | 525 | if (!firmware) { |
| 531 | dev_err(device, "%s: kmalloc(struct firmware) failed\n", | 526 | dev_err(device, "%s: kmalloc(struct firmware) failed\n", |
| @@ -539,6 +534,12 @@ static int _request_firmware(const struct firmware **firmware_p, | |||
| 539 | return 0; | 534 | return 0; |
| 540 | } | 535 | } |
| 541 | 536 | ||
| 537 | if (WARN_ON(usermodehelper_is_disabled())) { | ||
| 538 | dev_err(device, "firmware: %s will not be loaded\n", name); | ||
| 539 | retval = -EBUSY; | ||
| 540 | goto out; | ||
| 541 | } | ||
| 542 | |||
| 542 | if (uevent) | 543 | if (uevent) |
| 543 | dev_dbg(device, "firmware: requesting %s\n", name); | 544 | dev_dbg(device, "firmware: requesting %s\n", name); |
| 544 | 545 | ||
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 0cad9c7f6bb5..99a5272d7c2f 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
| @@ -33,7 +33,7 @@ EXPORT_SYMBOL_GPL(platform_bus); | |||
| 33 | 33 | ||
| 34 | /** | 34 | /** |
| 35 | * arch_setup_pdev_archdata - Allow manipulation of archdata before its used | 35 | * arch_setup_pdev_archdata - Allow manipulation of archdata before its used |
| 36 | * @dev: platform device | 36 | * @pdev: platform device |
| 37 | * | 37 | * |
| 38 | * This is called before platform_device_add() such that any pdev_archdata may | 38 | * This is called before platform_device_add() such that any pdev_archdata may |
| 39 | * be setup before the platform_notifier is called. So if a user needs to | 39 | * be setup before the platform_notifier is called. So if a user needs to |
diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c index a846b2f95cfb..2c18d584066d 100644 --- a/drivers/base/power/clock_ops.c +++ b/drivers/base/power/clock_ops.c | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | 19 | ||
| 20 | struct pm_clk_data { | 20 | struct pm_clk_data { |
| 21 | struct list_head clock_list; | 21 | struct list_head clock_list; |
| 22 | struct mutex lock; | 22 | spinlock_t lock; |
| 23 | }; | 23 | }; |
| 24 | 24 | ||
| 25 | enum pce_status { | 25 | enum pce_status { |
| @@ -73,9 +73,9 @@ int pm_clk_add(struct device *dev, const char *con_id) | |||
| 73 | } | 73 | } |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | mutex_lock(&pcd->lock); | 76 | spin_lock_irq(&pcd->lock); |
| 77 | list_add_tail(&ce->node, &pcd->clock_list); | 77 | list_add_tail(&ce->node, &pcd->clock_list); |
| 78 | mutex_unlock(&pcd->lock); | 78 | spin_unlock_irq(&pcd->lock); |
| 79 | return 0; | 79 | return 0; |
| 80 | } | 80 | } |
| 81 | 81 | ||
| @@ -83,8 +83,8 @@ int pm_clk_add(struct device *dev, const char *con_id) | |||
| 83 | * __pm_clk_remove - Destroy PM clock entry. | 83 | * __pm_clk_remove - Destroy PM clock entry. |
| 84 | * @ce: PM clock entry to destroy. | 84 | * @ce: PM clock entry to destroy. |
| 85 | * | 85 | * |
| 86 | * This routine must be called under the mutex protecting the PM list of clocks | 86 | * This routine must be called under the spinlock protecting the PM list of |
| 87 | * corresponding the the @ce's device. | 87 | * clocks corresponding the the @ce's device. |
| 88 | */ | 88 | */ |
| 89 | static void __pm_clk_remove(struct pm_clock_entry *ce) | 89 | static void __pm_clk_remove(struct pm_clock_entry *ce) |
| 90 | { | 90 | { |
| @@ -123,7 +123,7 @@ void pm_clk_remove(struct device *dev, const char *con_id) | |||
| 123 | if (!pcd) | 123 | if (!pcd) |
| 124 | return; | 124 | return; |
| 125 | 125 | ||
| 126 | mutex_lock(&pcd->lock); | 126 | spin_lock_irq(&pcd->lock); |
| 127 | 127 | ||
| 128 | list_for_each_entry(ce, &pcd->clock_list, node) { | 128 | list_for_each_entry(ce, &pcd->clock_list, node) { |
| 129 | if (!con_id && !ce->con_id) { | 129 | if (!con_id && !ce->con_id) { |
| @@ -137,7 +137,7 @@ void pm_clk_remove(struct device *dev, const char *con_id) | |||
| 137 | } | 137 | } |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | mutex_unlock(&pcd->lock); | 140 | spin_unlock_irq(&pcd->lock); |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | /** | 143 | /** |
| @@ -158,7 +158,7 @@ int pm_clk_init(struct device *dev) | |||
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | INIT_LIST_HEAD(&pcd->clock_list); | 160 | INIT_LIST_HEAD(&pcd->clock_list); |
| 161 | mutex_init(&pcd->lock); | 161 | spin_lock_init(&pcd->lock); |
| 162 | dev->power.subsys_data = pcd; | 162 | dev->power.subsys_data = pcd; |
| 163 | return 0; | 163 | return 0; |
| 164 | } | 164 | } |
| @@ -181,12 +181,12 @@ void pm_clk_destroy(struct device *dev) | |||
| 181 | 181 | ||
| 182 | dev->power.subsys_data = NULL; | 182 | dev->power.subsys_data = NULL; |
| 183 | 183 | ||
| 184 | mutex_lock(&pcd->lock); | 184 | spin_lock_irq(&pcd->lock); |
| 185 | 185 | ||
| 186 | list_for_each_entry_safe_reverse(ce, c, &pcd->clock_list, node) | 186 | list_for_each_entry_safe_reverse(ce, c, &pcd->clock_list, node) |
| 187 | __pm_clk_remove(ce); | 187 | __pm_clk_remove(ce); |
| 188 | 188 | ||
| 189 | mutex_unlock(&pcd->lock); | 189 | spin_unlock_irq(&pcd->lock); |
| 190 | 190 | ||
| 191 | kfree(pcd); | 191 | kfree(pcd); |
| 192 | } | 192 | } |
| @@ -220,13 +220,14 @@ int pm_clk_suspend(struct device *dev) | |||
| 220 | { | 220 | { |
| 221 | struct pm_clk_data *pcd = __to_pcd(dev); | 221 | struct pm_clk_data *pcd = __to_pcd(dev); |
| 222 | struct pm_clock_entry *ce; | 222 | struct pm_clock_entry *ce; |
| 223 | unsigned long flags; | ||
| 223 | 224 | ||
| 224 | dev_dbg(dev, "%s()\n", __func__); | 225 | dev_dbg(dev, "%s()\n", __func__); |
| 225 | 226 | ||
| 226 | if (!pcd) | 227 | if (!pcd) |
| 227 | return 0; | 228 | return 0; |
| 228 | 229 | ||
| 229 | mutex_lock(&pcd->lock); | 230 | spin_lock_irqsave(&pcd->lock, flags); |
| 230 | 231 | ||
| 231 | list_for_each_entry_reverse(ce, &pcd->clock_list, node) { | 232 | list_for_each_entry_reverse(ce, &pcd->clock_list, node) { |
| 232 | if (ce->status == PCE_STATUS_NONE) | 233 | if (ce->status == PCE_STATUS_NONE) |
| @@ -238,7 +239,7 @@ int pm_clk_suspend(struct device *dev) | |||
| 238 | } | 239 | } |
| 239 | } | 240 | } |
| 240 | 241 | ||
| 241 | mutex_unlock(&pcd->lock); | 242 | spin_unlock_irqrestore(&pcd->lock, flags); |
| 242 | 243 | ||
| 243 | return 0; | 244 | return 0; |
| 244 | } | 245 | } |
| @@ -251,13 +252,14 @@ int pm_clk_resume(struct device *dev) | |||
| 251 | { | 252 | { |
| 252 | struct pm_clk_data *pcd = __to_pcd(dev); | 253 | struct pm_clk_data *pcd = __to_pcd(dev); |
| 253 | struct pm_clock_entry *ce; | 254 | struct pm_clock_entry *ce; |
| 255 | unsigned long flags; | ||
| 254 | 256 | ||
| 255 | dev_dbg(dev, "%s()\n", __func__); | 257 | dev_dbg(dev, "%s()\n", __func__); |
| 256 | 258 | ||
| 257 | if (!pcd) | 259 | if (!pcd) |
| 258 | return 0; | 260 | return 0; |
| 259 | 261 | ||
| 260 | mutex_lock(&pcd->lock); | 262 | spin_lock_irqsave(&pcd->lock, flags); |
| 261 | 263 | ||
| 262 | list_for_each_entry(ce, &pcd->clock_list, node) { | 264 | list_for_each_entry(ce, &pcd->clock_list, node) { |
| 263 | if (ce->status == PCE_STATUS_NONE) | 265 | if (ce->status == PCE_STATUS_NONE) |
| @@ -269,7 +271,7 @@ int pm_clk_resume(struct device *dev) | |||
| 269 | } | 271 | } |
| 270 | } | 272 | } |
| 271 | 273 | ||
| 272 | mutex_unlock(&pcd->lock); | 274 | spin_unlock_irqrestore(&pcd->lock, flags); |
| 273 | 275 | ||
| 274 | return 0; | 276 | return 0; |
| 275 | } | 277 | } |
| @@ -344,6 +346,7 @@ int pm_clk_suspend(struct device *dev) | |||
| 344 | { | 346 | { |
| 345 | struct pm_clk_data *pcd = __to_pcd(dev); | 347 | struct pm_clk_data *pcd = __to_pcd(dev); |
| 346 | struct pm_clock_entry *ce; | 348 | struct pm_clock_entry *ce; |
| 349 | unsigned long flags; | ||
| 347 | 350 | ||
| 348 | dev_dbg(dev, "%s()\n", __func__); | 351 | dev_dbg(dev, "%s()\n", __func__); |
| 349 | 352 | ||
| @@ -351,12 +354,12 @@ int pm_clk_suspend(struct device *dev) | |||
| 351 | if (!pcd || !dev->driver) | 354 | if (!pcd || !dev->driver) |
| 352 | return 0; | 355 | return 0; |
| 353 | 356 | ||
| 354 | mutex_lock(&pcd->lock); | 357 | spin_lock_irqsave(&pcd->lock, flags); |
| 355 | 358 | ||
| 356 | list_for_each_entry_reverse(ce, &pcd->clock_list, node) | 359 | list_for_each_entry_reverse(ce, &pcd->clock_list, node) |
| 357 | clk_disable(ce->clk); | 360 | clk_disable(ce->clk); |
| 358 | 361 | ||
| 359 | mutex_unlock(&pcd->lock); | 362 | spin_unlock_irqrestore(&pcd->lock, flags); |
| 360 | 363 | ||
| 361 | return 0; | 364 | return 0; |
| 362 | } | 365 | } |
| @@ -369,6 +372,7 @@ int pm_clk_resume(struct device *dev) | |||
| 369 | { | 372 | { |
| 370 | struct pm_clk_data *pcd = __to_pcd(dev); | 373 | struct pm_clk_data *pcd = __to_pcd(dev); |
| 371 | struct pm_clock_entry *ce; | 374 | struct pm_clock_entry *ce; |
| 375 | unsigned long flags; | ||
| 372 | 376 | ||
| 373 | dev_dbg(dev, "%s()\n", __func__); | 377 | dev_dbg(dev, "%s()\n", __func__); |
| 374 | 378 | ||
| @@ -376,12 +380,12 @@ int pm_clk_resume(struct device *dev) | |||
| 376 | if (!pcd || !dev->driver) | 380 | if (!pcd || !dev->driver) |
| 377 | return 0; | 381 | return 0; |
| 378 | 382 | ||
| 379 | mutex_lock(&pcd->lock); | 383 | spin_lock_irqsave(&pcd->lock, flags); |
| 380 | 384 | ||
| 381 | list_for_each_entry(ce, &pcd->clock_list, node) | 385 | list_for_each_entry(ce, &pcd->clock_list, node) |
| 382 | clk_enable(ce->clk); | 386 | clk_enable(ce->clk); |
| 383 | 387 | ||
| 384 | mutex_unlock(&pcd->lock); | 388 | spin_unlock_irqrestore(&pcd->lock, flags); |
| 385 | 389 | ||
| 386 | return 0; | 390 | return 0; |
| 387 | } | 391 | } |
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 0eef4da1ac61..20663f8dae45 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c | |||
| @@ -168,13 +168,11 @@ struct regmap *regmap_init(struct device *dev, | |||
| 168 | map->work_buf = kmalloc(map->format.buf_size, GFP_KERNEL); | 168 | map->work_buf = kmalloc(map->format.buf_size, GFP_KERNEL); |
| 169 | if (map->work_buf == NULL) { | 169 | if (map->work_buf == NULL) { |
| 170 | ret = -ENOMEM; | 170 | ret = -ENOMEM; |
| 171 | goto err_bus; | 171 | goto err_map; |
| 172 | } | 172 | } |
| 173 | 173 | ||
| 174 | return map; | 174 | return map; |
| 175 | 175 | ||
| 176 | err_bus: | ||
| 177 | module_put(map->bus->owner); | ||
| 178 | err_map: | 176 | err_map: |
| 179 | kfree(map); | 177 | kfree(map); |
| 180 | err: | 178 | err: |
| @@ -188,7 +186,6 @@ EXPORT_SYMBOL_GPL(regmap_init); | |||
| 188 | void regmap_exit(struct regmap *map) | 186 | void regmap_exit(struct regmap *map) |
| 189 | { | 187 | { |
| 190 | kfree(map->work_buf); | 188 | kfree(map->work_buf); |
| 191 | module_put(map->bus->owner); | ||
| 192 | kfree(map); | 189 | kfree(map); |
| 193 | } | 190 | } |
| 194 | EXPORT_SYMBOL_GPL(regmap_exit); | 191 | EXPORT_SYMBOL_GPL(regmap_exit); |
diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c index 873e2e4ac55f..73b7b1a18fab 100644 --- a/drivers/bcma/main.c +++ b/drivers/bcma/main.c | |||
| @@ -15,6 +15,7 @@ MODULE_LICENSE("GPL"); | |||
| 15 | static int bcma_bus_match(struct device *dev, struct device_driver *drv); | 15 | static int bcma_bus_match(struct device *dev, struct device_driver *drv); |
| 16 | static int bcma_device_probe(struct device *dev); | 16 | static int bcma_device_probe(struct device *dev); |
| 17 | static int bcma_device_remove(struct device *dev); | 17 | static int bcma_device_remove(struct device *dev); |
| 18 | static int bcma_device_uevent(struct device *dev, struct kobj_uevent_env *env); | ||
| 18 | 19 | ||
| 19 | static ssize_t manuf_show(struct device *dev, struct device_attribute *attr, char *buf) | 20 | static ssize_t manuf_show(struct device *dev, struct device_attribute *attr, char *buf) |
| 20 | { | 21 | { |
| @@ -49,6 +50,7 @@ static struct bus_type bcma_bus_type = { | |||
| 49 | .match = bcma_bus_match, | 50 | .match = bcma_bus_match, |
| 50 | .probe = bcma_device_probe, | 51 | .probe = bcma_device_probe, |
| 51 | .remove = bcma_device_remove, | 52 | .remove = bcma_device_remove, |
| 53 | .uevent = bcma_device_uevent, | ||
| 52 | .dev_attrs = bcma_device_attrs, | 54 | .dev_attrs = bcma_device_attrs, |
| 53 | }; | 55 | }; |
| 54 | 56 | ||
| @@ -227,6 +229,16 @@ static int bcma_device_remove(struct device *dev) | |||
| 227 | return 0; | 229 | return 0; |
| 228 | } | 230 | } |
| 229 | 231 | ||
| 232 | static int bcma_device_uevent(struct device *dev, struct kobj_uevent_env *env) | ||
| 233 | { | ||
| 234 | struct bcma_device *core = container_of(dev, struct bcma_device, dev); | ||
| 235 | |||
| 236 | return add_uevent_var(env, | ||
| 237 | "MODALIAS=bcma:m%04Xid%04Xrev%02Xcl%02X", | ||
| 238 | core->id.manuf, core->id.id, | ||
| 239 | core->id.rev, core->id.class); | ||
| 240 | } | ||
| 241 | |||
| 230 | static int __init bcma_modinit(void) | 242 | static int __init bcma_modinit(void) |
| 231 | { | 243 | { |
| 232 | int err; | 244 | int err; |
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index a5854735bb2e..db7cb8111fbe 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c | |||
| @@ -63,6 +63,7 @@ static struct usb_device_id ath3k_table[] = { | |||
| 63 | /* Atheros AR3011 with sflash firmware*/ | 63 | /* Atheros AR3011 with sflash firmware*/ |
| 64 | { USB_DEVICE(0x0CF3, 0x3002) }, | 64 | { USB_DEVICE(0x0CF3, 0x3002) }, |
| 65 | { USB_DEVICE(0x13d3, 0x3304) }, | 65 | { USB_DEVICE(0x13d3, 0x3304) }, |
| 66 | { USB_DEVICE(0x0930, 0x0215) }, | ||
| 66 | 67 | ||
| 67 | /* Atheros AR9285 Malbec with sflash firmware */ | 68 | /* Atheros AR9285 Malbec with sflash firmware */ |
| 68 | { USB_DEVICE(0x03F0, 0x311D) }, | 69 | { USB_DEVICE(0x03F0, 0x311D) }, |
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 91d13a9e8c65..3ef476070baf 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
| @@ -106,6 +106,7 @@ static struct usb_device_id blacklist_table[] = { | |||
| 106 | /* Atheros 3011 with sflash firmware */ | 106 | /* Atheros 3011 with sflash firmware */ |
| 107 | { USB_DEVICE(0x0cf3, 0x3002), .driver_info = BTUSB_IGNORE }, | 107 | { USB_DEVICE(0x0cf3, 0x3002), .driver_info = BTUSB_IGNORE }, |
| 108 | { USB_DEVICE(0x13d3, 0x3304), .driver_info = BTUSB_IGNORE }, | 108 | { USB_DEVICE(0x13d3, 0x3304), .driver_info = BTUSB_IGNORE }, |
| 109 | { USB_DEVICE(0x0930, 0x0215), .driver_info = BTUSB_IGNORE }, | ||
| 109 | 110 | ||
| 110 | /* Atheros AR9285 Malbec with sflash firmware */ | 111 | /* Atheros AR9285 Malbec with sflash firmware */ |
| 111 | { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE }, | 112 | { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE }, |
| @@ -256,7 +257,9 @@ static void btusb_intr_complete(struct urb *urb) | |||
| 256 | 257 | ||
| 257 | err = usb_submit_urb(urb, GFP_ATOMIC); | 258 | err = usb_submit_urb(urb, GFP_ATOMIC); |
| 258 | if (err < 0) { | 259 | if (err < 0) { |
| 259 | if (err != -EPERM) | 260 | /* -EPERM: urb is being killed; |
| 261 | * -ENODEV: device got disconnected */ | ||
| 262 | if (err != -EPERM && err != -ENODEV) | ||
| 260 | BT_ERR("%s urb %p failed to resubmit (%d)", | 263 | BT_ERR("%s urb %p failed to resubmit (%d)", |
| 261 | hdev->name, urb, -err); | 264 | hdev->name, urb, -err); |
| 262 | usb_unanchor_urb(urb); | 265 | usb_unanchor_urb(urb); |
| @@ -341,7 +344,9 @@ static void btusb_bulk_complete(struct urb *urb) | |||
| 341 | 344 | ||
| 342 | err = usb_submit_urb(urb, GFP_ATOMIC); | 345 | err = usb_submit_urb(urb, GFP_ATOMIC); |
| 343 | if (err < 0) { | 346 | if (err < 0) { |
| 344 | if (err != -EPERM) | 347 | /* -EPERM: urb is being killed; |
| 348 | * -ENODEV: device got disconnected */ | ||
| 349 | if (err != -EPERM && err != -ENODEV) | ||
| 345 | BT_ERR("%s urb %p failed to resubmit (%d)", | 350 | BT_ERR("%s urb %p failed to resubmit (%d)", |
| 346 | hdev->name, urb, -err); | 351 | hdev->name, urb, -err); |
| 347 | usb_unanchor_urb(urb); | 352 | usb_unanchor_urb(urb); |
| @@ -431,7 +436,9 @@ static void btusb_isoc_complete(struct urb *urb) | |||
| 431 | 436 | ||
| 432 | err = usb_submit_urb(urb, GFP_ATOMIC); | 437 | err = usb_submit_urb(urb, GFP_ATOMIC); |
| 433 | if (err < 0) { | 438 | if (err < 0) { |
| 434 | if (err != -EPERM) | 439 | /* -EPERM: urb is being killed; |
| 440 | * -ENODEV: device got disconnected */ | ||
| 441 | if (err != -EPERM && err != -ENODEV) | ||
| 435 | BT_ERR("%s urb %p failed to resubmit (%d)", | 442 | BT_ERR("%s urb %p failed to resubmit (%d)", |
| 436 | hdev->name, urb, -err); | 443 | hdev->name, urb, -err); |
| 437 | usb_unanchor_urb(urb); | 444 | usb_unanchor_urb(urb); |
diff --git a/drivers/char/msm_smd_pkt.c b/drivers/char/msm_smd_pkt.c index b6f8a65c9960..8eca55deb3a3 100644 --- a/drivers/char/msm_smd_pkt.c +++ b/drivers/char/msm_smd_pkt.c | |||
| @@ -379,9 +379,8 @@ static int __init smd_pkt_init(void) | |||
| 379 | for (i = 0; i < NUM_SMD_PKT_PORTS; ++i) { | 379 | for (i = 0; i < NUM_SMD_PKT_PORTS; ++i) { |
| 380 | smd_pkt_devp[i] = kzalloc(sizeof(struct smd_pkt_dev), | 380 | smd_pkt_devp[i] = kzalloc(sizeof(struct smd_pkt_dev), |
| 381 | GFP_KERNEL); | 381 | GFP_KERNEL); |
| 382 | if (IS_ERR(smd_pkt_devp[i])) { | 382 | if (!smd_pkt_devp[i]) { |
| 383 | r = PTR_ERR(smd_pkt_devp[i]); | 383 | pr_err("kmalloc() failed\n"); |
| 384 | pr_err("kmalloc() failed %d\n", r); | ||
| 385 | goto clean_cdevs; | 384 | goto clean_cdevs; |
| 386 | } | 385 | } |
| 387 | 386 | ||
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c index dc7c033ef587..32a77becc098 100644 --- a/drivers/clocksource/sh_cmt.c +++ b/drivers/clocksource/sh_cmt.c | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #include <linux/clk.h> | 26 | #include <linux/clk.h> |
| 27 | #include <linux/irq.h> | 27 | #include <linux/irq.h> |
| 28 | #include <linux/err.h> | 28 | #include <linux/err.h> |
| 29 | #include <linux/delay.h> | ||
| 29 | #include <linux/clocksource.h> | 30 | #include <linux/clocksource.h> |
| 30 | #include <linux/clockchips.h> | 31 | #include <linux/clockchips.h> |
| 31 | #include <linux/sh_timer.h> | 32 | #include <linux/sh_timer.h> |
| @@ -150,13 +151,13 @@ static void sh_cmt_start_stop_ch(struct sh_cmt_priv *p, int start) | |||
| 150 | 151 | ||
| 151 | static int sh_cmt_enable(struct sh_cmt_priv *p, unsigned long *rate) | 152 | static int sh_cmt_enable(struct sh_cmt_priv *p, unsigned long *rate) |
| 152 | { | 153 | { |
| 153 | int ret; | 154 | int k, ret; |
| 154 | 155 | ||
| 155 | /* enable clock */ | 156 | /* enable clock */ |
| 156 | ret = clk_enable(p->clk); | 157 | ret = clk_enable(p->clk); |
| 157 | if (ret) { | 158 | if (ret) { |
| 158 | dev_err(&p->pdev->dev, "cannot enable clock\n"); | 159 | dev_err(&p->pdev->dev, "cannot enable clock\n"); |
| 159 | return ret; | 160 | goto err0; |
| 160 | } | 161 | } |
| 161 | 162 | ||
| 162 | /* make sure channel is disabled */ | 163 | /* make sure channel is disabled */ |
| @@ -174,9 +175,38 @@ static int sh_cmt_enable(struct sh_cmt_priv *p, unsigned long *rate) | |||
| 174 | sh_cmt_write(p, CMCOR, 0xffffffff); | 175 | sh_cmt_write(p, CMCOR, 0xffffffff); |
| 175 | sh_cmt_write(p, CMCNT, 0); | 176 | sh_cmt_write(p, CMCNT, 0); |
| 176 | 177 | ||
| 178 | /* | ||
| 179 | * According to the sh73a0 user's manual, as CMCNT can be operated | ||
| 180 | * only by the RCLK (Pseudo 32 KHz), there's one restriction on | ||
| 181 | * modifying CMCNT register; two RCLK cycles are necessary before | ||
| 182 | * this register is either read or any modification of the value | ||
| 183 | * it holds is reflected in the LSI's actual operation. | ||
| 184 | * | ||
| 185 | * While at it, we're supposed to clear out the CMCNT as of this | ||
| 186 | * moment, so make sure it's processed properly here. This will | ||
| 187 | * take RCLKx2 at maximum. | ||
| 188 | */ | ||
| 189 | for (k = 0; k < 100; k++) { | ||
| 190 | if (!sh_cmt_read(p, CMCNT)) | ||
| 191 | break; | ||
| 192 | udelay(1); | ||
| 193 | } | ||
| 194 | |||
| 195 | if (sh_cmt_read(p, CMCNT)) { | ||
| 196 | dev_err(&p->pdev->dev, "cannot clear CMCNT\n"); | ||
| 197 | ret = -ETIMEDOUT; | ||
| 198 | goto err1; | ||
| 199 | } | ||
| 200 | |||
| 177 | /* enable channel */ | 201 | /* enable channel */ |
| 178 | sh_cmt_start_stop_ch(p, 1); | 202 | sh_cmt_start_stop_ch(p, 1); |
| 179 | return 0; | 203 | return 0; |
| 204 | err1: | ||
| 205 | /* stop clock */ | ||
| 206 | clk_disable(p->clk); | ||
| 207 | |||
| 208 | err0: | ||
| 209 | return ret; | ||
| 180 | } | 210 | } |
| 181 | 211 | ||
| 182 | static void sh_cmt_disable(struct sh_cmt_priv *p) | 212 | static void sh_cmt_disable(struct sh_cmt_priv *p) |
diff --git a/drivers/cpufreq/pcc-cpufreq.c b/drivers/cpufreq/pcc-cpufreq.c index 7b0603eb0129..cdc02ac8f41a 100644 --- a/drivers/cpufreq/pcc-cpufreq.c +++ b/drivers/cpufreq/pcc-cpufreq.c | |||
| @@ -261,6 +261,9 @@ static int pcc_get_offset(int cpu) | |||
| 261 | pr = per_cpu(processors, cpu); | 261 | pr = per_cpu(processors, cpu); |
| 262 | pcc_cpu_data = per_cpu_ptr(pcc_cpu_info, cpu); | 262 | pcc_cpu_data = per_cpu_ptr(pcc_cpu_info, cpu); |
| 263 | 263 | ||
| 264 | if (!pr) | ||
| 265 | return -ENODEV; | ||
| 266 | |||
| 264 | status = acpi_evaluate_object(pr->handle, "PCCP", NULL, &buffer); | 267 | status = acpi_evaluate_object(pr->handle, "PCCP", NULL, &buffer); |
| 265 | if (ACPI_FAILURE(status)) | 268 | if (ACPI_FAILURE(status)) |
| 266 | return -ENODEV; | 269 | return -ENODEV; |
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index cd3a7c726bf8..467e4dcb20a0 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c | |||
| @@ -174,8 +174,10 @@ struct d40_base; | |||
| 174 | * @tasklet: Tasklet that gets scheduled from interrupt context to complete a | 174 | * @tasklet: Tasklet that gets scheduled from interrupt context to complete a |
| 175 | * transfer and call client callback. | 175 | * transfer and call client callback. |
| 176 | * @client: Cliented owned descriptor list. | 176 | * @client: Cliented owned descriptor list. |
| 177 | * @pending_queue: Submitted jobs, to be issued by issue_pending() | ||
| 177 | * @active: Active descriptor. | 178 | * @active: Active descriptor. |
| 178 | * @queue: Queued jobs. | 179 | * @queue: Queued jobs. |
| 180 | * @prepare_queue: Prepared jobs. | ||
| 179 | * @dma_cfg: The client configuration of this dma channel. | 181 | * @dma_cfg: The client configuration of this dma channel. |
| 180 | * @configured: whether the dma_cfg configuration is valid | 182 | * @configured: whether the dma_cfg configuration is valid |
| 181 | * @base: Pointer to the device instance struct. | 183 | * @base: Pointer to the device instance struct. |
| @@ -203,6 +205,7 @@ struct d40_chan { | |||
| 203 | struct list_head pending_queue; | 205 | struct list_head pending_queue; |
| 204 | struct list_head active; | 206 | struct list_head active; |
| 205 | struct list_head queue; | 207 | struct list_head queue; |
| 208 | struct list_head prepare_queue; | ||
| 206 | struct stedma40_chan_cfg dma_cfg; | 209 | struct stedma40_chan_cfg dma_cfg; |
| 207 | bool configured; | 210 | bool configured; |
| 208 | struct d40_base *base; | 211 | struct d40_base *base; |
| @@ -477,7 +480,6 @@ static struct d40_desc *d40_desc_get(struct d40_chan *d40c) | |||
| 477 | 480 | ||
| 478 | list_for_each_entry_safe(d, _d, &d40c->client, node) | 481 | list_for_each_entry_safe(d, _d, &d40c->client, node) |
| 479 | if (async_tx_test_ack(&d->txd)) { | 482 | if (async_tx_test_ack(&d->txd)) { |
| 480 | d40_pool_lli_free(d40c, d); | ||
| 481 | d40_desc_remove(d); | 483 | d40_desc_remove(d); |
| 482 | desc = d; | 484 | desc = d; |
| 483 | memset(desc, 0, sizeof(*desc)); | 485 | memset(desc, 0, sizeof(*desc)); |
| @@ -644,8 +646,11 @@ static struct d40_desc *d40_first_active_get(struct d40_chan *d40c) | |||
| 644 | return d; | 646 | return d; |
| 645 | } | 647 | } |
| 646 | 648 | ||
| 649 | /* remove desc from current queue and add it to the pending_queue */ | ||
| 647 | static void d40_desc_queue(struct d40_chan *d40c, struct d40_desc *desc) | 650 | static void d40_desc_queue(struct d40_chan *d40c, struct d40_desc *desc) |
| 648 | { | 651 | { |
| 652 | d40_desc_remove(desc); | ||
| 653 | desc->is_in_client_list = false; | ||
| 649 | list_add_tail(&desc->node, &d40c->pending_queue); | 654 | list_add_tail(&desc->node, &d40c->pending_queue); |
| 650 | } | 655 | } |
| 651 | 656 | ||
| @@ -803,6 +808,7 @@ done: | |||
| 803 | static void d40_term_all(struct d40_chan *d40c) | 808 | static void d40_term_all(struct d40_chan *d40c) |
| 804 | { | 809 | { |
| 805 | struct d40_desc *d40d; | 810 | struct d40_desc *d40d; |
| 811 | struct d40_desc *_d; | ||
| 806 | 812 | ||
| 807 | /* Release active descriptors */ | 813 | /* Release active descriptors */ |
| 808 | while ((d40d = d40_first_active_get(d40c))) { | 814 | while ((d40d = d40_first_active_get(d40c))) { |
| @@ -822,6 +828,21 @@ static void d40_term_all(struct d40_chan *d40c) | |||
| 822 | d40_desc_free(d40c, d40d); | 828 | d40_desc_free(d40c, d40d); |
| 823 | } | 829 | } |
| 824 | 830 | ||
| 831 | /* Release client owned descriptors */ | ||
| 832 | if (!list_empty(&d40c->client)) | ||
| 833 | list_for_each_entry_safe(d40d, _d, &d40c->client, node) { | ||
| 834 | d40_desc_remove(d40d); | ||
| 835 | d40_desc_free(d40c, d40d); | ||
| 836 | } | ||
| 837 | |||
| 838 | /* Release descriptors in prepare queue */ | ||
| 839 | if (!list_empty(&d40c->prepare_queue)) | ||
| 840 | list_for_each_entry_safe(d40d, _d, | ||
| 841 | &d40c->prepare_queue, node) { | ||
| 842 | d40_desc_remove(d40d); | ||
| 843 | d40_desc_free(d40c, d40d); | ||
| 844 | } | ||
| 845 | |||
| 825 | d40c->pending_tx = 0; | 846 | d40c->pending_tx = 0; |
| 826 | d40c->busy = false; | 847 | d40c->busy = false; |
| 827 | } | 848 | } |
| @@ -1208,7 +1229,6 @@ static void dma_tasklet(unsigned long data) | |||
| 1208 | 1229 | ||
| 1209 | if (!d40d->cyclic) { | 1230 | if (!d40d->cyclic) { |
| 1210 | if (async_tx_test_ack(&d40d->txd)) { | 1231 | if (async_tx_test_ack(&d40d->txd)) { |
| 1211 | d40_pool_lli_free(d40c, d40d); | ||
| 1212 | d40_desc_remove(d40d); | 1232 | d40_desc_remove(d40d); |
| 1213 | d40_desc_free(d40c, d40d); | 1233 | d40_desc_free(d40c, d40d); |
| 1214 | } else { | 1234 | } else { |
| @@ -1595,21 +1615,10 @@ static int d40_free_dma(struct d40_chan *d40c) | |||
| 1595 | u32 event; | 1615 | u32 event; |
| 1596 | struct d40_phy_res *phy = d40c->phy_chan; | 1616 | struct d40_phy_res *phy = d40c->phy_chan; |
| 1597 | bool is_src; | 1617 | bool is_src; |
| 1598 | struct d40_desc *d; | ||
| 1599 | struct d40_desc *_d; | ||
| 1600 | |||
| 1601 | 1618 | ||
| 1602 | /* Terminate all queued and active transfers */ | 1619 | /* Terminate all queued and active transfers */ |
| 1603 | d40_term_all(d40c); | 1620 | d40_term_all(d40c); |
| 1604 | 1621 | ||
| 1605 | /* Release client owned descriptors */ | ||
| 1606 | if (!list_empty(&d40c->client)) | ||
| 1607 | list_for_each_entry_safe(d, _d, &d40c->client, node) { | ||
| 1608 | d40_pool_lli_free(d40c, d); | ||
| 1609 | d40_desc_remove(d); | ||
| 1610 | d40_desc_free(d40c, d); | ||
| 1611 | } | ||
| 1612 | |||
| 1613 | if (phy == NULL) { | 1622 | if (phy == NULL) { |
| 1614 | chan_err(d40c, "phy == null\n"); | 1623 | chan_err(d40c, "phy == null\n"); |
| 1615 | return -EINVAL; | 1624 | return -EINVAL; |
| @@ -1911,6 +1920,12 @@ d40_prep_sg(struct dma_chan *dchan, struct scatterlist *sg_src, | |||
| 1911 | goto err; | 1920 | goto err; |
| 1912 | } | 1921 | } |
| 1913 | 1922 | ||
| 1923 | /* | ||
| 1924 | * add descriptor to the prepare queue in order to be able | ||
| 1925 | * to free them later in terminate_all | ||
| 1926 | */ | ||
| 1927 | list_add_tail(&desc->node, &chan->prepare_queue); | ||
| 1928 | |||
| 1914 | spin_unlock_irqrestore(&chan->lock, flags); | 1929 | spin_unlock_irqrestore(&chan->lock, flags); |
| 1915 | 1930 | ||
| 1916 | return &desc->txd; | 1931 | return &desc->txd; |
| @@ -2400,6 +2415,7 @@ static void __init d40_chan_init(struct d40_base *base, struct dma_device *dma, | |||
| 2400 | INIT_LIST_HEAD(&d40c->queue); | 2415 | INIT_LIST_HEAD(&d40c->queue); |
| 2401 | INIT_LIST_HEAD(&d40c->pending_queue); | 2416 | INIT_LIST_HEAD(&d40c->pending_queue); |
| 2402 | INIT_LIST_HEAD(&d40c->client); | 2417 | INIT_LIST_HEAD(&d40c->client); |
| 2418 | INIT_LIST_HEAD(&d40c->prepare_queue); | ||
| 2403 | 2419 | ||
| 2404 | tasklet_init(&d40c->tasklet, dma_tasklet, | 2420 | tasklet_init(&d40c->tasklet, dma_tasklet, |
| 2405 | (unsigned long) d40c); | 2421 | (unsigned long) d40c); |
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c index 41841a3e3f99..17cef864506a 100644 --- a/drivers/firewire/sbp2.c +++ b/drivers/firewire/sbp2.c | |||
| @@ -1198,6 +1198,10 @@ static int sbp2_remove(struct device *dev) | |||
| 1198 | { | 1198 | { |
| 1199 | struct fw_unit *unit = fw_unit(dev); | 1199 | struct fw_unit *unit = fw_unit(dev); |
| 1200 | struct sbp2_target *tgt = dev_get_drvdata(&unit->device); | 1200 | struct sbp2_target *tgt = dev_get_drvdata(&unit->device); |
| 1201 | struct sbp2_logical_unit *lu; | ||
| 1202 | |||
| 1203 | list_for_each_entry(lu, &tgt->lu_list, link) | ||
| 1204 | cancel_delayed_work_sync(&lu->work); | ||
| 1201 | 1205 | ||
| 1202 | sbp2_target_put(tgt); | 1206 | sbp2_target_put(tgt); |
| 1203 | return 0; | 1207 | return 0; |
diff --git a/drivers/firmware/google/gsmi.c b/drivers/firmware/google/gsmi.c index 68810fd1a59d..aa83de9db1b9 100644 --- a/drivers/firmware/google/gsmi.c +++ b/drivers/firmware/google/gsmi.c | |||
| @@ -420,7 +420,7 @@ static efi_status_t gsmi_get_next_variable(unsigned long *name_size, | |||
| 420 | 420 | ||
| 421 | static efi_status_t gsmi_set_variable(efi_char16_t *name, | 421 | static efi_status_t gsmi_set_variable(efi_char16_t *name, |
| 422 | efi_guid_t *vendor, | 422 | efi_guid_t *vendor, |
| 423 | unsigned long attr, | 423 | u32 attr, |
| 424 | unsigned long data_size, | 424 | unsigned long data_size, |
| 425 | void *data) | 425 | void *data) |
| 426 | { | 426 | { |
diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c index 231714def4d2..4e24436b0f82 100644 --- a/drivers/gpio/gpio-generic.c +++ b/drivers/gpio/gpio-generic.c | |||
| @@ -351,7 +351,7 @@ static int bgpio_setup_direction(struct bgpio_chip *bgc, | |||
| 351 | return 0; | 351 | return 0; |
| 352 | } | 352 | } |
| 353 | 353 | ||
| 354 | int __devexit bgpio_remove(struct bgpio_chip *bgc) | 354 | int bgpio_remove(struct bgpio_chip *bgc) |
| 355 | { | 355 | { |
| 356 | int err = gpiochip_remove(&bgc->gc); | 356 | int err = gpiochip_remove(&bgc->gc); |
| 357 | 357 | ||
| @@ -361,15 +361,10 @@ int __devexit bgpio_remove(struct bgpio_chip *bgc) | |||
| 361 | } | 361 | } |
| 362 | EXPORT_SYMBOL_GPL(bgpio_remove); | 362 | EXPORT_SYMBOL_GPL(bgpio_remove); |
| 363 | 363 | ||
| 364 | int __devinit bgpio_init(struct bgpio_chip *bgc, | 364 | int bgpio_init(struct bgpio_chip *bgc, struct device *dev, |
| 365 | struct device *dev, | 365 | unsigned long sz, void __iomem *dat, void __iomem *set, |
| 366 | unsigned long sz, | 366 | void __iomem *clr, void __iomem *dirout, void __iomem *dirin, |
| 367 | void __iomem *dat, | 367 | bool big_endian) |
| 368 | void __iomem *set, | ||
| 369 | void __iomem *clr, | ||
| 370 | void __iomem *dirout, | ||
| 371 | void __iomem *dirin, | ||
| 372 | bool big_endian) | ||
| 373 | { | 368 | { |
| 374 | int ret; | 369 | int ret; |
| 375 | 370 | ||
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 82db18506662..fe738f05309b 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
| @@ -499,6 +499,7 @@ void drm_connector_cleanup(struct drm_connector *connector) | |||
| 499 | mutex_lock(&dev->mode_config.mutex); | 499 | mutex_lock(&dev->mode_config.mutex); |
| 500 | drm_mode_object_put(dev, &connector->base); | 500 | drm_mode_object_put(dev, &connector->base); |
| 501 | list_del(&connector->head); | 501 | list_del(&connector->head); |
| 502 | dev->mode_config.num_connector--; | ||
| 502 | mutex_unlock(&dev->mode_config.mutex); | 503 | mutex_unlock(&dev->mode_config.mutex); |
| 503 | } | 504 | } |
| 504 | EXPORT_SYMBOL(drm_connector_cleanup); | 505 | EXPORT_SYMBOL(drm_connector_cleanup); |
| @@ -529,6 +530,7 @@ void drm_encoder_cleanup(struct drm_encoder *encoder) | |||
| 529 | mutex_lock(&dev->mode_config.mutex); | 530 | mutex_lock(&dev->mode_config.mutex); |
| 530 | drm_mode_object_put(dev, &encoder->base); | 531 | drm_mode_object_put(dev, &encoder->base); |
| 531 | list_del(&encoder->head); | 532 | list_del(&encoder->head); |
| 533 | dev->mode_config.num_encoder--; | ||
| 532 | mutex_unlock(&dev->mode_config.mutex); | 534 | mutex_unlock(&dev->mode_config.mutex); |
| 533 | } | 535 | } |
| 534 | EXPORT_SYMBOL(drm_encoder_cleanup); | 536 | EXPORT_SYMBOL(drm_encoder_cleanup); |
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 802b61ac3139..f7c6854eb4dd 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c | |||
| @@ -256,7 +256,6 @@ int drm_fb_helper_panic(struct notifier_block *n, unsigned long ununsed, | |||
| 256 | { | 256 | { |
| 257 | printk(KERN_ERR "panic occurred, switching back to text console\n"); | 257 | printk(KERN_ERR "panic occurred, switching back to text console\n"); |
| 258 | return drm_fb_helper_force_kernel_mode(); | 258 | return drm_fb_helper_force_kernel_mode(); |
| 259 | return 0; | ||
| 260 | } | 259 | } |
| 261 | EXPORT_SYMBOL(drm_fb_helper_panic); | 260 | EXPORT_SYMBOL(drm_fb_helper_panic); |
| 262 | 261 | ||
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index ee1d701317f7..56a8554d9039 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
| @@ -878,7 +878,7 @@ static void assert_panel_unlocked(struct drm_i915_private *dev_priv, | |||
| 878 | int pp_reg, lvds_reg; | 878 | int pp_reg, lvds_reg; |
| 879 | u32 val; | 879 | u32 val; |
| 880 | enum pipe panel_pipe = PIPE_A; | 880 | enum pipe panel_pipe = PIPE_A; |
| 881 | bool locked = locked; | 881 | bool locked = true; |
| 882 | 882 | ||
| 883 | if (HAS_PCH_SPLIT(dev_priv->dev)) { | 883 | if (HAS_PCH_SPLIT(dev_priv->dev)) { |
| 884 | pp_reg = PCH_PP_CONTROL; | 884 | pp_reg = PCH_PP_CONTROL; |
| @@ -7238,8 +7238,6 @@ static void intel_setup_outputs(struct drm_device *dev) | |||
| 7238 | intel_encoder_clones(dev, encoder->clone_mask); | 7238 | intel_encoder_clones(dev, encoder->clone_mask); |
| 7239 | } | 7239 | } |
| 7240 | 7240 | ||
| 7241 | intel_panel_setup_backlight(dev); | ||
| 7242 | |||
| 7243 | /* disable all the possible outputs/crtcs before entering KMS mode */ | 7241 | /* disable all the possible outputs/crtcs before entering KMS mode */ |
| 7244 | drm_helper_disable_unused_functions(dev); | 7242 | drm_helper_disable_unused_functions(dev); |
| 7245 | } | 7243 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c index 8d02d875376d..c919cfc8f2fd 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fence.c +++ b/drivers/gpu/drm/nouveau/nouveau_fence.c | |||
| @@ -530,7 +530,8 @@ nouveau_fence_channel_init(struct nouveau_channel *chan) | |||
| 530 | nouveau_gpuobj_ref(NULL, &obj); | 530 | nouveau_gpuobj_ref(NULL, &obj); |
| 531 | if (ret) | 531 | if (ret) |
| 532 | return ret; | 532 | return ret; |
| 533 | } else { | 533 | } else |
| 534 | if (USE_SEMA(dev)) { | ||
| 534 | /* map fence bo into channel's vm */ | 535 | /* map fence bo into channel's vm */ |
| 535 | ret = nouveau_bo_vma_add(dev_priv->fence.bo, chan->vm, | 536 | ret = nouveau_bo_vma_add(dev_priv->fence.bo, chan->vm, |
| 536 | &chan->fence.vma); | 537 | &chan->fence.vma); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c index c444cadbf849..2706cb3d871a 100644 --- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c +++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c | |||
| @@ -37,8 +37,11 @@ nouveau_sgdma_populate(struct ttm_backend *be, unsigned long num_pages, | |||
| 37 | return -ENOMEM; | 37 | return -ENOMEM; |
| 38 | 38 | ||
| 39 | nvbe->ttm_alloced = kmalloc(sizeof(bool) * num_pages, GFP_KERNEL); | 39 | nvbe->ttm_alloced = kmalloc(sizeof(bool) * num_pages, GFP_KERNEL); |
| 40 | if (!nvbe->ttm_alloced) | 40 | if (!nvbe->ttm_alloced) { |
| 41 | kfree(nvbe->pages); | ||
| 42 | nvbe->pages = NULL; | ||
| 41 | return -ENOMEM; | 43 | return -ENOMEM; |
| 44 | } | ||
| 42 | 45 | ||
| 43 | nvbe->nr_pages = 0; | 46 | nvbe->nr_pages = 0; |
| 44 | while (num_pages--) { | 47 | while (num_pages--) { |
| @@ -126,7 +129,7 @@ nv04_sgdma_bind(struct ttm_backend *be, struct ttm_mem_reg *mem) | |||
| 126 | 129 | ||
| 127 | for (j = 0; j < PAGE_SIZE / NV_CTXDMA_PAGE_SIZE; j++, pte++) { | 130 | for (j = 0; j < PAGE_SIZE / NV_CTXDMA_PAGE_SIZE; j++, pte++) { |
| 128 | nv_wo32(gpuobj, (pte * 4) + 0, offset_l | 3); | 131 | nv_wo32(gpuobj, (pte * 4) + 0, offset_l | 3); |
| 129 | dma_offset += NV_CTXDMA_PAGE_SIZE; | 132 | offset_l += NV_CTXDMA_PAGE_SIZE; |
| 130 | } | 133 | } |
| 131 | } | 134 | } |
| 132 | 135 | ||
diff --git a/drivers/gpu/drm/nouveau/nv04_crtc.c b/drivers/gpu/drm/nouveau/nv04_crtc.c index 118261d4927a..5e45398a9e2d 100644 --- a/drivers/gpu/drm/nouveau/nv04_crtc.c +++ b/drivers/gpu/drm/nouveau/nv04_crtc.c | |||
| @@ -781,11 +781,20 @@ nv04_crtc_do_mode_set_base(struct drm_crtc *crtc, | |||
| 781 | struct drm_device *dev = crtc->dev; | 781 | struct drm_device *dev = crtc->dev; |
| 782 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 782 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
| 783 | struct nv04_crtc_reg *regp = &dev_priv->mode_reg.crtc_reg[nv_crtc->index]; | 783 | struct nv04_crtc_reg *regp = &dev_priv->mode_reg.crtc_reg[nv_crtc->index]; |
| 784 | struct drm_framebuffer *drm_fb = nv_crtc->base.fb; | 784 | struct drm_framebuffer *drm_fb; |
| 785 | struct nouveau_framebuffer *fb = nouveau_framebuffer(drm_fb); | 785 | struct nouveau_framebuffer *fb; |
| 786 | int arb_burst, arb_lwm; | 786 | int arb_burst, arb_lwm; |
| 787 | int ret; | 787 | int ret; |
| 788 | 788 | ||
| 789 | NV_DEBUG_KMS(dev, "index %d\n", nv_crtc->index); | ||
| 790 | |||
| 791 | /* no fb bound */ | ||
| 792 | if (!atomic && !crtc->fb) { | ||
| 793 | NV_DEBUG_KMS(dev, "No FB bound\n"); | ||
| 794 | return 0; | ||
| 795 | } | ||
| 796 | |||
| 797 | |||
| 789 | /* If atomic, we want to switch to the fb we were passed, so | 798 | /* If atomic, we want to switch to the fb we were passed, so |
| 790 | * now we update pointers to do that. (We don't pin; just | 799 | * now we update pointers to do that. (We don't pin; just |
| 791 | * assume we're already pinned and update the base address.) | 800 | * assume we're already pinned and update the base address.) |
| @@ -794,6 +803,8 @@ nv04_crtc_do_mode_set_base(struct drm_crtc *crtc, | |||
| 794 | drm_fb = passed_fb; | 803 | drm_fb = passed_fb; |
| 795 | fb = nouveau_framebuffer(passed_fb); | 804 | fb = nouveau_framebuffer(passed_fb); |
| 796 | } else { | 805 | } else { |
| 806 | drm_fb = crtc->fb; | ||
| 807 | fb = nouveau_framebuffer(crtc->fb); | ||
| 797 | /* If not atomic, we can go ahead and pin, and unpin the | 808 | /* If not atomic, we can go ahead and pin, and unpin the |
| 798 | * old fb we were passed. | 809 | * old fb we were passed. |
| 799 | */ | 810 | */ |
diff --git a/drivers/gpu/drm/nouveau/nv50_crtc.c b/drivers/gpu/drm/nouveau/nv50_crtc.c index 46ad59ea2185..5d989073ba6e 100644 --- a/drivers/gpu/drm/nouveau/nv50_crtc.c +++ b/drivers/gpu/drm/nouveau/nv50_crtc.c | |||
| @@ -519,12 +519,18 @@ nv50_crtc_do_mode_set_base(struct drm_crtc *crtc, | |||
| 519 | struct drm_device *dev = nv_crtc->base.dev; | 519 | struct drm_device *dev = nv_crtc->base.dev; |
| 520 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 520 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
| 521 | struct nouveau_channel *evo = nv50_display(dev)->master; | 521 | struct nouveau_channel *evo = nv50_display(dev)->master; |
| 522 | struct drm_framebuffer *drm_fb = nv_crtc->base.fb; | 522 | struct drm_framebuffer *drm_fb; |
| 523 | struct nouveau_framebuffer *fb = nouveau_framebuffer(drm_fb); | 523 | struct nouveau_framebuffer *fb; |
| 524 | int ret; | 524 | int ret; |
| 525 | 525 | ||
| 526 | NV_DEBUG_KMS(dev, "index %d\n", nv_crtc->index); | 526 | NV_DEBUG_KMS(dev, "index %d\n", nv_crtc->index); |
| 527 | 527 | ||
| 528 | /* no fb bound */ | ||
| 529 | if (!atomic && !crtc->fb) { | ||
| 530 | NV_DEBUG_KMS(dev, "No FB bound\n"); | ||
| 531 | return 0; | ||
| 532 | } | ||
| 533 | |||
| 528 | /* If atomic, we want to switch to the fb we were passed, so | 534 | /* If atomic, we want to switch to the fb we were passed, so |
| 529 | * now we update pointers to do that. (We don't pin; just | 535 | * now we update pointers to do that. (We don't pin; just |
| 530 | * assume we're already pinned and update the base address.) | 536 | * assume we're already pinned and update the base address.) |
| @@ -533,6 +539,8 @@ nv50_crtc_do_mode_set_base(struct drm_crtc *crtc, | |||
| 533 | drm_fb = passed_fb; | 539 | drm_fb = passed_fb; |
| 534 | fb = nouveau_framebuffer(passed_fb); | 540 | fb = nouveau_framebuffer(passed_fb); |
| 535 | } else { | 541 | } else { |
| 542 | drm_fb = crtc->fb; | ||
| 543 | fb = nouveau_framebuffer(crtc->fb); | ||
| 536 | /* If not atomic, we can go ahead and pin, and unpin the | 544 | /* If not atomic, we can go ahead and pin, and unpin the |
| 537 | * old fb we were passed. | 545 | * old fb we were passed. |
| 538 | */ | 546 | */ |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index fb5fa0898868..dc0a5b56c81a 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
| @@ -41,6 +41,31 @@ static void evergreen_gpu_init(struct radeon_device *rdev); | |||
| 41 | void evergreen_fini(struct radeon_device *rdev); | 41 | void evergreen_fini(struct radeon_device *rdev); |
| 42 | static void evergreen_pcie_gen2_enable(struct radeon_device *rdev); | 42 | static void evergreen_pcie_gen2_enable(struct radeon_device *rdev); |
| 43 | 43 | ||
| 44 | void evergreen_fix_pci_max_read_req_size(struct radeon_device *rdev) | ||
| 45 | { | ||
| 46 | u16 ctl, v; | ||
| 47 | int cap, err; | ||
| 48 | |||
| 49 | cap = pci_pcie_cap(rdev->pdev); | ||
| 50 | if (!cap) | ||
| 51 | return; | ||
| 52 | |||
| 53 | err = pci_read_config_word(rdev->pdev, cap + PCI_EXP_DEVCTL, &ctl); | ||
| 54 | if (err) | ||
| 55 | return; | ||
| 56 | |||
| 57 | v = (ctl & PCI_EXP_DEVCTL_READRQ) >> 12; | ||
| 58 | |||
| 59 | /* if bios or OS sets MAX_READ_REQUEST_SIZE to an invalid value, fix it | ||
| 60 | * to avoid hangs or perfomance issues | ||
| 61 | */ | ||
| 62 | if ((v == 0) || (v == 6) || (v == 7)) { | ||
| 63 | ctl &= ~PCI_EXP_DEVCTL_READRQ; | ||
| 64 | ctl |= (2 << 12); | ||
| 65 | pci_write_config_word(rdev->pdev, cap + PCI_EXP_DEVCTL, ctl); | ||
| 66 | } | ||
| 67 | } | ||
| 68 | |||
| 44 | void evergreen_pre_page_flip(struct radeon_device *rdev, int crtc) | 69 | void evergreen_pre_page_flip(struct radeon_device *rdev, int crtc) |
| 45 | { | 70 | { |
| 46 | /* enable the pflip int */ | 71 | /* enable the pflip int */ |
| @@ -1357,6 +1382,7 @@ int evergreen_cp_resume(struct radeon_device *rdev) | |||
| 1357 | SOFT_RESET_PA | | 1382 | SOFT_RESET_PA | |
| 1358 | SOFT_RESET_SH | | 1383 | SOFT_RESET_SH | |
| 1359 | SOFT_RESET_VGT | | 1384 | SOFT_RESET_VGT | |
| 1385 | SOFT_RESET_SPI | | ||
| 1360 | SOFT_RESET_SX)); | 1386 | SOFT_RESET_SX)); |
| 1361 | RREG32(GRBM_SOFT_RESET); | 1387 | RREG32(GRBM_SOFT_RESET); |
| 1362 | mdelay(15); | 1388 | mdelay(15); |
| @@ -1862,6 +1888,8 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
| 1862 | 1888 | ||
| 1863 | WREG32(GRBM_CNTL, GRBM_READ_TIMEOUT(0xff)); | 1889 | WREG32(GRBM_CNTL, GRBM_READ_TIMEOUT(0xff)); |
| 1864 | 1890 | ||
| 1891 | evergreen_fix_pci_max_read_req_size(rdev); | ||
| 1892 | |||
| 1865 | cc_gc_shader_pipe_config = RREG32(CC_GC_SHADER_PIPE_CONFIG) & ~2; | 1893 | cc_gc_shader_pipe_config = RREG32(CC_GC_SHADER_PIPE_CONFIG) & ~2; |
| 1866 | 1894 | ||
| 1867 | cc_gc_shader_pipe_config |= | 1895 | cc_gc_shader_pipe_config |= |
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index 44c4750f4518..cbf57d75d925 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c | |||
| @@ -39,6 +39,7 @@ extern int evergreen_mc_wait_for_idle(struct radeon_device *rdev); | |||
| 39 | extern void evergreen_mc_program(struct radeon_device *rdev); | 39 | extern void evergreen_mc_program(struct radeon_device *rdev); |
| 40 | extern void evergreen_irq_suspend(struct radeon_device *rdev); | 40 | extern void evergreen_irq_suspend(struct radeon_device *rdev); |
| 41 | extern int evergreen_mc_init(struct radeon_device *rdev); | 41 | extern int evergreen_mc_init(struct radeon_device *rdev); |
| 42 | extern void evergreen_fix_pci_max_read_req_size(struct radeon_device *rdev); | ||
| 42 | 43 | ||
| 43 | #define EVERGREEN_PFP_UCODE_SIZE 1120 | 44 | #define EVERGREEN_PFP_UCODE_SIZE 1120 |
| 44 | #define EVERGREEN_PM4_UCODE_SIZE 1376 | 45 | #define EVERGREEN_PM4_UCODE_SIZE 1376 |
| @@ -669,6 +670,8 @@ static void cayman_gpu_init(struct radeon_device *rdev) | |||
| 669 | 670 | ||
| 670 | WREG32(GRBM_CNTL, GRBM_READ_TIMEOUT(0xff)); | 671 | WREG32(GRBM_CNTL, GRBM_READ_TIMEOUT(0xff)); |
| 671 | 672 | ||
| 673 | evergreen_fix_pci_max_read_req_size(rdev); | ||
| 674 | |||
| 672 | mc_shared_chmap = RREG32(MC_SHARED_CHMAP); | 675 | mc_shared_chmap = RREG32(MC_SHARED_CHMAP); |
| 673 | mc_arb_ramcfg = RREG32(MC_ARB_RAMCFG); | 676 | mc_arb_ramcfg = RREG32(MC_ARB_RAMCFG); |
| 674 | 677 | ||
| @@ -1159,6 +1162,7 @@ int cayman_cp_resume(struct radeon_device *rdev) | |||
| 1159 | SOFT_RESET_PA | | 1162 | SOFT_RESET_PA | |
| 1160 | SOFT_RESET_SH | | 1163 | SOFT_RESET_SH | |
| 1161 | SOFT_RESET_VGT | | 1164 | SOFT_RESET_VGT | |
| 1165 | SOFT_RESET_SPI | | ||
| 1162 | SOFT_RESET_SX)); | 1166 | SOFT_RESET_SX)); |
| 1163 | RREG32(GRBM_SOFT_RESET); | 1167 | RREG32(GRBM_SOFT_RESET); |
| 1164 | mdelay(15); | 1168 | mdelay(15); |
diff --git a/drivers/gpu/drm/radeon/radeon_clocks.c b/drivers/gpu/drm/radeon/radeon_clocks.c index dcd0863e31ae..b6e18c8db9f5 100644 --- a/drivers/gpu/drm/radeon/radeon_clocks.c +++ b/drivers/gpu/drm/radeon/radeon_clocks.c | |||
| @@ -219,6 +219,9 @@ void radeon_get_clock_info(struct drm_device *dev) | |||
| 219 | } else { | 219 | } else { |
| 220 | DRM_INFO("Using generic clock info\n"); | 220 | DRM_INFO("Using generic clock info\n"); |
| 221 | 221 | ||
| 222 | /* may need to be per card */ | ||
| 223 | rdev->clock.max_pixel_clock = 35000; | ||
| 224 | |||
| 222 | if (rdev->flags & RADEON_IS_IGP) { | 225 | if (rdev->flags & RADEON_IS_IGP) { |
| 223 | p1pll->reference_freq = 1432; | 226 | p1pll->reference_freq = 1432; |
| 224 | p2pll->reference_freq = 1432; | 227 | p2pll->reference_freq = 1432; |
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index e0138b674aca..63675241c7ff 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c | |||
| @@ -3298,6 +3298,14 @@ void radeon_combios_asic_init(struct drm_device *dev) | |||
| 3298 | rdev->pdev->subsystem_device == 0x30a4) | 3298 | rdev->pdev->subsystem_device == 0x30a4) |
| 3299 | return; | 3299 | return; |
| 3300 | 3300 | ||
| 3301 | /* quirk for rs4xx Compaq Presario V5245EU laptop to make it resume | ||
| 3302 | * - it hangs on resume inside the dynclk 1 table. | ||
| 3303 | */ | ||
| 3304 | if (rdev->family == CHIP_RS480 && | ||
| 3305 | rdev->pdev->subsystem_vendor == 0x103c && | ||
| 3306 | rdev->pdev->subsystem_device == 0x30ae) | ||
| 3307 | return; | ||
| 3308 | |||
| 3301 | /* DYN CLK 1 */ | 3309 | /* DYN CLK 1 */ |
| 3302 | table = combios_get_table_offset(dev, COMBIOS_DYN_CLK_1_TABLE); | 3310 | table = combios_get_table_offset(dev, COMBIOS_DYN_CLK_1_TABLE); |
| 3303 | if (table) | 3311 | if (table) |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index 4f0c1ecac72e..c4b8741dbf58 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
| @@ -1297,12 +1297,33 @@ radeon_dp_detect(struct drm_connector *connector, bool force) | |||
| 1297 | if (!radeon_dig_connector->edp_on) | 1297 | if (!radeon_dig_connector->edp_on) |
| 1298 | atombios_set_edp_panel_power(connector, | 1298 | atombios_set_edp_panel_power(connector, |
| 1299 | ATOM_TRANSMITTER_ACTION_POWER_OFF); | 1299 | ATOM_TRANSMITTER_ACTION_POWER_OFF); |
| 1300 | } else { | 1300 | } else if (radeon_connector_encoder_is_dp_bridge(connector)) { |
| 1301 | /* need to setup ddc on the bridge */ | 1301 | /* DP bridges are always DP */ |
| 1302 | if (radeon_connector_encoder_is_dp_bridge(connector)) { | 1302 | radeon_dig_connector->dp_sink_type = CONNECTOR_OBJECT_ID_DISPLAYPORT; |
| 1303 | /* get the DPCD from the bridge */ | ||
| 1304 | radeon_dp_getdpcd(radeon_connector); | ||
| 1305 | |||
| 1306 | if (radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) | ||
| 1307 | ret = connector_status_connected; | ||
| 1308 | else { | ||
| 1309 | /* need to setup ddc on the bridge */ | ||
| 1303 | if (encoder) | 1310 | if (encoder) |
| 1304 | radeon_atom_ext_encoder_setup_ddc(encoder); | 1311 | radeon_atom_ext_encoder_setup_ddc(encoder); |
| 1312 | if (radeon_ddc_probe(radeon_connector, | ||
| 1313 | radeon_connector->requires_extended_probe)) | ||
| 1314 | ret = connector_status_connected; | ||
| 1315 | } | ||
| 1316 | |||
| 1317 | if ((ret == connector_status_disconnected) && | ||
| 1318 | radeon_connector->dac_load_detect) { | ||
| 1319 | struct drm_encoder *encoder = radeon_best_single_encoder(connector); | ||
| 1320 | struct drm_encoder_helper_funcs *encoder_funcs; | ||
| 1321 | if (encoder) { | ||
| 1322 | encoder_funcs = encoder->helper_private; | ||
| 1323 | ret = encoder_funcs->detect(encoder, connector); | ||
| 1324 | } | ||
| 1305 | } | 1325 | } |
| 1326 | } else { | ||
| 1306 | radeon_dig_connector->dp_sink_type = radeon_dp_getsinktype(radeon_connector); | 1327 | radeon_dig_connector->dp_sink_type = radeon_dp_getsinktype(radeon_connector); |
| 1307 | if (radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) { | 1328 | if (radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) { |
| 1308 | ret = connector_status_connected; | 1329 | ret = connector_status_connected; |
| @@ -1318,16 +1339,6 @@ radeon_dp_detect(struct drm_connector *connector, bool force) | |||
| 1318 | ret = connector_status_connected; | 1339 | ret = connector_status_connected; |
| 1319 | } | 1340 | } |
| 1320 | } | 1341 | } |
| 1321 | |||
| 1322 | if ((ret == connector_status_disconnected) && | ||
| 1323 | radeon_connector->dac_load_detect) { | ||
| 1324 | struct drm_encoder *encoder = radeon_best_single_encoder(connector); | ||
| 1325 | struct drm_encoder_helper_funcs *encoder_funcs; | ||
| 1326 | if (encoder) { | ||
| 1327 | encoder_funcs = encoder->helper_private; | ||
| 1328 | ret = encoder_funcs->detect(encoder, connector); | ||
| 1329 | } | ||
| 1330 | } | ||
| 1331 | } | 1342 | } |
| 1332 | 1343 | ||
| 1333 | radeon_connector_update_scratch_regs(connector, ret); | 1344 | radeon_connector_update_scratch_regs(connector, ret); |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 1a858944e4f3..6cc17fb96a57 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
| @@ -707,16 +707,21 @@ int radeon_ddc_get_modes(struct radeon_connector *radeon_connector) | |||
| 707 | radeon_router_select_ddc_port(radeon_connector); | 707 | radeon_router_select_ddc_port(radeon_connector); |
| 708 | 708 | ||
| 709 | if ((radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) || | 709 | if ((radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) || |
| 710 | (radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_eDP)) { | 710 | (radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_eDP) || |
| 711 | radeon_connector_encoder_is_dp_bridge(&radeon_connector->base)) { | ||
| 711 | struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; | 712 | struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; |
| 713 | |||
| 712 | if ((dig->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT || | 714 | if ((dig->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT || |
| 713 | dig->dp_sink_type == CONNECTOR_OBJECT_ID_eDP) && dig->dp_i2c_bus) | 715 | dig->dp_sink_type == CONNECTOR_OBJECT_ID_eDP) && dig->dp_i2c_bus) |
| 714 | radeon_connector->edid = drm_get_edid(&radeon_connector->base, &dig->dp_i2c_bus->adapter); | 716 | radeon_connector->edid = drm_get_edid(&radeon_connector->base, |
| 715 | } | 717 | &dig->dp_i2c_bus->adapter); |
| 716 | if (!radeon_connector->ddc_bus) | 718 | else if (radeon_connector->ddc_bus && !radeon_connector->edid) |
| 717 | return -1; | 719 | radeon_connector->edid = drm_get_edid(&radeon_connector->base, |
| 718 | if (!radeon_connector->edid) { | 720 | &radeon_connector->ddc_bus->adapter); |
| 719 | radeon_connector->edid = drm_get_edid(&radeon_connector->base, &radeon_connector->ddc_bus->adapter); | 721 | } else { |
| 722 | if (radeon_connector->ddc_bus && !radeon_connector->edid) | ||
| 723 | radeon_connector->edid = drm_get_edid(&radeon_connector->base, | ||
| 724 | &radeon_connector->ddc_bus->adapter); | ||
| 720 | } | 725 | } |
| 721 | 726 | ||
| 722 | if (!radeon_connector->edid) { | 727 | if (!radeon_connector->edid) { |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 7d27d2b0445a..7484e1b67249 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
| @@ -277,6 +277,7 @@ | |||
| 277 | #define USB_DEVICE_ID_PENPOWER 0x00f4 | 277 | #define USB_DEVICE_ID_PENPOWER 0x00f4 |
| 278 | 278 | ||
| 279 | #define USB_VENDOR_ID_GREENASIA 0x0e8f | 279 | #define USB_VENDOR_ID_GREENASIA 0x0e8f |
| 280 | #define USB_DEVICE_ID_GREENASIA_DUAL_USB_JOYPAD 0x3013 | ||
| 280 | 281 | ||
| 281 | #define USB_VENDOR_ID_GRETAGMACBETH 0x0971 | 282 | #define USB_VENDOR_ID_GRETAGMACBETH 0x0971 |
| 282 | #define USB_DEVICE_ID_GRETAGMACBETH_HUEY 0x2005 | 283 | #define USB_DEVICE_ID_GRETAGMACBETH_HUEY 0x2005 |
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c index 0ec91c18a421..f0fbd7bd239e 100644 --- a/drivers/hid/hid-magicmouse.c +++ b/drivers/hid/hid-magicmouse.c | |||
| @@ -81,6 +81,28 @@ MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state fie | |||
| 81 | #define NO_TOUCHES -1 | 81 | #define NO_TOUCHES -1 |
| 82 | #define SINGLE_TOUCH_UP -2 | 82 | #define SINGLE_TOUCH_UP -2 |
| 83 | 83 | ||
| 84 | /* Touch surface information. Dimension is in hundredths of a mm, min and max | ||
| 85 | * are in units. */ | ||
| 86 | #define MOUSE_DIMENSION_X (float)9056 | ||
| 87 | #define MOUSE_MIN_X -1100 | ||
| 88 | #define MOUSE_MAX_X 1258 | ||
| 89 | #define MOUSE_RES_X ((MOUSE_MAX_X - MOUSE_MIN_X) / (MOUSE_DIMENSION_X / 100)) | ||
| 90 | #define MOUSE_DIMENSION_Y (float)5152 | ||
| 91 | #define MOUSE_MIN_Y -1589 | ||
| 92 | #define MOUSE_MAX_Y 2047 | ||
| 93 | #define MOUSE_RES_Y ((MOUSE_MAX_Y - MOUSE_MIN_Y) / (MOUSE_DIMENSION_Y / 100)) | ||
| 94 | |||
| 95 | #define TRACKPAD_DIMENSION_X (float)13000 | ||
| 96 | #define TRACKPAD_MIN_X -2909 | ||
| 97 | #define TRACKPAD_MAX_X 3167 | ||
| 98 | #define TRACKPAD_RES_X \ | ||
| 99 | ((TRACKPAD_MAX_X - TRACKPAD_MIN_X) / (TRACKPAD_DIMENSION_X / 100)) | ||
| 100 | #define TRACKPAD_DIMENSION_Y (float)11000 | ||
| 101 | #define TRACKPAD_MIN_Y -2456 | ||
| 102 | #define TRACKPAD_MAX_Y 2565 | ||
| 103 | #define TRACKPAD_RES_Y \ | ||
| 104 | ((TRACKPAD_MAX_Y - TRACKPAD_MIN_Y) / (TRACKPAD_DIMENSION_Y / 100)) | ||
| 105 | |||
| 84 | /** | 106 | /** |
| 85 | * struct magicmouse_sc - Tracks Magic Mouse-specific data. | 107 | * struct magicmouse_sc - Tracks Magic Mouse-specific data. |
| 86 | * @input: Input device through which we report events. | 108 | * @input: Input device through which we report events. |
| @@ -406,17 +428,31 @@ static void magicmouse_setup_input(struct input_dev *input, struct hid_device *h | |||
| 406 | * inverse of the reported Y. | 428 | * inverse of the reported Y. |
| 407 | */ | 429 | */ |
| 408 | if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) { | 430 | if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) { |
| 409 | input_set_abs_params(input, ABS_MT_POSITION_X, -1100, | 431 | input_set_abs_params(input, ABS_MT_POSITION_X, |
| 410 | 1358, 4, 0); | 432 | MOUSE_MIN_X, MOUSE_MAX_X, 4, 0); |
| 411 | input_set_abs_params(input, ABS_MT_POSITION_Y, -1589, | 433 | input_set_abs_params(input, ABS_MT_POSITION_Y, |
| 412 | 2047, 4, 0); | 434 | MOUSE_MIN_Y, MOUSE_MAX_Y, 4, 0); |
| 435 | |||
| 436 | input_abs_set_res(input, ABS_MT_POSITION_X, | ||
| 437 | MOUSE_RES_X); | ||
| 438 | input_abs_set_res(input, ABS_MT_POSITION_Y, | ||
| 439 | MOUSE_RES_Y); | ||
| 413 | } else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */ | 440 | } else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */ |
| 414 | input_set_abs_params(input, ABS_X, -2909, 3167, 4, 0); | 441 | input_set_abs_params(input, ABS_X, TRACKPAD_MIN_X, |
| 415 | input_set_abs_params(input, ABS_Y, -2456, 2565, 4, 0); | 442 | TRACKPAD_MAX_X, 4, 0); |
| 416 | input_set_abs_params(input, ABS_MT_POSITION_X, -2909, | 443 | input_set_abs_params(input, ABS_Y, TRACKPAD_MIN_Y, |
| 417 | 3167, 4, 0); | 444 | TRACKPAD_MAX_Y, 4, 0); |
| 418 | input_set_abs_params(input, ABS_MT_POSITION_Y, -2456, | 445 | input_set_abs_params(input, ABS_MT_POSITION_X, |
| 419 | 2565, 4, 0); | 446 | TRACKPAD_MIN_X, TRACKPAD_MAX_X, 4, 0); |
| 447 | input_set_abs_params(input, ABS_MT_POSITION_Y, | ||
| 448 | TRACKPAD_MIN_Y, TRACKPAD_MAX_Y, 4, 0); | ||
| 449 | |||
| 450 | input_abs_set_res(input, ABS_X, TRACKPAD_RES_X); | ||
| 451 | input_abs_set_res(input, ABS_Y, TRACKPAD_RES_Y); | ||
| 452 | input_abs_set_res(input, ABS_MT_POSITION_X, | ||
| 453 | TRACKPAD_RES_X); | ||
| 454 | input_abs_set_res(input, ABS_MT_POSITION_Y, | ||
| 455 | TRACKPAD_RES_Y); | ||
| 420 | } | 456 | } |
| 421 | 457 | ||
| 422 | input_set_events_per_packet(input, 60); | 458 | input_set_events_per_packet(input, 60); |
| @@ -501,9 +537,17 @@ static int magicmouse_probe(struct hid_device *hdev, | |||
| 501 | } | 537 | } |
| 502 | report->size = 6; | 538 | report->size = 6; |
| 503 | 539 | ||
| 540 | /* | ||
| 541 | * Some devices repond with 'invalid report id' when feature | ||
| 542 | * report switching it into multitouch mode is sent to it. | ||
| 543 | * | ||
| 544 | * This results in -EIO from the _raw low-level transport callback, | ||
| 545 | * but there seems to be no other way of switching the mode. | ||
| 546 | * Thus the super-ugly hacky success check below. | ||
| 547 | */ | ||
| 504 | ret = hdev->hid_output_raw_report(hdev, feature, sizeof(feature), | 548 | ret = hdev->hid_output_raw_report(hdev, feature, sizeof(feature), |
| 505 | HID_FEATURE_REPORT); | 549 | HID_FEATURE_REPORT); |
| 506 | if (ret != sizeof(feature)) { | 550 | if (ret != -EIO && ret != sizeof(feature)) { |
| 507 | hid_err(hdev, "unable to request touch data (%d)\n", ret); | 551 | hid_err(hdev, "unable to request touch data (%d)\n", ret); |
| 508 | goto err_stop_hw; | 552 | goto err_stop_hw; |
| 509 | } | 553 | } |
diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c index 06888323828c..a597039d0755 100644 --- a/drivers/hid/hid-wacom.c +++ b/drivers/hid/hid-wacom.c | |||
| @@ -353,11 +353,7 @@ static int wacom_probe(struct hid_device *hdev, | |||
| 353 | if (ret) { | 353 | if (ret) { |
| 354 | hid_warn(hdev, "can't create sysfs battery attribute, err: %d\n", | 354 | hid_warn(hdev, "can't create sysfs battery attribute, err: %d\n", |
| 355 | ret); | 355 | ret); |
| 356 | /* | 356 | goto err_battery; |
| 357 | * battery attribute is not critical for the tablet, but if it | ||
| 358 | * failed then there is no need to create ac attribute | ||
| 359 | */ | ||
| 360 | goto move_on; | ||
| 361 | } | 357 | } |
| 362 | 358 | ||
| 363 | wdata->ac.properties = wacom_ac_props; | 359 | wdata->ac.properties = wacom_ac_props; |
| @@ -371,14 +367,8 @@ static int wacom_probe(struct hid_device *hdev, | |||
| 371 | if (ret) { | 367 | if (ret) { |
| 372 | hid_warn(hdev, | 368 | hid_warn(hdev, |
| 373 | "can't create ac battery attribute, err: %d\n", ret); | 369 | "can't create ac battery attribute, err: %d\n", ret); |
| 374 | /* | 370 | goto err_ac; |
| 375 | * ac attribute is not critical for the tablet, but if it | ||
| 376 | * failed then we don't want to battery attribute to exist | ||
| 377 | */ | ||
| 378 | power_supply_unregister(&wdata->battery); | ||
| 379 | } | 371 | } |
| 380 | |||
| 381 | move_on: | ||
| 382 | #endif | 372 | #endif |
| 383 | hidinput = list_entry(hdev->inputs.next, struct hid_input, list); | 373 | hidinput = list_entry(hdev->inputs.next, struct hid_input, list); |
| 384 | input = hidinput->input; | 374 | input = hidinput->input; |
| @@ -416,6 +406,13 @@ move_on: | |||
| 416 | 406 | ||
| 417 | return 0; | 407 | return 0; |
| 418 | 408 | ||
| 409 | #ifdef CONFIG_HID_WACOM_POWER_SUPPLY | ||
| 410 | err_ac: | ||
| 411 | power_supply_unregister(&wdata->battery); | ||
| 412 | err_battery: | ||
| 413 | device_remove_file(&hdev->dev, &dev_attr_speed); | ||
| 414 | hid_hw_stop(hdev); | ||
| 415 | #endif | ||
| 419 | err_free: | 416 | err_free: |
| 420 | kfree(wdata); | 417 | kfree(wdata); |
| 421 | return ret; | 418 | return ret; |
| @@ -426,6 +423,7 @@ static void wacom_remove(struct hid_device *hdev) | |||
| 426 | #ifdef CONFIG_HID_WACOM_POWER_SUPPLY | 423 | #ifdef CONFIG_HID_WACOM_POWER_SUPPLY |
| 427 | struct wacom_data *wdata = hid_get_drvdata(hdev); | 424 | struct wacom_data *wdata = hid_get_drvdata(hdev); |
| 428 | #endif | 425 | #endif |
| 426 | device_remove_file(&hdev->dev, &dev_attr_speed); | ||
| 429 | hid_hw_stop(hdev); | 427 | hid_hw_stop(hdev); |
| 430 | 428 | ||
| 431 | #ifdef CONFIG_HID_WACOM_POWER_SUPPLY | 429 | #ifdef CONFIG_HID_WACOM_POWER_SUPPLY |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index 4bdb5d46c52c..3146fdcda272 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
| @@ -47,6 +47,7 @@ static const struct hid_blacklist { | |||
| 47 | { USB_VENDOR_ID_AFATECH, USB_DEVICE_ID_AFATECH_AF9016, HID_QUIRK_FULLSPEED_INTERVAL }, | 47 | { USB_VENDOR_ID_AFATECH, USB_DEVICE_ID_AFATECH_AF9016, HID_QUIRK_FULLSPEED_INTERVAL }, |
| 48 | 48 | ||
| 49 | { USB_VENDOR_ID_ETURBOTOUCH, USB_DEVICE_ID_ETURBOTOUCH, HID_QUIRK_MULTI_INPUT }, | 49 | { USB_VENDOR_ID_ETURBOTOUCH, USB_DEVICE_ID_ETURBOTOUCH, HID_QUIRK_MULTI_INPUT }, |
| 50 | { USB_VENDOR_ID_GREENASIA, USB_DEVICE_ID_GREENASIA_DUAL_USB_JOYPAD, HID_QUIRK_MULTI_INPUT }, | ||
| 50 | { USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS }, | 51 | { USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS }, |
| 51 | { USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII, HID_QUIRK_MULTI_INPUT }, | 52 | { USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII, HID_QUIRK_MULTI_INPUT }, |
| 52 | { USB_VENDOR_ID_TOUCHPACK, USB_DEVICE_ID_TOUCHPACK_RTS, HID_QUIRK_MULTI_INPUT }, | 53 | { USB_VENDOR_ID_TOUCHPACK, USB_DEVICE_ID_TOUCHPACK_RTS, HID_QUIRK_MULTI_INPUT }, |
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 59d83e83da7f..411257676133 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
| @@ -601,7 +601,12 @@ static int create_core_data(struct platform_data *pdata, | |||
| 601 | err = rdmsr_safe_on_cpu(cpu, tdata->intrpt_reg, &eax, &edx); | 601 | err = rdmsr_safe_on_cpu(cpu, tdata->intrpt_reg, &eax, &edx); |
| 602 | if (!err) { | 602 | if (!err) { |
| 603 | tdata->attr_size += MAX_THRESH_ATTRS; | 603 | tdata->attr_size += MAX_THRESH_ATTRS; |
| 604 | tdata->ttarget = tdata->tjmax - ((eax >> 16) & 0x7f) * 1000; | 604 | tdata->tmin = tdata->tjmax - |
| 605 | ((eax & THERM_MASK_THRESHOLD0) >> | ||
| 606 | THERM_SHIFT_THRESHOLD0) * 1000; | ||
| 607 | tdata->ttarget = tdata->tjmax - | ||
| 608 | ((eax & THERM_MASK_THRESHOLD1) >> | ||
| 609 | THERM_SHIFT_THRESHOLD1) * 1000; | ||
| 605 | } | 610 | } |
| 606 | 611 | ||
| 607 | pdata->core_data[attr_no] = tdata; | 612 | pdata->core_data[attr_no] = tdata; |
diff --git a/drivers/hwmon/i5k_amb.c b/drivers/hwmon/i5k_amb.c index c4c40be0edbf..d22f241b6a67 100644 --- a/drivers/hwmon/i5k_amb.c +++ b/drivers/hwmon/i5k_amb.c | |||
| @@ -114,7 +114,6 @@ struct i5k_amb_data { | |||
| 114 | void __iomem *amb_mmio; | 114 | void __iomem *amb_mmio; |
| 115 | struct i5k_device_attribute *attrs; | 115 | struct i5k_device_attribute *attrs; |
| 116 | unsigned int num_attrs; | 116 | unsigned int num_attrs; |
| 117 | unsigned long chipset_id; | ||
| 118 | }; | 117 | }; |
| 119 | 118 | ||
| 120 | static ssize_t show_name(struct device *dev, struct device_attribute *devattr, | 119 | static ssize_t show_name(struct device *dev, struct device_attribute *devattr, |
| @@ -444,8 +443,6 @@ static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data, | |||
| 444 | goto out; | 443 | goto out; |
| 445 | } | 444 | } |
| 446 | 445 | ||
| 447 | data->chipset_id = devid; | ||
| 448 | |||
| 449 | res = 0; | 446 | res = 0; |
| 450 | out: | 447 | out: |
| 451 | pci_dev_put(pcidev); | 448 | pci_dev_put(pcidev); |
| @@ -478,23 +475,13 @@ out: | |||
| 478 | return res; | 475 | return res; |
| 479 | } | 476 | } |
| 480 | 477 | ||
| 481 | static unsigned long i5k_channel_pci_id(struct i5k_amb_data *data, | 478 | static struct { |
| 482 | unsigned long channel) | 479 | unsigned long err; |
| 483 | { | 480 | unsigned long fbd0; |
| 484 | switch (data->chipset_id) { | 481 | } chipset_ids[] __devinitdata = { |
| 485 | case PCI_DEVICE_ID_INTEL_5000_ERR: | 482 | { PCI_DEVICE_ID_INTEL_5000_ERR, PCI_DEVICE_ID_INTEL_5000_FBD0 }, |
| 486 | return PCI_DEVICE_ID_INTEL_5000_FBD0 + channel; | 483 | { PCI_DEVICE_ID_INTEL_5400_ERR, PCI_DEVICE_ID_INTEL_5400_FBD0 }, |
| 487 | case PCI_DEVICE_ID_INTEL_5400_ERR: | 484 | { 0, 0 } |
| 488 | return PCI_DEVICE_ID_INTEL_5400_FBD0 + channel; | ||
| 489 | default: | ||
| 490 | BUG(); | ||
| 491 | } | ||
| 492 | } | ||
| 493 | |||
| 494 | static unsigned long chipset_ids[] = { | ||
| 495 | PCI_DEVICE_ID_INTEL_5000_ERR, | ||
| 496 | PCI_DEVICE_ID_INTEL_5400_ERR, | ||
| 497 | 0 | ||
| 498 | }; | 485 | }; |
| 499 | 486 | ||
| 500 | #ifdef MODULE | 487 | #ifdef MODULE |
| @@ -510,8 +497,7 @@ static int __devinit i5k_amb_probe(struct platform_device *pdev) | |||
| 510 | { | 497 | { |
| 511 | struct i5k_amb_data *data; | 498 | struct i5k_amb_data *data; |
| 512 | struct resource *reso; | 499 | struct resource *reso; |
| 513 | int i; | 500 | int i, res; |
| 514 | int res = -ENODEV; | ||
| 515 | 501 | ||
| 516 | data = kzalloc(sizeof(*data), GFP_KERNEL); | 502 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
| 517 | if (!data) | 503 | if (!data) |
| @@ -520,22 +506,22 @@ static int __devinit i5k_amb_probe(struct platform_device *pdev) | |||
| 520 | /* Figure out where the AMB registers live */ | 506 | /* Figure out where the AMB registers live */ |
| 521 | i = 0; | 507 | i = 0; |
| 522 | do { | 508 | do { |
| 523 | res = i5k_find_amb_registers(data, chipset_ids[i]); | 509 | res = i5k_find_amb_registers(data, chipset_ids[i].err); |
| 510 | if (res == 0) | ||
| 511 | break; | ||
| 524 | i++; | 512 | i++; |
| 525 | } while (res && chipset_ids[i]); | 513 | } while (chipset_ids[i].err); |
| 526 | 514 | ||
| 527 | if (res) | 515 | if (res) |
| 528 | goto err; | 516 | goto err; |
| 529 | 517 | ||
| 530 | /* Copy the DIMM presence map for the first two channels */ | 518 | /* Copy the DIMM presence map for the first two channels */ |
| 531 | res = i5k_channel_probe(&data->amb_present[0], | 519 | res = i5k_channel_probe(&data->amb_present[0], chipset_ids[i].fbd0); |
| 532 | i5k_channel_pci_id(data, 0)); | ||
| 533 | if (res) | 520 | if (res) |
| 534 | goto err; | 521 | goto err; |
| 535 | 522 | ||
| 536 | /* Copy the DIMM presence map for the optional second two channels */ | 523 | /* Copy the DIMM presence map for the optional second two channels */ |
| 537 | i5k_channel_probe(&data->amb_present[2], | 524 | i5k_channel_probe(&data->amb_present[2], chipset_ids[i].fbd0 + 1); |
| 538 | i5k_channel_pci_id(data, 1)); | ||
| 539 | 525 | ||
| 540 | /* Set up resource regions */ | 526 | /* Set up resource regions */ |
| 541 | reso = request_mem_region(data->amb_base, data->amb_len, DRVNAME); | 527 | reso = request_mem_region(data->amb_base, data->amb_len, DRVNAME); |
diff --git a/drivers/hwmon/max16065.c b/drivers/hwmon/max16065.c index d94a24fdf4ba..dd2d7b9620c2 100644 --- a/drivers/hwmon/max16065.c +++ b/drivers/hwmon/max16065.c | |||
| @@ -124,7 +124,7 @@ static inline int MV_TO_LIMIT(int mv, int range) | |||
| 124 | 124 | ||
| 125 | static inline int ADC_TO_CURR(int adc, int gain) | 125 | static inline int ADC_TO_CURR(int adc, int gain) |
| 126 | { | 126 | { |
| 127 | return adc * 1400000 / gain * 255; | 127 | return adc * 1400000 / (gain * 255); |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | /* | 130 | /* |
diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c index d7926f4336b5..eab11615dced 100644 --- a/drivers/hwmon/ntc_thermistor.c +++ b/drivers/hwmon/ntc_thermistor.c | |||
| @@ -211,8 +211,7 @@ static int lookup_comp(struct ntc_data *data, | |||
| 211 | if (data->comp[mid].ohm <= ohm) { | 211 | if (data->comp[mid].ohm <= ohm) { |
| 212 | *i_low = mid; | 212 | *i_low = mid; |
| 213 | *i_high = mid - 1; | 213 | *i_high = mid - 1; |
| 214 | } | 214 | } else { |
| 215 | if (data->comp[mid].ohm > ohm) { | ||
| 216 | *i_low = mid + 1; | 215 | *i_low = mid + 1; |
| 217 | *i_high = mid; | 216 | *i_high = mid; |
| 218 | } | 217 | } |
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index a561c3a0e916..397fc59b5682 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c | |||
| @@ -978,6 +978,8 @@ static void pmbus_find_max_attr(struct i2c_client *client, | |||
| 978 | struct pmbus_limit_attr { | 978 | struct pmbus_limit_attr { |
| 979 | u16 reg; /* Limit register */ | 979 | u16 reg; /* Limit register */ |
| 980 | bool update; /* True if register needs updates */ | 980 | bool update; /* True if register needs updates */ |
| 981 | bool low; /* True if low limit; for limits with compare | ||
| 982 | functions only */ | ||
| 981 | const char *attr; /* Attribute name */ | 983 | const char *attr; /* Attribute name */ |
| 982 | const char *alarm; /* Alarm attribute name */ | 984 | const char *alarm; /* Alarm attribute name */ |
| 983 | u32 sbit; /* Alarm attribute status bit */ | 985 | u32 sbit; /* Alarm attribute status bit */ |
| @@ -1029,7 +1031,8 @@ static bool pmbus_add_limit_attrs(struct i2c_client *client, | |||
| 1029 | if (attr->compare) { | 1031 | if (attr->compare) { |
| 1030 | pmbus_add_boolean_cmp(data, name, | 1032 | pmbus_add_boolean_cmp(data, name, |
| 1031 | l->alarm, index, | 1033 | l->alarm, index, |
| 1032 | cbase, cindex, | 1034 | l->low ? cindex : cbase, |
| 1035 | l->low ? cbase : cindex, | ||
| 1033 | attr->sbase + page, l->sbit); | 1036 | attr->sbase + page, l->sbit); |
| 1034 | } else { | 1037 | } else { |
| 1035 | pmbus_add_boolean_reg(data, name, | 1038 | pmbus_add_boolean_reg(data, name, |
| @@ -1366,11 +1369,13 @@ static const struct pmbus_sensor_attr power_attributes[] = { | |||
| 1366 | static const struct pmbus_limit_attr temp_limit_attrs[] = { | 1369 | static const struct pmbus_limit_attr temp_limit_attrs[] = { |
| 1367 | { | 1370 | { |
| 1368 | .reg = PMBUS_UT_WARN_LIMIT, | 1371 | .reg = PMBUS_UT_WARN_LIMIT, |
| 1372 | .low = true, | ||
| 1369 | .attr = "min", | 1373 | .attr = "min", |
| 1370 | .alarm = "min_alarm", | 1374 | .alarm = "min_alarm", |
| 1371 | .sbit = PB_TEMP_UT_WARNING, | 1375 | .sbit = PB_TEMP_UT_WARNING, |
| 1372 | }, { | 1376 | }, { |
| 1373 | .reg = PMBUS_UT_FAULT_LIMIT, | 1377 | .reg = PMBUS_UT_FAULT_LIMIT, |
| 1378 | .low = true, | ||
| 1374 | .attr = "lcrit", | 1379 | .attr = "lcrit", |
| 1375 | .alarm = "lcrit_alarm", | 1380 | .alarm = "lcrit_alarm", |
| 1376 | .sbit = PB_TEMP_UT_FAULT, | 1381 | .sbit = PB_TEMP_UT_FAULT, |
| @@ -1399,11 +1404,13 @@ static const struct pmbus_limit_attr temp_limit_attrs[] = { | |||
| 1399 | static const struct pmbus_limit_attr temp_limit_attrs23[] = { | 1404 | static const struct pmbus_limit_attr temp_limit_attrs23[] = { |
| 1400 | { | 1405 | { |
| 1401 | .reg = PMBUS_UT_WARN_LIMIT, | 1406 | .reg = PMBUS_UT_WARN_LIMIT, |
| 1407 | .low = true, | ||
| 1402 | .attr = "min", | 1408 | .attr = "min", |
| 1403 | .alarm = "min_alarm", | 1409 | .alarm = "min_alarm", |
| 1404 | .sbit = PB_TEMP_UT_WARNING, | 1410 | .sbit = PB_TEMP_UT_WARNING, |
| 1405 | }, { | 1411 | }, { |
| 1406 | .reg = PMBUS_UT_FAULT_LIMIT, | 1412 | .reg = PMBUS_UT_FAULT_LIMIT, |
| 1413 | .low = true, | ||
| 1407 | .attr = "lcrit", | 1414 | .attr = "lcrit", |
| 1408 | .alarm = "lcrit_alarm", | 1415 | .alarm = "lcrit_alarm", |
| 1409 | .sbit = PB_TEMP_UT_FAULT, | 1416 | .sbit = PB_TEMP_UT_FAULT, |
diff --git a/drivers/hwmon/pmbus/ucd9000.c b/drivers/hwmon/pmbus/ucd9000.c index ace1c7319734..d0ddb60155c9 100644 --- a/drivers/hwmon/pmbus/ucd9000.c +++ b/drivers/hwmon/pmbus/ucd9000.c | |||
| @@ -141,13 +141,11 @@ static int ucd9000_probe(struct i2c_client *client, | |||
| 141 | block_buffer[ret] = '\0'; | 141 | block_buffer[ret] = '\0'; |
| 142 | dev_info(&client->dev, "Device ID %s\n", block_buffer); | 142 | dev_info(&client->dev, "Device ID %s\n", block_buffer); |
| 143 | 143 | ||
| 144 | mid = NULL; | 144 | for (mid = ucd9000_id; mid->name[0]; mid++) { |
| 145 | for (i = 0; i < ARRAY_SIZE(ucd9000_id); i++) { | ||
| 146 | mid = &ucd9000_id[i]; | ||
| 147 | if (!strncasecmp(mid->name, block_buffer, strlen(mid->name))) | 145 | if (!strncasecmp(mid->name, block_buffer, strlen(mid->name))) |
| 148 | break; | 146 | break; |
| 149 | } | 147 | } |
| 150 | if (!mid || !strlen(mid->name)) { | 148 | if (!mid->name[0]) { |
| 151 | dev_err(&client->dev, "Unsupported device\n"); | 149 | dev_err(&client->dev, "Unsupported device\n"); |
| 152 | return -ENODEV; | 150 | return -ENODEV; |
| 153 | } | 151 | } |
diff --git a/drivers/hwmon/pmbus/ucd9200.c b/drivers/hwmon/pmbus/ucd9200.c index ffcc1cf3609d..c65e9da707cc 100644 --- a/drivers/hwmon/pmbus/ucd9200.c +++ b/drivers/hwmon/pmbus/ucd9200.c | |||
| @@ -68,13 +68,11 @@ static int ucd9200_probe(struct i2c_client *client, | |||
| 68 | block_buffer[ret] = '\0'; | 68 | block_buffer[ret] = '\0'; |
| 69 | dev_info(&client->dev, "Device ID %s\n", block_buffer); | 69 | dev_info(&client->dev, "Device ID %s\n", block_buffer); |
| 70 | 70 | ||
| 71 | mid = NULL; | 71 | for (mid = ucd9200_id; mid->name[0]; mid++) { |
| 72 | for (i = 0; i < ARRAY_SIZE(ucd9200_id); i++) { | ||
| 73 | mid = &ucd9200_id[i]; | ||
| 74 | if (!strncasecmp(mid->name, block_buffer, strlen(mid->name))) | 72 | if (!strncasecmp(mid->name, block_buffer, strlen(mid->name))) |
| 75 | break; | 73 | break; |
| 76 | } | 74 | } |
| 77 | if (!mid || !strlen(mid->name)) { | 75 | if (!mid->name[0]) { |
| 78 | dev_err(&client->dev, "Unsupported device\n"); | 76 | dev_err(&client->dev, "Unsupported device\n"); |
| 79 | return -ENODEV; | 77 | return -ENODEV; |
| 80 | } | 78 | } |
diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c index 0c731ca69f15..b228e09c5d05 100644 --- a/drivers/i2c/busses/i2c-nomadik.c +++ b/drivers/i2c/busses/i2c-nomadik.c | |||
| @@ -146,6 +146,7 @@ struct i2c_nmk_client { | |||
| 146 | * @stop: stop condition | 146 | * @stop: stop condition |
| 147 | * @xfer_complete: acknowledge completion for a I2C message | 147 | * @xfer_complete: acknowledge completion for a I2C message |
| 148 | * @result: controller propogated result | 148 | * @result: controller propogated result |
| 149 | * @regulator: pointer to i2c regulator | ||
| 149 | * @busy: Busy doing transfer | 150 | * @busy: Busy doing transfer |
| 150 | */ | 151 | */ |
| 151 | struct nmk_i2c_dev { | 152 | struct nmk_i2c_dev { |
| @@ -417,12 +418,12 @@ static int read_i2c(struct nmk_i2c_dev *dev) | |||
| 417 | writel(readl(dev->virtbase + I2C_IMSCR) | irq_mask, | 418 | writel(readl(dev->virtbase + I2C_IMSCR) | irq_mask, |
| 418 | dev->virtbase + I2C_IMSCR); | 419 | dev->virtbase + I2C_IMSCR); |
| 419 | 420 | ||
| 420 | timeout = wait_for_completion_interruptible_timeout( | 421 | timeout = wait_for_completion_timeout( |
| 421 | &dev->xfer_complete, dev->adap.timeout); | 422 | &dev->xfer_complete, dev->adap.timeout); |
| 422 | 423 | ||
| 423 | if (timeout < 0) { | 424 | if (timeout < 0) { |
| 424 | dev_err(&dev->pdev->dev, | 425 | dev_err(&dev->pdev->dev, |
| 425 | "wait_for_completion_interruptible_timeout" | 426 | "wait_for_completion_timeout" |
| 426 | "returned %d waiting for event\n", timeout); | 427 | "returned %d waiting for event\n", timeout); |
| 427 | status = timeout; | 428 | status = timeout; |
| 428 | } | 429 | } |
| @@ -504,12 +505,12 @@ static int write_i2c(struct nmk_i2c_dev *dev) | |||
| 504 | writel(readl(dev->virtbase + I2C_IMSCR) | irq_mask, | 505 | writel(readl(dev->virtbase + I2C_IMSCR) | irq_mask, |
| 505 | dev->virtbase + I2C_IMSCR); | 506 | dev->virtbase + I2C_IMSCR); |
| 506 | 507 | ||
| 507 | timeout = wait_for_completion_interruptible_timeout( | 508 | timeout = wait_for_completion_timeout( |
| 508 | &dev->xfer_complete, dev->adap.timeout); | 509 | &dev->xfer_complete, dev->adap.timeout); |
| 509 | 510 | ||
| 510 | if (timeout < 0) { | 511 | if (timeout < 0) { |
| 511 | dev_err(&dev->pdev->dev, | 512 | dev_err(&dev->pdev->dev, |
| 512 | "wait_for_completion_interruptible_timeout" | 513 | "wait_for_completion_timeout " |
| 513 | "returned %d waiting for event\n", timeout); | 514 | "returned %d waiting for event\n", timeout); |
| 514 | status = timeout; | 515 | status = timeout; |
| 515 | } | 516 | } |
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 1a766cf74f6b..2dfb63176856 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c | |||
| @@ -1139,41 +1139,12 @@ omap_i2c_remove(struct platform_device *pdev) | |||
| 1139 | return 0; | 1139 | return 0; |
| 1140 | } | 1140 | } |
| 1141 | 1141 | ||
| 1142 | #ifdef CONFIG_SUSPEND | ||
| 1143 | static int omap_i2c_suspend(struct device *dev) | ||
| 1144 | { | ||
| 1145 | if (!pm_runtime_suspended(dev)) | ||
| 1146 | if (dev->bus && dev->bus->pm && dev->bus->pm->runtime_suspend) | ||
| 1147 | dev->bus->pm->runtime_suspend(dev); | ||
| 1148 | |||
| 1149 | return 0; | ||
| 1150 | } | ||
| 1151 | |||
| 1152 | static int omap_i2c_resume(struct device *dev) | ||
| 1153 | { | ||
| 1154 | if (!pm_runtime_suspended(dev)) | ||
| 1155 | if (dev->bus && dev->bus->pm && dev->bus->pm->runtime_resume) | ||
| 1156 | dev->bus->pm->runtime_resume(dev); | ||
| 1157 | |||
| 1158 | return 0; | ||
| 1159 | } | ||
| 1160 | |||
| 1161 | static struct dev_pm_ops omap_i2c_pm_ops = { | ||
| 1162 | .suspend = omap_i2c_suspend, | ||
| 1163 | .resume = omap_i2c_resume, | ||
| 1164 | }; | ||
| 1165 | #define OMAP_I2C_PM_OPS (&omap_i2c_pm_ops) | ||
| 1166 | #else | ||
| 1167 | #define OMAP_I2C_PM_OPS NULL | ||
| 1168 | #endif | ||
| 1169 | |||
| 1170 | static struct platform_driver omap_i2c_driver = { | 1142 | static struct platform_driver omap_i2c_driver = { |
| 1171 | .probe = omap_i2c_probe, | 1143 | .probe = omap_i2c_probe, |
| 1172 | .remove = omap_i2c_remove, | 1144 | .remove = omap_i2c_remove, |
| 1173 | .driver = { | 1145 | .driver = { |
| 1174 | .name = "omap_i2c", | 1146 | .name = "omap_i2c", |
| 1175 | .owner = THIS_MODULE, | 1147 | .owner = THIS_MODULE, |
| 1176 | .pm = OMAP_I2C_PM_OPS, | ||
| 1177 | }, | 1148 | }, |
| 1178 | }; | 1149 | }; |
| 1179 | 1150 | ||
diff --git a/drivers/i2c/busses/i2c-pxa-pci.c b/drivers/i2c/busses/i2c-pxa-pci.c index 6659d269b841..b73da6cd6f91 100644 --- a/drivers/i2c/busses/i2c-pxa-pci.c +++ b/drivers/i2c/busses/i2c-pxa-pci.c | |||
| @@ -109,12 +109,15 @@ static int __devinit ce4100_i2c_probe(struct pci_dev *dev, | |||
| 109 | return -EINVAL; | 109 | return -EINVAL; |
| 110 | } | 110 | } |
| 111 | sds = kzalloc(sizeof(*sds), GFP_KERNEL); | 111 | sds = kzalloc(sizeof(*sds), GFP_KERNEL); |
| 112 | if (!sds) | 112 | if (!sds) { |
| 113 | ret = -ENOMEM; | ||
| 113 | goto err_mem; | 114 | goto err_mem; |
| 115 | } | ||
| 114 | 116 | ||
| 115 | for (i = 0; i < ARRAY_SIZE(sds->pdev); i++) { | 117 | for (i = 0; i < ARRAY_SIZE(sds->pdev); i++) { |
| 116 | sds->pdev[i] = add_i2c_device(dev, i); | 118 | sds->pdev[i] = add_i2c_device(dev, i); |
| 117 | if (IS_ERR(sds->pdev[i])) { | 119 | if (IS_ERR(sds->pdev[i])) { |
| 120 | ret = PTR_ERR(sds->pdev[i]); | ||
| 118 | while (--i >= 0) | 121 | while (--i >= 0) |
| 119 | platform_device_unregister(sds->pdev[i]); | 122 | platform_device_unregister(sds->pdev[i]); |
| 120 | goto err_dev_add; | 123 | goto err_dev_add; |
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 2440b7411978..3c94c4a81a55 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c | |||
| @@ -270,14 +270,30 @@ static int tegra_i2c_fill_tx_fifo(struct tegra_i2c_dev *i2c_dev) | |||
| 270 | 270 | ||
| 271 | /* Rounds down to not include partial word at the end of buf */ | 271 | /* Rounds down to not include partial word at the end of buf */ |
| 272 | words_to_transfer = buf_remaining / BYTES_PER_FIFO_WORD; | 272 | words_to_transfer = buf_remaining / BYTES_PER_FIFO_WORD; |
| 273 | if (words_to_transfer > tx_fifo_avail) | ||
| 274 | words_to_transfer = tx_fifo_avail; | ||
| 275 | 273 | ||
| 276 | i2c_writesl(i2c_dev, buf, I2C_TX_FIFO, words_to_transfer); | 274 | /* It's very common to have < 4 bytes, so optimize that case. */ |
| 277 | 275 | if (words_to_transfer) { | |
| 278 | buf += words_to_transfer * BYTES_PER_FIFO_WORD; | 276 | if (words_to_transfer > tx_fifo_avail) |
| 279 | buf_remaining -= words_to_transfer * BYTES_PER_FIFO_WORD; | 277 | words_to_transfer = tx_fifo_avail; |
| 280 | tx_fifo_avail -= words_to_transfer; | 278 | |
| 279 | /* | ||
| 280 | * Update state before writing to FIFO. If this casues us | ||
| 281 | * to finish writing all bytes (AKA buf_remaining goes to 0) we | ||
| 282 | * have a potential for an interrupt (PACKET_XFER_COMPLETE is | ||
| 283 | * not maskable). We need to make sure that the isr sees | ||
| 284 | * buf_remaining as 0 and doesn't call us back re-entrantly. | ||
| 285 | */ | ||
| 286 | buf_remaining -= words_to_transfer * BYTES_PER_FIFO_WORD; | ||
| 287 | tx_fifo_avail -= words_to_transfer; | ||
| 288 | i2c_dev->msg_buf_remaining = buf_remaining; | ||
| 289 | i2c_dev->msg_buf = buf + | ||
| 290 | words_to_transfer * BYTES_PER_FIFO_WORD; | ||
| 291 | barrier(); | ||
| 292 | |||
| 293 | i2c_writesl(i2c_dev, buf, I2C_TX_FIFO, words_to_transfer); | ||
| 294 | |||
| 295 | buf += words_to_transfer * BYTES_PER_FIFO_WORD; | ||
| 296 | } | ||
| 281 | 297 | ||
| 282 | /* | 298 | /* |
| 283 | * If there is a partial word at the end of buf, handle it manually to | 299 | * If there is a partial word at the end of buf, handle it manually to |
| @@ -287,14 +303,15 @@ static int tegra_i2c_fill_tx_fifo(struct tegra_i2c_dev *i2c_dev) | |||
| 287 | if (tx_fifo_avail > 0 && buf_remaining > 0) { | 303 | if (tx_fifo_avail > 0 && buf_remaining > 0) { |
| 288 | BUG_ON(buf_remaining > 3); | 304 | BUG_ON(buf_remaining > 3); |
| 289 | memcpy(&val, buf, buf_remaining); | 305 | memcpy(&val, buf, buf_remaining); |
| 306 | |||
| 307 | /* Again update before writing to FIFO to make sure isr sees. */ | ||
| 308 | i2c_dev->msg_buf_remaining = 0; | ||
| 309 | i2c_dev->msg_buf = NULL; | ||
| 310 | barrier(); | ||
| 311 | |||
| 290 | i2c_writel(i2c_dev, val, I2C_TX_FIFO); | 312 | i2c_writel(i2c_dev, val, I2C_TX_FIFO); |
| 291 | buf_remaining = 0; | ||
| 292 | tx_fifo_avail--; | ||
| 293 | } | 313 | } |
| 294 | 314 | ||
| 295 | BUG_ON(tx_fifo_avail > 0 && buf_remaining > 0); | ||
| 296 | i2c_dev->msg_buf_remaining = buf_remaining; | ||
| 297 | i2c_dev->msg_buf = buf; | ||
| 298 | return 0; | 315 | return 0; |
| 299 | } | 316 | } |
| 300 | 317 | ||
| @@ -411,9 +428,10 @@ static irqreturn_t tegra_i2c_isr(int irq, void *dev_id) | |||
| 411 | tegra_i2c_mask_irq(i2c_dev, I2C_INT_TX_FIFO_DATA_REQ); | 428 | tegra_i2c_mask_irq(i2c_dev, I2C_INT_TX_FIFO_DATA_REQ); |
| 412 | } | 429 | } |
| 413 | 430 | ||
| 414 | if ((status & I2C_INT_PACKET_XFER_COMPLETE) && | 431 | if (status & I2C_INT_PACKET_XFER_COMPLETE) { |
| 415 | !i2c_dev->msg_buf_remaining) | 432 | BUG_ON(i2c_dev->msg_buf_remaining); |
| 416 | complete(&i2c_dev->msg_complete); | 433 | complete(&i2c_dev->msg_complete); |
| 434 | } | ||
| 417 | 435 | ||
| 418 | i2c_writel(i2c_dev, status, I2C_INT_STATUS); | 436 | i2c_writel(i2c_dev, status, I2C_INT_STATUS); |
| 419 | if (i2c_dev->is_dvc) | 437 | if (i2c_dev->is_dvc) |
| @@ -531,7 +549,7 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], | |||
| 531 | 549 | ||
| 532 | static u32 tegra_i2c_func(struct i2c_adapter *adap) | 550 | static u32 tegra_i2c_func(struct i2c_adapter *adap) |
| 533 | { | 551 | { |
| 534 | return I2C_FUNC_I2C; | 552 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; |
| 535 | } | 553 | } |
| 536 | 554 | ||
| 537 | static const struct i2c_algorithm tegra_i2c_algo = { | 555 | static const struct i2c_algorithm tegra_i2c_algo = { |
| @@ -719,6 +737,17 @@ static int tegra_i2c_resume(struct platform_device *pdev) | |||
| 719 | } | 737 | } |
| 720 | #endif | 738 | #endif |
| 721 | 739 | ||
| 740 | #if defined(CONFIG_OF) | ||
| 741 | /* Match table for of_platform binding */ | ||
| 742 | static const struct of_device_id tegra_i2c_of_match[] __devinitconst = { | ||
| 743 | { .compatible = "nvidia,tegra20-i2c", }, | ||
| 744 | {}, | ||
| 745 | }; | ||
| 746 | MODULE_DEVICE_TABLE(of, tegra_i2c_of_match); | ||
| 747 | #else | ||
| 748 | #define tegra_i2c_of_match NULL | ||
| 749 | #endif | ||
| 750 | |||
| 722 | static struct platform_driver tegra_i2c_driver = { | 751 | static struct platform_driver tegra_i2c_driver = { |
| 723 | .probe = tegra_i2c_probe, | 752 | .probe = tegra_i2c_probe, |
| 724 | .remove = tegra_i2c_remove, | 753 | .remove = tegra_i2c_remove, |
| @@ -729,6 +758,7 @@ static struct platform_driver tegra_i2c_driver = { | |||
| 729 | .driver = { | 758 | .driver = { |
| 730 | .name = "tegra-i2c", | 759 | .name = "tegra-i2c", |
| 731 | .owner = THIS_MODULE, | 760 | .owner = THIS_MODULE, |
| 761 | .of_match_table = tegra_i2c_of_match, | ||
| 732 | }, | 762 | }, |
| 733 | }; | 763 | }; |
| 734 | 764 | ||
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index a14f8dc23462..0e4227f457af 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c | |||
| @@ -605,7 +605,9 @@ static void build_inv_all(struct iommu_cmd *cmd) | |||
| 605 | * Writes the command to the IOMMUs command buffer and informs the | 605 | * Writes the command to the IOMMUs command buffer and informs the |
| 606 | * hardware about the new command. | 606 | * hardware about the new command. |
| 607 | */ | 607 | */ |
| 608 | static int iommu_queue_command(struct amd_iommu *iommu, struct iommu_cmd *cmd) | 608 | static int iommu_queue_command_sync(struct amd_iommu *iommu, |
| 609 | struct iommu_cmd *cmd, | ||
| 610 | bool sync) | ||
| 609 | { | 611 | { |
| 610 | u32 left, tail, head, next_tail; | 612 | u32 left, tail, head, next_tail; |
| 611 | unsigned long flags; | 613 | unsigned long flags; |
| @@ -639,13 +641,18 @@ again: | |||
| 639 | copy_cmd_to_buffer(iommu, cmd, tail); | 641 | copy_cmd_to_buffer(iommu, cmd, tail); |
| 640 | 642 | ||
| 641 | /* We need to sync now to make sure all commands are processed */ | 643 | /* We need to sync now to make sure all commands are processed */ |
| 642 | iommu->need_sync = true; | 644 | iommu->need_sync = sync; |
| 643 | 645 | ||
| 644 | spin_unlock_irqrestore(&iommu->lock, flags); | 646 | spin_unlock_irqrestore(&iommu->lock, flags); |
| 645 | 647 | ||
| 646 | return 0; | 648 | return 0; |
| 647 | } | 649 | } |
| 648 | 650 | ||
| 651 | static int iommu_queue_command(struct amd_iommu *iommu, struct iommu_cmd *cmd) | ||
| 652 | { | ||
| 653 | return iommu_queue_command_sync(iommu, cmd, true); | ||
| 654 | } | ||
| 655 | |||
| 649 | /* | 656 | /* |
| 650 | * This function queues a completion wait command into the command | 657 | * This function queues a completion wait command into the command |
| 651 | * buffer of an IOMMU | 658 | * buffer of an IOMMU |
| @@ -661,7 +668,7 @@ static int iommu_completion_wait(struct amd_iommu *iommu) | |||
| 661 | 668 | ||
| 662 | build_completion_wait(&cmd, (u64)&sem); | 669 | build_completion_wait(&cmd, (u64)&sem); |
| 663 | 670 | ||
| 664 | ret = iommu_queue_command(iommu, &cmd); | 671 | ret = iommu_queue_command_sync(iommu, &cmd, false); |
| 665 | if (ret) | 672 | if (ret) |
| 666 | return ret; | 673 | return ret; |
| 667 | 674 | ||
| @@ -840,14 +847,9 @@ static void domain_flush_complete(struct protection_domain *domain) | |||
| 840 | static void domain_flush_devices(struct protection_domain *domain) | 847 | static void domain_flush_devices(struct protection_domain *domain) |
| 841 | { | 848 | { |
| 842 | struct iommu_dev_data *dev_data; | 849 | struct iommu_dev_data *dev_data; |
| 843 | unsigned long flags; | ||
| 844 | |||
| 845 | spin_lock_irqsave(&domain->lock, flags); | ||
| 846 | 850 | ||
| 847 | list_for_each_entry(dev_data, &domain->dev_list, list) | 851 | list_for_each_entry(dev_data, &domain->dev_list, list) |
| 848 | device_flush_dte(dev_data); | 852 | device_flush_dte(dev_data); |
| 849 | |||
| 850 | spin_unlock_irqrestore(&domain->lock, flags); | ||
| 851 | } | 853 | } |
| 852 | 854 | ||
| 853 | /**************************************************************************** | 855 | /**************************************************************************** |
diff --git a/drivers/leds/leds-ams-delta.c b/drivers/leds/leds-ams-delta.c index b9826032450b..8c00937bf7e7 100644 --- a/drivers/leds/leds-ams-delta.c +++ b/drivers/leds/leds-ams-delta.c | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | #include <linux/module.h> | ||
| 11 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
| 12 | #include <linux/init.h> | 13 | #include <linux/init.h> |
| 13 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
diff --git a/drivers/leds/leds-bd2802.c b/drivers/leds/leds-bd2802.c index 3ebe3824662d..ea2185531f82 100644 --- a/drivers/leds/leds-bd2802.c +++ b/drivers/leds/leds-bd2802.c | |||
| @@ -662,6 +662,11 @@ failed_unregister_led1_R: | |||
| 662 | static void bd2802_unregister_led_classdev(struct bd2802_led *led) | 662 | static void bd2802_unregister_led_classdev(struct bd2802_led *led) |
| 663 | { | 663 | { |
| 664 | cancel_work_sync(&led->work); | 664 | cancel_work_sync(&led->work); |
| 665 | led_classdev_unregister(&led->cdev_led2b); | ||
| 666 | led_classdev_unregister(&led->cdev_led2g); | ||
| 667 | led_classdev_unregister(&led->cdev_led2r); | ||
| 668 | led_classdev_unregister(&led->cdev_led1b); | ||
| 669 | led_classdev_unregister(&led->cdev_led1g); | ||
| 665 | led_classdev_unregister(&led->cdev_led1r); | 670 | led_classdev_unregister(&led->cdev_led1r); |
| 666 | } | 671 | } |
| 667 | 672 | ||
diff --git a/drivers/leds/leds-hp6xx.c b/drivers/leds/leds-hp6xx.c index e4ce1fd46338..bcfbd3a60eab 100644 --- a/drivers/leds/leds-hp6xx.c +++ b/drivers/leds/leds-hp6xx.c | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | * published by the Free Software Foundation. | 10 | * published by the Free Software Foundation. |
| 11 | */ | 11 | */ |
| 12 | 12 | ||
| 13 | #include <linux/module.h> | ||
| 13 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
| 14 | #include <linux/init.h> | 15 | #include <linux/init.h> |
| 15 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
diff --git a/drivers/leds/ledtrig-timer.c b/drivers/leds/ledtrig-timer.c index d87c9d02f786..328c64c0841c 100644 --- a/drivers/leds/ledtrig-timer.c +++ b/drivers/leds/ledtrig-timer.c | |||
| @@ -41,6 +41,7 @@ static ssize_t led_delay_on_store(struct device *dev, | |||
| 41 | 41 | ||
| 42 | if (count == size) { | 42 | if (count == size) { |
| 43 | led_blink_set(led_cdev, &state, &led_cdev->blink_delay_off); | 43 | led_blink_set(led_cdev, &state, &led_cdev->blink_delay_off); |
| 44 | led_cdev->blink_delay_on = state; | ||
| 44 | ret = count; | 45 | ret = count; |
| 45 | } | 46 | } |
| 46 | 47 | ||
| @@ -69,6 +70,7 @@ static ssize_t led_delay_off_store(struct device *dev, | |||
| 69 | 70 | ||
| 70 | if (count == size) { | 71 | if (count == size) { |
| 71 | led_blink_set(led_cdev, &led_cdev->blink_delay_on, &state); | 72 | led_blink_set(led_cdev, &led_cdev->blink_delay_on, &state); |
| 73 | led_cdev->blink_delay_off = state; | ||
| 72 | ret = count; | 74 | ret = count; |
| 73 | } | 75 | } |
| 74 | 76 | ||
diff --git a/drivers/md/linear.h b/drivers/md/linear.h index 0ce29b61605a..2f2da05b2ce9 100644 --- a/drivers/md/linear.h +++ b/drivers/md/linear.h | |||
| @@ -10,9 +10,9 @@ typedef struct dev_info dev_info_t; | |||
| 10 | 10 | ||
| 11 | struct linear_private_data | 11 | struct linear_private_data |
| 12 | { | 12 | { |
| 13 | struct rcu_head rcu; | ||
| 13 | sector_t array_sectors; | 14 | sector_t array_sectors; |
| 14 | dev_info_t disks[0]; | 15 | dev_info_t disks[0]; |
| 15 | struct rcu_head rcu; | ||
| 16 | }; | 16 | }; |
| 17 | 17 | ||
| 18 | 18 | ||
diff --git a/drivers/md/md.c b/drivers/md/md.c index 8e221a20f5d9..5404b2295820 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
| @@ -848,7 +848,7 @@ void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev, | |||
| 848 | bio->bi_end_io = super_written; | 848 | bio->bi_end_io = super_written; |
| 849 | 849 | ||
| 850 | atomic_inc(&mddev->pending_writes); | 850 | atomic_inc(&mddev->pending_writes); |
| 851 | submit_bio(REQ_WRITE | REQ_SYNC | REQ_FLUSH | REQ_FUA, bio); | 851 | submit_bio(WRITE_FLUSH_FUA, bio); |
| 852 | } | 852 | } |
| 853 | 853 | ||
| 854 | void md_super_wait(mddev_t *mddev) | 854 | void md_super_wait(mddev_t *mddev) |
| @@ -1138,8 +1138,11 @@ static int super_90_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version | |||
| 1138 | ret = 0; | 1138 | ret = 0; |
| 1139 | } | 1139 | } |
| 1140 | rdev->sectors = rdev->sb_start; | 1140 | rdev->sectors = rdev->sb_start; |
| 1141 | /* Limit to 4TB as metadata cannot record more than that */ | ||
| 1142 | if (rdev->sectors >= (2ULL << 32)) | ||
| 1143 | rdev->sectors = (2ULL << 32) - 2; | ||
| 1141 | 1144 | ||
| 1142 | if (rdev->sectors < sb->size * 2 && sb->level > 1) | 1145 | if (rdev->sectors < ((sector_t)sb->size) * 2 && sb->level >= 1) |
| 1143 | /* "this cannot possibly happen" ... */ | 1146 | /* "this cannot possibly happen" ... */ |
| 1144 | ret = -EINVAL; | 1147 | ret = -EINVAL; |
| 1145 | 1148 | ||
| @@ -1173,7 +1176,7 @@ static int super_90_validate(mddev_t *mddev, mdk_rdev_t *rdev) | |||
| 1173 | mddev->clevel[0] = 0; | 1176 | mddev->clevel[0] = 0; |
| 1174 | mddev->layout = sb->layout; | 1177 | mddev->layout = sb->layout; |
| 1175 | mddev->raid_disks = sb->raid_disks; | 1178 | mddev->raid_disks = sb->raid_disks; |
| 1176 | mddev->dev_sectors = sb->size * 2; | 1179 | mddev->dev_sectors = ((sector_t)sb->size) * 2; |
| 1177 | mddev->events = ev1; | 1180 | mddev->events = ev1; |
| 1178 | mddev->bitmap_info.offset = 0; | 1181 | mddev->bitmap_info.offset = 0; |
| 1179 | mddev->bitmap_info.default_offset = MD_SB_BYTES >> 9; | 1182 | mddev->bitmap_info.default_offset = MD_SB_BYTES >> 9; |
| @@ -1415,6 +1418,11 @@ super_90_rdev_size_change(mdk_rdev_t *rdev, sector_t num_sectors) | |||
| 1415 | rdev->sb_start = calc_dev_sboffset(rdev); | 1418 | rdev->sb_start = calc_dev_sboffset(rdev); |
| 1416 | if (!num_sectors || num_sectors > rdev->sb_start) | 1419 | if (!num_sectors || num_sectors > rdev->sb_start) |
| 1417 | num_sectors = rdev->sb_start; | 1420 | num_sectors = rdev->sb_start; |
| 1421 | /* Limit to 4TB as metadata cannot record more than that. | ||
| 1422 | * 4TB == 2^32 KB, or 2*2^32 sectors. | ||
| 1423 | */ | ||
| 1424 | if (num_sectors >= (2ULL << 32)) | ||
| 1425 | num_sectors = (2ULL << 32) - 2; | ||
| 1418 | md_super_write(rdev->mddev, rdev, rdev->sb_start, rdev->sb_size, | 1426 | md_super_write(rdev->mddev, rdev, rdev->sb_start, rdev->sb_size, |
| 1419 | rdev->sb_page); | 1427 | rdev->sb_page); |
| 1420 | md_super_wait(rdev->mddev); | 1428 | md_super_wait(rdev->mddev); |
| @@ -1738,6 +1746,11 @@ static void super_1_sync(mddev_t *mddev, mdk_rdev_t *rdev) | |||
| 1738 | sb->level = cpu_to_le32(mddev->level); | 1746 | sb->level = cpu_to_le32(mddev->level); |
| 1739 | sb->layout = cpu_to_le32(mddev->layout); | 1747 | sb->layout = cpu_to_le32(mddev->layout); |
| 1740 | 1748 | ||
| 1749 | if (test_bit(WriteMostly, &rdev->flags)) | ||
| 1750 | sb->devflags |= WriteMostly1; | ||
| 1751 | else | ||
| 1752 | sb->devflags &= ~WriteMostly1; | ||
| 1753 | |||
| 1741 | if (mddev->bitmap && mddev->bitmap_info.file == NULL) { | 1754 | if (mddev->bitmap && mddev->bitmap_info.file == NULL) { |
| 1742 | sb->bitmap_offset = cpu_to_le32((__u32)mddev->bitmap_info.offset); | 1755 | sb->bitmap_offset = cpu_to_le32((__u32)mddev->bitmap_info.offset); |
| 1743 | sb->feature_map = cpu_to_le32(MD_FEATURE_BITMAP_OFFSET); | 1756 | sb->feature_map = cpu_to_le32(MD_FEATURE_BITMAP_OFFSET); |
| @@ -2561,7 +2574,10 @@ state_store(mdk_rdev_t *rdev, const char *buf, size_t len) | |||
| 2561 | int err = -EINVAL; | 2574 | int err = -EINVAL; |
| 2562 | if (cmd_match(buf, "faulty") && rdev->mddev->pers) { | 2575 | if (cmd_match(buf, "faulty") && rdev->mddev->pers) { |
| 2563 | md_error(rdev->mddev, rdev); | 2576 | md_error(rdev->mddev, rdev); |
| 2564 | err = 0; | 2577 | if (test_bit(Faulty, &rdev->flags)) |
| 2578 | err = 0; | ||
| 2579 | else | ||
| 2580 | err = -EBUSY; | ||
| 2565 | } else if (cmd_match(buf, "remove")) { | 2581 | } else if (cmd_match(buf, "remove")) { |
| 2566 | if (rdev->raid_disk >= 0) | 2582 | if (rdev->raid_disk >= 0) |
| 2567 | err = -EBUSY; | 2583 | err = -EBUSY; |
| @@ -2584,7 +2600,7 @@ state_store(mdk_rdev_t *rdev, const char *buf, size_t len) | |||
| 2584 | err = 0; | 2600 | err = 0; |
| 2585 | } else if (cmd_match(buf, "-blocked")) { | 2601 | } else if (cmd_match(buf, "-blocked")) { |
| 2586 | if (!test_bit(Faulty, &rdev->flags) && | 2602 | if (!test_bit(Faulty, &rdev->flags) && |
| 2587 | test_bit(BlockedBadBlocks, &rdev->flags)) { | 2603 | rdev->badblocks.unacked_exist) { |
| 2588 | /* metadata handler doesn't understand badblocks, | 2604 | /* metadata handler doesn't understand badblocks, |
| 2589 | * so we need to fail the device | 2605 | * so we need to fail the device |
| 2590 | */ | 2606 | */ |
| @@ -5983,6 +5999,8 @@ static int set_disk_faulty(mddev_t *mddev, dev_t dev) | |||
| 5983 | return -ENODEV; | 5999 | return -ENODEV; |
| 5984 | 6000 | ||
| 5985 | md_error(mddev, rdev); | 6001 | md_error(mddev, rdev); |
| 6002 | if (!test_bit(Faulty, &rdev->flags)) | ||
| 6003 | return -EBUSY; | ||
| 5986 | return 0; | 6004 | return 0; |
| 5987 | } | 6005 | } |
| 5988 | 6006 | ||
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 32323f0afd89..f4622dd8fc59 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
| @@ -1099,12 +1099,11 @@ read_again: | |||
| 1099 | bio_list_add(&conf->pending_bio_list, mbio); | 1099 | bio_list_add(&conf->pending_bio_list, mbio); |
| 1100 | spin_unlock_irqrestore(&conf->device_lock, flags); | 1100 | spin_unlock_irqrestore(&conf->device_lock, flags); |
| 1101 | } | 1101 | } |
| 1102 | r1_bio_write_done(r1_bio); | 1102 | /* Mustn't call r1_bio_write_done before this next test, |
| 1103 | 1103 | * as it could result in the bio being freed. | |
| 1104 | /* In case raid1d snuck in to freeze_array */ | 1104 | */ |
| 1105 | wake_up(&conf->wait_barrier); | ||
| 1106 | |||
| 1107 | if (sectors_handled < (bio->bi_size >> 9)) { | 1105 | if (sectors_handled < (bio->bi_size >> 9)) { |
| 1106 | r1_bio_write_done(r1_bio); | ||
| 1108 | /* We need another r1_bio. It has already been counted | 1107 | /* We need another r1_bio. It has already been counted |
| 1109 | * in bio->bi_phys_segments | 1108 | * in bio->bi_phys_segments |
| 1110 | */ | 1109 | */ |
| @@ -1117,6 +1116,11 @@ read_again: | |||
| 1117 | goto retry_write; | 1116 | goto retry_write; |
| 1118 | } | 1117 | } |
| 1119 | 1118 | ||
| 1119 | r1_bio_write_done(r1_bio); | ||
| 1120 | |||
| 1121 | /* In case raid1d snuck in to freeze_array */ | ||
| 1122 | wake_up(&conf->wait_barrier); | ||
| 1123 | |||
| 1120 | if (do_sync || !bitmap || !plugged) | 1124 | if (do_sync || !bitmap || !plugged) |
| 1121 | md_wakeup_thread(mddev->thread); | 1125 | md_wakeup_thread(mddev->thread); |
| 1122 | 1126 | ||
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 8b29cd4f01c8..d7a8468ddeab 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
| @@ -337,6 +337,21 @@ static void close_write(r10bio_t *r10_bio) | |||
| 337 | md_write_end(r10_bio->mddev); | 337 | md_write_end(r10_bio->mddev); |
| 338 | } | 338 | } |
| 339 | 339 | ||
| 340 | static void one_write_done(r10bio_t *r10_bio) | ||
| 341 | { | ||
| 342 | if (atomic_dec_and_test(&r10_bio->remaining)) { | ||
| 343 | if (test_bit(R10BIO_WriteError, &r10_bio->state)) | ||
| 344 | reschedule_retry(r10_bio); | ||
| 345 | else { | ||
| 346 | close_write(r10_bio); | ||
| 347 | if (test_bit(R10BIO_MadeGood, &r10_bio->state)) | ||
| 348 | reschedule_retry(r10_bio); | ||
| 349 | else | ||
| 350 | raid_end_bio_io(r10_bio); | ||
| 351 | } | ||
| 352 | } | ||
| 353 | } | ||
| 354 | |||
| 340 | static void raid10_end_write_request(struct bio *bio, int error) | 355 | static void raid10_end_write_request(struct bio *bio, int error) |
| 341 | { | 356 | { |
| 342 | int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); | 357 | int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); |
| @@ -387,17 +402,7 @@ static void raid10_end_write_request(struct bio *bio, int error) | |||
| 387 | * Let's see if all mirrored write operations have finished | 402 | * Let's see if all mirrored write operations have finished |
| 388 | * already. | 403 | * already. |
| 389 | */ | 404 | */ |
| 390 | if (atomic_dec_and_test(&r10_bio->remaining)) { | 405 | one_write_done(r10_bio); |
| 391 | if (test_bit(R10BIO_WriteError, &r10_bio->state)) | ||
| 392 | reschedule_retry(r10_bio); | ||
| 393 | else { | ||
| 394 | close_write(r10_bio); | ||
| 395 | if (test_bit(R10BIO_MadeGood, &r10_bio->state)) | ||
| 396 | reschedule_retry(r10_bio); | ||
| 397 | else | ||
| 398 | raid_end_bio_io(r10_bio); | ||
| 399 | } | ||
| 400 | } | ||
| 401 | if (dec_rdev) | 406 | if (dec_rdev) |
| 402 | rdev_dec_pending(conf->mirrors[dev].rdev, conf->mddev); | 407 | rdev_dec_pending(conf->mirrors[dev].rdev, conf->mddev); |
| 403 | } | 408 | } |
| @@ -1127,20 +1132,12 @@ retry_write: | |||
| 1127 | spin_unlock_irqrestore(&conf->device_lock, flags); | 1132 | spin_unlock_irqrestore(&conf->device_lock, flags); |
| 1128 | } | 1133 | } |
| 1129 | 1134 | ||
| 1130 | if (atomic_dec_and_test(&r10_bio->remaining)) { | 1135 | /* Don't remove the bias on 'remaining' (one_write_done) until |
| 1131 | /* This matches the end of raid10_end_write_request() */ | 1136 | * after checking if we need to go around again. |
| 1132 | bitmap_endwrite(r10_bio->mddev->bitmap, r10_bio->sector, | 1137 | */ |
| 1133 | r10_bio->sectors, | ||
| 1134 | !test_bit(R10BIO_Degraded, &r10_bio->state), | ||
| 1135 | 0); | ||
| 1136 | md_write_end(mddev); | ||
| 1137 | raid_end_bio_io(r10_bio); | ||
| 1138 | } | ||
| 1139 | |||
| 1140 | /* In case raid10d snuck in to freeze_array */ | ||
| 1141 | wake_up(&conf->wait_barrier); | ||
| 1142 | 1138 | ||
| 1143 | if (sectors_handled < (bio->bi_size >> 9)) { | 1139 | if (sectors_handled < (bio->bi_size >> 9)) { |
| 1140 | one_write_done(r10_bio); | ||
| 1144 | /* We need another r10_bio. It has already been counted | 1141 | /* We need another r10_bio. It has already been counted |
| 1145 | * in bio->bi_phys_segments. | 1142 | * in bio->bi_phys_segments. |
| 1146 | */ | 1143 | */ |
| @@ -1154,6 +1151,10 @@ retry_write: | |||
| 1154 | r10_bio->state = 0; | 1151 | r10_bio->state = 0; |
| 1155 | goto retry_write; | 1152 | goto retry_write; |
| 1156 | } | 1153 | } |
| 1154 | one_write_done(r10_bio); | ||
| 1155 | |||
| 1156 | /* In case raid10d snuck in to freeze_array */ | ||
| 1157 | wake_up(&conf->wait_barrier); | ||
| 1157 | 1158 | ||
| 1158 | if (do_sync || !mddev->bitmap || !plugged) | 1159 | if (do_sync || !mddev->bitmap || !plugged) |
| 1159 | md_wakeup_thread(mddev->thread); | 1160 | md_wakeup_thread(mddev->thread); |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index dbae459fb02d..43709fa6b6df 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
| @@ -3336,7 +3336,7 @@ static void handle_stripe(struct stripe_head *sh) | |||
| 3336 | 3336 | ||
| 3337 | finish: | 3337 | finish: |
| 3338 | /* wait for this device to become unblocked */ | 3338 | /* wait for this device to become unblocked */ |
| 3339 | if (unlikely(s.blocked_rdev)) | 3339 | if (conf->mddev->external && unlikely(s.blocked_rdev)) |
| 3340 | md_wait_for_blocked_rdev(s.blocked_rdev, conf->mddev); | 3340 | md_wait_for_blocked_rdev(s.blocked_rdev, conf->mddev); |
| 3341 | 3341 | ||
| 3342 | if (s.handle_bad_blocks) | 3342 | if (s.handle_bad_blocks) |
diff --git a/drivers/media/dvb/dvb-usb/vp7045.c b/drivers/media/dvb/dvb-usb/vp7045.c index 3db89e3cb0bb..536c16c943bd 100644 --- a/drivers/media/dvb/dvb-usb/vp7045.c +++ b/drivers/media/dvb/dvb-usb/vp7045.c | |||
| @@ -224,26 +224,8 @@ static struct dvb_usb_device_properties vp7045_properties; | |||
| 224 | static int vp7045_usb_probe(struct usb_interface *intf, | 224 | static int vp7045_usb_probe(struct usb_interface *intf, |
| 225 | const struct usb_device_id *id) | 225 | const struct usb_device_id *id) |
| 226 | { | 226 | { |
| 227 | struct dvb_usb_device *d; | 227 | return dvb_usb_device_init(intf, &vp7045_properties, |
| 228 | int ret = dvb_usb_device_init(intf, &vp7045_properties, | 228 | THIS_MODULE, NULL, adapter_nr); |
| 229 | THIS_MODULE, &d, adapter_nr); | ||
| 230 | if (ret) | ||
| 231 | return ret; | ||
| 232 | |||
| 233 | d->priv = kmalloc(20, GFP_KERNEL); | ||
| 234 | if (!d->priv) { | ||
| 235 | dvb_usb_device_exit(intf); | ||
| 236 | return -ENOMEM; | ||
| 237 | } | ||
| 238 | |||
| 239 | return ret; | ||
| 240 | } | ||
| 241 | |||
| 242 | static void vp7045_usb_disconnect(struct usb_interface *intf) | ||
| 243 | { | ||
| 244 | struct dvb_usb_device *d = usb_get_intfdata(intf); | ||
| 245 | kfree(d->priv); | ||
| 246 | dvb_usb_device_exit(intf); | ||
| 247 | } | 229 | } |
| 248 | 230 | ||
| 249 | static struct usb_device_id vp7045_usb_table [] = { | 231 | static struct usb_device_id vp7045_usb_table [] = { |
| @@ -258,7 +240,7 @@ MODULE_DEVICE_TABLE(usb, vp7045_usb_table); | |||
| 258 | static struct dvb_usb_device_properties vp7045_properties = { | 240 | static struct dvb_usb_device_properties vp7045_properties = { |
| 259 | .usb_ctrl = CYPRESS_FX2, | 241 | .usb_ctrl = CYPRESS_FX2, |
| 260 | .firmware = "dvb-usb-vp7045-01.fw", | 242 | .firmware = "dvb-usb-vp7045-01.fw", |
| 261 | .size_of_priv = sizeof(u8 *), | 243 | .size_of_priv = 20, |
| 262 | 244 | ||
| 263 | .num_adapters = 1, | 245 | .num_adapters = 1, |
| 264 | .adapter = { | 246 | .adapter = { |
| @@ -305,7 +287,7 @@ static struct dvb_usb_device_properties vp7045_properties = { | |||
| 305 | static struct usb_driver vp7045_usb_driver = { | 287 | static struct usb_driver vp7045_usb_driver = { |
| 306 | .name = "dvb_usb_vp7045", | 288 | .name = "dvb_usb_vp7045", |
| 307 | .probe = vp7045_usb_probe, | 289 | .probe = vp7045_usb_probe, |
| 308 | .disconnect = vp7045_usb_disconnect, | 290 | .disconnect = dvb_usb_device_exit, |
| 309 | .id_table = vp7045_usb_table, | 291 | .id_table = vp7045_usb_table, |
| 310 | }; | 292 | }; |
| 311 | 293 | ||
diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index eae05b500476..144f3f55d765 100644 --- a/drivers/media/rc/nuvoton-cir.c +++ b/drivers/media/rc/nuvoton-cir.c | |||
| @@ -618,7 +618,6 @@ static void nvt_dump_rx_buf(struct nvt_dev *nvt) | |||
| 618 | static void nvt_process_rx_ir_data(struct nvt_dev *nvt) | 618 | static void nvt_process_rx_ir_data(struct nvt_dev *nvt) |
| 619 | { | 619 | { |
| 620 | DEFINE_IR_RAW_EVENT(rawir); | 620 | DEFINE_IR_RAW_EVENT(rawir); |
| 621 | unsigned int count; | ||
| 622 | u32 carrier; | 621 | u32 carrier; |
| 623 | u8 sample; | 622 | u8 sample; |
| 624 | int i; | 623 | int i; |
| @@ -631,65 +630,38 @@ static void nvt_process_rx_ir_data(struct nvt_dev *nvt) | |||
| 631 | if (nvt->carrier_detect_enabled) | 630 | if (nvt->carrier_detect_enabled) |
| 632 | carrier = nvt_rx_carrier_detect(nvt); | 631 | carrier = nvt_rx_carrier_detect(nvt); |
| 633 | 632 | ||
| 634 | count = nvt->pkts; | 633 | nvt_dbg_verbose("Processing buffer of len %d", nvt->pkts); |
| 635 | nvt_dbg_verbose("Processing buffer of len %d", count); | ||
| 636 | 634 | ||
| 637 | init_ir_raw_event(&rawir); | 635 | init_ir_raw_event(&rawir); |
| 638 | 636 | ||
| 639 | for (i = 0; i < count; i++) { | 637 | for (i = 0; i < nvt->pkts; i++) { |
| 640 | nvt->pkts--; | ||
| 641 | sample = nvt->buf[i]; | 638 | sample = nvt->buf[i]; |
| 642 | 639 | ||
| 643 | rawir.pulse = ((sample & BUF_PULSE_BIT) != 0); | 640 | rawir.pulse = ((sample & BUF_PULSE_BIT) != 0); |
| 644 | rawir.duration = US_TO_NS((sample & BUF_LEN_MASK) | 641 | rawir.duration = US_TO_NS((sample & BUF_LEN_MASK) |
| 645 | * SAMPLE_PERIOD); | 642 | * SAMPLE_PERIOD); |
| 646 | 643 | ||
| 647 | if ((sample & BUF_LEN_MASK) == BUF_LEN_MASK) { | 644 | nvt_dbg("Storing %s with duration %d", |
| 648 | if (nvt->rawir.pulse == rawir.pulse) | 645 | rawir.pulse ? "pulse" : "space", rawir.duration); |
| 649 | nvt->rawir.duration += rawir.duration; | ||
| 650 | else { | ||
| 651 | nvt->rawir.duration = rawir.duration; | ||
| 652 | nvt->rawir.pulse = rawir.pulse; | ||
| 653 | } | ||
| 654 | continue; | ||
| 655 | } | ||
| 656 | |||
| 657 | rawir.duration += nvt->rawir.duration; | ||
| 658 | 646 | ||
| 659 | init_ir_raw_event(&nvt->rawir); | 647 | ir_raw_event_store_with_filter(nvt->rdev, &rawir); |
| 660 | nvt->rawir.duration = 0; | ||
| 661 | nvt->rawir.pulse = rawir.pulse; | ||
| 662 | |||
| 663 | if (sample == BUF_PULSE_BIT) | ||
| 664 | rawir.pulse = false; | ||
| 665 | |||
| 666 | if (rawir.duration) { | ||
| 667 | nvt_dbg("Storing %s with duration %d", | ||
| 668 | rawir.pulse ? "pulse" : "space", | ||
| 669 | rawir.duration); | ||
| 670 | |||
| 671 | ir_raw_event_store_with_filter(nvt->rdev, &rawir); | ||
| 672 | } | ||
| 673 | 648 | ||
| 674 | /* | 649 | /* |
| 675 | * BUF_PULSE_BIT indicates end of IR data, BUF_REPEAT_BYTE | 650 | * BUF_PULSE_BIT indicates end of IR data, BUF_REPEAT_BYTE |
| 676 | * indicates end of IR signal, but new data incoming. In both | 651 | * indicates end of IR signal, but new data incoming. In both |
| 677 | * cases, it means we're ready to call ir_raw_event_handle | 652 | * cases, it means we're ready to call ir_raw_event_handle |
| 678 | */ | 653 | */ |
| 679 | if ((sample == BUF_PULSE_BIT) && nvt->pkts) { | 654 | if ((sample == BUF_PULSE_BIT) && (i + 1 < nvt->pkts)) { |
| 680 | nvt_dbg("Calling ir_raw_event_handle (signal end)\n"); | 655 | nvt_dbg("Calling ir_raw_event_handle (signal end)\n"); |
| 681 | ir_raw_event_handle(nvt->rdev); | 656 | ir_raw_event_handle(nvt->rdev); |
| 682 | } | 657 | } |
| 683 | } | 658 | } |
| 684 | 659 | ||
| 660 | nvt->pkts = 0; | ||
| 661 | |||
| 685 | nvt_dbg("Calling ir_raw_event_handle (buffer empty)\n"); | 662 | nvt_dbg("Calling ir_raw_event_handle (buffer empty)\n"); |
| 686 | ir_raw_event_handle(nvt->rdev); | 663 | ir_raw_event_handle(nvt->rdev); |
| 687 | 664 | ||
| 688 | if (nvt->pkts) { | ||
| 689 | nvt_dbg("Odd, pkts should be 0 now... (its %u)", nvt->pkts); | ||
| 690 | nvt->pkts = 0; | ||
| 691 | } | ||
| 692 | |||
| 693 | nvt_dbg_verbose("%s done", __func__); | 665 | nvt_dbg_verbose("%s done", __func__); |
| 694 | } | 666 | } |
| 695 | 667 | ||
| @@ -1048,7 +1020,6 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id) | |||
| 1048 | 1020 | ||
| 1049 | spin_lock_init(&nvt->nvt_lock); | 1021 | spin_lock_init(&nvt->nvt_lock); |
| 1050 | spin_lock_init(&nvt->tx.lock); | 1022 | spin_lock_init(&nvt->tx.lock); |
| 1051 | init_ir_raw_event(&nvt->rawir); | ||
| 1052 | 1023 | ||
| 1053 | ret = -EBUSY; | 1024 | ret = -EBUSY; |
| 1054 | /* now claim resources */ | 1025 | /* now claim resources */ |
diff --git a/drivers/media/rc/nuvoton-cir.h b/drivers/media/rc/nuvoton-cir.h index 1241fc89a36c..0d5e0872a2ea 100644 --- a/drivers/media/rc/nuvoton-cir.h +++ b/drivers/media/rc/nuvoton-cir.h | |||
| @@ -67,7 +67,6 @@ static int debug; | |||
| 67 | struct nvt_dev { | 67 | struct nvt_dev { |
| 68 | struct pnp_dev *pdev; | 68 | struct pnp_dev *pdev; |
| 69 | struct rc_dev *rdev; | 69 | struct rc_dev *rdev; |
| 70 | struct ir_raw_event rawir; | ||
| 71 | 70 | ||
| 72 | spinlock_t nvt_lock; | 71 | spinlock_t nvt_lock; |
| 73 | 72 | ||
diff --git a/drivers/media/video/gspca/ov519.c b/drivers/media/video/gspca/ov519.c index 0800433b2092..18305c89083c 100644 --- a/drivers/media/video/gspca/ov519.c +++ b/drivers/media/video/gspca/ov519.c | |||
| @@ -2858,7 +2858,6 @@ static void ov7xx0_configure(struct sd *sd) | |||
| 2858 | case 0x60: | 2858 | case 0x60: |
| 2859 | PDEBUG(D_PROBE, "Sensor is a OV7660"); | 2859 | PDEBUG(D_PROBE, "Sensor is a OV7660"); |
| 2860 | sd->sensor = SEN_OV7660; | 2860 | sd->sensor = SEN_OV7660; |
| 2861 | sd->invert_led = 0; | ||
| 2862 | break; | 2861 | break; |
| 2863 | default: | 2862 | default: |
| 2864 | PDEBUG(D_PROBE, "Unknown sensor: 0x76%x", low); | 2863 | PDEBUG(D_PROBE, "Unknown sensor: 0x76%x", low); |
| @@ -3337,7 +3336,6 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
| 3337 | case BRIDGE_OV519: | 3336 | case BRIDGE_OV519: |
| 3338 | cam->cam_mode = ov519_vga_mode; | 3337 | cam->cam_mode = ov519_vga_mode; |
| 3339 | cam->nmodes = ARRAY_SIZE(ov519_vga_mode); | 3338 | cam->nmodes = ARRAY_SIZE(ov519_vga_mode); |
| 3340 | sd->invert_led = !sd->invert_led; | ||
| 3341 | break; | 3339 | break; |
| 3342 | case BRIDGE_OVFX2: | 3340 | case BRIDGE_OVFX2: |
| 3343 | cam->cam_mode = ov519_vga_mode; | 3341 | cam->cam_mode = ov519_vga_mode; |
| @@ -5005,24 +5003,24 @@ static const struct sd_desc sd_desc = { | |||
| 5005 | /* -- module initialisation -- */ | 5003 | /* -- module initialisation -- */ |
| 5006 | static const struct usb_device_id device_table[] = { | 5004 | static const struct usb_device_id device_table[] = { |
| 5007 | {USB_DEVICE(0x041e, 0x4003), .driver_info = BRIDGE_W9968CF }, | 5005 | {USB_DEVICE(0x041e, 0x4003), .driver_info = BRIDGE_W9968CF }, |
| 5008 | {USB_DEVICE(0x041e, 0x4052), .driver_info = BRIDGE_OV519 }, | 5006 | {USB_DEVICE(0x041e, 0x4052), |
| 5009 | {USB_DEVICE(0x041e, 0x405f), | ||
| 5010 | .driver_info = BRIDGE_OV519 | BRIDGE_INVERT_LED }, | 5007 | .driver_info = BRIDGE_OV519 | BRIDGE_INVERT_LED }, |
| 5008 | {USB_DEVICE(0x041e, 0x405f), .driver_info = BRIDGE_OV519 }, | ||
| 5011 | {USB_DEVICE(0x041e, 0x4060), .driver_info = BRIDGE_OV519 }, | 5009 | {USB_DEVICE(0x041e, 0x4060), .driver_info = BRIDGE_OV519 }, |
| 5012 | {USB_DEVICE(0x041e, 0x4061), .driver_info = BRIDGE_OV519 }, | 5010 | {USB_DEVICE(0x041e, 0x4061), .driver_info = BRIDGE_OV519 }, |
| 5013 | {USB_DEVICE(0x041e, 0x4064), | 5011 | {USB_DEVICE(0x041e, 0x4064), .driver_info = BRIDGE_OV519 }, |
| 5014 | .driver_info = BRIDGE_OV519 | BRIDGE_INVERT_LED }, | ||
| 5015 | {USB_DEVICE(0x041e, 0x4067), .driver_info = BRIDGE_OV519 }, | 5012 | {USB_DEVICE(0x041e, 0x4067), .driver_info = BRIDGE_OV519 }, |
| 5016 | {USB_DEVICE(0x041e, 0x4068), | 5013 | {USB_DEVICE(0x041e, 0x4068), .driver_info = BRIDGE_OV519 }, |
| 5014 | {USB_DEVICE(0x045e, 0x028c), | ||
| 5017 | .driver_info = BRIDGE_OV519 | BRIDGE_INVERT_LED }, | 5015 | .driver_info = BRIDGE_OV519 | BRIDGE_INVERT_LED }, |
| 5018 | {USB_DEVICE(0x045e, 0x028c), .driver_info = BRIDGE_OV519 }, | ||
| 5019 | {USB_DEVICE(0x054c, 0x0154), .driver_info = BRIDGE_OV519 }, | 5016 | {USB_DEVICE(0x054c, 0x0154), .driver_info = BRIDGE_OV519 }, |
| 5020 | {USB_DEVICE(0x054c, 0x0155), | 5017 | {USB_DEVICE(0x054c, 0x0155), .driver_info = BRIDGE_OV519 }, |
| 5021 | .driver_info = BRIDGE_OV519 | BRIDGE_INVERT_LED }, | ||
| 5022 | {USB_DEVICE(0x05a9, 0x0511), .driver_info = BRIDGE_OV511 }, | 5018 | {USB_DEVICE(0x05a9, 0x0511), .driver_info = BRIDGE_OV511 }, |
| 5023 | {USB_DEVICE(0x05a9, 0x0518), .driver_info = BRIDGE_OV518 }, | 5019 | {USB_DEVICE(0x05a9, 0x0518), .driver_info = BRIDGE_OV518 }, |
| 5024 | {USB_DEVICE(0x05a9, 0x0519), .driver_info = BRIDGE_OV519 }, | 5020 | {USB_DEVICE(0x05a9, 0x0519), |
| 5025 | {USB_DEVICE(0x05a9, 0x0530), .driver_info = BRIDGE_OV519 }, | 5021 | .driver_info = BRIDGE_OV519 | BRIDGE_INVERT_LED }, |
| 5022 | {USB_DEVICE(0x05a9, 0x0530), | ||
| 5023 | .driver_info = BRIDGE_OV519 | BRIDGE_INVERT_LED }, | ||
| 5026 | {USB_DEVICE(0x05a9, 0x2800), .driver_info = BRIDGE_OVFX2 }, | 5024 | {USB_DEVICE(0x05a9, 0x2800), .driver_info = BRIDGE_OVFX2 }, |
| 5027 | {USB_DEVICE(0x05a9, 0x4519), .driver_info = BRIDGE_OV519 }, | 5025 | {USB_DEVICE(0x05a9, 0x4519), .driver_info = BRIDGE_OV519 }, |
| 5028 | {USB_DEVICE(0x05a9, 0x8519), .driver_info = BRIDGE_OV519 }, | 5026 | {USB_DEVICE(0x05a9, 0x8519), .driver_info = BRIDGE_OV519 }, |
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c index 81b8a600783b..c477ad11f103 100644 --- a/drivers/media/video/gspca/sonixj.c +++ b/drivers/media/video/gspca/sonixj.c | |||
| @@ -2386,7 +2386,7 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
| 2386 | reg_w1(gspca_dev, 0x01, 0x22); | 2386 | reg_w1(gspca_dev, 0x01, 0x22); |
| 2387 | msleep(100); | 2387 | msleep(100); |
| 2388 | reg01 = SCL_SEL_OD | S_PDN_INV; | 2388 | reg01 = SCL_SEL_OD | S_PDN_INV; |
| 2389 | reg17 &= MCK_SIZE_MASK; | 2389 | reg17 &= ~MCK_SIZE_MASK; |
| 2390 | reg17 |= 0x04; /* clock / 4 */ | 2390 | reg17 |= 0x04; /* clock / 4 */ |
| 2391 | break; | 2391 | break; |
| 2392 | } | 2392 | } |
| @@ -2532,6 +2532,10 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
| 2532 | if (!mode) { /* if 640x480 */ | 2532 | if (!mode) { /* if 640x480 */ |
| 2533 | reg17 &= ~MCK_SIZE_MASK; | 2533 | reg17 &= ~MCK_SIZE_MASK; |
| 2534 | reg17 |= 0x04; /* clock / 4 */ | 2534 | reg17 |= 0x04; /* clock / 4 */ |
| 2535 | } else { | ||
| 2536 | reg01 &= ~SYS_SEL_48M; /* clk 24Mz */ | ||
| 2537 | reg17 &= ~MCK_SIZE_MASK; | ||
| 2538 | reg17 |= 0x02; /* clock / 2 */ | ||
| 2535 | } | 2539 | } |
| 2536 | break; | 2540 | break; |
| 2537 | case SENSOR_OV7630: | 2541 | case SENSOR_OV7630: |
diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c index e9a0e94b9995..8c70e64444e7 100644 --- a/drivers/media/video/pwc/pwc-v4l.c +++ b/drivers/media/video/pwc/pwc-v4l.c | |||
| @@ -338,7 +338,7 @@ int pwc_init_controls(struct pwc_device *pdev) | |||
| 338 | if (pdev->restore_factory) | 338 | if (pdev->restore_factory) |
| 339 | pdev->restore_factory->flags = V4L2_CTRL_FLAG_UPDATE; | 339 | pdev->restore_factory->flags = V4L2_CTRL_FLAG_UPDATE; |
| 340 | 340 | ||
| 341 | if (!pdev->features & FEATURE_MOTOR_PANTILT) | 341 | if (!(pdev->features & FEATURE_MOTOR_PANTILT)) |
| 342 | return hdl->error; | 342 | return hdl->error; |
| 343 | 343 | ||
| 344 | /* Motor pan / tilt / reset */ | 344 | /* Motor pan / tilt / reset */ |
diff --git a/drivers/media/video/via-camera.c b/drivers/media/video/via-camera.c index 85d3048c1d67..bb7f17f2a33c 100644 --- a/drivers/media/video/via-camera.c +++ b/drivers/media/video/via-camera.c | |||
| @@ -1332,6 +1332,8 @@ static __devinit bool viacam_serial_is_enabled(void) | |||
| 1332 | struct pci_bus *pbus = pci_find_bus(0, 0); | 1332 | struct pci_bus *pbus = pci_find_bus(0, 0); |
| 1333 | u8 cbyte; | 1333 | u8 cbyte; |
| 1334 | 1334 | ||
| 1335 | if (!pbus) | ||
| 1336 | return false; | ||
| 1335 | pci_bus_read_config_byte(pbus, VIACAM_SERIAL_DEVFN, | 1337 | pci_bus_read_config_byte(pbus, VIACAM_SERIAL_DEVFN, |
| 1336 | VIACAM_SERIAL_CREG, &cbyte); | 1338 | VIACAM_SERIAL_CREG, &cbyte); |
| 1337 | if ((cbyte & VIACAM_SERIAL_BIT) == 0) | 1339 | if ((cbyte & VIACAM_SERIAL_BIT) == 0) |
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 0a4d86c6c4a4..2d6423c2d193 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig | |||
| @@ -146,6 +146,7 @@ config PHANTOM | |||
| 146 | 146 | ||
| 147 | config INTEL_MID_PTI | 147 | config INTEL_MID_PTI |
| 148 | tristate "Parallel Trace Interface for MIPI P1149.7 cJTAG standard" | 148 | tristate "Parallel Trace Interface for MIPI P1149.7 cJTAG standard" |
| 149 | depends on PCI | ||
| 149 | default n | 150 | default n |
| 150 | help | 151 | help |
| 151 | The PTI (Parallel Trace Interface) driver directs | 152 | The PTI (Parallel Trace Interface) driver directs |
diff --git a/drivers/misc/ab8500-pwm.c b/drivers/misc/ab8500-pwm.c index 54e3d05b63cc..35903154ca2e 100644 --- a/drivers/misc/ab8500-pwm.c +++ b/drivers/misc/ab8500-pwm.c | |||
| @@ -164,5 +164,5 @@ subsys_initcall(ab8500_pwm_init); | |||
| 164 | module_exit(ab8500_pwm_exit); | 164 | module_exit(ab8500_pwm_exit); |
| 165 | MODULE_AUTHOR("Arun MURTHY <arun.murthy@stericsson.com>"); | 165 | MODULE_AUTHOR("Arun MURTHY <arun.murthy@stericsson.com>"); |
| 166 | MODULE_DESCRIPTION("AB8500 Pulse Width Modulation Driver"); | 166 | MODULE_DESCRIPTION("AB8500 Pulse Width Modulation Driver"); |
| 167 | MODULE_ALIAS("AB8500 PWM driver"); | 167 | MODULE_ALIAS("platform:ab8500-pwm"); |
| 168 | MODULE_LICENSE("GPL v2"); | 168 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/misc/fsa9480.c b/drivers/misc/fsa9480.c index 5325a7e70dcf..27dc0d21aafa 100644 --- a/drivers/misc/fsa9480.c +++ b/drivers/misc/fsa9480.c | |||
| @@ -455,7 +455,7 @@ static int __devinit fsa9480_probe(struct i2c_client *client, | |||
| 455 | 455 | ||
| 456 | fail2: | 456 | fail2: |
| 457 | if (client->irq) | 457 | if (client->irq) |
| 458 | free_irq(client->irq, NULL); | 458 | free_irq(client->irq, usbsw); |
| 459 | fail1: | 459 | fail1: |
| 460 | i2c_set_clientdata(client, NULL); | 460 | i2c_set_clientdata(client, NULL); |
| 461 | kfree(usbsw); | 461 | kfree(usbsw); |
| @@ -466,7 +466,7 @@ static int __devexit fsa9480_remove(struct i2c_client *client) | |||
| 466 | { | 466 | { |
| 467 | struct fsa9480_usbsw *usbsw = i2c_get_clientdata(client); | 467 | struct fsa9480_usbsw *usbsw = i2c_get_clientdata(client); |
| 468 | if (client->irq) | 468 | if (client->irq) |
| 469 | free_irq(client->irq, NULL); | 469 | free_irq(client->irq, usbsw); |
| 470 | i2c_set_clientdata(client, NULL); | 470 | i2c_set_clientdata(client, NULL); |
| 471 | 471 | ||
| 472 | sysfs_remove_group(&client->dev.kobj, &fsa9480_group); | 472 | sysfs_remove_group(&client->dev.kobj, &fsa9480_group); |
diff --git a/drivers/misc/pti.c b/drivers/misc/pti.c index 8653bd0b1a33..0b56e3f43573 100644 --- a/drivers/misc/pti.c +++ b/drivers/misc/pti.c | |||
| @@ -33,6 +33,8 @@ | |||
| 33 | #include <linux/mutex.h> | 33 | #include <linux/mutex.h> |
| 34 | #include <linux/miscdevice.h> | 34 | #include <linux/miscdevice.h> |
| 35 | #include <linux/pti.h> | 35 | #include <linux/pti.h> |
| 36 | #include <linux/slab.h> | ||
| 37 | #include <linux/uaccess.h> | ||
| 36 | 38 | ||
| 37 | #define DRIVERNAME "pti" | 39 | #define DRIVERNAME "pti" |
| 38 | #define PCINAME "pciPTI" | 40 | #define PCINAME "pciPTI" |
| @@ -163,6 +165,11 @@ static void pti_write_to_aperture(struct pti_masterchannel *mc, | |||
| 163 | static void pti_control_frame_built_and_sent(struct pti_masterchannel *mc, | 165 | static void pti_control_frame_built_and_sent(struct pti_masterchannel *mc, |
| 164 | const char *thread_name) | 166 | const char *thread_name) |
| 165 | { | 167 | { |
| 168 | /* | ||
| 169 | * Since we access the comm member in current's task_struct, we only | ||
| 170 | * need to be as large as what 'comm' in that structure is. | ||
| 171 | */ | ||
| 172 | char comm[TASK_COMM_LEN]; | ||
| 166 | struct pti_masterchannel mccontrol = {.master = CONTROL_ID, | 173 | struct pti_masterchannel mccontrol = {.master = CONTROL_ID, |
| 167 | .channel = 0}; | 174 | .channel = 0}; |
| 168 | const char *thread_name_p; | 175 | const char *thread_name_p; |
| @@ -170,13 +177,6 @@ static void pti_control_frame_built_and_sent(struct pti_masterchannel *mc, | |||
| 170 | u8 control_frame[CONTROL_FRAME_LEN]; | 177 | u8 control_frame[CONTROL_FRAME_LEN]; |
| 171 | 178 | ||
| 172 | if (!thread_name) { | 179 | if (!thread_name) { |
| 173 | /* | ||
| 174 | * Since we access the comm member in current's task_struct, | ||
| 175 | * we only need to be as large as what 'comm' in that | ||
| 176 | * structure is. | ||
| 177 | */ | ||
| 178 | char comm[TASK_COMM_LEN]; | ||
| 179 | |||
| 180 | if (!in_interrupt()) | 180 | if (!in_interrupt()) |
| 181 | get_task_comm(comm, current); | 181 | get_task_comm(comm, current); |
| 182 | else | 182 | else |
diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c index 54c91ffe4a91..ba168a7d54d4 100644 --- a/drivers/misc/ti-st/st_core.c +++ b/drivers/misc/ti-st/st_core.c | |||
| @@ -338,6 +338,12 @@ void st_int_recv(void *disc_data, | |||
| 338 | /* Unknow packet? */ | 338 | /* Unknow packet? */ |
| 339 | default: | 339 | default: |
| 340 | type = *ptr; | 340 | type = *ptr; |
| 341 | if (st_gdata->list[type] == NULL) { | ||
| 342 | pr_err("chip/interface misbehavior dropping" | ||
| 343 | " frame starting with 0x%02x", type); | ||
| 344 | goto done; | ||
| 345 | |||
| 346 | } | ||
| 341 | st_gdata->rx_skb = alloc_skb( | 347 | st_gdata->rx_skb = alloc_skb( |
| 342 | st_gdata->list[type]->max_frame_size, | 348 | st_gdata->list[type]->max_frame_size, |
| 343 | GFP_ATOMIC); | 349 | GFP_ATOMIC); |
| @@ -354,6 +360,7 @@ void st_int_recv(void *disc_data, | |||
| 354 | ptr++; | 360 | ptr++; |
| 355 | count--; | 361 | count--; |
| 356 | } | 362 | } |
| 363 | done: | ||
| 357 | spin_unlock_irqrestore(&st_gdata->lock, flags); | 364 | spin_unlock_irqrestore(&st_gdata->lock, flags); |
| 358 | pr_debug("done %s", __func__); | 365 | pr_debug("done %s", __func__); |
| 359 | return; | 366 | return; |
| @@ -717,9 +724,10 @@ static void st_tty_close(struct tty_struct *tty) | |||
| 717 | */ | 724 | */ |
| 718 | spin_lock_irqsave(&st_gdata->lock, flags); | 725 | spin_lock_irqsave(&st_gdata->lock, flags); |
| 719 | for (i = ST_BT; i < ST_MAX_CHANNELS; i++) { | 726 | for (i = ST_BT; i < ST_MAX_CHANNELS; i++) { |
| 720 | if (st_gdata->list[i] != NULL) | 727 | if (st_gdata->is_registered[i] == true) |
| 721 | pr_err("%d not un-registered", i); | 728 | pr_err("%d not un-registered", i); |
| 722 | st_gdata->list[i] = NULL; | 729 | st_gdata->list[i] = NULL; |
| 730 | st_gdata->is_registered[i] = false; | ||
| 723 | } | 731 | } |
| 724 | st_gdata->protos_registered = 0; | 732 | st_gdata->protos_registered = 0; |
| 725 | spin_unlock_irqrestore(&st_gdata->lock, flags); | 733 | spin_unlock_irqrestore(&st_gdata->lock, flags); |
diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c index 38fd2f04c07e..3a3580566dfc 100644 --- a/drivers/misc/ti-st/st_kim.c +++ b/drivers/misc/ti-st/st_kim.c | |||
| @@ -68,6 +68,7 @@ void validate_firmware_response(struct kim_data_s *kim_gdata) | |||
| 68 | if (unlikely(skb->data[5] != 0)) { | 68 | if (unlikely(skb->data[5] != 0)) { |
| 69 | pr_err("no proper response during fw download"); | 69 | pr_err("no proper response during fw download"); |
| 70 | pr_err("data6 %x", skb->data[5]); | 70 | pr_err("data6 %x", skb->data[5]); |
| 71 | kfree_skb(skb); | ||
| 71 | return; /* keep waiting for the proper response */ | 72 | return; /* keep waiting for the proper response */ |
| 72 | } | 73 | } |
| 73 | /* becos of all the script being downloaded */ | 74 | /* becos of all the script being downloaded */ |
| @@ -210,6 +211,7 @@ static long read_local_version(struct kim_data_s *kim_gdata, char *bts_scr_name) | |||
| 210 | pr_err(" waiting for ver info- timed out "); | 211 | pr_err(" waiting for ver info- timed out "); |
| 211 | return -ETIMEDOUT; | 212 | return -ETIMEDOUT; |
| 212 | } | 213 | } |
| 214 | INIT_COMPLETION(kim_gdata->kim_rcvd); | ||
| 213 | 215 | ||
| 214 | version = | 216 | version = |
| 215 | MAKEWORD(kim_gdata->resp_buffer[13], | 217 | MAKEWORD(kim_gdata->resp_buffer[13], |
| @@ -298,6 +300,7 @@ static long download_firmware(struct kim_data_s *kim_gdata) | |||
| 298 | 300 | ||
| 299 | switch (((struct bts_action *)ptr)->type) { | 301 | switch (((struct bts_action *)ptr)->type) { |
| 300 | case ACTION_SEND_COMMAND: /* action send */ | 302 | case ACTION_SEND_COMMAND: /* action send */ |
| 303 | pr_debug("S"); | ||
| 301 | action_ptr = &(((struct bts_action *)ptr)->data[0]); | 304 | action_ptr = &(((struct bts_action *)ptr)->data[0]); |
| 302 | if (unlikely | 305 | if (unlikely |
| 303 | (((struct hci_command *)action_ptr)->opcode == | 306 | (((struct hci_command *)action_ptr)->opcode == |
| @@ -335,6 +338,10 @@ static long download_firmware(struct kim_data_s *kim_gdata) | |||
| 335 | release_firmware(kim_gdata->fw_entry); | 338 | release_firmware(kim_gdata->fw_entry); |
| 336 | return -ETIMEDOUT; | 339 | return -ETIMEDOUT; |
| 337 | } | 340 | } |
| 341 | /* reinit completion before sending for the | ||
| 342 | * relevant wait | ||
| 343 | */ | ||
| 344 | INIT_COMPLETION(kim_gdata->kim_rcvd); | ||
| 338 | 345 | ||
| 339 | /* | 346 | /* |
| 340 | * Free space found in uart buffer, call st_int_write | 347 | * Free space found in uart buffer, call st_int_write |
| @@ -361,6 +368,7 @@ static long download_firmware(struct kim_data_s *kim_gdata) | |||
| 361 | } | 368 | } |
| 362 | break; | 369 | break; |
| 363 | case ACTION_WAIT_EVENT: /* wait */ | 370 | case ACTION_WAIT_EVENT: /* wait */ |
| 371 | pr_debug("W"); | ||
| 364 | if (!wait_for_completion_timeout | 372 | if (!wait_for_completion_timeout |
| 365 | (&kim_gdata->kim_rcvd, | 373 | (&kim_gdata->kim_rcvd, |
| 366 | msecs_to_jiffies(CMD_RESP_TIME))) { | 374 | msecs_to_jiffies(CMD_RESP_TIME))) { |
| @@ -434,11 +442,17 @@ long st_kim_start(void *kim_data) | |||
| 434 | { | 442 | { |
| 435 | long err = 0; | 443 | long err = 0; |
| 436 | long retry = POR_RETRY_COUNT; | 444 | long retry = POR_RETRY_COUNT; |
| 445 | struct ti_st_plat_data *pdata; | ||
| 437 | struct kim_data_s *kim_gdata = (struct kim_data_s *)kim_data; | 446 | struct kim_data_s *kim_gdata = (struct kim_data_s *)kim_data; |
| 438 | 447 | ||
| 439 | pr_info(" %s", __func__); | 448 | pr_info(" %s", __func__); |
| 449 | pdata = kim_gdata->kim_pdev->dev.platform_data; | ||
| 440 | 450 | ||
| 441 | do { | 451 | do { |
| 452 | /* platform specific enabling code here */ | ||
| 453 | if (pdata->chip_enable) | ||
| 454 | pdata->chip_enable(kim_gdata); | ||
| 455 | |||
| 442 | /* Configure BT nShutdown to HIGH state */ | 456 | /* Configure BT nShutdown to HIGH state */ |
| 443 | gpio_set_value(kim_gdata->nshutdown, GPIO_LOW); | 457 | gpio_set_value(kim_gdata->nshutdown, GPIO_LOW); |
| 444 | mdelay(5); /* FIXME: a proper toggle */ | 458 | mdelay(5); /* FIXME: a proper toggle */ |
| @@ -460,6 +474,12 @@ long st_kim_start(void *kim_data) | |||
| 460 | pr_info("ldisc_install = 0"); | 474 | pr_info("ldisc_install = 0"); |
| 461 | sysfs_notify(&kim_gdata->kim_pdev->dev.kobj, | 475 | sysfs_notify(&kim_gdata->kim_pdev->dev.kobj, |
| 462 | NULL, "install"); | 476 | NULL, "install"); |
| 477 | /* the following wait is never going to be completed, | ||
| 478 | * since the ldisc was never installed, hence serving | ||
| 479 | * as a mdelay of LDISC_TIME msecs */ | ||
| 480 | err = wait_for_completion_timeout | ||
| 481 | (&kim_gdata->ldisc_installed, | ||
| 482 | msecs_to_jiffies(LDISC_TIME)); | ||
| 463 | err = -ETIMEDOUT; | 483 | err = -ETIMEDOUT; |
| 464 | continue; | 484 | continue; |
| 465 | } else { | 485 | } else { |
| @@ -472,6 +492,13 @@ long st_kim_start(void *kim_data) | |||
| 472 | pr_info("ldisc_install = 0"); | 492 | pr_info("ldisc_install = 0"); |
| 473 | sysfs_notify(&kim_gdata->kim_pdev->dev.kobj, | 493 | sysfs_notify(&kim_gdata->kim_pdev->dev.kobj, |
| 474 | NULL, "install"); | 494 | NULL, "install"); |
| 495 | /* this wait might be completed, though in the | ||
| 496 | * tty_close() since the ldisc is already | ||
| 497 | * installed */ | ||
| 498 | err = wait_for_completion_timeout | ||
| 499 | (&kim_gdata->ldisc_installed, | ||
| 500 | msecs_to_jiffies(LDISC_TIME)); | ||
| 501 | err = -EINVAL; | ||
| 475 | continue; | 502 | continue; |
| 476 | } else { /* on success don't retry */ | 503 | } else { /* on success don't retry */ |
| 477 | break; | 504 | break; |
| @@ -489,6 +516,8 @@ long st_kim_stop(void *kim_data) | |||
| 489 | { | 516 | { |
| 490 | long err = 0; | 517 | long err = 0; |
| 491 | struct kim_data_s *kim_gdata = (struct kim_data_s *)kim_data; | 518 | struct kim_data_s *kim_gdata = (struct kim_data_s *)kim_data; |
| 519 | struct ti_st_plat_data *pdata = | ||
| 520 | kim_gdata->kim_pdev->dev.platform_data; | ||
| 492 | 521 | ||
| 493 | INIT_COMPLETION(kim_gdata->ldisc_installed); | 522 | INIT_COMPLETION(kim_gdata->ldisc_installed); |
| 494 | 523 | ||
| @@ -515,6 +544,10 @@ long st_kim_stop(void *kim_data) | |||
| 515 | gpio_set_value(kim_gdata->nshutdown, GPIO_HIGH); | 544 | gpio_set_value(kim_gdata->nshutdown, GPIO_HIGH); |
| 516 | mdelay(1); | 545 | mdelay(1); |
| 517 | gpio_set_value(kim_gdata->nshutdown, GPIO_LOW); | 546 | gpio_set_value(kim_gdata->nshutdown, GPIO_LOW); |
| 547 | |||
| 548 | /* platform specific disable */ | ||
| 549 | if (pdata->chip_disable) | ||
| 550 | pdata->chip_disable(kim_gdata); | ||
| 518 | return err; | 551 | return err; |
| 519 | } | 552 | } |
| 520 | 553 | ||
diff --git a/drivers/misc/ti-st/st_ll.c b/drivers/misc/ti-st/st_ll.c index 3f2495138855..1ff460a8e9c7 100644 --- a/drivers/misc/ti-st/st_ll.c +++ b/drivers/misc/ti-st/st_ll.c | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #define pr_fmt(fmt) "(stll) :" fmt | 22 | #define pr_fmt(fmt) "(stll) :" fmt |
| 23 | #include <linux/skbuff.h> | 23 | #include <linux/skbuff.h> |
| 24 | #include <linux/module.h> | 24 | #include <linux/module.h> |
| 25 | #include <linux/platform_device.h> | ||
| 25 | #include <linux/ti_wilink_st.h> | 26 | #include <linux/ti_wilink_st.h> |
| 26 | 27 | ||
| 27 | /**********************************************************************/ | 28 | /**********************************************************************/ |
| @@ -37,6 +38,9 @@ static void send_ll_cmd(struct st_data_s *st_data, | |||
| 37 | 38 | ||
| 38 | static void ll_device_want_to_sleep(struct st_data_s *st_data) | 39 | static void ll_device_want_to_sleep(struct st_data_s *st_data) |
| 39 | { | 40 | { |
| 41 | struct kim_data_s *kim_data; | ||
| 42 | struct ti_st_plat_data *pdata; | ||
| 43 | |||
| 40 | pr_debug("%s", __func__); | 44 | pr_debug("%s", __func__); |
| 41 | /* sanity check */ | 45 | /* sanity check */ |
| 42 | if (st_data->ll_state != ST_LL_AWAKE) | 46 | if (st_data->ll_state != ST_LL_AWAKE) |
| @@ -46,10 +50,19 @@ static void ll_device_want_to_sleep(struct st_data_s *st_data) | |||
| 46 | send_ll_cmd(st_data, LL_SLEEP_ACK); | 50 | send_ll_cmd(st_data, LL_SLEEP_ACK); |
| 47 | /* update state */ | 51 | /* update state */ |
| 48 | st_data->ll_state = ST_LL_ASLEEP; | 52 | st_data->ll_state = ST_LL_ASLEEP; |
| 53 | |||
| 54 | /* communicate to platform about chip asleep */ | ||
| 55 | kim_data = st_data->kim_data; | ||
| 56 | pdata = kim_data->kim_pdev->dev.platform_data; | ||
| 57 | if (pdata->chip_asleep) | ||
| 58 | pdata->chip_asleep(NULL); | ||
| 49 | } | 59 | } |
| 50 | 60 | ||
| 51 | static void ll_device_want_to_wakeup(struct st_data_s *st_data) | 61 | static void ll_device_want_to_wakeup(struct st_data_s *st_data) |
| 52 | { | 62 | { |
| 63 | struct kim_data_s *kim_data; | ||
| 64 | struct ti_st_plat_data *pdata; | ||
| 65 | |||
| 53 | /* diff actions in diff states */ | 66 | /* diff actions in diff states */ |
| 54 | switch (st_data->ll_state) { | 67 | switch (st_data->ll_state) { |
| 55 | case ST_LL_ASLEEP: | 68 | case ST_LL_ASLEEP: |
| @@ -70,6 +83,12 @@ static void ll_device_want_to_wakeup(struct st_data_s *st_data) | |||
| 70 | } | 83 | } |
| 71 | /* update state */ | 84 | /* update state */ |
| 72 | st_data->ll_state = ST_LL_AWAKE; | 85 | st_data->ll_state = ST_LL_AWAKE; |
| 86 | |||
| 87 | /* communicate to platform about chip wakeup */ | ||
| 88 | kim_data = st_data->kim_data; | ||
| 89 | pdata = kim_data->kim_pdev->dev.platform_data; | ||
| 90 | if (pdata->chip_asleep) | ||
| 91 | pdata->chip_awake(NULL); | ||
| 73 | } | 92 | } |
| 74 | 93 | ||
| 75 | /**********************************************************************/ | 94 | /**********************************************************************/ |
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 91a0a7460ebb..b27b94078c21 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
| @@ -133,7 +133,7 @@ void mmc_request_done(struct mmc_host *host, struct mmc_request *mrq) | |||
| 133 | if (mrq->done) | 133 | if (mrq->done) |
| 134 | mrq->done(mrq); | 134 | mrq->done(mrq); |
| 135 | 135 | ||
| 136 | mmc_host_clk_gate(host); | 136 | mmc_host_clk_release(host); |
| 137 | } | 137 | } |
| 138 | } | 138 | } |
| 139 | 139 | ||
| @@ -192,7 +192,7 @@ mmc_start_request(struct mmc_host *host, struct mmc_request *mrq) | |||
| 192 | mrq->stop->mrq = mrq; | 192 | mrq->stop->mrq = mrq; |
| 193 | } | 193 | } |
| 194 | } | 194 | } |
| 195 | mmc_host_clk_ungate(host); | 195 | mmc_host_clk_hold(host); |
| 196 | led_trigger_event(host->led, LED_FULL); | 196 | led_trigger_event(host->led, LED_FULL); |
| 197 | host->ops->request(host, mrq); | 197 | host->ops->request(host, mrq); |
| 198 | } | 198 | } |
| @@ -728,15 +728,17 @@ static inline void mmc_set_ios(struct mmc_host *host) | |||
| 728 | */ | 728 | */ |
| 729 | void mmc_set_chip_select(struct mmc_host *host, int mode) | 729 | void mmc_set_chip_select(struct mmc_host *host, int mode) |
| 730 | { | 730 | { |
| 731 | mmc_host_clk_hold(host); | ||
| 731 | host->ios.chip_select = mode; | 732 | host->ios.chip_select = mode; |
| 732 | mmc_set_ios(host); | 733 | mmc_set_ios(host); |
| 734 | mmc_host_clk_release(host); | ||
| 733 | } | 735 | } |
| 734 | 736 | ||
| 735 | /* | 737 | /* |
| 736 | * Sets the host clock to the highest possible frequency that | 738 | * Sets the host clock to the highest possible frequency that |
| 737 | * is below "hz". | 739 | * is below "hz". |
| 738 | */ | 740 | */ |
| 739 | void mmc_set_clock(struct mmc_host *host, unsigned int hz) | 741 | static void __mmc_set_clock(struct mmc_host *host, unsigned int hz) |
| 740 | { | 742 | { |
| 741 | WARN_ON(hz < host->f_min); | 743 | WARN_ON(hz < host->f_min); |
| 742 | 744 | ||
| @@ -747,6 +749,13 @@ void mmc_set_clock(struct mmc_host *host, unsigned int hz) | |||
| 747 | mmc_set_ios(host); | 749 | mmc_set_ios(host); |
| 748 | } | 750 | } |
| 749 | 751 | ||
| 752 | void mmc_set_clock(struct mmc_host *host, unsigned int hz) | ||
| 753 | { | ||
| 754 | mmc_host_clk_hold(host); | ||
| 755 | __mmc_set_clock(host, hz); | ||
| 756 | mmc_host_clk_release(host); | ||
| 757 | } | ||
| 758 | |||
| 750 | #ifdef CONFIG_MMC_CLKGATE | 759 | #ifdef CONFIG_MMC_CLKGATE |
| 751 | /* | 760 | /* |
| 752 | * This gates the clock by setting it to 0 Hz. | 761 | * This gates the clock by setting it to 0 Hz. |
| @@ -779,7 +788,7 @@ void mmc_ungate_clock(struct mmc_host *host) | |||
| 779 | if (host->clk_old) { | 788 | if (host->clk_old) { |
| 780 | BUG_ON(host->ios.clock); | 789 | BUG_ON(host->ios.clock); |
| 781 | /* This call will also set host->clk_gated to false */ | 790 | /* This call will also set host->clk_gated to false */ |
| 782 | mmc_set_clock(host, host->clk_old); | 791 | __mmc_set_clock(host, host->clk_old); |
| 783 | } | 792 | } |
| 784 | } | 793 | } |
| 785 | 794 | ||
| @@ -807,8 +816,10 @@ void mmc_set_ungated(struct mmc_host *host) | |||
| 807 | */ | 816 | */ |
| 808 | void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode) | 817 | void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode) |
| 809 | { | 818 | { |
| 819 | mmc_host_clk_hold(host); | ||
| 810 | host->ios.bus_mode = mode; | 820 | host->ios.bus_mode = mode; |
| 811 | mmc_set_ios(host); | 821 | mmc_set_ios(host); |
| 822 | mmc_host_clk_release(host); | ||
| 812 | } | 823 | } |
| 813 | 824 | ||
| 814 | /* | 825 | /* |
| @@ -816,8 +827,10 @@ void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode) | |||
| 816 | */ | 827 | */ |
| 817 | void mmc_set_bus_width(struct mmc_host *host, unsigned int width) | 828 | void mmc_set_bus_width(struct mmc_host *host, unsigned int width) |
| 818 | { | 829 | { |
| 830 | mmc_host_clk_hold(host); | ||
| 819 | host->ios.bus_width = width; | 831 | host->ios.bus_width = width; |
| 820 | mmc_set_ios(host); | 832 | mmc_set_ios(host); |
| 833 | mmc_host_clk_release(host); | ||
| 821 | } | 834 | } |
| 822 | 835 | ||
| 823 | /** | 836 | /** |
| @@ -1015,8 +1028,10 @@ u32 mmc_select_voltage(struct mmc_host *host, u32 ocr) | |||
| 1015 | 1028 | ||
| 1016 | ocr &= 3 << bit; | 1029 | ocr &= 3 << bit; |
| 1017 | 1030 | ||
| 1031 | mmc_host_clk_hold(host); | ||
| 1018 | host->ios.vdd = bit; | 1032 | host->ios.vdd = bit; |
| 1019 | mmc_set_ios(host); | 1033 | mmc_set_ios(host); |
| 1034 | mmc_host_clk_release(host); | ||
| 1020 | } else { | 1035 | } else { |
| 1021 | pr_warning("%s: host doesn't support card's voltages\n", | 1036 | pr_warning("%s: host doesn't support card's voltages\n", |
| 1022 | mmc_hostname(host)); | 1037 | mmc_hostname(host)); |
| @@ -1063,8 +1078,10 @@ int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage, bool cmd11 | |||
| 1063 | */ | 1078 | */ |
| 1064 | void mmc_set_timing(struct mmc_host *host, unsigned int timing) | 1079 | void mmc_set_timing(struct mmc_host *host, unsigned int timing) |
| 1065 | { | 1080 | { |
| 1081 | mmc_host_clk_hold(host); | ||
| 1066 | host->ios.timing = timing; | 1082 | host->ios.timing = timing; |
| 1067 | mmc_set_ios(host); | 1083 | mmc_set_ios(host); |
| 1084 | mmc_host_clk_release(host); | ||
| 1068 | } | 1085 | } |
| 1069 | 1086 | ||
| 1070 | /* | 1087 | /* |
| @@ -1072,8 +1089,10 @@ void mmc_set_timing(struct mmc_host *host, unsigned int timing) | |||
| 1072 | */ | 1089 | */ |
| 1073 | void mmc_set_driver_type(struct mmc_host *host, unsigned int drv_type) | 1090 | void mmc_set_driver_type(struct mmc_host *host, unsigned int drv_type) |
| 1074 | { | 1091 | { |
| 1092 | mmc_host_clk_hold(host); | ||
| 1075 | host->ios.drv_type = drv_type; | 1093 | host->ios.drv_type = drv_type; |
| 1076 | mmc_set_ios(host); | 1094 | mmc_set_ios(host); |
| 1095 | mmc_host_clk_release(host); | ||
| 1077 | } | 1096 | } |
| 1078 | 1097 | ||
| 1079 | /* | 1098 | /* |
| @@ -1091,6 +1110,8 @@ static void mmc_power_up(struct mmc_host *host) | |||
| 1091 | { | 1110 | { |
| 1092 | int bit; | 1111 | int bit; |
| 1093 | 1112 | ||
| 1113 | mmc_host_clk_hold(host); | ||
| 1114 | |||
| 1094 | /* If ocr is set, we use it */ | 1115 | /* If ocr is set, we use it */ |
| 1095 | if (host->ocr) | 1116 | if (host->ocr) |
| 1096 | bit = ffs(host->ocr) - 1; | 1117 | bit = ffs(host->ocr) - 1; |
| @@ -1126,10 +1147,14 @@ static void mmc_power_up(struct mmc_host *host) | |||
| 1126 | * time required to reach a stable voltage. | 1147 | * time required to reach a stable voltage. |
| 1127 | */ | 1148 | */ |
| 1128 | mmc_delay(10); | 1149 | mmc_delay(10); |
| 1150 | |||
| 1151 | mmc_host_clk_release(host); | ||
| 1129 | } | 1152 | } |
| 1130 | 1153 | ||
| 1131 | static void mmc_power_off(struct mmc_host *host) | 1154 | static void mmc_power_off(struct mmc_host *host) |
| 1132 | { | 1155 | { |
| 1156 | mmc_host_clk_hold(host); | ||
| 1157 | |||
| 1133 | host->ios.clock = 0; | 1158 | host->ios.clock = 0; |
| 1134 | host->ios.vdd = 0; | 1159 | host->ios.vdd = 0; |
| 1135 | 1160 | ||
| @@ -1147,6 +1172,8 @@ static void mmc_power_off(struct mmc_host *host) | |||
| 1147 | host->ios.bus_width = MMC_BUS_WIDTH_1; | 1172 | host->ios.bus_width = MMC_BUS_WIDTH_1; |
| 1148 | host->ios.timing = MMC_TIMING_LEGACY; | 1173 | host->ios.timing = MMC_TIMING_LEGACY; |
| 1149 | mmc_set_ios(host); | 1174 | mmc_set_ios(host); |
| 1175 | |||
| 1176 | mmc_host_clk_release(host); | ||
| 1150 | } | 1177 | } |
| 1151 | 1178 | ||
| 1152 | /* | 1179 | /* |
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index b29d3e8fd3a2..793d0a0dad8d 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c | |||
| @@ -119,14 +119,14 @@ static void mmc_host_clk_gate_work(struct work_struct *work) | |||
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | /** | 121 | /** |
| 122 | * mmc_host_clk_ungate - ungate hardware MCI clocks | 122 | * mmc_host_clk_hold - ungate hardware MCI clocks |
| 123 | * @host: host to ungate. | 123 | * @host: host to ungate. |
| 124 | * | 124 | * |
| 125 | * Makes sure the host ios.clock is restored to a non-zero value | 125 | * Makes sure the host ios.clock is restored to a non-zero value |
| 126 | * past this call. Increase clock reference count and ungate clock | 126 | * past this call. Increase clock reference count and ungate clock |
| 127 | * if we're the first user. | 127 | * if we're the first user. |
| 128 | */ | 128 | */ |
| 129 | void mmc_host_clk_ungate(struct mmc_host *host) | 129 | void mmc_host_clk_hold(struct mmc_host *host) |
| 130 | { | 130 | { |
| 131 | unsigned long flags; | 131 | unsigned long flags; |
| 132 | 132 | ||
| @@ -164,14 +164,14 @@ static bool mmc_host_may_gate_card(struct mmc_card *card) | |||
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | /** | 166 | /** |
| 167 | * mmc_host_clk_gate - gate off hardware MCI clocks | 167 | * mmc_host_clk_release - gate off hardware MCI clocks |
| 168 | * @host: host to gate. | 168 | * @host: host to gate. |
| 169 | * | 169 | * |
| 170 | * Calls the host driver with ios.clock set to zero as often as possible | 170 | * Calls the host driver with ios.clock set to zero as often as possible |
| 171 | * in order to gate off hardware MCI clocks. Decrease clock reference | 171 | * in order to gate off hardware MCI clocks. Decrease clock reference |
| 172 | * count and schedule disabling of clock. | 172 | * count and schedule disabling of clock. |
| 173 | */ | 173 | */ |
| 174 | void mmc_host_clk_gate(struct mmc_host *host) | 174 | void mmc_host_clk_release(struct mmc_host *host) |
| 175 | { | 175 | { |
| 176 | unsigned long flags; | 176 | unsigned long flags; |
| 177 | 177 | ||
| @@ -179,7 +179,7 @@ void mmc_host_clk_gate(struct mmc_host *host) | |||
| 179 | host->clk_requests--; | 179 | host->clk_requests--; |
| 180 | if (mmc_host_may_gate_card(host->card) && | 180 | if (mmc_host_may_gate_card(host->card) && |
| 181 | !host->clk_requests) | 181 | !host->clk_requests) |
| 182 | schedule_work(&host->clk_gate_work); | 182 | queue_work(system_nrt_wq, &host->clk_gate_work); |
| 183 | spin_unlock_irqrestore(&host->clk_lock, flags); | 183 | spin_unlock_irqrestore(&host->clk_lock, flags); |
| 184 | } | 184 | } |
| 185 | 185 | ||
| @@ -231,7 +231,7 @@ static inline void mmc_host_clk_exit(struct mmc_host *host) | |||
| 231 | if (cancel_work_sync(&host->clk_gate_work)) | 231 | if (cancel_work_sync(&host->clk_gate_work)) |
| 232 | mmc_host_clk_gate_delayed(host); | 232 | mmc_host_clk_gate_delayed(host); |
| 233 | if (host->clk_gated) | 233 | if (host->clk_gated) |
| 234 | mmc_host_clk_ungate(host); | 234 | mmc_host_clk_hold(host); |
| 235 | /* There should be only one user now */ | 235 | /* There should be only one user now */ |
| 236 | WARN_ON(host->clk_requests > 1); | 236 | WARN_ON(host->clk_requests > 1); |
| 237 | } | 237 | } |
diff --git a/drivers/mmc/core/host.h b/drivers/mmc/core/host.h index de199f911928..fb8a5cd2e4a1 100644 --- a/drivers/mmc/core/host.h +++ b/drivers/mmc/core/host.h | |||
| @@ -16,16 +16,16 @@ int mmc_register_host_class(void); | |||
| 16 | void mmc_unregister_host_class(void); | 16 | void mmc_unregister_host_class(void); |
| 17 | 17 | ||
| 18 | #ifdef CONFIG_MMC_CLKGATE | 18 | #ifdef CONFIG_MMC_CLKGATE |
| 19 | void mmc_host_clk_ungate(struct mmc_host *host); | 19 | void mmc_host_clk_hold(struct mmc_host *host); |
| 20 | void mmc_host_clk_gate(struct mmc_host *host); | 20 | void mmc_host_clk_release(struct mmc_host *host); |
| 21 | unsigned int mmc_host_clk_rate(struct mmc_host *host); | 21 | unsigned int mmc_host_clk_rate(struct mmc_host *host); |
| 22 | 22 | ||
| 23 | #else | 23 | #else |
| 24 | static inline void mmc_host_clk_ungate(struct mmc_host *host) | 24 | static inline void mmc_host_clk_hold(struct mmc_host *host) |
| 25 | { | 25 | { |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | static inline void mmc_host_clk_gate(struct mmc_host *host) | 28 | static inline void mmc_host_clk_release(struct mmc_host *host) |
| 29 | { | 29 | { |
| 30 | } | 30 | } |
| 31 | 31 | ||
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 633975ff2bb3..0370e03e3142 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c | |||
| @@ -469,56 +469,75 @@ static int sd_select_driver_type(struct mmc_card *card, u8 *status) | |||
| 469 | return 0; | 469 | return 0; |
| 470 | } | 470 | } |
| 471 | 471 | ||
| 472 | static int sd_set_bus_speed_mode(struct mmc_card *card, u8 *status) | 472 | static void sd_update_bus_speed_mode(struct mmc_card *card) |
| 473 | { | 473 | { |
| 474 | unsigned int bus_speed = 0, timing = 0; | ||
| 475 | int err; | ||
| 476 | |||
| 477 | /* | 474 | /* |
| 478 | * If the host doesn't support any of the UHS-I modes, fallback on | 475 | * If the host doesn't support any of the UHS-I modes, fallback on |
| 479 | * default speed. | 476 | * default speed. |
| 480 | */ | 477 | */ |
| 481 | if (!(card->host->caps & (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | | 478 | if (!(card->host->caps & (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | |
| 482 | MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 | MMC_CAP_UHS_DDR50))) | 479 | MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 | MMC_CAP_UHS_DDR50))) { |
| 483 | return 0; | 480 | card->sd_bus_speed = 0; |
| 481 | return; | ||
| 482 | } | ||
| 484 | 483 | ||
| 485 | if ((card->host->caps & MMC_CAP_UHS_SDR104) && | 484 | if ((card->host->caps & MMC_CAP_UHS_SDR104) && |
| 486 | (card->sw_caps.sd3_bus_mode & SD_MODE_UHS_SDR104)) { | 485 | (card->sw_caps.sd3_bus_mode & SD_MODE_UHS_SDR104)) { |
| 487 | bus_speed = UHS_SDR104_BUS_SPEED; | 486 | card->sd_bus_speed = UHS_SDR104_BUS_SPEED; |
| 488 | timing = MMC_TIMING_UHS_SDR104; | ||
| 489 | card->sw_caps.uhs_max_dtr = UHS_SDR104_MAX_DTR; | ||
| 490 | } else if ((card->host->caps & MMC_CAP_UHS_DDR50) && | 487 | } else if ((card->host->caps & MMC_CAP_UHS_DDR50) && |
| 491 | (card->sw_caps.sd3_bus_mode & SD_MODE_UHS_DDR50)) { | 488 | (card->sw_caps.sd3_bus_mode & SD_MODE_UHS_DDR50)) { |
| 492 | bus_speed = UHS_DDR50_BUS_SPEED; | 489 | card->sd_bus_speed = UHS_DDR50_BUS_SPEED; |
| 493 | timing = MMC_TIMING_UHS_DDR50; | ||
| 494 | card->sw_caps.uhs_max_dtr = UHS_DDR50_MAX_DTR; | ||
| 495 | } else if ((card->host->caps & (MMC_CAP_UHS_SDR104 | | 490 | } else if ((card->host->caps & (MMC_CAP_UHS_SDR104 | |
| 496 | MMC_CAP_UHS_SDR50)) && (card->sw_caps.sd3_bus_mode & | 491 | MMC_CAP_UHS_SDR50)) && (card->sw_caps.sd3_bus_mode & |
| 497 | SD_MODE_UHS_SDR50)) { | 492 | SD_MODE_UHS_SDR50)) { |
| 498 | bus_speed = UHS_SDR50_BUS_SPEED; | 493 | card->sd_bus_speed = UHS_SDR50_BUS_SPEED; |
| 499 | timing = MMC_TIMING_UHS_SDR50; | ||
| 500 | card->sw_caps.uhs_max_dtr = UHS_SDR50_MAX_DTR; | ||
| 501 | } else if ((card->host->caps & (MMC_CAP_UHS_SDR104 | | 494 | } else if ((card->host->caps & (MMC_CAP_UHS_SDR104 | |
| 502 | MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR25)) && | 495 | MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR25)) && |
| 503 | (card->sw_caps.sd3_bus_mode & SD_MODE_UHS_SDR25)) { | 496 | (card->sw_caps.sd3_bus_mode & SD_MODE_UHS_SDR25)) { |
| 504 | bus_speed = UHS_SDR25_BUS_SPEED; | 497 | card->sd_bus_speed = UHS_SDR25_BUS_SPEED; |
| 505 | timing = MMC_TIMING_UHS_SDR25; | ||
| 506 | card->sw_caps.uhs_max_dtr = UHS_SDR25_MAX_DTR; | ||
| 507 | } else if ((card->host->caps & (MMC_CAP_UHS_SDR104 | | 498 | } else if ((card->host->caps & (MMC_CAP_UHS_SDR104 | |
| 508 | MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR25 | | 499 | MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR25 | |
| 509 | MMC_CAP_UHS_SDR12)) && (card->sw_caps.sd3_bus_mode & | 500 | MMC_CAP_UHS_SDR12)) && (card->sw_caps.sd3_bus_mode & |
| 510 | SD_MODE_UHS_SDR12)) { | 501 | SD_MODE_UHS_SDR12)) { |
| 511 | bus_speed = UHS_SDR12_BUS_SPEED; | 502 | card->sd_bus_speed = UHS_SDR12_BUS_SPEED; |
| 512 | timing = MMC_TIMING_UHS_SDR12; | 503 | } |
| 513 | card->sw_caps.uhs_max_dtr = UHS_SDR12_MAX_DTR; | 504 | } |
| 505 | |||
| 506 | static int sd_set_bus_speed_mode(struct mmc_card *card, u8 *status) | ||
| 507 | { | ||
| 508 | int err; | ||
| 509 | unsigned int timing = 0; | ||
| 510 | |||
| 511 | switch (card->sd_bus_speed) { | ||
| 512 | case UHS_SDR104_BUS_SPEED: | ||
| 513 | timing = MMC_TIMING_UHS_SDR104; | ||
| 514 | card->sw_caps.uhs_max_dtr = UHS_SDR104_MAX_DTR; | ||
| 515 | break; | ||
| 516 | case UHS_DDR50_BUS_SPEED: | ||
| 517 | timing = MMC_TIMING_UHS_DDR50; | ||
| 518 | card->sw_caps.uhs_max_dtr = UHS_DDR50_MAX_DTR; | ||
| 519 | break; | ||
| 520 | case UHS_SDR50_BUS_SPEED: | ||
| 521 | timing = MMC_TIMING_UHS_SDR50; | ||
| 522 | card->sw_caps.uhs_max_dtr = UHS_SDR50_MAX_DTR; | ||
| 523 | break; | ||
| 524 | case UHS_SDR25_BUS_SPEED: | ||
| 525 | timing = MMC_TIMING_UHS_SDR25; | ||
| 526 | card->sw_caps.uhs_max_dtr = UHS_SDR25_MAX_DTR; | ||
| 527 | break; | ||
| 528 | case UHS_SDR12_BUS_SPEED: | ||
| 529 | timing = MMC_TIMING_UHS_SDR12; | ||
| 530 | card->sw_caps.uhs_max_dtr = UHS_SDR12_MAX_DTR; | ||
| 531 | break; | ||
| 532 | default: | ||
| 533 | return 0; | ||
| 514 | } | 534 | } |
| 515 | 535 | ||
| 516 | card->sd_bus_speed = bus_speed; | 536 | err = mmc_sd_switch(card, 1, 0, card->sd_bus_speed, status); |
| 517 | err = mmc_sd_switch(card, 1, 0, bus_speed, status); | ||
| 518 | if (err) | 537 | if (err) |
| 519 | return err; | 538 | return err; |
| 520 | 539 | ||
| 521 | if ((status[16] & 0xF) != bus_speed) | 540 | if ((status[16] & 0xF) != card->sd_bus_speed) |
| 522 | printk(KERN_WARNING "%s: Problem setting bus speed mode!\n", | 541 | printk(KERN_WARNING "%s: Problem setting bus speed mode!\n", |
| 523 | mmc_hostname(card->host)); | 542 | mmc_hostname(card->host)); |
| 524 | else { | 543 | else { |
| @@ -618,18 +637,24 @@ static int mmc_sd_init_uhs_card(struct mmc_card *card) | |||
| 618 | mmc_set_bus_width(card->host, MMC_BUS_WIDTH_4); | 637 | mmc_set_bus_width(card->host, MMC_BUS_WIDTH_4); |
| 619 | } | 638 | } |
| 620 | 639 | ||
| 640 | /* | ||
| 641 | * Select the bus speed mode depending on host | ||
| 642 | * and card capability. | ||
| 643 | */ | ||
| 644 | sd_update_bus_speed_mode(card); | ||
| 645 | |||
| 621 | /* Set the driver strength for the card */ | 646 | /* Set the driver strength for the card */ |
| 622 | err = sd_select_driver_type(card, status); | 647 | err = sd_select_driver_type(card, status); |
| 623 | if (err) | 648 | if (err) |
| 624 | goto out; | 649 | goto out; |
| 625 | 650 | ||
| 626 | /* Set bus speed mode of the card */ | 651 | /* Set current limit for the card */ |
| 627 | err = sd_set_bus_speed_mode(card, status); | 652 | err = sd_set_current_limit(card, status); |
| 628 | if (err) | 653 | if (err) |
| 629 | goto out; | 654 | goto out; |
| 630 | 655 | ||
| 631 | /* Set current limit for the card */ | 656 | /* Set bus speed mode of the card */ |
| 632 | err = sd_set_current_limit(card, status); | 657 | err = sd_set_bus_speed_mode(card, status); |
| 633 | if (err) | 658 | if (err) |
| 634 | goto out; | 659 | goto out; |
| 635 | 660 | ||
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 0e9780f5a4a9..4dc0028086a3 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <linux/err.h> | 16 | #include <linux/err.h> |
| 17 | #include <linux/clk.h> | 17 | #include <linux/clk.h> |
| 18 | #include <linux/gpio.h> | 18 | #include <linux/gpio.h> |
| 19 | #include <linux/module.h> | ||
| 19 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
| 20 | #include <linux/mmc/host.h> | 21 | #include <linux/mmc/host.h> |
| 21 | #include <linux/mmc/mmc.h> | 22 | #include <linux/mmc/mmc.h> |
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c index 2bd7bf4fece7..fe886d6c474a 100644 --- a/drivers/mmc/host/sdhci-s3c.c +++ b/drivers/mmc/host/sdhci-s3c.c | |||
| @@ -302,6 +302,8 @@ static int sdhci_s3c_platform_8bit_width(struct sdhci_host *host, int width) | |||
| 302 | ctrl &= ~SDHCI_CTRL_8BITBUS; | 302 | ctrl &= ~SDHCI_CTRL_8BITBUS; |
| 303 | break; | 303 | break; |
| 304 | default: | 304 | default: |
| 305 | ctrl &= ~SDHCI_CTRL_4BITBUS; | ||
| 306 | ctrl &= ~SDHCI_CTRL_8BITBUS; | ||
| 305 | break; | 307 | break; |
| 306 | } | 308 | } |
| 307 | 309 | ||
diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c index 774f6439d7ce..0c4a672f5db6 100644 --- a/drivers/mmc/host/sh_mobile_sdhi.c +++ b/drivers/mmc/host/sh_mobile_sdhi.c | |||
| @@ -120,11 +120,11 @@ static int __devinit sh_mobile_sdhi_probe(struct platform_device *pdev) | |||
| 120 | mmc_data->hclk = clk_get_rate(priv->clk); | 120 | mmc_data->hclk = clk_get_rate(priv->clk); |
| 121 | mmc_data->set_pwr = sh_mobile_sdhi_set_pwr; | 121 | mmc_data->set_pwr = sh_mobile_sdhi_set_pwr; |
| 122 | mmc_data->get_cd = sh_mobile_sdhi_get_cd; | 122 | mmc_data->get_cd = sh_mobile_sdhi_get_cd; |
| 123 | if (mmc_data->flags & TMIO_MMC_HAS_IDLE_WAIT) | ||
| 124 | mmc_data->write16_hook = sh_mobile_sdhi_write16_hook; | ||
| 125 | mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED; | 123 | mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED; |
| 126 | if (p) { | 124 | if (p) { |
| 127 | mmc_data->flags = p->tmio_flags; | 125 | mmc_data->flags = p->tmio_flags; |
| 126 | if (mmc_data->flags & TMIO_MMC_HAS_IDLE_WAIT) | ||
| 127 | mmc_data->write16_hook = sh_mobile_sdhi_write16_hook; | ||
| 128 | mmc_data->ocr_mask = p->tmio_ocr_mask; | 128 | mmc_data->ocr_mask = p->tmio_ocr_mask; |
| 129 | mmc_data->capabilities |= p->tmio_caps; | 129 | mmc_data->capabilities |= p->tmio_caps; |
| 130 | 130 | ||
diff --git a/drivers/mtd/ubi/debug.h b/drivers/mtd/ubi/debug.h index 65b5b76cc379..64fbb0021825 100644 --- a/drivers/mtd/ubi/debug.h +++ b/drivers/mtd/ubi/debug.h | |||
| @@ -181,7 +181,7 @@ static inline int ubi_dbg_is_erase_failure(const struct ubi_device *ubi) | |||
| 181 | 181 | ||
| 182 | #define ubi_dbg_msg(fmt, ...) do { \ | 182 | #define ubi_dbg_msg(fmt, ...) do { \ |
| 183 | if (0) \ | 183 | if (0) \ |
| 184 | pr_debug(fmt "\n", ##__VA_ARGS__); \ | 184 | printk(KERN_DEBUG fmt "\n", ##__VA_ARGS__); \ |
| 185 | } while (0) | 185 | } while (0) |
| 186 | 186 | ||
| 187 | #define dbg_msg(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__) | 187 | #define dbg_msg(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__) |
diff --git a/drivers/net/arm/am79c961a.c b/drivers/net/arm/am79c961a.c index 52fe21e1e2cd..3b1416e3d217 100644 --- a/drivers/net/arm/am79c961a.c +++ b/drivers/net/arm/am79c961a.c | |||
| @@ -308,8 +308,11 @@ static void am79c961_timer(unsigned long data) | |||
| 308 | struct net_device *dev = (struct net_device *)data; | 308 | struct net_device *dev = (struct net_device *)data; |
| 309 | struct dev_priv *priv = netdev_priv(dev); | 309 | struct dev_priv *priv = netdev_priv(dev); |
| 310 | unsigned int lnkstat, carrier; | 310 | unsigned int lnkstat, carrier; |
| 311 | unsigned long flags; | ||
| 311 | 312 | ||
| 313 | spin_lock_irqsave(&priv->chip_lock, flags); | ||
| 312 | lnkstat = read_ireg(dev->base_addr, ISALED0) & ISALED0_LNKST; | 314 | lnkstat = read_ireg(dev->base_addr, ISALED0) & ISALED0_LNKST; |
| 315 | spin_unlock_irqrestore(&priv->chip_lock, flags); | ||
| 313 | carrier = netif_carrier_ok(dev); | 316 | carrier = netif_carrier_ok(dev); |
| 314 | 317 | ||
| 315 | if (lnkstat && !carrier) { | 318 | if (lnkstat && !carrier) { |
diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c index f7bbde9eb2cb..a81249246ece 100644 --- a/drivers/net/can/ti_hecc.c +++ b/drivers/net/can/ti_hecc.c | |||
| @@ -503,9 +503,9 @@ static netdev_tx_t ti_hecc_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
| 503 | spin_unlock_irqrestore(&priv->mbx_lock, flags); | 503 | spin_unlock_irqrestore(&priv->mbx_lock, flags); |
| 504 | 504 | ||
| 505 | /* Prepare mailbox for transmission */ | 505 | /* Prepare mailbox for transmission */ |
| 506 | data = cf->can_dlc | (get_tx_head_prio(priv) << 8); | ||
| 506 | if (cf->can_id & CAN_RTR_FLAG) /* Remote transmission request */ | 507 | if (cf->can_id & CAN_RTR_FLAG) /* Remote transmission request */ |
| 507 | data |= HECC_CANMCF_RTR; | 508 | data |= HECC_CANMCF_RTR; |
| 508 | data |= get_tx_head_prio(priv) << 8; | ||
| 509 | hecc_write_mbx(priv, mbxno, HECC_CANMCF, data); | 509 | hecc_write_mbx(priv, mbxno, HECC_CANMCF, data); |
| 510 | 510 | ||
| 511 | if (cf->can_id & CAN_EFF_FLAG) /* Extended frame format */ | 511 | if (cf->can_id & CAN_EFF_FLAG) /* Extended frame format */ |
| @@ -923,6 +923,7 @@ static int ti_hecc_probe(struct platform_device *pdev) | |||
| 923 | priv->can.do_get_state = ti_hecc_get_state; | 923 | priv->can.do_get_state = ti_hecc_get_state; |
| 924 | priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES; | 924 | priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES; |
| 925 | 925 | ||
| 926 | spin_lock_init(&priv->mbx_lock); | ||
| 926 | ndev->irq = irq->start; | 927 | ndev->irq = irq->start; |
| 927 | ndev->flags |= IFF_ECHO; | 928 | ndev->flags |= IFF_ECHO; |
| 928 | platform_set_drvdata(pdev, ndev); | 929 | platform_set_drvdata(pdev, ndev); |
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c index 646c86bcc545..fdb7a1756409 100644 --- a/drivers/net/cassini.c +++ b/drivers/net/cassini.c | |||
| @@ -2452,14 +2452,13 @@ static irqreturn_t cas_interruptN(int irq, void *dev_id) | |||
| 2452 | struct net_device *dev = dev_id; | 2452 | struct net_device *dev = dev_id; |
| 2453 | struct cas *cp = netdev_priv(dev); | 2453 | struct cas *cp = netdev_priv(dev); |
| 2454 | unsigned long flags; | 2454 | unsigned long flags; |
| 2455 | int ring; | 2455 | int ring = (irq == cp->pci_irq_INTC) ? 2 : 3; |
| 2456 | u32 status = readl(cp->regs + REG_PLUS_INTRN_STATUS(ring)); | 2456 | u32 status = readl(cp->regs + REG_PLUS_INTRN_STATUS(ring)); |
| 2457 | 2457 | ||
| 2458 | /* check for shared irq */ | 2458 | /* check for shared irq */ |
| 2459 | if (status == 0) | 2459 | if (status == 0) |
| 2460 | return IRQ_NONE; | 2460 | return IRQ_NONE; |
| 2461 | 2461 | ||
| 2462 | ring = (irq == cp->pci_irq_INTC) ? 2 : 3; | ||
| 2463 | spin_lock_irqsave(&cp->lock, flags); | 2462 | spin_lock_irqsave(&cp->lock, flags); |
| 2464 | if (status & INTR_RX_DONE_ALT) { /* handle rx separately */ | 2463 | if (status & INTR_RX_DONE_ALT) { /* handle rx separately */ |
| 2465 | #ifdef USE_NAPI | 2464 | #ifdef USE_NAPI |
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index ba99af05bf62..3e6679269400 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c | |||
| @@ -395,7 +395,7 @@ static inline struct sk_buff *ibmveth_rxq_get_buffer(struct ibmveth_adapter *ada | |||
| 395 | } | 395 | } |
| 396 | 396 | ||
| 397 | /* recycle the current buffer on the rx queue */ | 397 | /* recycle the current buffer on the rx queue */ |
| 398 | static void ibmveth_rxq_recycle_buffer(struct ibmveth_adapter *adapter) | 398 | static int ibmveth_rxq_recycle_buffer(struct ibmveth_adapter *adapter) |
| 399 | { | 399 | { |
| 400 | u32 q_index = adapter->rx_queue.index; | 400 | u32 q_index = adapter->rx_queue.index; |
| 401 | u64 correlator = adapter->rx_queue.queue_addr[q_index].correlator; | 401 | u64 correlator = adapter->rx_queue.queue_addr[q_index].correlator; |
| @@ -403,6 +403,7 @@ static void ibmveth_rxq_recycle_buffer(struct ibmveth_adapter *adapter) | |||
| 403 | unsigned int index = correlator & 0xffffffffUL; | 403 | unsigned int index = correlator & 0xffffffffUL; |
| 404 | union ibmveth_buf_desc desc; | 404 | union ibmveth_buf_desc desc; |
| 405 | unsigned long lpar_rc; | 405 | unsigned long lpar_rc; |
| 406 | int ret = 1; | ||
| 406 | 407 | ||
| 407 | BUG_ON(pool >= IBMVETH_NUM_BUFF_POOLS); | 408 | BUG_ON(pool >= IBMVETH_NUM_BUFF_POOLS); |
| 408 | BUG_ON(index >= adapter->rx_buff_pool[pool].size); | 409 | BUG_ON(index >= adapter->rx_buff_pool[pool].size); |
| @@ -410,7 +411,7 @@ static void ibmveth_rxq_recycle_buffer(struct ibmveth_adapter *adapter) | |||
| 410 | if (!adapter->rx_buff_pool[pool].active) { | 411 | if (!adapter->rx_buff_pool[pool].active) { |
| 411 | ibmveth_rxq_harvest_buffer(adapter); | 412 | ibmveth_rxq_harvest_buffer(adapter); |
| 412 | ibmveth_free_buffer_pool(adapter, &adapter->rx_buff_pool[pool]); | 413 | ibmveth_free_buffer_pool(adapter, &adapter->rx_buff_pool[pool]); |
| 413 | return; | 414 | goto out; |
| 414 | } | 415 | } |
| 415 | 416 | ||
| 416 | desc.fields.flags_len = IBMVETH_BUF_VALID | | 417 | desc.fields.flags_len = IBMVETH_BUF_VALID | |
| @@ -423,12 +424,16 @@ static void ibmveth_rxq_recycle_buffer(struct ibmveth_adapter *adapter) | |||
| 423 | netdev_dbg(adapter->netdev, "h_add_logical_lan_buffer failed " | 424 | netdev_dbg(adapter->netdev, "h_add_logical_lan_buffer failed " |
| 424 | "during recycle rc=%ld", lpar_rc); | 425 | "during recycle rc=%ld", lpar_rc); |
| 425 | ibmveth_remove_buffer_from_pool(adapter, adapter->rx_queue.queue_addr[adapter->rx_queue.index].correlator); | 426 | ibmveth_remove_buffer_from_pool(adapter, adapter->rx_queue.queue_addr[adapter->rx_queue.index].correlator); |
| 427 | ret = 0; | ||
| 426 | } | 428 | } |
| 427 | 429 | ||
| 428 | if (++adapter->rx_queue.index == adapter->rx_queue.num_slots) { | 430 | if (++adapter->rx_queue.index == adapter->rx_queue.num_slots) { |
| 429 | adapter->rx_queue.index = 0; | 431 | adapter->rx_queue.index = 0; |
| 430 | adapter->rx_queue.toggle = !adapter->rx_queue.toggle; | 432 | adapter->rx_queue.toggle = !adapter->rx_queue.toggle; |
| 431 | } | 433 | } |
| 434 | |||
| 435 | out: | ||
| 436 | return ret; | ||
| 432 | } | 437 | } |
| 433 | 438 | ||
| 434 | static void ibmveth_rxq_harvest_buffer(struct ibmveth_adapter *adapter) | 439 | static void ibmveth_rxq_harvest_buffer(struct ibmveth_adapter *adapter) |
| @@ -1084,8 +1089,9 @@ restart_poll: | |||
| 1084 | if (rx_flush) | 1089 | if (rx_flush) |
| 1085 | ibmveth_flush_buffer(skb->data, | 1090 | ibmveth_flush_buffer(skb->data, |
| 1086 | length + offset); | 1091 | length + offset); |
| 1092 | if (!ibmveth_rxq_recycle_buffer(adapter)) | ||
| 1093 | kfree_skb(skb); | ||
| 1087 | skb = new_skb; | 1094 | skb = new_skb; |
| 1088 | ibmveth_rxq_recycle_buffer(adapter); | ||
| 1089 | } else { | 1095 | } else { |
| 1090 | ibmveth_rxq_harvest_buffer(adapter); | 1096 | ibmveth_rxq_harvest_buffer(adapter); |
| 1091 | skb_reserve(skb, offset); | 1097 | skb_reserve(skb, offset); |
diff --git a/drivers/net/phy/national.c b/drivers/net/phy/national.c index 0620ba963508..04bb8fcc0cb5 100644 --- a/drivers/net/phy/national.c +++ b/drivers/net/phy/national.c | |||
| @@ -25,8 +25,9 @@ | |||
| 25 | /* DP83865 phy identifier values */ | 25 | /* DP83865 phy identifier values */ |
| 26 | #define DP83865_PHY_ID 0x20005c7a | 26 | #define DP83865_PHY_ID 0x20005c7a |
| 27 | 27 | ||
| 28 | #define DP83865_INT_MASK_REG 0x15 | 28 | #define DP83865_INT_STATUS 0x14 |
| 29 | #define DP83865_INT_MASK_STATUS 0x14 | 29 | #define DP83865_INT_MASK 0x15 |
| 30 | #define DP83865_INT_CLEAR 0x17 | ||
| 30 | 31 | ||
| 31 | #define DP83865_INT_REMOTE_FAULT 0x0008 | 32 | #define DP83865_INT_REMOTE_FAULT 0x0008 |
| 32 | #define DP83865_INT_ANE_COMPLETED 0x0010 | 33 | #define DP83865_INT_ANE_COMPLETED 0x0010 |
| @@ -68,21 +69,25 @@ static int ns_config_intr(struct phy_device *phydev) | |||
| 68 | int err; | 69 | int err; |
| 69 | 70 | ||
| 70 | if (phydev->interrupts == PHY_INTERRUPT_ENABLED) | 71 | if (phydev->interrupts == PHY_INTERRUPT_ENABLED) |
| 71 | err = phy_write(phydev, DP83865_INT_MASK_REG, | 72 | err = phy_write(phydev, DP83865_INT_MASK, |
| 72 | DP83865_INT_MASK_DEFAULT); | 73 | DP83865_INT_MASK_DEFAULT); |
| 73 | else | 74 | else |
| 74 | err = phy_write(phydev, DP83865_INT_MASK_REG, 0); | 75 | err = phy_write(phydev, DP83865_INT_MASK, 0); |
| 75 | 76 | ||
| 76 | return err; | 77 | return err; |
| 77 | } | 78 | } |
| 78 | 79 | ||
| 79 | static int ns_ack_interrupt(struct phy_device *phydev) | 80 | static int ns_ack_interrupt(struct phy_device *phydev) |
| 80 | { | 81 | { |
| 81 | int ret = phy_read(phydev, DP83865_INT_MASK_STATUS); | 82 | int ret = phy_read(phydev, DP83865_INT_STATUS); |
| 82 | if (ret < 0) | 83 | if (ret < 0) |
| 83 | return ret; | 84 | return ret; |
| 84 | 85 | ||
| 85 | return 0; | 86 | /* Clear the interrupt status bit by writing a “1” |
| 87 | * to the corresponding bit in INT_CLEAR (2:0 are reserved) */ | ||
| 88 | ret = phy_write(phydev, DP83865_INT_CLEAR, ret & ~0x7); | ||
| 89 | |||
| 90 | return ret; | ||
| 86 | } | 91 | } |
| 87 | 92 | ||
| 88 | static void ns_giga_speed_fallback(struct phy_device *phydev, int mode) | 93 | static void ns_giga_speed_fallback(struct phy_device *phydev, int mode) |
diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c index 86ac38c96bcf..3bb131137033 100644 --- a/drivers/net/rionet.c +++ b/drivers/net/rionet.c | |||
| @@ -80,13 +80,13 @@ static int rionet_capable = 1; | |||
| 80 | */ | 80 | */ |
| 81 | static struct rio_dev **rionet_active; | 81 | static struct rio_dev **rionet_active; |
| 82 | 82 | ||
| 83 | #define is_rionet_capable(pef, src_ops, dst_ops) \ | 83 | #define is_rionet_capable(src_ops, dst_ops) \ |
| 84 | ((pef & RIO_PEF_INB_MBOX) && \ | 84 | ((src_ops & RIO_SRC_OPS_DATA_MSG) && \ |
| 85 | (pef & RIO_PEF_INB_DOORBELL) && \ | 85 | (dst_ops & RIO_DST_OPS_DATA_MSG) && \ |
| 86 | (src_ops & RIO_SRC_OPS_DOORBELL) && \ | 86 | (src_ops & RIO_SRC_OPS_DOORBELL) && \ |
| 87 | (dst_ops & RIO_DST_OPS_DOORBELL)) | 87 | (dst_ops & RIO_DST_OPS_DOORBELL)) |
| 88 | #define dev_rionet_capable(dev) \ | 88 | #define dev_rionet_capable(dev) \ |
| 89 | is_rionet_capable(dev->pef, dev->src_ops, dev->dst_ops) | 89 | is_rionet_capable(dev->src_ops, dev->dst_ops) |
| 90 | 90 | ||
| 91 | #define RIONET_MAC_MATCH(x) (*(u32 *)x == 0x00010001) | 91 | #define RIONET_MAC_MATCH(x) (*(u32 *)x == 0x00010001) |
| 92 | #define RIONET_GET_DESTID(x) (*(u16 *)(x + 4)) | 92 | #define RIONET_GET_DESTID(x) (*(u16 *)(x + 4)) |
| @@ -282,7 +282,6 @@ static int rionet_open(struct net_device *ndev) | |||
| 282 | { | 282 | { |
| 283 | int i, rc = 0; | 283 | int i, rc = 0; |
| 284 | struct rionet_peer *peer, *tmp; | 284 | struct rionet_peer *peer, *tmp; |
| 285 | u32 pwdcsr; | ||
| 286 | struct rionet_private *rnet = netdev_priv(ndev); | 285 | struct rionet_private *rnet = netdev_priv(ndev); |
| 287 | 286 | ||
| 288 | if (netif_msg_ifup(rnet)) | 287 | if (netif_msg_ifup(rnet)) |
| @@ -332,13 +331,8 @@ static int rionet_open(struct net_device *ndev) | |||
| 332 | continue; | 331 | continue; |
| 333 | } | 332 | } |
| 334 | 333 | ||
| 335 | /* | 334 | /* Send a join message */ |
| 336 | * If device has initialized inbound doorbells, | 335 | rio_send_doorbell(peer->rdev, RIONET_DOORBELL_JOIN); |
| 337 | * send a join message | ||
| 338 | */ | ||
| 339 | rio_read_config_32(peer->rdev, RIO_WRITE_PORT_CSR, &pwdcsr); | ||
| 340 | if (pwdcsr & RIO_DOORBELL_AVAIL) | ||
| 341 | rio_send_doorbell(peer->rdev, RIONET_DOORBELL_JOIN); | ||
| 342 | } | 336 | } |
| 343 | 337 | ||
| 344 | out: | 338 | out: |
| @@ -492,7 +486,7 @@ static int rionet_setup_netdev(struct rio_mport *mport, struct net_device *ndev) | |||
| 492 | static int rionet_probe(struct rio_dev *rdev, const struct rio_device_id *id) | 486 | static int rionet_probe(struct rio_dev *rdev, const struct rio_device_id *id) |
| 493 | { | 487 | { |
| 494 | int rc = -ENODEV; | 488 | int rc = -ENODEV; |
| 495 | u32 lpef, lsrc_ops, ldst_ops; | 489 | u32 lsrc_ops, ldst_ops; |
| 496 | struct rionet_peer *peer; | 490 | struct rionet_peer *peer; |
| 497 | struct net_device *ndev = NULL; | 491 | struct net_device *ndev = NULL; |
| 498 | 492 | ||
| @@ -515,12 +509,11 @@ static int rionet_probe(struct rio_dev *rdev, const struct rio_device_id *id) | |||
| 515 | * on later probes | 509 | * on later probes |
| 516 | */ | 510 | */ |
| 517 | if (!rionet_check) { | 511 | if (!rionet_check) { |
| 518 | rio_local_read_config_32(rdev->net->hport, RIO_PEF_CAR, &lpef); | ||
| 519 | rio_local_read_config_32(rdev->net->hport, RIO_SRC_OPS_CAR, | 512 | rio_local_read_config_32(rdev->net->hport, RIO_SRC_OPS_CAR, |
| 520 | &lsrc_ops); | 513 | &lsrc_ops); |
| 521 | rio_local_read_config_32(rdev->net->hport, RIO_DST_OPS_CAR, | 514 | rio_local_read_config_32(rdev->net->hport, RIO_DST_OPS_CAR, |
| 522 | &ldst_ops); | 515 | &ldst_ops); |
| 523 | if (!is_rionet_capable(lpef, lsrc_ops, ldst_ops)) { | 516 | if (!is_rionet_capable(lsrc_ops, ldst_ops)) { |
| 524 | printk(KERN_ERR | 517 | printk(KERN_ERR |
| 525 | "%s: local device is not network capable\n", | 518 | "%s: local device is not network capable\n", |
| 526 | DRV_NAME); | 519 | DRV_NAME); |
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index 190f619e4215..1c1666e99106 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | #include <linux/phy.h> | 31 | #include <linux/phy.h> |
| 32 | #include <linux/cache.h> | 32 | #include <linux/cache.h> |
| 33 | #include <linux/io.h> | 33 | #include <linux/io.h> |
| 34 | #include <linux/interrupt.h> | ||
| 34 | #include <linux/pm_runtime.h> | 35 | #include <linux/pm_runtime.h> |
| 35 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
| 36 | #include <linux/ethtool.h> | 37 | #include <linux/ethtool.h> |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c index c34bef1bf2b0..1b9400371eaf 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | |||
| @@ -69,7 +69,7 @@ static int ar9003_hw_power_interpolate(int32_t x, | |||
| 69 | static const struct ar9300_eeprom ar9300_default = { | 69 | static const struct ar9300_eeprom ar9300_default = { |
| 70 | .eepromVersion = 2, | 70 | .eepromVersion = 2, |
| 71 | .templateVersion = 2, | 71 | .templateVersion = 2, |
| 72 | .macAddr = {1, 2, 3, 4, 5, 6}, | 72 | .macAddr = {0, 2, 3, 4, 5, 6}, |
| 73 | .custData = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 73 | .custData = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 74 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, | 74 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, |
| 75 | .baseEepHeader = { | 75 | .baseEepHeader = { |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 9098aaad97a9..6530694a59ae 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
| @@ -2283,7 +2283,11 @@ static void ath9k_set_coverage_class(struct ieee80211_hw *hw, u8 coverage_class) | |||
| 2283 | 2283 | ||
| 2284 | mutex_lock(&sc->mutex); | 2284 | mutex_lock(&sc->mutex); |
| 2285 | ah->coverage_class = coverage_class; | 2285 | ah->coverage_class = coverage_class; |
| 2286 | |||
| 2287 | ath9k_ps_wakeup(sc); | ||
| 2286 | ath9k_hw_init_global_settings(ah); | 2288 | ath9k_hw_init_global_settings(ah); |
| 2289 | ath9k_ps_restore(sc); | ||
| 2290 | |||
| 2287 | mutex_unlock(&sc->mutex); | 2291 | mutex_unlock(&sc->mutex); |
| 2288 | } | 2292 | } |
| 2289 | 2293 | ||
diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c index 0122930b14c7..0474e6638d21 100644 --- a/drivers/net/wireless/ath/carl9170/main.c +++ b/drivers/net/wireless/ath/carl9170/main.c | |||
| @@ -1066,8 +1066,10 @@ static int carl9170_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
| 1066 | * the high througput speed in 802.11n networks. | 1066 | * the high througput speed in 802.11n networks. |
| 1067 | */ | 1067 | */ |
| 1068 | 1068 | ||
| 1069 | if (!is_main_vif(ar, vif)) | 1069 | if (!is_main_vif(ar, vif)) { |
| 1070 | mutex_lock(&ar->mutex); | ||
| 1070 | goto err_softw; | 1071 | goto err_softw; |
| 1072 | } | ||
| 1071 | 1073 | ||
| 1072 | /* | 1074 | /* |
| 1073 | * While the hardware supports *catch-all* key, for offloading | 1075 | * While the hardware supports *catch-all* key, for offloading |
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c index 7fbb55c9da82..1e31050dafc9 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c | |||
| @@ -871,18 +871,8 @@ int rt2x00usb_suspend(struct usb_interface *usb_intf, pm_message_t state) | |||
| 871 | { | 871 | { |
| 872 | struct ieee80211_hw *hw = usb_get_intfdata(usb_intf); | 872 | struct ieee80211_hw *hw = usb_get_intfdata(usb_intf); |
| 873 | struct rt2x00_dev *rt2x00dev = hw->priv; | 873 | struct rt2x00_dev *rt2x00dev = hw->priv; |
| 874 | int retval; | ||
| 875 | |||
| 876 | retval = rt2x00lib_suspend(rt2x00dev, state); | ||
| 877 | if (retval) | ||
| 878 | return retval; | ||
| 879 | 874 | ||
| 880 | /* | 875 | return rt2x00lib_suspend(rt2x00dev, state); |
| 881 | * Decrease usbdev refcount. | ||
| 882 | */ | ||
| 883 | usb_put_dev(interface_to_usbdev(usb_intf)); | ||
| 884 | |||
| 885 | return 0; | ||
| 886 | } | 876 | } |
| 887 | EXPORT_SYMBOL_GPL(rt2x00usb_suspend); | 877 | EXPORT_SYMBOL_GPL(rt2x00usb_suspend); |
| 888 | 878 | ||
| @@ -891,8 +881,6 @@ int rt2x00usb_resume(struct usb_interface *usb_intf) | |||
| 891 | struct ieee80211_hw *hw = usb_get_intfdata(usb_intf); | 881 | struct ieee80211_hw *hw = usb_get_intfdata(usb_intf); |
| 892 | struct rt2x00_dev *rt2x00dev = hw->priv; | 882 | struct rt2x00_dev *rt2x00dev = hw->priv; |
| 893 | 883 | ||
| 894 | usb_get_dev(interface_to_usbdev(usb_intf)); | ||
| 895 | |||
| 896 | return rt2x00lib_resume(rt2x00dev); | 884 | return rt2x00lib_resume(rt2x00dev); |
| 897 | } | 885 | } |
| 898 | EXPORT_SYMBOL_GPL(rt2x00usb_resume); | 886 | EXPORT_SYMBOL_GPL(rt2x00usb_resume); |
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c index e58c22d21e39..b70ae40ad660 100644 --- a/drivers/net/wireless/wl12xx/main.c +++ b/drivers/net/wireless/wl12xx/main.c | |||
| @@ -4283,6 +4283,7 @@ int wl1271_init_ieee80211(struct wl1271 *wl) | |||
| 4283 | wl->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | | 4283 | wl->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | |
| 4284 | BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP); | 4284 | BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP); |
| 4285 | wl->hw->wiphy->max_scan_ssids = 1; | 4285 | wl->hw->wiphy->max_scan_ssids = 1; |
| 4286 | wl->hw->wiphy->max_sched_scan_ssids = 1; | ||
| 4286 | /* | 4287 | /* |
| 4287 | * Maximum length of elements in scanning probe request templates | 4288 | * Maximum length of elements in scanning probe request templates |
| 4288 | * should be the maximum length possible for a template, without | 4289 | * should be the maximum length possible for a template, without |
diff --git a/drivers/net/wireless/wl12xx/sdio.c b/drivers/net/wireless/wl12xx/sdio.c index 5cf18c2c23f0..fb1fd5af75ea 100644 --- a/drivers/net/wireless/wl12xx/sdio.c +++ b/drivers/net/wireless/wl12xx/sdio.c | |||
| @@ -164,7 +164,7 @@ static int wl1271_sdio_power_on(struct wl1271 *wl) | |||
| 164 | /* If enabled, tell runtime PM not to power off the card */ | 164 | /* If enabled, tell runtime PM not to power off the card */ |
| 165 | if (pm_runtime_enabled(&func->dev)) { | 165 | if (pm_runtime_enabled(&func->dev)) { |
| 166 | ret = pm_runtime_get_sync(&func->dev); | 166 | ret = pm_runtime_get_sync(&func->dev); |
| 167 | if (ret) | 167 | if (ret < 0) |
| 168 | goto out; | 168 | goto out; |
| 169 | } else { | 169 | } else { |
| 170 | /* Runtime PM is disabled: power up the card manually */ | 170 | /* Runtime PM is disabled: power up the card manually */ |
diff --git a/drivers/net/wireless/wl12xx/testmode.c b/drivers/net/wireless/wl12xx/testmode.c index 88add68bd9ac..4ae8effaee22 100644 --- a/drivers/net/wireless/wl12xx/testmode.c +++ b/drivers/net/wireless/wl12xx/testmode.c | |||
| @@ -36,7 +36,6 @@ enum wl1271_tm_commands { | |||
| 36 | WL1271_TM_CMD_TEST, | 36 | WL1271_TM_CMD_TEST, |
| 37 | WL1271_TM_CMD_INTERROGATE, | 37 | WL1271_TM_CMD_INTERROGATE, |
| 38 | WL1271_TM_CMD_CONFIGURE, | 38 | WL1271_TM_CMD_CONFIGURE, |
| 39 | WL1271_TM_CMD_NVS_PUSH, | ||
| 40 | WL1271_TM_CMD_SET_PLT_MODE, | 39 | WL1271_TM_CMD_SET_PLT_MODE, |
| 41 | WL1271_TM_CMD_RECOVER, | 40 | WL1271_TM_CMD_RECOVER, |
| 42 | 41 | ||
| @@ -190,48 +189,6 @@ static int wl1271_tm_cmd_configure(struct wl1271 *wl, struct nlattr *tb[]) | |||
| 190 | return 0; | 189 | return 0; |
| 191 | } | 190 | } |
| 192 | 191 | ||
| 193 | static int wl1271_tm_cmd_nvs_push(struct wl1271 *wl, struct nlattr *tb[]) | ||
| 194 | { | ||
| 195 | int ret = 0; | ||
| 196 | size_t len; | ||
| 197 | void *buf; | ||
| 198 | |||
| 199 | wl1271_debug(DEBUG_TESTMODE, "testmode cmd nvs push"); | ||
| 200 | |||
| 201 | if (!tb[WL1271_TM_ATTR_DATA]) | ||
| 202 | return -EINVAL; | ||
| 203 | |||
| 204 | buf = nla_data(tb[WL1271_TM_ATTR_DATA]); | ||
| 205 | len = nla_len(tb[WL1271_TM_ATTR_DATA]); | ||
| 206 | |||
| 207 | mutex_lock(&wl->mutex); | ||
| 208 | |||
| 209 | kfree(wl->nvs); | ||
| 210 | |||
| 211 | if ((wl->chip.id == CHIP_ID_1283_PG20) && | ||
| 212 | (len != sizeof(struct wl128x_nvs_file))) | ||
| 213 | return -EINVAL; | ||
| 214 | else if (len != sizeof(struct wl1271_nvs_file)) | ||
| 215 | return -EINVAL; | ||
| 216 | |||
| 217 | wl->nvs = kzalloc(len, GFP_KERNEL); | ||
| 218 | if (!wl->nvs) { | ||
| 219 | wl1271_error("could not allocate memory for the nvs file"); | ||
| 220 | ret = -ENOMEM; | ||
| 221 | goto out; | ||
| 222 | } | ||
| 223 | |||
| 224 | memcpy(wl->nvs, buf, len); | ||
| 225 | wl->nvs_len = len; | ||
| 226 | |||
| 227 | wl1271_debug(DEBUG_TESTMODE, "testmode pushed nvs"); | ||
| 228 | |||
| 229 | out: | ||
| 230 | mutex_unlock(&wl->mutex); | ||
| 231 | |||
| 232 | return ret; | ||
| 233 | } | ||
| 234 | |||
| 235 | static int wl1271_tm_cmd_set_plt_mode(struct wl1271 *wl, struct nlattr *tb[]) | 192 | static int wl1271_tm_cmd_set_plt_mode(struct wl1271 *wl, struct nlattr *tb[]) |
| 236 | { | 193 | { |
| 237 | u32 val; | 194 | u32 val; |
| @@ -288,8 +245,6 @@ int wl1271_tm_cmd(struct ieee80211_hw *hw, void *data, int len) | |||
| 288 | return wl1271_tm_cmd_interrogate(wl, tb); | 245 | return wl1271_tm_cmd_interrogate(wl, tb); |
| 289 | case WL1271_TM_CMD_CONFIGURE: | 246 | case WL1271_TM_CMD_CONFIGURE: |
| 290 | return wl1271_tm_cmd_configure(wl, tb); | 247 | return wl1271_tm_cmd_configure(wl, tb); |
| 291 | case WL1271_TM_CMD_NVS_PUSH: | ||
| 292 | return wl1271_tm_cmd_nvs_push(wl, tb); | ||
| 293 | case WL1271_TM_CMD_SET_PLT_MODE: | 248 | case WL1271_TM_CMD_SET_PLT_MODE: |
| 294 | return wl1271_tm_cmd_set_plt_mode(wl, tb); | 249 | return wl1271_tm_cmd_set_plt_mode(wl, tb); |
| 295 | case WL1271_TM_CMD_RECOVER: | 250 | case WL1271_TM_CMD_RECOVER: |
diff --git a/drivers/pci/hotplug/pcihp_slot.c b/drivers/pci/hotplug/pcihp_slot.c index 753b21aaea61..3ffd9c1acc0a 100644 --- a/drivers/pci/hotplug/pcihp_slot.c +++ b/drivers/pci/hotplug/pcihp_slot.c | |||
| @@ -169,7 +169,9 @@ void pci_configure_slot(struct pci_dev *dev) | |||
| 169 | (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI))) | 169 | (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI))) |
| 170 | return; | 170 | return; |
| 171 | 171 | ||
| 172 | pcie_bus_configure_settings(dev->bus, dev->bus->self->pcie_mpss); | 172 | if (dev->bus && dev->bus->self) |
| 173 | pcie_bus_configure_settings(dev->bus, | ||
| 174 | dev->bus->self->pcie_mpss); | ||
| 173 | 175 | ||
| 174 | memset(&hpp, 0, sizeof(hpp)); | 176 | memset(&hpp, 0, sizeof(hpp)); |
| 175 | ret = pci_get_hp_params(dev, &hpp); | 177 | ret = pci_get_hp_params(dev, &hpp); |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 0ce67423a0a3..4e84fd4a4312 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
| @@ -77,7 +77,7 @@ unsigned long pci_cardbus_mem_size = DEFAULT_CARDBUS_MEM_SIZE; | |||
| 77 | unsigned long pci_hotplug_io_size = DEFAULT_HOTPLUG_IO_SIZE; | 77 | unsigned long pci_hotplug_io_size = DEFAULT_HOTPLUG_IO_SIZE; |
| 78 | unsigned long pci_hotplug_mem_size = DEFAULT_HOTPLUG_MEM_SIZE; | 78 | unsigned long pci_hotplug_mem_size = DEFAULT_HOTPLUG_MEM_SIZE; |
| 79 | 79 | ||
| 80 | enum pcie_bus_config_types pcie_bus_config = PCIE_BUS_PERFORMANCE; | 80 | enum pcie_bus_config_types pcie_bus_config = PCIE_BUS_SAFE; |
| 81 | 81 | ||
| 82 | /* | 82 | /* |
| 83 | * The default CLS is used if arch didn't set CLS explicitly and not | 83 | * The default CLS is used if arch didn't set CLS explicitly and not |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 8473727b29fa..f3f94a5c068f 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
| @@ -1351,7 +1351,8 @@ static int pcie_find_smpss(struct pci_dev *dev, void *data) | |||
| 1351 | * will occur as normal. | 1351 | * will occur as normal. |
| 1352 | */ | 1352 | */ |
| 1353 | if (dev->is_hotplug_bridge && (!list_is_singular(&dev->bus->devices) || | 1353 | if (dev->is_hotplug_bridge && (!list_is_singular(&dev->bus->devices) || |
| 1354 | dev->bus->self->pcie_type != PCI_EXP_TYPE_ROOT_PORT)) | 1354 | (dev->bus->self && |
| 1355 | dev->bus->self->pcie_type != PCI_EXP_TYPE_ROOT_PORT))) | ||
| 1355 | *smpss = 0; | 1356 | *smpss = 0; |
| 1356 | 1357 | ||
| 1357 | if (*smpss > dev->pcie_mpss) | 1358 | if (*smpss > dev->pcie_mpss) |
| @@ -1396,34 +1397,37 @@ static void pcie_write_mps(struct pci_dev *dev, int mps) | |||
| 1396 | 1397 | ||
| 1397 | static void pcie_write_mrrs(struct pci_dev *dev, int mps) | 1398 | static void pcie_write_mrrs(struct pci_dev *dev, int mps) |
| 1398 | { | 1399 | { |
| 1399 | int rc, mrrs; | 1400 | int rc, mrrs, dev_mpss; |
| 1400 | 1401 | ||
| 1401 | if (pcie_bus_config == PCIE_BUS_PERFORMANCE) { | 1402 | /* In the "safe" case, do not configure the MRRS. There appear to be |
| 1402 | int dev_mpss = 128 << dev->pcie_mpss; | 1403 | * issues with setting MRRS to 0 on a number of devices. |
| 1404 | */ | ||
| 1403 | 1405 | ||
| 1404 | /* For Max performance, the MRRS must be set to the largest | 1406 | if (pcie_bus_config != PCIE_BUS_PERFORMANCE) |
| 1405 | * supported value. However, it cannot be configured larger | 1407 | return; |
| 1406 | * than the MPS the device or the bus can support. This assumes | ||
| 1407 | * that the largest MRRS available on the device cannot be | ||
| 1408 | * smaller than the device MPSS. | ||
| 1409 | */ | ||
| 1410 | mrrs = mps < dev_mpss ? mps : dev_mpss; | ||
| 1411 | } else | ||
| 1412 | /* In the "safe" case, configure the MRRS for fairness on the | ||
| 1413 | * bus by making all devices have the same size | ||
| 1414 | */ | ||
| 1415 | mrrs = mps; | ||
| 1416 | 1408 | ||
| 1409 | dev_mpss = 128 << dev->pcie_mpss; | ||
| 1410 | |||
| 1411 | /* For Max performance, the MRRS must be set to the largest supported | ||
| 1412 | * value. However, it cannot be configured larger than the MPS the | ||
| 1413 | * device or the bus can support. This assumes that the largest MRRS | ||
| 1414 | * available on the device cannot be smaller than the device MPSS. | ||
| 1415 | */ | ||
| 1416 | mrrs = min(mps, dev_mpss); | ||
| 1417 | 1417 | ||
| 1418 | /* MRRS is a R/W register. Invalid values can be written, but a | 1418 | /* MRRS is a R/W register. Invalid values can be written, but a |
| 1419 | * subsiquent read will verify if the value is acceptable or not. | 1419 | * subsequent read will verify if the value is acceptable or not. |
| 1420 | * If the MRRS value provided is not acceptable (e.g., too large), | 1420 | * If the MRRS value provided is not acceptable (e.g., too large), |
| 1421 | * shrink the value until it is acceptable to the HW. | 1421 | * shrink the value until it is acceptable to the HW. |
| 1422 | */ | 1422 | */ |
| 1423 | while (mrrs != pcie_get_readrq(dev) && mrrs >= 128) { | 1423 | while (mrrs != pcie_get_readrq(dev) && mrrs >= 128) { |
| 1424 | dev_warn(&dev->dev, "Attempting to modify the PCI-E MRRS value" | ||
| 1425 | " to %d. If any issues are encountered, please try " | ||
| 1426 | "running with pci=pcie_bus_safe\n", mrrs); | ||
| 1424 | rc = pcie_set_readrq(dev, mrrs); | 1427 | rc = pcie_set_readrq(dev, mrrs); |
| 1425 | if (rc) | 1428 | if (rc) |
| 1426 | dev_err(&dev->dev, "Failed attempting to set the MRRS\n"); | 1429 | dev_err(&dev->dev, |
| 1430 | "Failed attempting to set the MRRS\n"); | ||
| 1427 | 1431 | ||
| 1428 | mrrs /= 2; | 1432 | mrrs /= 2; |
| 1429 | } | 1433 | } |
| @@ -1436,13 +1440,13 @@ static int pcie_bus_configure_set(struct pci_dev *dev, void *data) | |||
| 1436 | if (!pci_is_pcie(dev)) | 1440 | if (!pci_is_pcie(dev)) |
| 1437 | return 0; | 1441 | return 0; |
| 1438 | 1442 | ||
| 1439 | dev_info(&dev->dev, "Dev MPS %d MPSS %d MRRS %d\n", | 1443 | dev_dbg(&dev->dev, "Dev MPS %d MPSS %d MRRS %d\n", |
| 1440 | pcie_get_mps(dev), 128<<dev->pcie_mpss, pcie_get_readrq(dev)); | 1444 | pcie_get_mps(dev), 128<<dev->pcie_mpss, pcie_get_readrq(dev)); |
| 1441 | 1445 | ||
| 1442 | pcie_write_mps(dev, mps); | 1446 | pcie_write_mps(dev, mps); |
| 1443 | pcie_write_mrrs(dev, mps); | 1447 | pcie_write_mrrs(dev, mps); |
| 1444 | 1448 | ||
| 1445 | dev_info(&dev->dev, "Dev MPS %d MPSS %d MRRS %d\n", | 1449 | dev_dbg(&dev->dev, "Dev MPS %d MPSS %d MRRS %d\n", |
| 1446 | pcie_get_mps(dev), 128<<dev->pcie_mpss, pcie_get_readrq(dev)); | 1450 | pcie_get_mps(dev), 128<<dev->pcie_mpss, pcie_get_readrq(dev)); |
| 1447 | 1451 | ||
| 1448 | return 0; | 1452 | return 0; |
| @@ -1456,9 +1460,6 @@ void pcie_bus_configure_settings(struct pci_bus *bus, u8 mpss) | |||
| 1456 | { | 1460 | { |
| 1457 | u8 smpss = mpss; | 1461 | u8 smpss = mpss; |
| 1458 | 1462 | ||
| 1459 | if (!bus->self) | ||
| 1460 | return; | ||
| 1461 | |||
| 1462 | if (!pci_is_pcie(bus->self)) | 1463 | if (!pci_is_pcie(bus->self)) |
| 1463 | return; | 1464 | return; |
| 1464 | 1465 | ||
diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c index ee893581d4b7..ebe77dd87daf 100644 --- a/drivers/rapidio/rio-scan.c +++ b/drivers/rapidio/rio-scan.c | |||
| @@ -505,8 +505,7 @@ static struct rio_dev __devinit *rio_setup_device(struct rio_net *net, | |||
| 505 | rdev->dev.dma_mask = &rdev->dma_mask; | 505 | rdev->dev.dma_mask = &rdev->dma_mask; |
| 506 | rdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); | 506 | rdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); |
| 507 | 507 | ||
| 508 | if ((rdev->pef & RIO_PEF_INB_DOORBELL) && | 508 | if (rdev->dst_ops & RIO_DST_OPS_DOORBELL) |
| 509 | (rdev->dst_ops & RIO_DST_OPS_DOORBELL)) | ||
| 510 | rio_init_dbell_res(&rdev->riores[RIO_DOORBELL_RESOURCE], | 509 | rio_init_dbell_res(&rdev->riores[RIO_DOORBELL_RESOURCE], |
| 511 | 0, 0xffff); | 510 | 0, 0xffff); |
| 512 | 511 | ||
diff --git a/drivers/rtc/rtc-ep93xx.c b/drivers/rtc/rtc-ep93xx.c index 335551d333b2..14a42a1edc66 100644 --- a/drivers/rtc/rtc-ep93xx.c +++ b/drivers/rtc/rtc-ep93xx.c | |||
| @@ -36,6 +36,7 @@ | |||
| 36 | */ | 36 | */ |
| 37 | struct ep93xx_rtc { | 37 | struct ep93xx_rtc { |
| 38 | void __iomem *mmio_base; | 38 | void __iomem *mmio_base; |
| 39 | struct rtc_device *rtc; | ||
| 39 | }; | 40 | }; |
| 40 | 41 | ||
| 41 | static int ep93xx_rtc_get_swcomp(struct device *dev, unsigned short *preload, | 42 | static int ep93xx_rtc_get_swcomp(struct device *dev, unsigned short *preload, |
| @@ -130,7 +131,6 @@ static int __init ep93xx_rtc_probe(struct platform_device *pdev) | |||
| 130 | { | 131 | { |
| 131 | struct ep93xx_rtc *ep93xx_rtc; | 132 | struct ep93xx_rtc *ep93xx_rtc; |
| 132 | struct resource *res; | 133 | struct resource *res; |
| 133 | struct rtc_device *rtc; | ||
| 134 | int err; | 134 | int err; |
| 135 | 135 | ||
| 136 | ep93xx_rtc = devm_kzalloc(&pdev->dev, sizeof(*ep93xx_rtc), GFP_KERNEL); | 136 | ep93xx_rtc = devm_kzalloc(&pdev->dev, sizeof(*ep93xx_rtc), GFP_KERNEL); |
| @@ -151,12 +151,12 @@ static int __init ep93xx_rtc_probe(struct platform_device *pdev) | |||
| 151 | return -ENXIO; | 151 | return -ENXIO; |
| 152 | 152 | ||
| 153 | pdev->dev.platform_data = ep93xx_rtc; | 153 | pdev->dev.platform_data = ep93xx_rtc; |
| 154 | platform_set_drvdata(pdev, rtc); | 154 | platform_set_drvdata(pdev, ep93xx_rtc); |
| 155 | 155 | ||
| 156 | rtc = rtc_device_register(pdev->name, | 156 | ep93xx_rtc->rtc = rtc_device_register(pdev->name, |
| 157 | &pdev->dev, &ep93xx_rtc_ops, THIS_MODULE); | 157 | &pdev->dev, &ep93xx_rtc_ops, THIS_MODULE); |
| 158 | if (IS_ERR(rtc)) { | 158 | if (IS_ERR(ep93xx_rtc->rtc)) { |
| 159 | err = PTR_ERR(rtc); | 159 | err = PTR_ERR(ep93xx_rtc->rtc); |
| 160 | goto exit; | 160 | goto exit; |
| 161 | } | 161 | } |
| 162 | 162 | ||
| @@ -167,7 +167,7 @@ static int __init ep93xx_rtc_probe(struct platform_device *pdev) | |||
| 167 | return 0; | 167 | return 0; |
| 168 | 168 | ||
| 169 | fail: | 169 | fail: |
| 170 | rtc_device_unregister(rtc); | 170 | rtc_device_unregister(ep93xx_rtc->rtc); |
| 171 | exit: | 171 | exit: |
| 172 | platform_set_drvdata(pdev, NULL); | 172 | platform_set_drvdata(pdev, NULL); |
| 173 | pdev->dev.platform_data = NULL; | 173 | pdev->dev.platform_data = NULL; |
| @@ -176,11 +176,11 @@ exit: | |||
| 176 | 176 | ||
| 177 | static int __exit ep93xx_rtc_remove(struct platform_device *pdev) | 177 | static int __exit ep93xx_rtc_remove(struct platform_device *pdev) |
| 178 | { | 178 | { |
| 179 | struct rtc_device *rtc = platform_get_drvdata(pdev); | 179 | struct ep93xx_rtc *ep93xx_rtc = platform_get_drvdata(pdev); |
| 180 | 180 | ||
| 181 | sysfs_remove_group(&pdev->dev.kobj, &ep93xx_rtc_sysfs_files); | 181 | sysfs_remove_group(&pdev->dev.kobj, &ep93xx_rtc_sysfs_files); |
| 182 | platform_set_drvdata(pdev, NULL); | 182 | platform_set_drvdata(pdev, NULL); |
| 183 | rtc_device_unregister(rtc); | 183 | rtc_device_unregister(ep93xx_rtc->rtc); |
| 184 | pdev->dev.platform_data = NULL; | 184 | pdev->dev.platform_data = NULL; |
| 185 | 185 | ||
| 186 | return 0; | 186 | return 0; |
diff --git a/drivers/rtc/rtc-imxdi.c b/drivers/rtc/rtc-imxdi.c index 2dd3c0163272..d93a9608b1f0 100644 --- a/drivers/rtc/rtc-imxdi.c +++ b/drivers/rtc/rtc-imxdi.c | |||
| @@ -35,6 +35,7 @@ | |||
| 35 | #include <linux/module.h> | 35 | #include <linux/module.h> |
| 36 | #include <linux/platform_device.h> | 36 | #include <linux/platform_device.h> |
| 37 | #include <linux/rtc.h> | 37 | #include <linux/rtc.h> |
| 38 | #include <linux/sched.h> | ||
| 38 | #include <linux/workqueue.h> | 39 | #include <linux/workqueue.h> |
| 39 | 40 | ||
| 40 | /* DryIce Register Definitions */ | 41 | /* DryIce Register Definitions */ |
diff --git a/drivers/rtc/rtc-lib.c b/drivers/rtc/rtc-lib.c index 075f1708deae..c4cf05731118 100644 --- a/drivers/rtc/rtc-lib.c +++ b/drivers/rtc/rtc-lib.c | |||
| @@ -85,6 +85,8 @@ void rtc_time_to_tm(unsigned long time, struct rtc_time *tm) | |||
| 85 | time -= tm->tm_hour * 3600; | 85 | time -= tm->tm_hour * 3600; |
| 86 | tm->tm_min = time / 60; | 86 | tm->tm_min = time / 60; |
| 87 | tm->tm_sec = time - tm->tm_min * 60; | 87 | tm->tm_sec = time - tm->tm_min * 60; |
| 88 | |||
| 89 | tm->tm_isdst = 0; | ||
| 88 | } | 90 | } |
| 89 | EXPORT_SYMBOL(rtc_time_to_tm); | 91 | EXPORT_SYMBOL(rtc_time_to_tm); |
| 90 | 92 | ||
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 9329dbb9ebab..7639ab906f02 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
| @@ -51,6 +51,27 @@ static enum s3c_cpu_type s3c_rtc_cpu_type; | |||
| 51 | 51 | ||
| 52 | static DEFINE_SPINLOCK(s3c_rtc_pie_lock); | 52 | static DEFINE_SPINLOCK(s3c_rtc_pie_lock); |
| 53 | 53 | ||
| 54 | static void s3c_rtc_alarm_clk_enable(bool enable) | ||
| 55 | { | ||
| 56 | static DEFINE_SPINLOCK(s3c_rtc_alarm_clk_lock); | ||
| 57 | static bool alarm_clk_enabled; | ||
| 58 | unsigned long irq_flags; | ||
| 59 | |||
| 60 | spin_lock_irqsave(&s3c_rtc_alarm_clk_lock, irq_flags); | ||
| 61 | if (enable) { | ||
| 62 | if (!alarm_clk_enabled) { | ||
| 63 | clk_enable(rtc_clk); | ||
| 64 | alarm_clk_enabled = true; | ||
| 65 | } | ||
| 66 | } else { | ||
| 67 | if (alarm_clk_enabled) { | ||
| 68 | clk_disable(rtc_clk); | ||
| 69 | alarm_clk_enabled = false; | ||
| 70 | } | ||
| 71 | } | ||
| 72 | spin_unlock_irqrestore(&s3c_rtc_alarm_clk_lock, irq_flags); | ||
| 73 | } | ||
| 74 | |||
| 54 | /* IRQ Handlers */ | 75 | /* IRQ Handlers */ |
| 55 | 76 | ||
| 56 | static irqreturn_t s3c_rtc_alarmirq(int irq, void *id) | 77 | static irqreturn_t s3c_rtc_alarmirq(int irq, void *id) |
| @@ -64,6 +85,9 @@ static irqreturn_t s3c_rtc_alarmirq(int irq, void *id) | |||
| 64 | writeb(S3C2410_INTP_ALM, s3c_rtc_base + S3C2410_INTP); | 85 | writeb(S3C2410_INTP_ALM, s3c_rtc_base + S3C2410_INTP); |
| 65 | 86 | ||
| 66 | clk_disable(rtc_clk); | 87 | clk_disable(rtc_clk); |
| 88 | |||
| 89 | s3c_rtc_alarm_clk_enable(false); | ||
| 90 | |||
| 67 | return IRQ_HANDLED; | 91 | return IRQ_HANDLED; |
| 68 | } | 92 | } |
| 69 | 93 | ||
| @@ -97,6 +121,8 @@ static int s3c_rtc_setaie(struct device *dev, unsigned int enabled) | |||
| 97 | writeb(tmp, s3c_rtc_base + S3C2410_RTCALM); | 121 | writeb(tmp, s3c_rtc_base + S3C2410_RTCALM); |
| 98 | clk_disable(rtc_clk); | 122 | clk_disable(rtc_clk); |
| 99 | 123 | ||
| 124 | s3c_rtc_alarm_clk_enable(enabled); | ||
| 125 | |||
| 100 | return 0; | 126 | return 0; |
| 101 | } | 127 | } |
| 102 | 128 | ||
| @@ -152,10 +178,6 @@ static int s3c_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm) | |||
| 152 | goto retry_get_time; | 178 | goto retry_get_time; |
| 153 | } | 179 | } |
| 154 | 180 | ||
| 155 | pr_debug("read time %04d.%02d.%02d %02d:%02d:%02d\n", | ||
| 156 | 1900 + rtc_tm->tm_year, rtc_tm->tm_mon, rtc_tm->tm_mday, | ||
| 157 | rtc_tm->tm_hour, rtc_tm->tm_min, rtc_tm->tm_sec); | ||
| 158 | |||
| 159 | rtc_tm->tm_sec = bcd2bin(rtc_tm->tm_sec); | 181 | rtc_tm->tm_sec = bcd2bin(rtc_tm->tm_sec); |
| 160 | rtc_tm->tm_min = bcd2bin(rtc_tm->tm_min); | 182 | rtc_tm->tm_min = bcd2bin(rtc_tm->tm_min); |
| 161 | rtc_tm->tm_hour = bcd2bin(rtc_tm->tm_hour); | 183 | rtc_tm->tm_hour = bcd2bin(rtc_tm->tm_hour); |
| @@ -164,6 +186,11 @@ static int s3c_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm) | |||
| 164 | rtc_tm->tm_year = bcd2bin(rtc_tm->tm_year); | 186 | rtc_tm->tm_year = bcd2bin(rtc_tm->tm_year); |
| 165 | 187 | ||
| 166 | rtc_tm->tm_year += 100; | 188 | rtc_tm->tm_year += 100; |
| 189 | |||
| 190 | pr_debug("read time %04d.%02d.%02d %02d:%02d:%02d\n", | ||
| 191 | 1900 + rtc_tm->tm_year, rtc_tm->tm_mon, rtc_tm->tm_mday, | ||
| 192 | rtc_tm->tm_hour, rtc_tm->tm_min, rtc_tm->tm_sec); | ||
| 193 | |||
| 167 | rtc_tm->tm_mon -= 1; | 194 | rtc_tm->tm_mon -= 1; |
| 168 | 195 | ||
| 169 | clk_disable(rtc_clk); | 196 | clk_disable(rtc_clk); |
| @@ -269,10 +296,9 @@ static int s3c_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
| 269 | clk_enable(rtc_clk); | 296 | clk_enable(rtc_clk); |
| 270 | pr_debug("s3c_rtc_setalarm: %d, %04d.%02d.%02d %02d:%02d:%02d\n", | 297 | pr_debug("s3c_rtc_setalarm: %d, %04d.%02d.%02d %02d:%02d:%02d\n", |
| 271 | alrm->enabled, | 298 | alrm->enabled, |
| 272 | 1900 + tm->tm_year, tm->tm_mon, tm->tm_mday, | 299 | 1900 + tm->tm_year, tm->tm_mon + 1, tm->tm_mday, |
| 273 | tm->tm_hour, tm->tm_min, tm->tm_sec); | 300 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
| 274 | 301 | ||
| 275 | |||
| 276 | alrm_en = readb(base + S3C2410_RTCALM) & S3C2410_RTCALM_ALMEN; | 302 | alrm_en = readb(base + S3C2410_RTCALM) & S3C2410_RTCALM_ALMEN; |
| 277 | writeb(0x00, base + S3C2410_RTCALM); | 303 | writeb(0x00, base + S3C2410_RTCALM); |
| 278 | 304 | ||
| @@ -319,49 +345,7 @@ static int s3c_rtc_proc(struct device *dev, struct seq_file *seq) | |||
| 319 | return 0; | 345 | return 0; |
| 320 | } | 346 | } |
| 321 | 347 | ||
| 322 | static int s3c_rtc_open(struct device *dev) | ||
| 323 | { | ||
| 324 | struct platform_device *pdev = to_platform_device(dev); | ||
| 325 | struct rtc_device *rtc_dev = platform_get_drvdata(pdev); | ||
| 326 | int ret; | ||
| 327 | |||
| 328 | ret = request_irq(s3c_rtc_alarmno, s3c_rtc_alarmirq, | ||
| 329 | IRQF_DISABLED, "s3c2410-rtc alarm", rtc_dev); | ||
| 330 | |||
| 331 | if (ret) { | ||
| 332 | dev_err(dev, "IRQ%d error %d\n", s3c_rtc_alarmno, ret); | ||
| 333 | return ret; | ||
| 334 | } | ||
| 335 | |||
| 336 | ret = request_irq(s3c_rtc_tickno, s3c_rtc_tickirq, | ||
| 337 | IRQF_DISABLED, "s3c2410-rtc tick", rtc_dev); | ||
| 338 | |||
| 339 | if (ret) { | ||
| 340 | dev_err(dev, "IRQ%d error %d\n", s3c_rtc_tickno, ret); | ||
| 341 | goto tick_err; | ||
| 342 | } | ||
| 343 | |||
| 344 | return ret; | ||
| 345 | |||
| 346 | tick_err: | ||
| 347 | free_irq(s3c_rtc_alarmno, rtc_dev); | ||
| 348 | return ret; | ||
| 349 | } | ||
| 350 | |||
| 351 | static void s3c_rtc_release(struct device *dev) | ||
| 352 | { | ||
| 353 | struct platform_device *pdev = to_platform_device(dev); | ||
| 354 | struct rtc_device *rtc_dev = platform_get_drvdata(pdev); | ||
| 355 | |||
| 356 | /* do not clear AIE here, it may be needed for wake */ | ||
| 357 | |||
| 358 | free_irq(s3c_rtc_alarmno, rtc_dev); | ||
| 359 | free_irq(s3c_rtc_tickno, rtc_dev); | ||
| 360 | } | ||
| 361 | |||
| 362 | static const struct rtc_class_ops s3c_rtcops = { | 348 | static const struct rtc_class_ops s3c_rtcops = { |
| 363 | .open = s3c_rtc_open, | ||
| 364 | .release = s3c_rtc_release, | ||
| 365 | .read_time = s3c_rtc_gettime, | 349 | .read_time = s3c_rtc_gettime, |
| 366 | .set_time = s3c_rtc_settime, | 350 | .set_time = s3c_rtc_settime, |
| 367 | .read_alarm = s3c_rtc_getalarm, | 351 | .read_alarm = s3c_rtc_getalarm, |
| @@ -425,6 +409,9 @@ static int __devexit s3c_rtc_remove(struct platform_device *dev) | |||
| 425 | { | 409 | { |
| 426 | struct rtc_device *rtc = platform_get_drvdata(dev); | 410 | struct rtc_device *rtc = platform_get_drvdata(dev); |
| 427 | 411 | ||
| 412 | free_irq(s3c_rtc_alarmno, rtc); | ||
| 413 | free_irq(s3c_rtc_tickno, rtc); | ||
| 414 | |||
| 428 | platform_set_drvdata(dev, NULL); | 415 | platform_set_drvdata(dev, NULL); |
| 429 | rtc_device_unregister(rtc); | 416 | rtc_device_unregister(rtc); |
| 430 | 417 | ||
| @@ -548,10 +535,32 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev) | |||
| 548 | 535 | ||
| 549 | s3c_rtc_setfreq(&pdev->dev, 1); | 536 | s3c_rtc_setfreq(&pdev->dev, 1); |
| 550 | 537 | ||
| 538 | ret = request_irq(s3c_rtc_alarmno, s3c_rtc_alarmirq, | ||
| 539 | IRQF_DISABLED, "s3c2410-rtc alarm", rtc); | ||
| 540 | if (ret) { | ||
| 541 | dev_err(&pdev->dev, "IRQ%d error %d\n", s3c_rtc_alarmno, ret); | ||
| 542 | goto err_alarm_irq; | ||
| 543 | } | ||
| 544 | |||
| 545 | ret = request_irq(s3c_rtc_tickno, s3c_rtc_tickirq, | ||
| 546 | IRQF_DISABLED, "s3c2410-rtc tick", rtc); | ||
| 547 | if (ret) { | ||
| 548 | dev_err(&pdev->dev, "IRQ%d error %d\n", s3c_rtc_tickno, ret); | ||
| 549 | free_irq(s3c_rtc_alarmno, rtc); | ||
| 550 | goto err_tick_irq; | ||
| 551 | } | ||
| 552 | |||
| 551 | clk_disable(rtc_clk); | 553 | clk_disable(rtc_clk); |
| 552 | 554 | ||
| 553 | return 0; | 555 | return 0; |
| 554 | 556 | ||
| 557 | err_tick_irq: | ||
| 558 | free_irq(s3c_rtc_alarmno, rtc); | ||
| 559 | |||
| 560 | err_alarm_irq: | ||
| 561 | platform_set_drvdata(pdev, NULL); | ||
| 562 | rtc_device_unregister(rtc); | ||
| 563 | |||
| 555 | err_nortc: | 564 | err_nortc: |
| 556 | s3c_rtc_enable(pdev, 0); | 565 | s3c_rtc_enable(pdev, 0); |
| 557 | clk_disable(rtc_clk); | 566 | clk_disable(rtc_clk); |
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c index 9a81f778d6b2..20687d55e7a7 100644 --- a/drivers/rtc/rtc-twl.c +++ b/drivers/rtc/rtc-twl.c | |||
| @@ -362,14 +362,6 @@ static irqreturn_t twl_rtc_interrupt(int irq, void *rtc) | |||
| 362 | int res; | 362 | int res; |
| 363 | u8 rd_reg; | 363 | u8 rd_reg; |
| 364 | 364 | ||
| 365 | #ifdef CONFIG_LOCKDEP | ||
| 366 | /* WORKAROUND for lockdep forcing IRQF_DISABLED on us, which | ||
| 367 | * we don't want and can't tolerate. Although it might be | ||
| 368 | * friendlier not to borrow this thread context... | ||
| 369 | */ | ||
| 370 | local_irq_enable(); | ||
| 371 | #endif | ||
| 372 | |||
| 373 | res = twl_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG); | 365 | res = twl_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG); |
| 374 | if (res) | 366 | if (res) |
| 375 | goto out; | 367 | goto out; |
| @@ -428,24 +420,12 @@ static struct rtc_class_ops twl_rtc_ops = { | |||
| 428 | static int __devinit twl_rtc_probe(struct platform_device *pdev) | 420 | static int __devinit twl_rtc_probe(struct platform_device *pdev) |
| 429 | { | 421 | { |
| 430 | struct rtc_device *rtc; | 422 | struct rtc_device *rtc; |
| 431 | int ret = 0; | 423 | int ret = -EINVAL; |
| 432 | int irq = platform_get_irq(pdev, 0); | 424 | int irq = platform_get_irq(pdev, 0); |
| 433 | u8 rd_reg; | 425 | u8 rd_reg; |
| 434 | 426 | ||
| 435 | if (irq <= 0) | 427 | if (irq <= 0) |
| 436 | return -EINVAL; | 428 | goto out1; |
| 437 | |||
| 438 | rtc = rtc_device_register(pdev->name, | ||
| 439 | &pdev->dev, &twl_rtc_ops, THIS_MODULE); | ||
| 440 | if (IS_ERR(rtc)) { | ||
| 441 | ret = PTR_ERR(rtc); | ||
| 442 | dev_err(&pdev->dev, "can't register RTC device, err %ld\n", | ||
| 443 | PTR_ERR(rtc)); | ||
| 444 | goto out0; | ||
| 445 | |||
| 446 | } | ||
| 447 | |||
| 448 | platform_set_drvdata(pdev, rtc); | ||
| 449 | 429 | ||
| 450 | ret = twl_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG); | 430 | ret = twl_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG); |
| 451 | if (ret < 0) | 431 | if (ret < 0) |
| @@ -462,14 +442,6 @@ static int __devinit twl_rtc_probe(struct platform_device *pdev) | |||
| 462 | if (ret < 0) | 442 | if (ret < 0) |
| 463 | goto out1; | 443 | goto out1; |
| 464 | 444 | ||
| 465 | ret = request_irq(irq, twl_rtc_interrupt, | ||
| 466 | IRQF_TRIGGER_RISING, | ||
| 467 | dev_name(&rtc->dev), rtc); | ||
| 468 | if (ret < 0) { | ||
| 469 | dev_err(&pdev->dev, "IRQ is not free.\n"); | ||
| 470 | goto out1; | ||
| 471 | } | ||
| 472 | |||
| 473 | if (twl_class_is_6030()) { | 445 | if (twl_class_is_6030()) { |
| 474 | twl6030_interrupt_unmask(TWL6030_RTC_INT_MASK, | 446 | twl6030_interrupt_unmask(TWL6030_RTC_INT_MASK, |
| 475 | REG_INT_MSK_LINE_A); | 447 | REG_INT_MSK_LINE_A); |
| @@ -480,28 +452,44 @@ static int __devinit twl_rtc_probe(struct platform_device *pdev) | |||
| 480 | /* Check RTC module status, Enable if it is off */ | 452 | /* Check RTC module status, Enable if it is off */ |
| 481 | ret = twl_rtc_read_u8(&rd_reg, REG_RTC_CTRL_REG); | 453 | ret = twl_rtc_read_u8(&rd_reg, REG_RTC_CTRL_REG); |
| 482 | if (ret < 0) | 454 | if (ret < 0) |
| 483 | goto out2; | 455 | goto out1; |
| 484 | 456 | ||
| 485 | if (!(rd_reg & BIT_RTC_CTRL_REG_STOP_RTC_M)) { | 457 | if (!(rd_reg & BIT_RTC_CTRL_REG_STOP_RTC_M)) { |
| 486 | dev_info(&pdev->dev, "Enabling TWL-RTC.\n"); | 458 | dev_info(&pdev->dev, "Enabling TWL-RTC.\n"); |
| 487 | rd_reg = BIT_RTC_CTRL_REG_STOP_RTC_M; | 459 | rd_reg = BIT_RTC_CTRL_REG_STOP_RTC_M; |
| 488 | ret = twl_rtc_write_u8(rd_reg, REG_RTC_CTRL_REG); | 460 | ret = twl_rtc_write_u8(rd_reg, REG_RTC_CTRL_REG); |
| 489 | if (ret < 0) | 461 | if (ret < 0) |
| 490 | goto out2; | 462 | goto out1; |
| 491 | } | 463 | } |
| 492 | 464 | ||
| 493 | /* init cached IRQ enable bits */ | 465 | /* init cached IRQ enable bits */ |
| 494 | ret = twl_rtc_read_u8(&rtc_irq_bits, REG_RTC_INTERRUPTS_REG); | 466 | ret = twl_rtc_read_u8(&rtc_irq_bits, REG_RTC_INTERRUPTS_REG); |
| 495 | if (ret < 0) | 467 | if (ret < 0) |
| 468 | goto out1; | ||
| 469 | |||
| 470 | rtc = rtc_device_register(pdev->name, | ||
| 471 | &pdev->dev, &twl_rtc_ops, THIS_MODULE); | ||
| 472 | if (IS_ERR(rtc)) { | ||
| 473 | ret = PTR_ERR(rtc); | ||
| 474 | dev_err(&pdev->dev, "can't register RTC device, err %ld\n", | ||
| 475 | PTR_ERR(rtc)); | ||
| 476 | goto out1; | ||
| 477 | } | ||
| 478 | |||
| 479 | ret = request_threaded_irq(irq, NULL, twl_rtc_interrupt, | ||
| 480 | IRQF_TRIGGER_RISING, | ||
| 481 | dev_name(&rtc->dev), rtc); | ||
| 482 | if (ret < 0) { | ||
| 483 | dev_err(&pdev->dev, "IRQ is not free.\n"); | ||
| 496 | goto out2; | 484 | goto out2; |
| 485 | } | ||
| 497 | 486 | ||
| 498 | return ret; | 487 | platform_set_drvdata(pdev, rtc); |
| 488 | return 0; | ||
| 499 | 489 | ||
| 500 | out2: | 490 | out2: |
| 501 | free_irq(irq, rtc); | ||
| 502 | out1: | ||
| 503 | rtc_device_unregister(rtc); | 491 | rtc_device_unregister(rtc); |
| 504 | out0: | 492 | out1: |
| 505 | return ret; | 493 | return ret; |
| 506 | } | 494 | } |
| 507 | 495 | ||
diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c index eb4e034378cd..f1a2016829fc 100644 --- a/drivers/s390/block/dasd_ioctl.c +++ b/drivers/s390/block/dasd_ioctl.c | |||
| @@ -249,6 +249,7 @@ static int dasd_ioctl_reset_profile(struct dasd_block *block) | |||
| 249 | static int dasd_ioctl_read_profile(struct dasd_block *block, void __user *argp) | 249 | static int dasd_ioctl_read_profile(struct dasd_block *block, void __user *argp) |
| 250 | { | 250 | { |
| 251 | struct dasd_profile_info_t *data; | 251 | struct dasd_profile_info_t *data; |
| 252 | int rc = 0; | ||
| 252 | 253 | ||
| 253 | data = kmalloc(sizeof(*data), GFP_KERNEL); | 254 | data = kmalloc(sizeof(*data), GFP_KERNEL); |
| 254 | if (!data) | 255 | if (!data) |
| @@ -279,11 +280,14 @@ static int dasd_ioctl_read_profile(struct dasd_block *block, void __user *argp) | |||
| 279 | spin_unlock_bh(&block->profile.lock); | 280 | spin_unlock_bh(&block->profile.lock); |
| 280 | } else { | 281 | } else { |
| 281 | spin_unlock_bh(&block->profile.lock); | 282 | spin_unlock_bh(&block->profile.lock); |
| 282 | return -EIO; | 283 | rc = -EIO; |
| 284 | goto out; | ||
| 283 | } | 285 | } |
| 284 | if (copy_to_user(argp, data, sizeof(*data))) | 286 | if (copy_to_user(argp, data, sizeof(*data))) |
| 285 | return -EFAULT; | 287 | rc = -EFAULT; |
| 286 | return 0; | 288 | out: |
| 289 | kfree(data); | ||
| 290 | return rc; | ||
| 287 | } | 291 | } |
| 288 | #else | 292 | #else |
| 289 | static int dasd_ioctl_reset_profile(struct dasd_block *block) | 293 | static int dasd_ioctl_reset_profile(struct dasd_block *block) |
diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c index be55fb2b1b1c..837e010299a8 100644 --- a/drivers/s390/char/sclp_cmd.c +++ b/drivers/s390/char/sclp_cmd.c | |||
| @@ -383,8 +383,10 @@ static int sclp_attach_storage(u8 id) | |||
| 383 | switch (sccb->header.response_code) { | 383 | switch (sccb->header.response_code) { |
| 384 | case 0x0020: | 384 | case 0x0020: |
| 385 | set_bit(id, sclp_storage_ids); | 385 | set_bit(id, sclp_storage_ids); |
| 386 | for (i = 0; i < sccb->assigned; i++) | 386 | for (i = 0; i < sccb->assigned; i++) { |
| 387 | sclp_unassign_storage(sccb->entries[i] >> 16); | 387 | if (sccb->entries[i]) |
| 388 | sclp_unassign_storage(sccb->entries[i] >> 16); | ||
| 389 | } | ||
| 388 | break; | 390 | break; |
| 389 | default: | 391 | default: |
| 390 | rc = -EIO; | 392 | rc = -EIO; |
diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c index 9ae80cd5953b..dba72a4e6a1c 100644 --- a/drivers/scsi/bnx2i/bnx2i_hwi.c +++ b/drivers/scsi/bnx2i/bnx2i_hwi.c | |||
| @@ -563,7 +563,7 @@ int bnx2i_send_iscsi_nopout(struct bnx2i_conn *bnx2i_conn, | |||
| 563 | nopout_wqe->itt = ((u16)task->itt | | 563 | nopout_wqe->itt = ((u16)task->itt | |
| 564 | (ISCSI_TASK_TYPE_MPATH << | 564 | (ISCSI_TASK_TYPE_MPATH << |
| 565 | ISCSI_TMF_REQUEST_TYPE_SHIFT)); | 565 | ISCSI_TMF_REQUEST_TYPE_SHIFT)); |
| 566 | nopout_wqe->ttt = nopout_hdr->ttt; | 566 | nopout_wqe->ttt = be32_to_cpu(nopout_hdr->ttt); |
| 567 | nopout_wqe->flags = 0; | 567 | nopout_wqe->flags = 0; |
| 568 | if (!unsol) | 568 | if (!unsol) |
| 569 | nopout_wqe->flags = ISCSI_NOP_OUT_REQUEST_LOCAL_COMPLETION; | 569 | nopout_wqe->flags = ISCSI_NOP_OUT_REQUEST_LOCAL_COMPLETION; |
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c index ba710e350ac5..5d0e9a24ae94 100644 --- a/drivers/scsi/fcoe/fcoe.c +++ b/drivers/scsi/fcoe/fcoe.c | |||
| @@ -432,6 +432,8 @@ void fcoe_interface_cleanup(struct fcoe_interface *fcoe) | |||
| 432 | u8 flogi_maddr[ETH_ALEN]; | 432 | u8 flogi_maddr[ETH_ALEN]; |
| 433 | const struct net_device_ops *ops; | 433 | const struct net_device_ops *ops; |
| 434 | 434 | ||
| 435 | rtnl_lock(); | ||
| 436 | |||
| 435 | /* | 437 | /* |
| 436 | * Don't listen for Ethernet packets anymore. | 438 | * Don't listen for Ethernet packets anymore. |
| 437 | * synchronize_net() ensures that the packet handlers are not running | 439 | * synchronize_net() ensures that the packet handlers are not running |
| @@ -461,6 +463,8 @@ void fcoe_interface_cleanup(struct fcoe_interface *fcoe) | |||
| 461 | " specific feature for LLD.\n"); | 463 | " specific feature for LLD.\n"); |
| 462 | } | 464 | } |
| 463 | 465 | ||
| 466 | rtnl_unlock(); | ||
| 467 | |||
| 464 | /* Release the self-reference taken during fcoe_interface_create() */ | 468 | /* Release the self-reference taken during fcoe_interface_create() */ |
| 465 | fcoe_interface_put(fcoe); | 469 | fcoe_interface_put(fcoe); |
| 466 | } | 470 | } |
| @@ -1951,11 +1955,8 @@ static void fcoe_destroy_work(struct work_struct *work) | |||
| 1951 | fcoe_if_destroy(port->lport); | 1955 | fcoe_if_destroy(port->lport); |
| 1952 | 1956 | ||
| 1953 | /* Do not tear down the fcoe interface for NPIV port */ | 1957 | /* Do not tear down the fcoe interface for NPIV port */ |
| 1954 | if (!npiv) { | 1958 | if (!npiv) |
| 1955 | rtnl_lock(); | ||
| 1956 | fcoe_interface_cleanup(fcoe); | 1959 | fcoe_interface_cleanup(fcoe); |
| 1957 | rtnl_unlock(); | ||
| 1958 | } | ||
| 1959 | 1960 | ||
| 1960 | mutex_unlock(&fcoe_config_mutex); | 1961 | mutex_unlock(&fcoe_config_mutex); |
| 1961 | } | 1962 | } |
| @@ -2009,8 +2010,9 @@ static int fcoe_create(struct net_device *netdev, enum fip_state fip_mode) | |||
| 2009 | printk(KERN_ERR "fcoe: Failed to create interface (%s)\n", | 2010 | printk(KERN_ERR "fcoe: Failed to create interface (%s)\n", |
| 2010 | netdev->name); | 2011 | netdev->name); |
| 2011 | rc = -EIO; | 2012 | rc = -EIO; |
| 2013 | rtnl_unlock(); | ||
| 2012 | fcoe_interface_cleanup(fcoe); | 2014 | fcoe_interface_cleanup(fcoe); |
| 2013 | goto out_nodev; | 2015 | goto out_nortnl; |
| 2014 | } | 2016 | } |
| 2015 | 2017 | ||
| 2016 | /* Make this the "master" N_Port */ | 2018 | /* Make this the "master" N_Port */ |
| @@ -2027,6 +2029,7 @@ static int fcoe_create(struct net_device *netdev, enum fip_state fip_mode) | |||
| 2027 | 2029 | ||
| 2028 | out_nodev: | 2030 | out_nodev: |
| 2029 | rtnl_unlock(); | 2031 | rtnl_unlock(); |
| 2032 | out_nortnl: | ||
| 2030 | mutex_unlock(&fcoe_config_mutex); | 2033 | mutex_unlock(&fcoe_config_mutex); |
| 2031 | return rc; | 2034 | return rc; |
| 2032 | } | 2035 | } |
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index ec61bdb833ac..b200b736b000 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c | |||
| @@ -676,6 +676,16 @@ static void hpsa_scsi_replace_entry(struct ctlr_info *h, int hostno, | |||
| 676 | BUG_ON(entry < 0 || entry >= HPSA_MAX_SCSI_DEVS_PER_HBA); | 676 | BUG_ON(entry < 0 || entry >= HPSA_MAX_SCSI_DEVS_PER_HBA); |
| 677 | removed[*nremoved] = h->dev[entry]; | 677 | removed[*nremoved] = h->dev[entry]; |
| 678 | (*nremoved)++; | 678 | (*nremoved)++; |
| 679 | |||
| 680 | /* | ||
| 681 | * New physical devices won't have target/lun assigned yet | ||
| 682 | * so we need to preserve the values in the slot we are replacing. | ||
| 683 | */ | ||
| 684 | if (new_entry->target == -1) { | ||
| 685 | new_entry->target = h->dev[entry]->target; | ||
| 686 | new_entry->lun = h->dev[entry]->lun; | ||
| 687 | } | ||
| 688 | |||
| 679 | h->dev[entry] = new_entry; | 689 | h->dev[entry] = new_entry; |
| 680 | added[*nadded] = new_entry; | 690 | added[*nadded] = new_entry; |
| 681 | (*nadded)++; | 691 | (*nadded)++; |
| @@ -1548,10 +1558,17 @@ static inline void hpsa_set_bus_target_lun(struct hpsa_scsi_dev_t *device, | |||
| 1548 | } | 1558 | } |
| 1549 | 1559 | ||
| 1550 | static int hpsa_update_device_info(struct ctlr_info *h, | 1560 | static int hpsa_update_device_info(struct ctlr_info *h, |
| 1551 | unsigned char scsi3addr[], struct hpsa_scsi_dev_t *this_device) | 1561 | unsigned char scsi3addr[], struct hpsa_scsi_dev_t *this_device, |
| 1562 | unsigned char *is_OBDR_device) | ||
| 1552 | { | 1563 | { |
| 1553 | #define OBDR_TAPE_INQ_SIZE 49 | 1564 | |
| 1565 | #define OBDR_SIG_OFFSET 43 | ||
| 1566 | #define OBDR_TAPE_SIG "$DR-10" | ||
| 1567 | #define OBDR_SIG_LEN (sizeof(OBDR_TAPE_SIG) - 1) | ||
| 1568 | #define OBDR_TAPE_INQ_SIZE (OBDR_SIG_OFFSET + OBDR_SIG_LEN) | ||
| 1569 | |||
| 1554 | unsigned char *inq_buff; | 1570 | unsigned char *inq_buff; |
| 1571 | unsigned char *obdr_sig; | ||
| 1555 | 1572 | ||
| 1556 | inq_buff = kzalloc(OBDR_TAPE_INQ_SIZE, GFP_KERNEL); | 1573 | inq_buff = kzalloc(OBDR_TAPE_INQ_SIZE, GFP_KERNEL); |
| 1557 | if (!inq_buff) | 1574 | if (!inq_buff) |
| @@ -1583,6 +1600,16 @@ static int hpsa_update_device_info(struct ctlr_info *h, | |||
| 1583 | else | 1600 | else |
| 1584 | this_device->raid_level = RAID_UNKNOWN; | 1601 | this_device->raid_level = RAID_UNKNOWN; |
| 1585 | 1602 | ||
| 1603 | if (is_OBDR_device) { | ||
| 1604 | /* See if this is a One-Button-Disaster-Recovery device | ||
| 1605 | * by looking for "$DR-10" at offset 43 in inquiry data. | ||
| 1606 | */ | ||
| 1607 | obdr_sig = &inq_buff[OBDR_SIG_OFFSET]; | ||
| 1608 | *is_OBDR_device = (this_device->devtype == TYPE_ROM && | ||
| 1609 | strncmp(obdr_sig, OBDR_TAPE_SIG, | ||
| 1610 | OBDR_SIG_LEN) == 0); | ||
| 1611 | } | ||
| 1612 | |||
| 1586 | kfree(inq_buff); | 1613 | kfree(inq_buff); |
| 1587 | return 0; | 1614 | return 0; |
| 1588 | 1615 | ||
| @@ -1716,7 +1743,7 @@ static int add_msa2xxx_enclosure_device(struct ctlr_info *h, | |||
| 1716 | return 0; | 1743 | return 0; |
| 1717 | } | 1744 | } |
| 1718 | 1745 | ||
| 1719 | if (hpsa_update_device_info(h, scsi3addr, this_device)) | 1746 | if (hpsa_update_device_info(h, scsi3addr, this_device, NULL)) |
| 1720 | return 0; | 1747 | return 0; |
| 1721 | (*nmsa2xxx_enclosures)++; | 1748 | (*nmsa2xxx_enclosures)++; |
| 1722 | hpsa_set_bus_target_lun(this_device, bus, target, 0); | 1749 | hpsa_set_bus_target_lun(this_device, bus, target, 0); |
| @@ -1808,7 +1835,6 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) | |||
| 1808 | */ | 1835 | */ |
| 1809 | struct ReportLUNdata *physdev_list = NULL; | 1836 | struct ReportLUNdata *physdev_list = NULL; |
| 1810 | struct ReportLUNdata *logdev_list = NULL; | 1837 | struct ReportLUNdata *logdev_list = NULL; |
| 1811 | unsigned char *inq_buff = NULL; | ||
| 1812 | u32 nphysicals = 0; | 1838 | u32 nphysicals = 0; |
| 1813 | u32 nlogicals = 0; | 1839 | u32 nlogicals = 0; |
| 1814 | u32 ndev_allocated = 0; | 1840 | u32 ndev_allocated = 0; |
| @@ -1824,11 +1850,9 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) | |||
| 1824 | GFP_KERNEL); | 1850 | GFP_KERNEL); |
| 1825 | physdev_list = kzalloc(reportlunsize, GFP_KERNEL); | 1851 | physdev_list = kzalloc(reportlunsize, GFP_KERNEL); |
| 1826 | logdev_list = kzalloc(reportlunsize, GFP_KERNEL); | 1852 | logdev_list = kzalloc(reportlunsize, GFP_KERNEL); |
| 1827 | inq_buff = kmalloc(OBDR_TAPE_INQ_SIZE, GFP_KERNEL); | ||
| 1828 | tmpdevice = kzalloc(sizeof(*tmpdevice), GFP_KERNEL); | 1853 | tmpdevice = kzalloc(sizeof(*tmpdevice), GFP_KERNEL); |
| 1829 | 1854 | ||
| 1830 | if (!currentsd || !physdev_list || !logdev_list || | 1855 | if (!currentsd || !physdev_list || !logdev_list || !tmpdevice) { |
| 1831 | !inq_buff || !tmpdevice) { | ||
| 1832 | dev_err(&h->pdev->dev, "out of memory\n"); | 1856 | dev_err(&h->pdev->dev, "out of memory\n"); |
| 1833 | goto out; | 1857 | goto out; |
| 1834 | } | 1858 | } |
| @@ -1863,7 +1887,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) | |||
| 1863 | /* adjust our table of devices */ | 1887 | /* adjust our table of devices */ |
| 1864 | nmsa2xxx_enclosures = 0; | 1888 | nmsa2xxx_enclosures = 0; |
| 1865 | for (i = 0; i < nphysicals + nlogicals + 1; i++) { | 1889 | for (i = 0; i < nphysicals + nlogicals + 1; i++) { |
| 1866 | u8 *lunaddrbytes; | 1890 | u8 *lunaddrbytes, is_OBDR = 0; |
| 1867 | 1891 | ||
| 1868 | /* Figure out where the LUN ID info is coming from */ | 1892 | /* Figure out where the LUN ID info is coming from */ |
| 1869 | lunaddrbytes = figure_lunaddrbytes(h, raid_ctlr_position, | 1893 | lunaddrbytes = figure_lunaddrbytes(h, raid_ctlr_position, |
| @@ -1874,7 +1898,8 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) | |||
| 1874 | continue; | 1898 | continue; |
| 1875 | 1899 | ||
| 1876 | /* Get device type, vendor, model, device id */ | 1900 | /* Get device type, vendor, model, device id */ |
| 1877 | if (hpsa_update_device_info(h, lunaddrbytes, tmpdevice)) | 1901 | if (hpsa_update_device_info(h, lunaddrbytes, tmpdevice, |
| 1902 | &is_OBDR)) | ||
| 1878 | continue; /* skip it if we can't talk to it. */ | 1903 | continue; /* skip it if we can't talk to it. */ |
| 1879 | figure_bus_target_lun(h, lunaddrbytes, &bus, &target, &lun, | 1904 | figure_bus_target_lun(h, lunaddrbytes, &bus, &target, &lun, |
| 1880 | tmpdevice); | 1905 | tmpdevice); |
| @@ -1898,7 +1923,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) | |||
| 1898 | hpsa_set_bus_target_lun(this_device, bus, target, lun); | 1923 | hpsa_set_bus_target_lun(this_device, bus, target, lun); |
| 1899 | 1924 | ||
| 1900 | switch (this_device->devtype) { | 1925 | switch (this_device->devtype) { |
| 1901 | case TYPE_ROM: { | 1926 | case TYPE_ROM: |
| 1902 | /* We don't *really* support actual CD-ROM devices, | 1927 | /* We don't *really* support actual CD-ROM devices, |
| 1903 | * just "One Button Disaster Recovery" tape drive | 1928 | * just "One Button Disaster Recovery" tape drive |
| 1904 | * which temporarily pretends to be a CD-ROM drive. | 1929 | * which temporarily pretends to be a CD-ROM drive. |
| @@ -1906,15 +1931,8 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) | |||
| 1906 | * device by checking for "$DR-10" in bytes 43-48 of | 1931 | * device by checking for "$DR-10" in bytes 43-48 of |
| 1907 | * the inquiry data. | 1932 | * the inquiry data. |
| 1908 | */ | 1933 | */ |
| 1909 | char obdr_sig[7]; | 1934 | if (is_OBDR) |
| 1910 | #define OBDR_TAPE_SIG "$DR-10" | 1935 | ncurrent++; |
| 1911 | strncpy(obdr_sig, &inq_buff[43], 6); | ||
| 1912 | obdr_sig[6] = '\0'; | ||
| 1913 | if (strncmp(obdr_sig, OBDR_TAPE_SIG, 6) != 0) | ||
| 1914 | /* Not OBDR device, ignore it. */ | ||
| 1915 | break; | ||
| 1916 | } | ||
| 1917 | ncurrent++; | ||
| 1918 | break; | 1936 | break; |
| 1919 | case TYPE_DISK: | 1937 | case TYPE_DISK: |
| 1920 | if (i < nphysicals) | 1938 | if (i < nphysicals) |
| @@ -1947,7 +1965,6 @@ out: | |||
| 1947 | for (i = 0; i < ndev_allocated; i++) | 1965 | for (i = 0; i < ndev_allocated; i++) |
| 1948 | kfree(currentsd[i]); | 1966 | kfree(currentsd[i]); |
| 1949 | kfree(currentsd); | 1967 | kfree(currentsd); |
| 1950 | kfree(inq_buff); | ||
| 1951 | kfree(physdev_list); | 1968 | kfree(physdev_list); |
| 1952 | kfree(logdev_list); | 1969 | kfree(logdev_list); |
| 1953 | } | 1970 | } |
diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c index 26072f1e9852..6981b773a88d 100644 --- a/drivers/scsi/isci/host.c +++ b/drivers/scsi/isci/host.c | |||
| @@ -531,6 +531,9 @@ static void sci_controller_process_completions(struct isci_host *ihost) | |||
| 531 | break; | 531 | break; |
| 532 | 532 | ||
| 533 | case SCU_COMPLETION_TYPE_EVENT: | 533 | case SCU_COMPLETION_TYPE_EVENT: |
| 534 | sci_controller_event_completion(ihost, ent); | ||
| 535 | break; | ||
| 536 | |||
| 534 | case SCU_COMPLETION_TYPE_NOTIFY: { | 537 | case SCU_COMPLETION_TYPE_NOTIFY: { |
| 535 | event_cycle ^= ((event_get+1) & SCU_MAX_EVENTS) << | 538 | event_cycle ^= ((event_get+1) & SCU_MAX_EVENTS) << |
| 536 | (SMU_COMPLETION_QUEUE_GET_EVENT_CYCLE_BIT_SHIFT - SCU_MAX_EVENTS_SHIFT); | 539 | (SMU_COMPLETION_QUEUE_GET_EVENT_CYCLE_BIT_SHIFT - SCU_MAX_EVENTS_SHIFT); |
| @@ -1091,6 +1094,7 @@ static void isci_host_completion_routine(unsigned long data) | |||
| 1091 | struct isci_request *request; | 1094 | struct isci_request *request; |
| 1092 | struct isci_request *next_request; | 1095 | struct isci_request *next_request; |
| 1093 | struct sas_task *task; | 1096 | struct sas_task *task; |
| 1097 | u16 active; | ||
| 1094 | 1098 | ||
| 1095 | INIT_LIST_HEAD(&completed_request_list); | 1099 | INIT_LIST_HEAD(&completed_request_list); |
| 1096 | INIT_LIST_HEAD(&errored_request_list); | 1100 | INIT_LIST_HEAD(&errored_request_list); |
| @@ -1181,6 +1185,13 @@ static void isci_host_completion_routine(unsigned long data) | |||
| 1181 | } | 1185 | } |
| 1182 | } | 1186 | } |
| 1183 | 1187 | ||
| 1188 | /* the coalesence timeout doubles at each encoding step, so | ||
| 1189 | * update it based on the ilog2 value of the outstanding requests | ||
| 1190 | */ | ||
| 1191 | active = isci_tci_active(ihost); | ||
| 1192 | writel(SMU_ICC_GEN_VAL(NUMBER, active) | | ||
| 1193 | SMU_ICC_GEN_VAL(TIMER, ISCI_COALESCE_BASE + ilog2(active)), | ||
| 1194 | &ihost->smu_registers->interrupt_coalesce_control); | ||
| 1184 | } | 1195 | } |
| 1185 | 1196 | ||
| 1186 | /** | 1197 | /** |
| @@ -1471,7 +1482,7 @@ static void sci_controller_ready_state_enter(struct sci_base_state_machine *sm) | |||
| 1471 | struct isci_host *ihost = container_of(sm, typeof(*ihost), sm); | 1482 | struct isci_host *ihost = container_of(sm, typeof(*ihost), sm); |
| 1472 | 1483 | ||
| 1473 | /* set the default interrupt coalescence number and timeout value. */ | 1484 | /* set the default interrupt coalescence number and timeout value. */ |
| 1474 | sci_controller_set_interrupt_coalescence(ihost, 0x10, 250); | 1485 | sci_controller_set_interrupt_coalescence(ihost, 0, 0); |
| 1475 | } | 1486 | } |
| 1476 | 1487 | ||
| 1477 | static void sci_controller_ready_state_exit(struct sci_base_state_machine *sm) | 1488 | static void sci_controller_ready_state_exit(struct sci_base_state_machine *sm) |
diff --git a/drivers/scsi/isci/host.h b/drivers/scsi/isci/host.h index 062101a39f79..9f33831a2f04 100644 --- a/drivers/scsi/isci/host.h +++ b/drivers/scsi/isci/host.h | |||
| @@ -369,6 +369,9 @@ static inline struct isci_host *dev_to_ihost(struct domain_device *dev) | |||
| 369 | #define ISCI_TAG_SEQ(tag) (((tag) >> 12) & (SCI_MAX_SEQ-1)) | 369 | #define ISCI_TAG_SEQ(tag) (((tag) >> 12) & (SCI_MAX_SEQ-1)) |
| 370 | #define ISCI_TAG_TCI(tag) ((tag) & (SCI_MAX_IO_REQUESTS-1)) | 370 | #define ISCI_TAG_TCI(tag) ((tag) & (SCI_MAX_IO_REQUESTS-1)) |
| 371 | 371 | ||
| 372 | /* interrupt coalescing baseline: 9 == 3 to 5us interrupt delay per command */ | ||
| 373 | #define ISCI_COALESCE_BASE 9 | ||
| 374 | |||
| 372 | /* expander attached sata devices require 3 rnc slots */ | 375 | /* expander attached sata devices require 3 rnc slots */ |
| 373 | static inline int sci_remote_device_node_count(struct isci_remote_device *idev) | 376 | static inline int sci_remote_device_node_count(struct isci_remote_device *idev) |
| 374 | { | 377 | { |
diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c index 61e0d09e2b57..29aa34efb0f5 100644 --- a/drivers/scsi/isci/init.c +++ b/drivers/scsi/isci/init.c | |||
| @@ -59,10 +59,19 @@ | |||
| 59 | #include <linux/firmware.h> | 59 | #include <linux/firmware.h> |
| 60 | #include <linux/efi.h> | 60 | #include <linux/efi.h> |
| 61 | #include <asm/string.h> | 61 | #include <asm/string.h> |
| 62 | #include <scsi/scsi_host.h> | ||
| 62 | #include "isci.h" | 63 | #include "isci.h" |
| 63 | #include "task.h" | 64 | #include "task.h" |
| 64 | #include "probe_roms.h" | 65 | #include "probe_roms.h" |
| 65 | 66 | ||
| 67 | #define MAJ 1 | ||
| 68 | #define MIN 0 | ||
| 69 | #define BUILD 0 | ||
| 70 | #define DRV_VERSION __stringify(MAJ) "." __stringify(MIN) "." \ | ||
| 71 | __stringify(BUILD) | ||
| 72 | |||
| 73 | MODULE_VERSION(DRV_VERSION); | ||
| 74 | |||
| 66 | static struct scsi_transport_template *isci_transport_template; | 75 | static struct scsi_transport_template *isci_transport_template; |
| 67 | 76 | ||
| 68 | static DEFINE_PCI_DEVICE_TABLE(isci_id_table) = { | 77 | static DEFINE_PCI_DEVICE_TABLE(isci_id_table) = { |
| @@ -113,6 +122,22 @@ unsigned char max_concurr_spinup = 1; | |||
| 113 | module_param(max_concurr_spinup, byte, 0); | 122 | module_param(max_concurr_spinup, byte, 0); |
| 114 | MODULE_PARM_DESC(max_concurr_spinup, "Max concurrent device spinup"); | 123 | MODULE_PARM_DESC(max_concurr_spinup, "Max concurrent device spinup"); |
| 115 | 124 | ||
| 125 | static ssize_t isci_show_id(struct device *dev, struct device_attribute *attr, char *buf) | ||
| 126 | { | ||
| 127 | struct Scsi_Host *shost = container_of(dev, typeof(*shost), shost_dev); | ||
| 128 | struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost); | ||
| 129 | struct isci_host *ihost = container_of(sas_ha, typeof(*ihost), sas_ha); | ||
| 130 | |||
| 131 | return snprintf(buf, PAGE_SIZE, "%d\n", ihost->id); | ||
| 132 | } | ||
| 133 | |||
| 134 | static DEVICE_ATTR(isci_id, S_IRUGO, isci_show_id, NULL); | ||
| 135 | |||
| 136 | struct device_attribute *isci_host_attrs[] = { | ||
| 137 | &dev_attr_isci_id, | ||
| 138 | NULL | ||
| 139 | }; | ||
| 140 | |||
| 116 | static struct scsi_host_template isci_sht = { | 141 | static struct scsi_host_template isci_sht = { |
| 117 | 142 | ||
| 118 | .module = THIS_MODULE, | 143 | .module = THIS_MODULE, |
| @@ -138,6 +163,7 @@ static struct scsi_host_template isci_sht = { | |||
| 138 | .slave_alloc = sas_slave_alloc, | 163 | .slave_alloc = sas_slave_alloc, |
| 139 | .target_destroy = sas_target_destroy, | 164 | .target_destroy = sas_target_destroy, |
| 140 | .ioctl = sas_ioctl, | 165 | .ioctl = sas_ioctl, |
| 166 | .shost_attrs = isci_host_attrs, | ||
| 141 | }; | 167 | }; |
| 142 | 168 | ||
| 143 | static struct sas_domain_function_template isci_transport_ops = { | 169 | static struct sas_domain_function_template isci_transport_ops = { |
| @@ -232,17 +258,6 @@ static int isci_register_sas_ha(struct isci_host *isci_host) | |||
| 232 | return 0; | 258 | return 0; |
| 233 | } | 259 | } |
| 234 | 260 | ||
| 235 | static ssize_t isci_show_id(struct device *dev, struct device_attribute *attr, char *buf) | ||
| 236 | { | ||
| 237 | struct Scsi_Host *shost = container_of(dev, typeof(*shost), shost_dev); | ||
| 238 | struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost); | ||
| 239 | struct isci_host *ihost = container_of(sas_ha, typeof(*ihost), sas_ha); | ||
| 240 | |||
| 241 | return snprintf(buf, PAGE_SIZE, "%d\n", ihost->id); | ||
| 242 | } | ||
| 243 | |||
| 244 | static DEVICE_ATTR(isci_id, S_IRUGO, isci_show_id, NULL); | ||
| 245 | |||
| 246 | static void isci_unregister(struct isci_host *isci_host) | 261 | static void isci_unregister(struct isci_host *isci_host) |
| 247 | { | 262 | { |
| 248 | struct Scsi_Host *shost; | 263 | struct Scsi_Host *shost; |
| @@ -251,7 +266,6 @@ static void isci_unregister(struct isci_host *isci_host) | |||
| 251 | return; | 266 | return; |
| 252 | 267 | ||
| 253 | shost = isci_host->shost; | 268 | shost = isci_host->shost; |
| 254 | device_remove_file(&shost->shost_dev, &dev_attr_isci_id); | ||
| 255 | 269 | ||
| 256 | sas_unregister_ha(&isci_host->sas_ha); | 270 | sas_unregister_ha(&isci_host->sas_ha); |
| 257 | 271 | ||
| @@ -415,14 +429,8 @@ static struct isci_host *isci_host_alloc(struct pci_dev *pdev, int id) | |||
| 415 | if (err) | 429 | if (err) |
| 416 | goto err_shost_remove; | 430 | goto err_shost_remove; |
| 417 | 431 | ||
| 418 | err = device_create_file(&shost->shost_dev, &dev_attr_isci_id); | ||
| 419 | if (err) | ||
| 420 | goto err_unregister_ha; | ||
| 421 | |||
| 422 | return isci_host; | 432 | return isci_host; |
| 423 | 433 | ||
| 424 | err_unregister_ha: | ||
| 425 | sas_unregister_ha(&(isci_host->sas_ha)); | ||
| 426 | err_shost_remove: | 434 | err_shost_remove: |
| 427 | scsi_remove_host(shost); | 435 | scsi_remove_host(shost); |
| 428 | err_shost: | 436 | err_shost: |
| @@ -540,7 +548,8 @@ static __init int isci_init(void) | |||
| 540 | { | 548 | { |
| 541 | int err; | 549 | int err; |
| 542 | 550 | ||
| 543 | pr_info("%s: Intel(R) C600 SAS Controller Driver\n", DRV_NAME); | 551 | pr_info("%s: Intel(R) C600 SAS Controller Driver - version %s\n", |
| 552 | DRV_NAME, DRV_VERSION); | ||
| 544 | 553 | ||
| 545 | isci_transport_template = sas_domain_attach_transport(&isci_transport_ops); | 554 | isci_transport_template = sas_domain_attach_transport(&isci_transport_ops); |
| 546 | if (!isci_transport_template) | 555 | if (!isci_transport_template) |
diff --git a/drivers/scsi/isci/phy.c b/drivers/scsi/isci/phy.c index 79313a7a2356..430fc8ff014a 100644 --- a/drivers/scsi/isci/phy.c +++ b/drivers/scsi/isci/phy.c | |||
| @@ -104,6 +104,7 @@ sci_phy_link_layer_initialization(struct isci_phy *iphy, | |||
| 104 | u32 parity_count = 0; | 104 | u32 parity_count = 0; |
| 105 | u32 llctl, link_rate; | 105 | u32 llctl, link_rate; |
| 106 | u32 clksm_value = 0; | 106 | u32 clksm_value = 0; |
| 107 | u32 sp_timeouts = 0; | ||
| 107 | 108 | ||
| 108 | iphy->link_layer_registers = reg; | 109 | iphy->link_layer_registers = reg; |
| 109 | 110 | ||
| @@ -211,6 +212,18 @@ sci_phy_link_layer_initialization(struct isci_phy *iphy, | |||
| 211 | llctl |= SCU_SAS_LLCTL_GEN_VAL(MAX_LINK_RATE, link_rate); | 212 | llctl |= SCU_SAS_LLCTL_GEN_VAL(MAX_LINK_RATE, link_rate); |
| 212 | writel(llctl, &iphy->link_layer_registers->link_layer_control); | 213 | writel(llctl, &iphy->link_layer_registers->link_layer_control); |
| 213 | 214 | ||
| 215 | sp_timeouts = readl(&iphy->link_layer_registers->sas_phy_timeouts); | ||
| 216 | |||
| 217 | /* Clear the default 0x36 (54us) RATE_CHANGE timeout value. */ | ||
| 218 | sp_timeouts &= ~SCU_SAS_PHYTOV_GEN_VAL(RATE_CHANGE, 0xFF); | ||
| 219 | |||
| 220 | /* Set RATE_CHANGE timeout value to 0x3B (59us). This ensures SCU can | ||
| 221 | * lock with 3Gb drive when SCU max rate is set to 1.5Gb. | ||
| 222 | */ | ||
| 223 | sp_timeouts |= SCU_SAS_PHYTOV_GEN_VAL(RATE_CHANGE, 0x3B); | ||
| 224 | |||
| 225 | writel(sp_timeouts, &iphy->link_layer_registers->sas_phy_timeouts); | ||
| 226 | |||
| 214 | if (is_a2(ihost->pdev)) { | 227 | if (is_a2(ihost->pdev)) { |
| 215 | /* Program the max ARB time for the PHY to 700us so we inter-operate with | 228 | /* Program the max ARB time for the PHY to 700us so we inter-operate with |
| 216 | * the PMC expander which shuts down PHYs if the expander PHY generates too | 229 | * the PMC expander which shuts down PHYs if the expander PHY generates too |
diff --git a/drivers/scsi/isci/registers.h b/drivers/scsi/isci/registers.h index 9b266c7428e8..00afc738bbed 100644 --- a/drivers/scsi/isci/registers.h +++ b/drivers/scsi/isci/registers.h | |||
| @@ -1299,6 +1299,18 @@ struct scu_transport_layer_registers { | |||
| 1299 | #define SCU_AFE_XCVRCR_OFFSET 0x00DC | 1299 | #define SCU_AFE_XCVRCR_OFFSET 0x00DC |
| 1300 | #define SCU_AFE_LUTCR_OFFSET 0x00E0 | 1300 | #define SCU_AFE_LUTCR_OFFSET 0x00E0 |
| 1301 | 1301 | ||
| 1302 | #define SCU_SAS_PHY_TIMER_TIMEOUT_VALUES_ALIGN_DETECTION_SHIFT (0UL) | ||
| 1303 | #define SCU_SAS_PHY_TIMER_TIMEOUT_VALUES_ALIGN_DETECTION_MASK (0x000000FFUL) | ||
| 1304 | #define SCU_SAS_PHY_TIMER_TIMEOUT_VALUES_HOT_PLUG_SHIFT (8UL) | ||
| 1305 | #define SCU_SAS_PHY_TIMER_TIMEOUT_VALUES_HOT_PLUG_MASK (0x0000FF00UL) | ||
| 1306 | #define SCU_SAS_PHY_TIMER_TIMEOUT_VALUES_COMSAS_DETECTION_SHIFT (16UL) | ||
| 1307 | #define SCU_SAS_PHY_TIMER_TIMEOUT_VALUES_COMSAS_DETECTION_MASK (0x00FF0000UL) | ||
| 1308 | #define SCU_SAS_PHY_TIMER_TIMEOUT_VALUES_RATE_CHANGE_SHIFT (24UL) | ||
| 1309 | #define SCU_SAS_PHY_TIMER_TIMEOUT_VALUES_RATE_CHANGE_MASK (0xFF000000UL) | ||
| 1310 | |||
| 1311 | #define SCU_SAS_PHYTOV_GEN_VAL(name, value) \ | ||
| 1312 | SCU_GEN_VALUE(SCU_SAS_PHY_TIMER_TIMEOUT_VALUES_##name, value) | ||
| 1313 | |||
| 1302 | #define SCU_SAS_LINK_LAYER_CONTROL_MAX_LINK_RATE_SHIFT (0) | 1314 | #define SCU_SAS_LINK_LAYER_CONTROL_MAX_LINK_RATE_SHIFT (0) |
| 1303 | #define SCU_SAS_LINK_LAYER_CONTROL_MAX_LINK_RATE_MASK (0x00000003) | 1315 | #define SCU_SAS_LINK_LAYER_CONTROL_MAX_LINK_RATE_MASK (0x00000003) |
| 1304 | #define SCU_SAS_LINK_LAYER_CONTROL_MAX_LINK_RATE_GEN1 (0) | 1316 | #define SCU_SAS_LINK_LAYER_CONTROL_MAX_LINK_RATE_GEN1 (0) |
diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c index a46e07ac789f..b5d3a8c4d329 100644 --- a/drivers/scsi/isci/request.c +++ b/drivers/scsi/isci/request.c | |||
| @@ -732,12 +732,20 @@ sci_io_request_terminate(struct isci_request *ireq) | |||
| 732 | sci_change_state(&ireq->sm, SCI_REQ_ABORTING); | 732 | sci_change_state(&ireq->sm, SCI_REQ_ABORTING); |
| 733 | return SCI_SUCCESS; | 733 | return SCI_SUCCESS; |
| 734 | case SCI_REQ_TASK_WAIT_TC_RESP: | 734 | case SCI_REQ_TASK_WAIT_TC_RESP: |
| 735 | /* The task frame was already confirmed to have been | ||
| 736 | * sent by the SCU HW. Since the state machine is | ||
| 737 | * now only waiting for the task response itself, | ||
| 738 | * abort the request and complete it immediately | ||
| 739 | * and don't wait for the task response. | ||
| 740 | */ | ||
| 735 | sci_change_state(&ireq->sm, SCI_REQ_ABORTING); | 741 | sci_change_state(&ireq->sm, SCI_REQ_ABORTING); |
| 736 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | 742 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); |
| 737 | return SCI_SUCCESS; | 743 | return SCI_SUCCESS; |
| 738 | case SCI_REQ_ABORTING: | 744 | case SCI_REQ_ABORTING: |
| 739 | sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); | 745 | /* If a request has a termination requested twice, return |
| 740 | return SCI_SUCCESS; | 746 | * a failure indication, since HW confirmation of the first |
| 747 | * abort is still outstanding. | ||
| 748 | */ | ||
| 741 | case SCI_REQ_COMPLETED: | 749 | case SCI_REQ_COMPLETED: |
| 742 | default: | 750 | default: |
| 743 | dev_warn(&ireq->owning_controller->pdev->dev, | 751 | dev_warn(&ireq->owning_controller->pdev->dev, |
| @@ -2399,22 +2407,19 @@ static void isci_task_save_for_upper_layer_completion( | |||
| 2399 | } | 2407 | } |
| 2400 | } | 2408 | } |
| 2401 | 2409 | ||
| 2402 | static void isci_request_process_stp_response(struct sas_task *task, | 2410 | static void isci_process_stp_response(struct sas_task *task, struct dev_to_host_fis *fis) |
| 2403 | void *response_buffer) | ||
| 2404 | { | 2411 | { |
| 2405 | struct dev_to_host_fis *d2h_reg_fis = response_buffer; | ||
| 2406 | struct task_status_struct *ts = &task->task_status; | 2412 | struct task_status_struct *ts = &task->task_status; |
| 2407 | struct ata_task_resp *resp = (void *)&ts->buf[0]; | 2413 | struct ata_task_resp *resp = (void *)&ts->buf[0]; |
| 2408 | 2414 | ||
| 2409 | resp->frame_len = le16_to_cpu(*(__le16 *)(response_buffer + 6)); | 2415 | resp->frame_len = sizeof(*fis); |
| 2410 | memcpy(&resp->ending_fis[0], response_buffer + 16, 24); | 2416 | memcpy(resp->ending_fis, fis, sizeof(*fis)); |
| 2411 | ts->buf_valid_size = sizeof(*resp); | 2417 | ts->buf_valid_size = sizeof(*resp); |
| 2412 | 2418 | ||
| 2413 | /** | 2419 | /* If the device fault bit is set in the status register, then |
| 2414 | * If the device fault bit is set in the status register, then | ||
| 2415 | * set the sense data and return. | 2420 | * set the sense data and return. |
| 2416 | */ | 2421 | */ |
| 2417 | if (d2h_reg_fis->status & ATA_DF) | 2422 | if (fis->status & ATA_DF) |
| 2418 | ts->stat = SAS_PROTO_RESPONSE; | 2423 | ts->stat = SAS_PROTO_RESPONSE; |
| 2419 | else | 2424 | else |
| 2420 | ts->stat = SAM_STAT_GOOD; | 2425 | ts->stat = SAM_STAT_GOOD; |
| @@ -2428,7 +2433,6 @@ static void isci_request_io_request_complete(struct isci_host *ihost, | |||
| 2428 | { | 2433 | { |
| 2429 | struct sas_task *task = isci_request_access_task(request); | 2434 | struct sas_task *task = isci_request_access_task(request); |
| 2430 | struct ssp_response_iu *resp_iu; | 2435 | struct ssp_response_iu *resp_iu; |
| 2431 | void *resp_buf; | ||
| 2432 | unsigned long task_flags; | 2436 | unsigned long task_flags; |
| 2433 | struct isci_remote_device *idev = isci_lookup_device(task->dev); | 2437 | struct isci_remote_device *idev = isci_lookup_device(task->dev); |
| 2434 | enum service_response response = SAS_TASK_UNDELIVERED; | 2438 | enum service_response response = SAS_TASK_UNDELIVERED; |
| @@ -2565,9 +2569,7 @@ static void isci_request_io_request_complete(struct isci_host *ihost, | |||
| 2565 | task); | 2569 | task); |
| 2566 | 2570 | ||
| 2567 | if (sas_protocol_ata(task->task_proto)) { | 2571 | if (sas_protocol_ata(task->task_proto)) { |
| 2568 | resp_buf = &request->stp.rsp; | 2572 | isci_process_stp_response(task, &request->stp.rsp); |
| 2569 | isci_request_process_stp_response(task, | ||
| 2570 | resp_buf); | ||
| 2571 | } else if (SAS_PROTOCOL_SSP == task->task_proto) { | 2573 | } else if (SAS_PROTOCOL_SSP == task->task_proto) { |
| 2572 | 2574 | ||
| 2573 | /* crack the iu response buffer. */ | 2575 | /* crack the iu response buffer. */ |
diff --git a/drivers/scsi/isci/unsolicited_frame_control.c b/drivers/scsi/isci/unsolicited_frame_control.c index e9e1e2abacb9..16f88ab939c8 100644 --- a/drivers/scsi/isci/unsolicited_frame_control.c +++ b/drivers/scsi/isci/unsolicited_frame_control.c | |||
| @@ -72,7 +72,7 @@ int sci_unsolicited_frame_control_construct(struct isci_host *ihost) | |||
| 72 | */ | 72 | */ |
| 73 | buf_len = SCU_MAX_UNSOLICITED_FRAMES * SCU_UNSOLICITED_FRAME_BUFFER_SIZE; | 73 | buf_len = SCU_MAX_UNSOLICITED_FRAMES * SCU_UNSOLICITED_FRAME_BUFFER_SIZE; |
| 74 | header_len = SCU_MAX_UNSOLICITED_FRAMES * sizeof(struct scu_unsolicited_frame_header); | 74 | header_len = SCU_MAX_UNSOLICITED_FRAMES * sizeof(struct scu_unsolicited_frame_header); |
| 75 | size = buf_len + header_len + SCU_MAX_UNSOLICITED_FRAMES * sizeof(dma_addr_t); | 75 | size = buf_len + header_len + SCU_MAX_UNSOLICITED_FRAMES * sizeof(uf_control->address_table.array[0]); |
| 76 | 76 | ||
| 77 | /* | 77 | /* |
| 78 | * The Unsolicited Frame buffers are set at the start of the UF | 78 | * The Unsolicited Frame buffers are set at the start of the UF |
diff --git a/drivers/scsi/isci/unsolicited_frame_control.h b/drivers/scsi/isci/unsolicited_frame_control.h index 31cb9506f52d..75d896686f5a 100644 --- a/drivers/scsi/isci/unsolicited_frame_control.h +++ b/drivers/scsi/isci/unsolicited_frame_control.h | |||
| @@ -214,7 +214,7 @@ struct sci_uf_address_table_array { | |||
| 214 | * starting address of the UF address table. | 214 | * starting address of the UF address table. |
| 215 | * 64-bit pointers are required by the hardware. | 215 | * 64-bit pointers are required by the hardware. |
| 216 | */ | 216 | */ |
| 217 | dma_addr_t *array; | 217 | u64 *array; |
| 218 | 218 | ||
| 219 | /** | 219 | /** |
| 220 | * This field specifies the physical address location for the UF | 220 | * This field specifies the physical address location for the UF |
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c index 01ff082dc34c..d261e982a2fa 100644 --- a/drivers/scsi/libfc/fc_exch.c +++ b/drivers/scsi/libfc/fc_exch.c | |||
| @@ -494,6 +494,9 @@ static int fc_seq_send(struct fc_lport *lport, struct fc_seq *sp, | |||
| 494 | */ | 494 | */ |
| 495 | error = lport->tt.frame_send(lport, fp); | 495 | error = lport->tt.frame_send(lport, fp); |
| 496 | 496 | ||
| 497 | if (fh->fh_type == FC_TYPE_BLS) | ||
| 498 | return error; | ||
| 499 | |||
| 497 | /* | 500 | /* |
| 498 | * Update the exchange and sequence flags, | 501 | * Update the exchange and sequence flags, |
| 499 | * assuming all frames for the sequence have been sent. | 502 | * assuming all frames for the sequence have been sent. |
| @@ -575,42 +578,35 @@ static void fc_seq_set_resp(struct fc_seq *sp, | |||
| 575 | } | 578 | } |
| 576 | 579 | ||
| 577 | /** | 580 | /** |
| 578 | * fc_seq_exch_abort() - Abort an exchange and sequence | 581 | * fc_exch_abort_locked() - Abort an exchange |
| 579 | * @req_sp: The sequence to be aborted | 582 | * @ep: The exchange to be aborted |
| 580 | * @timer_msec: The period of time to wait before aborting | 583 | * @timer_msec: The period of time to wait before aborting |
| 581 | * | 584 | * |
| 582 | * Generally called because of a timeout or an abort from the upper layer. | 585 | * Locking notes: Called with exch lock held |
| 586 | * | ||
| 587 | * Return value: 0 on success else error code | ||
| 583 | */ | 588 | */ |
| 584 | static int fc_seq_exch_abort(const struct fc_seq *req_sp, | 589 | static int fc_exch_abort_locked(struct fc_exch *ep, |
| 585 | unsigned int timer_msec) | 590 | unsigned int timer_msec) |
| 586 | { | 591 | { |
| 587 | struct fc_seq *sp; | 592 | struct fc_seq *sp; |
| 588 | struct fc_exch *ep; | ||
| 589 | struct fc_frame *fp; | 593 | struct fc_frame *fp; |
| 590 | int error; | 594 | int error; |
| 591 | 595 | ||
| 592 | ep = fc_seq_exch(req_sp); | ||
| 593 | |||
| 594 | spin_lock_bh(&ep->ex_lock); | ||
| 595 | if (ep->esb_stat & (ESB_ST_COMPLETE | ESB_ST_ABNORMAL) || | 596 | if (ep->esb_stat & (ESB_ST_COMPLETE | ESB_ST_ABNORMAL) || |
| 596 | ep->state & (FC_EX_DONE | FC_EX_RST_CLEANUP)) { | 597 | ep->state & (FC_EX_DONE | FC_EX_RST_CLEANUP)) |
| 597 | spin_unlock_bh(&ep->ex_lock); | ||
| 598 | return -ENXIO; | 598 | return -ENXIO; |
| 599 | } | ||
| 600 | 599 | ||
| 601 | /* | 600 | /* |
| 602 | * Send the abort on a new sequence if possible. | 601 | * Send the abort on a new sequence if possible. |
| 603 | */ | 602 | */ |
| 604 | sp = fc_seq_start_next_locked(&ep->seq); | 603 | sp = fc_seq_start_next_locked(&ep->seq); |
| 605 | if (!sp) { | 604 | if (!sp) |
| 606 | spin_unlock_bh(&ep->ex_lock); | ||
| 607 | return -ENOMEM; | 605 | return -ENOMEM; |
| 608 | } | ||
| 609 | 606 | ||
| 610 | ep->esb_stat |= ESB_ST_SEQ_INIT | ESB_ST_ABNORMAL; | 607 | ep->esb_stat |= ESB_ST_SEQ_INIT | ESB_ST_ABNORMAL; |
| 611 | if (timer_msec) | 608 | if (timer_msec) |
| 612 | fc_exch_timer_set_locked(ep, timer_msec); | 609 | fc_exch_timer_set_locked(ep, timer_msec); |
| 613 | spin_unlock_bh(&ep->ex_lock); | ||
| 614 | 610 | ||
| 615 | /* | 611 | /* |
| 616 | * If not logged into the fabric, don't send ABTS but leave | 612 | * If not logged into the fabric, don't send ABTS but leave |
| @@ -633,6 +629,28 @@ static int fc_seq_exch_abort(const struct fc_seq *req_sp, | |||
| 633 | } | 629 | } |
| 634 | 630 | ||
| 635 | /** | 631 | /** |
| 632 | * fc_seq_exch_abort() - Abort an exchange and sequence | ||
| 633 | * @req_sp: The sequence to be aborted | ||
| 634 | * @timer_msec: The period of time to wait before aborting | ||
| 635 | * | ||
| 636 | * Generally called because of a timeout or an abort from the upper layer. | ||
| 637 | * | ||
| 638 | * Return value: 0 on success else error code | ||
| 639 | */ | ||
| 640 | static int fc_seq_exch_abort(const struct fc_seq *req_sp, | ||
| 641 | unsigned int timer_msec) | ||
| 642 | { | ||
| 643 | struct fc_exch *ep; | ||
| 644 | int error; | ||
| 645 | |||
| 646 | ep = fc_seq_exch(req_sp); | ||
| 647 | spin_lock_bh(&ep->ex_lock); | ||
| 648 | error = fc_exch_abort_locked(ep, timer_msec); | ||
| 649 | spin_unlock_bh(&ep->ex_lock); | ||
| 650 | return error; | ||
| 651 | } | ||
| 652 | |||
| 653 | /** | ||
| 636 | * fc_exch_timeout() - Handle exchange timer expiration | 654 | * fc_exch_timeout() - Handle exchange timer expiration |
| 637 | * @work: The work_struct identifying the exchange that timed out | 655 | * @work: The work_struct identifying the exchange that timed out |
| 638 | */ | 656 | */ |
| @@ -1715,6 +1733,7 @@ static void fc_exch_reset(struct fc_exch *ep) | |||
| 1715 | int rc = 1; | 1733 | int rc = 1; |
| 1716 | 1734 | ||
| 1717 | spin_lock_bh(&ep->ex_lock); | 1735 | spin_lock_bh(&ep->ex_lock); |
| 1736 | fc_exch_abort_locked(ep, 0); | ||
| 1718 | ep->state |= FC_EX_RST_CLEANUP; | 1737 | ep->state |= FC_EX_RST_CLEANUP; |
| 1719 | if (cancel_delayed_work(&ep->timeout_work)) | 1738 | if (cancel_delayed_work(&ep->timeout_work)) |
| 1720 | atomic_dec(&ep->ex_refcnt); /* drop hold for timer */ | 1739 | atomic_dec(&ep->ex_refcnt); /* drop hold for timer */ |
| @@ -1962,6 +1981,7 @@ static struct fc_seq *fc_exch_seq_send(struct fc_lport *lport, | |||
| 1962 | struct fc_exch *ep; | 1981 | struct fc_exch *ep; |
| 1963 | struct fc_seq *sp = NULL; | 1982 | struct fc_seq *sp = NULL; |
| 1964 | struct fc_frame_header *fh; | 1983 | struct fc_frame_header *fh; |
| 1984 | struct fc_fcp_pkt *fsp = NULL; | ||
| 1965 | int rc = 1; | 1985 | int rc = 1; |
| 1966 | 1986 | ||
| 1967 | ep = fc_exch_alloc(lport, fp); | 1987 | ep = fc_exch_alloc(lport, fp); |
| @@ -1984,8 +2004,10 @@ static struct fc_seq *fc_exch_seq_send(struct fc_lport *lport, | |||
| 1984 | fc_exch_setup_hdr(ep, fp, ep->f_ctl); | 2004 | fc_exch_setup_hdr(ep, fp, ep->f_ctl); |
| 1985 | sp->cnt++; | 2005 | sp->cnt++; |
| 1986 | 2006 | ||
| 1987 | if (ep->xid <= lport->lro_xid && fh->fh_r_ctl == FC_RCTL_DD_UNSOL_CMD) | 2007 | if (ep->xid <= lport->lro_xid && fh->fh_r_ctl == FC_RCTL_DD_UNSOL_CMD) { |
| 2008 | fsp = fr_fsp(fp); | ||
| 1988 | fc_fcp_ddp_setup(fr_fsp(fp), ep->xid); | 2009 | fc_fcp_ddp_setup(fr_fsp(fp), ep->xid); |
| 2010 | } | ||
| 1989 | 2011 | ||
| 1990 | if (unlikely(lport->tt.frame_send(lport, fp))) | 2012 | if (unlikely(lport->tt.frame_send(lport, fp))) |
| 1991 | goto err; | 2013 | goto err; |
| @@ -1999,7 +2021,8 @@ static struct fc_seq *fc_exch_seq_send(struct fc_lport *lport, | |||
| 1999 | spin_unlock_bh(&ep->ex_lock); | 2021 | spin_unlock_bh(&ep->ex_lock); |
| 2000 | return sp; | 2022 | return sp; |
| 2001 | err: | 2023 | err: |
| 2002 | fc_fcp_ddp_done(fr_fsp(fp)); | 2024 | if (fsp) |
| 2025 | fc_fcp_ddp_done(fsp); | ||
| 2003 | rc = fc_exch_done_locked(ep); | 2026 | rc = fc_exch_done_locked(ep); |
| 2004 | spin_unlock_bh(&ep->ex_lock); | 2027 | spin_unlock_bh(&ep->ex_lock); |
| 2005 | if (!rc) | 2028 | if (!rc) |
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c index afb63c843144..4c41ee816f0b 100644 --- a/drivers/scsi/libfc/fc_fcp.c +++ b/drivers/scsi/libfc/fc_fcp.c | |||
| @@ -2019,6 +2019,11 @@ int fc_eh_abort(struct scsi_cmnd *sc_cmd) | |||
| 2019 | struct fc_fcp_internal *si; | 2019 | struct fc_fcp_internal *si; |
| 2020 | int rc = FAILED; | 2020 | int rc = FAILED; |
| 2021 | unsigned long flags; | 2021 | unsigned long flags; |
| 2022 | int rval; | ||
| 2023 | |||
| 2024 | rval = fc_block_scsi_eh(sc_cmd); | ||
| 2025 | if (rval) | ||
| 2026 | return rval; | ||
| 2022 | 2027 | ||
| 2023 | lport = shost_priv(sc_cmd->device->host); | 2028 | lport = shost_priv(sc_cmd->device->host); |
| 2024 | if (lport->state != LPORT_ST_READY) | 2029 | if (lport->state != LPORT_ST_READY) |
| @@ -2068,9 +2073,9 @@ int fc_eh_device_reset(struct scsi_cmnd *sc_cmd) | |||
| 2068 | int rc = FAILED; | 2073 | int rc = FAILED; |
| 2069 | int rval; | 2074 | int rval; |
| 2070 | 2075 | ||
| 2071 | rval = fc_remote_port_chkready(rport); | 2076 | rval = fc_block_scsi_eh(sc_cmd); |
| 2072 | if (rval) | 2077 | if (rval) |
| 2073 | goto out; | 2078 | return rval; |
| 2074 | 2079 | ||
| 2075 | lport = shost_priv(sc_cmd->device->host); | 2080 | lport = shost_priv(sc_cmd->device->host); |
| 2076 | 2081 | ||
| @@ -2116,6 +2121,8 @@ int fc_eh_host_reset(struct scsi_cmnd *sc_cmd) | |||
| 2116 | 2121 | ||
| 2117 | FC_SCSI_DBG(lport, "Resetting host\n"); | 2122 | FC_SCSI_DBG(lport, "Resetting host\n"); |
| 2118 | 2123 | ||
| 2124 | fc_block_scsi_eh(sc_cmd); | ||
| 2125 | |||
| 2119 | lport->tt.lport_reset(lport); | 2126 | lport->tt.lport_reset(lport); |
| 2120 | wait_tmo = jiffies + FC_HOST_RESET_TIMEOUT; | 2127 | wait_tmo = jiffies + FC_HOST_RESET_TIMEOUT; |
| 2121 | while (!fc_fcp_lport_queue_ready(lport) && time_before(jiffies, | 2128 | while (!fc_fcp_lport_queue_ready(lport) && time_before(jiffies, |
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c index e55ed9cf23fb..628f347404f9 100644 --- a/drivers/scsi/libfc/fc_lport.c +++ b/drivers/scsi/libfc/fc_lport.c | |||
| @@ -88,6 +88,7 @@ | |||
| 88 | */ | 88 | */ |
| 89 | 89 | ||
| 90 | #include <linux/timer.h> | 90 | #include <linux/timer.h> |
| 91 | #include <linux/delay.h> | ||
| 91 | #include <linux/slab.h> | 92 | #include <linux/slab.h> |
| 92 | #include <asm/unaligned.h> | 93 | #include <asm/unaligned.h> |
| 93 | 94 | ||
| @@ -1029,8 +1030,16 @@ static void fc_lport_enter_reset(struct fc_lport *lport) | |||
| 1029 | FCH_EVT_LIPRESET, 0); | 1030 | FCH_EVT_LIPRESET, 0); |
| 1030 | fc_vports_linkchange(lport); | 1031 | fc_vports_linkchange(lport); |
| 1031 | fc_lport_reset_locked(lport); | 1032 | fc_lport_reset_locked(lport); |
| 1032 | if (lport->link_up) | 1033 | if (lport->link_up) { |
| 1034 | /* | ||
| 1035 | * Wait upto resource allocation time out before | ||
| 1036 | * doing re-login since incomplete FIP exchanged | ||
| 1037 | * from last session may collide with exchanges | ||
| 1038 | * in new session. | ||
| 1039 | */ | ||
| 1040 | msleep(lport->r_a_tov); | ||
| 1033 | fc_lport_enter_flogi(lport); | 1041 | fc_lport_enter_flogi(lport); |
| 1042 | } | ||
| 1034 | } | 1043 | } |
| 1035 | 1044 | ||
| 1036 | /** | 1045 | /** |
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 7836eb01c7fc..a31e05f3bfd4 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
| @@ -1786,13 +1786,16 @@ qla24xx_vport_create(struct fc_vport *fc_vport, bool disable) | |||
| 1786 | fc_vport_set_state(fc_vport, FC_VPORT_LINKDOWN); | 1786 | fc_vport_set_state(fc_vport, FC_VPORT_LINKDOWN); |
| 1787 | } | 1787 | } |
| 1788 | 1788 | ||
| 1789 | if ((IS_QLA25XX(ha) || IS_QLA81XX(ha)) && ql2xenabledif) { | 1789 | if (IS_T10_PI_CAPABLE(ha) && ql2xenabledif) { |
| 1790 | if (ha->fw_attributes & BIT_4) { | 1790 | if (ha->fw_attributes & BIT_4) { |
| 1791 | int prot = 0; | ||
| 1791 | vha->flags.difdix_supported = 1; | 1792 | vha->flags.difdix_supported = 1; |
| 1792 | ql_dbg(ql_dbg_user, vha, 0x7082, | 1793 | ql_dbg(ql_dbg_user, vha, 0x7082, |
| 1793 | "Registered for DIF/DIX type 1 and 3 protection.\n"); | 1794 | "Registered for DIF/DIX type 1 and 3 protection.\n"); |
| 1795 | if (ql2xenabledif == 1) | ||
| 1796 | prot = SHOST_DIX_TYPE0_PROTECTION; | ||
| 1794 | scsi_host_set_prot(vha->host, | 1797 | scsi_host_set_prot(vha->host, |
| 1795 | SHOST_DIF_TYPE1_PROTECTION | 1798 | prot | SHOST_DIF_TYPE1_PROTECTION |
| 1796 | | SHOST_DIF_TYPE2_PROTECTION | 1799 | | SHOST_DIF_TYPE2_PROTECTION |
| 1797 | | SHOST_DIF_TYPE3_PROTECTION | 1800 | | SHOST_DIF_TYPE3_PROTECTION |
| 1798 | | SHOST_DIX_TYPE1_PROTECTION | 1801 | | SHOST_DIX_TYPE1_PROTECTION |
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index 2155071f3100..d79cd8a5f831 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c | |||
| @@ -8,24 +8,24 @@ | |||
| 8 | /* | 8 | /* |
| 9 | * Table for showing the current message id in use for particular level | 9 | * Table for showing the current message id in use for particular level |
| 10 | * Change this table for addition of log/debug messages. | 10 | * Change this table for addition of log/debug messages. |
| 11 | * ----------------------------------------------------- | 11 | * ---------------------------------------------------------------------- |
| 12 | * | Level | Last Value Used | | 12 | * | Level | Last Value Used | Holes | |
| 13 | * ----------------------------------------------------- | 13 | * ---------------------------------------------------------------------- |
| 14 | * | Module Init and Probe | 0x0116 | | 14 | * | Module Init and Probe | 0x0116 | | |
| 15 | * | Mailbox commands | 0x111e | | 15 | * | Mailbox commands | 0x1126 | | |
| 16 | * | Device Discovery | 0x2083 | | 16 | * | Device Discovery | 0x2083 | | |
| 17 | * | Queue Command and IO tracing | 0x302e | | 17 | * | Queue Command and IO tracing | 0x302e | 0x3008 | |
| 18 | * | DPC Thread | 0x401c | | 18 | * | DPC Thread | 0x401c | | |
| 19 | * | Async Events | 0x5059 | | 19 | * | Async Events | 0x5059 | | |
| 20 | * | Timer Routines | 0x600d | | 20 | * | Timer Routines | 0x600d | | |
| 21 | * | User Space Interactions | 0x709c | | 21 | * | User Space Interactions | 0x709d | | |
| 22 | * | Task Management | 0x8043 | | 22 | * | Task Management | 0x8041 | | |
| 23 | * | AER/EEH | 0x900f | | 23 | * | AER/EEH | 0x900f | | |
| 24 | * | Virtual Port | 0xa007 | | 24 | * | Virtual Port | 0xa007 | | |
| 25 | * | ISP82XX Specific | 0xb027 | | 25 | * | ISP82XX Specific | 0xb04f | | |
| 26 | * | MultiQ | 0xc00b | | 26 | * | MultiQ | 0xc00b | | |
| 27 | * | Misc | 0xd00b | | 27 | * | Misc | 0xd00b | | |
| 28 | * ----------------------------------------------------- | 28 | * ---------------------------------------------------------------------- |
| 29 | */ | 29 | */ |
| 30 | 30 | ||
| 31 | #include "qla_def.h" | 31 | #include "qla_def.h" |
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index cc5a79259d33..a03eaf40f377 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h | |||
| @@ -2529,6 +2529,7 @@ struct qla_hw_data { | |||
| 2529 | #define DT_ISP8021 BIT_14 | 2529 | #define DT_ISP8021 BIT_14 |
| 2530 | #define DT_ISP_LAST (DT_ISP8021 << 1) | 2530 | #define DT_ISP_LAST (DT_ISP8021 << 1) |
| 2531 | 2531 | ||
| 2532 | #define DT_T10_PI BIT_25 | ||
| 2532 | #define DT_IIDMA BIT_26 | 2533 | #define DT_IIDMA BIT_26 |
| 2533 | #define DT_FWI2 BIT_27 | 2534 | #define DT_FWI2 BIT_27 |
| 2534 | #define DT_ZIO_SUPPORTED BIT_28 | 2535 | #define DT_ZIO_SUPPORTED BIT_28 |
| @@ -2572,6 +2573,7 @@ struct qla_hw_data { | |||
| 2572 | #define IS_NOCACHE_VPD_TYPE(ha) (IS_QLA81XX(ha)) | 2573 | #define IS_NOCACHE_VPD_TYPE(ha) (IS_QLA81XX(ha)) |
| 2573 | #define IS_ALOGIO_CAPABLE(ha) (IS_QLA23XX(ha) || IS_FWI2_CAPABLE(ha)) | 2574 | #define IS_ALOGIO_CAPABLE(ha) (IS_QLA23XX(ha) || IS_FWI2_CAPABLE(ha)) |
| 2574 | 2575 | ||
| 2576 | #define IS_T10_PI_CAPABLE(ha) ((ha)->device_type & DT_T10_PI) | ||
| 2575 | #define IS_IIDMA_CAPABLE(ha) ((ha)->device_type & DT_IIDMA) | 2577 | #define IS_IIDMA_CAPABLE(ha) ((ha)->device_type & DT_IIDMA) |
| 2576 | #define IS_FWI2_CAPABLE(ha) ((ha)->device_type & DT_FWI2) | 2578 | #define IS_FWI2_CAPABLE(ha) ((ha)->device_type & DT_FWI2) |
| 2577 | #define IS_ZIO_SUPPORTED(ha) ((ha)->device_type & DT_ZIO_SUPPORTED) | 2579 | #define IS_ZIO_SUPPORTED(ha) ((ha)->device_type & DT_ZIO_SUPPORTED) |
diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h index 691783abfb69..aa69486dc064 100644 --- a/drivers/scsi/qla2xxx/qla_fw.h +++ b/drivers/scsi/qla2xxx/qla_fw.h | |||
| @@ -537,6 +537,11 @@ struct sts_entry_24xx { | |||
| 537 | /* | 537 | /* |
| 538 | * If DIF Error is set in comp_status, these additional fields are | 538 | * If DIF Error is set in comp_status, these additional fields are |
| 539 | * defined: | 539 | * defined: |
| 540 | * | ||
| 541 | * !!! NOTE: Firmware sends expected/actual DIF data in big endian | ||
| 542 | * format; but all of the "data" field gets swab32-d in the beginning | ||
| 543 | * of qla2x00_status_entry(). | ||
| 544 | * | ||
| 540 | * &data[10] : uint8_t report_runt_bg[2]; - computed guard | 545 | * &data[10] : uint8_t report_runt_bg[2]; - computed guard |
| 541 | * &data[12] : uint8_t actual_dif[8]; - DIF Data received | 546 | * &data[12] : uint8_t actual_dif[8]; - DIF Data received |
| 542 | * &data[20] : uint8_t expected_dif[8]; - DIF Data computed | 547 | * &data[20] : uint8_t expected_dif[8]; - DIF Data computed |
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index def694271bf7..37da04d3db26 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c | |||
| @@ -3838,15 +3838,12 @@ qla2x00_loop_resync(scsi_qla_host_t *vha) | |||
| 3838 | req = vha->req; | 3838 | req = vha->req; |
| 3839 | rsp = req->rsp; | 3839 | rsp = req->rsp; |
| 3840 | 3840 | ||
| 3841 | atomic_set(&vha->loop_state, LOOP_UPDATE); | ||
| 3842 | clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags); | 3841 | clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags); |
| 3843 | if (vha->flags.online) { | 3842 | if (vha->flags.online) { |
| 3844 | if (!(rval = qla2x00_fw_ready(vha))) { | 3843 | if (!(rval = qla2x00_fw_ready(vha))) { |
| 3845 | /* Wait at most MAX_TARGET RSCNs for a stable link. */ | 3844 | /* Wait at most MAX_TARGET RSCNs for a stable link. */ |
| 3846 | wait_time = 256; | 3845 | wait_time = 256; |
| 3847 | do { | 3846 | do { |
| 3848 | atomic_set(&vha->loop_state, LOOP_UPDATE); | ||
| 3849 | |||
| 3850 | /* Issue a marker after FW becomes ready. */ | 3847 | /* Issue a marker after FW becomes ready. */ |
| 3851 | qla2x00_marker(vha, req, rsp, 0, 0, | 3848 | qla2x00_marker(vha, req, rsp, 0, 0, |
| 3852 | MK_SYNC_ALL); | 3849 | MK_SYNC_ALL); |
diff --git a/drivers/scsi/qla2xxx/qla_inline.h b/drivers/scsi/qla2xxx/qla_inline.h index d2e904bc21c0..9902834e0b74 100644 --- a/drivers/scsi/qla2xxx/qla_inline.h +++ b/drivers/scsi/qla2xxx/qla_inline.h | |||
| @@ -102,3 +102,32 @@ qla2x00_set_fcport_state(fc_port_t *fcport, int state) | |||
| 102 | fcport->d_id.b.al_pa); | 102 | fcport->d_id.b.al_pa); |
| 103 | } | 103 | } |
| 104 | } | 104 | } |
| 105 | |||
| 106 | static inline int | ||
| 107 | qla2x00_hba_err_chk_enabled(srb_t *sp) | ||
| 108 | { | ||
| 109 | /* | ||
| 110 | * Uncomment when corresponding SCSI changes are done. | ||
| 111 | * | ||
| 112 | if (!sp->cmd->prot_chk) | ||
| 113 | return 0; | ||
| 114 | * | ||
| 115 | */ | ||
| 116 | |||
| 117 | switch (scsi_get_prot_op(sp->cmd)) { | ||
| 118 | case SCSI_PROT_READ_STRIP: | ||
| 119 | case SCSI_PROT_WRITE_INSERT: | ||
| 120 | if (ql2xenablehba_err_chk >= 1) | ||
| 121 | return 1; | ||
| 122 | break; | ||
| 123 | case SCSI_PROT_READ_PASS: | ||
| 124 | case SCSI_PROT_WRITE_PASS: | ||
| 125 | if (ql2xenablehba_err_chk >= 2) | ||
| 126 | return 1; | ||
| 127 | break; | ||
| 128 | case SCSI_PROT_READ_INSERT: | ||
| 129 | case SCSI_PROT_WRITE_STRIP: | ||
| 130 | return 1; | ||
| 131 | } | ||
| 132 | return 0; | ||
| 133 | } | ||
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index 49d6906af886..dbec89622a0f 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c | |||
| @@ -709,20 +709,28 @@ struct fw_dif_context { | |||
| 709 | * | 709 | * |
| 710 | */ | 710 | */ |
| 711 | static inline void | 711 | static inline void |
| 712 | qla24xx_set_t10dif_tags(struct scsi_cmnd *cmd, struct fw_dif_context *pkt, | 712 | qla24xx_set_t10dif_tags(srb_t *sp, struct fw_dif_context *pkt, |
| 713 | unsigned int protcnt) | 713 | unsigned int protcnt) |
| 714 | { | 714 | { |
| 715 | struct sd_dif_tuple *spt; | 715 | struct scsi_cmnd *cmd = sp->cmd; |
| 716 | scsi_qla_host_t *vha = shost_priv(cmd->device->host); | 716 | scsi_qla_host_t *vha = shost_priv(cmd->device->host); |
| 717 | unsigned char op = scsi_get_prot_op(cmd); | ||
| 718 | 717 | ||
| 719 | switch (scsi_get_prot_type(cmd)) { | 718 | switch (scsi_get_prot_type(cmd)) { |
| 720 | /* For TYPE 0 protection: no checking */ | ||
| 721 | case SCSI_PROT_DIF_TYPE0: | 719 | case SCSI_PROT_DIF_TYPE0: |
| 722 | pkt->ref_tag_mask[0] = 0x00; | 720 | /* |
| 723 | pkt->ref_tag_mask[1] = 0x00; | 721 | * No check for ql2xenablehba_err_chk, as it would be an |
| 724 | pkt->ref_tag_mask[2] = 0x00; | 722 | * I/O error if hba tag generation is not done. |
| 725 | pkt->ref_tag_mask[3] = 0x00; | 723 | */ |
| 724 | pkt->ref_tag = cpu_to_le32((uint32_t) | ||
| 725 | (0xffffffff & scsi_get_lba(cmd))); | ||
| 726 | |||
| 727 | if (!qla2x00_hba_err_chk_enabled(sp)) | ||
| 728 | break; | ||
| 729 | |||
| 730 | pkt->ref_tag_mask[0] = 0xff; | ||
| 731 | pkt->ref_tag_mask[1] = 0xff; | ||
| 732 | pkt->ref_tag_mask[2] = 0xff; | ||
| 733 | pkt->ref_tag_mask[3] = 0xff; | ||
| 726 | break; | 734 | break; |
| 727 | 735 | ||
| 728 | /* | 736 | /* |
| @@ -730,20 +738,16 @@ qla24xx_set_t10dif_tags(struct scsi_cmnd *cmd, struct fw_dif_context *pkt, | |||
| 730 | * match LBA in CDB + N | 738 | * match LBA in CDB + N |
| 731 | */ | 739 | */ |
| 732 | case SCSI_PROT_DIF_TYPE2: | 740 | case SCSI_PROT_DIF_TYPE2: |
| 733 | if (!ql2xenablehba_err_chk) | 741 | pkt->app_tag = __constant_cpu_to_le16(0); |
| 734 | break; | 742 | pkt->app_tag_mask[0] = 0x0; |
| 735 | 743 | pkt->app_tag_mask[1] = 0x0; | |
| 736 | if (scsi_prot_sg_count(cmd)) { | ||
| 737 | spt = page_address(sg_page(scsi_prot_sglist(cmd))) + | ||
| 738 | scsi_prot_sglist(cmd)[0].offset; | ||
| 739 | pkt->app_tag = swab32(spt->app_tag); | ||
| 740 | pkt->app_tag_mask[0] = 0xff; | ||
| 741 | pkt->app_tag_mask[1] = 0xff; | ||
| 742 | } | ||
| 743 | 744 | ||
| 744 | pkt->ref_tag = cpu_to_le32((uint32_t) | 745 | pkt->ref_tag = cpu_to_le32((uint32_t) |
| 745 | (0xffffffff & scsi_get_lba(cmd))); | 746 | (0xffffffff & scsi_get_lba(cmd))); |
| 746 | 747 | ||
| 748 | if (!qla2x00_hba_err_chk_enabled(sp)) | ||
| 749 | break; | ||
| 750 | |||
| 747 | /* enable ALL bytes of the ref tag */ | 751 | /* enable ALL bytes of the ref tag */ |
| 748 | pkt->ref_tag_mask[0] = 0xff; | 752 | pkt->ref_tag_mask[0] = 0xff; |
| 749 | pkt->ref_tag_mask[1] = 0xff; | 753 | pkt->ref_tag_mask[1] = 0xff; |
| @@ -763,26 +767,15 @@ qla24xx_set_t10dif_tags(struct scsi_cmnd *cmd, struct fw_dif_context *pkt, | |||
| 763 | * 16 bit app tag. | 767 | * 16 bit app tag. |
| 764 | */ | 768 | */ |
| 765 | case SCSI_PROT_DIF_TYPE1: | 769 | case SCSI_PROT_DIF_TYPE1: |
| 766 | if (!ql2xenablehba_err_chk) | 770 | pkt->ref_tag = cpu_to_le32((uint32_t) |
| 771 | (0xffffffff & scsi_get_lba(cmd))); | ||
| 772 | pkt->app_tag = __constant_cpu_to_le16(0); | ||
| 773 | pkt->app_tag_mask[0] = 0x0; | ||
| 774 | pkt->app_tag_mask[1] = 0x0; | ||
| 775 | |||
| 776 | if (!qla2x00_hba_err_chk_enabled(sp)) | ||
| 767 | break; | 777 | break; |
| 768 | 778 | ||
| 769 | if (protcnt && (op == SCSI_PROT_WRITE_STRIP || | ||
| 770 | op == SCSI_PROT_WRITE_PASS)) { | ||
| 771 | spt = page_address(sg_page(scsi_prot_sglist(cmd))) + | ||
| 772 | scsi_prot_sglist(cmd)[0].offset; | ||
| 773 | ql_dbg(ql_dbg_io, vha, 0x3008, | ||
| 774 | "LBA from user %p, lba = 0x%x for cmd=%p.\n", | ||
| 775 | spt, (int)spt->ref_tag, cmd); | ||
| 776 | pkt->ref_tag = swab32(spt->ref_tag); | ||
| 777 | pkt->app_tag_mask[0] = 0x0; | ||
| 778 | pkt->app_tag_mask[1] = 0x0; | ||
| 779 | } else { | ||
| 780 | pkt->ref_tag = cpu_to_le32((uint32_t) | ||
| 781 | (0xffffffff & scsi_get_lba(cmd))); | ||
| 782 | pkt->app_tag = __constant_cpu_to_le16(0); | ||
| 783 | pkt->app_tag_mask[0] = 0x0; | ||
| 784 | pkt->app_tag_mask[1] = 0x0; | ||
| 785 | } | ||
| 786 | /* enable ALL bytes of the ref tag */ | 779 | /* enable ALL bytes of the ref tag */ |
| 787 | pkt->ref_tag_mask[0] = 0xff; | 780 | pkt->ref_tag_mask[0] = 0xff; |
| 788 | pkt->ref_tag_mask[1] = 0xff; | 781 | pkt->ref_tag_mask[1] = 0xff; |
| @@ -798,8 +791,162 @@ qla24xx_set_t10dif_tags(struct scsi_cmnd *cmd, struct fw_dif_context *pkt, | |||
| 798 | scsi_get_prot_type(cmd), cmd); | 791 | scsi_get_prot_type(cmd), cmd); |
| 799 | } | 792 | } |
| 800 | 793 | ||
| 794 | struct qla2_sgx { | ||
| 795 | dma_addr_t dma_addr; /* OUT */ | ||
| 796 | uint32_t dma_len; /* OUT */ | ||
| 797 | |||
| 798 | uint32_t tot_bytes; /* IN */ | ||
| 799 | struct scatterlist *cur_sg; /* IN */ | ||
| 800 | |||
| 801 | /* for book keeping, bzero on initial invocation */ | ||
| 802 | uint32_t bytes_consumed; | ||
| 803 | uint32_t num_bytes; | ||
| 804 | uint32_t tot_partial; | ||
| 805 | |||
| 806 | /* for debugging */ | ||
| 807 | uint32_t num_sg; | ||
| 808 | srb_t *sp; | ||
| 809 | }; | ||
| 801 | 810 | ||
| 802 | static int | 811 | static int |
| 812 | qla24xx_get_one_block_sg(uint32_t blk_sz, struct qla2_sgx *sgx, | ||
| 813 | uint32_t *partial) | ||
| 814 | { | ||
| 815 | struct scatterlist *sg; | ||
| 816 | uint32_t cumulative_partial, sg_len; | ||
| 817 | dma_addr_t sg_dma_addr; | ||
| 818 | |||
| 819 | if (sgx->num_bytes == sgx->tot_bytes) | ||
| 820 | return 0; | ||
| 821 | |||
| 822 | sg = sgx->cur_sg; | ||
| 823 | cumulative_partial = sgx->tot_partial; | ||
| 824 | |||
| 825 | sg_dma_addr = sg_dma_address(sg); | ||
| 826 | sg_len = sg_dma_len(sg); | ||
| 827 | |||
| 828 | sgx->dma_addr = sg_dma_addr + sgx->bytes_consumed; | ||
| 829 | |||
| 830 | if ((cumulative_partial + (sg_len - sgx->bytes_consumed)) >= blk_sz) { | ||
| 831 | sgx->dma_len = (blk_sz - cumulative_partial); | ||
| 832 | sgx->tot_partial = 0; | ||
| 833 | sgx->num_bytes += blk_sz; | ||
| 834 | *partial = 0; | ||
| 835 | } else { | ||
| 836 | sgx->dma_len = sg_len - sgx->bytes_consumed; | ||
| 837 | sgx->tot_partial += sgx->dma_len; | ||
| 838 | *partial = 1; | ||
| 839 | } | ||
| 840 | |||
| 841 | sgx->bytes_consumed += sgx->dma_len; | ||
| 842 | |||
| 843 | if (sg_len == sgx->bytes_consumed) { | ||
| 844 | sg = sg_next(sg); | ||
| 845 | sgx->num_sg++; | ||
| 846 | sgx->cur_sg = sg; | ||
| 847 | sgx->bytes_consumed = 0; | ||
| 848 | } | ||
| 849 | |||
| 850 | return 1; | ||
| 851 | } | ||
| 852 | |||
| 853 | static int | ||
| 854 | qla24xx_walk_and_build_sglist_no_difb(struct qla_hw_data *ha, srb_t *sp, | ||
| 855 | uint32_t *dsd, uint16_t tot_dsds) | ||
| 856 | { | ||
| 857 | void *next_dsd; | ||
| 858 | uint8_t avail_dsds = 0; | ||
| 859 | uint32_t dsd_list_len; | ||
| 860 | struct dsd_dma *dsd_ptr; | ||
| 861 | struct scatterlist *sg_prot; | ||
| 862 | uint32_t *cur_dsd = dsd; | ||
| 863 | uint16_t used_dsds = tot_dsds; | ||
| 864 | |||
| 865 | uint32_t prot_int; | ||
| 866 | uint32_t partial; | ||
| 867 | struct qla2_sgx sgx; | ||
| 868 | dma_addr_t sle_dma; | ||
| 869 | uint32_t sle_dma_len, tot_prot_dma_len = 0; | ||
| 870 | struct scsi_cmnd *cmd = sp->cmd; | ||
| 871 | |||
| 872 | prot_int = cmd->device->sector_size; | ||
| 873 | |||
| 874 | memset(&sgx, 0, sizeof(struct qla2_sgx)); | ||
| 875 | sgx.tot_bytes = scsi_bufflen(sp->cmd); | ||
| 876 | sgx.cur_sg = scsi_sglist(sp->cmd); | ||
| 877 | sgx.sp = sp; | ||
| 878 | |||
| 879 | sg_prot = scsi_prot_sglist(sp->cmd); | ||
| 880 | |||
| 881 | while (qla24xx_get_one_block_sg(prot_int, &sgx, &partial)) { | ||
| 882 | |||
| 883 | sle_dma = sgx.dma_addr; | ||
| 884 | sle_dma_len = sgx.dma_len; | ||
| 885 | alloc_and_fill: | ||
| 886 | /* Allocate additional continuation packets? */ | ||
| 887 | if (avail_dsds == 0) { | ||
| 888 | avail_dsds = (used_dsds > QLA_DSDS_PER_IOCB) ? | ||
| 889 | QLA_DSDS_PER_IOCB : used_dsds; | ||
| 890 | dsd_list_len = (avail_dsds + 1) * 12; | ||
| 891 | used_dsds -= avail_dsds; | ||
| 892 | |||
| 893 | /* allocate tracking DS */ | ||
| 894 | dsd_ptr = kzalloc(sizeof(struct dsd_dma), GFP_ATOMIC); | ||
| 895 | if (!dsd_ptr) | ||
| 896 | return 1; | ||
| 897 | |||
| 898 | /* allocate new list */ | ||
| 899 | dsd_ptr->dsd_addr = next_dsd = | ||
| 900 | dma_pool_alloc(ha->dl_dma_pool, GFP_ATOMIC, | ||
| 901 | &dsd_ptr->dsd_list_dma); | ||
| 902 | |||
| 903 | if (!next_dsd) { | ||
| 904 | /* | ||
| 905 | * Need to cleanup only this dsd_ptr, rest | ||
| 906 | * will be done by sp_free_dma() | ||
| 907 | */ | ||
| 908 | kfree(dsd_ptr); | ||
| 909 | return 1; | ||
| 910 | } | ||
| 911 | |||
| 912 | list_add_tail(&dsd_ptr->list, | ||
| 913 | &((struct crc_context *)sp->ctx)->dsd_list); | ||
| 914 | |||
| 915 | sp->flags |= SRB_CRC_CTX_DSD_VALID; | ||
| 916 | |||
| 917 | /* add new list to cmd iocb or last list */ | ||
| 918 | *cur_dsd++ = cpu_to_le32(LSD(dsd_ptr->dsd_list_dma)); | ||
| 919 | *cur_dsd++ = cpu_to_le32(MSD(dsd_ptr->dsd_list_dma)); | ||
| 920 | *cur_dsd++ = dsd_list_len; | ||
| 921 | cur_dsd = (uint32_t *)next_dsd; | ||
| 922 | } | ||
| 923 | *cur_dsd++ = cpu_to_le32(LSD(sle_dma)); | ||
| 924 | *cur_dsd++ = cpu_to_le32(MSD(sle_dma)); | ||
| 925 | *cur_dsd++ = cpu_to_le32(sle_dma_len); | ||
| 926 | avail_dsds--; | ||
| 927 | |||
| 928 | if (partial == 0) { | ||
| 929 | /* Got a full protection interval */ | ||
| 930 | sle_dma = sg_dma_address(sg_prot) + tot_prot_dma_len; | ||
| 931 | sle_dma_len = 8; | ||
| 932 | |||
| 933 | tot_prot_dma_len += sle_dma_len; | ||
| 934 | if (tot_prot_dma_len == sg_dma_len(sg_prot)) { | ||
| 935 | tot_prot_dma_len = 0; | ||
| 936 | sg_prot = sg_next(sg_prot); | ||
| 937 | } | ||
| 938 | |||
| 939 | partial = 1; /* So as to not re-enter this block */ | ||
| 940 | goto alloc_and_fill; | ||
| 941 | } | ||
| 942 | } | ||
| 943 | /* Null termination */ | ||
| 944 | *cur_dsd++ = 0; | ||
| 945 | *cur_dsd++ = 0; | ||
| 946 | *cur_dsd++ = 0; | ||
| 947 | return 0; | ||
| 948 | } | ||
| 949 | static int | ||
| 803 | qla24xx_walk_and_build_sglist(struct qla_hw_data *ha, srb_t *sp, uint32_t *dsd, | 950 | qla24xx_walk_and_build_sglist(struct qla_hw_data *ha, srb_t *sp, uint32_t *dsd, |
| 804 | uint16_t tot_dsds) | 951 | uint16_t tot_dsds) |
| 805 | { | 952 | { |
| @@ -981,7 +1128,7 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt, | |||
| 981 | struct scsi_cmnd *cmd; | 1128 | struct scsi_cmnd *cmd; |
| 982 | struct scatterlist *cur_seg; | 1129 | struct scatterlist *cur_seg; |
| 983 | int sgc; | 1130 | int sgc; |
| 984 | uint32_t total_bytes; | 1131 | uint32_t total_bytes = 0; |
| 985 | uint32_t data_bytes; | 1132 | uint32_t data_bytes; |
| 986 | uint32_t dif_bytes; | 1133 | uint32_t dif_bytes; |
| 987 | uint8_t bundling = 1; | 1134 | uint8_t bundling = 1; |
| @@ -1023,8 +1170,10 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt, | |||
| 1023 | __constant_cpu_to_le16(CF_READ_DATA); | 1170 | __constant_cpu_to_le16(CF_READ_DATA); |
| 1024 | } | 1171 | } |
| 1025 | 1172 | ||
| 1026 | tot_prot_dsds = scsi_prot_sg_count(cmd); | 1173 | if ((scsi_get_prot_op(sp->cmd) == SCSI_PROT_READ_INSERT) || |
| 1027 | if (!tot_prot_dsds) | 1174 | (scsi_get_prot_op(sp->cmd) == SCSI_PROT_WRITE_STRIP) || |
| 1175 | (scsi_get_prot_op(sp->cmd) == SCSI_PROT_READ_STRIP) || | ||
| 1176 | (scsi_get_prot_op(sp->cmd) == SCSI_PROT_WRITE_INSERT)) | ||
| 1028 | bundling = 0; | 1177 | bundling = 0; |
| 1029 | 1178 | ||
| 1030 | /* Allocate CRC context from global pool */ | 1179 | /* Allocate CRC context from global pool */ |
| @@ -1047,7 +1196,7 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt, | |||
| 1047 | 1196 | ||
| 1048 | INIT_LIST_HEAD(&crc_ctx_pkt->dsd_list); | 1197 | INIT_LIST_HEAD(&crc_ctx_pkt->dsd_list); |
| 1049 | 1198 | ||
| 1050 | qla24xx_set_t10dif_tags(cmd, (struct fw_dif_context *) | 1199 | qla24xx_set_t10dif_tags(sp, (struct fw_dif_context *) |
| 1051 | &crc_ctx_pkt->ref_tag, tot_prot_dsds); | 1200 | &crc_ctx_pkt->ref_tag, tot_prot_dsds); |
| 1052 | 1201 | ||
| 1053 | cmd_pkt->crc_context_address[0] = cpu_to_le32(LSD(crc_ctx_dma)); | 1202 | cmd_pkt->crc_context_address[0] = cpu_to_le32(LSD(crc_ctx_dma)); |
| @@ -1076,7 +1225,6 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt, | |||
| 1076 | fcp_cmnd->additional_cdb_len |= 2; | 1225 | fcp_cmnd->additional_cdb_len |= 2; |
| 1077 | 1226 | ||
| 1078 | int_to_scsilun(sp->cmd->device->lun, &fcp_cmnd->lun); | 1227 | int_to_scsilun(sp->cmd->device->lun, &fcp_cmnd->lun); |
| 1079 | host_to_fcp_swap((uint8_t *)&fcp_cmnd->lun, sizeof(fcp_cmnd->lun)); | ||
| 1080 | memcpy(fcp_cmnd->cdb, cmd->cmnd, cmd->cmd_len); | 1228 | memcpy(fcp_cmnd->cdb, cmd->cmnd, cmd->cmd_len); |
| 1081 | cmd_pkt->fcp_cmnd_dseg_len = cpu_to_le16(fcp_cmnd_len); | 1229 | cmd_pkt->fcp_cmnd_dseg_len = cpu_to_le16(fcp_cmnd_len); |
| 1082 | cmd_pkt->fcp_cmnd_dseg_address[0] = cpu_to_le32( | 1230 | cmd_pkt->fcp_cmnd_dseg_address[0] = cpu_to_le32( |
| @@ -1107,15 +1255,28 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt, | |||
| 1107 | cmd_pkt->fcp_rsp_dseg_len = 0; /* Let response come in status iocb */ | 1255 | cmd_pkt->fcp_rsp_dseg_len = 0; /* Let response come in status iocb */ |
| 1108 | 1256 | ||
| 1109 | /* Compute dif len and adjust data len to incude protection */ | 1257 | /* Compute dif len and adjust data len to incude protection */ |
| 1110 | total_bytes = data_bytes; | ||
| 1111 | dif_bytes = 0; | 1258 | dif_bytes = 0; |
| 1112 | blk_size = cmd->device->sector_size; | 1259 | blk_size = cmd->device->sector_size; |
| 1113 | if (scsi_get_prot_op(cmd) != SCSI_PROT_NORMAL) { | 1260 | dif_bytes = (data_bytes / blk_size) * 8; |
| 1114 | dif_bytes = (data_bytes / blk_size) * 8; | 1261 | |
| 1115 | total_bytes += dif_bytes; | 1262 | switch (scsi_get_prot_op(sp->cmd)) { |
| 1263 | case SCSI_PROT_READ_INSERT: | ||
| 1264 | case SCSI_PROT_WRITE_STRIP: | ||
| 1265 | total_bytes = data_bytes; | ||
| 1266 | data_bytes += dif_bytes; | ||
| 1267 | break; | ||
| 1268 | |||
| 1269 | case SCSI_PROT_READ_STRIP: | ||
| 1270 | case SCSI_PROT_WRITE_INSERT: | ||
| 1271 | case SCSI_PROT_READ_PASS: | ||
| 1272 | case SCSI_PROT_WRITE_PASS: | ||
| 1273 | total_bytes = data_bytes + dif_bytes; | ||
| 1274 | break; | ||
| 1275 | default: | ||
| 1276 | BUG(); | ||
| 1116 | } | 1277 | } |
| 1117 | 1278 | ||
| 1118 | if (!ql2xenablehba_err_chk) | 1279 | if (!qla2x00_hba_err_chk_enabled(sp)) |
| 1119 | fw_prot_opts |= 0x10; /* Disable Guard tag checking */ | 1280 | fw_prot_opts |= 0x10; /* Disable Guard tag checking */ |
| 1120 | 1281 | ||
| 1121 | if (!bundling) { | 1282 | if (!bundling) { |
| @@ -1151,7 +1312,12 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt, | |||
| 1151 | 1312 | ||
| 1152 | cmd_pkt->control_flags |= | 1313 | cmd_pkt->control_flags |= |
| 1153 | __constant_cpu_to_le16(CF_DATA_SEG_DESCR_ENABLE); | 1314 | __constant_cpu_to_le16(CF_DATA_SEG_DESCR_ENABLE); |
| 1154 | if (qla24xx_walk_and_build_sglist(ha, sp, cur_dsd, | 1315 | |
| 1316 | if (!bundling && tot_prot_dsds) { | ||
| 1317 | if (qla24xx_walk_and_build_sglist_no_difb(ha, sp, | ||
| 1318 | cur_dsd, tot_dsds)) | ||
| 1319 | goto crc_queuing_error; | ||
| 1320 | } else if (qla24xx_walk_and_build_sglist(ha, sp, cur_dsd, | ||
| 1155 | (tot_dsds - tot_prot_dsds))) | 1321 | (tot_dsds - tot_prot_dsds))) |
| 1156 | goto crc_queuing_error; | 1322 | goto crc_queuing_error; |
| 1157 | 1323 | ||
| @@ -1414,6 +1580,22 @@ qla24xx_dif_start_scsi(srb_t *sp) | |||
| 1414 | goto queuing_error; | 1580 | goto queuing_error; |
| 1415 | else | 1581 | else |
| 1416 | sp->flags |= SRB_DMA_VALID; | 1582 | sp->flags |= SRB_DMA_VALID; |
| 1583 | |||
| 1584 | if ((scsi_get_prot_op(cmd) == SCSI_PROT_READ_INSERT) || | ||
| 1585 | (scsi_get_prot_op(cmd) == SCSI_PROT_WRITE_STRIP)) { | ||
| 1586 | struct qla2_sgx sgx; | ||
| 1587 | uint32_t partial; | ||
| 1588 | |||
| 1589 | memset(&sgx, 0, sizeof(struct qla2_sgx)); | ||
| 1590 | sgx.tot_bytes = scsi_bufflen(cmd); | ||
| 1591 | sgx.cur_sg = scsi_sglist(cmd); | ||
| 1592 | sgx.sp = sp; | ||
| 1593 | |||
| 1594 | nseg = 0; | ||
| 1595 | while (qla24xx_get_one_block_sg( | ||
| 1596 | cmd->device->sector_size, &sgx, &partial)) | ||
| 1597 | nseg++; | ||
| 1598 | } | ||
| 1417 | } else | 1599 | } else |
| 1418 | nseg = 0; | 1600 | nseg = 0; |
| 1419 | 1601 | ||
| @@ -1428,6 +1610,11 @@ qla24xx_dif_start_scsi(srb_t *sp) | |||
| 1428 | goto queuing_error; | 1610 | goto queuing_error; |
| 1429 | else | 1611 | else |
| 1430 | sp->flags |= SRB_CRC_PROT_DMA_VALID; | 1612 | sp->flags |= SRB_CRC_PROT_DMA_VALID; |
| 1613 | |||
| 1614 | if ((scsi_get_prot_op(cmd) == SCSI_PROT_READ_INSERT) || | ||
| 1615 | (scsi_get_prot_op(cmd) == SCSI_PROT_WRITE_STRIP)) { | ||
| 1616 | nseg = scsi_bufflen(cmd) / cmd->device->sector_size; | ||
| 1617 | } | ||
| 1431 | } else { | 1618 | } else { |
| 1432 | nseg = 0; | 1619 | nseg = 0; |
| 1433 | } | 1620 | } |
| @@ -1454,6 +1641,7 @@ qla24xx_dif_start_scsi(srb_t *sp) | |||
| 1454 | /* Build header part of command packet (excluding the OPCODE). */ | 1641 | /* Build header part of command packet (excluding the OPCODE). */ |
| 1455 | req->current_outstanding_cmd = handle; | 1642 | req->current_outstanding_cmd = handle; |
| 1456 | req->outstanding_cmds[handle] = sp; | 1643 | req->outstanding_cmds[handle] = sp; |
| 1644 | sp->handle = handle; | ||
| 1457 | sp->cmd->host_scribble = (unsigned char *)(unsigned long)handle; | 1645 | sp->cmd->host_scribble = (unsigned char *)(unsigned long)handle; |
| 1458 | req->cnt -= req_cnt; | 1646 | req->cnt -= req_cnt; |
| 1459 | 1647 | ||
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index b16b7725dee0..646fc5263d50 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c | |||
| @@ -719,7 +719,6 @@ skip_rio: | |||
| 719 | vha->flags.rscn_queue_overflow = 1; | 719 | vha->flags.rscn_queue_overflow = 1; |
| 720 | } | 720 | } |
| 721 | 721 | ||
| 722 | atomic_set(&vha->loop_state, LOOP_UPDATE); | ||
| 723 | atomic_set(&vha->loop_down_timer, 0); | 722 | atomic_set(&vha->loop_down_timer, 0); |
| 724 | vha->flags.management_server_logged_in = 0; | 723 | vha->flags.management_server_logged_in = 0; |
| 725 | 724 | ||
| @@ -1435,25 +1434,27 @@ struct scsi_dif_tuple { | |||
| 1435 | * ASC/ASCQ fields in the sense buffer with ILLEGAL_REQUEST | 1434 | * ASC/ASCQ fields in the sense buffer with ILLEGAL_REQUEST |
| 1436 | * to indicate to the kernel that the HBA detected error. | 1435 | * to indicate to the kernel that the HBA detected error. |
| 1437 | */ | 1436 | */ |
| 1438 | static inline void | 1437 | static inline int |
| 1439 | qla2x00_handle_dif_error(srb_t *sp, struct sts_entry_24xx *sts24) | 1438 | qla2x00_handle_dif_error(srb_t *sp, struct sts_entry_24xx *sts24) |
| 1440 | { | 1439 | { |
| 1441 | struct scsi_qla_host *vha = sp->fcport->vha; | 1440 | struct scsi_qla_host *vha = sp->fcport->vha; |
| 1442 | struct scsi_cmnd *cmd = sp->cmd; | 1441 | struct scsi_cmnd *cmd = sp->cmd; |
| 1443 | struct scsi_dif_tuple *ep = | 1442 | uint8_t *ap = &sts24->data[12]; |
| 1444 | (struct scsi_dif_tuple *)&sts24->data[20]; | 1443 | uint8_t *ep = &sts24->data[20]; |
| 1445 | struct scsi_dif_tuple *ap = | ||
| 1446 | (struct scsi_dif_tuple *)&sts24->data[12]; | ||
| 1447 | uint32_t e_ref_tag, a_ref_tag; | 1444 | uint32_t e_ref_tag, a_ref_tag; |
| 1448 | uint16_t e_app_tag, a_app_tag; | 1445 | uint16_t e_app_tag, a_app_tag; |
| 1449 | uint16_t e_guard, a_guard; | 1446 | uint16_t e_guard, a_guard; |
| 1450 | 1447 | ||
| 1451 | e_ref_tag = be32_to_cpu(ep->ref_tag); | 1448 | /* |
| 1452 | a_ref_tag = be32_to_cpu(ap->ref_tag); | 1449 | * swab32 of the "data" field in the beginning of qla2x00_status_entry() |
| 1453 | e_app_tag = be16_to_cpu(ep->app_tag); | 1450 | * would make guard field appear at offset 2 |
| 1454 | a_app_tag = be16_to_cpu(ap->app_tag); | 1451 | */ |
| 1455 | e_guard = be16_to_cpu(ep->guard); | 1452 | a_guard = le16_to_cpu(*(uint16_t *)(ap + 2)); |
| 1456 | a_guard = be16_to_cpu(ap->guard); | 1453 | a_app_tag = le16_to_cpu(*(uint16_t *)(ap + 0)); |
| 1454 | a_ref_tag = le32_to_cpu(*(uint32_t *)(ap + 4)); | ||
| 1455 | e_guard = le16_to_cpu(*(uint16_t *)(ep + 2)); | ||
| 1456 | e_app_tag = le16_to_cpu(*(uint16_t *)(ep + 0)); | ||
| 1457 | e_ref_tag = le32_to_cpu(*(uint32_t *)(ep + 4)); | ||
| 1457 | 1458 | ||
| 1458 | ql_dbg(ql_dbg_io, vha, 0x3023, | 1459 | ql_dbg(ql_dbg_io, vha, 0x3023, |
| 1459 | "iocb(s) %p Returned STATUS.\n", sts24); | 1460 | "iocb(s) %p Returned STATUS.\n", sts24); |
| @@ -1465,6 +1466,63 @@ qla2x00_handle_dif_error(srb_t *sp, struct sts_entry_24xx *sts24) | |||
| 1465 | cmd->cmnd[0], (u64)scsi_get_lba(cmd), a_ref_tag, e_ref_tag, | 1466 | cmd->cmnd[0], (u64)scsi_get_lba(cmd), a_ref_tag, e_ref_tag, |
| 1466 | a_app_tag, e_app_tag, a_guard, e_guard); | 1467 | a_app_tag, e_app_tag, a_guard, e_guard); |
| 1467 | 1468 | ||
| 1469 | /* | ||
| 1470 | * Ignore sector if: | ||
| 1471 | * For type 3: ref & app tag is all 'f's | ||
| 1472 | * For type 0,1,2: app tag is all 'f's | ||
| 1473 | */ | ||
| 1474 | if ((a_app_tag == 0xffff) && | ||
| 1475 | ((scsi_get_prot_type(cmd) != SCSI_PROT_DIF_TYPE3) || | ||
| 1476 | (a_ref_tag == 0xffffffff))) { | ||
| 1477 | uint32_t blocks_done, resid; | ||
| 1478 | sector_t lba_s = scsi_get_lba(cmd); | ||
| 1479 | |||
| 1480 | /* 2TB boundary case covered automatically with this */ | ||
| 1481 | blocks_done = e_ref_tag - (uint32_t)lba_s + 1; | ||
| 1482 | |||
| 1483 | resid = scsi_bufflen(cmd) - (blocks_done * | ||
| 1484 | cmd->device->sector_size); | ||
| 1485 | |||
| 1486 | scsi_set_resid(cmd, resid); | ||
| 1487 | cmd->result = DID_OK << 16; | ||
| 1488 | |||
| 1489 | /* Update protection tag */ | ||
| 1490 | if (scsi_prot_sg_count(cmd)) { | ||
| 1491 | uint32_t i, j = 0, k = 0, num_ent; | ||
| 1492 | struct scatterlist *sg; | ||
| 1493 | struct sd_dif_tuple *spt; | ||
| 1494 | |||
| 1495 | /* Patch the corresponding protection tags */ | ||
| 1496 | scsi_for_each_prot_sg(cmd, sg, | ||
| 1497 | scsi_prot_sg_count(cmd), i) { | ||
| 1498 | num_ent = sg_dma_len(sg) / 8; | ||
| 1499 | if (k + num_ent < blocks_done) { | ||
| 1500 | k += num_ent; | ||
| 1501 | continue; | ||
| 1502 | } | ||
| 1503 | j = blocks_done - k - 1; | ||
| 1504 | k = blocks_done; | ||
| 1505 | break; | ||
| 1506 | } | ||
| 1507 | |||
| 1508 | if (k != blocks_done) { | ||
| 1509 | qla_printk(KERN_WARNING, sp->fcport->vha->hw, | ||
| 1510 | "unexpected tag values tag:lba=%x:%lx)\n", | ||
| 1511 | e_ref_tag, lba_s); | ||
| 1512 | return 1; | ||
| 1513 | } | ||
| 1514 | |||
| 1515 | spt = page_address(sg_page(sg)) + sg->offset; | ||
| 1516 | spt += j; | ||
| 1517 | |||
| 1518 | spt->app_tag = 0xffff; | ||
| 1519 | if (scsi_get_prot_type(cmd) == SCSI_PROT_DIF_TYPE3) | ||
| 1520 | spt->ref_tag = 0xffffffff; | ||
| 1521 | } | ||
| 1522 | |||
| 1523 | return 0; | ||
| 1524 | } | ||
| 1525 | |||
| 1468 | /* check guard */ | 1526 | /* check guard */ |
| 1469 | if (e_guard != a_guard) { | 1527 | if (e_guard != a_guard) { |
| 1470 | scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST, | 1528 | scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST, |
| @@ -1472,28 +1530,30 @@ qla2x00_handle_dif_error(srb_t *sp, struct sts_entry_24xx *sts24) | |||
| 1472 | set_driver_byte(cmd, DRIVER_SENSE); | 1530 | set_driver_byte(cmd, DRIVER_SENSE); |
| 1473 | set_host_byte(cmd, DID_ABORT); | 1531 | set_host_byte(cmd, DID_ABORT); |
| 1474 | cmd->result |= SAM_STAT_CHECK_CONDITION << 1; | 1532 | cmd->result |= SAM_STAT_CHECK_CONDITION << 1; |
| 1475 | return; | 1533 | return 1; |
| 1476 | } | 1534 | } |
| 1477 | 1535 | ||
| 1478 | /* check appl tag */ | 1536 | /* check ref tag */ |
| 1479 | if (e_app_tag != a_app_tag) { | 1537 | if (e_ref_tag != a_ref_tag) { |
| 1480 | scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST, | 1538 | scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST, |
| 1481 | 0x10, 0x2); | 1539 | 0x10, 0x3); |
| 1482 | set_driver_byte(cmd, DRIVER_SENSE); | 1540 | set_driver_byte(cmd, DRIVER_SENSE); |
| 1483 | set_host_byte(cmd, DID_ABORT); | 1541 | set_host_byte(cmd, DID_ABORT); |
| 1484 | cmd->result |= SAM_STAT_CHECK_CONDITION << 1; | 1542 | cmd->result |= SAM_STAT_CHECK_CONDITION << 1; |
| 1485 | return; | 1543 | return 1; |
| 1486 | } | 1544 | } |
| 1487 | 1545 | ||
| 1488 | /* check ref tag */ | 1546 | /* check appl tag */ |
| 1489 | if (e_ref_tag != a_ref_tag) { | 1547 | if (e_app_tag != a_app_tag) { |
| 1490 | scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST, | 1548 | scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST, |
| 1491 | 0x10, 0x3); | 1549 | 0x10, 0x2); |
| 1492 | set_driver_byte(cmd, DRIVER_SENSE); | 1550 | set_driver_byte(cmd, DRIVER_SENSE); |
| 1493 | set_host_byte(cmd, DID_ABORT); | 1551 | set_host_byte(cmd, DID_ABORT); |
| 1494 | cmd->result |= SAM_STAT_CHECK_CONDITION << 1; | 1552 | cmd->result |= SAM_STAT_CHECK_CONDITION << 1; |
| 1495 | return; | 1553 | return 1; |
| 1496 | } | 1554 | } |
| 1555 | |||
| 1556 | return 1; | ||
| 1497 | } | 1557 | } |
| 1498 | 1558 | ||
| 1499 | /** | 1559 | /** |
| @@ -1767,7 +1827,7 @@ check_scsi_status: | |||
| 1767 | break; | 1827 | break; |
| 1768 | 1828 | ||
| 1769 | case CS_DIF_ERROR: | 1829 | case CS_DIF_ERROR: |
| 1770 | qla2x00_handle_dif_error(sp, sts24); | 1830 | logit = qla2x00_handle_dif_error(sp, sts24); |
| 1771 | break; | 1831 | break; |
| 1772 | default: | 1832 | default: |
| 1773 | cp->result = DID_ERROR << 16; | 1833 | cp->result = DID_ERROR << 16; |
| @@ -2468,11 +2528,10 @@ qla2x00_request_irqs(struct qla_hw_data *ha, struct rsp_que *rsp) | |||
| 2468 | goto skip_msi; | 2528 | goto skip_msi; |
| 2469 | } | 2529 | } |
| 2470 | 2530 | ||
| 2471 | if (IS_QLA2432(ha) && (ha->pdev->revision < QLA_MSIX_CHIP_REV_24XX || | 2531 | if (IS_QLA2432(ha) && (ha->pdev->revision < QLA_MSIX_CHIP_REV_24XX)) { |
| 2472 | !QLA_MSIX_FW_MODE_1(ha->fw_attributes))) { | ||
| 2473 | ql_log(ql_log_warn, vha, 0x0035, | 2532 | ql_log(ql_log_warn, vha, 0x0035, |
| 2474 | "MSI-X; Unsupported ISP2432 (0x%X, 0x%X).\n", | 2533 | "MSI-X; Unsupported ISP2432 (0x%X, 0x%X).\n", |
| 2475 | ha->pdev->revision, ha->fw_attributes); | 2534 | ha->pdev->revision, QLA_MSIX_CHIP_REV_24XX); |
| 2476 | goto skip_msix; | 2535 | goto skip_msix; |
| 2477 | } | 2536 | } |
| 2478 | 2537 | ||
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c index c706ed370000..f488cc69fc79 100644 --- a/drivers/scsi/qla2xxx/qla_mid.c +++ b/drivers/scsi/qla2xxx/qla_mid.c | |||
| @@ -472,7 +472,7 @@ qla24xx_create_vhost(struct fc_vport *fc_vport) | |||
| 472 | host->can_queue = base_vha->req->length + 128; | 472 | host->can_queue = base_vha->req->length + 128; |
| 473 | host->this_id = 255; | 473 | host->this_id = 255; |
| 474 | host->cmd_per_lun = 3; | 474 | host->cmd_per_lun = 3; |
| 475 | if ((IS_QLA25XX(ha) || IS_QLA81XX(ha)) && ql2xenabledif) | 475 | if (IS_T10_PI_CAPABLE(ha) && ql2xenabledif) |
| 476 | host->max_cmd_len = 32; | 476 | host->max_cmd_len = 32; |
| 477 | else | 477 | else |
| 478 | host->max_cmd_len = MAX_CMDSZ; | 478 | host->max_cmd_len = MAX_CMDSZ; |
diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c index 5cbf33a50b14..049807cda419 100644 --- a/drivers/scsi/qla2xxx/qla_nx.c +++ b/drivers/scsi/qla2xxx/qla_nx.c | |||
| @@ -2208,6 +2208,7 @@ qla82xx_msix_rsp_q(int irq, void *dev_id) | |||
| 2208 | struct qla_hw_data *ha; | 2208 | struct qla_hw_data *ha; |
| 2209 | struct rsp_que *rsp; | 2209 | struct rsp_que *rsp; |
| 2210 | struct device_reg_82xx __iomem *reg; | 2210 | struct device_reg_82xx __iomem *reg; |
| 2211 | unsigned long flags; | ||
| 2211 | 2212 | ||
| 2212 | rsp = (struct rsp_que *) dev_id; | 2213 | rsp = (struct rsp_que *) dev_id; |
| 2213 | if (!rsp) { | 2214 | if (!rsp) { |
| @@ -2218,11 +2219,11 @@ qla82xx_msix_rsp_q(int irq, void *dev_id) | |||
| 2218 | 2219 | ||
| 2219 | ha = rsp->hw; | 2220 | ha = rsp->hw; |
| 2220 | reg = &ha->iobase->isp82; | 2221 | reg = &ha->iobase->isp82; |
| 2221 | spin_lock_irq(&ha->hardware_lock); | 2222 | spin_lock_irqsave(&ha->hardware_lock, flags); |
| 2222 | vha = pci_get_drvdata(ha->pdev); | 2223 | vha = pci_get_drvdata(ha->pdev); |
| 2223 | qla24xx_process_response_queue(vha, rsp); | 2224 | qla24xx_process_response_queue(vha, rsp); |
| 2224 | WRT_REG_DWORD(®->host_int, 0); | 2225 | WRT_REG_DWORD(®->host_int, 0); |
| 2225 | spin_unlock_irq(&ha->hardware_lock); | 2226 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
| 2226 | return IRQ_HANDLED; | 2227 | return IRQ_HANDLED; |
| 2227 | } | 2228 | } |
| 2228 | 2229 | ||
| @@ -2838,6 +2839,16 @@ sufficient_dsds: | |||
| 2838 | int_to_scsilun(sp->cmd->device->lun, &cmd_pkt->lun); | 2839 | int_to_scsilun(sp->cmd->device->lun, &cmd_pkt->lun); |
| 2839 | host_to_fcp_swap((uint8_t *)&cmd_pkt->lun, sizeof(cmd_pkt->lun)); | 2840 | host_to_fcp_swap((uint8_t *)&cmd_pkt->lun, sizeof(cmd_pkt->lun)); |
| 2840 | 2841 | ||
| 2842 | /* build FCP_CMND IU */ | ||
| 2843 | memset(ctx->fcp_cmnd, 0, sizeof(struct fcp_cmnd)); | ||
| 2844 | int_to_scsilun(sp->cmd->device->lun, &ctx->fcp_cmnd->lun); | ||
| 2845 | ctx->fcp_cmnd->additional_cdb_len = additional_cdb_len; | ||
| 2846 | |||
| 2847 | if (cmd->sc_data_direction == DMA_TO_DEVICE) | ||
| 2848 | ctx->fcp_cmnd->additional_cdb_len |= 1; | ||
| 2849 | else if (cmd->sc_data_direction == DMA_FROM_DEVICE) | ||
| 2850 | ctx->fcp_cmnd->additional_cdb_len |= 2; | ||
| 2851 | |||
| 2841 | /* | 2852 | /* |
| 2842 | * Update tagged queuing modifier -- default is TSK_SIMPLE (0). | 2853 | * Update tagged queuing modifier -- default is TSK_SIMPLE (0). |
| 2843 | */ | 2854 | */ |
| @@ -2854,16 +2865,6 @@ sufficient_dsds: | |||
| 2854 | } | 2865 | } |
| 2855 | } | 2866 | } |
| 2856 | 2867 | ||
| 2857 | /* build FCP_CMND IU */ | ||
| 2858 | memset(ctx->fcp_cmnd, 0, sizeof(struct fcp_cmnd)); | ||
| 2859 | int_to_scsilun(sp->cmd->device->lun, &ctx->fcp_cmnd->lun); | ||
| 2860 | ctx->fcp_cmnd->additional_cdb_len = additional_cdb_len; | ||
| 2861 | |||
| 2862 | if (cmd->sc_data_direction == DMA_TO_DEVICE) | ||
| 2863 | ctx->fcp_cmnd->additional_cdb_len |= 1; | ||
| 2864 | else if (cmd->sc_data_direction == DMA_FROM_DEVICE) | ||
| 2865 | ctx->fcp_cmnd->additional_cdb_len |= 2; | ||
| 2866 | |||
| 2867 | memcpy(ctx->fcp_cmnd->cdb, cmd->cmnd, cmd->cmd_len); | 2868 | memcpy(ctx->fcp_cmnd->cdb, cmd->cmnd, cmd->cmd_len); |
| 2868 | 2869 | ||
| 2869 | fcp_dl = (uint32_t *)(ctx->fcp_cmnd->cdb + 16 + | 2870 | fcp_dl = (uint32_t *)(ctx->fcp_cmnd->cdb + 16 + |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index e02df276804e..4cace3f20c04 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
| @@ -106,17 +106,21 @@ MODULE_PARM_DESC(ql2xmaxqdepth, | |||
| 106 | "Maximum queue depth to report for target devices."); | 106 | "Maximum queue depth to report for target devices."); |
| 107 | 107 | ||
| 108 | /* Do not change the value of this after module load */ | 108 | /* Do not change the value of this after module load */ |
| 109 | int ql2xenabledif = 1; | 109 | int ql2xenabledif = 0; |
| 110 | module_param(ql2xenabledif, int, S_IRUGO|S_IWUSR); | 110 | module_param(ql2xenabledif, int, S_IRUGO|S_IWUSR); |
| 111 | MODULE_PARM_DESC(ql2xenabledif, | 111 | MODULE_PARM_DESC(ql2xenabledif, |
| 112 | " Enable T10-CRC-DIF " | 112 | " Enable T10-CRC-DIF " |
| 113 | " Default is 0 - No DIF Support. 1 - Enable it"); | 113 | " Default is 0 - No DIF Support. 1 - Enable it" |
| 114 | ", 2 - Enable DIF for all types, except Type 0."); | ||
| 114 | 115 | ||
| 115 | int ql2xenablehba_err_chk; | 116 | int ql2xenablehba_err_chk = 2; |
| 116 | module_param(ql2xenablehba_err_chk, int, S_IRUGO|S_IWUSR); | 117 | module_param(ql2xenablehba_err_chk, int, S_IRUGO|S_IWUSR); |
| 117 | MODULE_PARM_DESC(ql2xenablehba_err_chk, | 118 | MODULE_PARM_DESC(ql2xenablehba_err_chk, |
| 118 | " Enable T10-CRC-DIF Error isolation by HBA" | 119 | " Enable T10-CRC-DIF Error isolation by HBA:\n" |
| 119 | " Default is 0 - Error isolation disabled, 1 - Enable it"); | 120 | " Default is 1.\n" |
| 121 | " 0 -- Error isolation disabled\n" | ||
| 122 | " 1 -- Error isolation enabled only for DIX Type 0\n" | ||
| 123 | " 2 -- Error isolation enabled for all Types\n"); | ||
| 120 | 124 | ||
| 121 | int ql2xiidmaenable=1; | 125 | int ql2xiidmaenable=1; |
| 122 | module_param(ql2xiidmaenable, int, S_IRUGO); | 126 | module_param(ql2xiidmaenable, int, S_IRUGO); |
| @@ -909,7 +913,14 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) | |||
| 909 | "Abort command mbx success.\n"); | 913 | "Abort command mbx success.\n"); |
| 910 | wait = 1; | 914 | wait = 1; |
| 911 | } | 915 | } |
| 916 | |||
| 917 | spin_lock_irqsave(&ha->hardware_lock, flags); | ||
| 912 | qla2x00_sp_compl(ha, sp); | 918 | qla2x00_sp_compl(ha, sp); |
| 919 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | ||
| 920 | |||
| 921 | /* Did the command return during mailbox execution? */ | ||
| 922 | if (ret == FAILED && !CMD_SP(cmd)) | ||
| 923 | ret = SUCCESS; | ||
| 913 | 924 | ||
| 914 | /* Wait for the command to be returned. */ | 925 | /* Wait for the command to be returned. */ |
| 915 | if (wait) { | 926 | if (wait) { |
| @@ -2251,7 +2262,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 2251 | host->this_id = 255; | 2262 | host->this_id = 255; |
| 2252 | host->cmd_per_lun = 3; | 2263 | host->cmd_per_lun = 3; |
| 2253 | host->unique_id = host->host_no; | 2264 | host->unique_id = host->host_no; |
| 2254 | if ((IS_QLA25XX(ha) || IS_QLA81XX(ha)) && ql2xenabledif) | 2265 | if (IS_T10_PI_CAPABLE(ha) && ql2xenabledif) |
| 2255 | host->max_cmd_len = 32; | 2266 | host->max_cmd_len = 32; |
| 2256 | else | 2267 | else |
| 2257 | host->max_cmd_len = MAX_CMDSZ; | 2268 | host->max_cmd_len = MAX_CMDSZ; |
| @@ -2378,13 +2389,16 @@ skip_dpc: | |||
| 2378 | "Detected hba at address=%p.\n", | 2389 | "Detected hba at address=%p.\n", |
| 2379 | ha); | 2390 | ha); |
| 2380 | 2391 | ||
| 2381 | if ((IS_QLA25XX(ha) || IS_QLA81XX(ha)) && ql2xenabledif) { | 2392 | if (IS_T10_PI_CAPABLE(ha) && ql2xenabledif) { |
| 2382 | if (ha->fw_attributes & BIT_4) { | 2393 | if (ha->fw_attributes & BIT_4) { |
| 2394 | int prot = 0; | ||
| 2383 | base_vha->flags.difdix_supported = 1; | 2395 | base_vha->flags.difdix_supported = 1; |
| 2384 | ql_dbg(ql_dbg_init, base_vha, 0x00f1, | 2396 | ql_dbg(ql_dbg_init, base_vha, 0x00f1, |
| 2385 | "Registering for DIF/DIX type 1 and 3 protection.\n"); | 2397 | "Registering for DIF/DIX type 1 and 3 protection.\n"); |
| 2398 | if (ql2xenabledif == 1) | ||
| 2399 | prot = SHOST_DIX_TYPE0_PROTECTION; | ||
| 2386 | scsi_host_set_prot(host, | 2400 | scsi_host_set_prot(host, |
| 2387 | SHOST_DIF_TYPE1_PROTECTION | 2401 | prot | SHOST_DIF_TYPE1_PROTECTION |
| 2388 | | SHOST_DIF_TYPE2_PROTECTION | 2402 | | SHOST_DIF_TYPE2_PROTECTION |
| 2389 | | SHOST_DIF_TYPE3_PROTECTION | 2403 | | SHOST_DIF_TYPE3_PROTECTION |
| 2390 | | SHOST_DIX_TYPE1_PROTECTION | 2404 | | SHOST_DIX_TYPE1_PROTECTION |
diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h index 062c97bf62f5..13b6357c1fa2 100644 --- a/drivers/scsi/qla2xxx/qla_version.h +++ b/drivers/scsi/qla2xxx/qla_version.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | /* | 7 | /* |
| 8 | * Driver version | 8 | * Driver version |
| 9 | */ | 9 | */ |
| 10 | #define QLA2XXX_VERSION "8.03.07.03-k" | 10 | #define QLA2XXX_VERSION "8.03.07.07-k" |
| 11 | 11 | ||
| 12 | #define QLA_DRIVER_MAJOR_VER 8 | 12 | #define QLA_DRIVER_MAJOR_VER 8 |
| 13 | #define QLA_DRIVER_MINOR_VER 3 | 13 | #define QLA_DRIVER_MINOR_VER 3 |
diff --git a/drivers/scsi/qla4xxx/Kconfig b/drivers/scsi/qla4xxx/Kconfig index 2c33ce6eac1e..0f5599e0abf6 100644 --- a/drivers/scsi/qla4xxx/Kconfig +++ b/drivers/scsi/qla4xxx/Kconfig | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | config SCSI_QLA_ISCSI | 1 | config SCSI_QLA_ISCSI |
| 2 | tristate "QLogic ISP4XXX and ISP82XX host adapter family support" | 2 | tristate "QLogic ISP4XXX and ISP82XX host adapter family support" |
| 3 | depends on PCI && SCSI | 3 | depends on PCI && SCSI && NET |
| 4 | select SCSI_ISCSI_ATTRS | 4 | select SCSI_ISCSI_ATTRS |
| 5 | ---help--- | 5 | ---help--- |
| 6 | This driver supports the QLogic 40xx (ISP4XXX) and 8022 (ISP82XX) | 6 | This driver supports the QLogic 40xx (ISP4XXX) and 8022 (ISP82XX) |
diff --git a/drivers/sh/intc/chip.c b/drivers/sh/intc/chip.c index f33e2dd97934..33b2ed451e09 100644 --- a/drivers/sh/intc/chip.c +++ b/drivers/sh/intc/chip.c | |||
| @@ -186,6 +186,9 @@ static unsigned char intc_irq_sense_table[IRQ_TYPE_SENSE_MASK + 1] = { | |||
| 186 | !defined(CONFIG_CPU_SUBTYPE_SH7709) | 186 | !defined(CONFIG_CPU_SUBTYPE_SH7709) |
| 187 | [IRQ_TYPE_LEVEL_HIGH] = VALID(3), | 187 | [IRQ_TYPE_LEVEL_HIGH] = VALID(3), |
| 188 | #endif | 188 | #endif |
| 189 | #if defined(CONFIG_ARCH_SH7372) | ||
| 190 | [IRQ_TYPE_EDGE_BOTH] = VALID(4), | ||
| 191 | #endif | ||
| 189 | }; | 192 | }; |
| 190 | 193 | ||
| 191 | static int intc_set_type(struct irq_data *data, unsigned int type) | 194 | static int intc_set_type(struct irq_data *data, unsigned int type) |
diff --git a/drivers/staging/brcm80211/brcmsmac/otp.c b/drivers/staging/brcm80211/brcmsmac/otp.c index 34253cf37812..4a70180eba5d 100644 --- a/drivers/staging/brcm80211/brcmsmac/otp.c +++ b/drivers/staging/brcm80211/brcmsmac/otp.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | #include <linux/io.h> | 17 | #include <linux/io.h> |
| 18 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
| 19 | #include <linux/string.h> | ||
| 19 | 20 | ||
| 20 | #include <brcm_hw_ids.h> | 21 | #include <brcm_hw_ids.h> |
| 21 | #include <chipcommon.h> | 22 | #include <chipcommon.h> |
diff --git a/drivers/staging/brcm80211/brcmsmac/types.h b/drivers/staging/brcm80211/brcmsmac/types.h index bbf21897ae0e..823b5e4672e2 100644 --- a/drivers/staging/brcm80211/brcmsmac/types.h +++ b/drivers/staging/brcm80211/brcmsmac/types.h | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #define _BRCM_TYPES_H_ | 18 | #define _BRCM_TYPES_H_ |
| 19 | 19 | ||
| 20 | #include <linux/types.h> | 20 | #include <linux/types.h> |
| 21 | #include <linux/io.h> | ||
| 21 | 22 | ||
| 22 | /* Bus types */ | 23 | /* Bus types */ |
| 23 | #define SI_BUS 0 /* SOC Interconnect */ | 24 | #define SI_BUS 0 /* SOC Interconnect */ |
diff --git a/drivers/staging/octeon/ethernet-rgmii.c b/drivers/staging/octeon/ethernet-rgmii.c index 9c0d2936e486..c3d73f8431ae 100644 --- a/drivers/staging/octeon/ethernet-rgmii.c +++ b/drivers/staging/octeon/ethernet-rgmii.c | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | **********************************************************************/ | 26 | **********************************************************************/ |
| 27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
| 28 | #include <linux/netdevice.h> | 28 | #include <linux/netdevice.h> |
| 29 | #include <linux/interrupt.h> | ||
| 29 | #include <linux/phy.h> | 30 | #include <linux/phy.h> |
| 30 | #include <linux/ratelimit.h> | 31 | #include <linux/ratelimit.h> |
| 31 | #include <net/dst.h> | 32 | #include <net/dst.h> |
diff --git a/drivers/staging/octeon/ethernet-spi.c b/drivers/staging/octeon/ethernet-spi.c index 970825421884..d0e2d514968a 100644 --- a/drivers/staging/octeon/ethernet-spi.c +++ b/drivers/staging/octeon/ethernet-spi.c | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | **********************************************************************/ | 26 | **********************************************************************/ |
| 27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
| 28 | #include <linux/netdevice.h> | 28 | #include <linux/netdevice.h> |
| 29 | #include <linux/interrupt.h> | ||
| 29 | #include <net/dst.h> | 30 | #include <net/dst.h> |
| 30 | 31 | ||
| 31 | #include <asm/octeon/octeon.h> | 32 | #include <asm/octeon/octeon.h> |
diff --git a/drivers/staging/tidspbridge/core/dsp-clock.c b/drivers/staging/tidspbridge/core/dsp-clock.c index 589a0554332e..3d1279c424a8 100644 --- a/drivers/staging/tidspbridge/core/dsp-clock.c +++ b/drivers/staging/tidspbridge/core/dsp-clock.c | |||
| @@ -209,7 +209,6 @@ int dsp_clk_enable(enum dsp_clk_id clk_id) | |||
| 209 | break; | 209 | break; |
| 210 | #ifdef CONFIG_OMAP_MCBSP | 210 | #ifdef CONFIG_OMAP_MCBSP |
| 211 | case MCBSP_CLK: | 211 | case MCBSP_CLK: |
| 212 | omap_mcbsp_set_io_type(MCBSP_ID(clk_id), OMAP_MCBSP_POLL_IO); | ||
| 213 | omap_mcbsp_request(MCBSP_ID(clk_id)); | 212 | omap_mcbsp_request(MCBSP_ID(clk_id)); |
| 214 | omap2_mcbsp_set_clks_src(MCBSP_ID(clk_id), MCBSP_CLKS_PAD_SRC); | 213 | omap2_mcbsp_set_clks_src(MCBSP_ID(clk_id), MCBSP_CLKS_PAD_SRC); |
| 215 | break; | 214 | break; |
diff --git a/drivers/staging/zcache/tmem.c b/drivers/staging/zcache/tmem.c index 975e34bcd722..1ca66ea9b281 100644 --- a/drivers/staging/zcache/tmem.c +++ b/drivers/staging/zcache/tmem.c | |||
| @@ -604,7 +604,7 @@ int tmem_get(struct tmem_pool *pool, struct tmem_oid *oidp, uint32_t index, | |||
| 604 | struct tmem_obj *obj; | 604 | struct tmem_obj *obj; |
| 605 | void *pampd; | 605 | void *pampd; |
| 606 | bool ephemeral = is_ephemeral(pool); | 606 | bool ephemeral = is_ephemeral(pool); |
| 607 | uint32_t ret = -1; | 607 | int ret = -1; |
| 608 | struct tmem_hashbucket *hb; | 608 | struct tmem_hashbucket *hb; |
| 609 | bool free = (get_and_free == 1) || ((get_and_free == 0) && ephemeral); | 609 | bool free = (get_and_free == 1) || ((get_and_free == 0) && ephemeral); |
| 610 | bool lock_held = false; | 610 | bool lock_held = false; |
diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c index 855a5bb56a47..a3f5162bfedc 100644 --- a/drivers/staging/zcache/zcache-main.c +++ b/drivers/staging/zcache/zcache-main.c | |||
| @@ -1158,7 +1158,7 @@ static void *zcache_pampd_create(char *data, size_t size, bool raw, int eph, | |||
| 1158 | size_t clen; | 1158 | size_t clen; |
| 1159 | int ret; | 1159 | int ret; |
| 1160 | unsigned long count; | 1160 | unsigned long count; |
| 1161 | struct page *page = virt_to_page(data); | 1161 | struct page *page = (struct page *)(data); |
| 1162 | struct zcache_client *cli = pool->client; | 1162 | struct zcache_client *cli = pool->client; |
| 1163 | uint16_t client_id = get_client_id_from_client(cli); | 1163 | uint16_t client_id = get_client_id_from_client(cli); |
| 1164 | unsigned long zv_mean_zsize; | 1164 | unsigned long zv_mean_zsize; |
| @@ -1227,7 +1227,7 @@ static int zcache_pampd_get_data(char *data, size_t *bufsize, bool raw, | |||
| 1227 | int ret = 0; | 1227 | int ret = 0; |
| 1228 | 1228 | ||
| 1229 | BUG_ON(is_ephemeral(pool)); | 1229 | BUG_ON(is_ephemeral(pool)); |
| 1230 | zv_decompress(virt_to_page(data), pampd); | 1230 | zv_decompress((struct page *)(data), pampd); |
| 1231 | return ret; | 1231 | return ret; |
| 1232 | } | 1232 | } |
| 1233 | 1233 | ||
| @@ -1539,7 +1539,7 @@ static int zcache_put_page(int cli_id, int pool_id, struct tmem_oid *oidp, | |||
| 1539 | goto out; | 1539 | goto out; |
| 1540 | if (!zcache_freeze && zcache_do_preload(pool) == 0) { | 1540 | if (!zcache_freeze && zcache_do_preload(pool) == 0) { |
| 1541 | /* preload does preempt_disable on success */ | 1541 | /* preload does preempt_disable on success */ |
| 1542 | ret = tmem_put(pool, oidp, index, page_address(page), | 1542 | ret = tmem_put(pool, oidp, index, (char *)(page), |
| 1543 | PAGE_SIZE, 0, is_ephemeral(pool)); | 1543 | PAGE_SIZE, 0, is_ephemeral(pool)); |
| 1544 | if (ret < 0) { | 1544 | if (ret < 0) { |
| 1545 | if (is_ephemeral(pool)) | 1545 | if (is_ephemeral(pool)) |
| @@ -1572,7 +1572,7 @@ static int zcache_get_page(int cli_id, int pool_id, struct tmem_oid *oidp, | |||
| 1572 | pool = zcache_get_pool_by_id(cli_id, pool_id); | 1572 | pool = zcache_get_pool_by_id(cli_id, pool_id); |
| 1573 | if (likely(pool != NULL)) { | 1573 | if (likely(pool != NULL)) { |
| 1574 | if (atomic_read(&pool->obj_count) > 0) | 1574 | if (atomic_read(&pool->obj_count) > 0) |
| 1575 | ret = tmem_get(pool, oidp, index, page_address(page), | 1575 | ret = tmem_get(pool, oidp, index, (char *)(page), |
| 1576 | &size, 0, is_ephemeral(pool)); | 1576 | &size, 0, is_ephemeral(pool)); |
| 1577 | zcache_put_pool(pool); | 1577 | zcache_put_pool(pool); |
| 1578 | } | 1578 | } |
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index c24fb10de60b..6a4ea29c2f36 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
| @@ -2243,7 +2243,6 @@ static int iscsit_handle_snack( | |||
| 2243 | case 0: | 2243 | case 0: |
| 2244 | return iscsit_handle_recovery_datain_or_r2t(conn, buf, | 2244 | return iscsit_handle_recovery_datain_or_r2t(conn, buf, |
| 2245 | hdr->itt, hdr->ttt, hdr->begrun, hdr->runlength); | 2245 | hdr->itt, hdr->ttt, hdr->begrun, hdr->runlength); |
| 2246 | return 0; | ||
| 2247 | case ISCSI_FLAG_SNACK_TYPE_STATUS: | 2246 | case ISCSI_FLAG_SNACK_TYPE_STATUS: |
| 2248 | return iscsit_handle_status_snack(conn, hdr->itt, hdr->ttt, | 2247 | return iscsit_handle_status_snack(conn, hdr->itt, hdr->ttt, |
| 2249 | hdr->begrun, hdr->runlength); | 2248 | hdr->begrun, hdr->runlength); |
diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c index f095e65b1ccf..f1643dbf6a92 100644 --- a/drivers/target/iscsi/iscsi_target_configfs.c +++ b/drivers/target/iscsi/iscsi_target_configfs.c | |||
| @@ -268,7 +268,7 @@ struct se_tpg_np *lio_target_call_addnptotpg( | |||
| 268 | ISCSI_TCP); | 268 | ISCSI_TCP); |
| 269 | if (IS_ERR(tpg_np)) { | 269 | if (IS_ERR(tpg_np)) { |
| 270 | iscsit_put_tpg(tpg); | 270 | iscsit_put_tpg(tpg); |
| 271 | return ERR_PTR(PTR_ERR(tpg_np)); | 271 | return ERR_CAST(tpg_np); |
| 272 | } | 272 | } |
| 273 | pr_debug("LIO_Target_ConfigFS: addnptotpg done!\n"); | 273 | pr_debug("LIO_Target_ConfigFS: addnptotpg done!\n"); |
| 274 | 274 | ||
| @@ -1285,7 +1285,7 @@ struct se_wwn *lio_target_call_coreaddtiqn( | |||
| 1285 | 1285 | ||
| 1286 | tiqn = iscsit_add_tiqn((unsigned char *)name); | 1286 | tiqn = iscsit_add_tiqn((unsigned char *)name); |
| 1287 | if (IS_ERR(tiqn)) | 1287 | if (IS_ERR(tiqn)) |
| 1288 | return ERR_PTR(PTR_ERR(tiqn)); | 1288 | return ERR_CAST(tiqn); |
| 1289 | /* | 1289 | /* |
| 1290 | * Setup struct iscsi_wwn_stat_grps for se_wwn->fabric_stat_group. | 1290 | * Setup struct iscsi_wwn_stat_grps for se_wwn->fabric_stat_group. |
| 1291 | */ | 1291 | */ |
diff --git a/drivers/target/iscsi/iscsi_target_erl1.c b/drivers/target/iscsi/iscsi_target_erl1.c index 980650792cf6..c4c68da3e500 100644 --- a/drivers/target/iscsi/iscsi_target_erl1.c +++ b/drivers/target/iscsi/iscsi_target_erl1.c | |||
| @@ -834,7 +834,7 @@ static int iscsit_attach_ooo_cmdsn( | |||
| 834 | */ | 834 | */ |
| 835 | list_for_each_entry(ooo_tmp, &sess->sess_ooo_cmdsn_list, | 835 | list_for_each_entry(ooo_tmp, &sess->sess_ooo_cmdsn_list, |
| 836 | ooo_list) { | 836 | ooo_list) { |
| 837 | while (ooo_tmp->cmdsn < ooo_cmdsn->cmdsn) | 837 | if (ooo_tmp->cmdsn < ooo_cmdsn->cmdsn) |
| 838 | continue; | 838 | continue; |
| 839 | 839 | ||
| 840 | list_add(&ooo_cmdsn->ooo_list, | 840 | list_add(&ooo_cmdsn->ooo_list, |
diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c index bcaf82f47037..daad362a93ce 100644 --- a/drivers/target/iscsi/iscsi_target_login.c +++ b/drivers/target/iscsi/iscsi_target_login.c | |||
| @@ -1013,19 +1013,9 @@ static int __iscsi_target_login_thread(struct iscsi_np *np) | |||
| 1013 | ISCSI_LOGIN_STATUS_TARGET_ERROR); | 1013 | ISCSI_LOGIN_STATUS_TARGET_ERROR); |
| 1014 | goto new_sess_out; | 1014 | goto new_sess_out; |
| 1015 | } | 1015 | } |
| 1016 | #if 0 | 1016 | snprintf(conn->login_ip, sizeof(conn->login_ip), "%pI6c", |
| 1017 | if (!iscsi_ntop6((const unsigned char *) | 1017 | &sock_in6.sin6_addr.in6_u); |
| 1018 | &sock_in6.sin6_addr.in6_u, | 1018 | conn->login_port = ntohs(sock_in6.sin6_port); |
| 1019 | (char *)&conn->ipv6_login_ip[0], | ||
| 1020 | IPV6_ADDRESS_SPACE)) { | ||
| 1021 | pr_err("iscsi_ntop6() failed\n"); | ||
| 1022 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, | ||
| 1023 | ISCSI_LOGIN_STATUS_TARGET_ERROR); | ||
| 1024 | goto new_sess_out; | ||
| 1025 | } | ||
| 1026 | #else | ||
| 1027 | pr_debug("Skipping iscsi_ntop6()\n"); | ||
| 1028 | #endif | ||
| 1029 | } else { | 1019 | } else { |
| 1030 | memset(&sock_in, 0, sizeof(struct sockaddr_in)); | 1020 | memset(&sock_in, 0, sizeof(struct sockaddr_in)); |
| 1031 | 1021 | ||
diff --git a/drivers/target/iscsi/iscsi_target_parameters.c b/drivers/target/iscsi/iscsi_target_parameters.c index 252e246cf51e..497b2e718a76 100644 --- a/drivers/target/iscsi/iscsi_target_parameters.c +++ b/drivers/target/iscsi/iscsi_target_parameters.c | |||
| @@ -545,13 +545,13 @@ int iscsi_copy_param_list( | |||
| 545 | struct iscsi_param_list *src_param_list, | 545 | struct iscsi_param_list *src_param_list, |
| 546 | int leading) | 546 | int leading) |
| 547 | { | 547 | { |
| 548 | struct iscsi_param *new_param = NULL, *param = NULL; | 548 | struct iscsi_param *param = NULL; |
| 549 | struct iscsi_param *new_param = NULL; | ||
| 549 | struct iscsi_param_list *param_list = NULL; | 550 | struct iscsi_param_list *param_list = NULL; |
| 550 | 551 | ||
| 551 | param_list = kzalloc(sizeof(struct iscsi_param_list), GFP_KERNEL); | 552 | param_list = kzalloc(sizeof(struct iscsi_param_list), GFP_KERNEL); |
| 552 | if (!param_list) { | 553 | if (!param_list) { |
| 553 | pr_err("Unable to allocate memory for" | 554 | pr_err("Unable to allocate memory for struct iscsi_param_list.\n"); |
| 554 | " struct iscsi_param_list.\n"); | ||
| 555 | goto err_out; | 555 | goto err_out; |
| 556 | } | 556 | } |
| 557 | INIT_LIST_HEAD(¶m_list->param_list); | 557 | INIT_LIST_HEAD(¶m_list->param_list); |
| @@ -567,8 +567,17 @@ int iscsi_copy_param_list( | |||
| 567 | 567 | ||
| 568 | new_param = kzalloc(sizeof(struct iscsi_param), GFP_KERNEL); | 568 | new_param = kzalloc(sizeof(struct iscsi_param), GFP_KERNEL); |
| 569 | if (!new_param) { | 569 | if (!new_param) { |
| 570 | pr_err("Unable to allocate memory for" | 570 | pr_err("Unable to allocate memory for struct iscsi_param.\n"); |
| 571 | " struct iscsi_param.\n"); | 571 | goto err_out; |
| 572 | } | ||
| 573 | |||
| 574 | new_param->name = kstrdup(param->name, GFP_KERNEL); | ||
| 575 | new_param->value = kstrdup(param->value, GFP_KERNEL); | ||
| 576 | if (!new_param->value || !new_param->name) { | ||
| 577 | kfree(new_param->value); | ||
| 578 | kfree(new_param->name); | ||
| 579 | kfree(new_param); | ||
| 580 | pr_err("Unable to allocate memory for parameter name/value.\n"); | ||
| 572 | goto err_out; | 581 | goto err_out; |
| 573 | } | 582 | } |
| 574 | 583 | ||
| @@ -580,32 +589,12 @@ int iscsi_copy_param_list( | |||
| 580 | new_param->use = param->use; | 589 | new_param->use = param->use; |
| 581 | new_param->type_range = param->type_range; | 590 | new_param->type_range = param->type_range; |
| 582 | 591 | ||
| 583 | new_param->name = kzalloc(strlen(param->name) + 1, GFP_KERNEL); | ||
| 584 | if (!new_param->name) { | ||
| 585 | pr_err("Unable to allocate memory for" | ||
| 586 | " parameter name.\n"); | ||
| 587 | goto err_out; | ||
| 588 | } | ||
| 589 | |||
| 590 | new_param->value = kzalloc(strlen(param->value) + 1, | ||
| 591 | GFP_KERNEL); | ||
| 592 | if (!new_param->value) { | ||
| 593 | pr_err("Unable to allocate memory for" | ||
| 594 | " parameter value.\n"); | ||
| 595 | goto err_out; | ||
| 596 | } | ||
| 597 | |||
| 598 | memcpy(new_param->name, param->name, strlen(param->name)); | ||
| 599 | new_param->name[strlen(param->name)] = '\0'; | ||
| 600 | memcpy(new_param->value, param->value, strlen(param->value)); | ||
| 601 | new_param->value[strlen(param->value)] = '\0'; | ||
| 602 | |||
| 603 | list_add_tail(&new_param->p_list, ¶m_list->param_list); | 592 | list_add_tail(&new_param->p_list, ¶m_list->param_list); |
| 604 | } | 593 | } |
| 605 | 594 | ||
| 606 | if (!list_empty(¶m_list->param_list)) | 595 | if (!list_empty(¶m_list->param_list)) { |
| 607 | *dst_param_list = param_list; | 596 | *dst_param_list = param_list; |
| 608 | else { | 597 | } else { |
| 609 | pr_err("No parameters allocated.\n"); | 598 | pr_err("No parameters allocated.\n"); |
| 610 | goto err_out; | 599 | goto err_out; |
| 611 | } | 600 | } |
diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c index a1acb0167902..a0d23bc0fc98 100644 --- a/drivers/target/iscsi/iscsi_target_util.c +++ b/drivers/target/iscsi/iscsi_target_util.c | |||
| @@ -243,7 +243,7 @@ struct iscsi_cmd *iscsit_allocate_se_cmd_for_tmr( | |||
| 243 | if (!cmd->tmr_req) { | 243 | if (!cmd->tmr_req) { |
| 244 | pr_err("Unable to allocate memory for" | 244 | pr_err("Unable to allocate memory for" |
| 245 | " Task Management command!\n"); | 245 | " Task Management command!\n"); |
| 246 | return NULL; | 246 | goto out; |
| 247 | } | 247 | } |
| 248 | /* | 248 | /* |
| 249 | * TASK_REASSIGN for ERL=2 / connection stays inside of | 249 | * TASK_REASSIGN for ERL=2 / connection stays inside of |
| @@ -298,8 +298,6 @@ struct iscsi_cmd *iscsit_allocate_se_cmd_for_tmr( | |||
| 298 | return cmd; | 298 | return cmd; |
| 299 | out: | 299 | out: |
| 300 | iscsit_release_cmd(cmd); | 300 | iscsit_release_cmd(cmd); |
| 301 | if (se_cmd) | ||
| 302 | transport_free_se_cmd(se_cmd); | ||
| 303 | return NULL; | 301 | return NULL; |
| 304 | } | 302 | } |
| 305 | 303 | ||
diff --git a/drivers/target/target_core_cdb.c b/drivers/target/target_core_cdb.c index 8ae09a1bdf74..89ae923c5da6 100644 --- a/drivers/target/target_core_cdb.c +++ b/drivers/target/target_core_cdb.c | |||
| @@ -67,6 +67,7 @@ target_emulate_inquiry_std(struct se_cmd *cmd) | |||
| 67 | { | 67 | { |
| 68 | struct se_lun *lun = cmd->se_lun; | 68 | struct se_lun *lun = cmd->se_lun; |
| 69 | struct se_device *dev = cmd->se_dev; | 69 | struct se_device *dev = cmd->se_dev; |
| 70 | struct se_portal_group *tpg = lun->lun_sep->sep_tpg; | ||
| 70 | unsigned char *buf; | 71 | unsigned char *buf; |
| 71 | 72 | ||
| 72 | /* | 73 | /* |
| @@ -81,9 +82,13 @@ target_emulate_inquiry_std(struct se_cmd *cmd) | |||
| 81 | 82 | ||
| 82 | buf = transport_kmap_first_data_page(cmd); | 83 | buf = transport_kmap_first_data_page(cmd); |
| 83 | 84 | ||
| 84 | buf[0] = dev->transport->get_device_type(dev); | 85 | if (dev == tpg->tpg_virt_lun0.lun_se_dev) { |
| 85 | if (buf[0] == TYPE_TAPE) | 86 | buf[0] = 0x3f; /* Not connected */ |
| 86 | buf[1] = 0x80; | 87 | } else { |
| 88 | buf[0] = dev->transport->get_device_type(dev); | ||
| 89 | if (buf[0] == TYPE_TAPE) | ||
| 90 | buf[1] = 0x80; | ||
| 91 | } | ||
| 87 | buf[2] = dev->transport->get_device_rev(dev); | 92 | buf[2] = dev->transport->get_device_rev(dev); |
| 88 | 93 | ||
| 89 | /* | 94 | /* |
| @@ -915,8 +920,8 @@ target_emulate_modesense(struct se_cmd *cmd, int ten) | |||
| 915 | length += target_modesense_control(dev, &buf[offset+length]); | 920 | length += target_modesense_control(dev, &buf[offset+length]); |
| 916 | break; | 921 | break; |
| 917 | default: | 922 | default: |
| 918 | pr_err("Got Unknown Mode Page: 0x%02x\n", | 923 | pr_err("MODE SENSE: unimplemented page/subpage: 0x%02x/0x%02x\n", |
| 919 | cdb[2] & 0x3f); | 924 | cdb[2] & 0x3f, cdb[3]); |
| 920 | return PYX_TRANSPORT_UNKNOWN_MODE_PAGE; | 925 | return PYX_TRANSPORT_UNKNOWN_MODE_PAGE; |
| 921 | } | 926 | } |
| 922 | offset += length; | 927 | offset += length; |
| @@ -1072,8 +1077,6 @@ target_emulate_unmap(struct se_task *task) | |||
| 1072 | size -= 16; | 1077 | size -= 16; |
| 1073 | } | 1078 | } |
| 1074 | 1079 | ||
| 1075 | task->task_scsi_status = GOOD; | ||
| 1076 | transport_complete_task(task, 1); | ||
| 1077 | err: | 1080 | err: |
| 1078 | transport_kunmap_first_data_page(cmd); | 1081 | transport_kunmap_first_data_page(cmd); |
| 1079 | 1082 | ||
| @@ -1085,24 +1088,17 @@ err: | |||
| 1085 | * Note this is not used for TCM/pSCSI passthrough | 1088 | * Note this is not used for TCM/pSCSI passthrough |
| 1086 | */ | 1089 | */ |
| 1087 | static int | 1090 | static int |
| 1088 | target_emulate_write_same(struct se_task *task, int write_same32) | 1091 | target_emulate_write_same(struct se_task *task, u32 num_blocks) |
| 1089 | { | 1092 | { |
| 1090 | struct se_cmd *cmd = task->task_se_cmd; | 1093 | struct se_cmd *cmd = task->task_se_cmd; |
| 1091 | struct se_device *dev = cmd->se_dev; | 1094 | struct se_device *dev = cmd->se_dev; |
| 1092 | sector_t range; | 1095 | sector_t range; |
| 1093 | sector_t lba = cmd->t_task_lba; | 1096 | sector_t lba = cmd->t_task_lba; |
| 1094 | unsigned int num_blocks; | ||
| 1095 | int ret; | 1097 | int ret; |
| 1096 | /* | 1098 | /* |
| 1097 | * Extract num_blocks from the WRITE_SAME_* CDB. Then use the explict | 1099 | * Use the explicit range when non zero is supplied, otherwise calculate |
| 1098 | * range when non zero is supplied, otherwise calculate the remaining | 1100 | * the remaining range based on ->get_blocks() - starting LBA. |
| 1099 | * range based on ->get_blocks() - starting LBA. | ||
| 1100 | */ | 1101 | */ |
| 1101 | if (write_same32) | ||
| 1102 | num_blocks = get_unaligned_be32(&cmd->t_task_cdb[28]); | ||
| 1103 | else | ||
| 1104 | num_blocks = get_unaligned_be32(&cmd->t_task_cdb[10]); | ||
| 1105 | |||
| 1106 | if (num_blocks != 0) | 1102 | if (num_blocks != 0) |
| 1107 | range = num_blocks; | 1103 | range = num_blocks; |
| 1108 | else | 1104 | else |
| @@ -1117,8 +1113,6 @@ target_emulate_write_same(struct se_task *task, int write_same32) | |||
| 1117 | return ret; | 1113 | return ret; |
| 1118 | } | 1114 | } |
| 1119 | 1115 | ||
| 1120 | task->task_scsi_status = GOOD; | ||
| 1121 | transport_complete_task(task, 1); | ||
| 1122 | return 0; | 1116 | return 0; |
| 1123 | } | 1117 | } |
| 1124 | 1118 | ||
| @@ -1165,13 +1159,23 @@ transport_emulate_control_cdb(struct se_task *task) | |||
| 1165 | } | 1159 | } |
| 1166 | ret = target_emulate_unmap(task); | 1160 | ret = target_emulate_unmap(task); |
| 1167 | break; | 1161 | break; |
| 1162 | case WRITE_SAME: | ||
| 1163 | if (!dev->transport->do_discard) { | ||
| 1164 | pr_err("WRITE_SAME emulation not supported" | ||
| 1165 | " for: %s\n", dev->transport->name); | ||
| 1166 | return PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; | ||
| 1167 | } | ||
| 1168 | ret = target_emulate_write_same(task, | ||
| 1169 | get_unaligned_be16(&cmd->t_task_cdb[7])); | ||
| 1170 | break; | ||
| 1168 | case WRITE_SAME_16: | 1171 | case WRITE_SAME_16: |
| 1169 | if (!dev->transport->do_discard) { | 1172 | if (!dev->transport->do_discard) { |
| 1170 | pr_err("WRITE_SAME_16 emulation not supported" | 1173 | pr_err("WRITE_SAME_16 emulation not supported" |
| 1171 | " for: %s\n", dev->transport->name); | 1174 | " for: %s\n", dev->transport->name); |
| 1172 | return PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; | 1175 | return PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; |
| 1173 | } | 1176 | } |
| 1174 | ret = target_emulate_write_same(task, 0); | 1177 | ret = target_emulate_write_same(task, |
| 1178 | get_unaligned_be32(&cmd->t_task_cdb[10])); | ||
| 1175 | break; | 1179 | break; |
| 1176 | case VARIABLE_LENGTH_CMD: | 1180 | case VARIABLE_LENGTH_CMD: |
| 1177 | service_action = | 1181 | service_action = |
| @@ -1184,7 +1188,8 @@ transport_emulate_control_cdb(struct se_task *task) | |||
| 1184 | dev->transport->name); | 1188 | dev->transport->name); |
| 1185 | return PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; | 1189 | return PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; |
| 1186 | } | 1190 | } |
| 1187 | ret = target_emulate_write_same(task, 1); | 1191 | ret = target_emulate_write_same(task, |
| 1192 | get_unaligned_be32(&cmd->t_task_cdb[28])); | ||
| 1188 | break; | 1193 | break; |
| 1189 | default: | 1194 | default: |
| 1190 | pr_err("Unsupported VARIABLE_LENGTH_CMD SA:" | 1195 | pr_err("Unsupported VARIABLE_LENGTH_CMD SA:" |
| @@ -1219,8 +1224,14 @@ transport_emulate_control_cdb(struct se_task *task) | |||
| 1219 | 1224 | ||
| 1220 | if (ret < 0) | 1225 | if (ret < 0) |
| 1221 | return ret; | 1226 | return ret; |
| 1222 | task->task_scsi_status = GOOD; | 1227 | /* |
| 1223 | transport_complete_task(task, 1); | 1228 | * Handle the successful completion here unless a caller |
| 1229 | * has explictly requested an asychronous completion. | ||
| 1230 | */ | ||
| 1231 | if (!(cmd->se_cmd_flags & SCF_EMULATE_CDB_ASYNC)) { | ||
| 1232 | task->task_scsi_status = GOOD; | ||
| 1233 | transport_complete_task(task, 1); | ||
| 1234 | } | ||
| 1224 | 1235 | ||
| 1225 | return PYX_TRANSPORT_SENT_TO_TRANSPORT; | 1236 | return PYX_TRANSPORT_SENT_TO_TRANSPORT; |
| 1226 | } | 1237 | } |
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index b38b6c993e65..ca6e4a4df134 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c | |||
| @@ -472,9 +472,9 @@ void core_clear_lun_from_tpg(struct se_lun *lun, struct se_portal_group *tpg) | |||
| 472 | struct se_dev_entry *deve; | 472 | struct se_dev_entry *deve; |
| 473 | u32 i; | 473 | u32 i; |
| 474 | 474 | ||
| 475 | spin_lock_bh(&tpg->acl_node_lock); | 475 | spin_lock_irq(&tpg->acl_node_lock); |
| 476 | list_for_each_entry(nacl, &tpg->acl_node_list, acl_list) { | 476 | list_for_each_entry(nacl, &tpg->acl_node_list, acl_list) { |
| 477 | spin_unlock_bh(&tpg->acl_node_lock); | 477 | spin_unlock_irq(&tpg->acl_node_lock); |
| 478 | 478 | ||
| 479 | spin_lock_irq(&nacl->device_list_lock); | 479 | spin_lock_irq(&nacl->device_list_lock); |
| 480 | for (i = 0; i < TRANSPORT_MAX_LUNS_PER_TPG; i++) { | 480 | for (i = 0; i < TRANSPORT_MAX_LUNS_PER_TPG; i++) { |
| @@ -491,9 +491,9 @@ void core_clear_lun_from_tpg(struct se_lun *lun, struct se_portal_group *tpg) | |||
| 491 | } | 491 | } |
| 492 | spin_unlock_irq(&nacl->device_list_lock); | 492 | spin_unlock_irq(&nacl->device_list_lock); |
| 493 | 493 | ||
| 494 | spin_lock_bh(&tpg->acl_node_lock); | 494 | spin_lock_irq(&tpg->acl_node_lock); |
| 495 | } | 495 | } |
| 496 | spin_unlock_bh(&tpg->acl_node_lock); | 496 | spin_unlock_irq(&tpg->acl_node_lock); |
| 497 | } | 497 | } |
| 498 | 498 | ||
| 499 | static struct se_port *core_alloc_port(struct se_device *dev) | 499 | static struct se_port *core_alloc_port(struct se_device *dev) |
| @@ -839,6 +839,24 @@ int se_dev_check_shutdown(struct se_device *dev) | |||
| 839 | return ret; | 839 | return ret; |
| 840 | } | 840 | } |
| 841 | 841 | ||
| 842 | u32 se_dev_align_max_sectors(u32 max_sectors, u32 block_size) | ||
| 843 | { | ||
| 844 | u32 tmp, aligned_max_sectors; | ||
| 845 | /* | ||
| 846 | * Limit max_sectors to a PAGE_SIZE aligned value for modern | ||
| 847 | * transport_allocate_data_tasks() operation. | ||
| 848 | */ | ||
| 849 | tmp = rounddown((max_sectors * block_size), PAGE_SIZE); | ||
| 850 | aligned_max_sectors = (tmp / block_size); | ||
| 851 | if (max_sectors != aligned_max_sectors) { | ||
| 852 | printk(KERN_INFO "Rounding down aligned max_sectors from %u" | ||
| 853 | " to %u\n", max_sectors, aligned_max_sectors); | ||
| 854 | return aligned_max_sectors; | ||
| 855 | } | ||
| 856 | |||
| 857 | return max_sectors; | ||
| 858 | } | ||
| 859 | |||
| 842 | void se_dev_set_default_attribs( | 860 | void se_dev_set_default_attribs( |
| 843 | struct se_device *dev, | 861 | struct se_device *dev, |
| 844 | struct se_dev_limits *dev_limits) | 862 | struct se_dev_limits *dev_limits) |
| @@ -878,6 +896,11 @@ void se_dev_set_default_attribs( | |||
| 878 | * max_sectors is based on subsystem plugin dependent requirements. | 896 | * max_sectors is based on subsystem plugin dependent requirements. |
| 879 | */ | 897 | */ |
| 880 | dev->se_sub_dev->se_dev_attrib.hw_max_sectors = limits->max_hw_sectors; | 898 | dev->se_sub_dev->se_dev_attrib.hw_max_sectors = limits->max_hw_sectors; |
| 899 | /* | ||
| 900 | * Align max_sectors down to PAGE_SIZE to follow transport_allocate_data_tasks() | ||
| 901 | */ | ||
| 902 | limits->max_sectors = se_dev_align_max_sectors(limits->max_sectors, | ||
| 903 | limits->logical_block_size); | ||
| 881 | dev->se_sub_dev->se_dev_attrib.max_sectors = limits->max_sectors; | 904 | dev->se_sub_dev->se_dev_attrib.max_sectors = limits->max_sectors; |
| 882 | /* | 905 | /* |
| 883 | * Set optimal_sectors from max_sectors, which can be lowered via | 906 | * Set optimal_sectors from max_sectors, which can be lowered via |
| @@ -1242,6 +1265,11 @@ int se_dev_set_max_sectors(struct se_device *dev, u32 max_sectors) | |||
| 1242 | return -EINVAL; | 1265 | return -EINVAL; |
| 1243 | } | 1266 | } |
| 1244 | } | 1267 | } |
| 1268 | /* | ||
| 1269 | * Align max_sectors down to PAGE_SIZE to follow transport_allocate_data_tasks() | ||
| 1270 | */ | ||
| 1271 | max_sectors = se_dev_align_max_sectors(max_sectors, | ||
| 1272 | dev->se_sub_dev->se_dev_attrib.block_size); | ||
| 1245 | 1273 | ||
| 1246 | dev->se_sub_dev->se_dev_attrib.max_sectors = max_sectors; | 1274 | dev->se_sub_dev->se_dev_attrib.max_sectors = max_sectors; |
| 1247 | pr_debug("dev[%p]: SE Device max_sectors changed to %u\n", | 1275 | pr_debug("dev[%p]: SE Device max_sectors changed to %u\n", |
| @@ -1344,15 +1372,17 @@ struct se_lun *core_dev_add_lun( | |||
| 1344 | */ | 1372 | */ |
| 1345 | if (tpg->se_tpg_tfo->tpg_check_demo_mode(tpg)) { | 1373 | if (tpg->se_tpg_tfo->tpg_check_demo_mode(tpg)) { |
| 1346 | struct se_node_acl *acl; | 1374 | struct se_node_acl *acl; |
| 1347 | spin_lock_bh(&tpg->acl_node_lock); | 1375 | spin_lock_irq(&tpg->acl_node_lock); |
| 1348 | list_for_each_entry(acl, &tpg->acl_node_list, acl_list) { | 1376 | list_for_each_entry(acl, &tpg->acl_node_list, acl_list) { |
| 1349 | if (acl->dynamic_node_acl) { | 1377 | if (acl->dynamic_node_acl && |
| 1350 | spin_unlock_bh(&tpg->acl_node_lock); | 1378 | (!tpg->se_tpg_tfo->tpg_check_demo_mode_login_only || |
| 1379 | !tpg->se_tpg_tfo->tpg_check_demo_mode_login_only(tpg))) { | ||
| 1380 | spin_unlock_irq(&tpg->acl_node_lock); | ||
| 1351 | core_tpg_add_node_to_devs(acl, tpg); | 1381 | core_tpg_add_node_to_devs(acl, tpg); |
| 1352 | spin_lock_bh(&tpg->acl_node_lock); | 1382 | spin_lock_irq(&tpg->acl_node_lock); |
| 1353 | } | 1383 | } |
| 1354 | } | 1384 | } |
| 1355 | spin_unlock_bh(&tpg->acl_node_lock); | 1385 | spin_unlock_irq(&tpg->acl_node_lock); |
| 1356 | } | 1386 | } |
| 1357 | 1387 | ||
| 1358 | return lun_p; | 1388 | return lun_p; |
diff --git a/drivers/target/target_core_fabric_configfs.c b/drivers/target/target_core_fabric_configfs.c index f1654694f4ea..55bbe0847a6d 100644 --- a/drivers/target/target_core_fabric_configfs.c +++ b/drivers/target/target_core_fabric_configfs.c | |||
| @@ -481,7 +481,7 @@ static struct config_group *target_fabric_make_nodeacl( | |||
| 481 | 481 | ||
| 482 | se_nacl = tf->tf_ops.fabric_make_nodeacl(se_tpg, group, name); | 482 | se_nacl = tf->tf_ops.fabric_make_nodeacl(se_tpg, group, name); |
| 483 | if (IS_ERR(se_nacl)) | 483 | if (IS_ERR(se_nacl)) |
| 484 | return ERR_PTR(PTR_ERR(se_nacl)); | 484 | return ERR_CAST(se_nacl); |
| 485 | 485 | ||
| 486 | nacl_cg = &se_nacl->acl_group; | 486 | nacl_cg = &se_nacl->acl_group; |
| 487 | nacl_cg->default_groups = se_nacl->acl_default_groups; | 487 | nacl_cg->default_groups = se_nacl->acl_default_groups; |
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index 1c1b849cd4fb..7fd3a161f7cc 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c | |||
| @@ -1598,14 +1598,14 @@ static int core_scsi3_decode_spec_i_port( | |||
| 1598 | * from the decoded fabric module specific TransportID | 1598 | * from the decoded fabric module specific TransportID |
| 1599 | * at *i_str. | 1599 | * at *i_str. |
| 1600 | */ | 1600 | */ |
| 1601 | spin_lock_bh(&tmp_tpg->acl_node_lock); | 1601 | spin_lock_irq(&tmp_tpg->acl_node_lock); |
| 1602 | dest_node_acl = __core_tpg_get_initiator_node_acl( | 1602 | dest_node_acl = __core_tpg_get_initiator_node_acl( |
| 1603 | tmp_tpg, i_str); | 1603 | tmp_tpg, i_str); |
| 1604 | if (dest_node_acl) { | 1604 | if (dest_node_acl) { |
| 1605 | atomic_inc(&dest_node_acl->acl_pr_ref_count); | 1605 | atomic_inc(&dest_node_acl->acl_pr_ref_count); |
| 1606 | smp_mb__after_atomic_inc(); | 1606 | smp_mb__after_atomic_inc(); |
| 1607 | } | 1607 | } |
| 1608 | spin_unlock_bh(&tmp_tpg->acl_node_lock); | 1608 | spin_unlock_irq(&tmp_tpg->acl_node_lock); |
| 1609 | 1609 | ||
| 1610 | if (!dest_node_acl) { | 1610 | if (!dest_node_acl) { |
| 1611 | core_scsi3_tpg_undepend_item(tmp_tpg); | 1611 | core_scsi3_tpg_undepend_item(tmp_tpg); |
| @@ -3496,14 +3496,14 @@ after_iport_check: | |||
| 3496 | /* | 3496 | /* |
| 3497 | * Locate the destination struct se_node_acl from the received Transport ID | 3497 | * Locate the destination struct se_node_acl from the received Transport ID |
| 3498 | */ | 3498 | */ |
| 3499 | spin_lock_bh(&dest_se_tpg->acl_node_lock); | 3499 | spin_lock_irq(&dest_se_tpg->acl_node_lock); |
| 3500 | dest_node_acl = __core_tpg_get_initiator_node_acl(dest_se_tpg, | 3500 | dest_node_acl = __core_tpg_get_initiator_node_acl(dest_se_tpg, |
| 3501 | initiator_str); | 3501 | initiator_str); |
| 3502 | if (dest_node_acl) { | 3502 | if (dest_node_acl) { |
| 3503 | atomic_inc(&dest_node_acl->acl_pr_ref_count); | 3503 | atomic_inc(&dest_node_acl->acl_pr_ref_count); |
| 3504 | smp_mb__after_atomic_inc(); | 3504 | smp_mb__after_atomic_inc(); |
| 3505 | } | 3505 | } |
| 3506 | spin_unlock_bh(&dest_se_tpg->acl_node_lock); | 3506 | spin_unlock_irq(&dest_se_tpg->acl_node_lock); |
| 3507 | 3507 | ||
| 3508 | if (!dest_node_acl) { | 3508 | if (!dest_node_acl) { |
| 3509 | pr_err("Unable to locate %s dest_node_acl for" | 3509 | pr_err("Unable to locate %s dest_node_acl for" |
diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c index 3dd81d24d9a9..e567e129c697 100644 --- a/drivers/target/target_core_rd.c +++ b/drivers/target/target_core_rd.c | |||
| @@ -390,12 +390,10 @@ static int rd_MEMCPY_read(struct rd_request *req) | |||
| 390 | length = req->rd_size; | 390 | length = req->rd_size; |
| 391 | 391 | ||
| 392 | dst = sg_virt(&sg_d[i++]) + dst_offset; | 392 | dst = sg_virt(&sg_d[i++]) + dst_offset; |
| 393 | if (!dst) | 393 | BUG_ON(!dst); |
| 394 | BUG(); | ||
| 395 | 394 | ||
| 396 | src = sg_virt(&sg_s[j]) + src_offset; | 395 | src = sg_virt(&sg_s[j]) + src_offset; |
| 397 | if (!src) | 396 | BUG_ON(!src); |
| 398 | BUG(); | ||
| 399 | 397 | ||
| 400 | dst_offset = 0; | 398 | dst_offset = 0; |
| 401 | src_offset = length; | 399 | src_offset = length; |
| @@ -415,8 +413,7 @@ static int rd_MEMCPY_read(struct rd_request *req) | |||
| 415 | length = req->rd_size; | 413 | length = req->rd_size; |
| 416 | 414 | ||
| 417 | dst = sg_virt(&sg_d[i]) + dst_offset; | 415 | dst = sg_virt(&sg_d[i]) + dst_offset; |
| 418 | if (!dst) | 416 | BUG_ON(!dst); |
| 419 | BUG(); | ||
| 420 | 417 | ||
| 421 | if (sg_d[i].length == length) { | 418 | if (sg_d[i].length == length) { |
| 422 | i++; | 419 | i++; |
| @@ -425,8 +422,7 @@ static int rd_MEMCPY_read(struct rd_request *req) | |||
| 425 | dst_offset = length; | 422 | dst_offset = length; |
| 426 | 423 | ||
| 427 | src = sg_virt(&sg_s[j++]) + src_offset; | 424 | src = sg_virt(&sg_s[j++]) + src_offset; |
| 428 | if (!src) | 425 | BUG_ON(!src); |
| 429 | BUG(); | ||
| 430 | 426 | ||
| 431 | src_offset = 0; | 427 | src_offset = 0; |
| 432 | page_end = 1; | 428 | page_end = 1; |
| @@ -510,12 +506,10 @@ static int rd_MEMCPY_write(struct rd_request *req) | |||
| 510 | length = req->rd_size; | 506 | length = req->rd_size; |
| 511 | 507 | ||
| 512 | src = sg_virt(&sg_s[i++]) + src_offset; | 508 | src = sg_virt(&sg_s[i++]) + src_offset; |
| 513 | if (!src) | 509 | BUG_ON(!src); |
| 514 | BUG(); | ||
| 515 | 510 | ||
| 516 | dst = sg_virt(&sg_d[j]) + dst_offset; | 511 | dst = sg_virt(&sg_d[j]) + dst_offset; |
| 517 | if (!dst) | 512 | BUG_ON(!dst); |
| 518 | BUG(); | ||
| 519 | 513 | ||
| 520 | src_offset = 0; | 514 | src_offset = 0; |
| 521 | dst_offset = length; | 515 | dst_offset = length; |
| @@ -535,8 +529,7 @@ static int rd_MEMCPY_write(struct rd_request *req) | |||
| 535 | length = req->rd_size; | 529 | length = req->rd_size; |
| 536 | 530 | ||
| 537 | src = sg_virt(&sg_s[i]) + src_offset; | 531 | src = sg_virt(&sg_s[i]) + src_offset; |
| 538 | if (!src) | 532 | BUG_ON(!src); |
| 539 | BUG(); | ||
| 540 | 533 | ||
| 541 | if (sg_s[i].length == length) { | 534 | if (sg_s[i].length == length) { |
| 542 | i++; | 535 | i++; |
| @@ -545,8 +538,7 @@ static int rd_MEMCPY_write(struct rd_request *req) | |||
| 545 | src_offset = length; | 538 | src_offset = length; |
| 546 | 539 | ||
| 547 | dst = sg_virt(&sg_d[j++]) + dst_offset; | 540 | dst = sg_virt(&sg_d[j++]) + dst_offset; |
| 548 | if (!dst) | 541 | BUG_ON(!dst); |
| 549 | BUG(); | ||
| 550 | 542 | ||
| 551 | dst_offset = 0; | 543 | dst_offset = 0; |
| 552 | page_end = 1; | 544 | page_end = 1; |
diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c index 4f1ba4c5ef11..162b736c7342 100644 --- a/drivers/target/target_core_tpg.c +++ b/drivers/target/target_core_tpg.c | |||
| @@ -137,15 +137,15 @@ struct se_node_acl *core_tpg_get_initiator_node_acl( | |||
| 137 | { | 137 | { |
| 138 | struct se_node_acl *acl; | 138 | struct se_node_acl *acl; |
| 139 | 139 | ||
| 140 | spin_lock_bh(&tpg->acl_node_lock); | 140 | spin_lock_irq(&tpg->acl_node_lock); |
| 141 | list_for_each_entry(acl, &tpg->acl_node_list, acl_list) { | 141 | list_for_each_entry(acl, &tpg->acl_node_list, acl_list) { |
| 142 | if (!strcmp(acl->initiatorname, initiatorname) && | 142 | if (!strcmp(acl->initiatorname, initiatorname) && |
| 143 | !acl->dynamic_node_acl) { | 143 | !acl->dynamic_node_acl) { |
| 144 | spin_unlock_bh(&tpg->acl_node_lock); | 144 | spin_unlock_irq(&tpg->acl_node_lock); |
| 145 | return acl; | 145 | return acl; |
| 146 | } | 146 | } |
| 147 | } | 147 | } |
| 148 | spin_unlock_bh(&tpg->acl_node_lock); | 148 | spin_unlock_irq(&tpg->acl_node_lock); |
| 149 | 149 | ||
| 150 | return NULL; | 150 | return NULL; |
| 151 | } | 151 | } |
| @@ -298,13 +298,21 @@ struct se_node_acl *core_tpg_check_initiator_node_acl( | |||
| 298 | tpg->se_tpg_tfo->tpg_release_fabric_acl(tpg, acl); | 298 | tpg->se_tpg_tfo->tpg_release_fabric_acl(tpg, acl); |
| 299 | return NULL; | 299 | return NULL; |
| 300 | } | 300 | } |
| 301 | /* | ||
| 302 | * Here we only create demo-mode MappedLUNs from the active | ||
| 303 | * TPG LUNs if the fabric is not explictly asking for | ||
| 304 | * tpg_check_demo_mode_login_only() == 1. | ||
| 305 | */ | ||
| 306 | if ((tpg->se_tpg_tfo->tpg_check_demo_mode_login_only != NULL) && | ||
| 307 | (tpg->se_tpg_tfo->tpg_check_demo_mode_login_only(tpg) == 1)) | ||
| 308 | do { ; } while (0); | ||
| 309 | else | ||
| 310 | core_tpg_add_node_to_devs(acl, tpg); | ||
| 301 | 311 | ||
| 302 | core_tpg_add_node_to_devs(acl, tpg); | 312 | spin_lock_irq(&tpg->acl_node_lock); |
| 303 | |||
| 304 | spin_lock_bh(&tpg->acl_node_lock); | ||
| 305 | list_add_tail(&acl->acl_list, &tpg->acl_node_list); | 313 | list_add_tail(&acl->acl_list, &tpg->acl_node_list); |
| 306 | tpg->num_node_acls++; | 314 | tpg->num_node_acls++; |
| 307 | spin_unlock_bh(&tpg->acl_node_lock); | 315 | spin_unlock_irq(&tpg->acl_node_lock); |
| 308 | 316 | ||
| 309 | pr_debug("%s_TPG[%u] - Added DYNAMIC ACL with TCQ Depth: %d for %s" | 317 | pr_debug("%s_TPG[%u] - Added DYNAMIC ACL with TCQ Depth: %d for %s" |
| 310 | " Initiator Node: %s\n", tpg->se_tpg_tfo->get_fabric_name(), | 318 | " Initiator Node: %s\n", tpg->se_tpg_tfo->get_fabric_name(), |
| @@ -354,7 +362,7 @@ struct se_node_acl *core_tpg_add_initiator_node_acl( | |||
| 354 | { | 362 | { |
| 355 | struct se_node_acl *acl = NULL; | 363 | struct se_node_acl *acl = NULL; |
| 356 | 364 | ||
| 357 | spin_lock_bh(&tpg->acl_node_lock); | 365 | spin_lock_irq(&tpg->acl_node_lock); |
| 358 | acl = __core_tpg_get_initiator_node_acl(tpg, initiatorname); | 366 | acl = __core_tpg_get_initiator_node_acl(tpg, initiatorname); |
| 359 | if (acl) { | 367 | if (acl) { |
| 360 | if (acl->dynamic_node_acl) { | 368 | if (acl->dynamic_node_acl) { |
| @@ -362,7 +370,7 @@ struct se_node_acl *core_tpg_add_initiator_node_acl( | |||
| 362 | pr_debug("%s_TPG[%u] - Replacing dynamic ACL" | 370 | pr_debug("%s_TPG[%u] - Replacing dynamic ACL" |
| 363 | " for %s\n", tpg->se_tpg_tfo->get_fabric_name(), | 371 | " for %s\n", tpg->se_tpg_tfo->get_fabric_name(), |
| 364 | tpg->se_tpg_tfo->tpg_get_tag(tpg), initiatorname); | 372 | tpg->se_tpg_tfo->tpg_get_tag(tpg), initiatorname); |
| 365 | spin_unlock_bh(&tpg->acl_node_lock); | 373 | spin_unlock_irq(&tpg->acl_node_lock); |
| 366 | /* | 374 | /* |
| 367 | * Release the locally allocated struct se_node_acl | 375 | * Release the locally allocated struct se_node_acl |
| 368 | * because * core_tpg_add_initiator_node_acl() returned | 376 | * because * core_tpg_add_initiator_node_acl() returned |
| @@ -378,10 +386,10 @@ struct se_node_acl *core_tpg_add_initiator_node_acl( | |||
| 378 | " Node %s already exists for TPG %u, ignoring" | 386 | " Node %s already exists for TPG %u, ignoring" |
| 379 | " request.\n", tpg->se_tpg_tfo->get_fabric_name(), | 387 | " request.\n", tpg->se_tpg_tfo->get_fabric_name(), |
| 380 | initiatorname, tpg->se_tpg_tfo->tpg_get_tag(tpg)); | 388 | initiatorname, tpg->se_tpg_tfo->tpg_get_tag(tpg)); |
| 381 | spin_unlock_bh(&tpg->acl_node_lock); | 389 | spin_unlock_irq(&tpg->acl_node_lock); |
| 382 | return ERR_PTR(-EEXIST); | 390 | return ERR_PTR(-EEXIST); |
| 383 | } | 391 | } |
| 384 | spin_unlock_bh(&tpg->acl_node_lock); | 392 | spin_unlock_irq(&tpg->acl_node_lock); |
| 385 | 393 | ||
| 386 | if (!se_nacl) { | 394 | if (!se_nacl) { |
| 387 | pr_err("struct se_node_acl pointer is NULL\n"); | 395 | pr_err("struct se_node_acl pointer is NULL\n"); |
| @@ -418,10 +426,10 @@ struct se_node_acl *core_tpg_add_initiator_node_acl( | |||
| 418 | return ERR_PTR(-EINVAL); | 426 | return ERR_PTR(-EINVAL); |
| 419 | } | 427 | } |
| 420 | 428 | ||
| 421 | spin_lock_bh(&tpg->acl_node_lock); | 429 | spin_lock_irq(&tpg->acl_node_lock); |
| 422 | list_add_tail(&acl->acl_list, &tpg->acl_node_list); | 430 | list_add_tail(&acl->acl_list, &tpg->acl_node_list); |
| 423 | tpg->num_node_acls++; | 431 | tpg->num_node_acls++; |
| 424 | spin_unlock_bh(&tpg->acl_node_lock); | 432 | spin_unlock_irq(&tpg->acl_node_lock); |
| 425 | 433 | ||
| 426 | done: | 434 | done: |
| 427 | pr_debug("%s_TPG[%hu] - Added ACL with TCQ Depth: %d for %s" | 435 | pr_debug("%s_TPG[%hu] - Added ACL with TCQ Depth: %d for %s" |
| @@ -445,14 +453,14 @@ int core_tpg_del_initiator_node_acl( | |||
| 445 | struct se_session *sess, *sess_tmp; | 453 | struct se_session *sess, *sess_tmp; |
| 446 | int dynamic_acl = 0; | 454 | int dynamic_acl = 0; |
| 447 | 455 | ||
| 448 | spin_lock_bh(&tpg->acl_node_lock); | 456 | spin_lock_irq(&tpg->acl_node_lock); |
| 449 | if (acl->dynamic_node_acl) { | 457 | if (acl->dynamic_node_acl) { |
| 450 | acl->dynamic_node_acl = 0; | 458 | acl->dynamic_node_acl = 0; |
| 451 | dynamic_acl = 1; | 459 | dynamic_acl = 1; |
| 452 | } | 460 | } |
| 453 | list_del(&acl->acl_list); | 461 | list_del(&acl->acl_list); |
| 454 | tpg->num_node_acls--; | 462 | tpg->num_node_acls--; |
| 455 | spin_unlock_bh(&tpg->acl_node_lock); | 463 | spin_unlock_irq(&tpg->acl_node_lock); |
| 456 | 464 | ||
| 457 | spin_lock_bh(&tpg->session_lock); | 465 | spin_lock_bh(&tpg->session_lock); |
| 458 | list_for_each_entry_safe(sess, sess_tmp, | 466 | list_for_each_entry_safe(sess, sess_tmp, |
| @@ -503,21 +511,21 @@ int core_tpg_set_initiator_node_queue_depth( | |||
| 503 | struct se_node_acl *acl; | 511 | struct se_node_acl *acl; |
| 504 | int dynamic_acl = 0; | 512 | int dynamic_acl = 0; |
| 505 | 513 | ||
| 506 | spin_lock_bh(&tpg->acl_node_lock); | 514 | spin_lock_irq(&tpg->acl_node_lock); |
| 507 | acl = __core_tpg_get_initiator_node_acl(tpg, initiatorname); | 515 | acl = __core_tpg_get_initiator_node_acl(tpg, initiatorname); |
| 508 | if (!acl) { | 516 | if (!acl) { |
| 509 | pr_err("Access Control List entry for %s Initiator" | 517 | pr_err("Access Control List entry for %s Initiator" |
| 510 | " Node %s does not exists for TPG %hu, ignoring" | 518 | " Node %s does not exists for TPG %hu, ignoring" |
| 511 | " request.\n", tpg->se_tpg_tfo->get_fabric_name(), | 519 | " request.\n", tpg->se_tpg_tfo->get_fabric_name(), |
| 512 | initiatorname, tpg->se_tpg_tfo->tpg_get_tag(tpg)); | 520 | initiatorname, tpg->se_tpg_tfo->tpg_get_tag(tpg)); |
| 513 | spin_unlock_bh(&tpg->acl_node_lock); | 521 | spin_unlock_irq(&tpg->acl_node_lock); |
| 514 | return -ENODEV; | 522 | return -ENODEV; |
| 515 | } | 523 | } |
| 516 | if (acl->dynamic_node_acl) { | 524 | if (acl->dynamic_node_acl) { |
| 517 | acl->dynamic_node_acl = 0; | 525 | acl->dynamic_node_acl = 0; |
| 518 | dynamic_acl = 1; | 526 | dynamic_acl = 1; |
| 519 | } | 527 | } |
| 520 | spin_unlock_bh(&tpg->acl_node_lock); | 528 | spin_unlock_irq(&tpg->acl_node_lock); |
| 521 | 529 | ||
| 522 | spin_lock_bh(&tpg->session_lock); | 530 | spin_lock_bh(&tpg->session_lock); |
| 523 | list_for_each_entry(sess, &tpg->tpg_sess_list, sess_list) { | 531 | list_for_each_entry(sess, &tpg->tpg_sess_list, sess_list) { |
| @@ -533,10 +541,10 @@ int core_tpg_set_initiator_node_queue_depth( | |||
| 533 | tpg->se_tpg_tfo->get_fabric_name(), initiatorname); | 541 | tpg->se_tpg_tfo->get_fabric_name(), initiatorname); |
| 534 | spin_unlock_bh(&tpg->session_lock); | 542 | spin_unlock_bh(&tpg->session_lock); |
| 535 | 543 | ||
| 536 | spin_lock_bh(&tpg->acl_node_lock); | 544 | spin_lock_irq(&tpg->acl_node_lock); |
| 537 | if (dynamic_acl) | 545 | if (dynamic_acl) |
| 538 | acl->dynamic_node_acl = 1; | 546 | acl->dynamic_node_acl = 1; |
| 539 | spin_unlock_bh(&tpg->acl_node_lock); | 547 | spin_unlock_irq(&tpg->acl_node_lock); |
| 540 | return -EEXIST; | 548 | return -EEXIST; |
| 541 | } | 549 | } |
| 542 | /* | 550 | /* |
| @@ -571,10 +579,10 @@ int core_tpg_set_initiator_node_queue_depth( | |||
| 571 | if (init_sess) | 579 | if (init_sess) |
| 572 | tpg->se_tpg_tfo->close_session(init_sess); | 580 | tpg->se_tpg_tfo->close_session(init_sess); |
| 573 | 581 | ||
| 574 | spin_lock_bh(&tpg->acl_node_lock); | 582 | spin_lock_irq(&tpg->acl_node_lock); |
| 575 | if (dynamic_acl) | 583 | if (dynamic_acl) |
| 576 | acl->dynamic_node_acl = 1; | 584 | acl->dynamic_node_acl = 1; |
| 577 | spin_unlock_bh(&tpg->acl_node_lock); | 585 | spin_unlock_irq(&tpg->acl_node_lock); |
| 578 | return -EINVAL; | 586 | return -EINVAL; |
| 579 | } | 587 | } |
| 580 | spin_unlock_bh(&tpg->session_lock); | 588 | spin_unlock_bh(&tpg->session_lock); |
| @@ -590,10 +598,10 @@ int core_tpg_set_initiator_node_queue_depth( | |||
| 590 | initiatorname, tpg->se_tpg_tfo->get_fabric_name(), | 598 | initiatorname, tpg->se_tpg_tfo->get_fabric_name(), |
| 591 | tpg->se_tpg_tfo->tpg_get_tag(tpg)); | 599 | tpg->se_tpg_tfo->tpg_get_tag(tpg)); |
| 592 | 600 | ||
| 593 | spin_lock_bh(&tpg->acl_node_lock); | 601 | spin_lock_irq(&tpg->acl_node_lock); |
| 594 | if (dynamic_acl) | 602 | if (dynamic_acl) |
| 595 | acl->dynamic_node_acl = 1; | 603 | acl->dynamic_node_acl = 1; |
| 596 | spin_unlock_bh(&tpg->acl_node_lock); | 604 | spin_unlock_irq(&tpg->acl_node_lock); |
| 597 | 605 | ||
| 598 | return 0; | 606 | return 0; |
| 599 | } | 607 | } |
| @@ -717,20 +725,20 @@ int core_tpg_deregister(struct se_portal_group *se_tpg) | |||
| 717 | * not been released because of TFO->tpg_check_demo_mode_cache() == 1 | 725 | * not been released because of TFO->tpg_check_demo_mode_cache() == 1 |
| 718 | * in transport_deregister_session(). | 726 | * in transport_deregister_session(). |
| 719 | */ | 727 | */ |
| 720 | spin_lock_bh(&se_tpg->acl_node_lock); | 728 | spin_lock_irq(&se_tpg->acl_node_lock); |
| 721 | list_for_each_entry_safe(nacl, nacl_tmp, &se_tpg->acl_node_list, | 729 | list_for_each_entry_safe(nacl, nacl_tmp, &se_tpg->acl_node_list, |
| 722 | acl_list) { | 730 | acl_list) { |
| 723 | list_del(&nacl->acl_list); | 731 | list_del(&nacl->acl_list); |
| 724 | se_tpg->num_node_acls--; | 732 | se_tpg->num_node_acls--; |
| 725 | spin_unlock_bh(&se_tpg->acl_node_lock); | 733 | spin_unlock_irq(&se_tpg->acl_node_lock); |
| 726 | 734 | ||
| 727 | core_tpg_wait_for_nacl_pr_ref(nacl); | 735 | core_tpg_wait_for_nacl_pr_ref(nacl); |
| 728 | core_free_device_list_for_node(nacl, se_tpg); | 736 | core_free_device_list_for_node(nacl, se_tpg); |
| 729 | se_tpg->se_tpg_tfo->tpg_release_fabric_acl(se_tpg, nacl); | 737 | se_tpg->se_tpg_tfo->tpg_release_fabric_acl(se_tpg, nacl); |
| 730 | 738 | ||
| 731 | spin_lock_bh(&se_tpg->acl_node_lock); | 739 | spin_lock_irq(&se_tpg->acl_node_lock); |
| 732 | } | 740 | } |
| 733 | spin_unlock_bh(&se_tpg->acl_node_lock); | 741 | spin_unlock_irq(&se_tpg->acl_node_lock); |
| 734 | 742 | ||
| 735 | if (se_tpg->se_tpg_type == TRANSPORT_TPG_TYPE_NORMAL) | 743 | if (se_tpg->se_tpg_type == TRANSPORT_TPG_TYPE_NORMAL) |
| 736 | core_tpg_release_virtual_lun0(se_tpg); | 744 | core_tpg_release_virtual_lun0(se_tpg); |
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 89760329d5d0..8d0c58ea6316 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
| @@ -389,17 +389,18 @@ void transport_deregister_session(struct se_session *se_sess) | |||
| 389 | { | 389 | { |
| 390 | struct se_portal_group *se_tpg = se_sess->se_tpg; | 390 | struct se_portal_group *se_tpg = se_sess->se_tpg; |
| 391 | struct se_node_acl *se_nacl; | 391 | struct se_node_acl *se_nacl; |
| 392 | unsigned long flags; | ||
| 392 | 393 | ||
| 393 | if (!se_tpg) { | 394 | if (!se_tpg) { |
| 394 | transport_free_session(se_sess); | 395 | transport_free_session(se_sess); |
| 395 | return; | 396 | return; |
| 396 | } | 397 | } |
| 397 | 398 | ||
| 398 | spin_lock_bh(&se_tpg->session_lock); | 399 | spin_lock_irqsave(&se_tpg->session_lock, flags); |
| 399 | list_del(&se_sess->sess_list); | 400 | list_del(&se_sess->sess_list); |
| 400 | se_sess->se_tpg = NULL; | 401 | se_sess->se_tpg = NULL; |
| 401 | se_sess->fabric_sess_ptr = NULL; | 402 | se_sess->fabric_sess_ptr = NULL; |
| 402 | spin_unlock_bh(&se_tpg->session_lock); | 403 | spin_unlock_irqrestore(&se_tpg->session_lock, flags); |
| 403 | 404 | ||
| 404 | /* | 405 | /* |
| 405 | * Determine if we need to do extra work for this initiator node's | 406 | * Determine if we need to do extra work for this initiator node's |
| @@ -407,22 +408,22 @@ void transport_deregister_session(struct se_session *se_sess) | |||
| 407 | */ | 408 | */ |
| 408 | se_nacl = se_sess->se_node_acl; | 409 | se_nacl = se_sess->se_node_acl; |
| 409 | if (se_nacl) { | 410 | if (se_nacl) { |
| 410 | spin_lock_bh(&se_tpg->acl_node_lock); | 411 | spin_lock_irqsave(&se_tpg->acl_node_lock, flags); |
| 411 | if (se_nacl->dynamic_node_acl) { | 412 | if (se_nacl->dynamic_node_acl) { |
| 412 | if (!se_tpg->se_tpg_tfo->tpg_check_demo_mode_cache( | 413 | if (!se_tpg->se_tpg_tfo->tpg_check_demo_mode_cache( |
| 413 | se_tpg)) { | 414 | se_tpg)) { |
| 414 | list_del(&se_nacl->acl_list); | 415 | list_del(&se_nacl->acl_list); |
| 415 | se_tpg->num_node_acls--; | 416 | se_tpg->num_node_acls--; |
| 416 | spin_unlock_bh(&se_tpg->acl_node_lock); | 417 | spin_unlock_irqrestore(&se_tpg->acl_node_lock, flags); |
| 417 | 418 | ||
| 418 | core_tpg_wait_for_nacl_pr_ref(se_nacl); | 419 | core_tpg_wait_for_nacl_pr_ref(se_nacl); |
| 419 | core_free_device_list_for_node(se_nacl, se_tpg); | 420 | core_free_device_list_for_node(se_nacl, se_tpg); |
| 420 | se_tpg->se_tpg_tfo->tpg_release_fabric_acl(se_tpg, | 421 | se_tpg->se_tpg_tfo->tpg_release_fabric_acl(se_tpg, |
| 421 | se_nacl); | 422 | se_nacl); |
| 422 | spin_lock_bh(&se_tpg->acl_node_lock); | 423 | spin_lock_irqsave(&se_tpg->acl_node_lock, flags); |
| 423 | } | 424 | } |
| 424 | } | 425 | } |
| 425 | spin_unlock_bh(&se_tpg->acl_node_lock); | 426 | spin_unlock_irqrestore(&se_tpg->acl_node_lock, flags); |
| 426 | } | 427 | } |
| 427 | 428 | ||
| 428 | transport_free_session(se_sess); | 429 | transport_free_session(se_sess); |
| @@ -2053,8 +2054,14 @@ static void transport_generic_request_failure( | |||
| 2053 | cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE; | 2054 | cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE; |
| 2054 | break; | 2055 | break; |
| 2055 | } | 2056 | } |
| 2056 | 2057 | /* | |
| 2057 | if (!sc) | 2058 | * If a fabric does not define a cmd->se_tfo->new_cmd_map caller, |
| 2059 | * make the call to transport_send_check_condition_and_sense() | ||
| 2060 | * directly. Otherwise expect the fabric to make the call to | ||
| 2061 | * transport_send_check_condition_and_sense() after handling | ||
| 2062 | * possible unsoliticied write data payloads. | ||
| 2063 | */ | ||
| 2064 | if (!sc && !cmd->se_tfo->new_cmd_map) | ||
| 2058 | transport_new_cmd_failure(cmd); | 2065 | transport_new_cmd_failure(cmd); |
| 2059 | else { | 2066 | else { |
| 2060 | ret = transport_send_check_condition_and_sense(cmd, | 2067 | ret = transport_send_check_condition_and_sense(cmd, |
| @@ -2847,12 +2854,42 @@ static int transport_cmd_get_valid_sectors(struct se_cmd *cmd) | |||
| 2847 | " transport_dev_end_lba(): %llu\n", | 2854 | " transport_dev_end_lba(): %llu\n", |
| 2848 | cmd->t_task_lba, sectors, | 2855 | cmd->t_task_lba, sectors, |
| 2849 | transport_dev_end_lba(dev)); | 2856 | transport_dev_end_lba(dev)); |
| 2850 | pr_err(" We should return CHECK_CONDITION" | 2857 | return -EINVAL; |
| 2851 | " but we don't yet\n"); | ||
| 2852 | return 0; | ||
| 2853 | } | 2858 | } |
| 2854 | 2859 | ||
| 2855 | return sectors; | 2860 | return 0; |
| 2861 | } | ||
| 2862 | |||
| 2863 | static int target_check_write_same_discard(unsigned char *flags, struct se_device *dev) | ||
| 2864 | { | ||
| 2865 | /* | ||
| 2866 | * Determine if the received WRITE_SAME is used to for direct | ||
| 2867 | * passthrough into Linux/SCSI with struct request via TCM/pSCSI | ||
| 2868 | * or we are signaling the use of internal WRITE_SAME + UNMAP=1 | ||
| 2869 | * emulation for -> Linux/BLOCK disbard with TCM/IBLOCK code. | ||
| 2870 | */ | ||
| 2871 | int passthrough = (dev->transport->transport_type == | ||
| 2872 | TRANSPORT_PLUGIN_PHBA_PDEV); | ||
| 2873 | |||
| 2874 | if (!passthrough) { | ||
| 2875 | if ((flags[0] & 0x04) || (flags[0] & 0x02)) { | ||
| 2876 | pr_err("WRITE_SAME PBDATA and LBDATA" | ||
| 2877 | " bits not supported for Block Discard" | ||
| 2878 | " Emulation\n"); | ||
| 2879 | return -ENOSYS; | ||
| 2880 | } | ||
| 2881 | /* | ||
| 2882 | * Currently for the emulated case we only accept | ||
| 2883 | * tpws with the UNMAP=1 bit set. | ||
| 2884 | */ | ||
| 2885 | if (!(flags[0] & 0x08)) { | ||
| 2886 | pr_err("WRITE_SAME w/o UNMAP bit not" | ||
| 2887 | " supported for Block Discard Emulation\n"); | ||
| 2888 | return -ENOSYS; | ||
| 2889 | } | ||
| 2890 | } | ||
| 2891 | |||
| 2892 | return 0; | ||
| 2856 | } | 2893 | } |
| 2857 | 2894 | ||
| 2858 | /* transport_generic_cmd_sequencer(): | 2895 | /* transport_generic_cmd_sequencer(): |
| @@ -3065,7 +3102,7 @@ static int transport_generic_cmd_sequencer( | |||
| 3065 | goto out_unsupported_cdb; | 3102 | goto out_unsupported_cdb; |
| 3066 | 3103 | ||
| 3067 | if (sectors) | 3104 | if (sectors) |
| 3068 | size = transport_get_size(sectors, cdb, cmd); | 3105 | size = transport_get_size(1, cdb, cmd); |
| 3069 | else { | 3106 | else { |
| 3070 | pr_err("WSNZ=1, WRITE_SAME w/sectors=0 not" | 3107 | pr_err("WSNZ=1, WRITE_SAME w/sectors=0 not" |
| 3071 | " supported\n"); | 3108 | " supported\n"); |
| @@ -3075,27 +3112,9 @@ static int transport_generic_cmd_sequencer( | |||
| 3075 | cmd->t_task_lba = get_unaligned_be64(&cdb[12]); | 3112 | cmd->t_task_lba = get_unaligned_be64(&cdb[12]); |
| 3076 | cmd->se_cmd_flags |= SCF_SCSI_CONTROL_SG_IO_CDB; | 3113 | cmd->se_cmd_flags |= SCF_SCSI_CONTROL_SG_IO_CDB; |
| 3077 | 3114 | ||
| 3078 | /* | 3115 | if (target_check_write_same_discard(&cdb[10], dev) < 0) |
| 3079 | * Skip the remaining assignments for TCM/PSCSI passthrough | ||
| 3080 | */ | ||
| 3081 | if (passthrough) | ||
| 3082 | break; | ||
| 3083 | |||
| 3084 | if ((cdb[10] & 0x04) || (cdb[10] & 0x02)) { | ||
| 3085 | pr_err("WRITE_SAME PBDATA and LBDATA" | ||
| 3086 | " bits not supported for Block Discard" | ||
| 3087 | " Emulation\n"); | ||
| 3088 | goto out_invalid_cdb_field; | 3116 | goto out_invalid_cdb_field; |
| 3089 | } | 3117 | |
| 3090 | /* | ||
| 3091 | * Currently for the emulated case we only accept | ||
| 3092 | * tpws with the UNMAP=1 bit set. | ||
| 3093 | */ | ||
| 3094 | if (!(cdb[10] & 0x08)) { | ||
| 3095 | pr_err("WRITE_SAME w/o UNMAP bit not" | ||
| 3096 | " supported for Block Discard Emulation\n"); | ||
| 3097 | goto out_invalid_cdb_field; | ||
| 3098 | } | ||
| 3099 | break; | 3118 | break; |
| 3100 | default: | 3119 | default: |
| 3101 | pr_err("VARIABLE_LENGTH_CMD service action" | 3120 | pr_err("VARIABLE_LENGTH_CMD service action" |
| @@ -3330,10 +3349,12 @@ static int transport_generic_cmd_sequencer( | |||
| 3330 | cmd->se_cmd_flags |= SCF_EMULATE_CDB_ASYNC; | 3349 | cmd->se_cmd_flags |= SCF_EMULATE_CDB_ASYNC; |
| 3331 | /* | 3350 | /* |
| 3332 | * Check to ensure that LBA + Range does not exceed past end of | 3351 | * Check to ensure that LBA + Range does not exceed past end of |
| 3333 | * device. | 3352 | * device for IBLOCK and FILEIO ->do_sync_cache() backend calls |
| 3334 | */ | 3353 | */ |
| 3335 | if (!transport_cmd_get_valid_sectors(cmd)) | 3354 | if ((cmd->t_task_lba != 0) || (sectors != 0)) { |
| 3336 | goto out_invalid_cdb_field; | 3355 | if (transport_cmd_get_valid_sectors(cmd) < 0) |
| 3356 | goto out_invalid_cdb_field; | ||
| 3357 | } | ||
| 3337 | break; | 3358 | break; |
| 3338 | case UNMAP: | 3359 | case UNMAP: |
| 3339 | size = get_unaligned_be16(&cdb[7]); | 3360 | size = get_unaligned_be16(&cdb[7]); |
| @@ -3345,40 +3366,38 @@ static int transport_generic_cmd_sequencer( | |||
| 3345 | goto out_unsupported_cdb; | 3366 | goto out_unsupported_cdb; |
| 3346 | 3367 | ||
| 3347 | if (sectors) | 3368 | if (sectors) |
| 3348 | size = transport_get_size(sectors, cdb, cmd); | 3369 | size = transport_get_size(1, cdb, cmd); |
| 3349 | else { | 3370 | else { |
| 3350 | pr_err("WSNZ=1, WRITE_SAME w/sectors=0 not supported\n"); | 3371 | pr_err("WSNZ=1, WRITE_SAME w/sectors=0 not supported\n"); |
| 3351 | goto out_invalid_cdb_field; | 3372 | goto out_invalid_cdb_field; |
| 3352 | } | 3373 | } |
| 3353 | 3374 | ||
| 3354 | cmd->t_task_lba = get_unaligned_be64(&cdb[2]); | 3375 | cmd->t_task_lba = get_unaligned_be64(&cdb[2]); |
| 3355 | passthrough = (dev->transport->transport_type == | 3376 | cmd->se_cmd_flags |= SCF_SCSI_CONTROL_SG_IO_CDB; |
| 3356 | TRANSPORT_PLUGIN_PHBA_PDEV); | 3377 | |
| 3357 | /* | 3378 | if (target_check_write_same_discard(&cdb[1], dev) < 0) |
| 3358 | * Determine if the received WRITE_SAME_16 is used to for direct | 3379 | goto out_invalid_cdb_field; |
| 3359 | * passthrough into Linux/SCSI with struct request via TCM/pSCSI | 3380 | break; |
| 3360 | * or we are signaling the use of internal WRITE_SAME + UNMAP=1 | 3381 | case WRITE_SAME: |
| 3361 | * emulation for -> Linux/BLOCK disbard with TCM/IBLOCK and | 3382 | sectors = transport_get_sectors_10(cdb, cmd, §or_ret); |
| 3362 | * TCM/FILEIO subsystem plugin backstores. | 3383 | if (sector_ret) |
| 3363 | */ | 3384 | goto out_unsupported_cdb; |
| 3364 | if (!passthrough) { | 3385 | |
| 3365 | if ((cdb[1] & 0x04) || (cdb[1] & 0x02)) { | 3386 | if (sectors) |
| 3366 | pr_err("WRITE_SAME PBDATA and LBDATA" | 3387 | size = transport_get_size(1, cdb, cmd); |
| 3367 | " bits not supported for Block Discard" | 3388 | else { |
| 3368 | " Emulation\n"); | 3389 | pr_err("WSNZ=1, WRITE_SAME w/sectors=0 not supported\n"); |
| 3369 | goto out_invalid_cdb_field; | 3390 | goto out_invalid_cdb_field; |
| 3370 | } | ||
| 3371 | /* | ||
| 3372 | * Currently for the emulated case we only accept | ||
| 3373 | * tpws with the UNMAP=1 bit set. | ||
| 3374 | */ | ||
| 3375 | if (!(cdb[1] & 0x08)) { | ||
| 3376 | pr_err("WRITE_SAME w/o UNMAP bit not " | ||
| 3377 | " supported for Block Discard Emulation\n"); | ||
| 3378 | goto out_invalid_cdb_field; | ||
| 3379 | } | ||
| 3380 | } | 3391 | } |
| 3392 | |||
| 3393 | cmd->t_task_lba = get_unaligned_be32(&cdb[2]); | ||
| 3381 | cmd->se_cmd_flags |= SCF_SCSI_CONTROL_SG_IO_CDB; | 3394 | cmd->se_cmd_flags |= SCF_SCSI_CONTROL_SG_IO_CDB; |
| 3395 | /* | ||
| 3396 | * Follow sbcr26 with WRITE_SAME (10) and check for the existence | ||
| 3397 | * of byte 1 bit 3 UNMAP instead of original reserved field | ||
| 3398 | */ | ||
| 3399 | if (target_check_write_same_discard(&cdb[1], dev) < 0) | ||
| 3400 | goto out_invalid_cdb_field; | ||
| 3382 | break; | 3401 | break; |
| 3383 | case ALLOW_MEDIUM_REMOVAL: | 3402 | case ALLOW_MEDIUM_REMOVAL: |
| 3384 | case GPCMD_CLOSE_TRACK: | 3403 | case GPCMD_CLOSE_TRACK: |
| @@ -3873,9 +3892,7 @@ EXPORT_SYMBOL(transport_generic_map_mem_to_cmd); | |||
| 3873 | static int transport_new_cmd_obj(struct se_cmd *cmd) | 3892 | static int transport_new_cmd_obj(struct se_cmd *cmd) |
| 3874 | { | 3893 | { |
| 3875 | struct se_device *dev = cmd->se_dev; | 3894 | struct se_device *dev = cmd->se_dev; |
| 3876 | u32 task_cdbs; | 3895 | int set_counts = 1, rc, task_cdbs; |
| 3877 | u32 rc; | ||
| 3878 | int set_counts = 1; | ||
| 3879 | 3896 | ||
| 3880 | /* | 3897 | /* |
| 3881 | * Setup any BIDI READ tasks and memory from | 3898 | * Setup any BIDI READ tasks and memory from |
| @@ -3893,7 +3910,7 @@ static int transport_new_cmd_obj(struct se_cmd *cmd) | |||
| 3893 | cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION; | 3910 | cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION; |
| 3894 | cmd->scsi_sense_reason = | 3911 | cmd->scsi_sense_reason = |
| 3895 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 3912 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 3896 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 3913 | return -EINVAL; |
| 3897 | } | 3914 | } |
| 3898 | atomic_inc(&cmd->t_fe_count); | 3915 | atomic_inc(&cmd->t_fe_count); |
| 3899 | atomic_inc(&cmd->t_se_count); | 3916 | atomic_inc(&cmd->t_se_count); |
| @@ -3912,7 +3929,7 @@ static int transport_new_cmd_obj(struct se_cmd *cmd) | |||
| 3912 | cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION; | 3929 | cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION; |
| 3913 | cmd->scsi_sense_reason = | 3930 | cmd->scsi_sense_reason = |
| 3914 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 3931 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 3915 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 3932 | return -EINVAL; |
| 3916 | } | 3933 | } |
| 3917 | 3934 | ||
| 3918 | if (set_counts) { | 3935 | if (set_counts) { |
| @@ -4028,8 +4045,6 @@ void transport_do_task_sg_chain(struct se_cmd *cmd) | |||
| 4028 | if (!task->task_sg) | 4045 | if (!task->task_sg) |
| 4029 | continue; | 4046 | continue; |
| 4030 | 4047 | ||
| 4031 | BUG_ON(!task->task_padded_sg); | ||
| 4032 | |||
| 4033 | if (!sg_first) { | 4048 | if (!sg_first) { |
| 4034 | sg_first = task->task_sg; | 4049 | sg_first = task->task_sg; |
| 4035 | chained_nents = task->task_sg_nents; | 4050 | chained_nents = task->task_sg_nents; |
| @@ -4037,9 +4052,19 @@ void transport_do_task_sg_chain(struct se_cmd *cmd) | |||
| 4037 | sg_chain(sg_prev, sg_prev_nents, task->task_sg); | 4052 | sg_chain(sg_prev, sg_prev_nents, task->task_sg); |
| 4038 | chained_nents += task->task_sg_nents; | 4053 | chained_nents += task->task_sg_nents; |
| 4039 | } | 4054 | } |
| 4055 | /* | ||
| 4056 | * For the padded tasks, use the extra SGL vector allocated | ||
| 4057 | * in transport_allocate_data_tasks() for the sg_prev_nents | ||
| 4058 | * offset into sg_chain() above.. The last task of a | ||
| 4059 | * multi-task list, or a single task will not have | ||
| 4060 | * task->task_sg_padded set.. | ||
| 4061 | */ | ||
| 4062 | if (task->task_padded_sg) | ||
| 4063 | sg_prev_nents = (task->task_sg_nents + 1); | ||
| 4064 | else | ||
| 4065 | sg_prev_nents = task->task_sg_nents; | ||
| 4040 | 4066 | ||
| 4041 | sg_prev = task->task_sg; | 4067 | sg_prev = task->task_sg; |
| 4042 | sg_prev_nents = task->task_sg_nents; | ||
| 4043 | } | 4068 | } |
| 4044 | /* | 4069 | /* |
| 4045 | * Setup the starting pointer and total t_tasks_sg_linked_no including | 4070 | * Setup the starting pointer and total t_tasks_sg_linked_no including |
| @@ -4091,7 +4116,7 @@ static int transport_allocate_data_tasks( | |||
| 4091 | 4116 | ||
| 4092 | cmd_sg = sgl; | 4117 | cmd_sg = sgl; |
| 4093 | for (i = 0; i < task_count; i++) { | 4118 | for (i = 0; i < task_count; i++) { |
| 4094 | unsigned int task_size; | 4119 | unsigned int task_size, task_sg_nents_padded; |
| 4095 | int count; | 4120 | int count; |
| 4096 | 4121 | ||
| 4097 | task = transport_generic_get_task(cmd, data_direction); | 4122 | task = transport_generic_get_task(cmd, data_direction); |
| @@ -4110,30 +4135,33 @@ static int transport_allocate_data_tasks( | |||
| 4110 | 4135 | ||
| 4111 | /* Update new cdb with updated lba/sectors */ | 4136 | /* Update new cdb with updated lba/sectors */ |
| 4112 | cmd->transport_split_cdb(task->task_lba, task->task_sectors, cdb); | 4137 | cmd->transport_split_cdb(task->task_lba, task->task_sectors, cdb); |
| 4113 | 4138 | /* | |
| 4139 | * This now assumes that passed sg_ents are in PAGE_SIZE chunks | ||
| 4140 | * in order to calculate the number per task SGL entries | ||
| 4141 | */ | ||
| 4142 | task->task_sg_nents = DIV_ROUND_UP(task->task_size, PAGE_SIZE); | ||
| 4114 | /* | 4143 | /* |
| 4115 | * Check if the fabric module driver is requesting that all | 4144 | * Check if the fabric module driver is requesting that all |
| 4116 | * struct se_task->task_sg[] be chained together.. If so, | 4145 | * struct se_task->task_sg[] be chained together.. If so, |
| 4117 | * then allocate an extra padding SG entry for linking and | 4146 | * then allocate an extra padding SG entry for linking and |
| 4118 | * marking the end of the chained SGL. | 4147 | * marking the end of the chained SGL for every task except |
| 4119 | * Possibly over-allocate task sgl size by using cmd sgl size. | 4148 | * the last one for (task_count > 1) operation, or skipping |
| 4120 | * It's so much easier and only a waste when task_count > 1. | 4149 | * the extra padding for the (task_count == 1) case. |
| 4121 | * That is extremely rare. | ||
| 4122 | */ | 4150 | */ |
| 4123 | task->task_sg_nents = sgl_nents; | 4151 | if (cmd->se_tfo->task_sg_chaining && (i < (task_count - 1))) { |
| 4124 | if (cmd->se_tfo->task_sg_chaining) { | 4152 | task_sg_nents_padded = (task->task_sg_nents + 1); |
| 4125 | task->task_sg_nents++; | ||
| 4126 | task->task_padded_sg = 1; | 4153 | task->task_padded_sg = 1; |
| 4127 | } | 4154 | } else |
| 4155 | task_sg_nents_padded = task->task_sg_nents; | ||
| 4128 | 4156 | ||
| 4129 | task->task_sg = kmalloc(sizeof(struct scatterlist) * | 4157 | task->task_sg = kmalloc(sizeof(struct scatterlist) * |
| 4130 | task->task_sg_nents, GFP_KERNEL); | 4158 | task_sg_nents_padded, GFP_KERNEL); |
| 4131 | if (!task->task_sg) { | 4159 | if (!task->task_sg) { |
| 4132 | cmd->se_dev->transport->free_task(task); | 4160 | cmd->se_dev->transport->free_task(task); |
| 4133 | return -ENOMEM; | 4161 | return -ENOMEM; |
| 4134 | } | 4162 | } |
| 4135 | 4163 | ||
| 4136 | sg_init_table(task->task_sg, task->task_sg_nents); | 4164 | sg_init_table(task->task_sg, task_sg_nents_padded); |
| 4137 | 4165 | ||
| 4138 | task_size = task->task_size; | 4166 | task_size = task->task_size; |
| 4139 | 4167 | ||
| @@ -4230,10 +4258,13 @@ static u32 transport_allocate_tasks( | |||
| 4230 | struct scatterlist *sgl, | 4258 | struct scatterlist *sgl, |
| 4231 | unsigned int sgl_nents) | 4259 | unsigned int sgl_nents) |
| 4232 | { | 4260 | { |
| 4233 | if (cmd->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB) | 4261 | if (cmd->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB) { |
| 4262 | if (transport_cmd_get_valid_sectors(cmd) < 0) | ||
| 4263 | return -EINVAL; | ||
| 4264 | |||
| 4234 | return transport_allocate_data_tasks(cmd, lba, data_direction, | 4265 | return transport_allocate_data_tasks(cmd, lba, data_direction, |
| 4235 | sgl, sgl_nents); | 4266 | sgl, sgl_nents); |
| 4236 | else | 4267 | } else |
| 4237 | return transport_allocate_control_task(cmd); | 4268 | return transport_allocate_control_task(cmd); |
| 4238 | 4269 | ||
| 4239 | } | 4270 | } |
| @@ -4726,6 +4757,13 @@ int transport_send_check_condition_and_sense( | |||
| 4726 | */ | 4757 | */ |
| 4727 | switch (reason) { | 4758 | switch (reason) { |
| 4728 | case TCM_NON_EXISTENT_LUN: | 4759 | case TCM_NON_EXISTENT_LUN: |
| 4760 | /* CURRENT ERROR */ | ||
| 4761 | buffer[offset] = 0x70; | ||
| 4762 | /* ILLEGAL REQUEST */ | ||
| 4763 | buffer[offset+SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST; | ||
| 4764 | /* LOGICAL UNIT NOT SUPPORTED */ | ||
| 4765 | buffer[offset+SPC_ASC_KEY_OFFSET] = 0x25; | ||
| 4766 | break; | ||
| 4729 | case TCM_UNSUPPORTED_SCSI_OPCODE: | 4767 | case TCM_UNSUPPORTED_SCSI_OPCODE: |
| 4730 | case TCM_SECTOR_COUNT_TOO_MANY: | 4768 | case TCM_SECTOR_COUNT_TOO_MANY: |
| 4731 | /* CURRENT ERROR */ | 4769 | /* CURRENT ERROR */ |
diff --git a/drivers/target/tcm_fc/tfc_conf.c b/drivers/target/tcm_fc/tfc_conf.c index 8781d1e423df..b15879d43e22 100644 --- a/drivers/target/tcm_fc/tfc_conf.c +++ b/drivers/target/tcm_fc/tfc_conf.c | |||
| @@ -256,7 +256,7 @@ struct ft_node_acl *ft_acl_get(struct ft_tpg *tpg, struct fc_rport_priv *rdata) | |||
| 256 | struct se_portal_group *se_tpg = &tpg->se_tpg; | 256 | struct se_portal_group *se_tpg = &tpg->se_tpg; |
| 257 | struct se_node_acl *se_acl; | 257 | struct se_node_acl *se_acl; |
| 258 | 258 | ||
| 259 | spin_lock_bh(&se_tpg->acl_node_lock); | 259 | spin_lock_irq(&se_tpg->acl_node_lock); |
| 260 | list_for_each_entry(se_acl, &se_tpg->acl_node_list, acl_list) { | 260 | list_for_each_entry(se_acl, &se_tpg->acl_node_list, acl_list) { |
| 261 | acl = container_of(se_acl, struct ft_node_acl, se_node_acl); | 261 | acl = container_of(se_acl, struct ft_node_acl, se_node_acl); |
| 262 | pr_debug("acl %p port_name %llx\n", | 262 | pr_debug("acl %p port_name %llx\n", |
| @@ -270,7 +270,7 @@ struct ft_node_acl *ft_acl_get(struct ft_tpg *tpg, struct fc_rport_priv *rdata) | |||
| 270 | break; | 270 | break; |
| 271 | } | 271 | } |
| 272 | } | 272 | } |
| 273 | spin_unlock_bh(&se_tpg->acl_node_lock); | 273 | spin_unlock_irq(&se_tpg->acl_node_lock); |
| 274 | return found; | 274 | return found; |
| 275 | } | 275 | } |
| 276 | 276 | ||
| @@ -655,9 +655,7 @@ static void __exit ft_exit(void) | |||
| 655 | synchronize_rcu(); | 655 | synchronize_rcu(); |
| 656 | } | 656 | } |
| 657 | 657 | ||
| 658 | #ifdef MODULE | ||
| 659 | MODULE_DESCRIPTION("FC TCM fabric driver " FT_VERSION); | 658 | MODULE_DESCRIPTION("FC TCM fabric driver " FT_VERSION); |
| 660 | MODULE_LICENSE("GPL"); | 659 | MODULE_LICENSE("GPL"); |
| 661 | module_init(ft_init); | 660 | module_init(ft_init); |
| 662 | module_exit(ft_exit); | 661 | module_exit(ft_exit); |
| 663 | #endif /* MODULE */ | ||
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index 98b6e3bdb000..e809e9d4683c 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c | |||
| @@ -446,8 +446,19 @@ static inline void legacy_pty_init(void) { } | |||
| 446 | int pty_limit = NR_UNIX98_PTY_DEFAULT; | 446 | int pty_limit = NR_UNIX98_PTY_DEFAULT; |
| 447 | static int pty_limit_min; | 447 | static int pty_limit_min; |
| 448 | static int pty_limit_max = NR_UNIX98_PTY_MAX; | 448 | static int pty_limit_max = NR_UNIX98_PTY_MAX; |
| 449 | static int tty_count; | ||
| 449 | static int pty_count; | 450 | static int pty_count; |
| 450 | 451 | ||
| 452 | static inline void pty_inc_count(void) | ||
| 453 | { | ||
| 454 | pty_count = (++tty_count) / 2; | ||
| 455 | } | ||
| 456 | |||
| 457 | static inline void pty_dec_count(void) | ||
| 458 | { | ||
| 459 | pty_count = (--tty_count) / 2; | ||
| 460 | } | ||
| 461 | |||
| 451 | static struct cdev ptmx_cdev; | 462 | static struct cdev ptmx_cdev; |
| 452 | 463 | ||
| 453 | static struct ctl_table pty_table[] = { | 464 | static struct ctl_table pty_table[] = { |
| @@ -542,6 +553,7 @@ static struct tty_struct *pts_unix98_lookup(struct tty_driver *driver, | |||
| 542 | 553 | ||
| 543 | static void pty_unix98_shutdown(struct tty_struct *tty) | 554 | static void pty_unix98_shutdown(struct tty_struct *tty) |
| 544 | { | 555 | { |
| 556 | tty_driver_remove_tty(tty->driver, tty); | ||
| 545 | /* We have our own method as we don't use the tty index */ | 557 | /* We have our own method as we don't use the tty index */ |
| 546 | kfree(tty->termios); | 558 | kfree(tty->termios); |
| 547 | } | 559 | } |
| @@ -588,7 +600,8 @@ static int pty_unix98_install(struct tty_driver *driver, struct tty_struct *tty) | |||
| 588 | */ | 600 | */ |
| 589 | tty_driver_kref_get(driver); | 601 | tty_driver_kref_get(driver); |
| 590 | tty->count++; | 602 | tty->count++; |
| 591 | pty_count++; | 603 | pty_inc_count(); /* tty */ |
| 604 | pty_inc_count(); /* tty->link */ | ||
| 592 | return 0; | 605 | return 0; |
| 593 | err_free_mem: | 606 | err_free_mem: |
| 594 | deinitialize_tty_struct(o_tty); | 607 | deinitialize_tty_struct(o_tty); |
| @@ -602,7 +615,7 @@ err_free_tty: | |||
| 602 | 615 | ||
| 603 | static void pty_unix98_remove(struct tty_driver *driver, struct tty_struct *tty) | 616 | static void pty_unix98_remove(struct tty_driver *driver, struct tty_struct *tty) |
| 604 | { | 617 | { |
| 605 | pty_count--; | 618 | pty_dec_count(); |
| 606 | } | 619 | } |
| 607 | 620 | ||
| 608 | static const struct tty_operations ptm_unix98_ops = { | 621 | static const struct tty_operations ptm_unix98_ops = { |
diff --git a/drivers/tty/serial/8250.c b/drivers/tty/serial/8250.c index f2dfec82faf8..7f50999eebc2 100644 --- a/drivers/tty/serial/8250.c +++ b/drivers/tty/serial/8250.c | |||
| @@ -1819,6 +1819,8 @@ static void serial8250_backup_timeout(unsigned long data) | |||
| 1819 | unsigned int iir, ier = 0, lsr; | 1819 | unsigned int iir, ier = 0, lsr; |
| 1820 | unsigned long flags; | 1820 | unsigned long flags; |
| 1821 | 1821 | ||
| 1822 | spin_lock_irqsave(&up->port.lock, flags); | ||
| 1823 | |||
| 1822 | /* | 1824 | /* |
| 1823 | * Must disable interrupts or else we risk racing with the interrupt | 1825 | * Must disable interrupts or else we risk racing with the interrupt |
| 1824 | * based handler. | 1826 | * based handler. |
| @@ -1836,10 +1838,8 @@ static void serial8250_backup_timeout(unsigned long data) | |||
| 1836 | * the "Diva" UART used on the management processor on many HP | 1838 | * the "Diva" UART used on the management processor on many HP |
| 1837 | * ia64 and parisc boxes. | 1839 | * ia64 and parisc boxes. |
| 1838 | */ | 1840 | */ |
| 1839 | spin_lock_irqsave(&up->port.lock, flags); | ||
| 1840 | lsr = serial_in(up, UART_LSR); | 1841 | lsr = serial_in(up, UART_LSR); |
| 1841 | up->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS; | 1842 | up->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS; |
| 1842 | spin_unlock_irqrestore(&up->port.lock, flags); | ||
| 1843 | if ((iir & UART_IIR_NO_INT) && (up->ier & UART_IER_THRI) && | 1843 | if ((iir & UART_IIR_NO_INT) && (up->ier & UART_IER_THRI) && |
| 1844 | (!uart_circ_empty(&up->port.state->xmit) || up->port.x_char) && | 1844 | (!uart_circ_empty(&up->port.state->xmit) || up->port.x_char) && |
| 1845 | (lsr & UART_LSR_THRE)) { | 1845 | (lsr & UART_LSR_THRE)) { |
| @@ -1848,11 +1848,13 @@ static void serial8250_backup_timeout(unsigned long data) | |||
| 1848 | } | 1848 | } |
| 1849 | 1849 | ||
| 1850 | if (!(iir & UART_IIR_NO_INT)) | 1850 | if (!(iir & UART_IIR_NO_INT)) |
| 1851 | serial8250_handle_port(up); | 1851 | transmit_chars(up); |
| 1852 | 1852 | ||
| 1853 | if (is_real_interrupt(up->port.irq)) | 1853 | if (is_real_interrupt(up->port.irq)) |
| 1854 | serial_out(up, UART_IER, ier); | 1854 | serial_out(up, UART_IER, ier); |
| 1855 | 1855 | ||
| 1856 | spin_unlock_irqrestore(&up->port.lock, flags); | ||
| 1857 | |||
| 1856 | /* Standard timer interval plus 0.2s to keep the port running */ | 1858 | /* Standard timer interval plus 0.2s to keep the port running */ |
| 1857 | mod_timer(&up->timer, | 1859 | mod_timer(&up->timer, |
| 1858 | jiffies + uart_poll_timeout(&up->port) + HZ / 5); | 1860 | jiffies + uart_poll_timeout(&up->port) + HZ / 5); |
diff --git a/drivers/tty/serial/8250_pci.c b/drivers/tty/serial/8250_pci.c index 6b887d90a205..3abeca2a2a1b 100644 --- a/drivers/tty/serial/8250_pci.c +++ b/drivers/tty/serial/8250_pci.c | |||
| @@ -1599,11 +1599,6 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = { | |||
| 1599 | .device = 0x800D, | 1599 | .device = 0x800D, |
| 1600 | .init = pci_eg20t_init, | 1600 | .init = pci_eg20t_init, |
| 1601 | }, | 1601 | }, |
| 1602 | { | ||
| 1603 | .vendor = 0x10DB, | ||
| 1604 | .device = 0x800D, | ||
| 1605 | .init = pci_eg20t_init, | ||
| 1606 | }, | ||
| 1607 | /* | 1602 | /* |
| 1608 | * Cronyx Omega PCI (PLX-chip based) | 1603 | * Cronyx Omega PCI (PLX-chip based) |
| 1609 | */ | 1604 | */ |
| @@ -4021,7 +4016,7 @@ static struct pci_device_id serial_pci_tbl[] = { | |||
| 4021 | 0, 0, pbn_NETMOS9900_2s_115200 }, | 4016 | 0, 0, pbn_NETMOS9900_2s_115200 }, |
| 4022 | 4017 | ||
| 4023 | /* | 4018 | /* |
| 4024 | * Best Connectivity PCI Multi I/O cards | 4019 | * Best Connectivity and Rosewill PCI Multi I/O cards |
| 4025 | */ | 4020 | */ |
| 4026 | 4021 | ||
| 4027 | { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865, | 4022 | { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865, |
| @@ -4029,6 +4024,10 @@ static struct pci_device_id serial_pci_tbl[] = { | |||
| 4029 | 0, 0, pbn_b0_1_115200 }, | 4024 | 0, 0, pbn_b0_1_115200 }, |
| 4030 | 4025 | ||
| 4031 | { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865, | 4026 | { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865, |
| 4027 | 0xA000, 0x3002, | ||
| 4028 | 0, 0, pbn_b0_bt_2_115200 }, | ||
| 4029 | |||
| 4030 | { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865, | ||
| 4032 | 0xA000, 0x3004, | 4031 | 0xA000, 0x3004, |
| 4033 | 0, 0, pbn_b0_bt_4_115200 }, | 4032 | 0, 0, pbn_b0_bt_4_115200 }, |
| 4034 | /* Intel CE4100 */ | 4033 | /* Intel CE4100 */ |
diff --git a/drivers/tty/serial/8250_pnp.c b/drivers/tty/serial/8250_pnp.c index fc301f6722e1..a2f236510ff1 100644 --- a/drivers/tty/serial/8250_pnp.c +++ b/drivers/tty/serial/8250_pnp.c | |||
| @@ -109,6 +109,9 @@ static const struct pnp_device_id pnp_dev_table[] = { | |||
| 109 | /* IBM */ | 109 | /* IBM */ |
| 110 | /* IBM Thinkpad 701 Internal Modem Voice */ | 110 | /* IBM Thinkpad 701 Internal Modem Voice */ |
| 111 | { "IBM0033", 0 }, | 111 | { "IBM0033", 0 }, |
| 112 | /* Intermec */ | ||
| 113 | /* Intermec CV60 touchscreen port */ | ||
| 114 | { "PNP4972", 0 }, | ||
| 112 | /* Intertex */ | 115 | /* Intertex */ |
| 113 | /* Intertex 28k8 33k6 Voice EXT PnP */ | 116 | /* Intertex 28k8 33k6 Voice EXT PnP */ |
| 114 | { "IXDC801", 0 }, | 117 | { "IXDC801", 0 }, |
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index af9b7814965a..b922f5d2e61e 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c | |||
| @@ -1609,9 +1609,11 @@ static struct console atmel_console = { | |||
| 1609 | static int __init atmel_console_init(void) | 1609 | static int __init atmel_console_init(void) |
| 1610 | { | 1610 | { |
| 1611 | if (atmel_default_console_device) { | 1611 | if (atmel_default_console_device) { |
| 1612 | add_preferred_console(ATMEL_DEVICENAME, | 1612 | struct atmel_uart_data *pdata = |
| 1613 | atmel_default_console_device->id, NULL); | 1613 | atmel_default_console_device->dev.platform_data; |
| 1614 | atmel_init_port(&atmel_ports[atmel_default_console_device->id], | 1614 | |
| 1615 | add_preferred_console(ATMEL_DEVICENAME, pdata->num, NULL); | ||
| 1616 | atmel_init_port(&atmel_ports[pdata->num], | ||
| 1615 | atmel_default_console_device); | 1617 | atmel_default_console_device); |
| 1616 | register_console(&atmel_console); | 1618 | register_console(&atmel_console); |
| 1617 | } | 1619 | } |
diff --git a/drivers/tty/serial/crisv10.c b/drivers/tty/serial/crisv10.c index 225123b37f19..58be715913cd 100644 --- a/drivers/tty/serial/crisv10.c +++ b/drivers/tty/serial/crisv10.c | |||
| @@ -4450,7 +4450,7 @@ static int __init rs_init(void) | |||
| 4450 | 4450 | ||
| 4451 | #if defined(CONFIG_ETRAX_RS485) | 4451 | #if defined(CONFIG_ETRAX_RS485) |
| 4452 | #if defined(CONFIG_ETRAX_RS485_ON_PA) | 4452 | #if defined(CONFIG_ETRAX_RS485_ON_PA) |
| 4453 | if (cris_io_interface_allocate_pins(if_ser0, 'a', rs485_pa_bit, | 4453 | if (cris_io_interface_allocate_pins(if_serial_0, 'a', rs485_pa_bit, |
| 4454 | rs485_pa_bit)) { | 4454 | rs485_pa_bit)) { |
| 4455 | printk(KERN_CRIT "ETRAX100LX serial: Could not allocate " | 4455 | printk(KERN_CRIT "ETRAX100LX serial: Could not allocate " |
| 4456 | "RS485 pin\n"); | 4456 | "RS485 pin\n"); |
| @@ -4459,7 +4459,7 @@ static int __init rs_init(void) | |||
| 4459 | } | 4459 | } |
| 4460 | #endif | 4460 | #endif |
| 4461 | #if defined(CONFIG_ETRAX_RS485_ON_PORT_G) | 4461 | #if defined(CONFIG_ETRAX_RS485_ON_PORT_G) |
| 4462 | if (cris_io_interface_allocate_pins(if_ser0, 'g', rs485_pa_bit, | 4462 | if (cris_io_interface_allocate_pins(if_serial_0, 'g', rs485_pa_bit, |
| 4463 | rs485_port_g_bit)) { | 4463 | rs485_port_g_bit)) { |
| 4464 | printk(KERN_CRIT "ETRAX100LX serial: Could not allocate " | 4464 | printk(KERN_CRIT "ETRAX100LX serial: Could not allocate " |
| 4465 | "RS485 pin\n"); | 4465 | "RS485 pin\n"); |
diff --git a/drivers/tty/serial/max3107-aava.c b/drivers/tty/serial/max3107-aava.c index a1fe304f2f52..d73aadd7a9ad 100644 --- a/drivers/tty/serial/max3107-aava.c +++ b/drivers/tty/serial/max3107-aava.c | |||
| @@ -340,5 +340,5 @@ module_exit(max3107_exit); | |||
| 340 | 340 | ||
| 341 | MODULE_DESCRIPTION("MAX3107 driver"); | 341 | MODULE_DESCRIPTION("MAX3107 driver"); |
| 342 | MODULE_AUTHOR("Aavamobile"); | 342 | MODULE_AUTHOR("Aavamobile"); |
| 343 | MODULE_ALIAS("aava-max3107-spi"); | 343 | MODULE_ALIAS("spi:aava-max3107"); |
| 344 | MODULE_LICENSE("GPL v2"); | 344 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/tty/serial/max3107.c b/drivers/tty/serial/max3107.c index 750b4f627315..a8164601c0ea 100644 --- a/drivers/tty/serial/max3107.c +++ b/drivers/tty/serial/max3107.c | |||
| @@ -1209,5 +1209,5 @@ module_exit(max3107_exit); | |||
| 1209 | 1209 | ||
| 1210 | MODULE_DESCRIPTION("MAX3107 driver"); | 1210 | MODULE_DESCRIPTION("MAX3107 driver"); |
| 1211 | MODULE_AUTHOR("Aavamobile"); | 1211 | MODULE_AUTHOR("Aavamobile"); |
| 1212 | MODULE_ALIAS("max3107-spi"); | 1212 | MODULE_ALIAS("spi:max3107"); |
| 1213 | MODULE_LICENSE("GPL v2"); | 1213 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/tty/serial/mrst_max3110.c b/drivers/tty/serial/mrst_max3110.c index a764bf99743b..23bc743f2a22 100644 --- a/drivers/tty/serial/mrst_max3110.c +++ b/drivers/tty/serial/mrst_max3110.c | |||
| @@ -917,4 +917,4 @@ module_init(serial_m3110_init); | |||
| 917 | module_exit(serial_m3110_exit); | 917 | module_exit(serial_m3110_exit); |
| 918 | 918 | ||
| 919 | MODULE_LICENSE("GPL v2"); | 919 | MODULE_LICENSE("GPL v2"); |
| 920 | MODULE_ALIAS("max3110-uart"); | 920 | MODULE_ALIAS("spi:max3110-uart"); |
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index c37df8d0fa28..5e713d3ef1f4 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c | |||
| @@ -806,8 +806,7 @@ serial_omap_set_termios(struct uart_port *port, struct ktermios *termios, | |||
| 806 | 806 | ||
| 807 | serial_omap_set_mctrl(&up->port, up->port.mctrl); | 807 | serial_omap_set_mctrl(&up->port, up->port.mctrl); |
| 808 | /* Software Flow Control Configuration */ | 808 | /* Software Flow Control Configuration */ |
| 809 | if (termios->c_iflag & (IXON | IXOFF)) | 809 | serial_omap_configure_xonxoff(up, termios); |
| 810 | serial_omap_configure_xonxoff(up, termios); | ||
| 811 | 810 | ||
| 812 | spin_unlock_irqrestore(&up->port.lock, flags); | 811 | spin_unlock_irqrestore(&up->port.lock, flags); |
| 813 | dev_dbg(up->port.dev, "serial_omap_set_termios+%d\n", up->pdev->id); | 812 | dev_dbg(up->port.dev, "serial_omap_set_termios+%d\n", up->pdev->id); |
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index 846dfcd3ce0d..b46218d679e2 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c | |||
| @@ -598,7 +598,8 @@ static void pch_request_dma(struct uart_port *port) | |||
| 598 | dma_cap_zero(mask); | 598 | dma_cap_zero(mask); |
| 599 | dma_cap_set(DMA_SLAVE, mask); | 599 | dma_cap_set(DMA_SLAVE, mask); |
| 600 | 600 | ||
| 601 | dma_dev = pci_get_bus_and_slot(2, PCI_DEVFN(0xa, 0)); /* Get DMA's dev | 601 | dma_dev = pci_get_bus_and_slot(priv->pdev->bus->number, |
| 602 | PCI_DEVFN(0xa, 0)); /* Get DMA's dev | ||
| 602 | information */ | 603 | information */ |
| 603 | /* Set Tx DMA */ | 604 | /* Set Tx DMA */ |
| 604 | param = &priv->param_tx; | 605 | param = &priv->param_tx; |
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c index afc629423152..6edafb5ace18 100644 --- a/drivers/tty/serial/samsung.c +++ b/drivers/tty/serial/samsung.c | |||
| @@ -1225,15 +1225,19 @@ static const struct dev_pm_ops s3c24xx_serial_pm_ops = { | |||
| 1225 | .suspend = s3c24xx_serial_suspend, | 1225 | .suspend = s3c24xx_serial_suspend, |
| 1226 | .resume = s3c24xx_serial_resume, | 1226 | .resume = s3c24xx_serial_resume, |
| 1227 | }; | 1227 | }; |
| 1228 | #define SERIAL_SAMSUNG_PM_OPS (&s3c24xx_serial_pm_ops) | ||
| 1229 | |||
| 1228 | #else /* !CONFIG_PM_SLEEP */ | 1230 | #else /* !CONFIG_PM_SLEEP */ |
| 1229 | #define s3c24xx_serial_pm_ops NULL | 1231 | |
| 1232 | #define SERIAL_SAMSUNG_PM_OPS NULL | ||
| 1230 | #endif /* CONFIG_PM_SLEEP */ | 1233 | #endif /* CONFIG_PM_SLEEP */ |
| 1231 | 1234 | ||
| 1232 | int s3c24xx_serial_init(struct platform_driver *drv, | 1235 | int s3c24xx_serial_init(struct platform_driver *drv, |
| 1233 | struct s3c24xx_uart_info *info) | 1236 | struct s3c24xx_uart_info *info) |
| 1234 | { | 1237 | { |
| 1235 | dbg("s3c24xx_serial_init(%p,%p)\n", drv, info); | 1238 | dbg("s3c24xx_serial_init(%p,%p)\n", drv, info); |
| 1236 | drv->driver.pm = &s3c24xx_serial_pm_ops; | 1239 | |
| 1240 | drv->driver.pm = SERIAL_SAMSUNG_PM_OPS; | ||
| 1237 | 1241 | ||
| 1238 | return platform_driver_register(drv); | 1242 | return platform_driver_register(drv); |
| 1239 | } | 1243 | } |
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index db7912cb7ae0..a3efbea5dbba 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c | |||
| @@ -200,6 +200,11 @@ static int uart_startup(struct tty_struct *tty, struct uart_state *state, int in | |||
| 200 | clear_bit(TTY_IO_ERROR, &tty->flags); | 200 | clear_bit(TTY_IO_ERROR, &tty->flags); |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | /* | ||
| 204 | * This is to allow setserial on this port. People may want to set | ||
| 205 | * port/irq/type and then reconfigure the port properly if it failed | ||
| 206 | * now. | ||
| 207 | */ | ||
| 203 | if (retval && capable(CAP_SYS_ADMIN)) | 208 | if (retval && capable(CAP_SYS_ADMIN)) |
| 204 | retval = 0; | 209 | retval = 0; |
| 205 | 210 | ||
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 2ec57b2fb278..5ea6ec3442e6 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c | |||
| @@ -47,6 +47,7 @@ | |||
| 47 | #include <linux/ctype.h> | 47 | #include <linux/ctype.h> |
| 48 | #include <linux/err.h> | 48 | #include <linux/err.h> |
| 49 | #include <linux/dmaengine.h> | 49 | #include <linux/dmaengine.h> |
| 50 | #include <linux/dma-mapping.h> | ||
| 50 | #include <linux/scatterlist.h> | 51 | #include <linux/scatterlist.h> |
| 51 | #include <linux/slab.h> | 52 | #include <linux/slab.h> |
| 52 | 53 | ||
| @@ -95,6 +96,12 @@ struct sci_port { | |||
| 95 | #endif | 96 | #endif |
| 96 | 97 | ||
| 97 | struct notifier_block freq_transition; | 98 | struct notifier_block freq_transition; |
| 99 | |||
| 100 | #ifdef CONFIG_SERIAL_SH_SCI_CONSOLE | ||
| 101 | unsigned short saved_smr; | ||
| 102 | unsigned short saved_fcr; | ||
| 103 | unsigned char saved_brr; | ||
| 104 | #endif | ||
| 98 | }; | 105 | }; |
| 99 | 106 | ||
| 100 | /* Function prototypes */ | 107 | /* Function prototypes */ |
| @@ -1076,7 +1083,7 @@ static unsigned int sci_get_mctrl(struct uart_port *port) | |||
| 1076 | /* This routine is used for getting signals of: DTR, DCD, DSR, RI, | 1083 | /* This routine is used for getting signals of: DTR, DCD, DSR, RI, |
| 1077 | and CTS/RTS */ | 1084 | and CTS/RTS */ |
| 1078 | 1085 | ||
| 1079 | return TIOCM_DTR | TIOCM_RTS | TIOCM_DSR; | 1086 | return TIOCM_DTR | TIOCM_RTS | TIOCM_CTS | TIOCM_DSR; |
| 1080 | } | 1087 | } |
| 1081 | 1088 | ||
| 1082 | #ifdef CONFIG_SERIAL_SH_SCI_DMA | 1089 | #ifdef CONFIG_SERIAL_SH_SCI_DMA |
| @@ -1633,11 +1640,25 @@ static unsigned int sci_scbrr_calc(unsigned int algo_id, unsigned int bps, | |||
| 1633 | return ((freq + 16 * bps) / (32 * bps) - 1); | 1640 | return ((freq + 16 * bps) / (32 * bps) - 1); |
| 1634 | } | 1641 | } |
| 1635 | 1642 | ||
| 1643 | static void sci_reset(struct uart_port *port) | ||
| 1644 | { | ||
| 1645 | unsigned int status; | ||
| 1646 | |||
| 1647 | do { | ||
| 1648 | status = sci_in(port, SCxSR); | ||
| 1649 | } while (!(status & SCxSR_TEND(port))); | ||
| 1650 | |||
| 1651 | sci_out(port, SCSCR, 0x00); /* TE=0, RE=0, CKE1=0 */ | ||
| 1652 | |||
| 1653 | if (port->type != PORT_SCI) | ||
| 1654 | sci_out(port, SCFCR, SCFCR_RFRST | SCFCR_TFRST); | ||
| 1655 | } | ||
| 1656 | |||
| 1636 | static void sci_set_termios(struct uart_port *port, struct ktermios *termios, | 1657 | static void sci_set_termios(struct uart_port *port, struct ktermios *termios, |
| 1637 | struct ktermios *old) | 1658 | struct ktermios *old) |
| 1638 | { | 1659 | { |
| 1639 | struct sci_port *s = to_sci_port(port); | 1660 | struct sci_port *s = to_sci_port(port); |
| 1640 | unsigned int status, baud, smr_val, max_baud; | 1661 | unsigned int baud, smr_val, max_baud; |
| 1641 | int t = -1; | 1662 | int t = -1; |
| 1642 | u16 scfcr = 0; | 1663 | u16 scfcr = 0; |
| 1643 | 1664 | ||
| @@ -1657,14 +1678,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios, | |||
| 1657 | 1678 | ||
| 1658 | sci_port_enable(s); | 1679 | sci_port_enable(s); |
| 1659 | 1680 | ||
| 1660 | do { | 1681 | sci_reset(port); |
| 1661 | status = sci_in(port, SCxSR); | ||
| 1662 | } while (!(status & SCxSR_TEND(port))); | ||
| 1663 | |||
| 1664 | sci_out(port, SCSCR, 0x00); /* TE=0, RE=0, CKE1=0 */ | ||
| 1665 | |||
| 1666 | if (port->type != PORT_SCI) | ||
| 1667 | sci_out(port, SCFCR, scfcr | SCFCR_RFRST | SCFCR_TFRST); | ||
| 1668 | 1682 | ||
| 1669 | smr_val = sci_in(port, SCSMR) & 3; | 1683 | smr_val = sci_in(port, SCSMR) & 3; |
| 1670 | 1684 | ||
| @@ -1913,6 +1927,7 @@ static int __devinit sci_init_single(struct platform_device *dev, | |||
| 1913 | 1927 | ||
| 1914 | port->dev = &dev->dev; | 1928 | port->dev = &dev->dev; |
| 1915 | 1929 | ||
| 1930 | pm_runtime_irq_safe(&dev->dev); | ||
| 1916 | pm_runtime_enable(&dev->dev); | 1931 | pm_runtime_enable(&dev->dev); |
| 1917 | } | 1932 | } |
| 1918 | 1933 | ||
| @@ -2036,7 +2051,8 @@ static int __devinit serial_console_setup(struct console *co, char *options) | |||
| 2036 | if (options) | 2051 | if (options) |
| 2037 | uart_parse_options(options, &baud, &parity, &bits, &flow); | 2052 | uart_parse_options(options, &baud, &parity, &bits, &flow); |
| 2038 | 2053 | ||
| 2039 | /* TODO: disable clock */ | 2054 | sci_port_disable(sci_port); |
| 2055 | |||
| 2040 | return uart_set_options(port, co, baud, parity, bits, flow); | 2056 | return uart_set_options(port, co, baud, parity, bits, flow); |
| 2041 | } | 2057 | } |
| 2042 | 2058 | ||
| @@ -2079,6 +2095,36 @@ static int __devinit sci_probe_earlyprintk(struct platform_device *pdev) | |||
| 2079 | return 0; | 2095 | return 0; |
| 2080 | } | 2096 | } |
| 2081 | 2097 | ||
| 2098 | #define uart_console(port) ((port)->cons->index == (port)->line) | ||
| 2099 | |||
| 2100 | static int sci_runtime_suspend(struct device *dev) | ||
| 2101 | { | ||
| 2102 | struct sci_port *sci_port = dev_get_drvdata(dev); | ||
| 2103 | struct uart_port *port = &sci_port->port; | ||
| 2104 | |||
| 2105 | if (uart_console(port)) { | ||
| 2106 | sci_port->saved_smr = sci_in(port, SCSMR); | ||
| 2107 | sci_port->saved_brr = sci_in(port, SCBRR); | ||
| 2108 | sci_port->saved_fcr = sci_in(port, SCFCR); | ||
| 2109 | } | ||
| 2110 | return 0; | ||
| 2111 | } | ||
| 2112 | |||
| 2113 | static int sci_runtime_resume(struct device *dev) | ||
| 2114 | { | ||
| 2115 | struct sci_port *sci_port = dev_get_drvdata(dev); | ||
| 2116 | struct uart_port *port = &sci_port->port; | ||
| 2117 | |||
| 2118 | if (uart_console(port)) { | ||
| 2119 | sci_reset(port); | ||
| 2120 | sci_out(port, SCSMR, sci_port->saved_smr); | ||
| 2121 | sci_out(port, SCBRR, sci_port->saved_brr); | ||
| 2122 | sci_out(port, SCFCR, sci_port->saved_fcr); | ||
| 2123 | sci_out(port, SCSCR, sci_port->cfg->scscr); | ||
| 2124 | } | ||
| 2125 | return 0; | ||
| 2126 | } | ||
| 2127 | |||
| 2082 | #define SCI_CONSOLE (&serial_console) | 2128 | #define SCI_CONSOLE (&serial_console) |
| 2083 | 2129 | ||
| 2084 | #else | 2130 | #else |
| @@ -2088,6 +2134,8 @@ static inline int __devinit sci_probe_earlyprintk(struct platform_device *pdev) | |||
| 2088 | } | 2134 | } |
| 2089 | 2135 | ||
| 2090 | #define SCI_CONSOLE NULL | 2136 | #define SCI_CONSOLE NULL |
| 2137 | #define sci_runtime_suspend NULL | ||
| 2138 | #define sci_runtime_resume NULL | ||
| 2091 | 2139 | ||
| 2092 | #endif /* CONFIG_SERIAL_SH_SCI_CONSOLE */ | 2140 | #endif /* CONFIG_SERIAL_SH_SCI_CONSOLE */ |
| 2093 | 2141 | ||
| @@ -2203,6 +2251,8 @@ static int sci_resume(struct device *dev) | |||
| 2203 | } | 2251 | } |
| 2204 | 2252 | ||
| 2205 | static const struct dev_pm_ops sci_dev_pm_ops = { | 2253 | static const struct dev_pm_ops sci_dev_pm_ops = { |
| 2254 | .runtime_suspend = sci_runtime_suspend, | ||
| 2255 | .runtime_resume = sci_runtime_resume, | ||
| 2206 | .suspend = sci_suspend, | 2256 | .suspend = sci_suspend, |
| 2207 | .resume = sci_resume, | 2257 | .resume = sci_resume, |
| 2208 | }; | 2258 | }; |
diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c index c327218cad44..9af9f0879a24 100644 --- a/drivers/tty/serial/ucc_uart.c +++ b/drivers/tty/serial/ucc_uart.c | |||
| @@ -235,7 +235,7 @@ static inline void *qe2cpu_addr(dma_addr_t addr, struct uart_qe_port *qe_port) | |||
| 235 | return qe_port->bd_virt + (addr - qe_port->bd_dma_addr); | 235 | return qe_port->bd_virt + (addr - qe_port->bd_dma_addr); |
| 236 | 236 | ||
| 237 | /* something nasty happened */ | 237 | /* something nasty happened */ |
| 238 | printk(KERN_ERR "%s: addr=%x\n", __func__, addr); | 238 | printk(KERN_ERR "%s: addr=%llx\n", __func__, (u64)addr); |
| 239 | BUG(); | 239 | BUG(); |
| 240 | return NULL; | 240 | return NULL; |
| 241 | } | 241 | } |
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 150e4f747c7d..4f1fc81112e6 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c | |||
| @@ -1295,8 +1295,7 @@ static int tty_driver_install_tty(struct tty_driver *driver, | |||
| 1295 | * | 1295 | * |
| 1296 | * Locking: tty_mutex for now | 1296 | * Locking: tty_mutex for now |
| 1297 | */ | 1297 | */ |
| 1298 | static void tty_driver_remove_tty(struct tty_driver *driver, | 1298 | void tty_driver_remove_tty(struct tty_driver *driver, struct tty_struct *tty) |
| 1299 | struct tty_struct *tty) | ||
| 1300 | { | 1299 | { |
| 1301 | if (driver->ops->remove) | 1300 | if (driver->ops->remove) |
| 1302 | driver->ops->remove(driver, tty); | 1301 | driver->ops->remove(driver, tty); |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 8669ba3fe794..73cbbd85219f 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
| @@ -1775,6 +1775,8 @@ int usb_hcd_alloc_bandwidth(struct usb_device *udev, | |||
| 1775 | struct usb_interface *iface = usb_ifnum_to_if(udev, | 1775 | struct usb_interface *iface = usb_ifnum_to_if(udev, |
| 1776 | cur_alt->desc.bInterfaceNumber); | 1776 | cur_alt->desc.bInterfaceNumber); |
| 1777 | 1777 | ||
| 1778 | if (!iface) | ||
| 1779 | return -EINVAL; | ||
| 1778 | if (iface->resetting_device) { | 1780 | if (iface->resetting_device) { |
| 1779 | /* | 1781 | /* |
| 1780 | * The USB core just reset the device, so the xHCI host | 1782 | * The USB core just reset the device, so the xHCI host |
diff --git a/drivers/usb/gadget/f_phonet.c b/drivers/usb/gadget/f_phonet.c index 8f8d3f6cd89e..8f3eab1af885 100644 --- a/drivers/usb/gadget/f_phonet.c +++ b/drivers/usb/gadget/f_phonet.c | |||
| @@ -434,6 +434,7 @@ static int pn_set_alt(struct usb_function *f, unsigned intf, unsigned alt) | |||
| 434 | config_ep_by_speed(gadget, f, fp->out_ep)) { | 434 | config_ep_by_speed(gadget, f, fp->out_ep)) { |
| 435 | fp->in_ep->desc = NULL; | 435 | fp->in_ep->desc = NULL; |
| 436 | fp->out_ep->desc = NULL; | 436 | fp->out_ep->desc = NULL; |
| 437 | spin_unlock(&port->lock); | ||
| 437 | return -EINVAL; | 438 | return -EINVAL; |
| 438 | } | 439 | } |
| 439 | usb_ep_enable(fp->out_ep); | 440 | usb_ep_enable(fp->out_ep); |
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index e051b30c1847..4c32cb19b405 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
| @@ -343,7 +343,7 @@ static int ehci_bus_resume (struct usb_hcd *hcd) | |||
| 343 | u32 temp; | 343 | u32 temp; |
| 344 | u32 power_okay; | 344 | u32 power_okay; |
| 345 | int i; | 345 | int i; |
| 346 | u8 resume_needed = 0; | 346 | unsigned long resume_needed = 0; |
| 347 | 347 | ||
| 348 | if (time_before (jiffies, ehci->next_statechange)) | 348 | if (time_before (jiffies, ehci->next_statechange)) |
| 349 | msleep(5); | 349 | msleep(5); |
| @@ -416,7 +416,7 @@ static int ehci_bus_resume (struct usb_hcd *hcd) | |||
| 416 | if (test_bit(i, &ehci->bus_suspended) && | 416 | if (test_bit(i, &ehci->bus_suspended) && |
| 417 | (temp & PORT_SUSPEND)) { | 417 | (temp & PORT_SUSPEND)) { |
| 418 | temp |= PORT_RESUME; | 418 | temp |= PORT_RESUME; |
| 419 | resume_needed = 1; | 419 | set_bit(i, &resume_needed); |
| 420 | } | 420 | } |
| 421 | ehci_writel(ehci, temp, &ehci->regs->port_status [i]); | 421 | ehci_writel(ehci, temp, &ehci->regs->port_status [i]); |
| 422 | } | 422 | } |
| @@ -431,8 +431,7 @@ static int ehci_bus_resume (struct usb_hcd *hcd) | |||
| 431 | i = HCS_N_PORTS (ehci->hcs_params); | 431 | i = HCS_N_PORTS (ehci->hcs_params); |
| 432 | while (i--) { | 432 | while (i--) { |
| 433 | temp = ehci_readl(ehci, &ehci->regs->port_status [i]); | 433 | temp = ehci_readl(ehci, &ehci->regs->port_status [i]); |
| 434 | if (test_bit(i, &ehci->bus_suspended) && | 434 | if (test_bit(i, &resume_needed)) { |
| 435 | (temp & PORT_SUSPEND)) { | ||
| 436 | temp &= ~(PORT_RWC_BITS | PORT_RESUME); | 435 | temp &= ~(PORT_RWC_BITS | PORT_RESUME); |
| 437 | ehci_writel(ehci, temp, &ehci->regs->port_status [i]); | 436 | ehci_writel(ehci, temp, &ehci->regs->port_status [i]); |
| 438 | ehci_vdbg (ehci, "resumed port %d\n", i + 1); | 437 | ehci_vdbg (ehci, "resumed port %d\n", i + 1); |
diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c index b3958b3d3163..9e77f1c8bdbd 100644 --- a/drivers/usb/host/ehci-s5p.c +++ b/drivers/usb/host/ehci-s5p.c | |||
| @@ -86,6 +86,7 @@ static int __devinit s5p_ehci_probe(struct platform_device *pdev) | |||
| 86 | goto fail_hcd; | 86 | goto fail_hcd; |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | s5p_ehci->hcd = hcd; | ||
| 89 | s5p_ehci->clk = clk_get(&pdev->dev, "usbhost"); | 90 | s5p_ehci->clk = clk_get(&pdev->dev, "usbhost"); |
| 90 | 91 | ||
| 91 | if (IS_ERR(s5p_ehci->clk)) { | 92 | if (IS_ERR(s5p_ehci->clk)) { |
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 0be788cc2fdb..1e96d1f1fe6b 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
| @@ -463,11 +463,12 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
| 463 | && (temp & PORT_POWER)) | 463 | && (temp & PORT_POWER)) |
| 464 | status |= USB_PORT_STAT_SUSPEND; | 464 | status |= USB_PORT_STAT_SUSPEND; |
| 465 | } | 465 | } |
| 466 | if ((temp & PORT_PLS_MASK) == XDEV_RESUME) { | 466 | if ((temp & PORT_PLS_MASK) == XDEV_RESUME && |
| 467 | !DEV_SUPERSPEED(temp)) { | ||
| 467 | if ((temp & PORT_RESET) || !(temp & PORT_PE)) | 468 | if ((temp & PORT_RESET) || !(temp & PORT_PE)) |
| 468 | goto error; | 469 | goto error; |
| 469 | if (!DEV_SUPERSPEED(temp) && time_after_eq(jiffies, | 470 | if (time_after_eq(jiffies, |
| 470 | bus_state->resume_done[wIndex])) { | 471 | bus_state->resume_done[wIndex])) { |
| 471 | xhci_dbg(xhci, "Resume USB2 port %d\n", | 472 | xhci_dbg(xhci, "Resume USB2 port %d\n", |
| 472 | wIndex + 1); | 473 | wIndex + 1); |
| 473 | bus_state->resume_done[wIndex] = 0; | 474 | bus_state->resume_done[wIndex] = 0; |
| @@ -487,6 +488,14 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
| 487 | xhci_ring_device(xhci, slot_id); | 488 | xhci_ring_device(xhci, slot_id); |
| 488 | bus_state->port_c_suspend |= 1 << wIndex; | 489 | bus_state->port_c_suspend |= 1 << wIndex; |
| 489 | bus_state->suspended_ports &= ~(1 << wIndex); | 490 | bus_state->suspended_ports &= ~(1 << wIndex); |
| 491 | } else { | ||
| 492 | /* | ||
| 493 | * The resume has been signaling for less than | ||
| 494 | * 20ms. Report the port status as SUSPEND, | ||
| 495 | * let the usbcore check port status again | ||
| 496 | * and clear resume signaling later. | ||
| 497 | */ | ||
| 498 | status |= USB_PORT_STAT_SUSPEND; | ||
| 490 | } | 499 | } |
| 491 | } | 500 | } |
| 492 | if ((temp & PORT_PLS_MASK) == XDEV_U0 | 501 | if ((temp & PORT_PLS_MASK) == XDEV_U0 |
| @@ -664,7 +673,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
| 664 | xhci_dbg(xhci, "PORTSC %04x\n", temp); | 673 | xhci_dbg(xhci, "PORTSC %04x\n", temp); |
| 665 | if (temp & PORT_RESET) | 674 | if (temp & PORT_RESET) |
| 666 | goto error; | 675 | goto error; |
| 667 | if (temp & XDEV_U3) { | 676 | if ((temp & PORT_PLS_MASK) == XDEV_U3) { |
| 668 | if ((temp & PORT_PE) == 0) | 677 | if ((temp & PORT_PE) == 0) |
| 669 | goto error; | 678 | goto error; |
| 670 | 679 | ||
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 7113d16e2d3a..54139a2f06ce 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
| @@ -514,8 +514,12 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci, | |||
| 514 | (unsigned long long) addr); | 514 | (unsigned long long) addr); |
| 515 | } | 515 | } |
| 516 | 516 | ||
| 517 | /* flip_cycle means flip the cycle bit of all but the first and last TRB. | ||
| 518 | * (The last TRB actually points to the ring enqueue pointer, which is not part | ||
| 519 | * of this TD.) This is used to remove partially enqueued isoc TDs from a ring. | ||
| 520 | */ | ||
| 517 | static void td_to_noop(struct xhci_hcd *xhci, struct xhci_ring *ep_ring, | 521 | static void td_to_noop(struct xhci_hcd *xhci, struct xhci_ring *ep_ring, |
| 518 | struct xhci_td *cur_td) | 522 | struct xhci_td *cur_td, bool flip_cycle) |
| 519 | { | 523 | { |
| 520 | struct xhci_segment *cur_seg; | 524 | struct xhci_segment *cur_seg; |
| 521 | union xhci_trb *cur_trb; | 525 | union xhci_trb *cur_trb; |
| @@ -528,6 +532,12 @@ static void td_to_noop(struct xhci_hcd *xhci, struct xhci_ring *ep_ring, | |||
| 528 | * leave the pointers intact. | 532 | * leave the pointers intact. |
| 529 | */ | 533 | */ |
| 530 | cur_trb->generic.field[3] &= cpu_to_le32(~TRB_CHAIN); | 534 | cur_trb->generic.field[3] &= cpu_to_le32(~TRB_CHAIN); |
| 535 | /* Flip the cycle bit (link TRBs can't be the first | ||
| 536 | * or last TRB). | ||
| 537 | */ | ||
| 538 | if (flip_cycle) | ||
| 539 | cur_trb->generic.field[3] ^= | ||
| 540 | cpu_to_le32(TRB_CYCLE); | ||
| 531 | xhci_dbg(xhci, "Cancel (unchain) link TRB\n"); | 541 | xhci_dbg(xhci, "Cancel (unchain) link TRB\n"); |
| 532 | xhci_dbg(xhci, "Address = %p (0x%llx dma); " | 542 | xhci_dbg(xhci, "Address = %p (0x%llx dma); " |
| 533 | "in seg %p (0x%llx dma)\n", | 543 | "in seg %p (0x%llx dma)\n", |
| @@ -541,6 +551,11 @@ static void td_to_noop(struct xhci_hcd *xhci, struct xhci_ring *ep_ring, | |||
| 541 | cur_trb->generic.field[2] = 0; | 551 | cur_trb->generic.field[2] = 0; |
| 542 | /* Preserve only the cycle bit of this TRB */ | 552 | /* Preserve only the cycle bit of this TRB */ |
| 543 | cur_trb->generic.field[3] &= cpu_to_le32(TRB_CYCLE); | 553 | cur_trb->generic.field[3] &= cpu_to_le32(TRB_CYCLE); |
| 554 | /* Flip the cycle bit except on the first or last TRB */ | ||
| 555 | if (flip_cycle && cur_trb != cur_td->first_trb && | ||
| 556 | cur_trb != cur_td->last_trb) | ||
| 557 | cur_trb->generic.field[3] ^= | ||
| 558 | cpu_to_le32(TRB_CYCLE); | ||
| 544 | cur_trb->generic.field[3] |= cpu_to_le32( | 559 | cur_trb->generic.field[3] |= cpu_to_le32( |
| 545 | TRB_TYPE(TRB_TR_NOOP)); | 560 | TRB_TYPE(TRB_TR_NOOP)); |
| 546 | xhci_dbg(xhci, "Cancel TRB %p (0x%llx dma) " | 561 | xhci_dbg(xhci, "Cancel TRB %p (0x%llx dma) " |
| @@ -719,14 +734,14 @@ static void handle_stopped_endpoint(struct xhci_hcd *xhci, | |||
| 719 | cur_td->urb->stream_id, | 734 | cur_td->urb->stream_id, |
| 720 | cur_td, &deq_state); | 735 | cur_td, &deq_state); |
| 721 | else | 736 | else |
| 722 | td_to_noop(xhci, ep_ring, cur_td); | 737 | td_to_noop(xhci, ep_ring, cur_td, false); |
| 723 | remove_finished_td: | 738 | remove_finished_td: |
| 724 | /* | 739 | /* |
| 725 | * The event handler won't see a completion for this TD anymore, | 740 | * The event handler won't see a completion for this TD anymore, |
| 726 | * so remove it from the endpoint ring's TD list. Keep it in | 741 | * so remove it from the endpoint ring's TD list. Keep it in |
| 727 | * the cancelled TD list for URB completion later. | 742 | * the cancelled TD list for URB completion later. |
| 728 | */ | 743 | */ |
| 729 | list_del(&cur_td->td_list); | 744 | list_del_init(&cur_td->td_list); |
| 730 | } | 745 | } |
| 731 | last_unlinked_td = cur_td; | 746 | last_unlinked_td = cur_td; |
| 732 | xhci_stop_watchdog_timer_in_irq(xhci, ep); | 747 | xhci_stop_watchdog_timer_in_irq(xhci, ep); |
| @@ -754,7 +769,7 @@ remove_finished_td: | |||
| 754 | do { | 769 | do { |
| 755 | cur_td = list_entry(ep->cancelled_td_list.next, | 770 | cur_td = list_entry(ep->cancelled_td_list.next, |
| 756 | struct xhci_td, cancelled_td_list); | 771 | struct xhci_td, cancelled_td_list); |
| 757 | list_del(&cur_td->cancelled_td_list); | 772 | list_del_init(&cur_td->cancelled_td_list); |
| 758 | 773 | ||
| 759 | /* Clean up the cancelled URB */ | 774 | /* Clean up the cancelled URB */ |
| 760 | /* Doesn't matter what we pass for status, since the core will | 775 | /* Doesn't matter what we pass for status, since the core will |
| @@ -862,9 +877,9 @@ void xhci_stop_endpoint_command_watchdog(unsigned long arg) | |||
| 862 | cur_td = list_first_entry(&ring->td_list, | 877 | cur_td = list_first_entry(&ring->td_list, |
| 863 | struct xhci_td, | 878 | struct xhci_td, |
| 864 | td_list); | 879 | td_list); |
| 865 | list_del(&cur_td->td_list); | 880 | list_del_init(&cur_td->td_list); |
| 866 | if (!list_empty(&cur_td->cancelled_td_list)) | 881 | if (!list_empty(&cur_td->cancelled_td_list)) |
| 867 | list_del(&cur_td->cancelled_td_list); | 882 | list_del_init(&cur_td->cancelled_td_list); |
| 868 | xhci_giveback_urb_in_irq(xhci, cur_td, | 883 | xhci_giveback_urb_in_irq(xhci, cur_td, |
| 869 | -ESHUTDOWN, "killed"); | 884 | -ESHUTDOWN, "killed"); |
| 870 | } | 885 | } |
| @@ -873,7 +888,7 @@ void xhci_stop_endpoint_command_watchdog(unsigned long arg) | |||
| 873 | &temp_ep->cancelled_td_list, | 888 | &temp_ep->cancelled_td_list, |
| 874 | struct xhci_td, | 889 | struct xhci_td, |
| 875 | cancelled_td_list); | 890 | cancelled_td_list); |
| 876 | list_del(&cur_td->cancelled_td_list); | 891 | list_del_init(&cur_td->cancelled_td_list); |
| 877 | xhci_giveback_urb_in_irq(xhci, cur_td, | 892 | xhci_giveback_urb_in_irq(xhci, cur_td, |
| 878 | -ESHUTDOWN, "killed"); | 893 | -ESHUTDOWN, "killed"); |
| 879 | } | 894 | } |
| @@ -1565,10 +1580,10 @@ td_cleanup: | |||
| 1565 | else | 1580 | else |
| 1566 | *status = 0; | 1581 | *status = 0; |
| 1567 | } | 1582 | } |
| 1568 | list_del(&td->td_list); | 1583 | list_del_init(&td->td_list); |
| 1569 | /* Was this TD slated to be cancelled but completed anyway? */ | 1584 | /* Was this TD slated to be cancelled but completed anyway? */ |
| 1570 | if (!list_empty(&td->cancelled_td_list)) | 1585 | if (!list_empty(&td->cancelled_td_list)) |
| 1571 | list_del(&td->cancelled_td_list); | 1586 | list_del_init(&td->cancelled_td_list); |
| 1572 | 1587 | ||
| 1573 | urb_priv->td_cnt++; | 1588 | urb_priv->td_cnt++; |
| 1574 | /* Giveback the urb when all the tds are completed */ | 1589 | /* Giveback the urb when all the tds are completed */ |
| @@ -2500,11 +2515,8 @@ static int prepare_transfer(struct xhci_hcd *xhci, | |||
| 2500 | 2515 | ||
| 2501 | if (td_index == 0) { | 2516 | if (td_index == 0) { |
| 2502 | ret = usb_hcd_link_urb_to_ep(bus_to_hcd(urb->dev->bus), urb); | 2517 | ret = usb_hcd_link_urb_to_ep(bus_to_hcd(urb->dev->bus), urb); |
| 2503 | if (unlikely(ret)) { | 2518 | if (unlikely(ret)) |
| 2504 | xhci_urb_free_priv(xhci, urb_priv); | ||
| 2505 | urb->hcpriv = NULL; | ||
| 2506 | return ret; | 2519 | return ret; |
| 2507 | } | ||
| 2508 | } | 2520 | } |
| 2509 | 2521 | ||
| 2510 | td->urb = urb; | 2522 | td->urb = urb; |
| @@ -2672,6 +2684,10 @@ static u32 xhci_v1_0_td_remainder(int running_total, int trb_buff_len, | |||
| 2672 | { | 2684 | { |
| 2673 | int packets_transferred; | 2685 | int packets_transferred; |
| 2674 | 2686 | ||
| 2687 | /* One TRB with a zero-length data packet. */ | ||
| 2688 | if (running_total == 0 && trb_buff_len == 0) | ||
| 2689 | return 0; | ||
| 2690 | |||
| 2675 | /* All the TRB queueing functions don't count the current TRB in | 2691 | /* All the TRB queueing functions don't count the current TRB in |
| 2676 | * running_total. | 2692 | * running_total. |
| 2677 | */ | 2693 | */ |
| @@ -3113,20 +3129,15 @@ static int count_isoc_trbs_needed(struct xhci_hcd *xhci, | |||
| 3113 | struct urb *urb, int i) | 3129 | struct urb *urb, int i) |
| 3114 | { | 3130 | { |
| 3115 | int num_trbs = 0; | 3131 | int num_trbs = 0; |
| 3116 | u64 addr, td_len, running_total; | 3132 | u64 addr, td_len; |
| 3117 | 3133 | ||
| 3118 | addr = (u64) (urb->transfer_dma + urb->iso_frame_desc[i].offset); | 3134 | addr = (u64) (urb->transfer_dma + urb->iso_frame_desc[i].offset); |
| 3119 | td_len = urb->iso_frame_desc[i].length; | 3135 | td_len = urb->iso_frame_desc[i].length; |
| 3120 | 3136 | ||
| 3121 | running_total = TRB_MAX_BUFF_SIZE - (addr & (TRB_MAX_BUFF_SIZE - 1)); | 3137 | num_trbs = DIV_ROUND_UP(td_len + (addr & (TRB_MAX_BUFF_SIZE - 1)), |
| 3122 | running_total &= TRB_MAX_BUFF_SIZE - 1; | 3138 | TRB_MAX_BUFF_SIZE); |
| 3123 | if (running_total != 0) | 3139 | if (num_trbs == 0) |
| 3124 | num_trbs++; | ||
| 3125 | |||
| 3126 | while (running_total < td_len) { | ||
| 3127 | num_trbs++; | 3140 | num_trbs++; |
| 3128 | running_total += TRB_MAX_BUFF_SIZE; | ||
| 3129 | } | ||
| 3130 | 3141 | ||
| 3131 | return num_trbs; | 3142 | return num_trbs; |
| 3132 | } | 3143 | } |
| @@ -3226,6 +3237,7 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
| 3226 | start_trb = &ep_ring->enqueue->generic; | 3237 | start_trb = &ep_ring->enqueue->generic; |
| 3227 | start_cycle = ep_ring->cycle_state; | 3238 | start_cycle = ep_ring->cycle_state; |
| 3228 | 3239 | ||
| 3240 | urb_priv = urb->hcpriv; | ||
| 3229 | /* Queue the first TRB, even if it's zero-length */ | 3241 | /* Queue the first TRB, even if it's zero-length */ |
| 3230 | for (i = 0; i < num_tds; i++) { | 3242 | for (i = 0; i < num_tds; i++) { |
| 3231 | unsigned int total_packet_count; | 3243 | unsigned int total_packet_count; |
| @@ -3237,9 +3249,11 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
| 3237 | addr = start_addr + urb->iso_frame_desc[i].offset; | 3249 | addr = start_addr + urb->iso_frame_desc[i].offset; |
| 3238 | td_len = urb->iso_frame_desc[i].length; | 3250 | td_len = urb->iso_frame_desc[i].length; |
| 3239 | td_remain_len = td_len; | 3251 | td_remain_len = td_len; |
| 3240 | /* FIXME: Ignoring zero-length packets, can those happen? */ | ||
| 3241 | total_packet_count = roundup(td_len, | 3252 | total_packet_count = roundup(td_len, |
| 3242 | le16_to_cpu(urb->ep->desc.wMaxPacketSize)); | 3253 | le16_to_cpu(urb->ep->desc.wMaxPacketSize)); |
| 3254 | /* A zero-length transfer still involves at least one packet. */ | ||
| 3255 | if (total_packet_count == 0) | ||
| 3256 | total_packet_count++; | ||
| 3243 | burst_count = xhci_get_burst_count(xhci, urb->dev, urb, | 3257 | burst_count = xhci_get_burst_count(xhci, urb->dev, urb, |
| 3244 | total_packet_count); | 3258 | total_packet_count); |
| 3245 | residue = xhci_get_last_burst_packet_count(xhci, | 3259 | residue = xhci_get_last_burst_packet_count(xhci, |
| @@ -3249,12 +3263,13 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
| 3249 | 3263 | ||
| 3250 | ret = prepare_transfer(xhci, xhci->devs[slot_id], ep_index, | 3264 | ret = prepare_transfer(xhci, xhci->devs[slot_id], ep_index, |
| 3251 | urb->stream_id, trbs_per_td, urb, i, mem_flags); | 3265 | urb->stream_id, trbs_per_td, urb, i, mem_flags); |
| 3252 | if (ret < 0) | 3266 | if (ret < 0) { |
| 3253 | return ret; | 3267 | if (i == 0) |
| 3268 | return ret; | ||
| 3269 | goto cleanup; | ||
| 3270 | } | ||
| 3254 | 3271 | ||
| 3255 | urb_priv = urb->hcpriv; | ||
| 3256 | td = urb_priv->td[i]; | 3272 | td = urb_priv->td[i]; |
| 3257 | |||
| 3258 | for (j = 0; j < trbs_per_td; j++) { | 3273 | for (j = 0; j < trbs_per_td; j++) { |
| 3259 | u32 remainder = 0; | 3274 | u32 remainder = 0; |
| 3260 | field = TRB_TBC(burst_count) | TRB_TLBPC(residue); | 3275 | field = TRB_TBC(burst_count) | TRB_TLBPC(residue); |
| @@ -3344,6 +3359,27 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
| 3344 | giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, | 3359 | giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, |
| 3345 | start_cycle, start_trb); | 3360 | start_cycle, start_trb); |
| 3346 | return 0; | 3361 | return 0; |
| 3362 | cleanup: | ||
| 3363 | /* Clean up a partially enqueued isoc transfer. */ | ||
| 3364 | |||
| 3365 | for (i--; i >= 0; i--) | ||
| 3366 | list_del_init(&urb_priv->td[i]->td_list); | ||
| 3367 | |||
| 3368 | /* Use the first TD as a temporary variable to turn the TDs we've queued | ||
| 3369 | * into No-ops with a software-owned cycle bit. That way the hardware | ||
| 3370 | * won't accidentally start executing bogus TDs when we partially | ||
| 3371 | * overwrite them. td->first_trb and td->start_seg are already set. | ||
| 3372 | */ | ||
| 3373 | urb_priv->td[0]->last_trb = ep_ring->enqueue; | ||
| 3374 | /* Every TRB except the first & last will have its cycle bit flipped. */ | ||
| 3375 | td_to_noop(xhci, ep_ring, urb_priv->td[0], true); | ||
| 3376 | |||
| 3377 | /* Reset the ring enqueue back to the first TRB and its cycle bit. */ | ||
| 3378 | ep_ring->enqueue = urb_priv->td[0]->first_trb; | ||
| 3379 | ep_ring->enq_seg = urb_priv->td[0]->start_seg; | ||
| 3380 | ep_ring->cycle_state = start_cycle; | ||
| 3381 | usb_hcd_unlink_urb_from_ep(bus_to_hcd(urb->dev->bus), urb); | ||
| 3382 | return ret; | ||
| 3347 | } | 3383 | } |
| 3348 | 3384 | ||
| 3349 | /* | 3385 | /* |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 1c4432d8fc10..3a0f695138f4 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
| @@ -1085,8 +1085,11 @@ int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags) | |||
| 1085 | if (urb->dev->speed == USB_SPEED_FULL) { | 1085 | if (urb->dev->speed == USB_SPEED_FULL) { |
| 1086 | ret = xhci_check_maxpacket(xhci, slot_id, | 1086 | ret = xhci_check_maxpacket(xhci, slot_id, |
| 1087 | ep_index, urb); | 1087 | ep_index, urb); |
| 1088 | if (ret < 0) | 1088 | if (ret < 0) { |
| 1089 | xhci_urb_free_priv(xhci, urb_priv); | ||
| 1090 | urb->hcpriv = NULL; | ||
| 1089 | return ret; | 1091 | return ret; |
| 1092 | } | ||
| 1090 | } | 1093 | } |
| 1091 | 1094 | ||
| 1092 | /* We have a spinlock and interrupts disabled, so we must pass | 1095 | /* We have a spinlock and interrupts disabled, so we must pass |
| @@ -1097,6 +1100,8 @@ int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags) | |||
| 1097 | goto dying; | 1100 | goto dying; |
| 1098 | ret = xhci_queue_ctrl_tx(xhci, GFP_ATOMIC, urb, | 1101 | ret = xhci_queue_ctrl_tx(xhci, GFP_ATOMIC, urb, |
| 1099 | slot_id, ep_index); | 1102 | slot_id, ep_index); |
| 1103 | if (ret) | ||
| 1104 | goto free_priv; | ||
| 1100 | spin_unlock_irqrestore(&xhci->lock, flags); | 1105 | spin_unlock_irqrestore(&xhci->lock, flags); |
| 1101 | } else if (usb_endpoint_xfer_bulk(&urb->ep->desc)) { | 1106 | } else if (usb_endpoint_xfer_bulk(&urb->ep->desc)) { |
| 1102 | spin_lock_irqsave(&xhci->lock, flags); | 1107 | spin_lock_irqsave(&xhci->lock, flags); |
| @@ -1117,6 +1122,8 @@ int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags) | |||
| 1117 | ret = xhci_queue_bulk_tx(xhci, GFP_ATOMIC, urb, | 1122 | ret = xhci_queue_bulk_tx(xhci, GFP_ATOMIC, urb, |
| 1118 | slot_id, ep_index); | 1123 | slot_id, ep_index); |
| 1119 | } | 1124 | } |
| 1125 | if (ret) | ||
| 1126 | goto free_priv; | ||
| 1120 | spin_unlock_irqrestore(&xhci->lock, flags); | 1127 | spin_unlock_irqrestore(&xhci->lock, flags); |
| 1121 | } else if (usb_endpoint_xfer_int(&urb->ep->desc)) { | 1128 | } else if (usb_endpoint_xfer_int(&urb->ep->desc)) { |
| 1122 | spin_lock_irqsave(&xhci->lock, flags); | 1129 | spin_lock_irqsave(&xhci->lock, flags); |
| @@ -1124,6 +1131,8 @@ int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags) | |||
| 1124 | goto dying; | 1131 | goto dying; |
| 1125 | ret = xhci_queue_intr_tx(xhci, GFP_ATOMIC, urb, | 1132 | ret = xhci_queue_intr_tx(xhci, GFP_ATOMIC, urb, |
| 1126 | slot_id, ep_index); | 1133 | slot_id, ep_index); |
| 1134 | if (ret) | ||
| 1135 | goto free_priv; | ||
| 1127 | spin_unlock_irqrestore(&xhci->lock, flags); | 1136 | spin_unlock_irqrestore(&xhci->lock, flags); |
| 1128 | } else { | 1137 | } else { |
| 1129 | spin_lock_irqsave(&xhci->lock, flags); | 1138 | spin_lock_irqsave(&xhci->lock, flags); |
| @@ -1131,18 +1140,22 @@ int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags) | |||
| 1131 | goto dying; | 1140 | goto dying; |
| 1132 | ret = xhci_queue_isoc_tx_prepare(xhci, GFP_ATOMIC, urb, | 1141 | ret = xhci_queue_isoc_tx_prepare(xhci, GFP_ATOMIC, urb, |
| 1133 | slot_id, ep_index); | 1142 | slot_id, ep_index); |
| 1143 | if (ret) | ||
| 1144 | goto free_priv; | ||
| 1134 | spin_unlock_irqrestore(&xhci->lock, flags); | 1145 | spin_unlock_irqrestore(&xhci->lock, flags); |
| 1135 | } | 1146 | } |
| 1136 | exit: | 1147 | exit: |
| 1137 | return ret; | 1148 | return ret; |
| 1138 | dying: | 1149 | dying: |
| 1139 | xhci_urb_free_priv(xhci, urb_priv); | ||
| 1140 | urb->hcpriv = NULL; | ||
| 1141 | xhci_dbg(xhci, "Ep 0x%x: URB %p submitted for " | 1150 | xhci_dbg(xhci, "Ep 0x%x: URB %p submitted for " |
| 1142 | "non-responsive xHCI host.\n", | 1151 | "non-responsive xHCI host.\n", |
| 1143 | urb->ep->desc.bEndpointAddress, urb); | 1152 | urb->ep->desc.bEndpointAddress, urb); |
| 1153 | ret = -ESHUTDOWN; | ||
| 1154 | free_priv: | ||
| 1155 | xhci_urb_free_priv(xhci, urb_priv); | ||
| 1156 | urb->hcpriv = NULL; | ||
| 1144 | spin_unlock_irqrestore(&xhci->lock, flags); | 1157 | spin_unlock_irqrestore(&xhci->lock, flags); |
| 1145 | return -ESHUTDOWN; | 1158 | return ret; |
| 1146 | } | 1159 | } |
| 1147 | 1160 | ||
| 1148 | /* Get the right ring for the given URB. | 1161 | /* Get the right ring for the given URB. |
| @@ -1239,6 +1252,13 @@ int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) | |||
| 1239 | if (temp == 0xffffffff || (xhci->xhc_state & XHCI_STATE_HALTED)) { | 1252 | if (temp == 0xffffffff || (xhci->xhc_state & XHCI_STATE_HALTED)) { |
| 1240 | xhci_dbg(xhci, "HW died, freeing TD.\n"); | 1253 | xhci_dbg(xhci, "HW died, freeing TD.\n"); |
| 1241 | urb_priv = urb->hcpriv; | 1254 | urb_priv = urb->hcpriv; |
| 1255 | for (i = urb_priv->td_cnt; i < urb_priv->length; i++) { | ||
| 1256 | td = urb_priv->td[i]; | ||
| 1257 | if (!list_empty(&td->td_list)) | ||
| 1258 | list_del_init(&td->td_list); | ||
| 1259 | if (!list_empty(&td->cancelled_td_list)) | ||
| 1260 | list_del_init(&td->cancelled_td_list); | ||
| 1261 | } | ||
| 1242 | 1262 | ||
| 1243 | usb_hcd_unlink_urb_from_ep(hcd, urb); | 1263 | usb_hcd_unlink_urb_from_ep(hcd, urb); |
| 1244 | spin_unlock_irqrestore(&xhci->lock, flags); | 1264 | spin_unlock_irqrestore(&xhci->lock, flags); |
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c index ae8c39617743..5e7cfba5b079 100644 --- a/drivers/usb/musb/blackfin.c +++ b/drivers/usb/musb/blackfin.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include <linux/io.h> | 17 | #include <linux/io.h> |
| 18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
| 19 | #include <linux/dma-mapping.h> | 19 | #include <linux/dma-mapping.h> |
| 20 | #include <linux/prefetch.h> | ||
| 20 | 21 | ||
| 21 | #include <asm/cacheflush.h> | 22 | #include <asm/cacheflush.h> |
| 22 | 23 | ||
diff --git a/drivers/usb/musb/cppi_dma.c b/drivers/usb/musb/cppi_dma.c index 149f3f310a0a..318fb4e8a885 100644 --- a/drivers/usb/musb/cppi_dma.c +++ b/drivers/usb/musb/cppi_dma.c | |||
| @@ -226,8 +226,10 @@ static int cppi_controller_stop(struct dma_controller *c) | |||
| 226 | struct cppi *controller; | 226 | struct cppi *controller; |
| 227 | void __iomem *tibase; | 227 | void __iomem *tibase; |
| 228 | int i; | 228 | int i; |
| 229 | struct musb *musb; | ||
| 229 | 230 | ||
| 230 | controller = container_of(c, struct cppi, controller); | 231 | controller = container_of(c, struct cppi, controller); |
| 232 | musb = controller->musb; | ||
| 231 | 233 | ||
| 232 | tibase = controller->tibase; | 234 | tibase = controller->tibase; |
| 233 | /* DISABLE INDIVIDUAL CHANNEL Interrupts */ | 235 | /* DISABLE INDIVIDUAL CHANNEL Interrupts */ |
| @@ -289,9 +291,11 @@ cppi_channel_allocate(struct dma_controller *c, | |||
| 289 | u8 index; | 291 | u8 index; |
| 290 | struct cppi_channel *cppi_ch; | 292 | struct cppi_channel *cppi_ch; |
| 291 | void __iomem *tibase; | 293 | void __iomem *tibase; |
| 294 | struct musb *musb; | ||
| 292 | 295 | ||
| 293 | controller = container_of(c, struct cppi, controller); | 296 | controller = container_of(c, struct cppi, controller); |
| 294 | tibase = controller->tibase; | 297 | tibase = controller->tibase; |
| 298 | musb = controller->musb; | ||
| 295 | 299 | ||
| 296 | /* ep0 doesn't use DMA; remember cppi indices are 0..N-1 */ | 300 | /* ep0 doesn't use DMA; remember cppi indices are 0..N-1 */ |
| 297 | index = ep->epnum - 1; | 301 | index = ep->epnum - 1; |
| @@ -339,7 +343,8 @@ static void cppi_channel_release(struct dma_channel *channel) | |||
| 339 | c = container_of(channel, struct cppi_channel, channel); | 343 | c = container_of(channel, struct cppi_channel, channel); |
| 340 | tibase = c->controller->tibase; | 344 | tibase = c->controller->tibase; |
| 341 | if (!c->hw_ep) | 345 | if (!c->hw_ep) |
| 342 | dev_dbg(musb->controller, "releasing idle DMA channel %p\n", c); | 346 | dev_dbg(c->controller->musb->controller, |
| 347 | "releasing idle DMA channel %p\n", c); | ||
| 343 | else if (!c->transmit) | 348 | else if (!c->transmit) |
| 344 | core_rxirq_enable(tibase, c->index + 1); | 349 | core_rxirq_enable(tibase, c->index + 1); |
| 345 | 350 | ||
| @@ -357,10 +362,11 @@ cppi_dump_rx(int level, struct cppi_channel *c, const char *tag) | |||
| 357 | 362 | ||
| 358 | musb_ep_select(base, c->index + 1); | 363 | musb_ep_select(base, c->index + 1); |
| 359 | 364 | ||
| 360 | DBG(level, "RX DMA%d%s: %d left, csr %04x, " | 365 | dev_dbg(c->controller->musb->controller, |
| 361 | "%08x H%08x S%08x C%08x, " | 366 | "RX DMA%d%s: %d left, csr %04x, " |
| 362 | "B%08x L%08x %08x .. %08x" | 367 | "%08x H%08x S%08x C%08x, " |
| 363 | "\n", | 368 | "B%08x L%08x %08x .. %08x" |
| 369 | "\n", | ||
| 364 | c->index, tag, | 370 | c->index, tag, |
| 365 | musb_readl(c->controller->tibase, | 371 | musb_readl(c->controller->tibase, |
| 366 | DAVINCI_RXCPPI_BUFCNT0_REG + 4 * c->index), | 372 | DAVINCI_RXCPPI_BUFCNT0_REG + 4 * c->index), |
| @@ -387,10 +393,11 @@ cppi_dump_tx(int level, struct cppi_channel *c, const char *tag) | |||
| 387 | 393 | ||
| 388 | musb_ep_select(base, c->index + 1); | 394 | musb_ep_select(base, c->index + 1); |
| 389 | 395 | ||
| 390 | DBG(level, "TX DMA%d%s: csr %04x, " | 396 | dev_dbg(c->controller->musb->controller, |
| 391 | "H%08x S%08x C%08x %08x, " | 397 | "TX DMA%d%s: csr %04x, " |
| 392 | "F%08x L%08x .. %08x" | 398 | "H%08x S%08x C%08x %08x, " |
| 393 | "\n", | 399 | "F%08x L%08x .. %08x" |
| 400 | "\n", | ||
| 394 | c->index, tag, | 401 | c->index, tag, |
| 395 | musb_readw(c->hw_ep->regs, MUSB_TXCSR), | 402 | musb_readw(c->hw_ep->regs, MUSB_TXCSR), |
| 396 | 403 | ||
| @@ -1022,6 +1029,7 @@ static bool cppi_rx_scan(struct cppi *cppi, unsigned ch) | |||
| 1022 | int i; | 1029 | int i; |
| 1023 | dma_addr_t safe2ack; | 1030 | dma_addr_t safe2ack; |
| 1024 | void __iomem *regs = rx->hw_ep->regs; | 1031 | void __iomem *regs = rx->hw_ep->regs; |
| 1032 | struct musb *musb = cppi->musb; | ||
| 1025 | 1033 | ||
| 1026 | cppi_dump_rx(6, rx, "/K"); | 1034 | cppi_dump_rx(6, rx, "/K"); |
| 1027 | 1035 | ||
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index 668eeef601ae..b3c065ab9dbc 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h | |||
| @@ -172,7 +172,8 @@ enum musb_g_ep0_state { | |||
| 172 | #endif | 172 | #endif |
| 173 | 173 | ||
| 174 | /* TUSB mapping: "flat" plus ep0 special cases */ | 174 | /* TUSB mapping: "flat" plus ep0 special cases */ |
| 175 | #if defined(CONFIG_USB_MUSB_TUSB6010) | 175 | #if defined(CONFIG_USB_MUSB_TUSB6010) || \ |
| 176 | defined(CONFIG_USB_MUSB_TUSB6010_MODULE) | ||
| 176 | #define musb_ep_select(_mbase, _epnum) \ | 177 | #define musb_ep_select(_mbase, _epnum) \ |
| 177 | musb_writeb((_mbase), MUSB_INDEX, (_epnum)) | 178 | musb_writeb((_mbase), MUSB_INDEX, (_epnum)) |
| 178 | #define MUSB_EP_OFFSET MUSB_TUSB_OFFSET | 179 | #define MUSB_EP_OFFSET MUSB_TUSB_OFFSET |
| @@ -241,7 +242,8 @@ struct musb_hw_ep { | |||
| 241 | void __iomem *fifo; | 242 | void __iomem *fifo; |
| 242 | void __iomem *regs; | 243 | void __iomem *regs; |
| 243 | 244 | ||
| 244 | #ifdef CONFIG_USB_MUSB_TUSB6010 | 245 | #if defined(CONFIG_USB_MUSB_TUSB6010) || \ |
| 246 | defined(CONFIG_USB_MUSB_TUSB6010_MODULE) | ||
| 245 | void __iomem *conf; | 247 | void __iomem *conf; |
| 246 | #endif | 248 | #endif |
| 247 | 249 | ||
| @@ -258,7 +260,8 @@ struct musb_hw_ep { | |||
| 258 | struct dma_channel *tx_channel; | 260 | struct dma_channel *tx_channel; |
| 259 | struct dma_channel *rx_channel; | 261 | struct dma_channel *rx_channel; |
| 260 | 262 | ||
| 261 | #ifdef CONFIG_USB_MUSB_TUSB6010 | 263 | #if defined(CONFIG_USB_MUSB_TUSB6010) || \ |
| 264 | defined(CONFIG_USB_MUSB_TUSB6010_MODULE) | ||
| 262 | /* TUSB has "asynchronous" and "synchronous" dma modes */ | 265 | /* TUSB has "asynchronous" and "synchronous" dma modes */ |
| 263 | dma_addr_t fifo_async; | 266 | dma_addr_t fifo_async; |
| 264 | dma_addr_t fifo_sync; | 267 | dma_addr_t fifo_sync; |
| @@ -356,7 +359,8 @@ struct musb { | |||
| 356 | void __iomem *ctrl_base; | 359 | void __iomem *ctrl_base; |
| 357 | void __iomem *mregs; | 360 | void __iomem *mregs; |
| 358 | 361 | ||
| 359 | #ifdef CONFIG_USB_MUSB_TUSB6010 | 362 | #if defined(CONFIG_USB_MUSB_TUSB6010) || \ |
| 363 | defined(CONFIG_USB_MUSB_TUSB6010_MODULE) | ||
| 360 | dma_addr_t async; | 364 | dma_addr_t async; |
| 361 | dma_addr_t sync; | 365 | dma_addr_t sync; |
| 362 | void __iomem *sync_va; | 366 | void __iomem *sync_va; |
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 8c41a2e6ea77..e81820370d6f 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
| @@ -1856,6 +1856,7 @@ int __init musb_gadget_setup(struct musb *musb) | |||
| 1856 | 1856 | ||
| 1857 | return 0; | 1857 | return 0; |
| 1858 | err: | 1858 | err: |
| 1859 | musb->g.dev.parent = NULL; | ||
| 1859 | device_unregister(&musb->g.dev); | 1860 | device_unregister(&musb->g.dev); |
| 1860 | return status; | 1861 | return status; |
| 1861 | } | 1862 | } |
| @@ -1863,7 +1864,8 @@ err: | |||
| 1863 | void musb_gadget_cleanup(struct musb *musb) | 1864 | void musb_gadget_cleanup(struct musb *musb) |
| 1864 | { | 1865 | { |
| 1865 | usb_del_gadget_udc(&musb->g); | 1866 | usb_del_gadget_udc(&musb->g); |
| 1866 | device_unregister(&musb->g.dev); | 1867 | if (musb->g.dev.parent) |
| 1868 | device_unregister(&musb->g.dev); | ||
| 1867 | } | 1869 | } |
| 1868 | 1870 | ||
| 1869 | /* | 1871 | /* |
diff --git a/drivers/usb/musb/musb_regs.h b/drivers/usb/musb/musb_regs.h index 82410703dcd3..03f2655af290 100644 --- a/drivers/usb/musb/musb_regs.h +++ b/drivers/usb/musb/musb_regs.h | |||
| @@ -234,7 +234,8 @@ | |||
| 234 | #define MUSB_TESTMODE 0x0F /* 8 bit */ | 234 | #define MUSB_TESTMODE 0x0F /* 8 bit */ |
| 235 | 235 | ||
| 236 | /* Get offset for a given FIFO from musb->mregs */ | 236 | /* Get offset for a given FIFO from musb->mregs */ |
| 237 | #ifdef CONFIG_USB_MUSB_TUSB6010 | 237 | #if defined(CONFIG_USB_MUSB_TUSB6010) || \ |
| 238 | defined(CONFIG_USB_MUSB_TUSB6010_MODULE) | ||
| 238 | #define MUSB_FIFO_OFFSET(epnum) (0x200 + ((epnum) * 0x20)) | 239 | #define MUSB_FIFO_OFFSET(epnum) (0x200 + ((epnum) * 0x20)) |
| 239 | #else | 240 | #else |
| 240 | #define MUSB_FIFO_OFFSET(epnum) (0x20 + ((epnum) * 4)) | 241 | #define MUSB_FIFO_OFFSET(epnum) (0x20 + ((epnum) * 4)) |
| @@ -295,7 +296,8 @@ | |||
| 295 | #define MUSB_FLAT_OFFSET(_epnum, _offset) \ | 296 | #define MUSB_FLAT_OFFSET(_epnum, _offset) \ |
| 296 | (0x100 + (0x10*(_epnum)) + (_offset)) | 297 | (0x100 + (0x10*(_epnum)) + (_offset)) |
| 297 | 298 | ||
| 298 | #ifdef CONFIG_USB_MUSB_TUSB6010 | 299 | #if defined(CONFIG_USB_MUSB_TUSB6010) || \ |
| 300 | defined(CONFIG_USB_MUSB_TUSB6010_MODULE) | ||
| 299 | /* TUSB6010 EP0 configuration register is special */ | 301 | /* TUSB6010 EP0 configuration register is special */ |
| 300 | #define MUSB_TUSB_OFFSET(_epnum, _offset) \ | 302 | #define MUSB_TUSB_OFFSET(_epnum, _offset) \ |
| 301 | (0x10 + _offset) | 303 | (0x10 + _offset) |
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index 9eec41fbf3a4..ec1480191f78 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
| 19 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
| 20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
| 21 | #include <linux/prefetch.h> | ||
| 21 | #include <linux/usb.h> | 22 | #include <linux/usb.h> |
| 22 | #include <linux/irq.h> | 23 | #include <linux/irq.h> |
| 23 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
diff --git a/drivers/usb/musb/tusb6010_omap.c b/drivers/usb/musb/tusb6010_omap.c index 07c8a73dfe41..b67b4bc596c1 100644 --- a/drivers/usb/musb/tusb6010_omap.c +++ b/drivers/usb/musb/tusb6010_omap.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <plat/mux.h> | 20 | #include <plat/mux.h> |
| 21 | 21 | ||
| 22 | #include "musb_core.h" | 22 | #include "musb_core.h" |
| 23 | #include "tusb6010.h" | ||
| 23 | 24 | ||
| 24 | #define to_chdat(c) ((struct tusb_omap_dma_ch *)(c)->private_data) | 25 | #define to_chdat(c) ((struct tusb_omap_dma_ch *)(c)->private_data) |
| 25 | 26 | ||
diff --git a/drivers/usb/musb/ux500_dma.c b/drivers/usb/musb/ux500_dma.c index cecace411832..ef4333f4bbe0 100644 --- a/drivers/usb/musb/ux500_dma.c +++ b/drivers/usb/musb/ux500_dma.c | |||
| @@ -65,7 +65,8 @@ static void ux500_tx_work(struct work_struct *data) | |||
| 65 | struct musb *musb = hw_ep->musb; | 65 | struct musb *musb = hw_ep->musb; |
| 66 | unsigned long flags; | 66 | unsigned long flags; |
| 67 | 67 | ||
| 68 | DBG(4, "DMA tx transfer done on hw_ep=%d\n", hw_ep->epnum); | 68 | dev_dbg(musb->controller, "DMA tx transfer done on hw_ep=%d\n", |
| 69 | hw_ep->epnum); | ||
| 69 | 70 | ||
| 70 | spin_lock_irqsave(&musb->lock, flags); | 71 | spin_lock_irqsave(&musb->lock, flags); |
| 71 | ux500_channel->channel.actual_len = ux500_channel->cur_len; | 72 | ux500_channel->channel.actual_len = ux500_channel->cur_len; |
| @@ -84,7 +85,8 @@ static void ux500_rx_work(struct work_struct *data) | |||
| 84 | struct musb *musb = hw_ep->musb; | 85 | struct musb *musb = hw_ep->musb; |
| 85 | unsigned long flags; | 86 | unsigned long flags; |
| 86 | 87 | ||
| 87 | DBG(4, "DMA rx transfer done on hw_ep=%d\n", hw_ep->epnum); | 88 | dev_dbg(musb->controller, "DMA rx transfer done on hw_ep=%d\n", |
| 89 | hw_ep->epnum); | ||
| 88 | 90 | ||
| 89 | spin_lock_irqsave(&musb->lock, flags); | 91 | spin_lock_irqsave(&musb->lock, flags); |
| 90 | ux500_channel->channel.actual_len = ux500_channel->cur_len; | 92 | ux500_channel->channel.actual_len = ux500_channel->cur_len; |
| @@ -116,9 +118,11 @@ static bool ux500_configure_channel(struct dma_channel *channel, | |||
| 116 | enum dma_slave_buswidth addr_width; | 118 | enum dma_slave_buswidth addr_width; |
| 117 | dma_addr_t usb_fifo_addr = (MUSB_FIFO_OFFSET(hw_ep->epnum) + | 119 | dma_addr_t usb_fifo_addr = (MUSB_FIFO_OFFSET(hw_ep->epnum) + |
| 118 | ux500_channel->controller->phy_base); | 120 | ux500_channel->controller->phy_base); |
| 121 | struct musb *musb = ux500_channel->controller->private_data; | ||
| 119 | 122 | ||
| 120 | DBG(4, "packet_sz=%d, mode=%d, dma_addr=0x%x, len=%d is_tx=%d\n", | 123 | dev_dbg(musb->controller, |
| 121 | packet_sz, mode, dma_addr, len, ux500_channel->is_tx); | 124 | "packet_sz=%d, mode=%d, dma_addr=0x%x, len=%d is_tx=%d\n", |
| 125 | packet_sz, mode, dma_addr, len, ux500_channel->is_tx); | ||
| 122 | 126 | ||
| 123 | ux500_channel->cur_len = len; | 127 | ux500_channel->cur_len = len; |
| 124 | 128 | ||
| @@ -133,15 +137,13 @@ static bool ux500_configure_channel(struct dma_channel *channel, | |||
| 133 | DMA_SLAVE_BUSWIDTH_4_BYTES; | 137 | DMA_SLAVE_BUSWIDTH_4_BYTES; |
| 134 | 138 | ||
| 135 | slave_conf.direction = direction; | 139 | slave_conf.direction = direction; |
| 136 | if (direction == DMA_FROM_DEVICE) { | 140 | slave_conf.src_addr = usb_fifo_addr; |
| 137 | slave_conf.src_addr = usb_fifo_addr; | 141 | slave_conf.src_addr_width = addr_width; |
| 138 | slave_conf.src_addr_width = addr_width; | 142 | slave_conf.src_maxburst = 16; |
| 139 | slave_conf.src_maxburst = 16; | 143 | slave_conf.dst_addr = usb_fifo_addr; |
| 140 | } else { | 144 | slave_conf.dst_addr_width = addr_width; |
| 141 | slave_conf.dst_addr = usb_fifo_addr; | 145 | slave_conf.dst_maxburst = 16; |
| 142 | slave_conf.dst_addr_width = addr_width; | 146 | |
| 143 | slave_conf.dst_maxburst = 16; | ||
| 144 | } | ||
| 145 | dma_chan->device->device_control(dma_chan, DMA_SLAVE_CONFIG, | 147 | dma_chan->device->device_control(dma_chan, DMA_SLAVE_CONFIG, |
| 146 | (unsigned long) &slave_conf); | 148 | (unsigned long) &slave_conf); |
| 147 | 149 | ||
| @@ -166,6 +168,7 @@ static struct dma_channel *ux500_dma_channel_allocate(struct dma_controller *c, | |||
| 166 | struct ux500_dma_controller *controller = container_of(c, | 168 | struct ux500_dma_controller *controller = container_of(c, |
| 167 | struct ux500_dma_controller, controller); | 169 | struct ux500_dma_controller, controller); |
| 168 | struct ux500_dma_channel *ux500_channel = NULL; | 170 | struct ux500_dma_channel *ux500_channel = NULL; |
| 171 | struct musb *musb = controller->private_data; | ||
| 169 | u8 ch_num = hw_ep->epnum - 1; | 172 | u8 ch_num = hw_ep->epnum - 1; |
| 170 | u32 max_ch; | 173 | u32 max_ch; |
| 171 | 174 | ||
| @@ -192,7 +195,7 @@ static struct dma_channel *ux500_dma_channel_allocate(struct dma_controller *c, | |||
| 192 | ux500_channel->hw_ep = hw_ep; | 195 | ux500_channel->hw_ep = hw_ep; |
| 193 | ux500_channel->is_allocated = 1; | 196 | ux500_channel->is_allocated = 1; |
| 194 | 197 | ||
| 195 | DBG(7, "hw_ep=%d, is_tx=0x%x, channel=%d\n", | 198 | dev_dbg(musb->controller, "hw_ep=%d, is_tx=0x%x, channel=%d\n", |
| 196 | hw_ep->epnum, is_tx, ch_num); | 199 | hw_ep->epnum, is_tx, ch_num); |
| 197 | 200 | ||
| 198 | return &(ux500_channel->channel); | 201 | return &(ux500_channel->channel); |
| @@ -201,8 +204,9 @@ static struct dma_channel *ux500_dma_channel_allocate(struct dma_controller *c, | |||
| 201 | static void ux500_dma_channel_release(struct dma_channel *channel) | 204 | static void ux500_dma_channel_release(struct dma_channel *channel) |
| 202 | { | 205 | { |
| 203 | struct ux500_dma_channel *ux500_channel = channel->private_data; | 206 | struct ux500_dma_channel *ux500_channel = channel->private_data; |
| 207 | struct musb *musb = ux500_channel->controller->private_data; | ||
| 204 | 208 | ||
| 205 | DBG(7, "channel=%d\n", ux500_channel->ch_num); | 209 | dev_dbg(musb->controller, "channel=%d\n", ux500_channel->ch_num); |
| 206 | 210 | ||
| 207 | if (ux500_channel->is_allocated) { | 211 | if (ux500_channel->is_allocated) { |
| 208 | ux500_channel->is_allocated = 0; | 212 | ux500_channel->is_allocated = 0; |
| @@ -252,8 +256,8 @@ static int ux500_dma_channel_abort(struct dma_channel *channel) | |||
| 252 | void __iomem *epio = musb->endpoints[ux500_channel->hw_ep->epnum].regs; | 256 | void __iomem *epio = musb->endpoints[ux500_channel->hw_ep->epnum].regs; |
| 253 | u16 csr; | 257 | u16 csr; |
| 254 | 258 | ||
| 255 | DBG(4, "channel=%d, is_tx=%d\n", ux500_channel->ch_num, | 259 | dev_dbg(musb->controller, "channel=%d, is_tx=%d\n", |
| 256 | ux500_channel->is_tx); | 260 | ux500_channel->ch_num, ux500_channel->is_tx); |
| 257 | 261 | ||
| 258 | if (channel->status == MUSB_DMA_STATUS_BUSY) { | 262 | if (channel->status == MUSB_DMA_STATUS_BUSY) { |
| 259 | if (ux500_channel->is_tx) { | 263 | if (ux500_channel->is_tx) { |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 78a2cf9551cc..5fc13e717911 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
| @@ -101,6 +101,7 @@ static int ftdi_jtag_probe(struct usb_serial *serial); | |||
| 101 | static int ftdi_mtxorb_hack_setup(struct usb_serial *serial); | 101 | static int ftdi_mtxorb_hack_setup(struct usb_serial *serial); |
| 102 | static int ftdi_NDI_device_setup(struct usb_serial *serial); | 102 | static int ftdi_NDI_device_setup(struct usb_serial *serial); |
| 103 | static int ftdi_stmclite_probe(struct usb_serial *serial); | 103 | static int ftdi_stmclite_probe(struct usb_serial *serial); |
| 104 | static int ftdi_8u2232c_probe(struct usb_serial *serial); | ||
| 104 | static void ftdi_USB_UIRT_setup(struct ftdi_private *priv); | 105 | static void ftdi_USB_UIRT_setup(struct ftdi_private *priv); |
| 105 | static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv); | 106 | static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv); |
| 106 | 107 | ||
| @@ -128,6 +129,10 @@ static struct ftdi_sio_quirk ftdi_stmclite_quirk = { | |||
| 128 | .probe = ftdi_stmclite_probe, | 129 | .probe = ftdi_stmclite_probe, |
| 129 | }; | 130 | }; |
| 130 | 131 | ||
| 132 | static struct ftdi_sio_quirk ftdi_8u2232c_quirk = { | ||
| 133 | .probe = ftdi_8u2232c_probe, | ||
| 134 | }; | ||
| 135 | |||
| 131 | /* | 136 | /* |
| 132 | * The 8U232AM has the same API as the sio except for: | 137 | * The 8U232AM has the same API as the sio except for: |
| 133 | * - it can support MUCH higher baudrates; up to: | 138 | * - it can support MUCH higher baudrates; up to: |
| @@ -178,7 +183,8 @@ static struct usb_device_id id_table_combined [] = { | |||
| 178 | { USB_DEVICE(FTDI_VID, FTDI_8U232AM_PID) }, | 183 | { USB_DEVICE(FTDI_VID, FTDI_8U232AM_PID) }, |
| 179 | { USB_DEVICE(FTDI_VID, FTDI_8U232AM_ALT_PID) }, | 184 | { USB_DEVICE(FTDI_VID, FTDI_8U232AM_ALT_PID) }, |
| 180 | { USB_DEVICE(FTDI_VID, FTDI_232RL_PID) }, | 185 | { USB_DEVICE(FTDI_VID, FTDI_232RL_PID) }, |
| 181 | { USB_DEVICE(FTDI_VID, FTDI_8U2232C_PID) }, | 186 | { USB_DEVICE(FTDI_VID, FTDI_8U2232C_PID) , |
| 187 | .driver_info = (kernel_ulong_t)&ftdi_8u2232c_quirk }, | ||
| 182 | { USB_DEVICE(FTDI_VID, FTDI_4232H_PID) }, | 188 | { USB_DEVICE(FTDI_VID, FTDI_4232H_PID) }, |
| 183 | { USB_DEVICE(FTDI_VID, FTDI_232H_PID) }, | 189 | { USB_DEVICE(FTDI_VID, FTDI_232H_PID) }, |
| 184 | { USB_DEVICE(FTDI_VID, FTDI_MICRO_CHAMELEON_PID) }, | 190 | { USB_DEVICE(FTDI_VID, FTDI_MICRO_CHAMELEON_PID) }, |
| @@ -1737,6 +1743,18 @@ static int ftdi_jtag_probe(struct usb_serial *serial) | |||
| 1737 | return 0; | 1743 | return 0; |
| 1738 | } | 1744 | } |
| 1739 | 1745 | ||
| 1746 | static int ftdi_8u2232c_probe(struct usb_serial *serial) | ||
| 1747 | { | ||
| 1748 | struct usb_device *udev = serial->dev; | ||
| 1749 | |||
| 1750 | dbg("%s", __func__); | ||
| 1751 | |||
| 1752 | if (strcmp(udev->manufacturer, "CALAO Systems") == 0) | ||
| 1753 | return ftdi_jtag_probe(serial); | ||
| 1754 | |||
| 1755 | return 0; | ||
| 1756 | } | ||
| 1757 | |||
| 1740 | /* | 1758 | /* |
| 1741 | * First and second port on STMCLiteadaptors is reserved for JTAG interface | 1759 | * First and second port on STMCLiteadaptors is reserved for JTAG interface |
| 1742 | * and the forth port for pio | 1760 | * and the forth port for pio |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 815656198914..fe22e90bc879 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
| @@ -148,6 +148,8 @@ static void option_instat_callback(struct urb *urb); | |||
| 148 | #define HUAWEI_PRODUCT_K4505 0x1464 | 148 | #define HUAWEI_PRODUCT_K4505 0x1464 |
| 149 | #define HUAWEI_PRODUCT_K3765 0x1465 | 149 | #define HUAWEI_PRODUCT_K3765 0x1465 |
| 150 | #define HUAWEI_PRODUCT_E14AC 0x14AC | 150 | #define HUAWEI_PRODUCT_E14AC 0x14AC |
| 151 | #define HUAWEI_PRODUCT_K3806 0x14AE | ||
| 152 | #define HUAWEI_PRODUCT_K4605 0x14C6 | ||
| 151 | #define HUAWEI_PRODUCT_K3770 0x14C9 | 153 | #define HUAWEI_PRODUCT_K3770 0x14C9 |
| 152 | #define HUAWEI_PRODUCT_K3771 0x14CA | 154 | #define HUAWEI_PRODUCT_K3771 0x14CA |
| 153 | #define HUAWEI_PRODUCT_K4510 0x14CB | 155 | #define HUAWEI_PRODUCT_K4510 0x14CB |
| @@ -416,6 +418,56 @@ static void option_instat_callback(struct urb *urb); | |||
| 416 | #define SAMSUNG_VENDOR_ID 0x04e8 | 418 | #define SAMSUNG_VENDOR_ID 0x04e8 |
| 417 | #define SAMSUNG_PRODUCT_GT_B3730 0x6889 | 419 | #define SAMSUNG_PRODUCT_GT_B3730 0x6889 |
| 418 | 420 | ||
| 421 | /* YUGA products www.yuga-info.com*/ | ||
| 422 | #define YUGA_VENDOR_ID 0x257A | ||
| 423 | #define YUGA_PRODUCT_CEM600 0x1601 | ||
| 424 | #define YUGA_PRODUCT_CEM610 0x1602 | ||
| 425 | #define YUGA_PRODUCT_CEM500 0x1603 | ||
| 426 | #define YUGA_PRODUCT_CEM510 0x1604 | ||
| 427 | #define YUGA_PRODUCT_CEM800 0x1605 | ||
| 428 | #define YUGA_PRODUCT_CEM900 0x1606 | ||
| 429 | |||
| 430 | #define YUGA_PRODUCT_CEU818 0x1607 | ||
| 431 | #define YUGA_PRODUCT_CEU816 0x1608 | ||
| 432 | #define YUGA_PRODUCT_CEU828 0x1609 | ||
| 433 | #define YUGA_PRODUCT_CEU826 0x160A | ||
| 434 | #define YUGA_PRODUCT_CEU518 0x160B | ||
| 435 | #define YUGA_PRODUCT_CEU516 0x160C | ||
| 436 | #define YUGA_PRODUCT_CEU528 0x160D | ||
| 437 | #define YUGA_PRODUCT_CEU526 0x160F | ||
| 438 | |||
| 439 | #define YUGA_PRODUCT_CWM600 0x2601 | ||
| 440 | #define YUGA_PRODUCT_CWM610 0x2602 | ||
| 441 | #define YUGA_PRODUCT_CWM500 0x2603 | ||
| 442 | #define YUGA_PRODUCT_CWM510 0x2604 | ||
| 443 | #define YUGA_PRODUCT_CWM800 0x2605 | ||
| 444 | #define YUGA_PRODUCT_CWM900 0x2606 | ||
| 445 | |||
| 446 | #define YUGA_PRODUCT_CWU718 0x2607 | ||
| 447 | #define YUGA_PRODUCT_CWU716 0x2608 | ||
| 448 | #define YUGA_PRODUCT_CWU728 0x2609 | ||
| 449 | #define YUGA_PRODUCT_CWU726 0x260A | ||
| 450 | #define YUGA_PRODUCT_CWU518 0x260B | ||
| 451 | #define YUGA_PRODUCT_CWU516 0x260C | ||
| 452 | #define YUGA_PRODUCT_CWU528 0x260D | ||
| 453 | #define YUGA_PRODUCT_CWU526 0x260F | ||
| 454 | |||
| 455 | #define YUGA_PRODUCT_CLM600 0x2601 | ||
| 456 | #define YUGA_PRODUCT_CLM610 0x2602 | ||
| 457 | #define YUGA_PRODUCT_CLM500 0x2603 | ||
| 458 | #define YUGA_PRODUCT_CLM510 0x2604 | ||
| 459 | #define YUGA_PRODUCT_CLM800 0x2605 | ||
| 460 | #define YUGA_PRODUCT_CLM900 0x2606 | ||
| 461 | |||
| 462 | #define YUGA_PRODUCT_CLU718 0x2607 | ||
| 463 | #define YUGA_PRODUCT_CLU716 0x2608 | ||
| 464 | #define YUGA_PRODUCT_CLU728 0x2609 | ||
| 465 | #define YUGA_PRODUCT_CLU726 0x260A | ||
| 466 | #define YUGA_PRODUCT_CLU518 0x260B | ||
| 467 | #define YUGA_PRODUCT_CLU516 0x260C | ||
| 468 | #define YUGA_PRODUCT_CLU528 0x260D | ||
| 469 | #define YUGA_PRODUCT_CLU526 0x260F | ||
| 470 | |||
| 419 | /* some devices interfaces need special handling due to a number of reasons */ | 471 | /* some devices interfaces need special handling due to a number of reasons */ |
| 420 | enum option_blacklist_reason { | 472 | enum option_blacklist_reason { |
| 421 | OPTION_BLACKLIST_NONE = 0, | 473 | OPTION_BLACKLIST_NONE = 0, |
| @@ -551,6 +603,8 @@ static const struct usb_device_id option_ids[] = { | |||
| 551 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff) }, | 603 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff) }, |
| 552 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ETS1220, 0xff, 0xff, 0xff) }, | 604 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ETS1220, 0xff, 0xff, 0xff) }, |
| 553 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E14AC, 0xff, 0xff, 0xff) }, | 605 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E14AC, 0xff, 0xff, 0xff) }, |
| 606 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3806, 0xff, 0xff, 0xff) }, | ||
| 607 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4605, 0xff, 0xff, 0xff) }, | ||
| 554 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3770, 0xff, 0x02, 0x31) }, | 608 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3770, 0xff, 0x02, 0x31) }, |
| 555 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3770, 0xff, 0x02, 0x32) }, | 609 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3770, 0xff, 0x02, 0x32) }, |
| 556 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3771, 0xff, 0x02, 0x31) }, | 610 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3771, 0xff, 0x02, 0x31) }, |
| @@ -1005,6 +1059,48 @@ static const struct usb_device_id option_ids[] = { | |||
| 1005 | { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ | 1059 | { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ |
| 1006 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_MT825UP) }, /* ONDA MT825UP modem */ | 1060 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_MT825UP) }, /* ONDA MT825UP modem */ |
| 1007 | { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730 LTE USB modem.*/ | 1061 | { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730 LTE USB modem.*/ |
| 1062 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM600) }, | ||
| 1063 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM610) }, | ||
| 1064 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM500) }, | ||
| 1065 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM510) }, | ||
| 1066 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM800) }, | ||
| 1067 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM900) }, | ||
| 1068 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEU818) }, | ||
| 1069 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEU816) }, | ||
| 1070 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEU828) }, | ||
| 1071 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEU826) }, | ||
| 1072 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEU518) }, | ||
| 1073 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEU516) }, | ||
| 1074 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEU528) }, | ||
| 1075 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEU526) }, | ||
| 1076 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CWM600) }, | ||
| 1077 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CWM610) }, | ||
| 1078 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CWM500) }, | ||
| 1079 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CWM510) }, | ||
| 1080 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CWM800) }, | ||
| 1081 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CWM900) }, | ||
| 1082 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CWU718) }, | ||
| 1083 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CWU716) }, | ||
| 1084 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CWU728) }, | ||
| 1085 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CWU726) }, | ||
| 1086 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CWU518) }, | ||
| 1087 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CWU516) }, | ||
| 1088 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CWU528) }, | ||
| 1089 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CWU526) }, | ||
| 1090 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLM600) }, | ||
| 1091 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLM610) }, | ||
| 1092 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLM500) }, | ||
| 1093 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLM510) }, | ||
| 1094 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLM800) }, | ||
| 1095 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLM900) }, | ||
| 1096 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU718) }, | ||
| 1097 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU716) }, | ||
| 1098 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU728) }, | ||
| 1099 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU726) }, | ||
| 1100 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU518) }, | ||
| 1101 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU516) }, | ||
| 1102 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU528) }, | ||
| 1103 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU526) }, | ||
| 1008 | { } /* Terminating entry */ | 1104 | { } /* Terminating entry */ |
| 1009 | }; | 1105 | }; |
| 1010 | MODULE_DEVICE_TABLE(usb, option_ids); | 1106 | MODULE_DEVICE_TABLE(usb, option_ids); |
| @@ -1134,11 +1230,13 @@ static int option_probe(struct usb_serial *serial, | |||
| 1134 | serial->interface->cur_altsetting->desc.bInterfaceClass != 0xff) | 1230 | serial->interface->cur_altsetting->desc.bInterfaceClass != 0xff) |
| 1135 | return -ENODEV; | 1231 | return -ENODEV; |
| 1136 | 1232 | ||
| 1137 | /* Don't bind network interfaces on Huawei K3765 & K4505 */ | 1233 | /* Don't bind network interfaces on Huawei K3765, K4505 & K4605 */ |
| 1138 | if (serial->dev->descriptor.idVendor == HUAWEI_VENDOR_ID && | 1234 | if (serial->dev->descriptor.idVendor == HUAWEI_VENDOR_ID && |
| 1139 | (serial->dev->descriptor.idProduct == HUAWEI_PRODUCT_K3765 || | 1235 | (serial->dev->descriptor.idProduct == HUAWEI_PRODUCT_K3765 || |
| 1140 | serial->dev->descriptor.idProduct == HUAWEI_PRODUCT_K4505) && | 1236 | serial->dev->descriptor.idProduct == HUAWEI_PRODUCT_K4505 || |
| 1141 | serial->interface->cur_altsetting->desc.bInterfaceNumber == 1) | 1237 | serial->dev->descriptor.idProduct == HUAWEI_PRODUCT_K4605) && |
| 1238 | (serial->interface->cur_altsetting->desc.bInterfaceNumber == 1 || | ||
| 1239 | serial->interface->cur_altsetting->desc.bInterfaceNumber == 2)) | ||
| 1142 | return -ENODEV; | 1240 | return -ENODEV; |
| 1143 | 1241 | ||
| 1144 | /* Don't bind network interface on Samsung GT-B3730, it is handled by a separate module */ | 1242 | /* Don't bind network interface on Samsung GT-B3730, it is handled by a separate module */ |
diff --git a/drivers/video/backlight/adp8870_bl.c b/drivers/video/backlight/adp8870_bl.c index 05a8832bb3eb..d06886a2bfb5 100644 --- a/drivers/video/backlight/adp8870_bl.c +++ b/drivers/video/backlight/adp8870_bl.c | |||
| @@ -1009,4 +1009,4 @@ module_exit(adp8870_exit); | |||
| 1009 | MODULE_LICENSE("GPL v2"); | 1009 | MODULE_LICENSE("GPL v2"); |
| 1010 | MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); | 1010 | MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); |
| 1011 | MODULE_DESCRIPTION("ADP8870 Backlight driver"); | 1011 | MODULE_DESCRIPTION("ADP8870 Backlight driver"); |
| 1012 | MODULE_ALIAS("platform:adp8870-backlight"); | 1012 | MODULE_ALIAS("i2c:adp8870-backlight"); |
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index 80d292fb92d8..7363c1b169e8 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | #include <asm/backlight.h> | 19 | #include <asm/backlight.h> |
| 20 | #endif | 20 | #endif |
| 21 | 21 | ||
| 22 | static const char const *backlight_types[] = { | 22 | static const char *const backlight_types[] = { |
| 23 | [BACKLIGHT_RAW] = "raw", | 23 | [BACKLIGHT_RAW] = "raw", |
| 24 | [BACKLIGHT_PLATFORM] = "platform", | 24 | [BACKLIGHT_PLATFORM] = "platform", |
| 25 | [BACKLIGHT_FIRMWARE] = "firmware", | 25 | [BACKLIGHT_FIRMWARE] = "firmware", |
diff --git a/drivers/video/backlight/ep93xx_bl.c b/drivers/video/backlight/ep93xx_bl.c index 9f1e389d51d2..b0582917f0c8 100644 --- a/drivers/video/backlight/ep93xx_bl.c +++ b/drivers/video/backlight/ep93xx_bl.c | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | * BRIGHT, on the Cirrus EP9307, EP9312, and EP9315 processors. | 11 | * BRIGHT, on the Cirrus EP9307, EP9312, and EP9315 processors. |
| 12 | */ | 12 | */ |
| 13 | 13 | ||
| 14 | 14 | #include <linux/module.h> | |
| 15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
| 16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
| 17 | #include <linux/fb.h> | 17 | #include <linux/fb.h> |
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index b8f38ec6eb18..8b5b2a4124c7 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c | |||
| @@ -28,6 +28,8 @@ struct pwm_bl_data { | |||
| 28 | unsigned int lth_brightness; | 28 | unsigned int lth_brightness; |
| 29 | int (*notify)(struct device *, | 29 | int (*notify)(struct device *, |
| 30 | int brightness); | 30 | int brightness); |
| 31 | void (*notify_after)(struct device *, | ||
| 32 | int brightness); | ||
| 31 | int (*check_fb)(struct device *, struct fb_info *); | 33 | int (*check_fb)(struct device *, struct fb_info *); |
| 32 | }; | 34 | }; |
| 33 | 35 | ||
| @@ -55,6 +57,10 @@ static int pwm_backlight_update_status(struct backlight_device *bl) | |||
| 55 | pwm_config(pb->pwm, brightness, pb->period); | 57 | pwm_config(pb->pwm, brightness, pb->period); |
| 56 | pwm_enable(pb->pwm); | 58 | pwm_enable(pb->pwm); |
| 57 | } | 59 | } |
| 60 | |||
| 61 | if (pb->notify_after) | ||
| 62 | pb->notify_after(pb->dev, brightness); | ||
| 63 | |||
| 58 | return 0; | 64 | return 0; |
| 59 | } | 65 | } |
| 60 | 66 | ||
| @@ -105,6 +111,7 @@ static int pwm_backlight_probe(struct platform_device *pdev) | |||
| 105 | 111 | ||
| 106 | pb->period = data->pwm_period_ns; | 112 | pb->period = data->pwm_period_ns; |
| 107 | pb->notify = data->notify; | 113 | pb->notify = data->notify; |
| 114 | pb->notify_after = data->notify_after; | ||
| 108 | pb->check_fb = data->check_fb; | 115 | pb->check_fb = data->check_fb; |
| 109 | pb->lth_brightness = data->lth_brightness * | 116 | pb->lth_brightness = data->lth_brightness * |
| 110 | (data->pwm_period_ns / data->max_brightness); | 117 | (data->pwm_period_ns / data->max_brightness); |
| @@ -172,6 +179,8 @@ static int pwm_backlight_suspend(struct platform_device *pdev, | |||
| 172 | pb->notify(pb->dev, 0); | 179 | pb->notify(pb->dev, 0); |
| 173 | pwm_config(pb->pwm, 0, pb->period); | 180 | pwm_config(pb->pwm, 0, pb->period); |
| 174 | pwm_disable(pb->pwm); | 181 | pwm_disable(pb->pwm); |
| 182 | if (pb->notify_after) | ||
| 183 | pb->notify_after(pb->dev, 0); | ||
| 175 | return 0; | 184 | return 0; |
| 176 | } | 185 | } |
| 177 | 186 | ||
diff --git a/drivers/w1/masters/ds2490.c b/drivers/w1/masters/ds2490.c index 02bf7bf7160b..b5abaae38e97 100644 --- a/drivers/w1/masters/ds2490.c +++ b/drivers/w1/masters/ds2490.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * dscore.c | 2 | * dscore.c |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 4 | * Copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net> |
| 5 | * | 5 | * |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
| @@ -1024,5 +1024,5 @@ module_init(ds_init); | |||
| 1024 | module_exit(ds_fini); | 1024 | module_exit(ds_fini); |
| 1025 | 1025 | ||
| 1026 | MODULE_LICENSE("GPL"); | 1026 | MODULE_LICENSE("GPL"); |
| 1027 | MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>"); | 1027 | MODULE_AUTHOR("Evgeniy Polyakov <zbr@ioremap.net>"); |
| 1028 | MODULE_DESCRIPTION("DS2490 USB <-> W1 bus master driver (DS9490*)"); | 1028 | MODULE_DESCRIPTION("DS2490 USB <-> W1 bus master driver (DS9490*)"); |
diff --git a/drivers/w1/masters/matrox_w1.c b/drivers/w1/masters/matrox_w1.c index 334d1ccf9c92..f667c26b2195 100644 --- a/drivers/w1/masters/matrox_w1.c +++ b/drivers/w1/masters/matrox_w1.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * matrox_w1.c | 2 | * matrox_w1.c |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 4 | * Copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net> |
| 5 | * | 5 | * |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
| @@ -39,7 +39,7 @@ | |||
| 39 | #include "../w1_log.h" | 39 | #include "../w1_log.h" |
| 40 | 40 | ||
| 41 | MODULE_LICENSE("GPL"); | 41 | MODULE_LICENSE("GPL"); |
| 42 | MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>"); | 42 | MODULE_AUTHOR("Evgeniy Polyakov <zbr@ioremap.net>"); |
| 43 | MODULE_DESCRIPTION("Driver for transport(Dallas 1-wire prtocol) over VGA DDC(matrox gpio)."); | 43 | MODULE_DESCRIPTION("Driver for transport(Dallas 1-wire prtocol) over VGA DDC(matrox gpio)."); |
| 44 | 44 | ||
| 45 | static struct pci_device_id matrox_w1_tbl[] = { | 45 | static struct pci_device_id matrox_w1_tbl[] = { |
diff --git a/drivers/w1/slaves/w1_ds2408.c b/drivers/w1/slaves/w1_ds2408.c index c37781899d90..7c8cdb8aed26 100644 --- a/drivers/w1/slaves/w1_ds2408.c +++ b/drivers/w1/slaves/w1_ds2408.c | |||
| @@ -373,7 +373,7 @@ static int w1_f29_add_slave(struct w1_slave *sl) | |||
| 373 | static void w1_f29_remove_slave(struct w1_slave *sl) | 373 | static void w1_f29_remove_slave(struct w1_slave *sl) |
| 374 | { | 374 | { |
| 375 | int i; | 375 | int i; |
| 376 | for (i = NB_SYSFS_BIN_FILES; i <= 0; --i) | 376 | for (i = NB_SYSFS_BIN_FILES - 1; i >= 0; --i) |
| 377 | sysfs_remove_bin_file(&sl->dev.kobj, | 377 | sysfs_remove_bin_file(&sl->dev.kobj, |
| 378 | &(w1_f29_sysfs_bin_files[i])); | 378 | &(w1_f29_sysfs_bin_files[i])); |
| 379 | } | 379 | } |
diff --git a/drivers/w1/slaves/w1_smem.c b/drivers/w1/slaves/w1_smem.c index cc8c02e92593..84655625c870 100644 --- a/drivers/w1/slaves/w1_smem.c +++ b/drivers/w1/slaves/w1_smem.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * w1_smem.c | 2 | * w1_smem.c |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 4 | * Copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net> |
| 5 | * | 5 | * |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
| @@ -32,7 +32,7 @@ | |||
| 32 | #include "../w1_family.h" | 32 | #include "../w1_family.h" |
| 33 | 33 | ||
| 34 | MODULE_LICENSE("GPL"); | 34 | MODULE_LICENSE("GPL"); |
| 35 | MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>"); | 35 | MODULE_AUTHOR("Evgeniy Polyakov <zbr@ioremap.net>"); |
| 36 | MODULE_DESCRIPTION("Driver for 1-wire Dallas network protocol, 64bit memory family."); | 36 | MODULE_DESCRIPTION("Driver for 1-wire Dallas network protocol, 64bit memory family."); |
| 37 | 37 | ||
| 38 | static struct w1_family w1_smem_family_01 = { | 38 | static struct w1_family w1_smem_family_01 = { |
diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c index 402928b135d1..a1ef9b5b38cf 100644 --- a/drivers/w1/slaves/w1_therm.c +++ b/drivers/w1/slaves/w1_therm.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * w1_therm.c | 2 | * w1_therm.c |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 4 | * Copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net> |
| 5 | * | 5 | * |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
| @@ -34,7 +34,7 @@ | |||
| 34 | #include "../w1_family.h" | 34 | #include "../w1_family.h" |
| 35 | 35 | ||
| 36 | MODULE_LICENSE("GPL"); | 36 | MODULE_LICENSE("GPL"); |
| 37 | MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>"); | 37 | MODULE_AUTHOR("Evgeniy Polyakov <zbr@ioremap.net>"); |
| 38 | MODULE_DESCRIPTION("Driver for 1-wire Dallas network protocol, temperature family."); | 38 | MODULE_DESCRIPTION("Driver for 1-wire Dallas network protocol, temperature family."); |
| 39 | 39 | ||
| 40 | /* Allow the strong pullup to be disabled, but default to enabled. | 40 | /* Allow the strong pullup to be disabled, but default to enabled. |
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c index 6c136c19e982..c37497823851 100644 --- a/drivers/w1/w1.c +++ b/drivers/w1/w1.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * w1.c | 2 | * w1.c |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 4 | * Copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net> |
| 5 | * | 5 | * |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
| @@ -42,7 +42,7 @@ | |||
| 42 | #include "w1_netlink.h" | 42 | #include "w1_netlink.h" |
| 43 | 43 | ||
| 44 | MODULE_LICENSE("GPL"); | 44 | MODULE_LICENSE("GPL"); |
| 45 | MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>"); | 45 | MODULE_AUTHOR("Evgeniy Polyakov <zbr@ioremap.net>"); |
| 46 | MODULE_DESCRIPTION("Driver for 1-wire Dallas network protocol."); | 46 | MODULE_DESCRIPTION("Driver for 1-wire Dallas network protocol."); |
| 47 | 47 | ||
| 48 | static int w1_timeout = 10; | 48 | static int w1_timeout = 10; |
diff --git a/drivers/w1/w1.h b/drivers/w1/w1.h index 1ce23fc6186c..4d012ca3f32c 100644 --- a/drivers/w1/w1.h +++ b/drivers/w1/w1.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * w1.h | 2 | * w1.h |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 4 | * Copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net> |
| 5 | * | 5 | * |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
diff --git a/drivers/w1/w1_family.c b/drivers/w1/w1_family.c index 4a099041f28a..63359797c8b1 100644 --- a/drivers/w1/w1_family.c +++ b/drivers/w1/w1_family.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * w1_family.c | 2 | * w1_family.c |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 4 | * Copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net> |
| 5 | * | 5 | * |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
diff --git a/drivers/w1/w1_family.h b/drivers/w1/w1_family.h index 98a1ac0f4693..490cda2281bc 100644 --- a/drivers/w1/w1_family.h +++ b/drivers/w1/w1_family.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * w1_family.h | 2 | * w1_family.h |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 4 | * Copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net> |
| 5 | * | 5 | * |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c index b50be3f1073d..d220bce2cee4 100644 --- a/drivers/w1/w1_int.c +++ b/drivers/w1/w1_int.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * w1_int.c | 2 | * w1_int.c |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 4 | * Copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net> |
| 5 | * | 5 | * |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
diff --git a/drivers/w1/w1_int.h b/drivers/w1/w1_int.h index 4274082d2262..2ad7d4414bed 100644 --- a/drivers/w1/w1_int.h +++ b/drivers/w1/w1_int.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * w1_int.h | 2 | * w1_int.h |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 4 | * Copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net> |
| 5 | * | 5 | * |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
diff --git a/drivers/w1/w1_io.c b/drivers/w1/w1_io.c index 8e8b64cfafb6..765b37b62a4f 100644 --- a/drivers/w1/w1_io.c +++ b/drivers/w1/w1_io.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * w1_io.c | 2 | * w1_io.c |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 4 | * Copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net> |
| 5 | * | 5 | * |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
diff --git a/drivers/w1/w1_log.h b/drivers/w1/w1_log.h index e6ab7cf08f88..9c7bd62e6bdc 100644 --- a/drivers/w1/w1_log.h +++ b/drivers/w1/w1_log.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * w1_log.h | 2 | * w1_log.h |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 4 | * Copyright (c) 2004 Evgeniy Polyakov <zbr@ioremap.net> |
| 5 | * | 5 | * |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
diff --git a/drivers/w1/w1_netlink.c b/drivers/w1/w1_netlink.c index 55aabd927c60..40788c925d1c 100644 --- a/drivers/w1/w1_netlink.c +++ b/drivers/w1/w1_netlink.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * w1_netlink.c | 2 | * w1_netlink.c |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2003 Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 4 | * Copyright (c) 2003 Evgeniy Polyakov <zbr@ioremap.net> |
| 5 | * | 5 | * |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
diff --git a/drivers/w1/w1_netlink.h b/drivers/w1/w1_netlink.h index 27e950f935b1..b0922dc29658 100644 --- a/drivers/w1/w1_netlink.h +++ b/drivers/w1/w1_netlink.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * w1_netlink.h | 2 | * w1_netlink.h |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2003 Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 4 | * Copyright (c) 2003 Evgeniy Polyakov <zbr@ioremap.net> |
| 5 | * | 5 | * |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
