diff options
Diffstat (limited to 'drivers')
102 files changed, 732 insertions, 352 deletions
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index 2b805d7ef317..8ae05ce18500 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c | |||
@@ -586,13 +586,6 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device) | |||
586 | if (pr->flags.need_hotplug_init) | 586 | if (pr->flags.need_hotplug_init) |
587 | return 0; | 587 | return 0; |
588 | 588 | ||
589 | /* | ||
590 | * Do not start hotplugged CPUs now, but when they | ||
591 | * are onlined the first time | ||
592 | */ | ||
593 | if (pr->flags.need_hotplug_init) | ||
594 | return 0; | ||
595 | |||
596 | result = acpi_processor_start(pr); | 589 | result = acpi_processor_start(pr); |
597 | if (result) | 590 | if (result) |
598 | goto err_remove_sysfs; | 591 | goto err_remove_sysfs; |
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 3fd31dec8c9c..a6278e7e61a0 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -380,6 +380,7 @@ static int rbd_get_client(struct rbd_device *rbd_dev, const char *mon_addr, | |||
380 | rbdc = __rbd_client_find(opt); | 380 | rbdc = __rbd_client_find(opt); |
381 | if (rbdc) { | 381 | if (rbdc) { |
382 | ceph_destroy_options(opt); | 382 | ceph_destroy_options(opt); |
383 | kfree(rbd_opts); | ||
383 | 384 | ||
384 | /* using an existing client */ | 385 | /* using an existing client */ |
385 | kref_get(&rbdc->kref); | 386 | kref_get(&rbdc->kref); |
@@ -406,15 +407,15 @@ done_err: | |||
406 | 407 | ||
407 | /* | 408 | /* |
408 | * Destroy ceph client | 409 | * Destroy ceph client |
410 | * | ||
411 | * Caller must hold node_lock. | ||
409 | */ | 412 | */ |
410 | static void rbd_client_release(struct kref *kref) | 413 | static void rbd_client_release(struct kref *kref) |
411 | { | 414 | { |
412 | struct rbd_client *rbdc = container_of(kref, struct rbd_client, kref); | 415 | struct rbd_client *rbdc = container_of(kref, struct rbd_client, kref); |
413 | 416 | ||
414 | dout("rbd_release_client %p\n", rbdc); | 417 | dout("rbd_release_client %p\n", rbdc); |
415 | spin_lock(&node_lock); | ||
416 | list_del(&rbdc->node); | 418 | list_del(&rbdc->node); |
417 | spin_unlock(&node_lock); | ||
418 | 419 | ||
419 | ceph_destroy_client(rbdc->client); | 420 | ceph_destroy_client(rbdc->client); |
420 | kfree(rbdc->rbd_opts); | 421 | kfree(rbdc->rbd_opts); |
@@ -427,7 +428,9 @@ static void rbd_client_release(struct kref *kref) | |||
427 | */ | 428 | */ |
428 | static void rbd_put_client(struct rbd_device *rbd_dev) | 429 | static void rbd_put_client(struct rbd_device *rbd_dev) |
429 | { | 430 | { |
431 | spin_lock(&node_lock); | ||
430 | kref_put(&rbd_dev->rbd_client->kref, rbd_client_release); | 432 | kref_put(&rbd_dev->rbd_client->kref, rbd_client_release); |
433 | spin_unlock(&node_lock); | ||
431 | rbd_dev->rbd_client = NULL; | 434 | rbd_dev->rbd_client = NULL; |
432 | rbd_dev->client = NULL; | 435 | rbd_dev->client = NULL; |
433 | } | 436 | } |
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index 97f87b29b9f3..f4aed5fc2cb6 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c | |||
@@ -1343,7 +1343,7 @@ static int __init at_dma_probe(struct platform_device *pdev) | |||
1343 | 1343 | ||
1344 | tasklet_init(&atchan->tasklet, atc_tasklet, | 1344 | tasklet_init(&atchan->tasklet, atc_tasklet, |
1345 | (unsigned long)atchan); | 1345 | (unsigned long)atchan); |
1346 | atc_enable_irq(atchan); | 1346 | atc_enable_chan_irq(atdma, i); |
1347 | } | 1347 | } |
1348 | 1348 | ||
1349 | /* set base routines */ | 1349 | /* set base routines */ |
@@ -1410,7 +1410,7 @@ static int __exit at_dma_remove(struct platform_device *pdev) | |||
1410 | struct at_dma_chan *atchan = to_at_dma_chan(chan); | 1410 | struct at_dma_chan *atchan = to_at_dma_chan(chan); |
1411 | 1411 | ||
1412 | /* Disable interrupts */ | 1412 | /* Disable interrupts */ |
1413 | atc_disable_irq(atchan); | 1413 | atc_disable_chan_irq(atdma, chan->chan_id); |
1414 | tasklet_disable(&atchan->tasklet); | 1414 | tasklet_disable(&atchan->tasklet); |
1415 | 1415 | ||
1416 | tasklet_kill(&atchan->tasklet); | 1416 | tasklet_kill(&atchan->tasklet); |
diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h index dcaedfc181cf..a8d3277d60b5 100644 --- a/drivers/dma/at_hdmac_regs.h +++ b/drivers/dma/at_hdmac_regs.h | |||
@@ -327,28 +327,27 @@ static void atc_dump_lli(struct at_dma_chan *atchan, struct at_lli *lli) | |||
327 | } | 327 | } |
328 | 328 | ||
329 | 329 | ||
330 | static void atc_setup_irq(struct at_dma_chan *atchan, int on) | 330 | static void atc_setup_irq(struct at_dma *atdma, int chan_id, int on) |
331 | { | 331 | { |
332 | struct at_dma *atdma = to_at_dma(atchan->chan_common.device); | 332 | u32 ebci; |
333 | u32 ebci; | ||
334 | 333 | ||
335 | /* enable interrupts on buffer transfer completion & error */ | 334 | /* enable interrupts on buffer transfer completion & error */ |
336 | ebci = AT_DMA_BTC(atchan->chan_common.chan_id) | 335 | ebci = AT_DMA_BTC(chan_id) |
337 | | AT_DMA_ERR(atchan->chan_common.chan_id); | 336 | | AT_DMA_ERR(chan_id); |
338 | if (on) | 337 | if (on) |
339 | dma_writel(atdma, EBCIER, ebci); | 338 | dma_writel(atdma, EBCIER, ebci); |
340 | else | 339 | else |
341 | dma_writel(atdma, EBCIDR, ebci); | 340 | dma_writel(atdma, EBCIDR, ebci); |
342 | } | 341 | } |
343 | 342 | ||
344 | static inline void atc_enable_irq(struct at_dma_chan *atchan) | 343 | static void atc_enable_chan_irq(struct at_dma *atdma, int chan_id) |
345 | { | 344 | { |
346 | atc_setup_irq(atchan, 1); | 345 | atc_setup_irq(atdma, chan_id, 1); |
347 | } | 346 | } |
348 | 347 | ||
349 | static inline void atc_disable_irq(struct at_dma_chan *atchan) | 348 | static void atc_disable_chan_irq(struct at_dma *atdma, int chan_id) |
350 | { | 349 | { |
351 | atc_setup_irq(atchan, 0); | 350 | atc_setup_irq(atdma, chan_id, 0); |
352 | } | 351 | } |
353 | 352 | ||
354 | 353 | ||
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c index 2b8661b54eaf..24225f0fdcd8 100644 --- a/drivers/dma/dmatest.c +++ b/drivers/dma/dmatest.c | |||
@@ -599,7 +599,7 @@ static int dmatest_add_channel(struct dma_chan *chan) | |||
599 | } | 599 | } |
600 | if (dma_has_cap(DMA_PQ, dma_dev->cap_mask)) { | 600 | if (dma_has_cap(DMA_PQ, dma_dev->cap_mask)) { |
601 | cnt = dmatest_add_threads(dtc, DMA_PQ); | 601 | cnt = dmatest_add_threads(dtc, DMA_PQ); |
602 | thread_count += cnt > 0 ?: 0; | 602 | thread_count += cnt > 0 ? cnt : 0; |
603 | } | 603 | } |
604 | 604 | ||
605 | pr_info("dmatest: Started %u threads using %s\n", | 605 | pr_info("dmatest: Started %u threads using %s\n", |
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index a8af379680c1..8bc5acf36ee5 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c | |||
@@ -1102,11 +1102,13 @@ static int sdma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, | |||
1102 | case DMA_SLAVE_CONFIG: | 1102 | case DMA_SLAVE_CONFIG: |
1103 | if (dmaengine_cfg->direction == DMA_DEV_TO_MEM) { | 1103 | if (dmaengine_cfg->direction == DMA_DEV_TO_MEM) { |
1104 | sdmac->per_address = dmaengine_cfg->src_addr; | 1104 | sdmac->per_address = dmaengine_cfg->src_addr; |
1105 | sdmac->watermark_level = dmaengine_cfg->src_maxburst; | 1105 | sdmac->watermark_level = dmaengine_cfg->src_maxburst * |
1106 | dmaengine_cfg->src_addr_width; | ||
1106 | sdmac->word_size = dmaengine_cfg->src_addr_width; | 1107 | sdmac->word_size = dmaengine_cfg->src_addr_width; |
1107 | } else { | 1108 | } else { |
1108 | sdmac->per_address = dmaengine_cfg->dst_addr; | 1109 | sdmac->per_address = dmaengine_cfg->dst_addr; |
1109 | sdmac->watermark_level = dmaengine_cfg->dst_maxburst; | 1110 | sdmac->watermark_level = dmaengine_cfg->dst_maxburst * |
1111 | dmaengine_cfg->dst_addr_width; | ||
1110 | sdmac->word_size = dmaengine_cfg->dst_addr_width; | 1112 | sdmac->word_size = dmaengine_cfg->dst_addr_width; |
1111 | } | 1113 | } |
1112 | sdmac->direction = dmaengine_cfg->direction; | 1114 | sdmac->direction = dmaengine_cfg->direction; |
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c index 54043cd831c8..812fd76e9c18 100644 --- a/drivers/dma/shdma.c +++ b/drivers/dma/shdma.c | |||
@@ -1262,7 +1262,8 @@ static int __init sh_dmae_probe(struct platform_device *pdev) | |||
1262 | 1262 | ||
1263 | INIT_LIST_HEAD(&shdev->common.channels); | 1263 | INIT_LIST_HEAD(&shdev->common.channels); |
1264 | 1264 | ||
1265 | dma_cap_set(DMA_MEMCPY, shdev->common.cap_mask); | 1265 | if (!pdata->slave_only) |
1266 | dma_cap_set(DMA_MEMCPY, shdev->common.cap_mask); | ||
1266 | if (pdata->slave && pdata->slave_num) | 1267 | if (pdata->slave && pdata->slave_num) |
1267 | dma_cap_set(DMA_SLAVE, shdev->common.cap_mask); | 1268 | dma_cap_set(DMA_SLAVE, shdev->common.cap_mask); |
1268 | 1269 | ||
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 6628feaa7622..7f5f0da726da 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c | |||
@@ -263,6 +263,7 @@ static inline struct fw_ohci *fw_ohci(struct fw_card *card) | |||
263 | static char ohci_driver_name[] = KBUILD_MODNAME; | 263 | static char ohci_driver_name[] = KBUILD_MODNAME; |
264 | 264 | ||
265 | #define PCI_DEVICE_ID_AGERE_FW643 0x5901 | 265 | #define PCI_DEVICE_ID_AGERE_FW643 0x5901 |
266 | #define PCI_DEVICE_ID_CREATIVE_SB1394 0x4001 | ||
266 | #define PCI_DEVICE_ID_JMICRON_JMB38X_FW 0x2380 | 267 | #define PCI_DEVICE_ID_JMICRON_JMB38X_FW 0x2380 |
267 | #define PCI_DEVICE_ID_TI_TSB12LV22 0x8009 | 268 | #define PCI_DEVICE_ID_TI_TSB12LV22 0x8009 |
268 | #define PCI_DEVICE_ID_TI_TSB12LV26 0x8020 | 269 | #define PCI_DEVICE_ID_TI_TSB12LV26 0x8020 |
@@ -289,6 +290,9 @@ static const struct { | |||
289 | {PCI_VENDOR_ID_ATT, PCI_DEVICE_ID_AGERE_FW643, 6, | 290 | {PCI_VENDOR_ID_ATT, PCI_DEVICE_ID_AGERE_FW643, 6, |
290 | QUIRK_NO_MSI}, | 291 | QUIRK_NO_MSI}, |
291 | 292 | ||
293 | {PCI_VENDOR_ID_CREATIVE, PCI_DEVICE_ID_CREATIVE_SB1394, PCI_ANY_ID, | ||
294 | QUIRK_RESET_PACKET}, | ||
295 | |||
292 | {PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB38X_FW, PCI_ANY_ID, | 296 | {PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB38X_FW, PCI_ANY_ID, |
293 | QUIRK_NO_MSI}, | 297 | QUIRK_NO_MSI}, |
294 | 298 | ||
@@ -299,7 +303,7 @@ static const struct { | |||
299 | QUIRK_NO_MSI}, | 303 | QUIRK_NO_MSI}, |
300 | 304 | ||
301 | {PCI_VENDOR_ID_RICOH, PCI_ANY_ID, PCI_ANY_ID, | 305 | {PCI_VENDOR_ID_RICOH, PCI_ANY_ID, PCI_ANY_ID, |
302 | QUIRK_CYCLE_TIMER}, | 306 | QUIRK_CYCLE_TIMER | QUIRK_NO_MSI}, |
303 | 307 | ||
304 | {PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_TSB12LV22, PCI_ANY_ID, | 308 | {PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_TSB12LV22, PCI_ANY_ID, |
305 | QUIRK_CYCLE_TIMER | QUIRK_RESET_PACKET | QUIRK_NO_1394A}, | 309 | QUIRK_CYCLE_TIMER | QUIRK_RESET_PACKET | QUIRK_NO_1394A}, |
diff --git a/drivers/gpio/gpio-lpc32xx.c b/drivers/gpio/gpio-lpc32xx.c index 5b6948081f8f..ddfacc5ce56d 100644 --- a/drivers/gpio/gpio-lpc32xx.c +++ b/drivers/gpio/gpio-lpc32xx.c | |||
@@ -96,7 +96,7 @@ static const char *gpio_p2_names[LPC32XX_GPIO_P2_MAX] = { | |||
96 | }; | 96 | }; |
97 | 97 | ||
98 | static const char *gpio_p3_names[LPC32XX_GPIO_P3_MAX] = { | 98 | static const char *gpio_p3_names[LPC32XX_GPIO_P3_MAX] = { |
99 | "gpi000", "gpio01", "gpio02", "gpio03", | 99 | "gpio00", "gpio01", "gpio02", "gpio03", |
100 | "gpio04", "gpio05" | 100 | "gpio04", "gpio05" |
101 | }; | 101 | }; |
102 | 102 | ||
diff --git a/drivers/gpio/gpio-ml-ioh.c b/drivers/gpio/gpio-ml-ioh.c index 03d6dd5dcb77..f0febe5b8221 100644 --- a/drivers/gpio/gpio-ml-ioh.c +++ b/drivers/gpio/gpio-ml-ioh.c | |||
@@ -448,6 +448,7 @@ static int __devinit ioh_gpio_probe(struct pci_dev *pdev, | |||
448 | chip->reg = chip->base; | 448 | chip->reg = chip->base; |
449 | chip->ch = i; | 449 | chip->ch = i; |
450 | mutex_init(&chip->lock); | 450 | mutex_init(&chip->lock); |
451 | spin_lock_init(&chip->spinlock); | ||
451 | ioh_gpio_setup(chip, num_ports[i]); | 452 | ioh_gpio_setup(chip, num_ports[i]); |
452 | ret = gpiochip_add(&chip->gpio); | 453 | ret = gpiochip_add(&chip->gpio); |
453 | if (ret) { | 454 | if (ret) { |
diff --git a/drivers/gpio/gpio-pch.c b/drivers/gpio/gpio-pch.c index 68fa55e86eb1..e8729cc2ba2b 100644 --- a/drivers/gpio/gpio-pch.c +++ b/drivers/gpio/gpio-pch.c | |||
@@ -392,6 +392,7 @@ static int __devinit pch_gpio_probe(struct pci_dev *pdev, | |||
392 | chip->reg = chip->base; | 392 | chip->reg = chip->base; |
393 | pci_set_drvdata(pdev, chip); | 393 | pci_set_drvdata(pdev, chip); |
394 | mutex_init(&chip->lock); | 394 | mutex_init(&chip->lock); |
395 | spin_lock_init(&chip->spinlock); | ||
395 | pch_gpio_setup(chip); | 396 | pch_gpio_setup(chip); |
396 | ret = gpiochip_add(&chip->gpio); | 397 | ret = gpiochip_add(&chip->gpio); |
397 | if (ret) { | 398 | if (ret) { |
diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c index a7661773c052..0a79a1167a25 100644 --- a/drivers/gpio/gpio-samsung.c +++ b/drivers/gpio/gpio-samsung.c | |||
@@ -2387,27 +2387,30 @@ static struct samsung_gpio_chip exynos4_gpios_3[] = { | |||
2387 | }; | 2387 | }; |
2388 | 2388 | ||
2389 | #if defined(CONFIG_ARCH_EXYNOS4) && defined(CONFIG_OF) | 2389 | #if defined(CONFIG_ARCH_EXYNOS4) && defined(CONFIG_OF) |
2390 | static int exynos4_gpio_xlate(struct gpio_chip *gc, struct device_node *np, | 2390 | static int exynos4_gpio_xlate(struct gpio_chip *gc, |
2391 | const void *gpio_spec, u32 *flags) | 2391 | const struct of_phandle_args *gpiospec, u32 *flags) |
2392 | { | 2392 | { |
2393 | const __be32 *gpio = gpio_spec; | 2393 | unsigned int pin; |
2394 | const u32 n = be32_to_cpup(gpio); | ||
2395 | unsigned int pin = gc->base + be32_to_cpu(gpio[0]); | ||
2396 | 2394 | ||
2397 | if (WARN_ON(gc->of_gpio_n_cells < 4)) | 2395 | if (WARN_ON(gc->of_gpio_n_cells < 4)) |
2398 | return -EINVAL; | 2396 | return -EINVAL; |
2399 | 2397 | ||
2400 | if (n > gc->ngpio) | 2398 | if (WARN_ON(gpiospec->args_count < gc->of_gpio_n_cells)) |
2401 | return -EINVAL; | 2399 | return -EINVAL; |
2402 | 2400 | ||
2403 | if (s3c_gpio_cfgpin(pin, S3C_GPIO_SFN(be32_to_cpu(gpio[1])))) | 2401 | if (gpiospec->args[0] > gc->ngpio) |
2402 | return -EINVAL; | ||
2403 | |||
2404 | pin = gc->base + gpiospec->args[0]; | ||
2405 | |||
2406 | if (s3c_gpio_cfgpin(pin, S3C_GPIO_SFN(gpiospec->args[1]))) | ||
2404 | pr_warn("gpio_xlate: failed to set pin function\n"); | 2407 | pr_warn("gpio_xlate: failed to set pin function\n"); |
2405 | if (s3c_gpio_setpull(pin, be32_to_cpu(gpio[2]))) | 2408 | if (s3c_gpio_setpull(pin, gpiospec->args[2])) |
2406 | pr_warn("gpio_xlate: failed to set pin pull up/down\n"); | 2409 | pr_warn("gpio_xlate: failed to set pin pull up/down\n"); |
2407 | if (s5p_gpio_set_drvstr(pin, be32_to_cpu(gpio[3]))) | 2410 | if (s5p_gpio_set_drvstr(pin, gpiospec->args[3])) |
2408 | pr_warn("gpio_xlate: failed to set pin drive strength\n"); | 2411 | pr_warn("gpio_xlate: failed to set pin drive strength\n"); |
2409 | 2412 | ||
2410 | return n; | 2413 | return gpiospec->args[0]; |
2411 | } | 2414 | } |
2412 | 2415 | ||
2413 | static const struct of_device_id exynos4_gpio_dt_match[] __initdata = { | 2416 | static const struct of_device_id exynos4_gpio_dt_match[] __initdata = { |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.h b/drivers/gpu/drm/nouveau/nouveau_bios.h index 1e382ad5a2b8..a37c31e358aa 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.h +++ b/drivers/gpu/drm/nouveau/nouveau_bios.h | |||
@@ -54,9 +54,10 @@ struct bit_entry { | |||
54 | int bit_table(struct drm_device *, u8 id, struct bit_entry *); | 54 | int bit_table(struct drm_device *, u8 id, struct bit_entry *); |
55 | 55 | ||
56 | enum dcb_gpio_tag { | 56 | enum dcb_gpio_tag { |
57 | DCB_GPIO_TVDAC0 = 0xc, | 57 | DCB_GPIO_PANEL_POWER = 0x01, |
58 | DCB_GPIO_TVDAC0 = 0x0c, | ||
58 | DCB_GPIO_TVDAC1 = 0x2d, | 59 | DCB_GPIO_TVDAC1 = 0x2d, |
59 | DCB_GPIO_PWM_FAN = 0x9, | 60 | DCB_GPIO_PWM_FAN = 0x09, |
60 | DCB_GPIO_FAN_SENSE = 0x3d, | 61 | DCB_GPIO_FAN_SENSE = 0x3d, |
61 | DCB_GPIO_UNUSED = 0xff | 62 | DCB_GPIO_UNUSED = 0xff |
62 | }; | 63 | }; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index 3cb52bc52b21..795a9e3c990a 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c | |||
@@ -219,6 +219,16 @@ nouveau_display_init(struct drm_device *dev) | |||
219 | if (ret) | 219 | if (ret) |
220 | return ret; | 220 | return ret; |
221 | 221 | ||
222 | /* power on internal panel if it's not already. the init tables of | ||
223 | * some vbios default this to off for some reason, causing the | ||
224 | * panel to not work after resume | ||
225 | */ | ||
226 | if (nouveau_gpio_func_get(dev, DCB_GPIO_PANEL_POWER) == 0) { | ||
227 | nouveau_gpio_func_set(dev, DCB_GPIO_PANEL_POWER, true); | ||
228 | msleep(300); | ||
229 | } | ||
230 | |||
231 | /* enable polling for external displays */ | ||
222 | drm_kms_helper_poll_enable(dev); | 232 | drm_kms_helper_poll_enable(dev); |
223 | 233 | ||
224 | /* enable hotplug interrupts */ | 234 | /* enable hotplug interrupts */ |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.c b/drivers/gpu/drm/nouveau/nouveau_drv.c index e4a7cfe7898d..81d7962e7252 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.c +++ b/drivers/gpu/drm/nouveau/nouveau_drv.c | |||
@@ -124,7 +124,7 @@ MODULE_PARM_DESC(ctxfw, "Use external HUB/GPC ucode (fermi)\n"); | |||
124 | int nouveau_ctxfw; | 124 | int nouveau_ctxfw; |
125 | module_param_named(ctxfw, nouveau_ctxfw, int, 0400); | 125 | module_param_named(ctxfw, nouveau_ctxfw, int, 0400); |
126 | 126 | ||
127 | MODULE_PARM_DESC(ctxfw, "Santise DCB table according to MXM-SIS\n"); | 127 | MODULE_PARM_DESC(mxmdcb, "Santise DCB table according to MXM-SIS\n"); |
128 | int nouveau_mxmdcb = 1; | 128 | int nouveau_mxmdcb = 1; |
129 | module_param_named(mxmdcb, nouveau_mxmdcb, int, 0400); | 129 | module_param_named(mxmdcb, nouveau_mxmdcb, int, 0400); |
130 | 130 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index 5f0bc57fdaab..7ce3fde40743 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c | |||
@@ -380,6 +380,25 @@ retry: | |||
380 | } | 380 | } |
381 | 381 | ||
382 | static int | 382 | static int |
383 | validate_sync(struct nouveau_channel *chan, struct nouveau_bo *nvbo) | ||
384 | { | ||
385 | struct nouveau_fence *fence = NULL; | ||
386 | int ret = 0; | ||
387 | |||
388 | spin_lock(&nvbo->bo.bdev->fence_lock); | ||
389 | if (nvbo->bo.sync_obj) | ||
390 | fence = nouveau_fence_ref(nvbo->bo.sync_obj); | ||
391 | spin_unlock(&nvbo->bo.bdev->fence_lock); | ||
392 | |||
393 | if (fence) { | ||
394 | ret = nouveau_fence_sync(fence, chan); | ||
395 | nouveau_fence_unref(&fence); | ||
396 | } | ||
397 | |||
398 | return ret; | ||
399 | } | ||
400 | |||
401 | static int | ||
383 | validate_list(struct nouveau_channel *chan, struct list_head *list, | 402 | validate_list(struct nouveau_channel *chan, struct list_head *list, |
384 | struct drm_nouveau_gem_pushbuf_bo *pbbo, uint64_t user_pbbo_ptr) | 403 | struct drm_nouveau_gem_pushbuf_bo *pbbo, uint64_t user_pbbo_ptr) |
385 | { | 404 | { |
@@ -393,7 +412,7 @@ validate_list(struct nouveau_channel *chan, struct list_head *list, | |||
393 | list_for_each_entry(nvbo, list, entry) { | 412 | list_for_each_entry(nvbo, list, entry) { |
394 | struct drm_nouveau_gem_pushbuf_bo *b = &pbbo[nvbo->pbbo_index]; | 413 | struct drm_nouveau_gem_pushbuf_bo *b = &pbbo[nvbo->pbbo_index]; |
395 | 414 | ||
396 | ret = nouveau_fence_sync(nvbo->bo.sync_obj, chan); | 415 | ret = validate_sync(chan, nvbo); |
397 | if (unlikely(ret)) { | 416 | if (unlikely(ret)) { |
398 | NV_ERROR(dev, "fail pre-validate sync\n"); | 417 | NV_ERROR(dev, "fail pre-validate sync\n"); |
399 | return ret; | 418 | return ret; |
@@ -416,7 +435,7 @@ validate_list(struct nouveau_channel *chan, struct list_head *list, | |||
416 | return ret; | 435 | return ret; |
417 | } | 436 | } |
418 | 437 | ||
419 | ret = nouveau_fence_sync(nvbo->bo.sync_obj, chan); | 438 | ret = validate_sync(chan, nvbo); |
420 | if (unlikely(ret)) { | 439 | if (unlikely(ret)) { |
421 | NV_ERROR(dev, "fail post-validate sync\n"); | 440 | NV_ERROR(dev, "fail post-validate sync\n"); |
422 | return ret; | 441 | return ret; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_mxm.c b/drivers/gpu/drm/nouveau/nouveau_mxm.c index 8bccddf4eff0..e5a64f0f4cb7 100644 --- a/drivers/gpu/drm/nouveau/nouveau_mxm.c +++ b/drivers/gpu/drm/nouveau/nouveau_mxm.c | |||
@@ -656,7 +656,16 @@ nouveau_mxm_init(struct drm_device *dev) | |||
656 | 656 | ||
657 | if (mxm_shadow(dev, mxm[0])) { | 657 | if (mxm_shadow(dev, mxm[0])) { |
658 | MXM_MSG(dev, "failed to locate valid SIS\n"); | 658 | MXM_MSG(dev, "failed to locate valid SIS\n"); |
659 | #if 0 | ||
660 | /* we should, perhaps, fall back to some kind of limited | ||
661 | * mode here if the x86 vbios hasn't already done the | ||
662 | * work for us (so we prevent loading with completely | ||
663 | * whacked vbios tables). | ||
664 | */ | ||
659 | return -EINVAL; | 665 | return -EINVAL; |
666 | #else | ||
667 | return 0; | ||
668 | #endif | ||
660 | } | 669 | } |
661 | 670 | ||
662 | MXM_MSG(dev, "MXMS Version %d.%d\n", | 671 | MXM_MSG(dev, "MXMS Version %d.%d\n", |
diff --git a/drivers/gpu/drm/nouveau/nv50_pm.c b/drivers/gpu/drm/nouveau/nv50_pm.c index 03937212e9d8..ec5481dfcd82 100644 --- a/drivers/gpu/drm/nouveau/nv50_pm.c +++ b/drivers/gpu/drm/nouveau/nv50_pm.c | |||
@@ -495,9 +495,9 @@ nv50_pm_clocks_pre(struct drm_device *dev, struct nouveau_pm_level *perflvl) | |||
495 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 495 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
496 | struct nv50_pm_state *info; | 496 | struct nv50_pm_state *info; |
497 | struct pll_lims pll; | 497 | struct pll_lims pll; |
498 | int ret = -EINVAL; | 498 | int clk, ret = -EINVAL; |
499 | int N, M, P1, P2; | 499 | int N, M, P1, P2; |
500 | u32 clk, out; | 500 | u32 out; |
501 | 501 | ||
502 | if (dev_priv->chipset == 0xaa || | 502 | if (dev_priv->chipset == 0xaa || |
503 | dev_priv->chipset == 0xac) | 503 | dev_priv->chipset == 0xac) |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index 891935271d34..742f17f009a9 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -1184,7 +1184,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, | |||
1184 | WREG32(EVERGREEN_GRPH_ENABLE + radeon_crtc->crtc_offset, 1); | 1184 | WREG32(EVERGREEN_GRPH_ENABLE + radeon_crtc->crtc_offset, 1); |
1185 | 1185 | ||
1186 | WREG32(EVERGREEN_DESKTOP_HEIGHT + radeon_crtc->crtc_offset, | 1186 | WREG32(EVERGREEN_DESKTOP_HEIGHT + radeon_crtc->crtc_offset, |
1187 | crtc->mode.vdisplay); | 1187 | target_fb->height); |
1188 | x &= ~3; | 1188 | x &= ~3; |
1189 | y &= ~1; | 1189 | y &= ~1; |
1190 | WREG32(EVERGREEN_VIEWPORT_START + radeon_crtc->crtc_offset, | 1190 | WREG32(EVERGREEN_VIEWPORT_START + radeon_crtc->crtc_offset, |
@@ -1353,7 +1353,7 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
1353 | WREG32(AVIVO_D1GRPH_ENABLE + radeon_crtc->crtc_offset, 1); | 1353 | WREG32(AVIVO_D1GRPH_ENABLE + radeon_crtc->crtc_offset, 1); |
1354 | 1354 | ||
1355 | WREG32(AVIVO_D1MODE_DESKTOP_HEIGHT + radeon_crtc->crtc_offset, | 1355 | WREG32(AVIVO_D1MODE_DESKTOP_HEIGHT + radeon_crtc->crtc_offset, |
1356 | crtc->mode.vdisplay); | 1356 | target_fb->height); |
1357 | x &= ~3; | 1357 | x &= ~3; |
1358 | y &= ~1; | 1358 | y &= ~1; |
1359 | WREG32(AVIVO_D1MODE_VIEWPORT_START + radeon_crtc->crtc_offset, | 1359 | WREG32(AVIVO_D1MODE_VIEWPORT_START + radeon_crtc->crtc_offset, |
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c index a71557ce01dc..552b436451fd 100644 --- a/drivers/gpu/drm/radeon/atombios_dp.c +++ b/drivers/gpu/drm/radeon/atombios_dp.c | |||
@@ -564,9 +564,21 @@ int radeon_dp_get_panel_mode(struct drm_encoder *encoder, | |||
564 | ENCODER_OBJECT_ID_NUTMEG) | 564 | ENCODER_OBJECT_ID_NUTMEG) |
565 | panel_mode = DP_PANEL_MODE_INTERNAL_DP1_MODE; | 565 | panel_mode = DP_PANEL_MODE_INTERNAL_DP1_MODE; |
566 | else if (radeon_connector_encoder_get_dp_bridge_encoder_id(connector) == | 566 | else if (radeon_connector_encoder_get_dp_bridge_encoder_id(connector) == |
567 | ENCODER_OBJECT_ID_TRAVIS) | 567 | ENCODER_OBJECT_ID_TRAVIS) { |
568 | panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE; | 568 | u8 id[6]; |
569 | else if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { | 569 | int i; |
570 | for (i = 0; i < 6; i++) | ||
571 | id[i] = radeon_read_dpcd_reg(radeon_connector, 0x503 + i); | ||
572 | if (id[0] == 0x73 && | ||
573 | id[1] == 0x69 && | ||
574 | id[2] == 0x76 && | ||
575 | id[3] == 0x61 && | ||
576 | id[4] == 0x72 && | ||
577 | id[5] == 0x54) | ||
578 | panel_mode = DP_PANEL_MODE_INTERNAL_DP1_MODE; | ||
579 | else | ||
580 | panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE; | ||
581 | } else if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { | ||
570 | u8 tmp = radeon_read_dpcd_reg(radeon_connector, DP_EDP_CONFIGURATION_CAP); | 582 | u8 tmp = radeon_read_dpcd_reg(radeon_connector, DP_EDP_CONFIGURATION_CAP); |
571 | if (tmp & 1) | 583 | if (tmp & 1) |
572 | panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE; | 584 | panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE; |
diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c b/drivers/gpu/drm/radeon/r600_blit_kms.c index d996f4381130..accc032c103f 100644 --- a/drivers/gpu/drm/radeon/r600_blit_kms.c +++ b/drivers/gpu/drm/radeon/r600_blit_kms.c | |||
@@ -468,27 +468,42 @@ set_default_state(struct radeon_device *rdev) | |||
468 | radeon_ring_write(ring, sq_stack_resource_mgmt_2); | 468 | radeon_ring_write(ring, sq_stack_resource_mgmt_2); |
469 | } | 469 | } |
470 | 470 | ||
471 | #define I2F_MAX_BITS 15 | ||
472 | #define I2F_MAX_INPUT ((1 << I2F_MAX_BITS) - 1) | ||
473 | #define I2F_SHIFT (24 - I2F_MAX_BITS) | ||
474 | |||
475 | /* | ||
476 | * Converts unsigned integer into 32-bit IEEE floating point representation. | ||
477 | * Conversion is not universal and only works for the range from 0 | ||
478 | * to 2^I2F_MAX_BITS-1. Currently we only use it with inputs between | ||
479 | * 0 and 16384 (inclusive), so I2F_MAX_BITS=15 is enough. If necessary, | ||
480 | * I2F_MAX_BITS can be increased, but that will add to the loop iterations | ||
481 | * and slow us down. Conversion is done by shifting the input and counting | ||
482 | * down until the first 1 reaches bit position 23. The resulting counter | ||
483 | * and the shifted input are, respectively, the exponent and the fraction. | ||
484 | * The sign is always zero. | ||
485 | */ | ||
471 | static uint32_t i2f(uint32_t input) | 486 | static uint32_t i2f(uint32_t input) |
472 | { | 487 | { |
473 | u32 result, i, exponent, fraction; | 488 | u32 result, i, exponent, fraction; |
474 | 489 | ||
475 | if ((input & 0x3fff) == 0) | 490 | WARN_ON_ONCE(input > I2F_MAX_INPUT); |
476 | result = 0; /* 0 is a special case */ | 491 | |
492 | if ((input & I2F_MAX_INPUT) == 0) | ||
493 | result = 0; | ||
477 | else { | 494 | else { |
478 | exponent = 140; /* exponent biased by 127; */ | 495 | exponent = 126 + I2F_MAX_BITS; |
479 | fraction = (input & 0x3fff) << 10; /* cheat and only | 496 | fraction = (input & I2F_MAX_INPUT) << I2F_SHIFT; |
480 | handle numbers below 2^^15 */ | 497 | |
481 | for (i = 0; i < 14; i++) { | 498 | for (i = 0; i < I2F_MAX_BITS; i++) { |
482 | if (fraction & 0x800000) | 499 | if (fraction & 0x800000) |
483 | break; | 500 | break; |
484 | else { | 501 | else { |
485 | fraction = fraction << 1; /* keep | 502 | fraction = fraction << 1; |
486 | shifting left until top bit = 1 */ | ||
487 | exponent = exponent - 1; | 503 | exponent = exponent - 1; |
488 | } | 504 | } |
489 | } | 505 | } |
490 | result = exponent << 23 | (fraction & 0x7fffff); /* mask | 506 | result = exponent << 23 | (fraction & 0x7fffff); |
491 | off top bit; assumed 1 */ | ||
492 | } | 507 | } |
493 | return result; | 508 | return result; |
494 | } | 509 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c index 13ac63ba6075..98724fcb0088 100644 --- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c +++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c | |||
@@ -59,8 +59,9 @@ static int radeon_atrm_call(acpi_handle atrm_handle, uint8_t *bios, | |||
59 | 59 | ||
60 | obj = (union acpi_object *)buffer.pointer; | 60 | obj = (union acpi_object *)buffer.pointer; |
61 | memcpy(bios+offset, obj->buffer.pointer, obj->buffer.length); | 61 | memcpy(bios+offset, obj->buffer.pointer, obj->buffer.length); |
62 | len = obj->buffer.length; | ||
62 | kfree(buffer.pointer); | 63 | kfree(buffer.pointer); |
63 | return obj->buffer.length; | 64 | return len; |
64 | } | 65 | } |
65 | 66 | ||
66 | bool radeon_atrm_supported(struct pci_dev *pdev) | 67 | bool radeon_atrm_supported(struct pci_dev *pdev) |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index cec51a5b69dd..49f7cb7e226b 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -883,6 +883,8 @@ int radeon_suspend_kms(struct drm_device *dev, pm_message_t state) | |||
883 | if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) | 883 | if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) |
884 | return 0; | 884 | return 0; |
885 | 885 | ||
886 | drm_kms_helper_poll_disable(dev); | ||
887 | |||
886 | /* turn off display hw */ | 888 | /* turn off display hw */ |
887 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | 889 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
888 | drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF); | 890 | drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF); |
@@ -972,6 +974,8 @@ int radeon_resume_kms(struct drm_device *dev) | |||
972 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | 974 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
973 | drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON); | 975 | drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON); |
974 | } | 976 | } |
977 | |||
978 | drm_kms_helper_poll_enable(dev); | ||
975 | return 0; | 979 | return 0; |
976 | } | 980 | } |
977 | 981 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c b/drivers/gpu/drm/radeon/radeon_i2c.c index e2a393ff0c44..98a8ad680109 100644 --- a/drivers/gpu/drm/radeon/radeon_i2c.c +++ b/drivers/gpu/drm/radeon/radeon_i2c.c | |||
@@ -958,6 +958,7 @@ struct radeon_i2c_chan *radeon_i2c_create_dp(struct drm_device *dev, | |||
958 | i2c->rec = *rec; | 958 | i2c->rec = *rec; |
959 | i2c->adapter.owner = THIS_MODULE; | 959 | i2c->adapter.owner = THIS_MODULE; |
960 | i2c->adapter.class = I2C_CLASS_DDC; | 960 | i2c->adapter.class = I2C_CLASS_DDC; |
961 | i2c->adapter.dev.parent = &dev->pdev->dev; | ||
961 | i2c->dev = dev; | 962 | i2c->dev = dev; |
962 | snprintf(i2c->adapter.name, sizeof(i2c->adapter.name), | 963 | snprintf(i2c->adapter.name, sizeof(i2c->adapter.name), |
963 | "Radeon aux bus %s", name); | 964 | "Radeon aux bus %s", name); |
diff --git a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c index 0c33ae9cf0f0..406632472c1b 100644 --- a/drivers/hid/hid-hyperv.c +++ b/drivers/hid/hid-hyperv.c | |||
@@ -548,6 +548,7 @@ static int mousevsc_remove(struct hv_device *dev) | |||
548 | struct mousevsc_dev *input_dev = hv_get_drvdata(dev); | 548 | struct mousevsc_dev *input_dev = hv_get_drvdata(dev); |
549 | 549 | ||
550 | vmbus_close(dev->channel); | 550 | vmbus_close(dev->channel); |
551 | hid_hw_stop(input_dev->hid_device); | ||
551 | hid_destroy_device(input_dev->hid_device); | 552 | hid_destroy_device(input_dev->hid_device); |
552 | mousevsc_free_device(input_dev); | 553 | mousevsc_free_device(input_dev); |
553 | 554 | ||
diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c index b47e58b52d9f..acab74cde727 100644 --- a/drivers/hid/hid-wacom.c +++ b/drivers/hid/hid-wacom.c | |||
@@ -531,7 +531,6 @@ static int wacom_probe(struct hid_device *hdev, | |||
531 | wdata->battery.type = POWER_SUPPLY_TYPE_BATTERY; | 531 | wdata->battery.type = POWER_SUPPLY_TYPE_BATTERY; |
532 | wdata->battery.use_for_apm = 0; | 532 | wdata->battery.use_for_apm = 0; |
533 | 533 | ||
534 | power_supply_powers(&wdata->battery, &hdev->dev); | ||
535 | 534 | ||
536 | ret = power_supply_register(&hdev->dev, &wdata->battery); | 535 | ret = power_supply_register(&hdev->dev, &wdata->battery); |
537 | if (ret) { | 536 | if (ret) { |
@@ -540,6 +539,8 @@ static int wacom_probe(struct hid_device *hdev, | |||
540 | goto err_battery; | 539 | goto err_battery; |
541 | } | 540 | } |
542 | 541 | ||
542 | power_supply_powers(&wdata->battery, &hdev->dev); | ||
543 | |||
543 | wdata->ac.properties = wacom_ac_props; | 544 | wdata->ac.properties = wacom_ac_props; |
544 | wdata->ac.num_properties = ARRAY_SIZE(wacom_ac_props); | 545 | wdata->ac.num_properties = ARRAY_SIZE(wacom_ac_props); |
545 | wdata->ac.get_property = wacom_ac_get_property; | 546 | wdata->ac.get_property = wacom_ac_get_property; |
@@ -547,14 +548,14 @@ static int wacom_probe(struct hid_device *hdev, | |||
547 | wdata->ac.type = POWER_SUPPLY_TYPE_MAINS; | 548 | wdata->ac.type = POWER_SUPPLY_TYPE_MAINS; |
548 | wdata->ac.use_for_apm = 0; | 549 | wdata->ac.use_for_apm = 0; |
549 | 550 | ||
550 | power_supply_powers(&wdata->battery, &hdev->dev); | ||
551 | |||
552 | ret = power_supply_register(&hdev->dev, &wdata->ac); | 551 | ret = power_supply_register(&hdev->dev, &wdata->ac); |
553 | if (ret) { | 552 | if (ret) { |
554 | hid_warn(hdev, | 553 | hid_warn(hdev, |
555 | "can't create ac battery attribute, err: %d\n", ret); | 554 | "can't create ac battery attribute, err: %d\n", ret); |
556 | goto err_ac; | 555 | goto err_ac; |
557 | } | 556 | } |
557 | |||
558 | power_supply_powers(&wdata->ac, &hdev->dev); | ||
558 | #endif | 559 | #endif |
559 | return 0; | 560 | return 0; |
560 | 561 | ||
diff --git a/drivers/hid/hid-wiimote-core.c b/drivers/hid/hid-wiimote-core.c index fc253b472f9d..cac3589b1ed5 100644 --- a/drivers/hid/hid-wiimote-core.c +++ b/drivers/hid/hid-wiimote-core.c | |||
@@ -1226,14 +1226,14 @@ static int wiimote_hid_probe(struct hid_device *hdev, | |||
1226 | wdata->battery.type = POWER_SUPPLY_TYPE_BATTERY; | 1226 | wdata->battery.type = POWER_SUPPLY_TYPE_BATTERY; |
1227 | wdata->battery.use_for_apm = 0; | 1227 | wdata->battery.use_for_apm = 0; |
1228 | 1228 | ||
1229 | power_supply_powers(&wdata->battery, &hdev->dev); | ||
1230 | |||
1231 | ret = power_supply_register(&wdata->hdev->dev, &wdata->battery); | 1229 | ret = power_supply_register(&wdata->hdev->dev, &wdata->battery); |
1232 | if (ret) { | 1230 | if (ret) { |
1233 | hid_err(hdev, "Cannot register battery device\n"); | 1231 | hid_err(hdev, "Cannot register battery device\n"); |
1234 | goto err_battery; | 1232 | goto err_battery; |
1235 | } | 1233 | } |
1236 | 1234 | ||
1235 | power_supply_powers(&wdata->battery, &hdev->dev); | ||
1236 | |||
1237 | ret = wiimote_leds_create(wdata); | 1237 | ret = wiimote_leds_create(wdata); |
1238 | if (ret) | 1238 | if (ret) |
1239 | goto err_free; | 1239 | goto err_free; |
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index 7c297d305d5d..b1ec0e2aeb57 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c | |||
@@ -922,11 +922,11 @@ void hiddev_disconnect(struct hid_device *hid) | |||
922 | struct hiddev *hiddev = hid->hiddev; | 922 | struct hiddev *hiddev = hid->hiddev; |
923 | struct usbhid_device *usbhid = hid->driver_data; | 923 | struct usbhid_device *usbhid = hid->driver_data; |
924 | 924 | ||
925 | usb_deregister_dev(usbhid->intf, &hiddev_class); | ||
926 | |||
925 | mutex_lock(&hiddev->existancelock); | 927 | mutex_lock(&hiddev->existancelock); |
926 | hiddev->exist = 0; | 928 | hiddev->exist = 0; |
927 | 929 | ||
928 | usb_deregister_dev(usbhid->intf, &hiddev_class); | ||
929 | |||
930 | if (hiddev->open) { | 930 | if (hiddev->open) { |
931 | mutex_unlock(&hiddev->existancelock); | 931 | mutex_unlock(&hiddev->existancelock); |
932 | usbhid_close(hiddev->hid); | 932 | usbhid_close(hiddev->hid); |
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index 2dfae7d7cc5b..4d383e7e051d 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c | |||
@@ -1920,9 +1920,26 @@ w83627ehf_check_fan_inputs(const struct w83627ehf_sio_data *sio_data, | |||
1920 | fan4min = 0; | 1920 | fan4min = 0; |
1921 | fan5pin = 0; | 1921 | fan5pin = 0; |
1922 | } else if (sio_data->kind == nct6776) { | 1922 | } else if (sio_data->kind == nct6776) { |
1923 | fan3pin = !(superio_inb(sio_data->sioreg, 0x24) & 0x40); | 1923 | bool gpok = superio_inb(sio_data->sioreg, 0x27) & 0x80; |
1924 | fan4pin = !!(superio_inb(sio_data->sioreg, 0x1C) & 0x01); | 1924 | |
1925 | fan5pin = !!(superio_inb(sio_data->sioreg, 0x1C) & 0x02); | 1925 | superio_select(sio_data->sioreg, W83627EHF_LD_HWM); |
1926 | regval = superio_inb(sio_data->sioreg, SIO_REG_ENABLE); | ||
1927 | |||
1928 | if (regval & 0x80) | ||
1929 | fan3pin = gpok; | ||
1930 | else | ||
1931 | fan3pin = !(superio_inb(sio_data->sioreg, 0x24) & 0x40); | ||
1932 | |||
1933 | if (regval & 0x40) | ||
1934 | fan4pin = gpok; | ||
1935 | else | ||
1936 | fan4pin = !!(superio_inb(sio_data->sioreg, 0x1C) & 0x01); | ||
1937 | |||
1938 | if (regval & 0x20) | ||
1939 | fan5pin = gpok; | ||
1940 | else | ||
1941 | fan5pin = !!(superio_inb(sio_data->sioreg, 0x1C) & 0x02); | ||
1942 | |||
1926 | fan4min = fan4pin; | 1943 | fan4min = fan4pin; |
1927 | } else if (sio_data->kind == w83667hg || sio_data->kind == w83667hg_b) { | 1944 | } else if (sio_data->kind == w83667hg || sio_data->kind == w83667hg_b) { |
1928 | fan3pin = 1; | 1945 | fan3pin = 1; |
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index f713eac55047..801df6000e9b 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c | |||
@@ -1018,7 +1018,7 @@ omap_i2c_probe(struct platform_device *pdev) | |||
1018 | goto err_release_region; | 1018 | goto err_release_region; |
1019 | } | 1019 | } |
1020 | 1020 | ||
1021 | match = of_match_device(omap_i2c_of_match, &pdev->dev); | 1021 | match = of_match_device(of_match_ptr(omap_i2c_of_match), &pdev->dev); |
1022 | if (match) { | 1022 | if (match) { |
1023 | u32 freq = 100000; /* default to 100000 Hz */ | 1023 | u32 freq = 100000; /* default to 100000 Hz */ |
1024 | 1024 | ||
diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c index b37b0c02a7b9..5034a87cc72d 100644 --- a/drivers/infiniband/core/ucma.c +++ b/drivers/infiniband/core/ucma.c | |||
@@ -808,9 +808,12 @@ static ssize_t ucma_accept(struct ucma_file *file, const char __user *inbuf, | |||
808 | return PTR_ERR(ctx); | 808 | return PTR_ERR(ctx); |
809 | 809 | ||
810 | if (cmd.conn_param.valid) { | 810 | if (cmd.conn_param.valid) { |
811 | ctx->uid = cmd.uid; | ||
812 | ucma_copy_conn_param(&conn_param, &cmd.conn_param); | 811 | ucma_copy_conn_param(&conn_param, &cmd.conn_param); |
812 | mutex_lock(&file->mut); | ||
813 | ret = rdma_accept(ctx->cm_id, &conn_param); | 813 | ret = rdma_accept(ctx->cm_id, &conn_param); |
814 | if (!ret) | ||
815 | ctx->uid = cmd.uid; | ||
816 | mutex_unlock(&file->mut); | ||
814 | } else | 817 | } else |
815 | ret = rdma_accept(ctx->cm_id, NULL); | 818 | ret = rdma_accept(ctx->cm_id, NULL); |
816 | 819 | ||
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index b930da4c0c63..4d27e4c3fe34 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c | |||
@@ -1485,6 +1485,7 @@ ssize_t ib_uverbs_create_qp(struct ib_uverbs_file *file, | |||
1485 | qp->event_handler = attr.event_handler; | 1485 | qp->event_handler = attr.event_handler; |
1486 | qp->qp_context = attr.qp_context; | 1486 | qp->qp_context = attr.qp_context; |
1487 | qp->qp_type = attr.qp_type; | 1487 | qp->qp_type = attr.qp_type; |
1488 | atomic_set(&qp->usecnt, 0); | ||
1488 | atomic_inc(&pd->usecnt); | 1489 | atomic_inc(&pd->usecnt); |
1489 | atomic_inc(&attr.send_cq->usecnt); | 1490 | atomic_inc(&attr.send_cq->usecnt); |
1490 | if (attr.recv_cq) | 1491 | if (attr.recv_cq) |
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index 602b1bd723a9..575b78045aaf 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c | |||
@@ -421,6 +421,7 @@ struct ib_qp *ib_create_qp(struct ib_pd *pd, | |||
421 | qp->uobject = NULL; | 421 | qp->uobject = NULL; |
422 | qp->qp_type = qp_init_attr->qp_type; | 422 | qp->qp_type = qp_init_attr->qp_type; |
423 | 423 | ||
424 | atomic_set(&qp->usecnt, 0); | ||
424 | if (qp_init_attr->qp_type == IB_QPT_XRC_TGT) { | 425 | if (qp_init_attr->qp_type == IB_QPT_XRC_TGT) { |
425 | qp->event_handler = __ib_shared_qp_event_handler; | 426 | qp->event_handler = __ib_shared_qp_event_handler; |
426 | qp->qp_context = qp; | 427 | qp->qp_context = qp; |
@@ -430,7 +431,6 @@ struct ib_qp *ib_create_qp(struct ib_pd *pd, | |||
430 | qp->xrcd = qp_init_attr->xrcd; | 431 | qp->xrcd = qp_init_attr->xrcd; |
431 | atomic_inc(&qp_init_attr->xrcd->usecnt); | 432 | atomic_inc(&qp_init_attr->xrcd->usecnt); |
432 | INIT_LIST_HEAD(&qp->open_list); | 433 | INIT_LIST_HEAD(&qp->open_list); |
433 | atomic_set(&qp->usecnt, 0); | ||
434 | 434 | ||
435 | real_qp = qp; | 435 | real_qp = qp; |
436 | qp = __ib_open_qp(real_qp, qp_init_attr->event_handler, | 436 | qp = __ib_open_qp(real_qp, qp_init_attr->event_handler, |
diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c index b7d4216db3c3..a4de9d58e9b4 100644 --- a/drivers/infiniband/hw/ipath/ipath_fs.c +++ b/drivers/infiniband/hw/ipath/ipath_fs.c | |||
@@ -89,7 +89,7 @@ static int create_file(const char *name, umode_t mode, | |||
89 | error = ipathfs_mknod(parent->d_inode, *dentry, | 89 | error = ipathfs_mknod(parent->d_inode, *dentry, |
90 | mode, fops, data); | 90 | mode, fops, data); |
91 | else | 91 | else |
92 | error = PTR_ERR(dentry); | 92 | error = PTR_ERR(*dentry); |
93 | mutex_unlock(&parent->d_inode->i_mutex); | 93 | mutex_unlock(&parent->d_inode->i_mutex); |
94 | 94 | ||
95 | return error; | 95 | return error; |
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index 95c94d8f0254..259b0670b51c 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c | |||
@@ -257,12 +257,9 @@ static int ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, | |||
257 | return IB_MAD_RESULT_SUCCESS; | 257 | return IB_MAD_RESULT_SUCCESS; |
258 | 258 | ||
259 | /* | 259 | /* |
260 | * Don't process SMInfo queries or vendor-specific | 260 | * Don't process SMInfo queries -- the SMA can't handle them. |
261 | * MADs -- the SMA can't handle them. | ||
262 | */ | 261 | */ |
263 | if (in_mad->mad_hdr.attr_id == IB_SMP_ATTR_SM_INFO || | 262 | if (in_mad->mad_hdr.attr_id == IB_SMP_ATTR_SM_INFO) |
264 | ((in_mad->mad_hdr.attr_id & IB_SMP_ATTR_VENDOR_MASK) == | ||
265 | IB_SMP_ATTR_VENDOR_MASK)) | ||
266 | return IB_MAD_RESULT_SUCCESS; | 263 | return IB_MAD_RESULT_SUCCESS; |
267 | } else if (in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_PERF_MGMT || | 264 | } else if (in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_PERF_MGMT || |
268 | in_mad->mad_hdr.mgmt_class == MLX4_IB_VENDOR_CLASS1 || | 265 | in_mad->mad_hdr.mgmt_class == MLX4_IB_VENDOR_CLASS1 || |
diff --git a/drivers/infiniband/hw/nes/nes.c b/drivers/infiniband/hw/nes/nes.c index 7013da5e9eda..7140199f562e 100644 --- a/drivers/infiniband/hw/nes/nes.c +++ b/drivers/infiniband/hw/nes/nes.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 - 2009 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved. |
3 | * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved. | 3 | * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved. |
4 | * | 4 | * |
5 | * This software is available to you under a choice of one of two | 5 | * This software is available to you under a choice of one of two |
diff --git a/drivers/infiniband/hw/nes/nes.h b/drivers/infiniband/hw/nes/nes.h index 568b4f11380a..c438e4691b3c 100644 --- a/drivers/infiniband/hw/nes/nes.h +++ b/drivers/infiniband/hw/nes/nes.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 - 2009 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved. |
3 | * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved. | 3 | * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved. |
4 | * | 4 | * |
5 | * This software is available to you under a choice of one of two | 5 | * This software is available to you under a choice of one of two |
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c index 425065b36b8c..a4972abedef1 100644 --- a/drivers/infiniband/hw/nes/nes_cm.c +++ b/drivers/infiniband/hw/nes/nes_cm.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 - 2009 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
@@ -233,6 +233,7 @@ static int send_mpa_reject(struct nes_cm_node *cm_node) | |||
233 | u8 *start_ptr = &start_addr; | 233 | u8 *start_ptr = &start_addr; |
234 | u8 **start_buff = &start_ptr; | 234 | u8 **start_buff = &start_ptr; |
235 | u16 buff_len = 0; | 235 | u16 buff_len = 0; |
236 | struct ietf_mpa_v1 *mpa_frame; | ||
236 | 237 | ||
237 | skb = dev_alloc_skb(MAX_CM_BUFFER); | 238 | skb = dev_alloc_skb(MAX_CM_BUFFER); |
238 | if (!skb) { | 239 | if (!skb) { |
@@ -242,6 +243,8 @@ static int send_mpa_reject(struct nes_cm_node *cm_node) | |||
242 | 243 | ||
243 | /* send an MPA reject frame */ | 244 | /* send an MPA reject frame */ |
244 | cm_build_mpa_frame(cm_node, start_buff, &buff_len, NULL, MPA_KEY_REPLY); | 245 | cm_build_mpa_frame(cm_node, start_buff, &buff_len, NULL, MPA_KEY_REPLY); |
246 | mpa_frame = (struct ietf_mpa_v1 *)*start_buff; | ||
247 | mpa_frame->flags |= IETF_MPA_FLAGS_REJECT; | ||
245 | form_cm_frame(skb, cm_node, NULL, 0, *start_buff, buff_len, SET_ACK | SET_FIN); | 248 | form_cm_frame(skb, cm_node, NULL, 0, *start_buff, buff_len, SET_ACK | SET_FIN); |
246 | 249 | ||
247 | cm_node->state = NES_CM_STATE_FIN_WAIT1; | 250 | cm_node->state = NES_CM_STATE_FIN_WAIT1; |
@@ -1360,8 +1363,7 @@ static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpi | |||
1360 | if (!memcmp(nesadapter->arp_table[arpindex].mac_addr, | 1363 | if (!memcmp(nesadapter->arp_table[arpindex].mac_addr, |
1361 | neigh->ha, ETH_ALEN)) { | 1364 | neigh->ha, ETH_ALEN)) { |
1362 | /* Mac address same as in nes_arp_table */ | 1365 | /* Mac address same as in nes_arp_table */ |
1363 | ip_rt_put(rt); | 1366 | goto out; |
1364 | return rc; | ||
1365 | } | 1367 | } |
1366 | 1368 | ||
1367 | nes_manage_arp_cache(nesvnic->netdev, | 1369 | nes_manage_arp_cache(nesvnic->netdev, |
@@ -1377,6 +1379,8 @@ static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpi | |||
1377 | neigh_event_send(neigh, NULL); | 1379 | neigh_event_send(neigh, NULL); |
1378 | } | 1380 | } |
1379 | } | 1381 | } |
1382 | |||
1383 | out: | ||
1380 | rcu_read_unlock(); | 1384 | rcu_read_unlock(); |
1381 | ip_rt_put(rt); | 1385 | ip_rt_put(rt); |
1382 | return rc; | 1386 | return rc; |
diff --git a/drivers/infiniband/hw/nes/nes_cm.h b/drivers/infiniband/hw/nes/nes_cm.h index bdfa1fbb35fc..4646e6666087 100644 --- a/drivers/infiniband/hw/nes/nes_cm.h +++ b/drivers/infiniband/hw/nes/nes_cm.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 - 2009 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/infiniband/hw/nes/nes_context.h b/drivers/infiniband/hw/nes/nes_context.h index b4393a16099d..a69eef16d72d 100644 --- a/drivers/infiniband/hw/nes/nes_context.h +++ b/drivers/infiniband/hw/nes/nes_context.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 - 2009 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c index 055f4b545df0..d42c9f435b1b 100644 --- a/drivers/infiniband/hw/nes/nes_hw.c +++ b/drivers/infiniband/hw/nes/nes_hw.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 - 2009 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/infiniband/hw/nes/nes_hw.h b/drivers/infiniband/hw/nes/nes_hw.h index 0b590e152c6a..d748e4b31b8d 100644 --- a/drivers/infiniband/hw/nes/nes_hw.h +++ b/drivers/infiniband/hw/nes/nes_hw.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 - 2009 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/infiniband/hw/nes/nes_mgt.c b/drivers/infiniband/hw/nes/nes_mgt.c index b3b2a240c6e9..3ba7be369452 100644 --- a/drivers/infiniband/hw/nes/nes_mgt.c +++ b/drivers/infiniband/hw/nes/nes_mgt.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 - 2009 Intel-NE, Inc. All rights reserved. | 2 | * Copyright (c) 2006 - 2011 Intel-NE, Inc. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/infiniband/hw/nes/nes_mgt.h b/drivers/infiniband/hw/nes/nes_mgt.h index 8c8af254555a..4f7f701c4a81 100644 --- a/drivers/infiniband/hw/nes/nes_mgt.h +++ b/drivers/infiniband/hw/nes/nes_mgt.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2010 Intel-NE, Inc. All rights reserved. | 2 | * Copyright (c) 2006 - 2011 Intel-NE, Inc. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c index 4b3fa711a247..f3a3ecf8d09e 100644 --- a/drivers/infiniband/hw/nes/nes_nic.c +++ b/drivers/infiniband/hw/nes/nes_nic.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 - 2009 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/infiniband/hw/nes/nes_user.h b/drivers/infiniband/hw/nes/nes_user.h index 71e133ab209b..4926de744488 100644 --- a/drivers/infiniband/hw/nes/nes_user.h +++ b/drivers/infiniband/hw/nes/nes_user.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 - 2009 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved. |
3 | * Copyright (c) 2005 Topspin Communications. All rights reserved. | 3 | * Copyright (c) 2005 Topspin Communications. All rights reserved. |
4 | * Copyright (c) 2005 Cisco Systems. All rights reserved. | 4 | * Copyright (c) 2005 Cisco Systems. All rights reserved. |
5 | * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved. | 5 | * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved. |
diff --git a/drivers/infiniband/hw/nes/nes_utils.c b/drivers/infiniband/hw/nes/nes_utils.c index 8b4c2ff54888..e98f4fc0b768 100644 --- a/drivers/infiniband/hw/nes/nes_utils.c +++ b/drivers/infiniband/hw/nes/nes_utils.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 - 2009 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c index 5095bc41c6cc..0927b5cc65d3 100644 --- a/drivers/infiniband/hw/nes/nes_verbs.c +++ b/drivers/infiniband/hw/nes/nes_verbs.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 - 2009 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * This software is available to you under a choice of one of two | 4 | * This software is available to you under a choice of one of two |
5 | * licenses. You may choose to be licensed under the terms of the GNU | 5 | * licenses. You may choose to be licensed under the terms of the GNU |
@@ -3428,6 +3428,8 @@ static int nes_post_send(struct ib_qp *ibqp, struct ib_send_wr *ib_wr, | |||
3428 | NES_IWARP_SQ_FMR_WQE_LENGTH_LOW_IDX, | 3428 | NES_IWARP_SQ_FMR_WQE_LENGTH_LOW_IDX, |
3429 | ib_wr->wr.fast_reg.length); | 3429 | ib_wr->wr.fast_reg.length); |
3430 | set_wqe_32bit_value(wqe->wqe_words, | 3430 | set_wqe_32bit_value(wqe->wqe_words, |
3431 | NES_IWARP_SQ_FMR_WQE_LENGTH_HIGH_IDX, 0); | ||
3432 | set_wqe_32bit_value(wqe->wqe_words, | ||
3431 | NES_IWARP_SQ_FMR_WQE_MR_STAG_IDX, | 3433 | NES_IWARP_SQ_FMR_WQE_MR_STAG_IDX, |
3432 | ib_wr->wr.fast_reg.rkey); | 3434 | ib_wr->wr.fast_reg.rkey); |
3433 | /* Set page size: */ | 3435 | /* Set page size: */ |
@@ -3724,7 +3726,7 @@ static int nes_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *entry) | |||
3724 | entry->opcode = IB_WC_SEND; | 3726 | entry->opcode = IB_WC_SEND; |
3725 | break; | 3727 | break; |
3726 | case NES_IWARP_SQ_OP_LOCINV: | 3728 | case NES_IWARP_SQ_OP_LOCINV: |
3727 | entry->opcode = IB_WR_LOCAL_INV; | 3729 | entry->opcode = IB_WC_LOCAL_INV; |
3728 | break; | 3730 | break; |
3729 | case NES_IWARP_SQ_OP_FAST_REG: | 3731 | case NES_IWARP_SQ_OP_FAST_REG: |
3730 | entry->opcode = IB_WC_FAST_REG_MR; | 3732 | entry->opcode = IB_WC_FAST_REG_MR; |
diff --git a/drivers/infiniband/hw/nes/nes_verbs.h b/drivers/infiniband/hw/nes/nes_verbs.h index fe6b6e92fa90..0eff7c44d76b 100644 --- a/drivers/infiniband/hw/nes/nes_verbs.h +++ b/drivers/infiniband/hw/nes/nes_verbs.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 - 2009 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved. |
3 | * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved. | 3 | * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved. |
4 | * | 4 | * |
5 | * This software is available to you under a choice of one of two | 5 | * This software is available to you under a choice of one of two |
diff --git a/drivers/infiniband/hw/qib/qib_iba6120.c b/drivers/infiniband/hw/qib/qib_iba6120.c index 4f18e2d332df..d0c64d514813 100644 --- a/drivers/infiniband/hw/qib/qib_iba6120.c +++ b/drivers/infiniband/hw/qib/qib_iba6120.c | |||
@@ -2105,7 +2105,7 @@ static void alloc_dummy_hdrq(struct qib_devdata *dd) | |||
2105 | dd->cspec->dummy_hdrq = dma_alloc_coherent(&dd->pcidev->dev, | 2105 | dd->cspec->dummy_hdrq = dma_alloc_coherent(&dd->pcidev->dev, |
2106 | dd->rcd[0]->rcvhdrq_size, | 2106 | dd->rcd[0]->rcvhdrq_size, |
2107 | &dd->cspec->dummy_hdrq_phys, | 2107 | &dd->cspec->dummy_hdrq_phys, |
2108 | GFP_KERNEL | __GFP_COMP); | 2108 | GFP_ATOMIC | __GFP_COMP); |
2109 | if (!dd->cspec->dummy_hdrq) { | 2109 | if (!dd->cspec->dummy_hdrq) { |
2110 | qib_devinfo(dd->pcidev, "Couldn't allocate dummy hdrq\n"); | 2110 | qib_devinfo(dd->pcidev, "Couldn't allocate dummy hdrq\n"); |
2111 | /* fallback to just 0'ing */ | 2111 | /* fallback to just 0'ing */ |
diff --git a/drivers/infiniband/hw/qib/qib_pcie.c b/drivers/infiniband/hw/qib/qib_pcie.c index f695061d688e..0fde788e1100 100644 --- a/drivers/infiniband/hw/qib/qib_pcie.c +++ b/drivers/infiniband/hw/qib/qib_pcie.c | |||
@@ -560,7 +560,7 @@ static int qib_tune_pcie_coalesce(struct qib_devdata *dd) | |||
560 | * BIOS may not set PCIe bus-utilization parameters for best performance. | 560 | * BIOS may not set PCIe bus-utilization parameters for best performance. |
561 | * Check and optionally adjust them to maximize our throughput. | 561 | * Check and optionally adjust them to maximize our throughput. |
562 | */ | 562 | */ |
563 | static int qib_pcie_caps = 0x51; | 563 | static int qib_pcie_caps; |
564 | module_param_named(pcie_caps, qib_pcie_caps, int, S_IRUGO); | 564 | module_param_named(pcie_caps, qib_pcie_caps, int, S_IRUGO); |
565 | MODULE_PARM_DESC(pcie_caps, "Max PCIe tuning: Payload (0..3), ReadReq (4..7)"); | 565 | MODULE_PARM_DESC(pcie_caps, "Max PCIe tuning: Payload (0..3), ReadReq (4..7)"); |
566 | 566 | ||
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index cd5d05e22a77..2b73d43cd691 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c | |||
@@ -69,8 +69,8 @@ MODULE_LICENSE("Dual BSD/GPL"); | |||
69 | */ | 69 | */ |
70 | 70 | ||
71 | static u64 srpt_service_guid; | 71 | static u64 srpt_service_guid; |
72 | static spinlock_t srpt_dev_lock; /* Protects srpt_dev_list. */ | 72 | static DEFINE_SPINLOCK(srpt_dev_lock); /* Protects srpt_dev_list. */ |
73 | static struct list_head srpt_dev_list; /* List of srpt_device structures. */ | 73 | static LIST_HEAD(srpt_dev_list); /* List of srpt_device structures. */ |
74 | 74 | ||
75 | static unsigned srp_max_req_size = DEFAULT_MAX_REQ_SIZE; | 75 | static unsigned srp_max_req_size = DEFAULT_MAX_REQ_SIZE; |
76 | module_param(srp_max_req_size, int, 0444); | 76 | module_param(srp_max_req_size, int, 0444); |
@@ -687,6 +687,7 @@ err: | |||
687 | while (--i >= 0) | 687 | while (--i >= 0) |
688 | srpt_free_ioctx(sdev, ring[i], dma_size, dir); | 688 | srpt_free_ioctx(sdev, ring[i], dma_size, dir); |
689 | kfree(ring); | 689 | kfree(ring); |
690 | ring = NULL; | ||
690 | out: | 691 | out: |
691 | return ring; | 692 | return ring; |
692 | } | 693 | } |
@@ -2595,7 +2596,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, | |||
2595 | } | 2596 | } |
2596 | 2597 | ||
2597 | ch->sess = transport_init_session(); | 2598 | ch->sess = transport_init_session(); |
2598 | if (!ch->sess) { | 2599 | if (IS_ERR(ch->sess)) { |
2599 | rej->reason = __constant_cpu_to_be32( | 2600 | rej->reason = __constant_cpu_to_be32( |
2600 | SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); | 2601 | SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); |
2601 | pr_debug("Failed to create session\n"); | 2602 | pr_debug("Failed to create session\n"); |
@@ -3264,8 +3265,7 @@ static void srpt_add_one(struct ib_device *device) | |||
3264 | for (i = 0; i < sdev->srq_size; ++i) | 3265 | for (i = 0; i < sdev->srq_size; ++i) |
3265 | srpt_post_recv(sdev, sdev->ioctx_ring[i]); | 3266 | srpt_post_recv(sdev, sdev->ioctx_ring[i]); |
3266 | 3267 | ||
3267 | WARN_ON(sdev->device->phys_port_cnt | 3268 | WARN_ON(sdev->device->phys_port_cnt > ARRAY_SIZE(sdev->port)); |
3268 | > sizeof(sdev->port)/sizeof(sdev->port[0])); | ||
3269 | 3269 | ||
3270 | for (i = 1; i <= sdev->device->phys_port_cnt; i++) { | 3270 | for (i = 1; i <= sdev->device->phys_port_cnt; i++) { |
3271 | sport = &sdev->port[i - 1]; | 3271 | sport = &sdev->port[i - 1]; |
@@ -4010,13 +4010,10 @@ static int __init srpt_init_module(void) | |||
4010 | goto out; | 4010 | goto out; |
4011 | } | 4011 | } |
4012 | 4012 | ||
4013 | spin_lock_init(&srpt_dev_lock); | ||
4014 | INIT_LIST_HEAD(&srpt_dev_list); | ||
4015 | |||
4016 | ret = -ENODEV; | ||
4017 | srpt_target = target_fabric_configfs_init(THIS_MODULE, "srpt"); | 4013 | srpt_target = target_fabric_configfs_init(THIS_MODULE, "srpt"); |
4018 | if (!srpt_target) { | 4014 | if (IS_ERR(srpt_target)) { |
4019 | printk(KERN_ERR "couldn't register\n"); | 4015 | printk(KERN_ERR "couldn't register\n"); |
4016 | ret = PTR_ERR(srpt_target); | ||
4020 | goto out; | 4017 | goto out; |
4021 | } | 4018 | } |
4022 | 4019 | ||
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.h b/drivers/infiniband/ulp/srpt/ib_srpt.h index b4b4bbcd7f16..61e52b830816 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.h +++ b/drivers/infiniband/ulp/srpt/ib_srpt.h | |||
@@ -35,7 +35,6 @@ | |||
35 | #ifndef IB_SRPT_H | 35 | #ifndef IB_SRPT_H |
36 | #define IB_SRPT_H | 36 | #define IB_SRPT_H |
37 | 37 | ||
38 | #include <linux/version.h> | ||
39 | #include <linux/types.h> | 38 | #include <linux/types.h> |
40 | #include <linux/list.h> | 39 | #include <linux/list.h> |
41 | #include <linux/wait.h> | 40 | #include <linux/wait.h> |
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 76457d50bc34..afc166fcc3d9 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
@@ -386,7 +386,7 @@ static ssize_t evdev_read(struct file *file, char __user *buffer, | |||
386 | struct evdev_client *client = file->private_data; | 386 | struct evdev_client *client = file->private_data; |
387 | struct evdev *evdev = client->evdev; | 387 | struct evdev *evdev = client->evdev; |
388 | struct input_event event; | 388 | struct input_event event; |
389 | int retval; | 389 | int retval = 0; |
390 | 390 | ||
391 | if (count < input_event_size()) | 391 | if (count < input_event_size()) |
392 | return -EINVAL; | 392 | return -EINVAL; |
diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c index a588578037eb..67bec14e8b96 100644 --- a/drivers/input/keyboard/twl4030_keypad.c +++ b/drivers/input/keyboard/twl4030_keypad.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/i2c/twl.h> | 34 | #include <linux/i2c/twl.h> |
35 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
36 | 36 | ||
37 | |||
38 | /* | 37 | /* |
39 | * The TWL4030 family chips include a keypad controller that supports | 38 | * The TWL4030 family chips include a keypad controller that supports |
40 | * up to an 8x8 switch matrix. The controller can issue system wakeup | 39 | * up to an 8x8 switch matrix. The controller can issue system wakeup |
@@ -302,7 +301,7 @@ static int __devinit twl4030_kp_program(struct twl4030_keypad *kp) | |||
302 | if (twl4030_kpwrite_u8(kp, i, KEYP_DEB) < 0) | 301 | if (twl4030_kpwrite_u8(kp, i, KEYP_DEB) < 0) |
303 | return -EIO; | 302 | return -EIO; |
304 | 303 | ||
305 | /* Set timeout period to 100 ms */ | 304 | /* Set timeout period to 200 ms */ |
306 | i = KEYP_PERIOD_US(200000, PTV_PRESCALER); | 305 | i = KEYP_PERIOD_US(200000, PTV_PRESCALER); |
307 | if (twl4030_kpwrite_u8(kp, (i & 0xFF), KEYP_TIMEOUT_L) < 0) | 306 | if (twl4030_kpwrite_u8(kp, (i & 0xFF), KEYP_TIMEOUT_L) < 0) |
308 | return -EIO; | 307 | return -EIO; |
@@ -466,4 +465,3 @@ MODULE_AUTHOR("Texas Instruments"); | |||
466 | MODULE_DESCRIPTION("TWL4030 Keypad Driver"); | 465 | MODULE_DESCRIPTION("TWL4030 Keypad Driver"); |
467 | MODULE_LICENSE("GPL"); | 466 | MODULE_LICENSE("GPL"); |
468 | MODULE_ALIAS("platform:twl4030_keypad"); | 467 | MODULE_ALIAS("platform:twl4030_keypad"); |
469 | |||
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index b4cfc6c8be89..5ec774d6c82b 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
@@ -512,6 +512,13 @@ static const struct dmi_system_id __initconst i8042_dmi_reset_table[] = { | |||
512 | DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1720"), | 512 | DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1720"), |
513 | }, | 513 | }, |
514 | }, | 514 | }, |
515 | { | ||
516 | /* Lenovo Ideapad U455 */ | ||
517 | .matches = { | ||
518 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
519 | DMI_MATCH(DMI_PRODUCT_NAME, "20046"), | ||
520 | }, | ||
521 | }, | ||
515 | { } | 522 | { } |
516 | }; | 523 | }; |
517 | 524 | ||
diff --git a/drivers/input/serio/serio_raw.c b/drivers/input/serio/serio_raw.c index 8250299fd64f..4494233d331a 100644 --- a/drivers/input/serio/serio_raw.c +++ b/drivers/input/serio/serio_raw.c | |||
@@ -164,7 +164,8 @@ static ssize_t serio_raw_read(struct file *file, char __user *buffer, | |||
164 | struct serio_raw_client *client = file->private_data; | 164 | struct serio_raw_client *client = file->private_data; |
165 | struct serio_raw *serio_raw = client->serio_raw; | 165 | struct serio_raw *serio_raw = client->serio_raw; |
166 | char uninitialized_var(c); | 166 | char uninitialized_var(c); |
167 | ssize_t retval = 0; | 167 | ssize_t read = 0; |
168 | int retval; | ||
168 | 169 | ||
169 | if (serio_raw->dead) | 170 | if (serio_raw->dead) |
170 | return -ENODEV; | 171 | return -ENODEV; |
@@ -180,13 +181,15 @@ static ssize_t serio_raw_read(struct file *file, char __user *buffer, | |||
180 | if (serio_raw->dead) | 181 | if (serio_raw->dead) |
181 | return -ENODEV; | 182 | return -ENODEV; |
182 | 183 | ||
183 | while (retval < count && serio_raw_fetch_byte(serio_raw, &c)) { | 184 | while (read < count && serio_raw_fetch_byte(serio_raw, &c)) { |
184 | if (put_user(c, buffer++)) | 185 | if (put_user(c, buffer++)) { |
185 | return -EFAULT; | 186 | retval = -EFAULT; |
186 | retval++; | 187 | break; |
188 | } | ||
189 | read++; | ||
187 | } | 190 | } |
188 | 191 | ||
189 | return retval; | 192 | return read ?: retval; |
190 | } | 193 | } |
191 | 194 | ||
192 | static ssize_t serio_raw_write(struct file *file, const char __user *buffer, | 195 | static ssize_t serio_raw_write(struct file *file, const char __user *buffer, |
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index cce1f03b8895..f75e0608be5b 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c | |||
@@ -2863,6 +2863,9 @@ static unsigned device_dma_ops_init(void) | |||
2863 | 2863 | ||
2864 | for_each_pci_dev(pdev) { | 2864 | for_each_pci_dev(pdev) { |
2865 | if (!check_device(&pdev->dev)) { | 2865 | if (!check_device(&pdev->dev)) { |
2866 | |||
2867 | iommu_ignore_device(&pdev->dev); | ||
2868 | |||
2866 | unhandled += 1; | 2869 | unhandled += 1; |
2867 | continue; | 2870 | continue; |
2868 | } | 2871 | } |
diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c index 08a90b88e40d..cee307e86606 100644 --- a/drivers/iommu/msm_iommu.c +++ b/drivers/iommu/msm_iommu.c | |||
@@ -482,23 +482,19 @@ static size_t msm_iommu_unmap(struct iommu_domain *domain, unsigned long va, | |||
482 | 482 | ||
483 | priv = domain->priv; | 483 | priv = domain->priv; |
484 | 484 | ||
485 | if (!priv) { | 485 | if (!priv) |
486 | ret = -ENODEV; | ||
487 | goto fail; | 486 | goto fail; |
488 | } | ||
489 | 487 | ||
490 | fl_table = priv->pgtable; | 488 | fl_table = priv->pgtable; |
491 | 489 | ||
492 | if (len != SZ_16M && len != SZ_1M && | 490 | if (len != SZ_16M && len != SZ_1M && |
493 | len != SZ_64K && len != SZ_4K) { | 491 | len != SZ_64K && len != SZ_4K) { |
494 | pr_debug("Bad length: %d\n", len); | 492 | pr_debug("Bad length: %d\n", len); |
495 | ret = -EINVAL; | ||
496 | goto fail; | 493 | goto fail; |
497 | } | 494 | } |
498 | 495 | ||
499 | if (!fl_table) { | 496 | if (!fl_table) { |
500 | pr_debug("Null page table\n"); | 497 | pr_debug("Null page table\n"); |
501 | ret = -EINVAL; | ||
502 | goto fail; | 498 | goto fail; |
503 | } | 499 | } |
504 | 500 | ||
@@ -507,7 +503,6 @@ static size_t msm_iommu_unmap(struct iommu_domain *domain, unsigned long va, | |||
507 | 503 | ||
508 | if (*fl_pte == 0) { | 504 | if (*fl_pte == 0) { |
509 | pr_debug("First level PTE is 0\n"); | 505 | pr_debug("First level PTE is 0\n"); |
510 | ret = -ENODEV; | ||
511 | goto fail; | 506 | goto fail; |
512 | } | 507 | } |
513 | 508 | ||
diff --git a/drivers/leds/leds-lm3530.c b/drivers/leds/leds-lm3530.c index 45e6878d7374..e59c166a0ce2 100644 --- a/drivers/leds/leds-lm3530.c +++ b/drivers/leds/leds-lm3530.c | |||
@@ -164,8 +164,8 @@ static int lm3530_init_registers(struct lm3530_data *drvdata) | |||
164 | 164 | ||
165 | if (drvdata->mode == LM3530_BL_MODE_ALS) { | 165 | if (drvdata->mode == LM3530_BL_MODE_ALS) { |
166 | if (pltfm->als_vmax == 0) { | 166 | if (pltfm->als_vmax == 0) { |
167 | pltfm->als_vmin = als_vmin = 0; | 167 | pltfm->als_vmin = 0; |
168 | pltfm->als_vmin = als_vmax = LM3530_ALS_WINDOW_mV; | 168 | pltfm->als_vmax = LM3530_ALS_WINDOW_mV; |
169 | } | 169 | } |
170 | 170 | ||
171 | als_vmin = pltfm->als_vmin; | 171 | als_vmin = pltfm->als_vmin; |
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index c2907d836e4e..86cb7e5d83d5 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c | |||
@@ -56,7 +56,8 @@ struct raid_dev { | |||
56 | struct raid_set { | 56 | struct raid_set { |
57 | struct dm_target *ti; | 57 | struct dm_target *ti; |
58 | 58 | ||
59 | uint64_t print_flags; | 59 | uint32_t bitmap_loaded; |
60 | uint32_t print_flags; | ||
60 | 61 | ||
61 | struct mddev md; | 62 | struct mddev md; |
62 | struct raid_type *raid_type; | 63 | struct raid_type *raid_type; |
@@ -1085,7 +1086,7 @@ static int raid_status(struct dm_target *ti, status_type_t type, | |||
1085 | raid_param_cnt += 2; | 1086 | raid_param_cnt += 2; |
1086 | } | 1087 | } |
1087 | 1088 | ||
1088 | raid_param_cnt += (hweight64(rs->print_flags & ~DMPF_REBUILD) * 2); | 1089 | raid_param_cnt += (hweight32(rs->print_flags & ~DMPF_REBUILD) * 2); |
1089 | if (rs->print_flags & (DMPF_SYNC | DMPF_NOSYNC)) | 1090 | if (rs->print_flags & (DMPF_SYNC | DMPF_NOSYNC)) |
1090 | raid_param_cnt--; | 1091 | raid_param_cnt--; |
1091 | 1092 | ||
@@ -1197,7 +1198,12 @@ static void raid_resume(struct dm_target *ti) | |||
1197 | { | 1198 | { |
1198 | struct raid_set *rs = ti->private; | 1199 | struct raid_set *rs = ti->private; |
1199 | 1200 | ||
1200 | bitmap_load(&rs->md); | 1201 | if (!rs->bitmap_loaded) { |
1202 | bitmap_load(&rs->md); | ||
1203 | rs->bitmap_loaded = 1; | ||
1204 | } else | ||
1205 | md_wakeup_thread(rs->md.thread); | ||
1206 | |||
1201 | mddev_resume(&rs->md); | 1207 | mddev_resume(&rs->md); |
1202 | } | 1208 | } |
1203 | 1209 | ||
diff --git a/drivers/md/md.c b/drivers/md/md.c index 9417ae2fa0bb..ce88755baf4a 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -7333,7 +7333,8 @@ void md_do_sync(struct mddev *mddev) | |||
7333 | printk(KERN_INFO | 7333 | printk(KERN_INFO |
7334 | "md: checkpointing %s of %s.\n", | 7334 | "md: checkpointing %s of %s.\n", |
7335 | desc, mdname(mddev)); | 7335 | desc, mdname(mddev)); |
7336 | mddev->recovery_cp = mddev->curr_resync; | 7336 | mddev->recovery_cp = |
7337 | mddev->curr_resync_completed; | ||
7337 | } | 7338 | } |
7338 | } else | 7339 | } else |
7339 | mddev->recovery_cp = MaxSector; | 7340 | mddev->recovery_cp = MaxSector; |
@@ -7351,9 +7352,9 @@ void md_do_sync(struct mddev *mddev) | |||
7351 | rcu_read_unlock(); | 7352 | rcu_read_unlock(); |
7352 | } | 7353 | } |
7353 | } | 7354 | } |
7355 | skip: | ||
7354 | set_bit(MD_CHANGE_DEVS, &mddev->flags); | 7356 | set_bit(MD_CHANGE_DEVS, &mddev->flags); |
7355 | 7357 | ||
7356 | skip: | ||
7357 | if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery)) { | 7358 | if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery)) { |
7358 | /* We completed so min/max setting can be forgotten if used. */ | 7359 | /* We completed so min/max setting can be forgotten if used. */ |
7359 | if (test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) | 7360 | if (test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) |
diff --git a/drivers/mfd/twl6040-core.c b/drivers/mfd/twl6040-core.c index dda86293dc9f..b2d8e512d3cb 100644 --- a/drivers/mfd/twl6040-core.c +++ b/drivers/mfd/twl6040-core.c | |||
@@ -282,6 +282,7 @@ int twl6040_power(struct twl6040 *twl6040, int on) | |||
282 | /* Default PLL configuration after power up */ | 282 | /* Default PLL configuration after power up */ |
283 | twl6040->pll = TWL6040_SYSCLK_SEL_LPPLL; | 283 | twl6040->pll = TWL6040_SYSCLK_SEL_LPPLL; |
284 | twl6040->sysclk = 19200000; | 284 | twl6040->sysclk = 19200000; |
285 | twl6040->mclk = 32768; | ||
285 | } else { | 286 | } else { |
286 | /* already powered-down */ | 287 | /* already powered-down */ |
287 | if (!twl6040->power_count) { | 288 | if (!twl6040->power_count) { |
@@ -305,6 +306,7 @@ int twl6040_power(struct twl6040 *twl6040, int on) | |||
305 | twl6040_power_down(twl6040); | 306 | twl6040_power_down(twl6040); |
306 | } | 307 | } |
307 | twl6040->sysclk = 0; | 308 | twl6040->sysclk = 0; |
309 | twl6040->mclk = 0; | ||
308 | } | 310 | } |
309 | 311 | ||
310 | out: | 312 | out: |
@@ -324,23 +326,38 @@ int twl6040_set_pll(struct twl6040 *twl6040, int pll_id, | |||
324 | hppllctl = twl6040_reg_read(twl6040, TWL6040_REG_HPPLLCTL); | 326 | hppllctl = twl6040_reg_read(twl6040, TWL6040_REG_HPPLLCTL); |
325 | lppllctl = twl6040_reg_read(twl6040, TWL6040_REG_LPPLLCTL); | 327 | lppllctl = twl6040_reg_read(twl6040, TWL6040_REG_LPPLLCTL); |
326 | 328 | ||
329 | /* Force full reconfiguration when switching between PLL */ | ||
330 | if (pll_id != twl6040->pll) { | ||
331 | twl6040->sysclk = 0; | ||
332 | twl6040->mclk = 0; | ||
333 | } | ||
334 | |||
327 | switch (pll_id) { | 335 | switch (pll_id) { |
328 | case TWL6040_SYSCLK_SEL_LPPLL: | 336 | case TWL6040_SYSCLK_SEL_LPPLL: |
329 | /* low-power PLL divider */ | 337 | /* low-power PLL divider */ |
330 | switch (freq_out) { | 338 | /* Change the sysclk configuration only if it has been canged */ |
331 | case 17640000: | 339 | if (twl6040->sysclk != freq_out) { |
332 | lppllctl |= TWL6040_LPLLFIN; | 340 | switch (freq_out) { |
333 | break; | 341 | case 17640000: |
334 | case 19200000: | 342 | lppllctl |= TWL6040_LPLLFIN; |
335 | lppllctl &= ~TWL6040_LPLLFIN; | 343 | break; |
336 | break; | 344 | case 19200000: |
337 | default: | 345 | lppllctl &= ~TWL6040_LPLLFIN; |
338 | dev_err(twl6040->dev, | 346 | break; |
339 | "freq_out %d not supported\n", freq_out); | 347 | default: |
340 | ret = -EINVAL; | 348 | dev_err(twl6040->dev, |
341 | goto pll_out; | 349 | "freq_out %d not supported\n", |
350 | freq_out); | ||
351 | ret = -EINVAL; | ||
352 | goto pll_out; | ||
353 | } | ||
354 | twl6040_reg_write(twl6040, TWL6040_REG_LPPLLCTL, | ||
355 | lppllctl); | ||
342 | } | 356 | } |
343 | twl6040_reg_write(twl6040, TWL6040_REG_LPPLLCTL, lppllctl); | 357 | |
358 | /* The PLL in use has not been change, we can exit */ | ||
359 | if (twl6040->pll == pll_id) | ||
360 | break; | ||
344 | 361 | ||
345 | switch (freq_in) { | 362 | switch (freq_in) { |
346 | case 32768: | 363 | case 32768: |
@@ -371,48 +388,56 @@ int twl6040_set_pll(struct twl6040 *twl6040, int pll_id, | |||
371 | goto pll_out; | 388 | goto pll_out; |
372 | } | 389 | } |
373 | 390 | ||
374 | hppllctl &= ~TWL6040_MCLK_MSK; | 391 | if (twl6040->mclk != freq_in) { |
392 | hppllctl &= ~TWL6040_MCLK_MSK; | ||
393 | |||
394 | switch (freq_in) { | ||
395 | case 12000000: | ||
396 | /* PLL enabled, active mode */ | ||
397 | hppllctl |= TWL6040_MCLK_12000KHZ | | ||
398 | TWL6040_HPLLENA; | ||
399 | break; | ||
400 | case 19200000: | ||
401 | /* | ||
402 | * PLL disabled | ||
403 | * (enable PLL if MCLK jitter quality | ||
404 | * doesn't meet specification) | ||
405 | */ | ||
406 | hppllctl |= TWL6040_MCLK_19200KHZ; | ||
407 | break; | ||
408 | case 26000000: | ||
409 | /* PLL enabled, active mode */ | ||
410 | hppllctl |= TWL6040_MCLK_26000KHZ | | ||
411 | TWL6040_HPLLENA; | ||
412 | break; | ||
413 | case 38400000: | ||
414 | /* PLL enabled, active mode */ | ||
415 | hppllctl |= TWL6040_MCLK_38400KHZ | | ||
416 | TWL6040_HPLLENA; | ||
417 | break; | ||
418 | default: | ||
419 | dev_err(twl6040->dev, | ||
420 | "freq_in %d not supported\n", freq_in); | ||
421 | ret = -EINVAL; | ||
422 | goto pll_out; | ||
423 | } | ||
375 | 424 | ||
376 | switch (freq_in) { | ||
377 | case 12000000: | ||
378 | /* PLL enabled, active mode */ | ||
379 | hppllctl |= TWL6040_MCLK_12000KHZ | | ||
380 | TWL6040_HPLLENA; | ||
381 | break; | ||
382 | case 19200000: | ||
383 | /* | 425 | /* |
384 | * PLL disabled | 426 | * enable clock slicer to ensure input waveform is |
385 | * (enable PLL if MCLK jitter quality | 427 | * square |
386 | * doesn't meet specification) | ||
387 | */ | 428 | */ |
388 | hppllctl |= TWL6040_MCLK_19200KHZ; | 429 | hppllctl |= TWL6040_HPLLSQRENA; |
389 | break; | ||
390 | case 26000000: | ||
391 | /* PLL enabled, active mode */ | ||
392 | hppllctl |= TWL6040_MCLK_26000KHZ | | ||
393 | TWL6040_HPLLENA; | ||
394 | break; | ||
395 | case 38400000: | ||
396 | /* PLL enabled, active mode */ | ||
397 | hppllctl |= TWL6040_MCLK_38400KHZ | | ||
398 | TWL6040_HPLLENA; | ||
399 | break; | ||
400 | default: | ||
401 | dev_err(twl6040->dev, | ||
402 | "freq_in %d not supported\n", freq_in); | ||
403 | ret = -EINVAL; | ||
404 | goto pll_out; | ||
405 | } | ||
406 | 430 | ||
407 | /* enable clock slicer to ensure input waveform is square */ | 431 | twl6040_reg_write(twl6040, TWL6040_REG_HPPLLCTL, |
408 | hppllctl |= TWL6040_HPLLSQRENA; | 432 | hppllctl); |
409 | 433 | usleep_range(500, 700); | |
410 | twl6040_reg_write(twl6040, TWL6040_REG_HPPLLCTL, hppllctl); | 434 | lppllctl |= TWL6040_HPLLSEL; |
411 | usleep_range(500, 700); | 435 | twl6040_reg_write(twl6040, TWL6040_REG_LPPLLCTL, |
412 | lppllctl |= TWL6040_HPLLSEL; | 436 | lppllctl); |
413 | twl6040_reg_write(twl6040, TWL6040_REG_LPPLLCTL, lppllctl); | 437 | lppllctl &= ~TWL6040_LPLLENA; |
414 | lppllctl &= ~TWL6040_LPLLENA; | 438 | twl6040_reg_write(twl6040, TWL6040_REG_LPPLLCTL, |
415 | twl6040_reg_write(twl6040, TWL6040_REG_LPPLLCTL, lppllctl); | 439 | lppllctl); |
440 | } | ||
416 | break; | 441 | break; |
417 | default: | 442 | default: |
418 | dev_err(twl6040->dev, "unknown pll id %d\n", pll_id); | 443 | dev_err(twl6040->dev, "unknown pll id %d\n", pll_id); |
@@ -421,6 +446,7 @@ int twl6040_set_pll(struct twl6040 *twl6040, int pll_id, | |||
421 | } | 446 | } |
422 | 447 | ||
423 | twl6040->sysclk = freq_out; | 448 | twl6040->sysclk = freq_out; |
449 | twl6040->mclk = freq_in; | ||
424 | twl6040->pll = pll_id; | 450 | twl6040->pll = pll_id; |
425 | 451 | ||
426 | pll_out: | 452 | pll_out: |
diff --git a/drivers/misc/lkdtm.c b/drivers/misc/lkdtm.c index 150cd7061b80..28adefe70f96 100644 --- a/drivers/misc/lkdtm.c +++ b/drivers/misc/lkdtm.c | |||
@@ -354,6 +354,7 @@ static void lkdtm_do_action(enum ctype which) | |||
354 | static void lkdtm_handler(void) | 354 | static void lkdtm_handler(void) |
355 | { | 355 | { |
356 | unsigned long flags; | 356 | unsigned long flags; |
357 | bool do_it = false; | ||
357 | 358 | ||
358 | spin_lock_irqsave(&count_lock, flags); | 359 | spin_lock_irqsave(&count_lock, flags); |
359 | count--; | 360 | count--; |
@@ -361,10 +362,13 @@ static void lkdtm_handler(void) | |||
361 | cp_name_to_str(cpoint), cp_type_to_str(cptype), count); | 362 | cp_name_to_str(cpoint), cp_type_to_str(cptype), count); |
362 | 363 | ||
363 | if (count == 0) { | 364 | if (count == 0) { |
364 | lkdtm_do_action(cptype); | 365 | do_it = true; |
365 | count = cpoint_count; | 366 | count = cpoint_count; |
366 | } | 367 | } |
367 | spin_unlock_irqrestore(&count_lock, flags); | 368 | spin_unlock_irqrestore(&count_lock, flags); |
369 | |||
370 | if (do_it) | ||
371 | lkdtm_do_action(cptype); | ||
368 | } | 372 | } |
369 | 373 | ||
370 | static int lkdtm_register_cpoint(enum cname which) | 374 | static int lkdtm_register_cpoint(enum cname which) |
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 6ae9ca01388b..9a9ce71a71fc 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c | |||
@@ -119,7 +119,7 @@ static int mtd_cls_suspend(struct device *dev, pm_message_t state) | |||
119 | { | 119 | { |
120 | struct mtd_info *mtd = dev_get_drvdata(dev); | 120 | struct mtd_info *mtd = dev_get_drvdata(dev); |
121 | 121 | ||
122 | return mtd_suspend(mtd); | 122 | return mtd ? mtd_suspend(mtd) : 0; |
123 | } | 123 | } |
124 | 124 | ||
125 | static int mtd_cls_resume(struct device *dev) | 125 | static int mtd_cls_resume(struct device *dev) |
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index 4dd056e2e16a..35b4fb55dbd6 100644 --- a/drivers/mtd/nand/atmel_nand.c +++ b/drivers/mtd/nand/atmel_nand.c | |||
@@ -161,6 +161,37 @@ static int atmel_nand_device_ready(struct mtd_info *mtd) | |||
161 | !!host->board->rdy_pin_active_low; | 161 | !!host->board->rdy_pin_active_low; |
162 | } | 162 | } |
163 | 163 | ||
164 | /* | ||
165 | * Minimal-overhead PIO for data access. | ||
166 | */ | ||
167 | static void atmel_read_buf8(struct mtd_info *mtd, u8 *buf, int len) | ||
168 | { | ||
169 | struct nand_chip *nand_chip = mtd->priv; | ||
170 | |||
171 | __raw_readsb(nand_chip->IO_ADDR_R, buf, len); | ||
172 | } | ||
173 | |||
174 | static void atmel_read_buf16(struct mtd_info *mtd, u8 *buf, int len) | ||
175 | { | ||
176 | struct nand_chip *nand_chip = mtd->priv; | ||
177 | |||
178 | __raw_readsw(nand_chip->IO_ADDR_R, buf, len / 2); | ||
179 | } | ||
180 | |||
181 | static void atmel_write_buf8(struct mtd_info *mtd, const u8 *buf, int len) | ||
182 | { | ||
183 | struct nand_chip *nand_chip = mtd->priv; | ||
184 | |||
185 | __raw_writesb(nand_chip->IO_ADDR_W, buf, len); | ||
186 | } | ||
187 | |||
188 | static void atmel_write_buf16(struct mtd_info *mtd, const u8 *buf, int len) | ||
189 | { | ||
190 | struct nand_chip *nand_chip = mtd->priv; | ||
191 | |||
192 | __raw_writesw(nand_chip->IO_ADDR_W, buf, len / 2); | ||
193 | } | ||
194 | |||
164 | static void dma_complete_func(void *completion) | 195 | static void dma_complete_func(void *completion) |
165 | { | 196 | { |
166 | complete(completion); | 197 | complete(completion); |
@@ -235,27 +266,33 @@ err_buf: | |||
235 | static void atmel_read_buf(struct mtd_info *mtd, u8 *buf, int len) | 266 | static void atmel_read_buf(struct mtd_info *mtd, u8 *buf, int len) |
236 | { | 267 | { |
237 | struct nand_chip *chip = mtd->priv; | 268 | struct nand_chip *chip = mtd->priv; |
269 | struct atmel_nand_host *host = chip->priv; | ||
238 | 270 | ||
239 | if (use_dma && len > mtd->oobsize) | 271 | if (use_dma && len > mtd->oobsize) |
240 | /* only use DMA for bigger than oob size: better performances */ | 272 | /* only use DMA for bigger than oob size: better performances */ |
241 | if (atmel_nand_dma_op(mtd, buf, len, 1) == 0) | 273 | if (atmel_nand_dma_op(mtd, buf, len, 1) == 0) |
242 | return; | 274 | return; |
243 | 275 | ||
244 | /* if no DMA operation possible, use PIO */ | 276 | if (host->board->bus_width_16) |
245 | memcpy_fromio(buf, chip->IO_ADDR_R, len); | 277 | atmel_read_buf16(mtd, buf, len); |
278 | else | ||
279 | atmel_read_buf8(mtd, buf, len); | ||
246 | } | 280 | } |
247 | 281 | ||
248 | static void atmel_write_buf(struct mtd_info *mtd, const u8 *buf, int len) | 282 | static void atmel_write_buf(struct mtd_info *mtd, const u8 *buf, int len) |
249 | { | 283 | { |
250 | struct nand_chip *chip = mtd->priv; | 284 | struct nand_chip *chip = mtd->priv; |
285 | struct atmel_nand_host *host = chip->priv; | ||
251 | 286 | ||
252 | if (use_dma && len > mtd->oobsize) | 287 | if (use_dma && len > mtd->oobsize) |
253 | /* only use DMA for bigger than oob size: better performances */ | 288 | /* only use DMA for bigger than oob size: better performances */ |
254 | if (atmel_nand_dma_op(mtd, (void *)buf, len, 0) == 0) | 289 | if (atmel_nand_dma_op(mtd, (void *)buf, len, 0) == 0) |
255 | return; | 290 | return; |
256 | 291 | ||
257 | /* if no DMA operation possible, use PIO */ | 292 | if (host->board->bus_width_16) |
258 | memcpy_toio(chip->IO_ADDR_W, buf, len); | 293 | atmel_write_buf16(mtd, buf, len); |
294 | else | ||
295 | atmel_write_buf8(mtd, buf, len); | ||
259 | } | 296 | } |
260 | 297 | ||
261 | /* | 298 | /* |
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c index 7f680420bfab..7db6555ed3ba 100644 --- a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c +++ b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c | |||
@@ -69,17 +69,19 @@ static int clear_poll_bit(void __iomem *addr, u32 mask) | |||
69 | * [1] enable the module. | 69 | * [1] enable the module. |
70 | * [2] reset the module. | 70 | * [2] reset the module. |
71 | * | 71 | * |
72 | * In most of the cases, it's ok. But there is a hardware bug in the BCH block. | 72 | * In most of the cases, it's ok. |
73 | * But in MX23, there is a hardware bug in the BCH block (see erratum #2847). | ||
73 | * If you try to soft reset the BCH block, it becomes unusable until | 74 | * If you try to soft reset the BCH block, it becomes unusable until |
74 | * the next hard reset. This case occurs in the NAND boot mode. When the board | 75 | * the next hard reset. This case occurs in the NAND boot mode. When the board |
75 | * boots by NAND, the ROM of the chip will initialize the BCH blocks itself. | 76 | * boots by NAND, the ROM of the chip will initialize the BCH blocks itself. |
76 | * So If the driver tries to reset the BCH again, the BCH will not work anymore. | 77 | * So If the driver tries to reset the BCH again, the BCH will not work anymore. |
77 | * You will see a DMA timeout in this case. | 78 | * You will see a DMA timeout in this case. The bug has been fixed |
79 | * in the following chips, such as MX28. | ||
78 | * | 80 | * |
79 | * To avoid this bug, just add a new parameter `just_enable` for | 81 | * To avoid this bug, just add a new parameter `just_enable` for |
80 | * the mxs_reset_block(), and rewrite it here. | 82 | * the mxs_reset_block(), and rewrite it here. |
81 | */ | 83 | */ |
82 | int gpmi_reset_block(void __iomem *reset_addr, bool just_enable) | 84 | static int gpmi_reset_block(void __iomem *reset_addr, bool just_enable) |
83 | { | 85 | { |
84 | int ret; | 86 | int ret; |
85 | int timeout = 0x400; | 87 | int timeout = 0x400; |
@@ -206,7 +208,15 @@ int bch_set_geometry(struct gpmi_nand_data *this) | |||
206 | if (ret) | 208 | if (ret) |
207 | goto err_out; | 209 | goto err_out; |
208 | 210 | ||
209 | ret = gpmi_reset_block(r->bch_regs, true); | 211 | /* |
212 | * Due to erratum #2847 of the MX23, the BCH cannot be soft reset on this | ||
213 | * chip, otherwise it will lock up. So we skip resetting BCH on the MX23. | ||
214 | * On the other hand, the MX28 needs the reset, because one case has been | ||
215 | * seen where the BCH produced ECC errors constantly after 10000 | ||
216 | * consecutive reboots. The latter case has not been seen on the MX23 yet, | ||
217 | * still we don't know if it could happen there as well. | ||
218 | */ | ||
219 | ret = gpmi_reset_block(r->bch_regs, GPMI_IS_MX23(this)); | ||
210 | if (ret) | 220 | if (ret) |
211 | goto err_out; | 221 | goto err_out; |
212 | 222 | ||
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 35b4565050f1..8a393f9e6027 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -2588,7 +2588,7 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, | |||
2588 | instr->state = MTD_ERASING; | 2588 | instr->state = MTD_ERASING; |
2589 | 2589 | ||
2590 | while (len) { | 2590 | while (len) { |
2591 | /* Heck if we have a bad block, we do not erase bad blocks! */ | 2591 | /* Check if we have a bad block, we do not erase bad blocks! */ |
2592 | if (nand_block_checkbad(mtd, ((loff_t) page) << | 2592 | if (nand_block_checkbad(mtd, ((loff_t) page) << |
2593 | chip->page_shift, 0, allowbbt)) { | 2593 | chip->page_shift, 0, allowbbt)) { |
2594 | pr_warn("%s: attempt to erase a bad block at page 0x%08x\n", | 2594 | pr_warn("%s: attempt to erase a bad block at page 0x%08x\n", |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 749c2a16012c..1932029de48d 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -1269,10 +1269,8 @@ static int pcmcia_bus_add(struct pcmcia_socket *skt) | |||
1269 | 1269 | ||
1270 | static int pcmcia_bus_early_resume(struct pcmcia_socket *skt) | 1270 | static int pcmcia_bus_early_resume(struct pcmcia_socket *skt) |
1271 | { | 1271 | { |
1272 | if (!verify_cis_cache(skt)) { | 1272 | if (!verify_cis_cache(skt)) |
1273 | pcmcia_put_socket(skt); | ||
1274 | return 0; | 1273 | return 0; |
1275 | } | ||
1276 | 1274 | ||
1277 | dev_dbg(&skt->dev, "cis mismatch - different card\n"); | 1275 | dev_dbg(&skt->dev, "cis mismatch - different card\n"); |
1278 | 1276 | ||
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 3f9a47ec67dc..8293658e7cf9 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig | |||
@@ -299,7 +299,7 @@ config SPI_S3C24XX_FIQ | |||
299 | 299 | ||
300 | config SPI_S3C64XX | 300 | config SPI_S3C64XX |
301 | tristate "Samsung S3C64XX series type SPI" | 301 | tristate "Samsung S3C64XX series type SPI" |
302 | depends on (ARCH_S3C64XX || ARCH_S5P64X0) | 302 | depends on (ARCH_S3C64XX || ARCH_S5P64X0 || ARCH_EXYNOS) |
303 | select S3C64XX_DMA if ARCH_S3C64XX | 303 | select S3C64XX_DMA if ARCH_S3C64XX |
304 | help | 304 | help |
305 | SPI driver for Samsung S3C64XX and newer SoCs. | 305 | SPI driver for Samsung S3C64XX and newer SoCs. |
diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c index 2a6429d8c363..10182eb50068 100644 --- a/drivers/spi/spi-topcliff-pch.c +++ b/drivers/spi/spi-topcliff-pch.c | |||
@@ -1720,7 +1720,7 @@ static int pch_spi_resume(struct pci_dev *pdev) | |||
1720 | 1720 | ||
1721 | #endif | 1721 | #endif |
1722 | 1722 | ||
1723 | static struct pci_driver pch_spi_pcidev = { | 1723 | static struct pci_driver pch_spi_pcidev_driver = { |
1724 | .name = "pch_spi", | 1724 | .name = "pch_spi", |
1725 | .id_table = pch_spi_pcidev_id, | 1725 | .id_table = pch_spi_pcidev_id, |
1726 | .probe = pch_spi_probe, | 1726 | .probe = pch_spi_probe, |
@@ -1736,7 +1736,7 @@ static int __init pch_spi_init(void) | |||
1736 | if (ret) | 1736 | if (ret) |
1737 | return ret; | 1737 | return ret; |
1738 | 1738 | ||
1739 | ret = pci_register_driver(&pch_spi_pcidev); | 1739 | ret = pci_register_driver(&pch_spi_pcidev_driver); |
1740 | if (ret) | 1740 | if (ret) |
1741 | return ret; | 1741 | return ret; |
1742 | 1742 | ||
@@ -1746,7 +1746,7 @@ module_init(pch_spi_init); | |||
1746 | 1746 | ||
1747 | static void __exit pch_spi_exit(void) | 1747 | static void __exit pch_spi_exit(void) |
1748 | { | 1748 | { |
1749 | pci_unregister_driver(&pch_spi_pcidev); | 1749 | pci_unregister_driver(&pch_spi_pcidev_driver); |
1750 | platform_driver_unregister(&pch_spi_pd_driver); | 1750 | platform_driver_unregister(&pch_spi_pd_driver); |
1751 | } | 1751 | } |
1752 | module_exit(pch_spi_exit); | 1752 | module_exit(pch_spi_exit); |
diff --git a/drivers/staging/media/go7007/go7007-usb.c b/drivers/staging/media/go7007/go7007-usb.c index 70e006b50f29..5443e25086e9 100644 --- a/drivers/staging/media/go7007/go7007-usb.c +++ b/drivers/staging/media/go7007/go7007-usb.c | |||
@@ -1279,3 +1279,4 @@ static struct usb_driver go7007_usb_driver = { | |||
1279 | }; | 1279 | }; |
1280 | 1280 | ||
1281 | module_usb_driver(go7007_usb_driver); | 1281 | module_usb_driver(go7007_usb_driver); |
1282 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index ac44af165b27..44262908def5 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -1061,7 +1061,7 @@ attach_cmd: | |||
1061 | if (ret < 0) | 1061 | if (ret < 0) |
1062 | return iscsit_add_reject_from_cmd( | 1062 | return iscsit_add_reject_from_cmd( |
1063 | ISCSI_REASON_BOOKMARK_NO_RESOURCES, | 1063 | ISCSI_REASON_BOOKMARK_NO_RESOURCES, |
1064 | 1, 1, buf, cmd); | 1064 | 1, 0, buf, cmd); |
1065 | /* | 1065 | /* |
1066 | * Check the CmdSN against ExpCmdSN/MaxCmdSN here if | 1066 | * Check the CmdSN against ExpCmdSN/MaxCmdSN here if |
1067 | * the Immediate Bit is not set, and no Immediate | 1067 | * the Immediate Bit is not set, and no Immediate |
@@ -3164,6 +3164,30 @@ static int iscsit_send_task_mgt_rsp( | |||
3164 | return 0; | 3164 | return 0; |
3165 | } | 3165 | } |
3166 | 3166 | ||
3167 | static bool iscsit_check_inaddr_any(struct iscsi_np *np) | ||
3168 | { | ||
3169 | bool ret = false; | ||
3170 | |||
3171 | if (np->np_sockaddr.ss_family == AF_INET6) { | ||
3172 | const struct sockaddr_in6 sin6 = { | ||
3173 | .sin6_addr = IN6ADDR_ANY_INIT }; | ||
3174 | struct sockaddr_in6 *sock_in6 = | ||
3175 | (struct sockaddr_in6 *)&np->np_sockaddr; | ||
3176 | |||
3177 | if (!memcmp(sock_in6->sin6_addr.s6_addr, | ||
3178 | sin6.sin6_addr.s6_addr, 16)) | ||
3179 | ret = true; | ||
3180 | } else { | ||
3181 | struct sockaddr_in * sock_in = | ||
3182 | (struct sockaddr_in *)&np->np_sockaddr; | ||
3183 | |||
3184 | if (sock_in->sin_addr.s_addr == INADDR_ANY) | ||
3185 | ret = true; | ||
3186 | } | ||
3187 | |||
3188 | return ret; | ||
3189 | } | ||
3190 | |||
3167 | static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd) | 3191 | static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd) |
3168 | { | 3192 | { |
3169 | char *payload = NULL; | 3193 | char *payload = NULL; |
@@ -3213,12 +3237,17 @@ static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd) | |||
3213 | spin_lock(&tpg->tpg_np_lock); | 3237 | spin_lock(&tpg->tpg_np_lock); |
3214 | list_for_each_entry(tpg_np, &tpg->tpg_gnp_list, | 3238 | list_for_each_entry(tpg_np, &tpg->tpg_gnp_list, |
3215 | tpg_np_list) { | 3239 | tpg_np_list) { |
3240 | struct iscsi_np *np = tpg_np->tpg_np; | ||
3241 | bool inaddr_any = iscsit_check_inaddr_any(np); | ||
3242 | |||
3216 | len = sprintf(buf, "TargetAddress=" | 3243 | len = sprintf(buf, "TargetAddress=" |
3217 | "%s%s%s:%hu,%hu", | 3244 | "%s%s%s:%hu,%hu", |
3218 | (tpg_np->tpg_np->np_sockaddr.ss_family == AF_INET6) ? | 3245 | (np->np_sockaddr.ss_family == AF_INET6) ? |
3219 | "[" : "", tpg_np->tpg_np->np_ip, | 3246 | "[" : "", (inaddr_any == false) ? |
3220 | (tpg_np->tpg_np->np_sockaddr.ss_family == AF_INET6) ? | 3247 | np->np_ip : conn->local_ip, |
3221 | "]" : "", tpg_np->tpg_np->np_port, | 3248 | (np->np_sockaddr.ss_family == AF_INET6) ? |
3249 | "]" : "", (inaddr_any == false) ? | ||
3250 | np->np_port : conn->local_port, | ||
3222 | tpg->tpgt); | 3251 | tpg->tpgt); |
3223 | len += 1; | 3252 | len += 1; |
3224 | 3253 | ||
diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c index 3468caab47a2..6b35b37988ed 100644 --- a/drivers/target/iscsi/iscsi_target_configfs.c +++ b/drivers/target/iscsi/iscsi_target_configfs.c | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | #include <linux/configfs.h> | 22 | #include <linux/configfs.h> |
23 | #include <linux/export.h> | 23 | #include <linux/export.h> |
24 | #include <linux/inet.h> | ||
24 | #include <target/target_core_base.h> | 25 | #include <target/target_core_base.h> |
25 | #include <target/target_core_fabric.h> | 26 | #include <target/target_core_fabric.h> |
26 | #include <target/target_core_fabric_configfs.h> | 27 | #include <target/target_core_fabric_configfs.h> |
diff --git a/drivers/target/iscsi/iscsi_target_core.h b/drivers/target/iscsi/iscsi_target_core.h index f1a02dad05a0..0ec3b77a0c27 100644 --- a/drivers/target/iscsi/iscsi_target_core.h +++ b/drivers/target/iscsi/iscsi_target_core.h | |||
@@ -508,6 +508,7 @@ struct iscsi_conn { | |||
508 | u16 cid; | 508 | u16 cid; |
509 | /* Remote TCP Port */ | 509 | /* Remote TCP Port */ |
510 | u16 login_port; | 510 | u16 login_port; |
511 | u16 local_port; | ||
511 | int net_size; | 512 | int net_size; |
512 | u32 auth_id; | 513 | u32 auth_id; |
513 | #define CONNFLAG_SCTP_STRUCT_FILE 0x01 | 514 | #define CONNFLAG_SCTP_STRUCT_FILE 0x01 |
@@ -527,6 +528,7 @@ struct iscsi_conn { | |||
527 | unsigned char bad_hdr[ISCSI_HDR_LEN]; | 528 | unsigned char bad_hdr[ISCSI_HDR_LEN]; |
528 | #define IPV6_ADDRESS_SPACE 48 | 529 | #define IPV6_ADDRESS_SPACE 48 |
529 | unsigned char login_ip[IPV6_ADDRESS_SPACE]; | 530 | unsigned char login_ip[IPV6_ADDRESS_SPACE]; |
531 | unsigned char local_ip[IPV6_ADDRESS_SPACE]; | ||
530 | int conn_usage_count; | 532 | int conn_usage_count; |
531 | int conn_waiting_on_uc; | 533 | int conn_waiting_on_uc; |
532 | atomic_t check_immediate_queue; | 534 | atomic_t check_immediate_queue; |
@@ -561,8 +563,8 @@ struct iscsi_conn { | |||
561 | struct hash_desc conn_tx_hash; | 563 | struct hash_desc conn_tx_hash; |
562 | /* Used for scheduling TX and RX connection kthreads */ | 564 | /* Used for scheduling TX and RX connection kthreads */ |
563 | cpumask_var_t conn_cpumask; | 565 | cpumask_var_t conn_cpumask; |
564 | int conn_rx_reset_cpumask:1; | 566 | unsigned int conn_rx_reset_cpumask:1; |
565 | int conn_tx_reset_cpumask:1; | 567 | unsigned int conn_tx_reset_cpumask:1; |
566 | /* list_head of struct iscsi_cmd for this connection */ | 568 | /* list_head of struct iscsi_cmd for this connection */ |
567 | struct list_head conn_cmd_list; | 569 | struct list_head conn_cmd_list; |
568 | struct list_head immed_queue_list; | 570 | struct list_head immed_queue_list; |
diff --git a/drivers/target/iscsi/iscsi_target_erl1.c b/drivers/target/iscsi/iscsi_target_erl1.c index 255c0d67e898..27901e37c125 100644 --- a/drivers/target/iscsi/iscsi_target_erl1.c +++ b/drivers/target/iscsi/iscsi_target_erl1.c | |||
@@ -1238,7 +1238,7 @@ void iscsit_mod_dataout_timer(struct iscsi_cmd *cmd) | |||
1238 | { | 1238 | { |
1239 | struct iscsi_conn *conn = cmd->conn; | 1239 | struct iscsi_conn *conn = cmd->conn; |
1240 | struct iscsi_session *sess = conn->sess; | 1240 | struct iscsi_session *sess = conn->sess; |
1241 | struct iscsi_node_attrib *na = na = iscsit_tpg_get_node_attrib(sess); | 1241 | struct iscsi_node_attrib *na = iscsit_tpg_get_node_attrib(sess); |
1242 | 1242 | ||
1243 | spin_lock_bh(&cmd->dataout_timeout_lock); | 1243 | spin_lock_bh(&cmd->dataout_timeout_lock); |
1244 | if (!(cmd->dataout_timer_flags & ISCSI_TF_RUNNING)) { | 1244 | if (!(cmd->dataout_timer_flags & ISCSI_TF_RUNNING)) { |
@@ -1261,7 +1261,7 @@ void iscsit_start_dataout_timer( | |||
1261 | struct iscsi_conn *conn) | 1261 | struct iscsi_conn *conn) |
1262 | { | 1262 | { |
1263 | struct iscsi_session *sess = conn->sess; | 1263 | struct iscsi_session *sess = conn->sess; |
1264 | struct iscsi_node_attrib *na = na = iscsit_tpg_get_node_attrib(sess); | 1264 | struct iscsi_node_attrib *na = iscsit_tpg_get_node_attrib(sess); |
1265 | 1265 | ||
1266 | if (cmd->dataout_timer_flags & ISCSI_TF_RUNNING) | 1266 | if (cmd->dataout_timer_flags & ISCSI_TF_RUNNING) |
1267 | return; | 1267 | return; |
diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c index 373b0cc6abd8..38cb7ce8469e 100644 --- a/drivers/target/iscsi/iscsi_target_login.c +++ b/drivers/target/iscsi/iscsi_target_login.c | |||
@@ -615,8 +615,8 @@ static int iscsi_post_login_handler( | |||
615 | } | 615 | } |
616 | 616 | ||
617 | pr_debug("iSCSI Login successful on CID: %hu from %s to" | 617 | pr_debug("iSCSI Login successful on CID: %hu from %s to" |
618 | " %s:%hu,%hu\n", conn->cid, conn->login_ip, np->np_ip, | 618 | " %s:%hu,%hu\n", conn->cid, conn->login_ip, |
619 | np->np_port, tpg->tpgt); | 619 | conn->local_ip, conn->local_port, tpg->tpgt); |
620 | 620 | ||
621 | list_add_tail(&conn->conn_list, &sess->sess_conn_list); | 621 | list_add_tail(&conn->conn_list, &sess->sess_conn_list); |
622 | atomic_inc(&sess->nconn); | 622 | atomic_inc(&sess->nconn); |
@@ -658,7 +658,8 @@ static int iscsi_post_login_handler( | |||
658 | sess->session_state = TARG_SESS_STATE_LOGGED_IN; | 658 | sess->session_state = TARG_SESS_STATE_LOGGED_IN; |
659 | 659 | ||
660 | pr_debug("iSCSI Login successful on CID: %hu from %s to %s:%hu,%hu\n", | 660 | pr_debug("iSCSI Login successful on CID: %hu from %s to %s:%hu,%hu\n", |
661 | conn->cid, conn->login_ip, np->np_ip, np->np_port, tpg->tpgt); | 661 | conn->cid, conn->login_ip, conn->local_ip, conn->local_port, |
662 | tpg->tpgt); | ||
662 | 663 | ||
663 | spin_lock_bh(&sess->conn_lock); | 664 | spin_lock_bh(&sess->conn_lock); |
664 | list_add_tail(&conn->conn_list, &sess->sess_conn_list); | 665 | list_add_tail(&conn->conn_list, &sess->sess_conn_list); |
@@ -841,6 +842,14 @@ int iscsi_target_setup_login_socket( | |||
841 | goto fail; | 842 | goto fail; |
842 | } | 843 | } |
843 | 844 | ||
845 | ret = kernel_setsockopt(sock, IPPROTO_IP, IP_FREEBIND, | ||
846 | (char *)&opt, sizeof(opt)); | ||
847 | if (ret < 0) { | ||
848 | pr_err("kernel_setsockopt() for IP_FREEBIND" | ||
849 | " failed\n"); | ||
850 | goto fail; | ||
851 | } | ||
852 | |||
844 | ret = kernel_bind(sock, (struct sockaddr *)&np->np_sockaddr, len); | 853 | ret = kernel_bind(sock, (struct sockaddr *)&np->np_sockaddr, len); |
845 | if (ret < 0) { | 854 | if (ret < 0) { |
846 | pr_err("kernel_bind() failed: %d\n", ret); | 855 | pr_err("kernel_bind() failed: %d\n", ret); |
@@ -1020,6 +1029,18 @@ static int __iscsi_target_login_thread(struct iscsi_np *np) | |||
1020 | snprintf(conn->login_ip, sizeof(conn->login_ip), "%pI6c", | 1029 | snprintf(conn->login_ip, sizeof(conn->login_ip), "%pI6c", |
1021 | &sock_in6.sin6_addr.in6_u); | 1030 | &sock_in6.sin6_addr.in6_u); |
1022 | conn->login_port = ntohs(sock_in6.sin6_port); | 1031 | conn->login_port = ntohs(sock_in6.sin6_port); |
1032 | |||
1033 | if (conn->sock->ops->getname(conn->sock, | ||
1034 | (struct sockaddr *)&sock_in6, &err, 0) < 0) { | ||
1035 | pr_err("sock_ops->getname() failed.\n"); | ||
1036 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, | ||
1037 | ISCSI_LOGIN_STATUS_TARGET_ERROR); | ||
1038 | goto new_sess_out; | ||
1039 | } | ||
1040 | snprintf(conn->local_ip, sizeof(conn->local_ip), "%pI6c", | ||
1041 | &sock_in6.sin6_addr.in6_u); | ||
1042 | conn->local_port = ntohs(sock_in6.sin6_port); | ||
1043 | |||
1023 | } else { | 1044 | } else { |
1024 | memset(&sock_in, 0, sizeof(struct sockaddr_in)); | 1045 | memset(&sock_in, 0, sizeof(struct sockaddr_in)); |
1025 | 1046 | ||
@@ -1032,6 +1053,16 @@ static int __iscsi_target_login_thread(struct iscsi_np *np) | |||
1032 | } | 1053 | } |
1033 | sprintf(conn->login_ip, "%pI4", &sock_in.sin_addr.s_addr); | 1054 | sprintf(conn->login_ip, "%pI4", &sock_in.sin_addr.s_addr); |
1034 | conn->login_port = ntohs(sock_in.sin_port); | 1055 | conn->login_port = ntohs(sock_in.sin_port); |
1056 | |||
1057 | if (conn->sock->ops->getname(conn->sock, | ||
1058 | (struct sockaddr *)&sock_in, &err, 0) < 0) { | ||
1059 | pr_err("sock_ops->getname() failed.\n"); | ||
1060 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, | ||
1061 | ISCSI_LOGIN_STATUS_TARGET_ERROR); | ||
1062 | goto new_sess_out; | ||
1063 | } | ||
1064 | sprintf(conn->local_ip, "%pI4", &sock_in.sin_addr.s_addr); | ||
1065 | conn->local_port = ntohs(sock_in.sin_port); | ||
1035 | } | 1066 | } |
1036 | 1067 | ||
1037 | conn->network_transport = np->np_network_transport; | 1068 | conn->network_transport = np->np_network_transport; |
@@ -1039,7 +1070,7 @@ static int __iscsi_target_login_thread(struct iscsi_np *np) | |||
1039 | pr_debug("Received iSCSI login request from %s on %s Network" | 1070 | pr_debug("Received iSCSI login request from %s on %s Network" |
1040 | " Portal %s:%hu\n", conn->login_ip, | 1071 | " Portal %s:%hu\n", conn->login_ip, |
1041 | (conn->network_transport == ISCSI_TCP) ? "TCP" : "SCTP", | 1072 | (conn->network_transport == ISCSI_TCP) ? "TCP" : "SCTP", |
1042 | np->np_ip, np->np_port); | 1073 | conn->local_ip, conn->local_port); |
1043 | 1074 | ||
1044 | pr_debug("Moving to TARG_CONN_STATE_IN_LOGIN.\n"); | 1075 | pr_debug("Moving to TARG_CONN_STATE_IN_LOGIN.\n"); |
1045 | conn->conn_state = TARG_CONN_STATE_IN_LOGIN; | 1076 | conn->conn_state = TARG_CONN_STATE_IN_LOGIN; |
diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c index a05ca1c4f01c..11287e1ece13 100644 --- a/drivers/target/iscsi/iscsi_target_util.c +++ b/drivers/target/iscsi/iscsi_target_util.c | |||
@@ -849,6 +849,17 @@ void iscsit_free_cmd(struct iscsi_cmd *cmd) | |||
849 | case ISCSI_OP_SCSI_TMFUNC: | 849 | case ISCSI_OP_SCSI_TMFUNC: |
850 | transport_generic_free_cmd(&cmd->se_cmd, 1); | 850 | transport_generic_free_cmd(&cmd->se_cmd, 1); |
851 | break; | 851 | break; |
852 | case ISCSI_OP_REJECT: | ||
853 | /* | ||
854 | * Handle special case for REJECT when iscsi_add_reject*() has | ||
855 | * overwritten the original iscsi_opcode assignment, and the | ||
856 | * associated cmd->se_cmd needs to be released. | ||
857 | */ | ||
858 | if (cmd->se_cmd.se_tfo != NULL) { | ||
859 | transport_generic_free_cmd(&cmd->se_cmd, 1); | ||
860 | break; | ||
861 | } | ||
862 | /* Fall-through */ | ||
852 | default: | 863 | default: |
853 | iscsit_release_cmd(cmd); | 864 | iscsit_release_cmd(cmd); |
854 | break; | 865 | break; |
diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c index 1b1edd14f4bf..01a2691dfb47 100644 --- a/drivers/target/target_core_alua.c +++ b/drivers/target/target_core_alua.c | |||
@@ -78,7 +78,7 @@ int target_emulate_report_target_port_groups(struct se_task *task) | |||
78 | return -EINVAL; | 78 | return -EINVAL; |
79 | } | 79 | } |
80 | 80 | ||
81 | buf = transport_kmap_first_data_page(cmd); | 81 | buf = transport_kmap_data_sg(cmd); |
82 | 82 | ||
83 | spin_lock(&su_dev->t10_alua.tg_pt_gps_lock); | 83 | spin_lock(&su_dev->t10_alua.tg_pt_gps_lock); |
84 | list_for_each_entry(tg_pt_gp, &su_dev->t10_alua.tg_pt_gps_list, | 84 | list_for_each_entry(tg_pt_gp, &su_dev->t10_alua.tg_pt_gps_list, |
@@ -163,7 +163,7 @@ int target_emulate_report_target_port_groups(struct se_task *task) | |||
163 | buf[2] = ((rd_len >> 8) & 0xff); | 163 | buf[2] = ((rd_len >> 8) & 0xff); |
164 | buf[3] = (rd_len & 0xff); | 164 | buf[3] = (rd_len & 0xff); |
165 | 165 | ||
166 | transport_kunmap_first_data_page(cmd); | 166 | transport_kunmap_data_sg(cmd); |
167 | 167 | ||
168 | task->task_scsi_status = GOOD; | 168 | task->task_scsi_status = GOOD; |
169 | transport_complete_task(task, 1); | 169 | transport_complete_task(task, 1); |
@@ -194,7 +194,7 @@ int target_emulate_set_target_port_groups(struct se_task *task) | |||
194 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 194 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
195 | return -EINVAL; | 195 | return -EINVAL; |
196 | } | 196 | } |
197 | buf = transport_kmap_first_data_page(cmd); | 197 | buf = transport_kmap_data_sg(cmd); |
198 | 198 | ||
199 | /* | 199 | /* |
200 | * Determine if explict ALUA via SET_TARGET_PORT_GROUPS is allowed | 200 | * Determine if explict ALUA via SET_TARGET_PORT_GROUPS is allowed |
@@ -351,7 +351,7 @@ int target_emulate_set_target_port_groups(struct se_task *task) | |||
351 | } | 351 | } |
352 | 352 | ||
353 | out: | 353 | out: |
354 | transport_kunmap_first_data_page(cmd); | 354 | transport_kunmap_data_sg(cmd); |
355 | task->task_scsi_status = GOOD; | 355 | task->task_scsi_status = GOOD; |
356 | transport_complete_task(task, 1); | 356 | transport_complete_task(task, 1); |
357 | return 0; | 357 | return 0; |
diff --git a/drivers/target/target_core_cdb.c b/drivers/target/target_core_cdb.c index 2f2235edefff..f3d71fa88a28 100644 --- a/drivers/target/target_core_cdb.c +++ b/drivers/target/target_core_cdb.c | |||
@@ -83,7 +83,7 @@ target_emulate_inquiry_std(struct se_cmd *cmd) | |||
83 | return -EINVAL; | 83 | return -EINVAL; |
84 | } | 84 | } |
85 | 85 | ||
86 | buf = transport_kmap_first_data_page(cmd); | 86 | buf = transport_kmap_data_sg(cmd); |
87 | 87 | ||
88 | if (dev == tpg->tpg_virt_lun0.lun_se_dev) { | 88 | if (dev == tpg->tpg_virt_lun0.lun_se_dev) { |
89 | buf[0] = 0x3f; /* Not connected */ | 89 | buf[0] = 0x3f; /* Not connected */ |
@@ -134,7 +134,7 @@ target_emulate_inquiry_std(struct se_cmd *cmd) | |||
134 | buf[4] = 31; /* Set additional length to 31 */ | 134 | buf[4] = 31; /* Set additional length to 31 */ |
135 | 135 | ||
136 | out: | 136 | out: |
137 | transport_kunmap_first_data_page(cmd); | 137 | transport_kunmap_data_sg(cmd); |
138 | return 0; | 138 | return 0; |
139 | } | 139 | } |
140 | 140 | ||
@@ -698,6 +698,13 @@ int target_emulate_inquiry(struct se_task *task) | |||
698 | int p, ret; | 698 | int p, ret; |
699 | 699 | ||
700 | if (!(cdb[1] & 0x1)) { | 700 | if (!(cdb[1] & 0x1)) { |
701 | if (cdb[2]) { | ||
702 | pr_err("INQUIRY with EVPD==0 but PAGE CODE=%02x\n", | ||
703 | cdb[2]); | ||
704 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; | ||
705 | return -EINVAL; | ||
706 | } | ||
707 | |||
701 | ret = target_emulate_inquiry_std(cmd); | 708 | ret = target_emulate_inquiry_std(cmd); |
702 | goto out; | 709 | goto out; |
703 | } | 710 | } |
@@ -716,7 +723,7 @@ int target_emulate_inquiry(struct se_task *task) | |||
716 | return -EINVAL; | 723 | return -EINVAL; |
717 | } | 724 | } |
718 | 725 | ||
719 | buf = transport_kmap_first_data_page(cmd); | 726 | buf = transport_kmap_data_sg(cmd); |
720 | 727 | ||
721 | buf[0] = dev->transport->get_device_type(dev); | 728 | buf[0] = dev->transport->get_device_type(dev); |
722 | 729 | ||
@@ -729,11 +736,11 @@ int target_emulate_inquiry(struct se_task *task) | |||
729 | } | 736 | } |
730 | 737 | ||
731 | pr_err("Unknown VPD Code: 0x%02x\n", cdb[2]); | 738 | pr_err("Unknown VPD Code: 0x%02x\n", cdb[2]); |
732 | cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE; | 739 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; |
733 | ret = -EINVAL; | 740 | ret = -EINVAL; |
734 | 741 | ||
735 | out_unmap: | 742 | out_unmap: |
736 | transport_kunmap_first_data_page(cmd); | 743 | transport_kunmap_data_sg(cmd); |
737 | out: | 744 | out: |
738 | if (!ret) { | 745 | if (!ret) { |
739 | task->task_scsi_status = GOOD; | 746 | task->task_scsi_status = GOOD; |
@@ -755,7 +762,7 @@ int target_emulate_readcapacity(struct se_task *task) | |||
755 | else | 762 | else |
756 | blocks = (u32)blocks_long; | 763 | blocks = (u32)blocks_long; |
757 | 764 | ||
758 | buf = transport_kmap_first_data_page(cmd); | 765 | buf = transport_kmap_data_sg(cmd); |
759 | 766 | ||
760 | buf[0] = (blocks >> 24) & 0xff; | 767 | buf[0] = (blocks >> 24) & 0xff; |
761 | buf[1] = (blocks >> 16) & 0xff; | 768 | buf[1] = (blocks >> 16) & 0xff; |
@@ -771,7 +778,7 @@ int target_emulate_readcapacity(struct se_task *task) | |||
771 | if (dev->se_sub_dev->se_dev_attrib.emulate_tpu || dev->se_sub_dev->se_dev_attrib.emulate_tpws) | 778 | if (dev->se_sub_dev->se_dev_attrib.emulate_tpu || dev->se_sub_dev->se_dev_attrib.emulate_tpws) |
772 | put_unaligned_be32(0xFFFFFFFF, &buf[0]); | 779 | put_unaligned_be32(0xFFFFFFFF, &buf[0]); |
773 | 780 | ||
774 | transport_kunmap_first_data_page(cmd); | 781 | transport_kunmap_data_sg(cmd); |
775 | 782 | ||
776 | task->task_scsi_status = GOOD; | 783 | task->task_scsi_status = GOOD; |
777 | transport_complete_task(task, 1); | 784 | transport_complete_task(task, 1); |
@@ -785,7 +792,7 @@ int target_emulate_readcapacity_16(struct se_task *task) | |||
785 | unsigned char *buf; | 792 | unsigned char *buf; |
786 | unsigned long long blocks = dev->transport->get_blocks(dev); | 793 | unsigned long long blocks = dev->transport->get_blocks(dev); |
787 | 794 | ||
788 | buf = transport_kmap_first_data_page(cmd); | 795 | buf = transport_kmap_data_sg(cmd); |
789 | 796 | ||
790 | buf[0] = (blocks >> 56) & 0xff; | 797 | buf[0] = (blocks >> 56) & 0xff; |
791 | buf[1] = (blocks >> 48) & 0xff; | 798 | buf[1] = (blocks >> 48) & 0xff; |
@@ -806,7 +813,7 @@ int target_emulate_readcapacity_16(struct se_task *task) | |||
806 | if (dev->se_sub_dev->se_dev_attrib.emulate_tpu || dev->se_sub_dev->se_dev_attrib.emulate_tpws) | 813 | if (dev->se_sub_dev->se_dev_attrib.emulate_tpu || dev->se_sub_dev->se_dev_attrib.emulate_tpws) |
807 | buf[14] = 0x80; | 814 | buf[14] = 0x80; |
808 | 815 | ||
809 | transport_kunmap_first_data_page(cmd); | 816 | transport_kunmap_data_sg(cmd); |
810 | 817 | ||
811 | task->task_scsi_status = GOOD; | 818 | task->task_scsi_status = GOOD; |
812 | transport_complete_task(task, 1); | 819 | transport_complete_task(task, 1); |
@@ -1019,9 +1026,9 @@ int target_emulate_modesense(struct se_task *task) | |||
1019 | offset = cmd->data_length; | 1026 | offset = cmd->data_length; |
1020 | } | 1027 | } |
1021 | 1028 | ||
1022 | rbuf = transport_kmap_first_data_page(cmd); | 1029 | rbuf = transport_kmap_data_sg(cmd); |
1023 | memcpy(rbuf, buf, offset); | 1030 | memcpy(rbuf, buf, offset); |
1024 | transport_kunmap_first_data_page(cmd); | 1031 | transport_kunmap_data_sg(cmd); |
1025 | 1032 | ||
1026 | task->task_scsi_status = GOOD; | 1033 | task->task_scsi_status = GOOD; |
1027 | transport_complete_task(task, 1); | 1034 | transport_complete_task(task, 1); |
@@ -1043,7 +1050,7 @@ int target_emulate_request_sense(struct se_task *task) | |||
1043 | return -ENOSYS; | 1050 | return -ENOSYS; |
1044 | } | 1051 | } |
1045 | 1052 | ||
1046 | buf = transport_kmap_first_data_page(cmd); | 1053 | buf = transport_kmap_data_sg(cmd); |
1047 | 1054 | ||
1048 | if (!core_scsi3_ua_clear_for_request_sense(cmd, &ua_asc, &ua_ascq)) { | 1055 | if (!core_scsi3_ua_clear_for_request_sense(cmd, &ua_asc, &ua_ascq)) { |
1049 | /* | 1056 | /* |
@@ -1051,11 +1058,8 @@ int target_emulate_request_sense(struct se_task *task) | |||
1051 | */ | 1058 | */ |
1052 | buf[0] = 0x70; | 1059 | buf[0] = 0x70; |
1053 | buf[SPC_SENSE_KEY_OFFSET] = UNIT_ATTENTION; | 1060 | buf[SPC_SENSE_KEY_OFFSET] = UNIT_ATTENTION; |
1054 | /* | 1061 | |
1055 | * Make sure request data length is enough for additional | 1062 | if (cmd->data_length < 18) { |
1056 | * sense data. | ||
1057 | */ | ||
1058 | if (cmd->data_length <= 18) { | ||
1059 | buf[7] = 0x00; | 1063 | buf[7] = 0x00; |
1060 | err = -EINVAL; | 1064 | err = -EINVAL; |
1061 | goto end; | 1065 | goto end; |
@@ -1072,11 +1076,8 @@ int target_emulate_request_sense(struct se_task *task) | |||
1072 | */ | 1076 | */ |
1073 | buf[0] = 0x70; | 1077 | buf[0] = 0x70; |
1074 | buf[SPC_SENSE_KEY_OFFSET] = NO_SENSE; | 1078 | buf[SPC_SENSE_KEY_OFFSET] = NO_SENSE; |
1075 | /* | 1079 | |
1076 | * Make sure request data length is enough for additional | 1080 | if (cmd->data_length < 18) { |
1077 | * sense data. | ||
1078 | */ | ||
1079 | if (cmd->data_length <= 18) { | ||
1080 | buf[7] = 0x00; | 1081 | buf[7] = 0x00; |
1081 | err = -EINVAL; | 1082 | err = -EINVAL; |
1082 | goto end; | 1083 | goto end; |
@@ -1089,7 +1090,7 @@ int target_emulate_request_sense(struct se_task *task) | |||
1089 | } | 1090 | } |
1090 | 1091 | ||
1091 | end: | 1092 | end: |
1092 | transport_kunmap_first_data_page(cmd); | 1093 | transport_kunmap_data_sg(cmd); |
1093 | task->task_scsi_status = GOOD; | 1094 | task->task_scsi_status = GOOD; |
1094 | transport_complete_task(task, 1); | 1095 | transport_complete_task(task, 1); |
1095 | return 0; | 1096 | return 0; |
@@ -1123,7 +1124,7 @@ int target_emulate_unmap(struct se_task *task) | |||
1123 | dl = get_unaligned_be16(&cdb[0]); | 1124 | dl = get_unaligned_be16(&cdb[0]); |
1124 | bd_dl = get_unaligned_be16(&cdb[2]); | 1125 | bd_dl = get_unaligned_be16(&cdb[2]); |
1125 | 1126 | ||
1126 | buf = transport_kmap_first_data_page(cmd); | 1127 | buf = transport_kmap_data_sg(cmd); |
1127 | 1128 | ||
1128 | ptr = &buf[offset]; | 1129 | ptr = &buf[offset]; |
1129 | pr_debug("UNMAP: Sub: %s Using dl: %hu bd_dl: %hu size: %hu" | 1130 | pr_debug("UNMAP: Sub: %s Using dl: %hu bd_dl: %hu size: %hu" |
@@ -1147,7 +1148,7 @@ int target_emulate_unmap(struct se_task *task) | |||
1147 | } | 1148 | } |
1148 | 1149 | ||
1149 | err: | 1150 | err: |
1150 | transport_kunmap_first_data_page(cmd); | 1151 | transport_kunmap_data_sg(cmd); |
1151 | if (!ret) { | 1152 | if (!ret) { |
1152 | task->task_scsi_status = GOOD; | 1153 | task->task_scsi_status = GOOD; |
1153 | transport_complete_task(task, 1); | 1154 | transport_complete_task(task, 1); |
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index 0955bb8979fb..6e043eeb1db9 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c | |||
@@ -1704,13 +1704,15 @@ static ssize_t target_core_store_dev_alias( | |||
1704 | return -EINVAL; | 1704 | return -EINVAL; |
1705 | } | 1705 | } |
1706 | 1706 | ||
1707 | se_dev->su_dev_flags |= SDF_USING_ALIAS; | ||
1708 | read_bytes = snprintf(&se_dev->se_dev_alias[0], SE_DEV_ALIAS_LEN, | 1707 | read_bytes = snprintf(&se_dev->se_dev_alias[0], SE_DEV_ALIAS_LEN, |
1709 | "%s", page); | 1708 | "%s", page); |
1710 | 1709 | if (!read_bytes) | |
1710 | return -EINVAL; | ||
1711 | if (se_dev->se_dev_alias[read_bytes - 1] == '\n') | 1711 | if (se_dev->se_dev_alias[read_bytes - 1] == '\n') |
1712 | se_dev->se_dev_alias[read_bytes - 1] = '\0'; | 1712 | se_dev->se_dev_alias[read_bytes - 1] = '\0'; |
1713 | 1713 | ||
1714 | se_dev->su_dev_flags |= SDF_USING_ALIAS; | ||
1715 | |||
1714 | pr_debug("Target_Core_ConfigFS: %s/%s set alias: %s\n", | 1716 | pr_debug("Target_Core_ConfigFS: %s/%s set alias: %s\n", |
1715 | config_item_name(&hba->hba_group.cg_item), | 1717 | config_item_name(&hba->hba_group.cg_item), |
1716 | config_item_name(&se_dev->se_dev_group.cg_item), | 1718 | config_item_name(&se_dev->se_dev_group.cg_item), |
@@ -1753,13 +1755,15 @@ static ssize_t target_core_store_dev_udev_path( | |||
1753 | return -EINVAL; | 1755 | return -EINVAL; |
1754 | } | 1756 | } |
1755 | 1757 | ||
1756 | se_dev->su_dev_flags |= SDF_USING_UDEV_PATH; | ||
1757 | read_bytes = snprintf(&se_dev->se_dev_udev_path[0], SE_UDEV_PATH_LEN, | 1758 | read_bytes = snprintf(&se_dev->se_dev_udev_path[0], SE_UDEV_PATH_LEN, |
1758 | "%s", page); | 1759 | "%s", page); |
1759 | 1760 | if (!read_bytes) | |
1761 | return -EINVAL; | ||
1760 | if (se_dev->se_dev_udev_path[read_bytes - 1] == '\n') | 1762 | if (se_dev->se_dev_udev_path[read_bytes - 1] == '\n') |
1761 | se_dev->se_dev_udev_path[read_bytes - 1] = '\0'; | 1763 | se_dev->se_dev_udev_path[read_bytes - 1] = '\0'; |
1762 | 1764 | ||
1765 | se_dev->su_dev_flags |= SDF_USING_UDEV_PATH; | ||
1766 | |||
1763 | pr_debug("Target_Core_ConfigFS: %s/%s set udev_path: %s\n", | 1767 | pr_debug("Target_Core_ConfigFS: %s/%s set udev_path: %s\n", |
1764 | config_item_name(&hba->hba_group.cg_item), | 1768 | config_item_name(&hba->hba_group.cg_item), |
1765 | config_item_name(&se_dev->se_dev_group.cg_item), | 1769 | config_item_name(&se_dev->se_dev_group.cg_item), |
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 0c5992f0d946..edbcabbf85f7 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c | |||
@@ -320,11 +320,12 @@ int core_free_device_list_for_node( | |||
320 | void core_dec_lacl_count(struct se_node_acl *se_nacl, struct se_cmd *se_cmd) | 320 | void core_dec_lacl_count(struct se_node_acl *se_nacl, struct se_cmd *se_cmd) |
321 | { | 321 | { |
322 | struct se_dev_entry *deve; | 322 | struct se_dev_entry *deve; |
323 | unsigned long flags; | ||
323 | 324 | ||
324 | spin_lock_irq(&se_nacl->device_list_lock); | 325 | spin_lock_irqsave(&se_nacl->device_list_lock, flags); |
325 | deve = &se_nacl->device_list[se_cmd->orig_fe_lun]; | 326 | deve = &se_nacl->device_list[se_cmd->orig_fe_lun]; |
326 | deve->deve_cmds--; | 327 | deve->deve_cmds--; |
327 | spin_unlock_irq(&se_nacl->device_list_lock); | 328 | spin_unlock_irqrestore(&se_nacl->device_list_lock, flags); |
328 | } | 329 | } |
329 | 330 | ||
330 | void core_update_device_list_access( | 331 | void core_update_device_list_access( |
@@ -656,7 +657,7 @@ int target_report_luns(struct se_task *se_task) | |||
656 | unsigned char *buf; | 657 | unsigned char *buf; |
657 | u32 cdb_offset = 0, lun_count = 0, offset = 8, i; | 658 | u32 cdb_offset = 0, lun_count = 0, offset = 8, i; |
658 | 659 | ||
659 | buf = transport_kmap_first_data_page(se_cmd); | 660 | buf = (unsigned char *) transport_kmap_data_sg(se_cmd); |
660 | 661 | ||
661 | /* | 662 | /* |
662 | * If no struct se_session pointer is present, this struct se_cmd is | 663 | * If no struct se_session pointer is present, this struct se_cmd is |
@@ -694,7 +695,7 @@ int target_report_luns(struct se_task *se_task) | |||
694 | * See SPC3 r07, page 159. | 695 | * See SPC3 r07, page 159. |
695 | */ | 696 | */ |
696 | done: | 697 | done: |
697 | transport_kunmap_first_data_page(se_cmd); | 698 | transport_kunmap_data_sg(se_cmd); |
698 | lun_count *= 8; | 699 | lun_count *= 8; |
699 | buf[0] = ((lun_count >> 24) & 0xff); | 700 | buf[0] = ((lun_count >> 24) & 0xff); |
700 | buf[1] = ((lun_count >> 16) & 0xff); | 701 | buf[1] = ((lun_count >> 16) & 0xff); |
@@ -1294,24 +1295,26 @@ struct se_lun *core_dev_add_lun( | |||
1294 | { | 1295 | { |
1295 | struct se_lun *lun_p; | 1296 | struct se_lun *lun_p; |
1296 | u32 lun_access = 0; | 1297 | u32 lun_access = 0; |
1298 | int rc; | ||
1297 | 1299 | ||
1298 | if (atomic_read(&dev->dev_access_obj.obj_access_count) != 0) { | 1300 | if (atomic_read(&dev->dev_access_obj.obj_access_count) != 0) { |
1299 | pr_err("Unable to export struct se_device while dev_access_obj: %d\n", | 1301 | pr_err("Unable to export struct se_device while dev_access_obj: %d\n", |
1300 | atomic_read(&dev->dev_access_obj.obj_access_count)); | 1302 | atomic_read(&dev->dev_access_obj.obj_access_count)); |
1301 | return NULL; | 1303 | return ERR_PTR(-EACCES); |
1302 | } | 1304 | } |
1303 | 1305 | ||
1304 | lun_p = core_tpg_pre_addlun(tpg, lun); | 1306 | lun_p = core_tpg_pre_addlun(tpg, lun); |
1305 | if ((IS_ERR(lun_p)) || !lun_p) | 1307 | if (IS_ERR(lun_p)) |
1306 | return NULL; | 1308 | return lun_p; |
1307 | 1309 | ||
1308 | if (dev->dev_flags & DF_READ_ONLY) | 1310 | if (dev->dev_flags & DF_READ_ONLY) |
1309 | lun_access = TRANSPORT_LUNFLAGS_READ_ONLY; | 1311 | lun_access = TRANSPORT_LUNFLAGS_READ_ONLY; |
1310 | else | 1312 | else |
1311 | lun_access = TRANSPORT_LUNFLAGS_READ_WRITE; | 1313 | lun_access = TRANSPORT_LUNFLAGS_READ_WRITE; |
1312 | 1314 | ||
1313 | if (core_tpg_post_addlun(tpg, lun_p, lun_access, dev) < 0) | 1315 | rc = core_tpg_post_addlun(tpg, lun_p, lun_access, dev); |
1314 | return NULL; | 1316 | if (rc < 0) |
1317 | return ERR_PTR(rc); | ||
1315 | 1318 | ||
1316 | pr_debug("%s_TPG[%u]_LUN[%u] - Activated %s Logical Unit from" | 1319 | pr_debug("%s_TPG[%u]_LUN[%u] - Activated %s Logical Unit from" |
1317 | " CORE HBA: %u\n", tpg->se_tpg_tfo->get_fabric_name(), | 1320 | " CORE HBA: %u\n", tpg->se_tpg_tfo->get_fabric_name(), |
@@ -1348,11 +1351,10 @@ int core_dev_del_lun( | |||
1348 | u32 unpacked_lun) | 1351 | u32 unpacked_lun) |
1349 | { | 1352 | { |
1350 | struct se_lun *lun; | 1353 | struct se_lun *lun; |
1351 | int ret = 0; | ||
1352 | 1354 | ||
1353 | lun = core_tpg_pre_dellun(tpg, unpacked_lun, &ret); | 1355 | lun = core_tpg_pre_dellun(tpg, unpacked_lun); |
1354 | if (!lun) | 1356 | if (IS_ERR(lun)) |
1355 | return ret; | 1357 | return PTR_ERR(lun); |
1356 | 1358 | ||
1357 | core_tpg_post_dellun(tpg, lun); | 1359 | core_tpg_post_dellun(tpg, lun); |
1358 | 1360 | ||
diff --git a/drivers/target/target_core_fabric_configfs.c b/drivers/target/target_core_fabric_configfs.c index 4f77cce22646..9a2ce11e1a6e 100644 --- a/drivers/target/target_core_fabric_configfs.c +++ b/drivers/target/target_core_fabric_configfs.c | |||
@@ -766,9 +766,9 @@ static int target_fabric_port_link( | |||
766 | 766 | ||
767 | lun_p = core_dev_add_lun(se_tpg, dev->se_hba, dev, | 767 | lun_p = core_dev_add_lun(se_tpg, dev->se_hba, dev, |
768 | lun->unpacked_lun); | 768 | lun->unpacked_lun); |
769 | if (IS_ERR(lun_p) || !lun_p) { | 769 | if (IS_ERR(lun_p)) { |
770 | pr_err("core_dev_add_lun() failed\n"); | 770 | pr_err("core_dev_add_lun() failed\n"); |
771 | ret = -EINVAL; | 771 | ret = PTR_ERR(lun_p); |
772 | goto out; | 772 | goto out; |
773 | } | 773 | } |
774 | 774 | ||
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index cc8e6b58ef20..8572eae62da7 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c | |||
@@ -129,7 +129,7 @@ static struct se_device *iblock_create_virtdevice( | |||
129 | /* | 129 | /* |
130 | * These settings need to be made tunable.. | 130 | * These settings need to be made tunable.. |
131 | */ | 131 | */ |
132 | ib_dev->ibd_bio_set = bioset_create(32, 64); | 132 | ib_dev->ibd_bio_set = bioset_create(32, 0); |
133 | if (!ib_dev->ibd_bio_set) { | 133 | if (!ib_dev->ibd_bio_set) { |
134 | pr_err("IBLOCK: Unable to create bioset()\n"); | 134 | pr_err("IBLOCK: Unable to create bioset()\n"); |
135 | return ERR_PTR(-ENOMEM); | 135 | return ERR_PTR(-ENOMEM); |
@@ -181,7 +181,7 @@ static struct se_device *iblock_create_virtdevice( | |||
181 | */ | 181 | */ |
182 | dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count = 1; | 182 | dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count = 1; |
183 | dev->se_sub_dev->se_dev_attrib.unmap_granularity = | 183 | dev->se_sub_dev->se_dev_attrib.unmap_granularity = |
184 | q->limits.discard_granularity; | 184 | q->limits.discard_granularity >> 9; |
185 | dev->se_sub_dev->se_dev_attrib.unmap_granularity_alignment = | 185 | dev->se_sub_dev->se_dev_attrib.unmap_granularity_alignment = |
186 | q->limits.discard_alignment; | 186 | q->limits.discard_alignment; |
187 | 187 | ||
@@ -488,6 +488,13 @@ iblock_get_bio(struct se_task *task, sector_t lba, u32 sg_num) | |||
488 | struct iblock_req *ib_req = IBLOCK_REQ(task); | 488 | struct iblock_req *ib_req = IBLOCK_REQ(task); |
489 | struct bio *bio; | 489 | struct bio *bio; |
490 | 490 | ||
491 | /* | ||
492 | * Only allocate as many vector entries as the bio code allows us to, | ||
493 | * we'll loop later on until we have handled the whole request. | ||
494 | */ | ||
495 | if (sg_num > BIO_MAX_PAGES) | ||
496 | sg_num = BIO_MAX_PAGES; | ||
497 | |||
491 | bio = bio_alloc_bioset(GFP_NOIO, sg_num, ib_dev->ibd_bio_set); | 498 | bio = bio_alloc_bioset(GFP_NOIO, sg_num, ib_dev->ibd_bio_set); |
492 | if (!bio) { | 499 | if (!bio) { |
493 | pr_err("Unable to allocate memory for bio\n"); | 500 | pr_err("Unable to allocate memory for bio\n"); |
diff --git a/drivers/target/target_core_internal.h b/drivers/target/target_core_internal.h index 26f135e94f6e..45001364788a 100644 --- a/drivers/target/target_core_internal.h +++ b/drivers/target/target_core_internal.h | |||
@@ -90,7 +90,7 @@ void core_tpg_wait_for_nacl_pr_ref(struct se_node_acl *); | |||
90 | struct se_lun *core_tpg_pre_addlun(struct se_portal_group *, u32); | 90 | struct se_lun *core_tpg_pre_addlun(struct se_portal_group *, u32); |
91 | int core_tpg_post_addlun(struct se_portal_group *, struct se_lun *, | 91 | int core_tpg_post_addlun(struct se_portal_group *, struct se_lun *, |
92 | u32, void *); | 92 | u32, void *); |
93 | struct se_lun *core_tpg_pre_dellun(struct se_portal_group *, u32, int *); | 93 | struct se_lun *core_tpg_pre_dellun(struct se_portal_group *, u32 unpacked_lun); |
94 | int core_tpg_post_dellun(struct se_portal_group *, struct se_lun *); | 94 | int core_tpg_post_dellun(struct se_portal_group *, struct se_lun *); |
95 | 95 | ||
96 | /* target_core_transport.c */ | 96 | /* target_core_transport.c */ |
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index 429ad7291664..b7c779389eea 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c | |||
@@ -478,6 +478,7 @@ static int core_scsi3_pr_seq_non_holder( | |||
478 | case READ_MEDIA_SERIAL_NUMBER: | 478 | case READ_MEDIA_SERIAL_NUMBER: |
479 | case REPORT_LUNS: | 479 | case REPORT_LUNS: |
480 | case REQUEST_SENSE: | 480 | case REQUEST_SENSE: |
481 | case PERSISTENT_RESERVE_IN: | ||
481 | ret = 0; /*/ Allowed CDBs */ | 482 | ret = 0; /*/ Allowed CDBs */ |
482 | break; | 483 | break; |
483 | default: | 484 | default: |
@@ -1534,7 +1535,7 @@ static int core_scsi3_decode_spec_i_port( | |||
1534 | tidh_new->dest_local_nexus = 1; | 1535 | tidh_new->dest_local_nexus = 1; |
1535 | list_add_tail(&tidh_new->dest_list, &tid_dest_list); | 1536 | list_add_tail(&tidh_new->dest_list, &tid_dest_list); |
1536 | 1537 | ||
1537 | buf = transport_kmap_first_data_page(cmd); | 1538 | buf = transport_kmap_data_sg(cmd); |
1538 | /* | 1539 | /* |
1539 | * For a PERSISTENT RESERVE OUT specify initiator ports payload, | 1540 | * For a PERSISTENT RESERVE OUT specify initiator ports payload, |
1540 | * first extract TransportID Parameter Data Length, and make sure | 1541 | * first extract TransportID Parameter Data Length, and make sure |
@@ -1785,7 +1786,7 @@ static int core_scsi3_decode_spec_i_port( | |||
1785 | 1786 | ||
1786 | } | 1787 | } |
1787 | 1788 | ||
1788 | transport_kunmap_first_data_page(cmd); | 1789 | transport_kunmap_data_sg(cmd); |
1789 | 1790 | ||
1790 | /* | 1791 | /* |
1791 | * Go ahead and create a registrations from tid_dest_list for the | 1792 | * Go ahead and create a registrations from tid_dest_list for the |
@@ -1833,7 +1834,7 @@ static int core_scsi3_decode_spec_i_port( | |||
1833 | 1834 | ||
1834 | return 0; | 1835 | return 0; |
1835 | out: | 1836 | out: |
1836 | transport_kunmap_first_data_page(cmd); | 1837 | transport_kunmap_data_sg(cmd); |
1837 | /* | 1838 | /* |
1838 | * For the failure case, release everything from tid_dest_list | 1839 | * For the failure case, release everything from tid_dest_list |
1839 | * including *dest_pr_reg and the configfs dependances.. | 1840 | * including *dest_pr_reg and the configfs dependances.. |
@@ -3120,7 +3121,7 @@ static int core_scsi3_pro_preempt( | |||
3120 | if (!calling_it_nexus) | 3121 | if (!calling_it_nexus) |
3121 | core_scsi3_ua_allocate(pr_reg_nacl, | 3122 | core_scsi3_ua_allocate(pr_reg_nacl, |
3122 | pr_res_mapped_lun, 0x2A, | 3123 | pr_res_mapped_lun, 0x2A, |
3123 | ASCQ_2AH_RESERVATIONS_PREEMPTED); | 3124 | ASCQ_2AH_REGISTRATIONS_PREEMPTED); |
3124 | } | 3125 | } |
3125 | spin_unlock(&pr_tmpl->registration_lock); | 3126 | spin_unlock(&pr_tmpl->registration_lock); |
3126 | /* | 3127 | /* |
@@ -3233,7 +3234,7 @@ static int core_scsi3_pro_preempt( | |||
3233 | * additional sense code set to REGISTRATIONS PREEMPTED; | 3234 | * additional sense code set to REGISTRATIONS PREEMPTED; |
3234 | */ | 3235 | */ |
3235 | core_scsi3_ua_allocate(pr_reg_nacl, pr_res_mapped_lun, 0x2A, | 3236 | core_scsi3_ua_allocate(pr_reg_nacl, pr_res_mapped_lun, 0x2A, |
3236 | ASCQ_2AH_RESERVATIONS_PREEMPTED); | 3237 | ASCQ_2AH_REGISTRATIONS_PREEMPTED); |
3237 | } | 3238 | } |
3238 | spin_unlock(&pr_tmpl->registration_lock); | 3239 | spin_unlock(&pr_tmpl->registration_lock); |
3239 | /* | 3240 | /* |
@@ -3410,14 +3411,14 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
3410 | * will be moved to for the TransportID containing SCSI initiator WWN | 3411 | * will be moved to for the TransportID containing SCSI initiator WWN |
3411 | * information. | 3412 | * information. |
3412 | */ | 3413 | */ |
3413 | buf = transport_kmap_first_data_page(cmd); | 3414 | buf = transport_kmap_data_sg(cmd); |
3414 | rtpi = (buf[18] & 0xff) << 8; | 3415 | rtpi = (buf[18] & 0xff) << 8; |
3415 | rtpi |= buf[19] & 0xff; | 3416 | rtpi |= buf[19] & 0xff; |
3416 | tid_len = (buf[20] & 0xff) << 24; | 3417 | tid_len = (buf[20] & 0xff) << 24; |
3417 | tid_len |= (buf[21] & 0xff) << 16; | 3418 | tid_len |= (buf[21] & 0xff) << 16; |
3418 | tid_len |= (buf[22] & 0xff) << 8; | 3419 | tid_len |= (buf[22] & 0xff) << 8; |
3419 | tid_len |= buf[23] & 0xff; | 3420 | tid_len |= buf[23] & 0xff; |
3420 | transport_kunmap_first_data_page(cmd); | 3421 | transport_kunmap_data_sg(cmd); |
3421 | buf = NULL; | 3422 | buf = NULL; |
3422 | 3423 | ||
3423 | if ((tid_len + 24) != cmd->data_length) { | 3424 | if ((tid_len + 24) != cmd->data_length) { |
@@ -3469,7 +3470,7 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
3469 | return -EINVAL; | 3470 | return -EINVAL; |
3470 | } | 3471 | } |
3471 | 3472 | ||
3472 | buf = transport_kmap_first_data_page(cmd); | 3473 | buf = transport_kmap_data_sg(cmd); |
3473 | proto_ident = (buf[24] & 0x0f); | 3474 | proto_ident = (buf[24] & 0x0f); |
3474 | #if 0 | 3475 | #if 0 |
3475 | pr_debug("SPC-3 PR REGISTER_AND_MOVE: Extracted Protocol Identifier:" | 3476 | pr_debug("SPC-3 PR REGISTER_AND_MOVE: Extracted Protocol Identifier:" |
@@ -3503,7 +3504,7 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
3503 | goto out; | 3504 | goto out; |
3504 | } | 3505 | } |
3505 | 3506 | ||
3506 | transport_kunmap_first_data_page(cmd); | 3507 | transport_kunmap_data_sg(cmd); |
3507 | buf = NULL; | 3508 | buf = NULL; |
3508 | 3509 | ||
3509 | pr_debug("SPC-3 PR [%s] Extracted initiator %s identifier: %s" | 3510 | pr_debug("SPC-3 PR [%s] Extracted initiator %s identifier: %s" |
@@ -3768,13 +3769,13 @@ after_iport_check: | |||
3768 | " REGISTER_AND_MOVE\n"); | 3769 | " REGISTER_AND_MOVE\n"); |
3769 | } | 3770 | } |
3770 | 3771 | ||
3771 | transport_kunmap_first_data_page(cmd); | 3772 | transport_kunmap_data_sg(cmd); |
3772 | 3773 | ||
3773 | core_scsi3_put_pr_reg(dest_pr_reg); | 3774 | core_scsi3_put_pr_reg(dest_pr_reg); |
3774 | return 0; | 3775 | return 0; |
3775 | out: | 3776 | out: |
3776 | if (buf) | 3777 | if (buf) |
3777 | transport_kunmap_first_data_page(cmd); | 3778 | transport_kunmap_data_sg(cmd); |
3778 | if (dest_se_deve) | 3779 | if (dest_se_deve) |
3779 | core_scsi3_lunacl_undepend_item(dest_se_deve); | 3780 | core_scsi3_lunacl_undepend_item(dest_se_deve); |
3780 | if (dest_node_acl) | 3781 | if (dest_node_acl) |
@@ -3848,7 +3849,7 @@ int target_scsi3_emulate_pr_out(struct se_task *task) | |||
3848 | scope = (cdb[2] & 0xf0); | 3849 | scope = (cdb[2] & 0xf0); |
3849 | type = (cdb[2] & 0x0f); | 3850 | type = (cdb[2] & 0x0f); |
3850 | 3851 | ||
3851 | buf = transport_kmap_first_data_page(cmd); | 3852 | buf = transport_kmap_data_sg(cmd); |
3852 | /* | 3853 | /* |
3853 | * From PERSISTENT_RESERVE_OUT parameter list (payload) | 3854 | * From PERSISTENT_RESERVE_OUT parameter list (payload) |
3854 | */ | 3855 | */ |
@@ -3866,7 +3867,7 @@ int target_scsi3_emulate_pr_out(struct se_task *task) | |||
3866 | aptpl = (buf[17] & 0x01); | 3867 | aptpl = (buf[17] & 0x01); |
3867 | unreg = (buf[17] & 0x02); | 3868 | unreg = (buf[17] & 0x02); |
3868 | } | 3869 | } |
3869 | transport_kunmap_first_data_page(cmd); | 3870 | transport_kunmap_data_sg(cmd); |
3870 | buf = NULL; | 3871 | buf = NULL; |
3871 | 3872 | ||
3872 | /* | 3873 | /* |
@@ -3966,7 +3967,7 @@ static int core_scsi3_pri_read_keys(struct se_cmd *cmd) | |||
3966 | return -EINVAL; | 3967 | return -EINVAL; |
3967 | } | 3968 | } |
3968 | 3969 | ||
3969 | buf = transport_kmap_first_data_page(cmd); | 3970 | buf = transport_kmap_data_sg(cmd); |
3970 | buf[0] = ((su_dev->t10_pr.pr_generation >> 24) & 0xff); | 3971 | buf[0] = ((su_dev->t10_pr.pr_generation >> 24) & 0xff); |
3971 | buf[1] = ((su_dev->t10_pr.pr_generation >> 16) & 0xff); | 3972 | buf[1] = ((su_dev->t10_pr.pr_generation >> 16) & 0xff); |
3972 | buf[2] = ((su_dev->t10_pr.pr_generation >> 8) & 0xff); | 3973 | buf[2] = ((su_dev->t10_pr.pr_generation >> 8) & 0xff); |
@@ -4000,7 +4001,7 @@ static int core_scsi3_pri_read_keys(struct se_cmd *cmd) | |||
4000 | buf[6] = ((add_len >> 8) & 0xff); | 4001 | buf[6] = ((add_len >> 8) & 0xff); |
4001 | buf[7] = (add_len & 0xff); | 4002 | buf[7] = (add_len & 0xff); |
4002 | 4003 | ||
4003 | transport_kunmap_first_data_page(cmd); | 4004 | transport_kunmap_data_sg(cmd); |
4004 | 4005 | ||
4005 | return 0; | 4006 | return 0; |
4006 | } | 4007 | } |
@@ -4026,7 +4027,7 @@ static int core_scsi3_pri_read_reservation(struct se_cmd *cmd) | |||
4026 | return -EINVAL; | 4027 | return -EINVAL; |
4027 | } | 4028 | } |
4028 | 4029 | ||
4029 | buf = transport_kmap_first_data_page(cmd); | 4030 | buf = transport_kmap_data_sg(cmd); |
4030 | buf[0] = ((su_dev->t10_pr.pr_generation >> 24) & 0xff); | 4031 | buf[0] = ((su_dev->t10_pr.pr_generation >> 24) & 0xff); |
4031 | buf[1] = ((su_dev->t10_pr.pr_generation >> 16) & 0xff); | 4032 | buf[1] = ((su_dev->t10_pr.pr_generation >> 16) & 0xff); |
4032 | buf[2] = ((su_dev->t10_pr.pr_generation >> 8) & 0xff); | 4033 | buf[2] = ((su_dev->t10_pr.pr_generation >> 8) & 0xff); |
@@ -4085,7 +4086,7 @@ static int core_scsi3_pri_read_reservation(struct se_cmd *cmd) | |||
4085 | 4086 | ||
4086 | err: | 4087 | err: |
4087 | spin_unlock(&se_dev->dev_reservation_lock); | 4088 | spin_unlock(&se_dev->dev_reservation_lock); |
4088 | transport_kunmap_first_data_page(cmd); | 4089 | transport_kunmap_data_sg(cmd); |
4089 | 4090 | ||
4090 | return 0; | 4091 | return 0; |
4091 | } | 4092 | } |
@@ -4109,7 +4110,7 @@ static int core_scsi3_pri_report_capabilities(struct se_cmd *cmd) | |||
4109 | return -EINVAL; | 4110 | return -EINVAL; |
4110 | } | 4111 | } |
4111 | 4112 | ||
4112 | buf = transport_kmap_first_data_page(cmd); | 4113 | buf = transport_kmap_data_sg(cmd); |
4113 | 4114 | ||
4114 | buf[0] = ((add_len << 8) & 0xff); | 4115 | buf[0] = ((add_len << 8) & 0xff); |
4115 | buf[1] = (add_len & 0xff); | 4116 | buf[1] = (add_len & 0xff); |
@@ -4141,7 +4142,7 @@ static int core_scsi3_pri_report_capabilities(struct se_cmd *cmd) | |||
4141 | buf[4] |= 0x02; /* PR_TYPE_WRITE_EXCLUSIVE */ | 4142 | buf[4] |= 0x02; /* PR_TYPE_WRITE_EXCLUSIVE */ |
4142 | buf[5] |= 0x01; /* PR_TYPE_EXCLUSIVE_ACCESS_ALLREG */ | 4143 | buf[5] |= 0x01; /* PR_TYPE_EXCLUSIVE_ACCESS_ALLREG */ |
4143 | 4144 | ||
4144 | transport_kunmap_first_data_page(cmd); | 4145 | transport_kunmap_data_sg(cmd); |
4145 | 4146 | ||
4146 | return 0; | 4147 | return 0; |
4147 | } | 4148 | } |
@@ -4171,7 +4172,7 @@ static int core_scsi3_pri_read_full_status(struct se_cmd *cmd) | |||
4171 | return -EINVAL; | 4172 | return -EINVAL; |
4172 | } | 4173 | } |
4173 | 4174 | ||
4174 | buf = transport_kmap_first_data_page(cmd); | 4175 | buf = transport_kmap_data_sg(cmd); |
4175 | 4176 | ||
4176 | buf[0] = ((su_dev->t10_pr.pr_generation >> 24) & 0xff); | 4177 | buf[0] = ((su_dev->t10_pr.pr_generation >> 24) & 0xff); |
4177 | buf[1] = ((su_dev->t10_pr.pr_generation >> 16) & 0xff); | 4178 | buf[1] = ((su_dev->t10_pr.pr_generation >> 16) & 0xff); |
@@ -4292,7 +4293,7 @@ static int core_scsi3_pri_read_full_status(struct se_cmd *cmd) | |||
4292 | buf[6] = ((add_len >> 8) & 0xff); | 4293 | buf[6] = ((add_len >> 8) & 0xff); |
4293 | buf[7] = (add_len & 0xff); | 4294 | buf[7] = (add_len & 0xff); |
4294 | 4295 | ||
4295 | transport_kunmap_first_data_page(cmd); | 4296 | transport_kunmap_data_sg(cmd); |
4296 | 4297 | ||
4297 | return 0; | 4298 | return 0; |
4298 | } | 4299 | } |
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index d35467d42e12..8d4def30e9e8 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c | |||
@@ -693,7 +693,7 @@ static int pscsi_transport_complete(struct se_task *task) | |||
693 | 693 | ||
694 | if (task->task_se_cmd->se_deve->lun_flags & | 694 | if (task->task_se_cmd->se_deve->lun_flags & |
695 | TRANSPORT_LUNFLAGS_READ_ONLY) { | 695 | TRANSPORT_LUNFLAGS_READ_ONLY) { |
696 | unsigned char *buf = transport_kmap_first_data_page(task->task_se_cmd); | 696 | unsigned char *buf = transport_kmap_data_sg(task->task_se_cmd); |
697 | 697 | ||
698 | if (cdb[0] == MODE_SENSE_10) { | 698 | if (cdb[0] == MODE_SENSE_10) { |
699 | if (!(buf[3] & 0x80)) | 699 | if (!(buf[3] & 0x80)) |
@@ -703,7 +703,7 @@ static int pscsi_transport_complete(struct se_task *task) | |||
703 | buf[2] |= 0x80; | 703 | buf[2] |= 0x80; |
704 | } | 704 | } |
705 | 705 | ||
706 | transport_kunmap_first_data_page(task->task_se_cmd); | 706 | transport_kunmap_data_sg(task->task_se_cmd); |
707 | } | 707 | } |
708 | } | 708 | } |
709 | after_mode_sense: | 709 | after_mode_sense: |
diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c index b7668029bb31..06336ecd872d 100644 --- a/drivers/target/target_core_tpg.c +++ b/drivers/target/target_core_tpg.c | |||
@@ -807,8 +807,7 @@ static void core_tpg_shutdown_lun( | |||
807 | 807 | ||
808 | struct se_lun *core_tpg_pre_dellun( | 808 | struct se_lun *core_tpg_pre_dellun( |
809 | struct se_portal_group *tpg, | 809 | struct se_portal_group *tpg, |
810 | u32 unpacked_lun, | 810 | u32 unpacked_lun) |
811 | int *ret) | ||
812 | { | 811 | { |
813 | struct se_lun *lun; | 812 | struct se_lun *lun; |
814 | 813 | ||
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index d3ddd1361949..58cea07b12fb 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -1255,32 +1255,34 @@ static void core_setup_task_attr_emulation(struct se_device *dev) | |||
1255 | static void scsi_dump_inquiry(struct se_device *dev) | 1255 | static void scsi_dump_inquiry(struct se_device *dev) |
1256 | { | 1256 | { |
1257 | struct t10_wwn *wwn = &dev->se_sub_dev->t10_wwn; | 1257 | struct t10_wwn *wwn = &dev->se_sub_dev->t10_wwn; |
1258 | char buf[17]; | ||
1258 | int i, device_type; | 1259 | int i, device_type; |
1259 | /* | 1260 | /* |
1260 | * Print Linux/SCSI style INQUIRY formatting to the kernel ring buffer | 1261 | * Print Linux/SCSI style INQUIRY formatting to the kernel ring buffer |
1261 | */ | 1262 | */ |
1262 | pr_debug(" Vendor: "); | ||
1263 | for (i = 0; i < 8; i++) | 1263 | for (i = 0; i < 8; i++) |
1264 | if (wwn->vendor[i] >= 0x20) | 1264 | if (wwn->vendor[i] >= 0x20) |
1265 | pr_debug("%c", wwn->vendor[i]); | 1265 | buf[i] = wwn->vendor[i]; |
1266 | else | 1266 | else |
1267 | pr_debug(" "); | 1267 | buf[i] = ' '; |
1268 | buf[i] = '\0'; | ||
1269 | pr_debug(" Vendor: %s\n", buf); | ||
1268 | 1270 | ||
1269 | pr_debug(" Model: "); | ||
1270 | for (i = 0; i < 16; i++) | 1271 | for (i = 0; i < 16; i++) |
1271 | if (wwn->model[i] >= 0x20) | 1272 | if (wwn->model[i] >= 0x20) |
1272 | pr_debug("%c", wwn->model[i]); | 1273 | buf[i] = wwn->model[i]; |
1273 | else | 1274 | else |
1274 | pr_debug(" "); | 1275 | buf[i] = ' '; |
1276 | buf[i] = '\0'; | ||
1277 | pr_debug(" Model: %s\n", buf); | ||
1275 | 1278 | ||
1276 | pr_debug(" Revision: "); | ||
1277 | for (i = 0; i < 4; i++) | 1279 | for (i = 0; i < 4; i++) |
1278 | if (wwn->revision[i] >= 0x20) | 1280 | if (wwn->revision[i] >= 0x20) |
1279 | pr_debug("%c", wwn->revision[i]); | 1281 | buf[i] = wwn->revision[i]; |
1280 | else | 1282 | else |
1281 | pr_debug(" "); | 1283 | buf[i] = ' '; |
1282 | 1284 | buf[i] = '\0'; | |
1283 | pr_debug("\n"); | 1285 | pr_debug(" Revision: %s\n", buf); |
1284 | 1286 | ||
1285 | device_type = dev->transport->get_device_type(dev); | 1287 | device_type = dev->transport->get_device_type(dev); |
1286 | pr_debug(" Type: %s ", scsi_device_type(device_type)); | 1288 | pr_debug(" Type: %s ", scsi_device_type(device_type)); |
@@ -1655,7 +1657,7 @@ EXPORT_SYMBOL(transport_handle_cdb_direct); | |||
1655 | * This may only be called from process context, and also currently | 1657 | * This may only be called from process context, and also currently |
1656 | * assumes internal allocation of fabric payload buffer by target-core. | 1658 | * assumes internal allocation of fabric payload buffer by target-core. |
1657 | **/ | 1659 | **/ |
1658 | int target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, | 1660 | void target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, |
1659 | unsigned char *cdb, unsigned char *sense, u32 unpacked_lun, | 1661 | unsigned char *cdb, unsigned char *sense, u32 unpacked_lun, |
1660 | u32 data_length, int task_attr, int data_dir, int flags) | 1662 | u32 data_length, int task_attr, int data_dir, int flags) |
1661 | { | 1663 | { |
@@ -1688,15 +1690,21 @@ int target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, | |||
1688 | /* | 1690 | /* |
1689 | * Locate se_lun pointer and attach it to struct se_cmd | 1691 | * Locate se_lun pointer and attach it to struct se_cmd |
1690 | */ | 1692 | */ |
1691 | if (transport_lookup_cmd_lun(se_cmd, unpacked_lun) < 0) | 1693 | if (transport_lookup_cmd_lun(se_cmd, unpacked_lun) < 0) { |
1692 | goto out_check_cond; | 1694 | transport_send_check_condition_and_sense(se_cmd, |
1695 | se_cmd->scsi_sense_reason, 0); | ||
1696 | target_put_sess_cmd(se_sess, se_cmd); | ||
1697 | return; | ||
1698 | } | ||
1693 | /* | 1699 | /* |
1694 | * Sanitize CDBs via transport_generic_cmd_sequencer() and | 1700 | * Sanitize CDBs via transport_generic_cmd_sequencer() and |
1695 | * allocate the necessary tasks to complete the received CDB+data | 1701 | * allocate the necessary tasks to complete the received CDB+data |
1696 | */ | 1702 | */ |
1697 | rc = transport_generic_allocate_tasks(se_cmd, cdb); | 1703 | rc = transport_generic_allocate_tasks(se_cmd, cdb); |
1698 | if (rc != 0) | 1704 | if (rc != 0) { |
1699 | goto out_check_cond; | 1705 | transport_generic_request_failure(se_cmd); |
1706 | return; | ||
1707 | } | ||
1700 | /* | 1708 | /* |
1701 | * Dispatch se_cmd descriptor to se_lun->lun_se_dev backend | 1709 | * Dispatch se_cmd descriptor to se_lun->lun_se_dev backend |
1702 | * for immediate execution of READs, otherwise wait for | 1710 | * for immediate execution of READs, otherwise wait for |
@@ -1704,12 +1712,7 @@ int target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess, | |||
1704 | * when fabric has filled the incoming buffer. | 1712 | * when fabric has filled the incoming buffer. |
1705 | */ | 1713 | */ |
1706 | transport_handle_cdb_direct(se_cmd); | 1714 | transport_handle_cdb_direct(se_cmd); |
1707 | return 0; | 1715 | return; |
1708 | |||
1709 | out_check_cond: | ||
1710 | transport_send_check_condition_and_sense(se_cmd, | ||
1711 | se_cmd->scsi_sense_reason, 0); | ||
1712 | return 0; | ||
1713 | } | 1716 | } |
1714 | EXPORT_SYMBOL(target_submit_cmd); | 1717 | EXPORT_SYMBOL(target_submit_cmd); |
1715 | 1718 | ||
@@ -2694,7 +2697,7 @@ static int transport_generic_cmd_sequencer( | |||
2694 | cmd->se_cmd_flags |= SCF_SCSI_CONTROL_SG_IO_CDB; | 2697 | cmd->se_cmd_flags |= SCF_SCSI_CONTROL_SG_IO_CDB; |
2695 | 2698 | ||
2696 | if (target_check_write_same_discard(&cdb[10], dev) < 0) | 2699 | if (target_check_write_same_discard(&cdb[10], dev) < 0) |
2697 | goto out_invalid_cdb_field; | 2700 | goto out_unsupported_cdb; |
2698 | if (!passthrough) | 2701 | if (!passthrough) |
2699 | cmd->execute_task = target_emulate_write_same; | 2702 | cmd->execute_task = target_emulate_write_same; |
2700 | break; | 2703 | break; |
@@ -2977,7 +2980,7 @@ static int transport_generic_cmd_sequencer( | |||
2977 | cmd->se_cmd_flags |= SCF_SCSI_CONTROL_SG_IO_CDB; | 2980 | cmd->se_cmd_flags |= SCF_SCSI_CONTROL_SG_IO_CDB; |
2978 | 2981 | ||
2979 | if (target_check_write_same_discard(&cdb[1], dev) < 0) | 2982 | if (target_check_write_same_discard(&cdb[1], dev) < 0) |
2980 | goto out_invalid_cdb_field; | 2983 | goto out_unsupported_cdb; |
2981 | if (!passthrough) | 2984 | if (!passthrough) |
2982 | cmd->execute_task = target_emulate_write_same; | 2985 | cmd->execute_task = target_emulate_write_same; |
2983 | break; | 2986 | break; |
@@ -3000,7 +3003,7 @@ static int transport_generic_cmd_sequencer( | |||
3000 | * of byte 1 bit 3 UNMAP instead of original reserved field | 3003 | * of byte 1 bit 3 UNMAP instead of original reserved field |
3001 | */ | 3004 | */ |
3002 | if (target_check_write_same_discard(&cdb[1], dev) < 0) | 3005 | if (target_check_write_same_discard(&cdb[1], dev) < 0) |
3003 | goto out_invalid_cdb_field; | 3006 | goto out_unsupported_cdb; |
3004 | if (!passthrough) | 3007 | if (!passthrough) |
3005 | cmd->execute_task = target_emulate_write_same; | 3008 | cmd->execute_task = target_emulate_write_same; |
3006 | break; | 3009 | break; |
@@ -3082,11 +3085,6 @@ static int transport_generic_cmd_sequencer( | |||
3082 | (cmd->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB))) | 3085 | (cmd->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB))) |
3083 | goto out_unsupported_cdb; | 3086 | goto out_unsupported_cdb; |
3084 | 3087 | ||
3085 | /* Let's limit control cdbs to a page, for simplicity's sake. */ | ||
3086 | if ((cmd->se_cmd_flags & SCF_SCSI_CONTROL_SG_IO_CDB) && | ||
3087 | size > PAGE_SIZE) | ||
3088 | goto out_invalid_cdb_field; | ||
3089 | |||
3090 | transport_set_supported_SAM_opcode(cmd); | 3088 | transport_set_supported_SAM_opcode(cmd); |
3091 | return ret; | 3089 | return ret; |
3092 | 3090 | ||
@@ -3490,9 +3488,11 @@ int transport_generic_map_mem_to_cmd( | |||
3490 | } | 3488 | } |
3491 | EXPORT_SYMBOL(transport_generic_map_mem_to_cmd); | 3489 | EXPORT_SYMBOL(transport_generic_map_mem_to_cmd); |
3492 | 3490 | ||
3493 | void *transport_kmap_first_data_page(struct se_cmd *cmd) | 3491 | void *transport_kmap_data_sg(struct se_cmd *cmd) |
3494 | { | 3492 | { |
3495 | struct scatterlist *sg = cmd->t_data_sg; | 3493 | struct scatterlist *sg = cmd->t_data_sg; |
3494 | struct page **pages; | ||
3495 | int i; | ||
3496 | 3496 | ||
3497 | BUG_ON(!sg); | 3497 | BUG_ON(!sg); |
3498 | /* | 3498 | /* |
@@ -3500,15 +3500,41 @@ void *transport_kmap_first_data_page(struct se_cmd *cmd) | |||
3500 | * tcm_loop who may be using a contig buffer from the SCSI midlayer for | 3500 | * tcm_loop who may be using a contig buffer from the SCSI midlayer for |
3501 | * control CDBs passed as SGLs via transport_generic_map_mem_to_cmd() | 3501 | * control CDBs passed as SGLs via transport_generic_map_mem_to_cmd() |
3502 | */ | 3502 | */ |
3503 | return kmap(sg_page(sg)) + sg->offset; | 3503 | if (!cmd->t_data_nents) |
3504 | return NULL; | ||
3505 | else if (cmd->t_data_nents == 1) | ||
3506 | return kmap(sg_page(sg)) + sg->offset; | ||
3507 | |||
3508 | /* >1 page. use vmap */ | ||
3509 | pages = kmalloc(sizeof(*pages) * cmd->t_data_nents, GFP_KERNEL); | ||
3510 | if (!pages) | ||
3511 | return NULL; | ||
3512 | |||
3513 | /* convert sg[] to pages[] */ | ||
3514 | for_each_sg(cmd->t_data_sg, sg, cmd->t_data_nents, i) { | ||
3515 | pages[i] = sg_page(sg); | ||
3516 | } | ||
3517 | |||
3518 | cmd->t_data_vmap = vmap(pages, cmd->t_data_nents, VM_MAP, PAGE_KERNEL); | ||
3519 | kfree(pages); | ||
3520 | if (!cmd->t_data_vmap) | ||
3521 | return NULL; | ||
3522 | |||
3523 | return cmd->t_data_vmap + cmd->t_data_sg[0].offset; | ||
3504 | } | 3524 | } |
3505 | EXPORT_SYMBOL(transport_kmap_first_data_page); | 3525 | EXPORT_SYMBOL(transport_kmap_data_sg); |
3506 | 3526 | ||
3507 | void transport_kunmap_first_data_page(struct se_cmd *cmd) | 3527 | void transport_kunmap_data_sg(struct se_cmd *cmd) |
3508 | { | 3528 | { |
3509 | kunmap(sg_page(cmd->t_data_sg)); | 3529 | if (!cmd->t_data_nents) |
3530 | return; | ||
3531 | else if (cmd->t_data_nents == 1) | ||
3532 | kunmap(sg_page(cmd->t_data_sg)); | ||
3533 | |||
3534 | vunmap(cmd->t_data_vmap); | ||
3535 | cmd->t_data_vmap = NULL; | ||
3510 | } | 3536 | } |
3511 | EXPORT_SYMBOL(transport_kunmap_first_data_page); | 3537 | EXPORT_SYMBOL(transport_kunmap_data_sg); |
3512 | 3538 | ||
3513 | static int | 3539 | static int |
3514 | transport_generic_get_mem(struct se_cmd *cmd) | 3540 | transport_generic_get_mem(struct se_cmd *cmd) |
@@ -3516,6 +3542,7 @@ transport_generic_get_mem(struct se_cmd *cmd) | |||
3516 | u32 length = cmd->data_length; | 3542 | u32 length = cmd->data_length; |
3517 | unsigned int nents; | 3543 | unsigned int nents; |
3518 | struct page *page; | 3544 | struct page *page; |
3545 | gfp_t zero_flag; | ||
3519 | int i = 0; | 3546 | int i = 0; |
3520 | 3547 | ||
3521 | nents = DIV_ROUND_UP(length, PAGE_SIZE); | 3548 | nents = DIV_ROUND_UP(length, PAGE_SIZE); |
@@ -3526,9 +3553,11 @@ transport_generic_get_mem(struct se_cmd *cmd) | |||
3526 | cmd->t_data_nents = nents; | 3553 | cmd->t_data_nents = nents; |
3527 | sg_init_table(cmd->t_data_sg, nents); | 3554 | sg_init_table(cmd->t_data_sg, nents); |
3528 | 3555 | ||
3556 | zero_flag = cmd->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB ? 0 : __GFP_ZERO; | ||
3557 | |||
3529 | while (length) { | 3558 | while (length) { |
3530 | u32 page_len = min_t(u32, length, PAGE_SIZE); | 3559 | u32 page_len = min_t(u32, length, PAGE_SIZE); |
3531 | page = alloc_page(GFP_KERNEL | __GFP_ZERO); | 3560 | page = alloc_page(GFP_KERNEL | zero_flag); |
3532 | if (!page) | 3561 | if (!page) |
3533 | goto out; | 3562 | goto out; |
3534 | 3563 | ||
@@ -3756,6 +3785,11 @@ transport_allocate_control_task(struct se_cmd *cmd) | |||
3756 | struct se_task *task; | 3785 | struct se_task *task; |
3757 | unsigned long flags; | 3786 | unsigned long flags; |
3758 | 3787 | ||
3788 | /* Workaround for handling zero-length control CDBs */ | ||
3789 | if ((cmd->se_cmd_flags & SCF_SCSI_CONTROL_SG_IO_CDB) && | ||
3790 | !cmd->data_length) | ||
3791 | return 0; | ||
3792 | |||
3759 | task = transport_generic_get_task(cmd, cmd->data_direction); | 3793 | task = transport_generic_get_task(cmd, cmd->data_direction); |
3760 | if (!task) | 3794 | if (!task) |
3761 | return -ENOMEM; | 3795 | return -ENOMEM; |
@@ -3827,6 +3861,14 @@ int transport_generic_new_cmd(struct se_cmd *cmd) | |||
3827 | else if (!task_cdbs && (cmd->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB)) { | 3861 | else if (!task_cdbs && (cmd->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB)) { |
3828 | cmd->t_state = TRANSPORT_COMPLETE; | 3862 | cmd->t_state = TRANSPORT_COMPLETE; |
3829 | atomic_set(&cmd->t_transport_active, 1); | 3863 | atomic_set(&cmd->t_transport_active, 1); |
3864 | |||
3865 | if (cmd->t_task_cdb[0] == REQUEST_SENSE) { | ||
3866 | u8 ua_asc = 0, ua_ascq = 0; | ||
3867 | |||
3868 | core_scsi3_ua_clear_for_request_sense(cmd, | ||
3869 | &ua_asc, &ua_ascq); | ||
3870 | } | ||
3871 | |||
3830 | INIT_WORK(&cmd->work, target_complete_ok_work); | 3872 | INIT_WORK(&cmd->work, target_complete_ok_work); |
3831 | queue_work(target_completion_wq, &cmd->work); | 3873 | queue_work(target_completion_wq, &cmd->work); |
3832 | return 0; | 3874 | return 0; |
@@ -4448,8 +4490,8 @@ int transport_send_check_condition_and_sense( | |||
4448 | /* CURRENT ERROR */ | 4490 | /* CURRENT ERROR */ |
4449 | buffer[offset] = 0x70; | 4491 | buffer[offset] = 0x70; |
4450 | buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10; | 4492 | buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10; |
4451 | /* ABORTED COMMAND */ | 4493 | /* ILLEGAL REQUEST */ |
4452 | buffer[offset+SPC_SENSE_KEY_OFFSET] = ABORTED_COMMAND; | 4494 | buffer[offset+SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST; |
4453 | /* INVALID FIELD IN CDB */ | 4495 | /* INVALID FIELD IN CDB */ |
4454 | buffer[offset+SPC_ASC_KEY_OFFSET] = 0x24; | 4496 | buffer[offset+SPC_ASC_KEY_OFFSET] = 0x24; |
4455 | break; | 4497 | break; |
@@ -4457,8 +4499,8 @@ int transport_send_check_condition_and_sense( | |||
4457 | /* CURRENT ERROR */ | 4499 | /* CURRENT ERROR */ |
4458 | buffer[offset] = 0x70; | 4500 | buffer[offset] = 0x70; |
4459 | buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10; | 4501 | buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10; |
4460 | /* ABORTED COMMAND */ | 4502 | /* ILLEGAL REQUEST */ |
4461 | buffer[offset+SPC_SENSE_KEY_OFFSET] = ABORTED_COMMAND; | 4503 | buffer[offset+SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST; |
4462 | /* INVALID FIELD IN PARAMETER LIST */ | 4504 | /* INVALID FIELD IN PARAMETER LIST */ |
4463 | buffer[offset+SPC_ASC_KEY_OFFSET] = 0x26; | 4505 | buffer[offset+SPC_ASC_KEY_OFFSET] = 0x26; |
4464 | break; | 4506 | break; |
diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c index addc18f727ea..9e7e26c74c79 100644 --- a/drivers/target/tcm_fc/tfc_cmd.c +++ b/drivers/target/tcm_fc/tfc_cmd.c | |||
@@ -540,7 +540,6 @@ static void ft_send_work(struct work_struct *work) | |||
540 | int data_dir = 0; | 540 | int data_dir = 0; |
541 | u32 data_len; | 541 | u32 data_len; |
542 | int task_attr; | 542 | int task_attr; |
543 | int ret; | ||
544 | 543 | ||
545 | fcp = fc_frame_payload_get(cmd->req_frame, sizeof(*fcp)); | 544 | fcp = fc_frame_payload_get(cmd->req_frame, sizeof(*fcp)); |
546 | if (!fcp) | 545 | if (!fcp) |
@@ -603,14 +602,10 @@ static void ft_send_work(struct work_struct *work) | |||
603 | * Use a single se_cmd->cmd_kref as we expect to release se_cmd | 602 | * Use a single se_cmd->cmd_kref as we expect to release se_cmd |
604 | * directly from ft_check_stop_free callback in response path. | 603 | * directly from ft_check_stop_free callback in response path. |
605 | */ | 604 | */ |
606 | ret = target_submit_cmd(&cmd->se_cmd, cmd->sess->se_sess, cmd->cdb, | 605 | target_submit_cmd(&cmd->se_cmd, cmd->sess->se_sess, cmd->cdb, |
607 | &cmd->ft_sense_buffer[0], cmd->lun, data_len, | 606 | &cmd->ft_sense_buffer[0], cmd->lun, data_len, |
608 | task_attr, data_dir, 0); | 607 | task_attr, data_dir, 0); |
609 | pr_debug("r_ctl %x alloc target_submit_cmd %d\n", fh->fh_r_ctl, ret); | 608 | pr_debug("r_ctl %x alloc target_submit_cmd\n", fh->fh_r_ctl); |
610 | if (ret < 0) { | ||
611 | ft_dump_cmd(cmd, __func__); | ||
612 | return; | ||
613 | } | ||
614 | return; | 609 | return; |
615 | 610 | ||
616 | err: | 611 | err: |
diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c index 5e096f43bcea..65447c5f91d7 100644 --- a/drivers/tty/vt/vt_ioctl.c +++ b/drivers/tty/vt/vt_ioctl.c | |||
@@ -1463,7 +1463,6 @@ compat_kdfontop_ioctl(struct compat_console_font_op __user *fontop, | |||
1463 | if (!perm && op->op != KD_FONT_OP_GET) | 1463 | if (!perm && op->op != KD_FONT_OP_GET) |
1464 | return -EPERM; | 1464 | return -EPERM; |
1465 | op->data = compat_ptr(((struct compat_console_font_op *)op)->data); | 1465 | op->data = compat_ptr(((struct compat_console_font_op *)op)->data); |
1466 | op->flags |= KD_FONT_FLAG_OLD; | ||
1467 | i = con_font_op(vc, op); | 1466 | i = con_font_op(vc, op); |
1468 | if (i) | 1467 | if (i) |
1469 | return i; | 1468 | return i; |
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index 0d7b20d4285d..e40c00f2c2ba 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c | |||
@@ -1108,7 +1108,7 @@ static int atmel_lcdfb_suspend(struct platform_device *pdev, pm_message_t mesg) | |||
1108 | */ | 1108 | */ |
1109 | lcdc_writel(sinfo, ATMEL_LCDC_IDR, ~0UL); | 1109 | lcdc_writel(sinfo, ATMEL_LCDC_IDR, ~0UL); |
1110 | 1110 | ||
1111 | sinfo->saved_lcdcon = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_VAL); | 1111 | sinfo->saved_lcdcon = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_CTR); |
1112 | lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, 0); | 1112 | lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, 0); |
1113 | if (sinfo->atmel_lcdfb_power_control) | 1113 | if (sinfo->atmel_lcdfb_power_control) |
1114 | sinfo->atmel_lcdfb_power_control(0); | 1114 | sinfo->atmel_lcdfb_power_control(0); |
diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c index acf292bfba02..6af3f16754f0 100644 --- a/drivers/video/fsl-diu-fb.c +++ b/drivers/video/fsl-diu-fb.c | |||
@@ -1432,7 +1432,7 @@ static int fsl_diu_suspend(struct platform_device *ofdev, pm_message_t state) | |||
1432 | struct fsl_diu_data *data; | 1432 | struct fsl_diu_data *data; |
1433 | 1433 | ||
1434 | data = dev_get_drvdata(&ofdev->dev); | 1434 | data = dev_get_drvdata(&ofdev->dev); |
1435 | disable_lcdc(data->fsl_diu_info[0]); | 1435 | disable_lcdc(data->fsl_diu_info); |
1436 | 1436 | ||
1437 | return 0; | 1437 | return 0; |
1438 | } | 1438 | } |
@@ -1442,7 +1442,7 @@ static int fsl_diu_resume(struct platform_device *ofdev) | |||
1442 | struct fsl_diu_data *data; | 1442 | struct fsl_diu_data *data; |
1443 | 1443 | ||
1444 | data = dev_get_drvdata(&ofdev->dev); | 1444 | data = dev_get_drvdata(&ofdev->dev); |
1445 | enable_lcdc(data->fsl_diu_info[0]); | 1445 | enable_lcdc(data->fsl_diu_info); |
1446 | 1446 | ||
1447 | return 0; | 1447 | return 0; |
1448 | } | 1448 | } |
diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c index c6afa33a4532..02fd2263610c 100644 --- a/drivers/video/intelfb/intelfbdrv.c +++ b/drivers/video/intelfb/intelfbdrv.c | |||
@@ -529,7 +529,6 @@ static int __devinit intelfb_pci_register(struct pci_dev *pdev, | |||
529 | if (fb_alloc_cmap(&info->cmap, 256, 1) < 0) { | 529 | if (fb_alloc_cmap(&info->cmap, 256, 1) < 0) { |
530 | ERR_MSG("Could not allocate cmap for intelfb_info.\n"); | 530 | ERR_MSG("Could not allocate cmap for intelfb_info.\n"); |
531 | goto err_out_cmap; | 531 | goto err_out_cmap; |
532 | return -ENODEV; | ||
533 | } | 532 | } |
534 | 533 | ||
535 | dinfo = info->par; | 534 | dinfo = info->par; |
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index a5ec7f37c185..e1626a1d5c45 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c | |||
@@ -401,7 +401,7 @@ void dispc_runtime_put(void) | |||
401 | 401 | ||
402 | DSSDBG("dispc_runtime_put\n"); | 402 | DSSDBG("dispc_runtime_put\n"); |
403 | 403 | ||
404 | r = pm_runtime_put(&dispc.pdev->dev); | 404 | r = pm_runtime_put_sync(&dispc.pdev->dev); |
405 | WARN_ON(r < 0); | 405 | WARN_ON(r < 0); |
406 | } | 406 | } |
407 | 407 | ||
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index d4d676c82c12..52f36ec1c8bb 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c | |||
@@ -1079,7 +1079,7 @@ void dsi_runtime_put(struct platform_device *dsidev) | |||
1079 | 1079 | ||
1080 | DSSDBG("dsi_runtime_put\n"); | 1080 | DSSDBG("dsi_runtime_put\n"); |
1081 | 1081 | ||
1082 | r = pm_runtime_put(&dsi->pdev->dev); | 1082 | r = pm_runtime_put_sync(&dsi->pdev->dev); |
1083 | WARN_ON(r < 0); | 1083 | WARN_ON(r < 0); |
1084 | } | 1084 | } |
1085 | 1085 | ||
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c index 17033457ee89..77c2b5a32b5d 100644 --- a/drivers/video/omap2/dss/dss.c +++ b/drivers/video/omap2/dss/dss.c | |||
@@ -720,7 +720,7 @@ void dss_runtime_put(void) | |||
720 | 720 | ||
721 | DSSDBG("dss_runtime_put\n"); | 721 | DSSDBG("dss_runtime_put\n"); |
722 | 722 | ||
723 | r = pm_runtime_put(&dss.pdev->dev); | 723 | r = pm_runtime_put_sync(&dss.pdev->dev); |
724 | WARN_ON(r < 0); | 724 | WARN_ON(r < 0); |
725 | } | 725 | } |
726 | 726 | ||
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index b4c270edb915..d7aa3b056529 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c | |||
@@ -176,7 +176,7 @@ static void hdmi_runtime_put(void) | |||
176 | 176 | ||
177 | DSSDBG("hdmi_runtime_put\n"); | 177 | DSSDBG("hdmi_runtime_put\n"); |
178 | 178 | ||
179 | r = pm_runtime_put(&hdmi.pdev->dev); | 179 | r = pm_runtime_put_sync(&hdmi.pdev->dev); |
180 | WARN_ON(r < 0); | 180 | WARN_ON(r < 0); |
181 | } | 181 | } |
182 | 182 | ||
@@ -497,6 +497,7 @@ bool omapdss_hdmi_detect(void) | |||
497 | 497 | ||
498 | int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev) | 498 | int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev) |
499 | { | 499 | { |
500 | struct omap_dss_hdmi_data *priv = dssdev->data; | ||
500 | int r = 0; | 501 | int r = 0; |
501 | 502 | ||
502 | DSSDBG("ENTER hdmi_display_enable\n"); | 503 | DSSDBG("ENTER hdmi_display_enable\n"); |
@@ -509,6 +510,8 @@ int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev) | |||
509 | goto err0; | 510 | goto err0; |
510 | } | 511 | } |
511 | 512 | ||
513 | hdmi.ip_data.hpd_gpio = priv->hpd_gpio; | ||
514 | |||
512 | r = omap_dss_start_device(dssdev); | 515 | r = omap_dss_start_device(dssdev); |
513 | if (r) { | 516 | if (r) { |
514 | DSSERR("failed to start device\n"); | 517 | DSSERR("failed to start device\n"); |
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c index 814bb9500dca..55f398014f33 100644 --- a/drivers/video/omap2/dss/rfbi.c +++ b/drivers/video/omap2/dss/rfbi.c | |||
@@ -140,7 +140,7 @@ static void rfbi_runtime_put(void) | |||
140 | 140 | ||
141 | DSSDBG("rfbi_runtime_put\n"); | 141 | DSSDBG("rfbi_runtime_put\n"); |
142 | 142 | ||
143 | r = pm_runtime_put(&rfbi.pdev->dev); | 143 | r = pm_runtime_put_sync(&rfbi.pdev->dev); |
144 | WARN_ON(r < 0); | 144 | WARN_ON(r < 0); |
145 | } | 145 | } |
146 | 146 | ||
diff --git a/drivers/video/omap2/dss/ti_hdmi.h b/drivers/video/omap2/dss/ti_hdmi.h index 7503f7f619a7..50dadba5070a 100644 --- a/drivers/video/omap2/dss/ti_hdmi.h +++ b/drivers/video/omap2/dss/ti_hdmi.h | |||
@@ -126,6 +126,10 @@ struct hdmi_ip_data { | |||
126 | const struct ti_hdmi_ip_ops *ops; | 126 | const struct ti_hdmi_ip_ops *ops; |
127 | struct hdmi_config cfg; | 127 | struct hdmi_config cfg; |
128 | struct hdmi_pll_info pll_data; | 128 | struct hdmi_pll_info pll_data; |
129 | |||
130 | /* ti_hdmi_4xxx_ip private data. These should be in a separate struct */ | ||
131 | int hpd_gpio; | ||
132 | bool phy_tx_enabled; | ||
129 | }; | 133 | }; |
130 | int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data); | 134 | int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data); |
131 | void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data); | 135 | void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data); |
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c index 9af81f18f163..2d72334ca3da 100644 --- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c +++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
29 | #include <linux/string.h> | 29 | #include <linux/string.h> |
30 | #include <linux/seq_file.h> | 30 | #include <linux/seq_file.h> |
31 | #include <linux/gpio.h> | ||
31 | 32 | ||
32 | #include "ti_hdmi_4xxx_ip.h" | 33 | #include "ti_hdmi_4xxx_ip.h" |
33 | #include "dss.h" | 34 | #include "dss.h" |
@@ -223,6 +224,49 @@ void ti_hdmi_4xxx_pll_disable(struct hdmi_ip_data *ip_data) | |||
223 | hdmi_set_pll_pwr(ip_data, HDMI_PLLPWRCMD_ALLOFF); | 224 | hdmi_set_pll_pwr(ip_data, HDMI_PLLPWRCMD_ALLOFF); |
224 | } | 225 | } |
225 | 226 | ||
227 | static int hdmi_check_hpd_state(struct hdmi_ip_data *ip_data) | ||
228 | { | ||
229 | unsigned long flags; | ||
230 | bool hpd; | ||
231 | int r; | ||
232 | /* this should be in ti_hdmi_4xxx_ip private data */ | ||
233 | static DEFINE_SPINLOCK(phy_tx_lock); | ||
234 | |||
235 | spin_lock_irqsave(&phy_tx_lock, flags); | ||
236 | |||
237 | hpd = gpio_get_value(ip_data->hpd_gpio); | ||
238 | |||
239 | if (hpd == ip_data->phy_tx_enabled) { | ||
240 | spin_unlock_irqrestore(&phy_tx_lock, flags); | ||
241 | return 0; | ||
242 | } | ||
243 | |||
244 | if (hpd) | ||
245 | r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_TXON); | ||
246 | else | ||
247 | r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_LDOON); | ||
248 | |||
249 | if (r) { | ||
250 | DSSERR("Failed to %s PHY TX power\n", | ||
251 | hpd ? "enable" : "disable"); | ||
252 | goto err; | ||
253 | } | ||
254 | |||
255 | ip_data->phy_tx_enabled = hpd; | ||
256 | err: | ||
257 | spin_unlock_irqrestore(&phy_tx_lock, flags); | ||
258 | return r; | ||
259 | } | ||
260 | |||
261 | static irqreturn_t hpd_irq_handler(int irq, void *data) | ||
262 | { | ||
263 | struct hdmi_ip_data *ip_data = data; | ||
264 | |||
265 | hdmi_check_hpd_state(ip_data); | ||
266 | |||
267 | return IRQ_HANDLED; | ||
268 | } | ||
269 | |||
226 | int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data) | 270 | int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data) |
227 | { | 271 | { |
228 | u16 r = 0; | 272 | u16 r = 0; |
@@ -232,10 +276,6 @@ int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data) | |||
232 | if (r) | 276 | if (r) |
233 | return r; | 277 | return r; |
234 | 278 | ||
235 | r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_TXON); | ||
236 | if (r) | ||
237 | return r; | ||
238 | |||
239 | /* | 279 | /* |
240 | * Read address 0 in order to get the SCP reset done completed | 280 | * Read address 0 in order to get the SCP reset done completed |
241 | * Dummy access performed to make sure reset is done | 281 | * Dummy access performed to make sure reset is done |
@@ -257,12 +297,32 @@ int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data) | |||
257 | /* Write to phy address 3 to change the polarity control */ | 297 | /* Write to phy address 3 to change the polarity control */ |
258 | REG_FLD_MOD(phy_base, HDMI_TXPHY_PAD_CFG_CTRL, 0x1, 27, 27); | 298 | REG_FLD_MOD(phy_base, HDMI_TXPHY_PAD_CFG_CTRL, 0x1, 27, 27); |
259 | 299 | ||
300 | r = request_threaded_irq(gpio_to_irq(ip_data->hpd_gpio), | ||
301 | NULL, hpd_irq_handler, | ||
302 | IRQF_DISABLED | IRQF_TRIGGER_RISING | | ||
303 | IRQF_TRIGGER_FALLING, "hpd", ip_data); | ||
304 | if (r) { | ||
305 | DSSERR("HPD IRQ request failed\n"); | ||
306 | hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_OFF); | ||
307 | return r; | ||
308 | } | ||
309 | |||
310 | r = hdmi_check_hpd_state(ip_data); | ||
311 | if (r) { | ||
312 | free_irq(gpio_to_irq(ip_data->hpd_gpio), ip_data); | ||
313 | hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_OFF); | ||
314 | return r; | ||
315 | } | ||
316 | |||
260 | return 0; | 317 | return 0; |
261 | } | 318 | } |
262 | 319 | ||
263 | void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data) | 320 | void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data) |
264 | { | 321 | { |
322 | free_irq(gpio_to_irq(ip_data->hpd_gpio), ip_data); | ||
323 | |||
265 | hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_OFF); | 324 | hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_OFF); |
325 | ip_data->phy_tx_enabled = false; | ||
266 | } | 326 | } |
267 | 327 | ||
268 | static int hdmi_core_ddc_init(struct hdmi_ip_data *ip_data) | 328 | static int hdmi_core_ddc_init(struct hdmi_ip_data *ip_data) |
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c index b3e9f9091581..5c3d0f901510 100644 --- a/drivers/video/omap2/dss/venc.c +++ b/drivers/video/omap2/dss/venc.c | |||
@@ -401,7 +401,7 @@ static void venc_runtime_put(void) | |||
401 | 401 | ||
402 | DSSDBG("venc_runtime_put\n"); | 402 | DSSDBG("venc_runtime_put\n"); |
403 | 403 | ||
404 | r = pm_runtime_put(&venc.pdev->dev); | 404 | r = pm_runtime_put_sync(&venc.pdev->dev); |
405 | WARN_ON(r < 0); | 405 | WARN_ON(r < 0); |
406 | } | 406 | } |
407 | 407 | ||