diff options
Diffstat (limited to 'drivers')
103 files changed, 884 insertions, 503 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index db6dfcfa3e2e..ab58556d347c 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
| @@ -3625,6 +3625,7 @@ int ata_scsi_add_hosts(struct ata_host *host, struct scsi_host_template *sht) | |||
| 3625 | shost->max_lun = 1; | 3625 | shost->max_lun = 1; |
| 3626 | shost->max_channel = 1; | 3626 | shost->max_channel = 1; |
| 3627 | shost->max_cmd_len = 16; | 3627 | shost->max_cmd_len = 16; |
| 3628 | shost->no_write_same = 1; | ||
| 3628 | 3629 | ||
| 3629 | /* Schedule policy is determined by ->qc_defer() | 3630 | /* Schedule policy is determined by ->qc_defer() |
| 3630 | * callback and it needs to see every deferred qc. | 3631 | * callback and it needs to see every deferred qc. |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 1b41fca3d65a..e3219dfd736c 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #include <linux/async.h> | 29 | #include <linux/async.h> |
| 30 | #include <linux/suspend.h> | 30 | #include <linux/suspend.h> |
| 31 | #include <trace/events/power.h> | 31 | #include <trace/events/power.h> |
| 32 | #include <linux/cpufreq.h> | ||
| 32 | #include <linux/cpuidle.h> | 33 | #include <linux/cpuidle.h> |
| 33 | #include <linux/timer.h> | 34 | #include <linux/timer.h> |
| 34 | 35 | ||
| @@ -540,6 +541,7 @@ static void dpm_resume_noirq(pm_message_t state) | |||
| 540 | dpm_show_time(starttime, state, "noirq"); | 541 | dpm_show_time(starttime, state, "noirq"); |
| 541 | resume_device_irqs(); | 542 | resume_device_irqs(); |
| 542 | cpuidle_resume(); | 543 | cpuidle_resume(); |
| 544 | cpufreq_resume(); | ||
| 543 | } | 545 | } |
| 544 | 546 | ||
| 545 | /** | 547 | /** |
| @@ -955,6 +957,7 @@ static int dpm_suspend_noirq(pm_message_t state) | |||
| 955 | ktime_t starttime = ktime_get(); | 957 | ktime_t starttime = ktime_get(); |
| 956 | int error = 0; | 958 | int error = 0; |
| 957 | 959 | ||
| 960 | cpufreq_suspend(); | ||
| 958 | cpuidle_pause(); | 961 | cpuidle_pause(); |
| 959 | suspend_device_irqs(); | 962 | suspend_device_irqs(); |
| 960 | mutex_lock(&dpm_list_mtx); | 963 | mutex_lock(&dpm_list_mtx); |
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 432db1b59b00..c4a4c9006288 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
| @@ -489,7 +489,7 @@ static int blkif_queue_request(struct request *req) | |||
| 489 | 489 | ||
| 490 | if ((ring_req->operation == BLKIF_OP_INDIRECT) && | 490 | if ((ring_req->operation == BLKIF_OP_INDIRECT) && |
| 491 | (i % SEGS_PER_INDIRECT_FRAME == 0)) { | 491 | (i % SEGS_PER_INDIRECT_FRAME == 0)) { |
| 492 | unsigned long pfn; | 492 | unsigned long uninitialized_var(pfn); |
| 493 | 493 | ||
| 494 | if (segments) | 494 | if (segments) |
| 495 | kunmap_atomic(segments); | 495 | kunmap_atomic(segments); |
| @@ -2011,6 +2011,10 @@ static void blkif_release(struct gendisk *disk, fmode_t mode) | |||
| 2011 | 2011 | ||
| 2012 | bdev = bdget_disk(disk, 0); | 2012 | bdev = bdget_disk(disk, 0); |
| 2013 | 2013 | ||
| 2014 | if (!bdev) { | ||
| 2015 | WARN(1, "Block device %s yanked out from us!\n", disk->disk_name); | ||
| 2016 | goto out_mutex; | ||
| 2017 | } | ||
| 2014 | if (bdev->bd_openers) | 2018 | if (bdev->bd_openers) |
| 2015 | goto out; | 2019 | goto out; |
| 2016 | 2020 | ||
| @@ -2041,6 +2045,7 @@ static void blkif_release(struct gendisk *disk, fmode_t mode) | |||
| 2041 | 2045 | ||
| 2042 | out: | 2046 | out: |
| 2043 | bdput(bdev); | 2047 | bdput(bdev); |
| 2048 | out_mutex: | ||
| 2044 | mutex_unlock(&blkfront_mutex); | 2049 | mutex_unlock(&blkfront_mutex); |
| 2045 | } | 2050 | } |
| 2046 | 2051 | ||
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index bdb953e15d2a..5c07a56962db 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig | |||
| @@ -87,6 +87,7 @@ config ARM_ARCH_TIMER | |||
| 87 | config ARM_ARCH_TIMER_EVTSTREAM | 87 | config ARM_ARCH_TIMER_EVTSTREAM |
| 88 | bool "Support for ARM architected timer event stream generation" | 88 | bool "Support for ARM architected timer event stream generation" |
| 89 | default y if ARM_ARCH_TIMER | 89 | default y if ARM_ARCH_TIMER |
| 90 | depends on ARM_ARCH_TIMER | ||
| 90 | help | 91 | help |
| 91 | This option enables support for event stream generation based on | 92 | This option enables support for event stream generation based on |
| 92 | the ARM architected timer. It is used for waking up CPUs executing | 93 | the ARM architected timer. It is used for waking up CPUs executing |
diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c index 4aac9ee0d0c0..3cf12834681e 100644 --- a/drivers/clocksource/sh_mtu2.c +++ b/drivers/clocksource/sh_mtu2.c | |||
| @@ -313,8 +313,20 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev) | |||
| 313 | goto err1; | 313 | goto err1; |
| 314 | } | 314 | } |
| 315 | 315 | ||
| 316 | return sh_mtu2_register(p, (char *)dev_name(&p->pdev->dev), | 316 | ret = clk_prepare(p->clk); |
| 317 | cfg->clockevent_rating); | 317 | if (ret < 0) |
| 318 | goto err2; | ||
| 319 | |||
| 320 | ret = sh_mtu2_register(p, (char *)dev_name(&p->pdev->dev), | ||
| 321 | cfg->clockevent_rating); | ||
| 322 | if (ret < 0) | ||
| 323 | goto err3; | ||
| 324 | |||
| 325 | return 0; | ||
| 326 | err3: | ||
| 327 | clk_unprepare(p->clk); | ||
| 328 | err2: | ||
| 329 | clk_put(p->clk); | ||
| 318 | err1: | 330 | err1: |
| 319 | iounmap(p->mapbase); | 331 | iounmap(p->mapbase); |
| 320 | err0: | 332 | err0: |
diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c index 78b8dae49628..63557cda0a7d 100644 --- a/drivers/clocksource/sh_tmu.c +++ b/drivers/clocksource/sh_tmu.c | |||
| @@ -472,12 +472,26 @@ static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev) | |||
| 472 | ret = PTR_ERR(p->clk); | 472 | ret = PTR_ERR(p->clk); |
| 473 | goto err1; | 473 | goto err1; |
| 474 | } | 474 | } |
| 475 | |||
| 476 | ret = clk_prepare(p->clk); | ||
| 477 | if (ret < 0) | ||
| 478 | goto err2; | ||
| 479 | |||
| 475 | p->cs_enabled = false; | 480 | p->cs_enabled = false; |
| 476 | p->enable_count = 0; | 481 | p->enable_count = 0; |
| 477 | 482 | ||
| 478 | return sh_tmu_register(p, (char *)dev_name(&p->pdev->dev), | 483 | ret = sh_tmu_register(p, (char *)dev_name(&p->pdev->dev), |
| 479 | cfg->clockevent_rating, | 484 | cfg->clockevent_rating, |
| 480 | cfg->clocksource_rating); | 485 | cfg->clocksource_rating); |
| 486 | if (ret < 0) | ||
| 487 | goto err3; | ||
| 488 | |||
| 489 | return 0; | ||
| 490 | |||
| 491 | err3: | ||
| 492 | clk_unprepare(p->clk); | ||
| 493 | err2: | ||
| 494 | clk_put(p->clk); | ||
| 481 | err1: | 495 | err1: |
| 482 | iounmap(p->mapbase); | 496 | iounmap(p->mapbase); |
| 483 | err0: | 497 | err0: |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 02d534da22dd..81e9d4412db8 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
| 27 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
| 28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
| 29 | #include <linux/suspend.h> | ||
| 29 | #include <linux/syscore_ops.h> | 30 | #include <linux/syscore_ops.h> |
| 30 | #include <linux/tick.h> | 31 | #include <linux/tick.h> |
| 31 | #include <trace/events/power.h> | 32 | #include <trace/events/power.h> |
| @@ -47,6 +48,9 @@ static LIST_HEAD(cpufreq_policy_list); | |||
| 47 | static DEFINE_PER_CPU(char[CPUFREQ_NAME_LEN], cpufreq_cpu_governor); | 48 | static DEFINE_PER_CPU(char[CPUFREQ_NAME_LEN], cpufreq_cpu_governor); |
| 48 | #endif | 49 | #endif |
| 49 | 50 | ||
| 51 | /* Flag to suspend/resume CPUFreq governors */ | ||
| 52 | static bool cpufreq_suspended; | ||
| 53 | |||
| 50 | static inline bool has_target(void) | 54 | static inline bool has_target(void) |
| 51 | { | 55 | { |
| 52 | return cpufreq_driver->target_index || cpufreq_driver->target; | 56 | return cpufreq_driver->target_index || cpufreq_driver->target; |
| @@ -1462,6 +1466,41 @@ static struct subsys_interface cpufreq_interface = { | |||
| 1462 | .remove_dev = cpufreq_remove_dev, | 1466 | .remove_dev = cpufreq_remove_dev, |
| 1463 | }; | 1467 | }; |
| 1464 | 1468 | ||
| 1469 | void cpufreq_suspend(void) | ||
| 1470 | { | ||
| 1471 | struct cpufreq_policy *policy; | ||
| 1472 | |||
| 1473 | if (!has_target()) | ||
| 1474 | return; | ||
| 1475 | |||
| 1476 | pr_debug("%s: Suspending Governors\n", __func__); | ||
| 1477 | |||
| 1478 | list_for_each_entry(policy, &cpufreq_policy_list, policy_list) | ||
| 1479 | if (__cpufreq_governor(policy, CPUFREQ_GOV_STOP)) | ||
| 1480 | pr_err("%s: Failed to stop governor for policy: %p\n", | ||
| 1481 | __func__, policy); | ||
| 1482 | |||
| 1483 | cpufreq_suspended = true; | ||
| 1484 | } | ||
| 1485 | |||
| 1486 | void cpufreq_resume(void) | ||
| 1487 | { | ||
| 1488 | struct cpufreq_policy *policy; | ||
| 1489 | |||
| 1490 | if (!has_target()) | ||
| 1491 | return; | ||
| 1492 | |||
| 1493 | pr_debug("%s: Resuming Governors\n", __func__); | ||
| 1494 | |||
| 1495 | cpufreq_suspended = false; | ||
| 1496 | |||
| 1497 | list_for_each_entry(policy, &cpufreq_policy_list, policy_list) | ||
| 1498 | if (__cpufreq_governor(policy, CPUFREQ_GOV_START) | ||
| 1499 | || __cpufreq_governor(policy, CPUFREQ_GOV_LIMITS)) | ||
| 1500 | pr_err("%s: Failed to start governor for policy: %p\n", | ||
| 1501 | __func__, policy); | ||
| 1502 | } | ||
| 1503 | |||
| 1465 | /** | 1504 | /** |
| 1466 | * cpufreq_bp_suspend - Prepare the boot CPU for system suspend. | 1505 | * cpufreq_bp_suspend - Prepare the boot CPU for system suspend. |
| 1467 | * | 1506 | * |
| @@ -1764,6 +1803,10 @@ static int __cpufreq_governor(struct cpufreq_policy *policy, | |||
| 1764 | struct cpufreq_governor *gov = NULL; | 1803 | struct cpufreq_governor *gov = NULL; |
| 1765 | #endif | 1804 | #endif |
| 1766 | 1805 | ||
| 1806 | /* Don't start any governor operations if we are entering suspend */ | ||
| 1807 | if (cpufreq_suspended) | ||
| 1808 | return 0; | ||
| 1809 | |||
| 1767 | if (policy->governor->max_transition_latency && | 1810 | if (policy->governor->max_transition_latency && |
| 1768 | policy->cpuinfo.transition_latency > | 1811 | policy->cpuinfo.transition_latency > |
| 1769 | policy->governor->max_transition_latency) { | 1812 | policy->governor->max_transition_latency) { |
| @@ -2076,9 +2119,6 @@ static int cpufreq_cpu_callback(struct notifier_block *nfb, | |||
| 2076 | dev = get_cpu_device(cpu); | 2119 | dev = get_cpu_device(cpu); |
| 2077 | if (dev) { | 2120 | if (dev) { |
| 2078 | 2121 | ||
| 2079 | if (action & CPU_TASKS_FROZEN) | ||
| 2080 | frozen = true; | ||
| 2081 | |||
| 2082 | switch (action & ~CPU_TASKS_FROZEN) { | 2122 | switch (action & ~CPU_TASKS_FROZEN) { |
| 2083 | case CPU_ONLINE: | 2123 | case CPU_ONLINE: |
| 2084 | __cpufreq_add_dev(dev, NULL, frozen); | 2124 | __cpufreq_add_dev(dev, NULL, frozen); |
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 2a991e468f78..a55e68f2cfc8 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c | |||
| @@ -400,7 +400,7 @@ EXPORT_SYMBOL_GPL(cpuidle_register_device); | |||
| 400 | */ | 400 | */ |
| 401 | void cpuidle_unregister_device(struct cpuidle_device *dev) | 401 | void cpuidle_unregister_device(struct cpuidle_device *dev) |
| 402 | { | 402 | { |
| 403 | if (dev->registered == 0) | 403 | if (!dev || dev->registered == 0) |
| 404 | return; | 404 | return; |
| 405 | 405 | ||
| 406 | cpuidle_pause_and_lock(); | 406 | cpuidle_pause_and_lock(); |
diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c index 4f44b71b9e24..4cf5dec826e1 100644 --- a/drivers/crypto/caam/caamalg.c +++ b/drivers/crypto/caam/caamalg.c | |||
| @@ -818,7 +818,7 @@ static void aead_decrypt_done(struct device *jrdev, u32 *desc, u32 err, | |||
| 818 | ivsize, 1); | 818 | ivsize, 1); |
| 819 | print_hex_dump(KERN_ERR, "dst @"__stringify(__LINE__)": ", | 819 | print_hex_dump(KERN_ERR, "dst @"__stringify(__LINE__)": ", |
| 820 | DUMP_PREFIX_ADDRESS, 16, 4, sg_virt(req->dst), | 820 | DUMP_PREFIX_ADDRESS, 16, 4, sg_virt(req->dst), |
| 821 | req->cryptlen, 1); | 821 | req->cryptlen - ctx->authsize, 1); |
| 822 | #endif | 822 | #endif |
| 823 | 823 | ||
| 824 | if (err) { | 824 | if (err) { |
| @@ -972,12 +972,9 @@ static void init_aead_job(u32 *sh_desc, dma_addr_t ptr, | |||
| 972 | (edesc->src_nents ? : 1); | 972 | (edesc->src_nents ? : 1); |
| 973 | in_options = LDST_SGF; | 973 | in_options = LDST_SGF; |
| 974 | } | 974 | } |
| 975 | if (encrypt) | 975 | |
| 976 | append_seq_in_ptr(desc, src_dma, req->assoclen + ivsize + | 976 | append_seq_in_ptr(desc, src_dma, req->assoclen + ivsize + req->cryptlen, |
| 977 | req->cryptlen - authsize, in_options); | 977 | in_options); |
| 978 | else | ||
| 979 | append_seq_in_ptr(desc, src_dma, req->assoclen + ivsize + | ||
| 980 | req->cryptlen, in_options); | ||
| 981 | 978 | ||
| 982 | if (likely(req->src == req->dst)) { | 979 | if (likely(req->src == req->dst)) { |
| 983 | if (all_contig) { | 980 | if (all_contig) { |
| @@ -998,7 +995,8 @@ static void init_aead_job(u32 *sh_desc, dma_addr_t ptr, | |||
| 998 | } | 995 | } |
| 999 | } | 996 | } |
| 1000 | if (encrypt) | 997 | if (encrypt) |
| 1001 | append_seq_out_ptr(desc, dst_dma, req->cryptlen, out_options); | 998 | append_seq_out_ptr(desc, dst_dma, req->cryptlen + authsize, |
| 999 | out_options); | ||
| 1002 | else | 1000 | else |
| 1003 | append_seq_out_ptr(desc, dst_dma, req->cryptlen - authsize, | 1001 | append_seq_out_ptr(desc, dst_dma, req->cryptlen - authsize, |
| 1004 | out_options); | 1002 | out_options); |
| @@ -1048,8 +1046,8 @@ static void init_aead_giv_job(u32 *sh_desc, dma_addr_t ptr, | |||
| 1048 | sec4_sg_index += edesc->assoc_nents + 1 + edesc->src_nents; | 1046 | sec4_sg_index += edesc->assoc_nents + 1 + edesc->src_nents; |
| 1049 | in_options = LDST_SGF; | 1047 | in_options = LDST_SGF; |
| 1050 | } | 1048 | } |
| 1051 | append_seq_in_ptr(desc, src_dma, req->assoclen + ivsize + | 1049 | append_seq_in_ptr(desc, src_dma, req->assoclen + ivsize + req->cryptlen, |
| 1052 | req->cryptlen - authsize, in_options); | 1050 | in_options); |
| 1053 | 1051 | ||
| 1054 | if (contig & GIV_DST_CONTIG) { | 1052 | if (contig & GIV_DST_CONTIG) { |
| 1055 | dst_dma = edesc->iv_dma; | 1053 | dst_dma = edesc->iv_dma; |
| @@ -1066,7 +1064,8 @@ static void init_aead_giv_job(u32 *sh_desc, dma_addr_t ptr, | |||
| 1066 | } | 1064 | } |
| 1067 | } | 1065 | } |
| 1068 | 1066 | ||
| 1069 | append_seq_out_ptr(desc, dst_dma, ivsize + req->cryptlen, out_options); | 1067 | append_seq_out_ptr(desc, dst_dma, ivsize + req->cryptlen + authsize, |
| 1068 | out_options); | ||
| 1070 | } | 1069 | } |
| 1071 | 1070 | ||
| 1072 | /* | 1071 | /* |
| @@ -1130,7 +1129,8 @@ static void init_ablkcipher_job(u32 *sh_desc, dma_addr_t ptr, | |||
| 1130 | * allocate and map the aead extended descriptor | 1129 | * allocate and map the aead extended descriptor |
| 1131 | */ | 1130 | */ |
| 1132 | static struct aead_edesc *aead_edesc_alloc(struct aead_request *req, | 1131 | static struct aead_edesc *aead_edesc_alloc(struct aead_request *req, |
| 1133 | int desc_bytes, bool *all_contig_ptr) | 1132 | int desc_bytes, bool *all_contig_ptr, |
| 1133 | bool encrypt) | ||
| 1134 | { | 1134 | { |
| 1135 | struct crypto_aead *aead = crypto_aead_reqtfm(req); | 1135 | struct crypto_aead *aead = crypto_aead_reqtfm(req); |
| 1136 | struct caam_ctx *ctx = crypto_aead_ctx(aead); | 1136 | struct caam_ctx *ctx = crypto_aead_ctx(aead); |
| @@ -1145,12 +1145,22 @@ static struct aead_edesc *aead_edesc_alloc(struct aead_request *req, | |||
| 1145 | bool assoc_chained = false, src_chained = false, dst_chained = false; | 1145 | bool assoc_chained = false, src_chained = false, dst_chained = false; |
| 1146 | int ivsize = crypto_aead_ivsize(aead); | 1146 | int ivsize = crypto_aead_ivsize(aead); |
| 1147 | int sec4_sg_index, sec4_sg_len = 0, sec4_sg_bytes; | 1147 | int sec4_sg_index, sec4_sg_len = 0, sec4_sg_bytes; |
| 1148 | unsigned int authsize = ctx->authsize; | ||
| 1148 | 1149 | ||
| 1149 | assoc_nents = sg_count(req->assoc, req->assoclen, &assoc_chained); | 1150 | assoc_nents = sg_count(req->assoc, req->assoclen, &assoc_chained); |
| 1150 | src_nents = sg_count(req->src, req->cryptlen, &src_chained); | ||
| 1151 | 1151 | ||
| 1152 | if (unlikely(req->dst != req->src)) | 1152 | if (unlikely(req->dst != req->src)) { |
| 1153 | dst_nents = sg_count(req->dst, req->cryptlen, &dst_chained); | 1153 | src_nents = sg_count(req->src, req->cryptlen, &src_chained); |
| 1154 | dst_nents = sg_count(req->dst, | ||
| 1155 | req->cryptlen + | ||
| 1156 | (encrypt ? authsize : (-authsize)), | ||
| 1157 | &dst_chained); | ||
| 1158 | } else { | ||
| 1159 | src_nents = sg_count(req->src, | ||
| 1160 | req->cryptlen + | ||
| 1161 | (encrypt ? authsize : 0), | ||
| 1162 | &src_chained); | ||
| 1163 | } | ||
| 1154 | 1164 | ||
| 1155 | sgc = dma_map_sg_chained(jrdev, req->assoc, assoc_nents ? : 1, | 1165 | sgc = dma_map_sg_chained(jrdev, req->assoc, assoc_nents ? : 1, |
| 1156 | DMA_TO_DEVICE, assoc_chained); | 1166 | DMA_TO_DEVICE, assoc_chained); |
| @@ -1234,11 +1244,9 @@ static int aead_encrypt(struct aead_request *req) | |||
| 1234 | u32 *desc; | 1244 | u32 *desc; |
| 1235 | int ret = 0; | 1245 | int ret = 0; |
| 1236 | 1246 | ||
| 1237 | req->cryptlen += ctx->authsize; | ||
| 1238 | |||
| 1239 | /* allocate extended descriptor */ | 1247 | /* allocate extended descriptor */ |
| 1240 | edesc = aead_edesc_alloc(req, DESC_JOB_IO_LEN * | 1248 | edesc = aead_edesc_alloc(req, DESC_JOB_IO_LEN * |
| 1241 | CAAM_CMD_SZ, &all_contig); | 1249 | CAAM_CMD_SZ, &all_contig, true); |
| 1242 | if (IS_ERR(edesc)) | 1250 | if (IS_ERR(edesc)) |
| 1243 | return PTR_ERR(edesc); | 1251 | return PTR_ERR(edesc); |
| 1244 | 1252 | ||
| @@ -1275,7 +1283,7 @@ static int aead_decrypt(struct aead_request *req) | |||
| 1275 | 1283 | ||
| 1276 | /* allocate extended descriptor */ | 1284 | /* allocate extended descriptor */ |
| 1277 | edesc = aead_edesc_alloc(req, DESC_JOB_IO_LEN * | 1285 | edesc = aead_edesc_alloc(req, DESC_JOB_IO_LEN * |
| 1278 | CAAM_CMD_SZ, &all_contig); | 1286 | CAAM_CMD_SZ, &all_contig, false); |
| 1279 | if (IS_ERR(edesc)) | 1287 | if (IS_ERR(edesc)) |
| 1280 | return PTR_ERR(edesc); | 1288 | return PTR_ERR(edesc); |
| 1281 | 1289 | ||
| @@ -1332,7 +1340,8 @@ static struct aead_edesc *aead_giv_edesc_alloc(struct aead_givcrypt_request | |||
| 1332 | src_nents = sg_count(req->src, req->cryptlen, &src_chained); | 1340 | src_nents = sg_count(req->src, req->cryptlen, &src_chained); |
| 1333 | 1341 | ||
| 1334 | if (unlikely(req->dst != req->src)) | 1342 | if (unlikely(req->dst != req->src)) |
| 1335 | dst_nents = sg_count(req->dst, req->cryptlen, &dst_chained); | 1343 | dst_nents = sg_count(req->dst, req->cryptlen + ctx->authsize, |
| 1344 | &dst_chained); | ||
| 1336 | 1345 | ||
| 1337 | sgc = dma_map_sg_chained(jrdev, req->assoc, assoc_nents ? : 1, | 1346 | sgc = dma_map_sg_chained(jrdev, req->assoc, assoc_nents ? : 1, |
| 1338 | DMA_TO_DEVICE, assoc_chained); | 1347 | DMA_TO_DEVICE, assoc_chained); |
| @@ -1426,8 +1435,6 @@ static int aead_givencrypt(struct aead_givcrypt_request *areq) | |||
| 1426 | u32 *desc; | 1435 | u32 *desc; |
| 1427 | int ret = 0; | 1436 | int ret = 0; |
| 1428 | 1437 | ||
| 1429 | req->cryptlen += ctx->authsize; | ||
| 1430 | |||
| 1431 | /* allocate extended descriptor */ | 1438 | /* allocate extended descriptor */ |
| 1432 | edesc = aead_giv_edesc_alloc(areq, DESC_JOB_IO_LEN * | 1439 | edesc = aead_giv_edesc_alloc(areq, DESC_JOB_IO_LEN * |
| 1433 | CAAM_CMD_SZ, &contig); | 1440 | CAAM_CMD_SZ, &contig); |
diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c index d23356d20e1c..1d80bd3636c5 100644 --- a/drivers/crypto/caam/jr.c +++ b/drivers/crypto/caam/jr.c | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| 8 | #include <linux/of_irq.h> | 8 | #include <linux/of_irq.h> |
| 9 | #include <linux/of_address.h> | ||
| 9 | 10 | ||
| 10 | #include "compat.h" | 11 | #include "compat.h" |
| 11 | #include "regs.h" | 12 | #include "regs.h" |
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index 905de4427e7c..b44f4ddc565c 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c | |||
| @@ -790,7 +790,7 @@ static void ipsec_esp_unmap(struct device *dev, | |||
| 790 | 790 | ||
| 791 | if (edesc->assoc_chained) | 791 | if (edesc->assoc_chained) |
| 792 | talitos_unmap_sg_chain(dev, areq->assoc, DMA_TO_DEVICE); | 792 | talitos_unmap_sg_chain(dev, areq->assoc, DMA_TO_DEVICE); |
| 793 | else | 793 | else if (areq->assoclen) |
| 794 | /* assoc_nents counts also for IV in non-contiguous cases */ | 794 | /* assoc_nents counts also for IV in non-contiguous cases */ |
| 795 | dma_unmap_sg(dev, areq->assoc, | 795 | dma_unmap_sg(dev, areq->assoc, |
| 796 | edesc->assoc_nents ? edesc->assoc_nents - 1 : 1, | 796 | edesc->assoc_nents ? edesc->assoc_nents - 1 : 1, |
| @@ -973,7 +973,11 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, | |||
| 973 | dma_sync_single_for_device(dev, edesc->dma_link_tbl, | 973 | dma_sync_single_for_device(dev, edesc->dma_link_tbl, |
| 974 | edesc->dma_len, DMA_BIDIRECTIONAL); | 974 | edesc->dma_len, DMA_BIDIRECTIONAL); |
| 975 | } else { | 975 | } else { |
| 976 | to_talitos_ptr(&desc->ptr[1], sg_dma_address(areq->assoc)); | 976 | if (areq->assoclen) |
| 977 | to_talitos_ptr(&desc->ptr[1], | ||
| 978 | sg_dma_address(areq->assoc)); | ||
| 979 | else | ||
| 980 | to_talitos_ptr(&desc->ptr[1], edesc->iv_dma); | ||
| 977 | desc->ptr[1].j_extent = 0; | 981 | desc->ptr[1].j_extent = 0; |
| 978 | } | 982 | } |
| 979 | 983 | ||
| @@ -1108,7 +1112,8 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev, | |||
| 1108 | unsigned int authsize, | 1112 | unsigned int authsize, |
| 1109 | unsigned int ivsize, | 1113 | unsigned int ivsize, |
| 1110 | int icv_stashing, | 1114 | int icv_stashing, |
| 1111 | u32 cryptoflags) | 1115 | u32 cryptoflags, |
| 1116 | bool encrypt) | ||
| 1112 | { | 1117 | { |
| 1113 | struct talitos_edesc *edesc; | 1118 | struct talitos_edesc *edesc; |
| 1114 | int assoc_nents = 0, src_nents, dst_nents, alloc_len, dma_len; | 1119 | int assoc_nents = 0, src_nents, dst_nents, alloc_len, dma_len; |
| @@ -1122,10 +1127,10 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev, | |||
| 1122 | return ERR_PTR(-EINVAL); | 1127 | return ERR_PTR(-EINVAL); |
| 1123 | } | 1128 | } |
| 1124 | 1129 | ||
| 1125 | if (iv) | 1130 | if (ivsize) |
| 1126 | iv_dma = dma_map_single(dev, iv, ivsize, DMA_TO_DEVICE); | 1131 | iv_dma = dma_map_single(dev, iv, ivsize, DMA_TO_DEVICE); |
| 1127 | 1132 | ||
| 1128 | if (assoc) { | 1133 | if (assoclen) { |
| 1129 | /* | 1134 | /* |
| 1130 | * Currently it is assumed that iv is provided whenever assoc | 1135 | * Currently it is assumed that iv is provided whenever assoc |
| 1131 | * is. | 1136 | * is. |
| @@ -1141,19 +1146,17 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev, | |||
| 1141 | assoc_nents = assoc_nents ? assoc_nents + 1 : 2; | 1146 | assoc_nents = assoc_nents ? assoc_nents + 1 : 2; |
| 1142 | } | 1147 | } |
| 1143 | 1148 | ||
| 1144 | src_nents = sg_count(src, cryptlen + authsize, &src_chained); | 1149 | if (!dst || dst == src) { |
| 1145 | src_nents = (src_nents == 1) ? 0 : src_nents; | 1150 | src_nents = sg_count(src, cryptlen + authsize, &src_chained); |
| 1146 | 1151 | src_nents = (src_nents == 1) ? 0 : src_nents; | |
| 1147 | if (!dst) { | 1152 | dst_nents = dst ? src_nents : 0; |
| 1148 | dst_nents = 0; | 1153 | } else { /* dst && dst != src*/ |
| 1149 | } else { | 1154 | src_nents = sg_count(src, cryptlen + (encrypt ? 0 : authsize), |
| 1150 | if (dst == src) { | 1155 | &src_chained); |
| 1151 | dst_nents = src_nents; | 1156 | src_nents = (src_nents == 1) ? 0 : src_nents; |
| 1152 | } else { | 1157 | dst_nents = sg_count(dst, cryptlen + (encrypt ? authsize : 0), |
| 1153 | dst_nents = sg_count(dst, cryptlen + authsize, | 1158 | &dst_chained); |
| 1154 | &dst_chained); | 1159 | dst_nents = (dst_nents == 1) ? 0 : dst_nents; |
| 1155 | dst_nents = (dst_nents == 1) ? 0 : dst_nents; | ||
| 1156 | } | ||
| 1157 | } | 1160 | } |
| 1158 | 1161 | ||
| 1159 | /* | 1162 | /* |
| @@ -1173,9 +1176,16 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev, | |||
| 1173 | 1176 | ||
| 1174 | edesc = kmalloc(alloc_len, GFP_DMA | flags); | 1177 | edesc = kmalloc(alloc_len, GFP_DMA | flags); |
| 1175 | if (!edesc) { | 1178 | if (!edesc) { |
| 1176 | talitos_unmap_sg_chain(dev, assoc, DMA_TO_DEVICE); | 1179 | if (assoc_chained) |
| 1180 | talitos_unmap_sg_chain(dev, assoc, DMA_TO_DEVICE); | ||
| 1181 | else if (assoclen) | ||
| 1182 | dma_unmap_sg(dev, assoc, | ||
| 1183 | assoc_nents ? assoc_nents - 1 : 1, | ||
| 1184 | DMA_TO_DEVICE); | ||
| 1185 | |||
| 1177 | if (iv_dma) | 1186 | if (iv_dma) |
| 1178 | dma_unmap_single(dev, iv_dma, ivsize, DMA_TO_DEVICE); | 1187 | dma_unmap_single(dev, iv_dma, ivsize, DMA_TO_DEVICE); |
| 1188 | |||
| 1179 | dev_err(dev, "could not allocate edescriptor\n"); | 1189 | dev_err(dev, "could not allocate edescriptor\n"); |
| 1180 | return ERR_PTR(-ENOMEM); | 1190 | return ERR_PTR(-ENOMEM); |
| 1181 | } | 1191 | } |
| @@ -1197,7 +1207,7 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev, | |||
| 1197 | } | 1207 | } |
| 1198 | 1208 | ||
| 1199 | static struct talitos_edesc *aead_edesc_alloc(struct aead_request *areq, u8 *iv, | 1209 | static struct talitos_edesc *aead_edesc_alloc(struct aead_request *areq, u8 *iv, |
| 1200 | int icv_stashing) | 1210 | int icv_stashing, bool encrypt) |
| 1201 | { | 1211 | { |
| 1202 | struct crypto_aead *authenc = crypto_aead_reqtfm(areq); | 1212 | struct crypto_aead *authenc = crypto_aead_reqtfm(areq); |
| 1203 | struct talitos_ctx *ctx = crypto_aead_ctx(authenc); | 1213 | struct talitos_ctx *ctx = crypto_aead_ctx(authenc); |
| @@ -1206,7 +1216,7 @@ static struct talitos_edesc *aead_edesc_alloc(struct aead_request *areq, u8 *iv, | |||
| 1206 | return talitos_edesc_alloc(ctx->dev, areq->assoc, areq->src, areq->dst, | 1216 | return talitos_edesc_alloc(ctx->dev, areq->assoc, areq->src, areq->dst, |
| 1207 | iv, areq->assoclen, areq->cryptlen, | 1217 | iv, areq->assoclen, areq->cryptlen, |
| 1208 | ctx->authsize, ivsize, icv_stashing, | 1218 | ctx->authsize, ivsize, icv_stashing, |
| 1209 | areq->base.flags); | 1219 | areq->base.flags, encrypt); |
| 1210 | } | 1220 | } |
| 1211 | 1221 | ||
| 1212 | static int aead_encrypt(struct aead_request *req) | 1222 | static int aead_encrypt(struct aead_request *req) |
| @@ -1216,7 +1226,7 @@ static int aead_encrypt(struct aead_request *req) | |||
| 1216 | struct talitos_edesc *edesc; | 1226 | struct talitos_edesc *edesc; |
| 1217 | 1227 | ||
| 1218 | /* allocate extended descriptor */ | 1228 | /* allocate extended descriptor */ |
| 1219 | edesc = aead_edesc_alloc(req, req->iv, 0); | 1229 | edesc = aead_edesc_alloc(req, req->iv, 0, true); |
| 1220 | if (IS_ERR(edesc)) | 1230 | if (IS_ERR(edesc)) |
| 1221 | return PTR_ERR(edesc); | 1231 | return PTR_ERR(edesc); |
| 1222 | 1232 | ||
| @@ -1239,7 +1249,7 @@ static int aead_decrypt(struct aead_request *req) | |||
| 1239 | req->cryptlen -= authsize; | 1249 | req->cryptlen -= authsize; |
| 1240 | 1250 | ||
| 1241 | /* allocate extended descriptor */ | 1251 | /* allocate extended descriptor */ |
| 1242 | edesc = aead_edesc_alloc(req, req->iv, 1); | 1252 | edesc = aead_edesc_alloc(req, req->iv, 1, false); |
| 1243 | if (IS_ERR(edesc)) | 1253 | if (IS_ERR(edesc)) |
| 1244 | return PTR_ERR(edesc); | 1254 | return PTR_ERR(edesc); |
| 1245 | 1255 | ||
| @@ -1285,7 +1295,7 @@ static int aead_givencrypt(struct aead_givcrypt_request *req) | |||
| 1285 | struct talitos_edesc *edesc; | 1295 | struct talitos_edesc *edesc; |
| 1286 | 1296 | ||
| 1287 | /* allocate extended descriptor */ | 1297 | /* allocate extended descriptor */ |
| 1288 | edesc = aead_edesc_alloc(areq, req->giv, 0); | 1298 | edesc = aead_edesc_alloc(areq, req->giv, 0, true); |
| 1289 | if (IS_ERR(edesc)) | 1299 | if (IS_ERR(edesc)) |
| 1290 | return PTR_ERR(edesc); | 1300 | return PTR_ERR(edesc); |
| 1291 | 1301 | ||
| @@ -1441,7 +1451,7 @@ static int common_nonsnoop(struct talitos_edesc *edesc, | |||
| 1441 | } | 1451 | } |
| 1442 | 1452 | ||
| 1443 | static struct talitos_edesc *ablkcipher_edesc_alloc(struct ablkcipher_request * | 1453 | static struct talitos_edesc *ablkcipher_edesc_alloc(struct ablkcipher_request * |
| 1444 | areq) | 1454 | areq, bool encrypt) |
| 1445 | { | 1455 | { |
| 1446 | struct crypto_ablkcipher *cipher = crypto_ablkcipher_reqtfm(areq); | 1456 | struct crypto_ablkcipher *cipher = crypto_ablkcipher_reqtfm(areq); |
| 1447 | struct talitos_ctx *ctx = crypto_ablkcipher_ctx(cipher); | 1457 | struct talitos_ctx *ctx = crypto_ablkcipher_ctx(cipher); |
| @@ -1449,7 +1459,7 @@ static struct talitos_edesc *ablkcipher_edesc_alloc(struct ablkcipher_request * | |||
| 1449 | 1459 | ||
| 1450 | return talitos_edesc_alloc(ctx->dev, NULL, areq->src, areq->dst, | 1460 | return talitos_edesc_alloc(ctx->dev, NULL, areq->src, areq->dst, |
| 1451 | areq->info, 0, areq->nbytes, 0, ivsize, 0, | 1461 | areq->info, 0, areq->nbytes, 0, ivsize, 0, |
| 1452 | areq->base.flags); | 1462 | areq->base.flags, encrypt); |
| 1453 | } | 1463 | } |
| 1454 | 1464 | ||
| 1455 | static int ablkcipher_encrypt(struct ablkcipher_request *areq) | 1465 | static int ablkcipher_encrypt(struct ablkcipher_request *areq) |
| @@ -1459,7 +1469,7 @@ static int ablkcipher_encrypt(struct ablkcipher_request *areq) | |||
| 1459 | struct talitos_edesc *edesc; | 1469 | struct talitos_edesc *edesc; |
| 1460 | 1470 | ||
| 1461 | /* allocate extended descriptor */ | 1471 | /* allocate extended descriptor */ |
| 1462 | edesc = ablkcipher_edesc_alloc(areq); | 1472 | edesc = ablkcipher_edesc_alloc(areq, true); |
| 1463 | if (IS_ERR(edesc)) | 1473 | if (IS_ERR(edesc)) |
| 1464 | return PTR_ERR(edesc); | 1474 | return PTR_ERR(edesc); |
| 1465 | 1475 | ||
| @@ -1476,7 +1486,7 @@ static int ablkcipher_decrypt(struct ablkcipher_request *areq) | |||
| 1476 | struct talitos_edesc *edesc; | 1486 | struct talitos_edesc *edesc; |
| 1477 | 1487 | ||
| 1478 | /* allocate extended descriptor */ | 1488 | /* allocate extended descriptor */ |
| 1479 | edesc = ablkcipher_edesc_alloc(areq); | 1489 | edesc = ablkcipher_edesc_alloc(areq, false); |
| 1480 | if (IS_ERR(edesc)) | 1490 | if (IS_ERR(edesc)) |
| 1481 | return PTR_ERR(edesc); | 1491 | return PTR_ERR(edesc); |
| 1482 | 1492 | ||
| @@ -1628,7 +1638,7 @@ static struct talitos_edesc *ahash_edesc_alloc(struct ahash_request *areq, | |||
| 1628 | struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); | 1638 | struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); |
| 1629 | 1639 | ||
| 1630 | return talitos_edesc_alloc(ctx->dev, NULL, req_ctx->psrc, NULL, NULL, 0, | 1640 | return talitos_edesc_alloc(ctx->dev, NULL, req_ctx->psrc, NULL, NULL, 0, |
| 1631 | nbytes, 0, 0, 0, areq->base.flags); | 1641 | nbytes, 0, 0, 0, areq->base.flags, false); |
| 1632 | } | 1642 | } |
| 1633 | 1643 | ||
| 1634 | static int ahash_init(struct ahash_request *areq) | 1644 | static int ahash_init(struct ahash_request *areq) |
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c index 281029daf98c..b0bb056458a3 100644 --- a/drivers/firewire/sbp2.c +++ b/drivers/firewire/sbp2.c | |||
| @@ -1623,6 +1623,7 @@ static struct scsi_host_template scsi_driver_template = { | |||
| 1623 | .cmd_per_lun = 1, | 1623 | .cmd_per_lun = 1, |
| 1624 | .can_queue = 1, | 1624 | .can_queue = 1, |
| 1625 | .sdev_attrs = sbp2_scsi_sysfs_attrs, | 1625 | .sdev_attrs = sbp2_scsi_sysfs_attrs, |
| 1626 | .no_write_same = 1, | ||
| 1626 | }; | 1627 | }; |
| 1627 | 1628 | ||
| 1628 | MODULE_AUTHOR("Kristian Hoegsberg <krh@bitplanet.net>"); | 1629 | MODULE_AUTHOR("Kristian Hoegsberg <krh@bitplanet.net>"); |
diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c index 5002d50e3781..743fd426f21b 100644 --- a/drivers/firmware/efi/efi-pstore.c +++ b/drivers/firmware/efi/efi-pstore.c | |||
| @@ -18,14 +18,12 @@ module_param_named(pstore_disable, efivars_pstore_disable, bool, 0644); | |||
| 18 | 18 | ||
| 19 | static int efi_pstore_open(struct pstore_info *psi) | 19 | static int efi_pstore_open(struct pstore_info *psi) |
| 20 | { | 20 | { |
| 21 | efivar_entry_iter_begin(); | ||
| 22 | psi->data = NULL; | 21 | psi->data = NULL; |
| 23 | return 0; | 22 | return 0; |
| 24 | } | 23 | } |
| 25 | 24 | ||
| 26 | static int efi_pstore_close(struct pstore_info *psi) | 25 | static int efi_pstore_close(struct pstore_info *psi) |
| 27 | { | 26 | { |
| 28 | efivar_entry_iter_end(); | ||
| 29 | psi->data = NULL; | 27 | psi->data = NULL; |
| 30 | return 0; | 28 | return 0; |
| 31 | } | 29 | } |
| @@ -39,6 +37,12 @@ struct pstore_read_data { | |||
| 39 | char **buf; | 37 | char **buf; |
| 40 | }; | 38 | }; |
| 41 | 39 | ||
| 40 | static inline u64 generic_id(unsigned long timestamp, | ||
| 41 | unsigned int part, int count) | ||
| 42 | { | ||
| 43 | return (timestamp * 100 + part) * 1000 + count; | ||
| 44 | } | ||
| 45 | |||
| 42 | static int efi_pstore_read_func(struct efivar_entry *entry, void *data) | 46 | static int efi_pstore_read_func(struct efivar_entry *entry, void *data) |
| 43 | { | 47 | { |
| 44 | efi_guid_t vendor = LINUX_EFI_CRASH_GUID; | 48 | efi_guid_t vendor = LINUX_EFI_CRASH_GUID; |
| @@ -57,7 +61,7 @@ static int efi_pstore_read_func(struct efivar_entry *entry, void *data) | |||
| 57 | 61 | ||
| 58 | if (sscanf(name, "dump-type%u-%u-%d-%lu-%c", | 62 | if (sscanf(name, "dump-type%u-%u-%d-%lu-%c", |
| 59 | cb_data->type, &part, &cnt, &time, &data_type) == 5) { | 63 | cb_data->type, &part, &cnt, &time, &data_type) == 5) { |
| 60 | *cb_data->id = part; | 64 | *cb_data->id = generic_id(time, part, cnt); |
| 61 | *cb_data->count = cnt; | 65 | *cb_data->count = cnt; |
| 62 | cb_data->timespec->tv_sec = time; | 66 | cb_data->timespec->tv_sec = time; |
| 63 | cb_data->timespec->tv_nsec = 0; | 67 | cb_data->timespec->tv_nsec = 0; |
| @@ -67,7 +71,7 @@ static int efi_pstore_read_func(struct efivar_entry *entry, void *data) | |||
| 67 | *cb_data->compressed = false; | 71 | *cb_data->compressed = false; |
| 68 | } else if (sscanf(name, "dump-type%u-%u-%d-%lu", | 72 | } else if (sscanf(name, "dump-type%u-%u-%d-%lu", |
| 69 | cb_data->type, &part, &cnt, &time) == 4) { | 73 | cb_data->type, &part, &cnt, &time) == 4) { |
| 70 | *cb_data->id = part; | 74 | *cb_data->id = generic_id(time, part, cnt); |
| 71 | *cb_data->count = cnt; | 75 | *cb_data->count = cnt; |
| 72 | cb_data->timespec->tv_sec = time; | 76 | cb_data->timespec->tv_sec = time; |
| 73 | cb_data->timespec->tv_nsec = 0; | 77 | cb_data->timespec->tv_nsec = 0; |
| @@ -79,7 +83,7 @@ static int efi_pstore_read_func(struct efivar_entry *entry, void *data) | |||
| 79 | * which doesn't support holding | 83 | * which doesn't support holding |
| 80 | * multiple logs, remains. | 84 | * multiple logs, remains. |
| 81 | */ | 85 | */ |
| 82 | *cb_data->id = part; | 86 | *cb_data->id = generic_id(time, part, 0); |
| 83 | *cb_data->count = 0; | 87 | *cb_data->count = 0; |
| 84 | cb_data->timespec->tv_sec = time; | 88 | cb_data->timespec->tv_sec = time; |
| 85 | cb_data->timespec->tv_nsec = 0; | 89 | cb_data->timespec->tv_nsec = 0; |
| @@ -91,19 +95,125 @@ static int efi_pstore_read_func(struct efivar_entry *entry, void *data) | |||
| 91 | __efivar_entry_get(entry, &entry->var.Attributes, | 95 | __efivar_entry_get(entry, &entry->var.Attributes, |
| 92 | &entry->var.DataSize, entry->var.Data); | 96 | &entry->var.DataSize, entry->var.Data); |
| 93 | size = entry->var.DataSize; | 97 | size = entry->var.DataSize; |
| 98 | memcpy(*cb_data->buf, entry->var.Data, | ||
| 99 | (size_t)min_t(unsigned long, EFIVARS_DATA_SIZE_MAX, size)); | ||
| 94 | 100 | ||
| 95 | *cb_data->buf = kmemdup(entry->var.Data, size, GFP_KERNEL); | ||
| 96 | if (*cb_data->buf == NULL) | ||
| 97 | return -ENOMEM; | ||
| 98 | return size; | 101 | return size; |
| 99 | } | 102 | } |
| 100 | 103 | ||
| 104 | /** | ||
| 105 | * efi_pstore_scan_sysfs_enter | ||
| 106 | * @entry: scanning entry | ||
| 107 | * @next: next entry | ||
| 108 | * @head: list head | ||
| 109 | */ | ||
| 110 | static void efi_pstore_scan_sysfs_enter(struct efivar_entry *pos, | ||
| 111 | struct efivar_entry *next, | ||
| 112 | struct list_head *head) | ||
| 113 | { | ||
| 114 | pos->scanning = true; | ||
| 115 | if (&next->list != head) | ||
| 116 | next->scanning = true; | ||
| 117 | } | ||
| 118 | |||
| 119 | /** | ||
| 120 | * __efi_pstore_scan_sysfs_exit | ||
| 121 | * @entry: deleting entry | ||
| 122 | * @turn_off_scanning: Check if a scanning flag should be turned off | ||
| 123 | */ | ||
| 124 | static inline void __efi_pstore_scan_sysfs_exit(struct efivar_entry *entry, | ||
| 125 | bool turn_off_scanning) | ||
| 126 | { | ||
| 127 | if (entry->deleting) { | ||
| 128 | list_del(&entry->list); | ||
| 129 | efivar_entry_iter_end(); | ||
| 130 | efivar_unregister(entry); | ||
| 131 | efivar_entry_iter_begin(); | ||
| 132 | } else if (turn_off_scanning) | ||
| 133 | entry->scanning = false; | ||
| 134 | } | ||
| 135 | |||
| 136 | /** | ||
| 137 | * efi_pstore_scan_sysfs_exit | ||
| 138 | * @pos: scanning entry | ||
| 139 | * @next: next entry | ||
| 140 | * @head: list head | ||
| 141 | * @stop: a flag checking if scanning will stop | ||
| 142 | */ | ||
| 143 | static void efi_pstore_scan_sysfs_exit(struct efivar_entry *pos, | ||
| 144 | struct efivar_entry *next, | ||
| 145 | struct list_head *head, bool stop) | ||
| 146 | { | ||
| 147 | __efi_pstore_scan_sysfs_exit(pos, true); | ||
| 148 | if (stop) | ||
| 149 | __efi_pstore_scan_sysfs_exit(next, &next->list != head); | ||
| 150 | } | ||
| 151 | |||
| 152 | /** | ||
| 153 | * efi_pstore_sysfs_entry_iter | ||
| 154 | * | ||
| 155 | * @data: function-specific data to pass to callback | ||
| 156 | * @pos: entry to begin iterating from | ||
| 157 | * | ||
| 158 | * You MUST call efivar_enter_iter_begin() before this function, and | ||
| 159 | * efivar_entry_iter_end() afterwards. | ||
| 160 | * | ||
| 161 | * It is possible to begin iteration from an arbitrary entry within | ||
| 162 | * the list by passing @pos. @pos is updated on return to point to | ||
| 163 | * the next entry of the last one passed to efi_pstore_read_func(). | ||
| 164 | * To begin iterating from the beginning of the list @pos must be %NULL. | ||
| 165 | */ | ||
| 166 | static int efi_pstore_sysfs_entry_iter(void *data, struct efivar_entry **pos) | ||
| 167 | { | ||
| 168 | struct efivar_entry *entry, *n; | ||
| 169 | struct list_head *head = &efivar_sysfs_list; | ||
| 170 | int size = 0; | ||
| 171 | |||
| 172 | if (!*pos) { | ||
| 173 | list_for_each_entry_safe(entry, n, head, list) { | ||
| 174 | efi_pstore_scan_sysfs_enter(entry, n, head); | ||
| 175 | |||
| 176 | size = efi_pstore_read_func(entry, data); | ||
| 177 | efi_pstore_scan_sysfs_exit(entry, n, head, size < 0); | ||
| 178 | if (size) | ||
| 179 | break; | ||
| 180 | } | ||
| 181 | *pos = n; | ||
| 182 | return size; | ||
| 183 | } | ||
| 184 | |||
| 185 | list_for_each_entry_safe_from((*pos), n, head, list) { | ||
| 186 | efi_pstore_scan_sysfs_enter((*pos), n, head); | ||
| 187 | |||
| 188 | size = efi_pstore_read_func((*pos), data); | ||
| 189 | efi_pstore_scan_sysfs_exit((*pos), n, head, size < 0); | ||
| 190 | if (size) | ||
| 191 | break; | ||
| 192 | } | ||
| 193 | *pos = n; | ||
| 194 | return size; | ||
| 195 | } | ||
| 196 | |||
| 197 | /** | ||
| 198 | * efi_pstore_read | ||
| 199 | * | ||
| 200 | * This function returns a size of NVRAM entry logged via efi_pstore_write(). | ||
| 201 | * The meaning and behavior of efi_pstore/pstore are as below. | ||
| 202 | * | ||
| 203 | * size > 0: Got data of an entry logged via efi_pstore_write() successfully, | ||
| 204 | * and pstore filesystem will continue reading subsequent entries. | ||
| 205 | * size == 0: Entry was not logged via efi_pstore_write(), | ||
| 206 | * and efi_pstore driver will continue reading subsequent entries. | ||
| 207 | * size < 0: Failed to get data of entry logging via efi_pstore_write(), | ||
| 208 | * and pstore will stop reading entry. | ||
| 209 | */ | ||
| 101 | static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, | 210 | static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, |
| 102 | int *count, struct timespec *timespec, | 211 | int *count, struct timespec *timespec, |
| 103 | char **buf, bool *compressed, | 212 | char **buf, bool *compressed, |
| 104 | struct pstore_info *psi) | 213 | struct pstore_info *psi) |
| 105 | { | 214 | { |
| 106 | struct pstore_read_data data; | 215 | struct pstore_read_data data; |
| 216 | ssize_t size; | ||
| 107 | 217 | ||
| 108 | data.id = id; | 218 | data.id = id; |
| 109 | data.type = type; | 219 | data.type = type; |
| @@ -112,8 +222,17 @@ static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, | |||
| 112 | data.compressed = compressed; | 222 | data.compressed = compressed; |
| 113 | data.buf = buf; | 223 | data.buf = buf; |
| 114 | 224 | ||
| 115 | return __efivar_entry_iter(efi_pstore_read_func, &efivar_sysfs_list, &data, | 225 | *data.buf = kzalloc(EFIVARS_DATA_SIZE_MAX, GFP_KERNEL); |
| 116 | (struct efivar_entry **)&psi->data); | 226 | if (!*data.buf) |
| 227 | return -ENOMEM; | ||
| 228 | |||
| 229 | efivar_entry_iter_begin(); | ||
| 230 | size = efi_pstore_sysfs_entry_iter(&data, | ||
| 231 | (struct efivar_entry **)&psi->data); | ||
| 232 | efivar_entry_iter_end(); | ||
| 233 | if (size <= 0) | ||
| 234 | kfree(*data.buf); | ||
| 235 | return size; | ||
| 117 | } | 236 | } |
| 118 | 237 | ||
| 119 | static int efi_pstore_write(enum pstore_type_id type, | 238 | static int efi_pstore_write(enum pstore_type_id type, |
| @@ -184,9 +303,17 @@ static int efi_pstore_erase_func(struct efivar_entry *entry, void *data) | |||
| 184 | return 0; | 303 | return 0; |
| 185 | } | 304 | } |
| 186 | 305 | ||
| 306 | if (entry->scanning) { | ||
| 307 | /* | ||
| 308 | * Skip deletion because this entry will be deleted | ||
| 309 | * after scanning is completed. | ||
| 310 | */ | ||
| 311 | entry->deleting = true; | ||
| 312 | } else | ||
| 313 | list_del(&entry->list); | ||
| 314 | |||
| 187 | /* found */ | 315 | /* found */ |
| 188 | __efivar_entry_delete(entry); | 316 | __efivar_entry_delete(entry); |
| 189 | list_del(&entry->list); | ||
| 190 | 317 | ||
| 191 | return 1; | 318 | return 1; |
| 192 | } | 319 | } |
| @@ -199,14 +326,16 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count, | |||
| 199 | char name[DUMP_NAME_LEN]; | 326 | char name[DUMP_NAME_LEN]; |
| 200 | efi_char16_t efi_name[DUMP_NAME_LEN]; | 327 | efi_char16_t efi_name[DUMP_NAME_LEN]; |
| 201 | int found, i; | 328 | int found, i; |
| 329 | unsigned int part; | ||
| 202 | 330 | ||
| 203 | sprintf(name, "dump-type%u-%u-%d-%lu", type, (unsigned int)id, count, | 331 | do_div(id, 1000); |
| 204 | time.tv_sec); | 332 | part = do_div(id, 100); |
| 333 | sprintf(name, "dump-type%u-%u-%d-%lu", type, part, count, time.tv_sec); | ||
| 205 | 334 | ||
| 206 | for (i = 0; i < DUMP_NAME_LEN; i++) | 335 | for (i = 0; i < DUMP_NAME_LEN; i++) |
| 207 | efi_name[i] = name[i]; | 336 | efi_name[i] = name[i]; |
| 208 | 337 | ||
| 209 | edata.id = id; | 338 | edata.id = part; |
| 210 | edata.type = type; | 339 | edata.type = type; |
| 211 | edata.count = count; | 340 | edata.count = count; |
| 212 | edata.time = time; | 341 | edata.time = time; |
| @@ -214,10 +343,12 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count, | |||
| 214 | 343 | ||
| 215 | efivar_entry_iter_begin(); | 344 | efivar_entry_iter_begin(); |
| 216 | found = __efivar_entry_iter(efi_pstore_erase_func, &efivar_sysfs_list, &edata, &entry); | 345 | found = __efivar_entry_iter(efi_pstore_erase_func, &efivar_sysfs_list, &edata, &entry); |
| 217 | efivar_entry_iter_end(); | ||
| 218 | 346 | ||
| 219 | if (found) | 347 | if (found && !entry->scanning) { |
| 348 | efivar_entry_iter_end(); | ||
| 220 | efivar_unregister(entry); | 349 | efivar_unregister(entry); |
| 350 | } else | ||
| 351 | efivar_entry_iter_end(); | ||
| 221 | 352 | ||
| 222 | return 0; | 353 | return 0; |
| 223 | } | 354 | } |
diff --git a/drivers/firmware/efi/efivars.c b/drivers/firmware/efi/efivars.c index 933eb027d527..3dc248239197 100644 --- a/drivers/firmware/efi/efivars.c +++ b/drivers/firmware/efi/efivars.c | |||
| @@ -383,12 +383,16 @@ static ssize_t efivar_delete(struct file *filp, struct kobject *kobj, | |||
| 383 | else if (__efivar_entry_delete(entry)) | 383 | else if (__efivar_entry_delete(entry)) |
| 384 | err = -EIO; | 384 | err = -EIO; |
| 385 | 385 | ||
| 386 | efivar_entry_iter_end(); | 386 | if (err) { |
| 387 | 387 | efivar_entry_iter_end(); | |
| 388 | if (err) | ||
| 389 | return err; | 388 | return err; |
| 389 | } | ||
| 390 | 390 | ||
| 391 | efivar_unregister(entry); | 391 | if (!entry->scanning) { |
| 392 | efivar_entry_iter_end(); | ||
| 393 | efivar_unregister(entry); | ||
| 394 | } else | ||
| 395 | efivar_entry_iter_end(); | ||
| 392 | 396 | ||
| 393 | /* It's dead Jim.... */ | 397 | /* It's dead Jim.... */ |
| 394 | return count; | 398 | return count; |
diff --git a/drivers/firmware/efi/vars.c b/drivers/firmware/efi/vars.c index 391c67b182d9..b22659cccca4 100644 --- a/drivers/firmware/efi/vars.c +++ b/drivers/firmware/efi/vars.c | |||
| @@ -683,8 +683,16 @@ struct efivar_entry *efivar_entry_find(efi_char16_t *name, efi_guid_t guid, | |||
| 683 | if (!found) | 683 | if (!found) |
| 684 | return NULL; | 684 | return NULL; |
| 685 | 685 | ||
| 686 | if (remove) | 686 | if (remove) { |
| 687 | list_del(&entry->list); | 687 | if (entry->scanning) { |
| 688 | /* | ||
| 689 | * The entry will be deleted | ||
| 690 | * after scanning is completed. | ||
| 691 | */ | ||
| 692 | entry->deleting = true; | ||
| 693 | } else | ||
| 694 | list_del(&entry->list); | ||
| 695 | } | ||
| 688 | 696 | ||
| 689 | return entry; | 697 | return entry; |
| 690 | } | 698 | } |
diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c index 914e859e3eda..d7d6d72eba33 100644 --- a/drivers/gpio/gpio-mpc8xxx.c +++ b/drivers/gpio/gpio-mpc8xxx.c | |||
| @@ -70,10 +70,14 @@ static int mpc8572_gpio_get(struct gpio_chip *gc, unsigned int gpio) | |||
| 70 | u32 val; | 70 | u32 val; |
| 71 | struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc); | 71 | struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc); |
| 72 | struct mpc8xxx_gpio_chip *mpc8xxx_gc = to_mpc8xxx_gpio_chip(mm); | 72 | struct mpc8xxx_gpio_chip *mpc8xxx_gc = to_mpc8xxx_gpio_chip(mm); |
| 73 | u32 out_mask, out_shadow; | ||
| 73 | 74 | ||
| 74 | val = in_be32(mm->regs + GPIO_DAT) & ~in_be32(mm->regs + GPIO_DIR); | 75 | out_mask = in_be32(mm->regs + GPIO_DIR); |
| 75 | 76 | ||
| 76 | return (val | mpc8xxx_gc->data) & mpc8xxx_gpio2mask(gpio); | 77 | val = in_be32(mm->regs + GPIO_DAT) & ~out_mask; |
| 78 | out_shadow = mpc8xxx_gc->data & out_mask; | ||
| 79 | |||
| 80 | return (val | out_shadow) & mpc8xxx_gpio2mask(gpio); | ||
| 77 | } | 81 | } |
| 78 | 82 | ||
| 79 | static int mpc8xxx_gpio_get(struct gpio_chip *gc, unsigned int gpio) | 83 | static int mpc8xxx_gpio_get(struct gpio_chip *gc, unsigned int gpio) |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index ac53a9593662..85f772c0b26a 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
| @@ -2368,7 +2368,7 @@ static struct gpio_desc *gpiod_find(struct device *dev, const char *con_id, | |||
| 2368 | continue; | 2368 | continue; |
| 2369 | } | 2369 | } |
| 2370 | 2370 | ||
| 2371 | if (chip->ngpio >= p->chip_hwnum) { | 2371 | if (chip->ngpio <= p->chip_hwnum) { |
| 2372 | dev_warn(dev, "GPIO chip %s has %d GPIOs\n", | 2372 | dev_warn(dev, "GPIO chip %s has %d GPIOs\n", |
| 2373 | chip->label, chip->ngpio); | 2373 | chip->label, chip->ngpio); |
| 2374 | continue; | 2374 | continue; |
| @@ -2418,7 +2418,7 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev, | |||
| 2418 | const char *con_id, | 2418 | const char *con_id, |
| 2419 | unsigned int idx) | 2419 | unsigned int idx) |
| 2420 | { | 2420 | { |
| 2421 | struct gpio_desc *desc; | 2421 | struct gpio_desc *desc = NULL; |
| 2422 | int status; | 2422 | int status; |
| 2423 | enum gpio_lookup_flags flags = 0; | 2423 | enum gpio_lookup_flags flags = 0; |
| 2424 | 2424 | ||
| @@ -2431,13 +2431,23 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev, | |||
| 2431 | } else if (IS_ENABLED(CONFIG_ACPI) && dev && ACPI_HANDLE(dev)) { | 2431 | } else if (IS_ENABLED(CONFIG_ACPI) && dev && ACPI_HANDLE(dev)) { |
| 2432 | dev_dbg(dev, "using ACPI for GPIO lookup\n"); | 2432 | dev_dbg(dev, "using ACPI for GPIO lookup\n"); |
| 2433 | desc = acpi_find_gpio(dev, con_id, idx, &flags); | 2433 | desc = acpi_find_gpio(dev, con_id, idx, &flags); |
| 2434 | } else { | 2434 | } |
| 2435 | |||
| 2436 | /* | ||
| 2437 | * Either we are not using DT or ACPI, or their lookup did not return | ||
| 2438 | * a result. In that case, use platform lookup as a fallback. | ||
| 2439 | */ | ||
| 2440 | if (!desc || IS_ERR(desc)) { | ||
| 2441 | struct gpio_desc *pdesc; | ||
| 2435 | dev_dbg(dev, "using lookup tables for GPIO lookup"); | 2442 | dev_dbg(dev, "using lookup tables for GPIO lookup"); |
| 2436 | desc = gpiod_find(dev, con_id, idx, &flags); | 2443 | pdesc = gpiod_find(dev, con_id, idx, &flags); |
| 2444 | /* If used as fallback, do not replace the previous error */ | ||
| 2445 | if (!IS_ERR(pdesc) || !desc) | ||
| 2446 | desc = pdesc; | ||
| 2437 | } | 2447 | } |
| 2438 | 2448 | ||
| 2439 | if (IS_ERR(desc)) { | 2449 | if (IS_ERR(desc)) { |
| 2440 | dev_warn(dev, "lookup for GPIO %s failed\n", con_id); | 2450 | dev_dbg(dev, "lookup for GPIO %s failed\n", con_id); |
| 2441 | return desc; | 2451 | return desc; |
| 2442 | } | 2452 | } |
| 2443 | 2453 | ||
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c index cbd4e9abc47e..92d1206482a6 100644 --- a/drivers/idle/intel_idle.c +++ b/drivers/idle/intel_idle.c | |||
| @@ -329,7 +329,7 @@ static struct cpuidle_state atom_cstates[] __initdata = { | |||
| 329 | { | 329 | { |
| 330 | .enter = NULL } | 330 | .enter = NULL } |
| 331 | }; | 331 | }; |
| 332 | static struct cpuidle_state avn_cstates[CPUIDLE_STATE_MAX] = { | 332 | static struct cpuidle_state avn_cstates[] __initdata = { |
| 333 | { | 333 | { |
| 334 | .name = "C1-AVN", | 334 | .name = "C1-AVN", |
| 335 | .desc = "MWAIT 0x00", | 335 | .desc = "MWAIT 0x00", |
| @@ -340,7 +340,7 @@ static struct cpuidle_state avn_cstates[CPUIDLE_STATE_MAX] = { | |||
| 340 | { | 340 | { |
| 341 | .name = "C6-AVN", | 341 | .name = "C6-AVN", |
| 342 | .desc = "MWAIT 0x51", | 342 | .desc = "MWAIT 0x51", |
| 343 | .flags = MWAIT2flg(0x58) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, | 343 | .flags = MWAIT2flg(0x51) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, |
| 344 | .exit_latency = 15, | 344 | .exit_latency = 15, |
| 345 | .target_residency = 45, | 345 | .target_residency = 45, |
| 346 | .enter = &intel_idle }, | 346 | .enter = &intel_idle }, |
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c index 9031171c141b..341c6016812d 100644 --- a/drivers/irqchip/irq-gic.c +++ b/drivers/irqchip/irq-gic.c | |||
| @@ -957,12 +957,13 @@ void __init gic_init_bases(unsigned int gic_nr, int irq_start, | |||
| 957 | if (WARN_ON(!gic->domain)) | 957 | if (WARN_ON(!gic->domain)) |
| 958 | return; | 958 | return; |
| 959 | 959 | ||
| 960 | if (gic_nr == 0) { | ||
| 960 | #ifdef CONFIG_SMP | 961 | #ifdef CONFIG_SMP |
| 961 | set_smp_cross_call(gic_raise_softirq); | 962 | set_smp_cross_call(gic_raise_softirq); |
| 962 | register_cpu_notifier(&gic_cpu_notifier); | 963 | register_cpu_notifier(&gic_cpu_notifier); |
| 963 | #endif | 964 | #endif |
| 964 | 965 | set_handle_irq(gic_handle_irq); | |
| 965 | set_handle_irq(gic_handle_irq); | 966 | } |
| 966 | 967 | ||
| 967 | gic_chip.flags |= gic_arch_extn.flags; | 968 | gic_chip.flags |= gic_arch_extn.flags; |
| 968 | gic_dist_init(gic); | 969 | gic_dist_init(gic); |
diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c index 2848171b8576..b31d8e99c419 100644 --- a/drivers/leds/leds-pwm.c +++ b/drivers/leds/leds-pwm.c | |||
| @@ -82,22 +82,12 @@ static inline size_t sizeof_pwm_leds_priv(int num_leds) | |||
| 82 | (sizeof(struct led_pwm_data) * num_leds); | 82 | (sizeof(struct led_pwm_data) * num_leds); |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | static struct led_pwm_priv *led_pwm_create_of(struct platform_device *pdev) | 85 | static int led_pwm_create_of(struct platform_device *pdev, |
| 86 | struct led_pwm_priv *priv) | ||
| 86 | { | 87 | { |
| 87 | struct device_node *node = pdev->dev.of_node; | 88 | struct device_node *node = pdev->dev.of_node; |
| 88 | struct device_node *child; | 89 | struct device_node *child; |
| 89 | struct led_pwm_priv *priv; | 90 | int ret; |
| 90 | int count, ret; | ||
| 91 | |||
| 92 | /* count LEDs in this device, so we know how much to allocate */ | ||
| 93 | count = of_get_child_count(node); | ||
| 94 | if (!count) | ||
| 95 | return NULL; | ||
| 96 | |||
| 97 | priv = devm_kzalloc(&pdev->dev, sizeof_pwm_leds_priv(count), | ||
| 98 | GFP_KERNEL); | ||
| 99 | if (!priv) | ||
| 100 | return NULL; | ||
| 101 | 91 | ||
| 102 | for_each_child_of_node(node, child) { | 92 | for_each_child_of_node(node, child) { |
| 103 | struct led_pwm_data *led_dat = &priv->leds[priv->num_leds]; | 93 | struct led_pwm_data *led_dat = &priv->leds[priv->num_leds]; |
| @@ -109,6 +99,7 @@ static struct led_pwm_priv *led_pwm_create_of(struct platform_device *pdev) | |||
| 109 | if (IS_ERR(led_dat->pwm)) { | 99 | if (IS_ERR(led_dat->pwm)) { |
| 110 | dev_err(&pdev->dev, "unable to request PWM for %s\n", | 100 | dev_err(&pdev->dev, "unable to request PWM for %s\n", |
| 111 | led_dat->cdev.name); | 101 | led_dat->cdev.name); |
| 102 | ret = PTR_ERR(led_dat->pwm); | ||
| 112 | goto err; | 103 | goto err; |
| 113 | } | 104 | } |
| 114 | /* Get the period from PWM core when n*/ | 105 | /* Get the period from PWM core when n*/ |
| @@ -137,28 +128,36 @@ static struct led_pwm_priv *led_pwm_create_of(struct platform_device *pdev) | |||
| 137 | priv->num_leds++; | 128 | priv->num_leds++; |
| 138 | } | 129 | } |
| 139 | 130 | ||
| 140 | return priv; | 131 | return 0; |
| 141 | err: | 132 | err: |
| 142 | while (priv->num_leds--) | 133 | while (priv->num_leds--) |
| 143 | led_classdev_unregister(&priv->leds[priv->num_leds].cdev); | 134 | led_classdev_unregister(&priv->leds[priv->num_leds].cdev); |
| 144 | 135 | ||
| 145 | return NULL; | 136 | return ret; |
| 146 | } | 137 | } |
| 147 | 138 | ||
| 148 | static int led_pwm_probe(struct platform_device *pdev) | 139 | static int led_pwm_probe(struct platform_device *pdev) |
| 149 | { | 140 | { |
| 150 | struct led_pwm_platform_data *pdata = dev_get_platdata(&pdev->dev); | 141 | struct led_pwm_platform_data *pdata = dev_get_platdata(&pdev->dev); |
| 151 | struct led_pwm_priv *priv; | 142 | struct led_pwm_priv *priv; |
| 152 | int i, ret = 0; | 143 | int count, i; |
| 144 | int ret = 0; | ||
| 145 | |||
| 146 | if (pdata) | ||
| 147 | count = pdata->num_leds; | ||
| 148 | else | ||
| 149 | count = of_get_child_count(pdev->dev.of_node); | ||
| 150 | |||
| 151 | if (!count) | ||
| 152 | return -EINVAL; | ||
| 153 | 153 | ||
| 154 | if (pdata && pdata->num_leds) { | 154 | priv = devm_kzalloc(&pdev->dev, sizeof_pwm_leds_priv(count), |
| 155 | priv = devm_kzalloc(&pdev->dev, | 155 | GFP_KERNEL); |
| 156 | sizeof_pwm_leds_priv(pdata->num_leds), | 156 | if (!priv) |
| 157 | GFP_KERNEL); | 157 | return -ENOMEM; |
| 158 | if (!priv) | ||
| 159 | return -ENOMEM; | ||
| 160 | 158 | ||
| 161 | for (i = 0; i < pdata->num_leds; i++) { | 159 | if (pdata) { |
| 160 | for (i = 0; i < count; i++) { | ||
| 162 | struct led_pwm *cur_led = &pdata->leds[i]; | 161 | struct led_pwm *cur_led = &pdata->leds[i]; |
| 163 | struct led_pwm_data *led_dat = &priv->leds[i]; | 162 | struct led_pwm_data *led_dat = &priv->leds[i]; |
| 164 | 163 | ||
| @@ -188,11 +187,11 @@ static int led_pwm_probe(struct platform_device *pdev) | |||
| 188 | if (ret < 0) | 187 | if (ret < 0) |
| 189 | goto err; | 188 | goto err; |
| 190 | } | 189 | } |
| 191 | priv->num_leds = pdata->num_leds; | 190 | priv->num_leds = count; |
| 192 | } else { | 191 | } else { |
| 193 | priv = led_pwm_create_of(pdev); | 192 | ret = led_pwm_create_of(pdev, priv); |
| 194 | if (!priv) | 193 | if (ret) |
| 195 | return -ENODEV; | 194 | return ret; |
| 196 | } | 195 | } |
| 197 | 196 | ||
| 198 | platform_set_drvdata(pdev, priv); | 197 | platform_set_drvdata(pdev, priv); |
diff --git a/drivers/md/md.c b/drivers/md/md.c index e60cebf3f519..21f4d7ff0da2 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
| @@ -776,16 +776,10 @@ void md_super_wait(struct mddev *mddev) | |||
| 776 | finish_wait(&mddev->sb_wait, &wq); | 776 | finish_wait(&mddev->sb_wait, &wq); |
| 777 | } | 777 | } |
| 778 | 778 | ||
| 779 | static void bi_complete(struct bio *bio, int error) | ||
| 780 | { | ||
| 781 | complete((struct completion*)bio->bi_private); | ||
| 782 | } | ||
| 783 | |||
| 784 | int sync_page_io(struct md_rdev *rdev, sector_t sector, int size, | 779 | int sync_page_io(struct md_rdev *rdev, sector_t sector, int size, |
| 785 | struct page *page, int rw, bool metadata_op) | 780 | struct page *page, int rw, bool metadata_op) |
| 786 | { | 781 | { |
| 787 | struct bio *bio = bio_alloc_mddev(GFP_NOIO, 1, rdev->mddev); | 782 | struct bio *bio = bio_alloc_mddev(GFP_NOIO, 1, rdev->mddev); |
| 788 | struct completion event; | ||
| 789 | int ret; | 783 | int ret; |
| 790 | 784 | ||
| 791 | rw |= REQ_SYNC; | 785 | rw |= REQ_SYNC; |
| @@ -801,11 +795,7 @@ int sync_page_io(struct md_rdev *rdev, sector_t sector, int size, | |||
| 801 | else | 795 | else |
| 802 | bio->bi_sector = sector + rdev->data_offset; | 796 | bio->bi_sector = sector + rdev->data_offset; |
| 803 | bio_add_page(bio, page, size, 0); | 797 | bio_add_page(bio, page, size, 0); |
| 804 | init_completion(&event); | 798 | submit_bio_wait(rw, bio); |
| 805 | bio->bi_private = &event; | ||
| 806 | bio->bi_end_io = bi_complete; | ||
| 807 | submit_bio(rw, bio); | ||
| 808 | wait_for_completion(&event); | ||
| 809 | 799 | ||
| 810 | ret = test_bit(BIO_UPTODATE, &bio->bi_flags); | 800 | ret = test_bit(BIO_UPTODATE, &bio->bi_flags); |
| 811 | bio_put(bio); | 801 | bio_put(bio); |
diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c index 0e8df41aaf14..2cf2bbc0b927 100644 --- a/drivers/misc/enclosure.c +++ b/drivers/misc/enclosure.c | |||
| @@ -198,6 +198,13 @@ static void enclosure_remove_links(struct enclosure_component *cdev) | |||
| 198 | { | 198 | { |
| 199 | char name[ENCLOSURE_NAME_SIZE]; | 199 | char name[ENCLOSURE_NAME_SIZE]; |
| 200 | 200 | ||
| 201 | /* | ||
| 202 | * In odd circumstances, like multipath devices, something else may | ||
| 203 | * already have removed the links, so check for this condition first. | ||
| 204 | */ | ||
| 205 | if (!cdev->dev->kobj.sd) | ||
| 206 | return; | ||
| 207 | |||
| 201 | enclosure_link_name(cdev, name); | 208 | enclosure_link_name(cdev, name); |
| 202 | sysfs_remove_link(&cdev->dev->kobj, name); | 209 | sysfs_remove_link(&cdev->dev->kobj, name); |
| 203 | sysfs_remove_link(&cdev->cdev.kobj, "device"); | 210 | sysfs_remove_link(&cdev->cdev.kobj, "device"); |
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c index 0b10a9030f4e..98b6b6ef7e5c 100644 --- a/drivers/mmc/host/omap.c +++ b/drivers/mmc/host/omap.c | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
| 23 | #include <linux/spinlock.h> | 23 | #include <linux/spinlock.h> |
| 24 | #include <linux/timer.h> | 24 | #include <linux/timer.h> |
| 25 | #include <linux/of.h> | ||
| 25 | #include <linux/omap-dma.h> | 26 | #include <linux/omap-dma.h> |
| 26 | #include <linux/mmc/host.h> | 27 | #include <linux/mmc/host.h> |
| 27 | #include <linux/mmc/card.h> | 28 | #include <linux/mmc/card.h> |
| @@ -90,17 +91,6 @@ | |||
| 90 | #define OMAP_MMC_CMDTYPE_AC 2 | 91 | #define OMAP_MMC_CMDTYPE_AC 2 |
| 91 | #define OMAP_MMC_CMDTYPE_ADTC 3 | 92 | #define OMAP_MMC_CMDTYPE_ADTC 3 |
| 92 | 93 | ||
| 93 | #define OMAP_DMA_MMC_TX 21 | ||
| 94 | #define OMAP_DMA_MMC_RX 22 | ||
| 95 | #define OMAP_DMA_MMC2_TX 54 | ||
| 96 | #define OMAP_DMA_MMC2_RX 55 | ||
| 97 | |||
| 98 | #define OMAP24XX_DMA_MMC2_TX 47 | ||
| 99 | #define OMAP24XX_DMA_MMC2_RX 48 | ||
| 100 | #define OMAP24XX_DMA_MMC1_TX 61 | ||
| 101 | #define OMAP24XX_DMA_MMC1_RX 62 | ||
| 102 | |||
| 103 | |||
| 104 | #define DRIVER_NAME "mmci-omap" | 94 | #define DRIVER_NAME "mmci-omap" |
| 105 | 95 | ||
| 106 | /* Specifies how often in millisecs to poll for card status changes | 96 | /* Specifies how often in millisecs to poll for card status changes |
| @@ -1330,7 +1320,7 @@ static int mmc_omap_probe(struct platform_device *pdev) | |||
| 1330 | struct mmc_omap_host *host = NULL; | 1320 | struct mmc_omap_host *host = NULL; |
| 1331 | struct resource *res; | 1321 | struct resource *res; |
| 1332 | dma_cap_mask_t mask; | 1322 | dma_cap_mask_t mask; |
| 1333 | unsigned sig; | 1323 | unsigned sig = 0; |
| 1334 | int i, ret = 0; | 1324 | int i, ret = 0; |
| 1335 | int irq; | 1325 | int irq; |
| 1336 | 1326 | ||
| @@ -1340,7 +1330,7 @@ static int mmc_omap_probe(struct platform_device *pdev) | |||
| 1340 | } | 1330 | } |
| 1341 | if (pdata->nr_slots == 0) { | 1331 | if (pdata->nr_slots == 0) { |
| 1342 | dev_err(&pdev->dev, "no slots\n"); | 1332 | dev_err(&pdev->dev, "no slots\n"); |
| 1343 | return -ENXIO; | 1333 | return -EPROBE_DEFER; |
| 1344 | } | 1334 | } |
| 1345 | 1335 | ||
| 1346 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1336 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| @@ -1407,19 +1397,20 @@ static int mmc_omap_probe(struct platform_device *pdev) | |||
| 1407 | host->dma_tx_burst = -1; | 1397 | host->dma_tx_burst = -1; |
| 1408 | host->dma_rx_burst = -1; | 1398 | host->dma_rx_burst = -1; |
| 1409 | 1399 | ||
| 1410 | if (mmc_omap2()) | 1400 | res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx"); |
| 1411 | sig = host->id == 0 ? OMAP24XX_DMA_MMC1_TX : OMAP24XX_DMA_MMC2_TX; | 1401 | if (res) |
| 1412 | else | 1402 | sig = res->start; |
| 1413 | sig = host->id == 0 ? OMAP_DMA_MMC_TX : OMAP_DMA_MMC2_TX; | 1403 | host->dma_tx = dma_request_slave_channel_compat(mask, |
| 1414 | host->dma_tx = dma_request_channel(mask, omap_dma_filter_fn, &sig); | 1404 | omap_dma_filter_fn, &sig, &pdev->dev, "tx"); |
| 1415 | if (!host->dma_tx) | 1405 | if (!host->dma_tx) |
| 1416 | dev_warn(host->dev, "unable to obtain TX DMA engine channel %u\n", | 1406 | dev_warn(host->dev, "unable to obtain TX DMA engine channel %u\n", |
| 1417 | sig); | 1407 | sig); |
| 1418 | if (mmc_omap2()) | 1408 | |
| 1419 | sig = host->id == 0 ? OMAP24XX_DMA_MMC1_RX : OMAP24XX_DMA_MMC2_RX; | 1409 | res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx"); |
| 1420 | else | 1410 | if (res) |
| 1421 | sig = host->id == 0 ? OMAP_DMA_MMC_RX : OMAP_DMA_MMC2_RX; | 1411 | sig = res->start; |
| 1422 | host->dma_rx = dma_request_channel(mask, omap_dma_filter_fn, &sig); | 1412 | host->dma_rx = dma_request_slave_channel_compat(mask, |
| 1413 | omap_dma_filter_fn, &sig, &pdev->dev, "rx"); | ||
| 1423 | if (!host->dma_rx) | 1414 | if (!host->dma_rx) |
| 1424 | dev_warn(host->dev, "unable to obtain RX DMA engine channel %u\n", | 1415 | dev_warn(host->dev, "unable to obtain RX DMA engine channel %u\n", |
| 1425 | sig); | 1416 | sig); |
| @@ -1512,12 +1503,20 @@ static int mmc_omap_remove(struct platform_device *pdev) | |||
| 1512 | return 0; | 1503 | return 0; |
| 1513 | } | 1504 | } |
| 1514 | 1505 | ||
| 1506 | #if IS_BUILTIN(CONFIG_OF) | ||
| 1507 | static const struct of_device_id mmc_omap_match[] = { | ||
| 1508 | { .compatible = "ti,omap2420-mmc", }, | ||
| 1509 | { }, | ||
| 1510 | }; | ||
| 1511 | #endif | ||
| 1512 | |||
| 1515 | static struct platform_driver mmc_omap_driver = { | 1513 | static struct platform_driver mmc_omap_driver = { |
| 1516 | .probe = mmc_omap_probe, | 1514 | .probe = mmc_omap_probe, |
| 1517 | .remove = mmc_omap_remove, | 1515 | .remove = mmc_omap_remove, |
| 1518 | .driver = { | 1516 | .driver = { |
| 1519 | .name = DRIVER_NAME, | 1517 | .name = DRIVER_NAME, |
| 1520 | .owner = THIS_MODULE, | 1518 | .owner = THIS_MODULE, |
| 1519 | .of_match_table = of_match_ptr(mmc_omap_match), | ||
| 1521 | }, | 1520 | }, |
| 1522 | }; | 1521 | }; |
| 1523 | 1522 | ||
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 4dd5ee2a34cc..36eab0c4fb33 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
| @@ -4110,7 +4110,7 @@ static int bond_check_params(struct bond_params *params) | |||
| 4110 | if (!miimon) { | 4110 | if (!miimon) { |
| 4111 | pr_warning("Warning: miimon must be specified, otherwise bonding will not detect link failure, speed and duplex which are essential for 802.3ad operation\n"); | 4111 | pr_warning("Warning: miimon must be specified, otherwise bonding will not detect link failure, speed and duplex which are essential for 802.3ad operation\n"); |
| 4112 | pr_warning("Forcing miimon to 100msec\n"); | 4112 | pr_warning("Forcing miimon to 100msec\n"); |
| 4113 | miimon = 100; | 4113 | miimon = BOND_DEFAULT_MIIMON; |
| 4114 | } | 4114 | } |
| 4115 | } | 4115 | } |
| 4116 | 4116 | ||
| @@ -4147,7 +4147,7 @@ static int bond_check_params(struct bond_params *params) | |||
| 4147 | if (!miimon) { | 4147 | if (!miimon) { |
| 4148 | pr_warning("Warning: miimon must be specified, otherwise bonding will not detect link failure and link speed which are essential for TLB/ALB load balancing\n"); | 4148 | pr_warning("Warning: miimon must be specified, otherwise bonding will not detect link failure and link speed which are essential for TLB/ALB load balancing\n"); |
| 4149 | pr_warning("Forcing miimon to 100msec\n"); | 4149 | pr_warning("Forcing miimon to 100msec\n"); |
| 4150 | miimon = 100; | 4150 | miimon = BOND_DEFAULT_MIIMON; |
| 4151 | } | 4151 | } |
| 4152 | } | 4152 | } |
| 4153 | 4153 | ||
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c index 9a5223c7b4d1..ea6f640782b7 100644 --- a/drivers/net/bonding/bond_options.c +++ b/drivers/net/bonding/bond_options.c | |||
| @@ -45,10 +45,15 @@ int bond_option_mode_set(struct bonding *bond, int mode) | |||
| 45 | return -EPERM; | 45 | return -EPERM; |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | if (BOND_MODE_IS_LB(mode) && bond->params.arp_interval) { | 48 | if (BOND_NO_USES_ARP(mode) && bond->params.arp_interval) { |
| 49 | pr_err("%s: %s mode is incompatible with arp monitoring.\n", | 49 | pr_info("%s: %s mode is incompatible with arp monitoring, start mii monitoring\n", |
| 50 | bond->dev->name, bond_mode_tbl[mode].modename); | 50 | bond->dev->name, bond_mode_tbl[mode].modename); |
| 51 | return -EINVAL; | 51 | /* disable arp monitoring */ |
| 52 | bond->params.arp_interval = 0; | ||
| 53 | /* set miimon to default value */ | ||
| 54 | bond->params.miimon = BOND_DEFAULT_MIIMON; | ||
| 55 | pr_info("%s: Setting MII monitoring interval to %d.\n", | ||
| 56 | bond->dev->name, bond->params.miimon); | ||
| 52 | } | 57 | } |
| 53 | 58 | ||
| 54 | /* don't cache arp_validate between modes */ | 59 | /* don't cache arp_validate between modes */ |
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 0ec2a7e8c8a9..abf5e106edc5 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
| @@ -523,9 +523,7 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
| 523 | ret = -EINVAL; | 523 | ret = -EINVAL; |
| 524 | goto out; | 524 | goto out; |
| 525 | } | 525 | } |
| 526 | if (bond->params.mode == BOND_MODE_ALB || | 526 | if (BOND_NO_USES_ARP(bond->params.mode)) { |
| 527 | bond->params.mode == BOND_MODE_TLB || | ||
| 528 | bond->params.mode == BOND_MODE_8023AD) { | ||
| 529 | pr_info("%s: ARP monitoring cannot be used with ALB/TLB/802.3ad. Only MII monitoring is supported on %s.\n", | 527 | pr_info("%s: ARP monitoring cannot be used with ALB/TLB/802.3ad. Only MII monitoring is supported on %s.\n", |
| 530 | bond->dev->name, bond->dev->name); | 528 | bond->dev->name, bond->dev->name); |
| 531 | ret = -EINVAL; | 529 | ret = -EINVAL; |
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index ca31286aa028..a9f4f9f4d8ce 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
| @@ -35,6 +35,8 @@ | |||
| 35 | 35 | ||
| 36 | #define BOND_MAX_ARP_TARGETS 16 | 36 | #define BOND_MAX_ARP_TARGETS 16 |
| 37 | 37 | ||
| 38 | #define BOND_DEFAULT_MIIMON 100 | ||
| 39 | |||
| 38 | #define IS_UP(dev) \ | 40 | #define IS_UP(dev) \ |
| 39 | ((((dev)->flags & IFF_UP) == IFF_UP) && \ | 41 | ((((dev)->flags & IFF_UP) == IFF_UP) && \ |
| 40 | netif_running(dev) && \ | 42 | netif_running(dev) && \ |
| @@ -55,6 +57,11 @@ | |||
| 55 | ((mode) == BOND_MODE_TLB) || \ | 57 | ((mode) == BOND_MODE_TLB) || \ |
| 56 | ((mode) == BOND_MODE_ALB)) | 58 | ((mode) == BOND_MODE_ALB)) |
| 57 | 59 | ||
| 60 | #define BOND_NO_USES_ARP(mode) \ | ||
| 61 | (((mode) == BOND_MODE_8023AD) || \ | ||
| 62 | ((mode) == BOND_MODE_TLB) || \ | ||
| 63 | ((mode) == BOND_MODE_ALB)) | ||
| 64 | |||
| 58 | #define TX_QUEUE_OVERRIDE(mode) \ | 65 | #define TX_QUEUE_OVERRIDE(mode) \ |
| 59 | (((mode) == BOND_MODE_ACTIVEBACKUP) || \ | 66 | (((mode) == BOND_MODE_ACTIVEBACKUP) || \ |
| 60 | ((mode) == BOND_MODE_ROUNDROBIN)) | 67 | ((mode) == BOND_MODE_ROUNDROBIN)) |
diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c index e3fc07cf2f62..77061eebb034 100644 --- a/drivers/net/can/c_can/c_can.c +++ b/drivers/net/can/c_can/c_can.c | |||
| @@ -712,22 +712,31 @@ static int c_can_set_mode(struct net_device *dev, enum can_mode mode) | |||
| 712 | return 0; | 712 | return 0; |
| 713 | } | 713 | } |
| 714 | 714 | ||
| 715 | static int c_can_get_berr_counter(const struct net_device *dev, | 715 | static int __c_can_get_berr_counter(const struct net_device *dev, |
| 716 | struct can_berr_counter *bec) | 716 | struct can_berr_counter *bec) |
| 717 | { | 717 | { |
| 718 | unsigned int reg_err_counter; | 718 | unsigned int reg_err_counter; |
| 719 | struct c_can_priv *priv = netdev_priv(dev); | 719 | struct c_can_priv *priv = netdev_priv(dev); |
| 720 | 720 | ||
| 721 | c_can_pm_runtime_get_sync(priv); | ||
| 722 | |||
| 723 | reg_err_counter = priv->read_reg(priv, C_CAN_ERR_CNT_REG); | 721 | reg_err_counter = priv->read_reg(priv, C_CAN_ERR_CNT_REG); |
| 724 | bec->rxerr = (reg_err_counter & ERR_CNT_REC_MASK) >> | 722 | bec->rxerr = (reg_err_counter & ERR_CNT_REC_MASK) >> |
| 725 | ERR_CNT_REC_SHIFT; | 723 | ERR_CNT_REC_SHIFT; |
| 726 | bec->txerr = reg_err_counter & ERR_CNT_TEC_MASK; | 724 | bec->txerr = reg_err_counter & ERR_CNT_TEC_MASK; |
| 727 | 725 | ||
| 726 | return 0; | ||
| 727 | } | ||
| 728 | |||
| 729 | static int c_can_get_berr_counter(const struct net_device *dev, | ||
| 730 | struct can_berr_counter *bec) | ||
| 731 | { | ||
| 732 | struct c_can_priv *priv = netdev_priv(dev); | ||
| 733 | int err; | ||
| 734 | |||
| 735 | c_can_pm_runtime_get_sync(priv); | ||
| 736 | err = __c_can_get_berr_counter(dev, bec); | ||
| 728 | c_can_pm_runtime_put_sync(priv); | 737 | c_can_pm_runtime_put_sync(priv); |
| 729 | 738 | ||
| 730 | return 0; | 739 | return err; |
| 731 | } | 740 | } |
| 732 | 741 | ||
| 733 | /* | 742 | /* |
| @@ -754,6 +763,7 @@ static void c_can_do_tx(struct net_device *dev) | |||
| 754 | if (!(val & (1 << (msg_obj_no - 1)))) { | 763 | if (!(val & (1 << (msg_obj_no - 1)))) { |
| 755 | can_get_echo_skb(dev, | 764 | can_get_echo_skb(dev, |
| 756 | msg_obj_no - C_CAN_MSG_OBJ_TX_FIRST); | 765 | msg_obj_no - C_CAN_MSG_OBJ_TX_FIRST); |
| 766 | c_can_object_get(dev, 0, msg_obj_no, IF_COMM_ALL); | ||
| 757 | stats->tx_bytes += priv->read_reg(priv, | 767 | stats->tx_bytes += priv->read_reg(priv, |
| 758 | C_CAN_IFACE(MSGCTRL_REG, 0)) | 768 | C_CAN_IFACE(MSGCTRL_REG, 0)) |
| 759 | & IF_MCONT_DLC_MASK; | 769 | & IF_MCONT_DLC_MASK; |
| @@ -872,7 +882,7 @@ static int c_can_handle_state_change(struct net_device *dev, | |||
| 872 | if (unlikely(!skb)) | 882 | if (unlikely(!skb)) |
| 873 | return 0; | 883 | return 0; |
| 874 | 884 | ||
| 875 | c_can_get_berr_counter(dev, &bec); | 885 | __c_can_get_berr_counter(dev, &bec); |
| 876 | reg_err_counter = priv->read_reg(priv, C_CAN_ERR_CNT_REG); | 886 | reg_err_counter = priv->read_reg(priv, C_CAN_ERR_CNT_REG); |
| 877 | rx_err_passive = (reg_err_counter & ERR_CNT_RP_MASK) >> | 887 | rx_err_passive = (reg_err_counter & ERR_CNT_RP_MASK) >> |
| 878 | ERR_CNT_RP_SHIFT; | 888 | ERR_CNT_RP_SHIFT; |
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index ae08cf129ebb..aaed97bee471 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c | |||
| @@ -1020,13 +1020,13 @@ static int flexcan_probe(struct platform_device *pdev) | |||
| 1020 | dev_err(&pdev->dev, "no ipg clock defined\n"); | 1020 | dev_err(&pdev->dev, "no ipg clock defined\n"); |
| 1021 | return PTR_ERR(clk_ipg); | 1021 | return PTR_ERR(clk_ipg); |
| 1022 | } | 1022 | } |
| 1023 | clock_freq = clk_get_rate(clk_ipg); | ||
| 1024 | 1023 | ||
| 1025 | clk_per = devm_clk_get(&pdev->dev, "per"); | 1024 | clk_per = devm_clk_get(&pdev->dev, "per"); |
| 1026 | if (IS_ERR(clk_per)) { | 1025 | if (IS_ERR(clk_per)) { |
| 1027 | dev_err(&pdev->dev, "no per clock defined\n"); | 1026 | dev_err(&pdev->dev, "no per clock defined\n"); |
| 1028 | return PTR_ERR(clk_per); | 1027 | return PTR_ERR(clk_per); |
| 1029 | } | 1028 | } |
| 1029 | clock_freq = clk_get_rate(clk_per); | ||
| 1030 | } | 1030 | } |
| 1031 | 1031 | ||
| 1032 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1032 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c index 7164a999f50f..f17c3018b7c7 100644 --- a/drivers/net/can/sja1000/sja1000.c +++ b/drivers/net/can/sja1000/sja1000.c | |||
| @@ -494,20 +494,20 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id) | |||
| 494 | uint8_t isrc, status; | 494 | uint8_t isrc, status; |
| 495 | int n = 0; | 495 | int n = 0; |
| 496 | 496 | ||
| 497 | /* Shared interrupts and IRQ off? */ | ||
| 498 | if (priv->read_reg(priv, SJA1000_IER) == IRQ_OFF) | ||
| 499 | return IRQ_NONE; | ||
| 500 | |||
| 501 | if (priv->pre_irq) | 497 | if (priv->pre_irq) |
| 502 | priv->pre_irq(priv); | 498 | priv->pre_irq(priv); |
| 503 | 499 | ||
| 500 | /* Shared interrupts and IRQ off? */ | ||
| 501 | if (priv->read_reg(priv, SJA1000_IER) == IRQ_OFF) | ||
| 502 | goto out; | ||
| 503 | |||
| 504 | while ((isrc = priv->read_reg(priv, SJA1000_IR)) && | 504 | while ((isrc = priv->read_reg(priv, SJA1000_IR)) && |
| 505 | (n < SJA1000_MAX_IRQ)) { | 505 | (n < SJA1000_MAX_IRQ)) { |
| 506 | n++; | 506 | |
| 507 | status = priv->read_reg(priv, SJA1000_SR); | 507 | status = priv->read_reg(priv, SJA1000_SR); |
| 508 | /* check for absent controller due to hw unplug */ | 508 | /* check for absent controller due to hw unplug */ |
| 509 | if (status == 0xFF && sja1000_is_absent(priv)) | 509 | if (status == 0xFF && sja1000_is_absent(priv)) |
| 510 | return IRQ_NONE; | 510 | goto out; |
| 511 | 511 | ||
| 512 | if (isrc & IRQ_WUI) | 512 | if (isrc & IRQ_WUI) |
| 513 | netdev_warn(dev, "wakeup interrupt\n"); | 513 | netdev_warn(dev, "wakeup interrupt\n"); |
| @@ -535,7 +535,7 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id) | |||
| 535 | status = priv->read_reg(priv, SJA1000_SR); | 535 | status = priv->read_reg(priv, SJA1000_SR); |
| 536 | /* check for absent controller */ | 536 | /* check for absent controller */ |
| 537 | if (status == 0xFF && sja1000_is_absent(priv)) | 537 | if (status == 0xFF && sja1000_is_absent(priv)) |
| 538 | return IRQ_NONE; | 538 | goto out; |
| 539 | } | 539 | } |
| 540 | } | 540 | } |
| 541 | if (isrc & (IRQ_DOI | IRQ_EI | IRQ_BEI | IRQ_EPI | IRQ_ALI)) { | 541 | if (isrc & (IRQ_DOI | IRQ_EI | IRQ_BEI | IRQ_EPI | IRQ_ALI)) { |
| @@ -543,8 +543,9 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id) | |||
| 543 | if (sja1000_err(dev, isrc, status)) | 543 | if (sja1000_err(dev, isrc, status)) |
| 544 | break; | 544 | break; |
| 545 | } | 545 | } |
| 546 | n++; | ||
| 546 | } | 547 | } |
| 547 | 548 | out: | |
| 548 | if (priv->post_irq) | 549 | if (priv->post_irq) |
| 549 | priv->post_irq(priv); | 550 | priv->post_irq(priv); |
| 550 | 551 | ||
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index a9e068423ba0..369b736dde05 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
| @@ -10629,10 +10629,8 @@ static void tg3_sd_scan_scratchpad(struct tg3 *tp, struct tg3_ocir *ocir) | |||
| 10629 | static ssize_t tg3_show_temp(struct device *dev, | 10629 | static ssize_t tg3_show_temp(struct device *dev, |
| 10630 | struct device_attribute *devattr, char *buf) | 10630 | struct device_attribute *devattr, char *buf) |
| 10631 | { | 10631 | { |
| 10632 | struct pci_dev *pdev = to_pci_dev(dev); | ||
| 10633 | struct net_device *netdev = pci_get_drvdata(pdev); | ||
| 10634 | struct tg3 *tp = netdev_priv(netdev); | ||
| 10635 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 10632 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
| 10633 | struct tg3 *tp = dev_get_drvdata(dev); | ||
| 10636 | u32 temperature; | 10634 | u32 temperature; |
| 10637 | 10635 | ||
| 10638 | spin_lock_bh(&tp->lock); | 10636 | spin_lock_bh(&tp->lock); |
| @@ -10650,29 +10648,25 @@ static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, tg3_show_temp, NULL, | |||
| 10650 | static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, tg3_show_temp, NULL, | 10648 | static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, tg3_show_temp, NULL, |
| 10651 | TG3_TEMP_MAX_OFFSET); | 10649 | TG3_TEMP_MAX_OFFSET); |
| 10652 | 10650 | ||
| 10653 | static struct attribute *tg3_attributes[] = { | 10651 | static struct attribute *tg3_attrs[] = { |
| 10654 | &sensor_dev_attr_temp1_input.dev_attr.attr, | 10652 | &sensor_dev_attr_temp1_input.dev_attr.attr, |
| 10655 | &sensor_dev_attr_temp1_crit.dev_attr.attr, | 10653 | &sensor_dev_attr_temp1_crit.dev_attr.attr, |
| 10656 | &sensor_dev_attr_temp1_max.dev_attr.attr, | 10654 | &sensor_dev_attr_temp1_max.dev_attr.attr, |
| 10657 | NULL | 10655 | NULL |
| 10658 | }; | 10656 | }; |
| 10659 | 10657 | ATTRIBUTE_GROUPS(tg3); | |
| 10660 | static const struct attribute_group tg3_group = { | ||
| 10661 | .attrs = tg3_attributes, | ||
| 10662 | }; | ||
| 10663 | 10658 | ||
| 10664 | static void tg3_hwmon_close(struct tg3 *tp) | 10659 | static void tg3_hwmon_close(struct tg3 *tp) |
| 10665 | { | 10660 | { |
| 10666 | if (tp->hwmon_dev) { | 10661 | if (tp->hwmon_dev) { |
| 10667 | hwmon_device_unregister(tp->hwmon_dev); | 10662 | hwmon_device_unregister(tp->hwmon_dev); |
| 10668 | tp->hwmon_dev = NULL; | 10663 | tp->hwmon_dev = NULL; |
| 10669 | sysfs_remove_group(&tp->pdev->dev.kobj, &tg3_group); | ||
| 10670 | } | 10664 | } |
| 10671 | } | 10665 | } |
| 10672 | 10666 | ||
| 10673 | static void tg3_hwmon_open(struct tg3 *tp) | 10667 | static void tg3_hwmon_open(struct tg3 *tp) |
| 10674 | { | 10668 | { |
| 10675 | int i, err; | 10669 | int i; |
| 10676 | u32 size = 0; | 10670 | u32 size = 0; |
| 10677 | struct pci_dev *pdev = tp->pdev; | 10671 | struct pci_dev *pdev = tp->pdev; |
| 10678 | struct tg3_ocir ocirs[TG3_SD_NUM_RECS]; | 10672 | struct tg3_ocir ocirs[TG3_SD_NUM_RECS]; |
| @@ -10690,18 +10684,11 @@ static void tg3_hwmon_open(struct tg3 *tp) | |||
| 10690 | if (!size) | 10684 | if (!size) |
| 10691 | return; | 10685 | return; |
| 10692 | 10686 | ||
| 10693 | /* Register hwmon sysfs hooks */ | 10687 | tp->hwmon_dev = hwmon_device_register_with_groups(&pdev->dev, "tg3", |
| 10694 | err = sysfs_create_group(&pdev->dev.kobj, &tg3_group); | 10688 | tp, tg3_groups); |
| 10695 | if (err) { | ||
| 10696 | dev_err(&pdev->dev, "Cannot create sysfs group, aborting\n"); | ||
| 10697 | return; | ||
| 10698 | } | ||
| 10699 | |||
| 10700 | tp->hwmon_dev = hwmon_device_register(&pdev->dev); | ||
| 10701 | if (IS_ERR(tp->hwmon_dev)) { | 10689 | if (IS_ERR(tp->hwmon_dev)) { |
| 10702 | tp->hwmon_dev = NULL; | 10690 | tp->hwmon_dev = NULL; |
| 10703 | dev_err(&pdev->dev, "Cannot register hwmon device, aborting\n"); | 10691 | dev_err(&pdev->dev, "Cannot register hwmon device, aborting\n"); |
| 10704 | sysfs_remove_group(&pdev->dev.kobj, &tg3_group); | ||
| 10705 | } | 10692 | } |
| 10706 | } | 10693 | } |
| 10707 | 10694 | ||
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h index f4825db5d179..5878df619b53 100644 --- a/drivers/net/ethernet/emulex/benet/be.h +++ b/drivers/net/ethernet/emulex/benet/be.h | |||
| @@ -503,6 +503,7 @@ struct be_adapter { | |||
| 503 | }; | 503 | }; |
| 504 | 504 | ||
| 505 | #define be_physfn(adapter) (!adapter->virtfn) | 505 | #define be_physfn(adapter) (!adapter->virtfn) |
| 506 | #define be_virtfn(adapter) (adapter->virtfn) | ||
| 506 | #define sriov_enabled(adapter) (adapter->num_vfs > 0) | 507 | #define sriov_enabled(adapter) (adapter->num_vfs > 0) |
| 507 | #define sriov_want(adapter) (be_physfn(adapter) && \ | 508 | #define sriov_want(adapter) (be_physfn(adapter) && \ |
| 508 | (num_vfs || pci_num_vf(adapter->pdev))) | 509 | (num_vfs || pci_num_vf(adapter->pdev))) |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c index dbcd5262c016..e0e8bc1ef14c 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.c +++ b/drivers/net/ethernet/emulex/benet/be_cmds.c | |||
| @@ -1032,6 +1032,13 @@ int be_cmd_cq_create(struct be_adapter *adapter, struct be_queue_info *cq, | |||
| 1032 | } else { | 1032 | } else { |
| 1033 | req->hdr.version = 2; | 1033 | req->hdr.version = 2; |
| 1034 | req->page_size = 1; /* 1 for 4K */ | 1034 | req->page_size = 1; /* 1 for 4K */ |
| 1035 | |||
| 1036 | /* coalesce-wm field in this cmd is not relevant to Lancer. | ||
| 1037 | * Lancer uses COMMON_MODIFY_CQ to set this field | ||
| 1038 | */ | ||
| 1039 | if (!lancer_chip(adapter)) | ||
| 1040 | AMAP_SET_BITS(struct amap_cq_context_v2, coalescwm, | ||
| 1041 | ctxt, coalesce_wm); | ||
| 1035 | AMAP_SET_BITS(struct amap_cq_context_v2, nodelay, ctxt, | 1042 | AMAP_SET_BITS(struct amap_cq_context_v2, nodelay, ctxt, |
| 1036 | no_delay); | 1043 | no_delay); |
| 1037 | AMAP_SET_BITS(struct amap_cq_context_v2, count, ctxt, | 1044 | AMAP_SET_BITS(struct amap_cq_context_v2, count, ctxt, |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index abde97471636..fee64bf10446 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
| @@ -2658,8 +2658,8 @@ static int be_close(struct net_device *netdev) | |||
| 2658 | 2658 | ||
| 2659 | be_roce_dev_close(adapter); | 2659 | be_roce_dev_close(adapter); |
| 2660 | 2660 | ||
| 2661 | for_all_evt_queues(adapter, eqo, i) { | 2661 | if (adapter->flags & BE_FLAGS_NAPI_ENABLED) { |
| 2662 | if (adapter->flags & BE_FLAGS_NAPI_ENABLED) { | 2662 | for_all_evt_queues(adapter, eqo, i) { |
| 2663 | napi_disable(&eqo->napi); | 2663 | napi_disable(&eqo->napi); |
| 2664 | be_disable_busy_poll(eqo); | 2664 | be_disable_busy_poll(eqo); |
| 2665 | } | 2665 | } |
| @@ -3253,12 +3253,10 @@ static int be_mac_setup(struct be_adapter *adapter) | |||
| 3253 | memcpy(mac, adapter->netdev->dev_addr, ETH_ALEN); | 3253 | memcpy(mac, adapter->netdev->dev_addr, ETH_ALEN); |
| 3254 | } | 3254 | } |
| 3255 | 3255 | ||
| 3256 | /* On BE3 VFs this cmd may fail due to lack of privilege. | 3256 | /* For BE3-R VFs, the PF programs the initial MAC address */ |
| 3257 | * Ignore the failure as in this case pmac_id is fetched | 3257 | if (!(BEx_chip(adapter) && be_virtfn(adapter))) |
| 3258 | * in the IFACE_CREATE cmd. | 3258 | be_cmd_pmac_add(adapter, mac, adapter->if_handle, |
| 3259 | */ | 3259 | &adapter->pmac_id[0], 0); |
| 3260 | be_cmd_pmac_add(adapter, mac, adapter->if_handle, | ||
| 3261 | &adapter->pmac_id[0], 0); | ||
| 3262 | return 0; | 3260 | return 0; |
| 3263 | } | 3261 | } |
| 3264 | 3262 | ||
| @@ -4599,6 +4597,7 @@ static int be_suspend(struct pci_dev *pdev, pm_message_t state) | |||
| 4599 | if (adapter->wol) | 4597 | if (adapter->wol) |
| 4600 | be_setup_wol(adapter, true); | 4598 | be_setup_wol(adapter, true); |
| 4601 | 4599 | ||
| 4600 | be_intr_set(adapter, false); | ||
| 4602 | cancel_delayed_work_sync(&adapter->func_recovery_work); | 4601 | cancel_delayed_work_sync(&adapter->func_recovery_work); |
| 4603 | 4602 | ||
| 4604 | netif_device_detach(netdev); | 4603 | netif_device_detach(netdev); |
| @@ -4634,6 +4633,7 @@ static int be_resume(struct pci_dev *pdev) | |||
| 4634 | if (status) | 4633 | if (status) |
| 4635 | return status; | 4634 | return status; |
| 4636 | 4635 | ||
| 4636 | be_intr_set(adapter, true); | ||
| 4637 | /* tell fw we're ready to fire cmds */ | 4637 | /* tell fw we're ready to fire cmds */ |
| 4638 | status = be_cmd_fw_init(adapter); | 4638 | status = be_cmd_fw_init(adapter); |
| 4639 | if (status) | 4639 | if (status) |
diff --git a/drivers/net/ethernet/intel/e1000/e1000.h b/drivers/net/ethernet/intel/e1000/e1000.h index 58c147271a36..f9313b36c887 100644 --- a/drivers/net/ethernet/intel/e1000/e1000.h +++ b/drivers/net/ethernet/intel/e1000/e1000.h | |||
| @@ -83,6 +83,11 @@ struct e1000_adapter; | |||
| 83 | 83 | ||
| 84 | #define E1000_MAX_INTR 10 | 84 | #define E1000_MAX_INTR 10 |
| 85 | 85 | ||
| 86 | /* | ||
| 87 | * Count for polling __E1000_RESET condition every 10-20msec. | ||
| 88 | */ | ||
| 89 | #define E1000_CHECK_RESET_COUNT 50 | ||
| 90 | |||
| 86 | /* TX/RX descriptor defines */ | 91 | /* TX/RX descriptor defines */ |
| 87 | #define E1000_DEFAULT_TXD 256 | 92 | #define E1000_DEFAULT_TXD 256 |
| 88 | #define E1000_MAX_TXD 256 | 93 | #define E1000_MAX_TXD 256 |
| @@ -312,8 +317,6 @@ struct e1000_adapter { | |||
| 312 | struct delayed_work watchdog_task; | 317 | struct delayed_work watchdog_task; |
| 313 | struct delayed_work fifo_stall_task; | 318 | struct delayed_work fifo_stall_task; |
| 314 | struct delayed_work phy_info_task; | 319 | struct delayed_work phy_info_task; |
| 315 | |||
| 316 | struct mutex mutex; | ||
| 317 | }; | 320 | }; |
| 318 | 321 | ||
| 319 | enum e1000_state_t { | 322 | enum e1000_state_t { |
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c index e38622825fa7..46e6544ed1b7 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_main.c +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c | |||
| @@ -494,13 +494,20 @@ static void e1000_down_and_stop(struct e1000_adapter *adapter) | |||
| 494 | { | 494 | { |
| 495 | set_bit(__E1000_DOWN, &adapter->flags); | 495 | set_bit(__E1000_DOWN, &adapter->flags); |
| 496 | 496 | ||
| 497 | /* Only kill reset task if adapter is not resetting */ | ||
| 498 | if (!test_bit(__E1000_RESETTING, &adapter->flags)) | ||
| 499 | cancel_work_sync(&adapter->reset_task); | ||
| 500 | |||
| 501 | cancel_delayed_work_sync(&adapter->watchdog_task); | 497 | cancel_delayed_work_sync(&adapter->watchdog_task); |
| 498 | |||
| 499 | /* | ||
| 500 | * Since the watchdog task can reschedule other tasks, we should cancel | ||
| 501 | * it first, otherwise we can run into the situation when a work is | ||
| 502 | * still running after the adapter has been turned down. | ||
| 503 | */ | ||
| 504 | |||
| 502 | cancel_delayed_work_sync(&adapter->phy_info_task); | 505 | cancel_delayed_work_sync(&adapter->phy_info_task); |
| 503 | cancel_delayed_work_sync(&adapter->fifo_stall_task); | 506 | cancel_delayed_work_sync(&adapter->fifo_stall_task); |
| 507 | |||
| 508 | /* Only kill reset task if adapter is not resetting */ | ||
| 509 | if (!test_bit(__E1000_RESETTING, &adapter->flags)) | ||
| 510 | cancel_work_sync(&adapter->reset_task); | ||
| 504 | } | 511 | } |
| 505 | 512 | ||
| 506 | void e1000_down(struct e1000_adapter *adapter) | 513 | void e1000_down(struct e1000_adapter *adapter) |
| @@ -544,21 +551,8 @@ void e1000_down(struct e1000_adapter *adapter) | |||
| 544 | e1000_clean_all_rx_rings(adapter); | 551 | e1000_clean_all_rx_rings(adapter); |
| 545 | } | 552 | } |
| 546 | 553 | ||
| 547 | static void e1000_reinit_safe(struct e1000_adapter *adapter) | ||
| 548 | { | ||
| 549 | while (test_and_set_bit(__E1000_RESETTING, &adapter->flags)) | ||
| 550 | msleep(1); | ||
| 551 | mutex_lock(&adapter->mutex); | ||
| 552 | e1000_down(adapter); | ||
| 553 | e1000_up(adapter); | ||
| 554 | mutex_unlock(&adapter->mutex); | ||
| 555 | clear_bit(__E1000_RESETTING, &adapter->flags); | ||
| 556 | } | ||
| 557 | |||
| 558 | void e1000_reinit_locked(struct e1000_adapter *adapter) | 554 | void e1000_reinit_locked(struct e1000_adapter *adapter) |
| 559 | { | 555 | { |
| 560 | /* if rtnl_lock is not held the call path is bogus */ | ||
| 561 | ASSERT_RTNL(); | ||
| 562 | WARN_ON(in_interrupt()); | 556 | WARN_ON(in_interrupt()); |
| 563 | while (test_and_set_bit(__E1000_RESETTING, &adapter->flags)) | 557 | while (test_and_set_bit(__E1000_RESETTING, &adapter->flags)) |
| 564 | msleep(1); | 558 | msleep(1); |
| @@ -1316,7 +1310,6 @@ static int e1000_sw_init(struct e1000_adapter *adapter) | |||
| 1316 | e1000_irq_disable(adapter); | 1310 | e1000_irq_disable(adapter); |
| 1317 | 1311 | ||
| 1318 | spin_lock_init(&adapter->stats_lock); | 1312 | spin_lock_init(&adapter->stats_lock); |
| 1319 | mutex_init(&adapter->mutex); | ||
| 1320 | 1313 | ||
| 1321 | set_bit(__E1000_DOWN, &adapter->flags); | 1314 | set_bit(__E1000_DOWN, &adapter->flags); |
| 1322 | 1315 | ||
| @@ -1440,6 +1433,10 @@ static int e1000_close(struct net_device *netdev) | |||
| 1440 | { | 1433 | { |
| 1441 | struct e1000_adapter *adapter = netdev_priv(netdev); | 1434 | struct e1000_adapter *adapter = netdev_priv(netdev); |
| 1442 | struct e1000_hw *hw = &adapter->hw; | 1435 | struct e1000_hw *hw = &adapter->hw; |
| 1436 | int count = E1000_CHECK_RESET_COUNT; | ||
| 1437 | |||
| 1438 | while (test_bit(__E1000_RESETTING, &adapter->flags) && count--) | ||
| 1439 | usleep_range(10000, 20000); | ||
| 1443 | 1440 | ||
| 1444 | WARN_ON(test_bit(__E1000_RESETTING, &adapter->flags)); | 1441 | WARN_ON(test_bit(__E1000_RESETTING, &adapter->flags)); |
| 1445 | e1000_down(adapter); | 1442 | e1000_down(adapter); |
| @@ -2325,11 +2322,8 @@ static void e1000_update_phy_info_task(struct work_struct *work) | |||
| 2325 | struct e1000_adapter *adapter = container_of(work, | 2322 | struct e1000_adapter *adapter = container_of(work, |
| 2326 | struct e1000_adapter, | 2323 | struct e1000_adapter, |
| 2327 | phy_info_task.work); | 2324 | phy_info_task.work); |
| 2328 | if (test_bit(__E1000_DOWN, &adapter->flags)) | 2325 | |
| 2329 | return; | ||
| 2330 | mutex_lock(&adapter->mutex); | ||
| 2331 | e1000_phy_get_info(&adapter->hw, &adapter->phy_info); | 2326 | e1000_phy_get_info(&adapter->hw, &adapter->phy_info); |
| 2332 | mutex_unlock(&adapter->mutex); | ||
| 2333 | } | 2327 | } |
| 2334 | 2328 | ||
| 2335 | /** | 2329 | /** |
| @@ -2345,9 +2339,6 @@ static void e1000_82547_tx_fifo_stall_task(struct work_struct *work) | |||
| 2345 | struct net_device *netdev = adapter->netdev; | 2339 | struct net_device *netdev = adapter->netdev; |
| 2346 | u32 tctl; | 2340 | u32 tctl; |
| 2347 | 2341 | ||
| 2348 | if (test_bit(__E1000_DOWN, &adapter->flags)) | ||
| 2349 | return; | ||
| 2350 | mutex_lock(&adapter->mutex); | ||
| 2351 | if (atomic_read(&adapter->tx_fifo_stall)) { | 2342 | if (atomic_read(&adapter->tx_fifo_stall)) { |
| 2352 | if ((er32(TDT) == er32(TDH)) && | 2343 | if ((er32(TDT) == er32(TDH)) && |
| 2353 | (er32(TDFT) == er32(TDFH)) && | 2344 | (er32(TDFT) == er32(TDFH)) && |
| @@ -2368,7 +2359,6 @@ static void e1000_82547_tx_fifo_stall_task(struct work_struct *work) | |||
| 2368 | schedule_delayed_work(&adapter->fifo_stall_task, 1); | 2359 | schedule_delayed_work(&adapter->fifo_stall_task, 1); |
| 2369 | } | 2360 | } |
| 2370 | } | 2361 | } |
| 2371 | mutex_unlock(&adapter->mutex); | ||
| 2372 | } | 2362 | } |
| 2373 | 2363 | ||
| 2374 | bool e1000_has_link(struct e1000_adapter *adapter) | 2364 | bool e1000_has_link(struct e1000_adapter *adapter) |
| @@ -2422,10 +2412,6 @@ static void e1000_watchdog(struct work_struct *work) | |||
| 2422 | struct e1000_tx_ring *txdr = adapter->tx_ring; | 2412 | struct e1000_tx_ring *txdr = adapter->tx_ring; |
| 2423 | u32 link, tctl; | 2413 | u32 link, tctl; |
| 2424 | 2414 | ||
| 2425 | if (test_bit(__E1000_DOWN, &adapter->flags)) | ||
| 2426 | return; | ||
| 2427 | |||
| 2428 | mutex_lock(&adapter->mutex); | ||
| 2429 | link = e1000_has_link(adapter); | 2415 | link = e1000_has_link(adapter); |
| 2430 | if ((netif_carrier_ok(netdev)) && link) | 2416 | if ((netif_carrier_ok(netdev)) && link) |
| 2431 | goto link_up; | 2417 | goto link_up; |
| @@ -2516,7 +2502,7 @@ link_up: | |||
| 2516 | adapter->tx_timeout_count++; | 2502 | adapter->tx_timeout_count++; |
| 2517 | schedule_work(&adapter->reset_task); | 2503 | schedule_work(&adapter->reset_task); |
| 2518 | /* exit immediately since reset is imminent */ | 2504 | /* exit immediately since reset is imminent */ |
| 2519 | goto unlock; | 2505 | return; |
| 2520 | } | 2506 | } |
| 2521 | } | 2507 | } |
| 2522 | 2508 | ||
| @@ -2544,9 +2530,6 @@ link_up: | |||
| 2544 | /* Reschedule the task */ | 2530 | /* Reschedule the task */ |
| 2545 | if (!test_bit(__E1000_DOWN, &adapter->flags)) | 2531 | if (!test_bit(__E1000_DOWN, &adapter->flags)) |
| 2546 | schedule_delayed_work(&adapter->watchdog_task, 2 * HZ); | 2532 | schedule_delayed_work(&adapter->watchdog_task, 2 * HZ); |
| 2547 | |||
| 2548 | unlock: | ||
| 2549 | mutex_unlock(&adapter->mutex); | ||
| 2550 | } | 2533 | } |
| 2551 | 2534 | ||
| 2552 | enum latency_range { | 2535 | enum latency_range { |
| @@ -3495,10 +3478,8 @@ static void e1000_reset_task(struct work_struct *work) | |||
| 3495 | struct e1000_adapter *adapter = | 3478 | struct e1000_adapter *adapter = |
| 3496 | container_of(work, struct e1000_adapter, reset_task); | 3479 | container_of(work, struct e1000_adapter, reset_task); |
| 3497 | 3480 | ||
| 3498 | if (test_bit(__E1000_DOWN, &adapter->flags)) | ||
| 3499 | return; | ||
| 3500 | e_err(drv, "Reset adapter\n"); | 3481 | e_err(drv, "Reset adapter\n"); |
| 3501 | e1000_reinit_safe(adapter); | 3482 | e1000_reinit_locked(adapter); |
| 3502 | } | 3483 | } |
| 3503 | 3484 | ||
| 3504 | /** | 3485 | /** |
| @@ -4963,6 +4944,11 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake) | |||
| 4963 | netif_device_detach(netdev); | 4944 | netif_device_detach(netdev); |
| 4964 | 4945 | ||
| 4965 | if (netif_running(netdev)) { | 4946 | if (netif_running(netdev)) { |
| 4947 | int count = E1000_CHECK_RESET_COUNT; | ||
| 4948 | |||
| 4949 | while (test_bit(__E1000_RESETTING, &adapter->flags) && count--) | ||
| 4950 | usleep_range(10000, 20000); | ||
| 4951 | |||
| 4966 | WARN_ON(test_bit(__E1000_RESETTING, &adapter->flags)); | 4952 | WARN_ON(test_bit(__E1000_RESETTING, &adapter->flags)); |
| 4967 | e1000_down(adapter); | 4953 | e1000_down(adapter); |
| 4968 | } | 4954 | } |
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c index b0f3666b1d7f..c3143da497c8 100644 --- a/drivers/net/ethernet/intel/igb/igb_ethtool.c +++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c | |||
| @@ -2062,14 +2062,15 @@ static void igb_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) | |||
| 2062 | { | 2062 | { |
| 2063 | struct igb_adapter *adapter = netdev_priv(netdev); | 2063 | struct igb_adapter *adapter = netdev_priv(netdev); |
| 2064 | 2064 | ||
| 2065 | wol->supported = WAKE_UCAST | WAKE_MCAST | | ||
| 2066 | WAKE_BCAST | WAKE_MAGIC | | ||
| 2067 | WAKE_PHY; | ||
| 2068 | wol->wolopts = 0; | 2065 | wol->wolopts = 0; |
| 2069 | 2066 | ||
| 2070 | if (!(adapter->flags & IGB_FLAG_WOL_SUPPORTED)) | 2067 | if (!(adapter->flags & IGB_FLAG_WOL_SUPPORTED)) |
| 2071 | return; | 2068 | return; |
| 2072 | 2069 | ||
| 2070 | wol->supported = WAKE_UCAST | WAKE_MCAST | | ||
| 2071 | WAKE_BCAST | WAKE_MAGIC | | ||
| 2072 | WAKE_PHY; | ||
| 2073 | |||
| 2073 | /* apply any specific unsupported masks here */ | 2074 | /* apply any specific unsupported masks here */ |
| 2074 | switch (adapter->hw.device_id) { | 2075 | switch (adapter->hw.device_id) { |
| 2075 | default: | 2076 | default: |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 0c55079ebee3..cc06854296a3 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
| @@ -4251,8 +4251,8 @@ static void ixgbe_disable_fwd_ring(struct ixgbe_fwd_adapter *vadapter, | |||
| 4251 | rx_ring->l2_accel_priv = NULL; | 4251 | rx_ring->l2_accel_priv = NULL; |
| 4252 | } | 4252 | } |
| 4253 | 4253 | ||
| 4254 | int ixgbe_fwd_ring_down(struct net_device *vdev, | 4254 | static int ixgbe_fwd_ring_down(struct net_device *vdev, |
| 4255 | struct ixgbe_fwd_adapter *accel) | 4255 | struct ixgbe_fwd_adapter *accel) |
| 4256 | { | 4256 | { |
| 4257 | struct ixgbe_adapter *adapter = accel->real_adapter; | 4257 | struct ixgbe_adapter *adapter = accel->real_adapter; |
| 4258 | unsigned int rxbase = accel->rx_base_queue; | 4258 | unsigned int rxbase = accel->rx_base_queue; |
| @@ -7986,10 +7986,9 @@ skip_sriov: | |||
| 7986 | NETIF_F_TSO | | 7986 | NETIF_F_TSO | |
| 7987 | NETIF_F_TSO6 | | 7987 | NETIF_F_TSO6 | |
| 7988 | NETIF_F_RXHASH | | 7988 | NETIF_F_RXHASH | |
| 7989 | NETIF_F_RXCSUM | | 7989 | NETIF_F_RXCSUM; |
| 7990 | NETIF_F_HW_L2FW_DOFFLOAD; | ||
| 7991 | 7990 | ||
| 7992 | netdev->hw_features = netdev->features; | 7991 | netdev->hw_features = netdev->features | NETIF_F_HW_L2FW_DOFFLOAD; |
| 7993 | 7992 | ||
| 7994 | switch (adapter->hw.mac.type) { | 7993 | switch (adapter->hw.mac.type) { |
| 7995 | case ixgbe_mac_82599EB: | 7994 | case ixgbe_mac_82599EB: |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c index e4c676006be9..39217e5ff7dc 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | |||
| @@ -46,6 +46,7 @@ static bool ixgbe_get_i2c_data(u32 *i2cctl); | |||
| 46 | static void ixgbe_i2c_bus_clear(struct ixgbe_hw *hw); | 46 | static void ixgbe_i2c_bus_clear(struct ixgbe_hw *hw); |
| 47 | static enum ixgbe_phy_type ixgbe_get_phy_type_from_id(u32 phy_id); | 47 | static enum ixgbe_phy_type ixgbe_get_phy_type_from_id(u32 phy_id); |
| 48 | static s32 ixgbe_get_phy_id(struct ixgbe_hw *hw); | 48 | static s32 ixgbe_get_phy_id(struct ixgbe_hw *hw); |
| 49 | static s32 ixgbe_identify_qsfp_module_generic(struct ixgbe_hw *hw); | ||
| 49 | 50 | ||
| 50 | /** | 51 | /** |
| 51 | * ixgbe_identify_phy_generic - Get physical layer module | 52 | * ixgbe_identify_phy_generic - Get physical layer module |
| @@ -1164,7 +1165,7 @@ err_read_i2c_eeprom: | |||
| 1164 | * | 1165 | * |
| 1165 | * Searches for and identifies the QSFP module and assigns appropriate PHY type | 1166 | * Searches for and identifies the QSFP module and assigns appropriate PHY type |
| 1166 | **/ | 1167 | **/ |
| 1167 | s32 ixgbe_identify_qsfp_module_generic(struct ixgbe_hw *hw) | 1168 | static s32 ixgbe_identify_qsfp_module_generic(struct ixgbe_hw *hw) |
| 1168 | { | 1169 | { |
| 1169 | struct ixgbe_adapter *adapter = hw->back; | 1170 | struct ixgbe_adapter *adapter = hw->back; |
| 1170 | s32 status = IXGBE_ERR_PHY_ADDR_INVALID; | 1171 | s32 status = IXGBE_ERR_PHY_ADDR_INVALID; |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h index aae900a256da..fffcbdd2bf0e 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h | |||
| @@ -145,7 +145,6 @@ s32 ixgbe_get_phy_firmware_version_generic(struct ixgbe_hw *hw, | |||
| 145 | s32 ixgbe_reset_phy_nl(struct ixgbe_hw *hw); | 145 | s32 ixgbe_reset_phy_nl(struct ixgbe_hw *hw); |
| 146 | s32 ixgbe_identify_module_generic(struct ixgbe_hw *hw); | 146 | s32 ixgbe_identify_module_generic(struct ixgbe_hw *hw); |
| 147 | s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw); | 147 | s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw); |
| 148 | s32 ixgbe_identify_qsfp_module_generic(struct ixgbe_hw *hw); | ||
| 149 | s32 ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw, | 148 | s32 ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw, |
| 150 | u16 *list_offset, | 149 | u16 *list_offset, |
| 151 | u16 *data_offset); | 150 | u16 *data_offset); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_selftest.c b/drivers/net/ethernet/mellanox/mlx4/en_selftest.c index 40626690e8a8..c11d063473e5 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_selftest.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_selftest.c | |||
| @@ -140,7 +140,6 @@ void mlx4_en_ex_selftest(struct net_device *dev, u32 *flags, u64 *buf) | |||
| 140 | { | 140 | { |
| 141 | struct mlx4_en_priv *priv = netdev_priv(dev); | 141 | struct mlx4_en_priv *priv = netdev_priv(dev); |
| 142 | struct mlx4_en_dev *mdev = priv->mdev; | 142 | struct mlx4_en_dev *mdev = priv->mdev; |
| 143 | struct mlx4_en_tx_ring *tx_ring; | ||
| 144 | int i, carrier_ok; | 143 | int i, carrier_ok; |
| 145 | 144 | ||
| 146 | memset(buf, 0, sizeof(u64) * MLX4_EN_NUM_SELF_TEST); | 145 | memset(buf, 0, sizeof(u64) * MLX4_EN_NUM_SELF_TEST); |
| @@ -150,16 +149,10 @@ void mlx4_en_ex_selftest(struct net_device *dev, u32 *flags, u64 *buf) | |||
| 150 | carrier_ok = netif_carrier_ok(dev); | 149 | carrier_ok = netif_carrier_ok(dev); |
| 151 | 150 | ||
| 152 | netif_carrier_off(dev); | 151 | netif_carrier_off(dev); |
| 153 | retry_tx: | ||
| 154 | /* Wait until all tx queues are empty. | 152 | /* Wait until all tx queues are empty. |
| 155 | * there should not be any additional incoming traffic | 153 | * there should not be any additional incoming traffic |
| 156 | * since we turned the carrier off */ | 154 | * since we turned the carrier off */ |
| 157 | msleep(200); | 155 | msleep(200); |
| 158 | for (i = 0; i < priv->tx_ring_num && carrier_ok; i++) { | ||
| 159 | tx_ring = priv->tx_ring[i]; | ||
| 160 | if (tx_ring->prod != (tx_ring->cons + tx_ring->last_nr_txbb)) | ||
| 161 | goto retry_tx; | ||
| 162 | } | ||
| 163 | 156 | ||
| 164 | if (priv->mdev->dev->caps.flags & | 157 | if (priv->mdev->dev->caps.flags & |
| 165 | MLX4_DEV_CAP_FLAG_UC_LOOPBACK) { | 158 | MLX4_DEV_CAP_FLAG_UC_LOOPBACK) { |
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c index f2a2128165dd..737c1a881f78 100644 --- a/drivers/net/ethernet/realtek/8139cp.c +++ b/drivers/net/ethernet/realtek/8139cp.c | |||
| @@ -678,9 +678,6 @@ static void cp_tx (struct cp_private *cp) | |||
| 678 | le32_to_cpu(txd->opts1) & 0xffff, | 678 | le32_to_cpu(txd->opts1) & 0xffff, |
| 679 | PCI_DMA_TODEVICE); | 679 | PCI_DMA_TODEVICE); |
| 680 | 680 | ||
| 681 | bytes_compl += skb->len; | ||
| 682 | pkts_compl++; | ||
| 683 | |||
| 684 | if (status & LastFrag) { | 681 | if (status & LastFrag) { |
| 685 | if (status & (TxError | TxFIFOUnder)) { | 682 | if (status & (TxError | TxFIFOUnder)) { |
| 686 | netif_dbg(cp, tx_err, cp->dev, | 683 | netif_dbg(cp, tx_err, cp->dev, |
| @@ -702,6 +699,8 @@ static void cp_tx (struct cp_private *cp) | |||
| 702 | netif_dbg(cp, tx_done, cp->dev, | 699 | netif_dbg(cp, tx_done, cp->dev, |
| 703 | "tx done, slot %d\n", tx_tail); | 700 | "tx done, slot %d\n", tx_tail); |
| 704 | } | 701 | } |
| 702 | bytes_compl += skb->len; | ||
| 703 | pkts_compl++; | ||
| 705 | dev_kfree_skb_irq(skb); | 704 | dev_kfree_skb_irq(skb); |
| 706 | } | 705 | } |
| 707 | 706 | ||
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 799387570766..c737f0ea5de7 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
| @@ -3465,6 +3465,11 @@ static void rtl8168g_1_hw_phy_config(struct rtl8169_private *tp) | |||
| 3465 | rtl_writephy(tp, 0x14, 0x9065); | 3465 | rtl_writephy(tp, 0x14, 0x9065); |
| 3466 | rtl_writephy(tp, 0x14, 0x1065); | 3466 | rtl_writephy(tp, 0x14, 0x1065); |
| 3467 | 3467 | ||
| 3468 | /* Check ALDPS bit, disable it if enabled */ | ||
| 3469 | rtl_writephy(tp, 0x1f, 0x0a43); | ||
| 3470 | if (rtl_readphy(tp, 0x10) & 0x0004) | ||
| 3471 | rtl_w1w0_phy(tp, 0x10, 0x0000, 0x0004); | ||
| 3472 | |||
| 3468 | rtl_writephy(tp, 0x1f, 0x0000); | 3473 | rtl_writephy(tp, 0x1f, 0x0000); |
| 3469 | } | 3474 | } |
| 3470 | 3475 | ||
diff --git a/drivers/net/ethernet/sfc/mcdi.h b/drivers/net/ethernet/sfc/mcdi.h index 656a3277c2b2..15816cacb548 100644 --- a/drivers/net/ethernet/sfc/mcdi.h +++ b/drivers/net/ethernet/sfc/mcdi.h | |||
| @@ -75,6 +75,8 @@ struct efx_mcdi_mon { | |||
| 75 | unsigned long last_update; | 75 | unsigned long last_update; |
| 76 | struct device *device; | 76 | struct device *device; |
| 77 | struct efx_mcdi_mon_attribute *attrs; | 77 | struct efx_mcdi_mon_attribute *attrs; |
| 78 | struct attribute_group group; | ||
| 79 | const struct attribute_group *groups[2]; | ||
| 78 | unsigned int n_attrs; | 80 | unsigned int n_attrs; |
| 79 | }; | 81 | }; |
| 80 | 82 | ||
diff --git a/drivers/net/ethernet/sfc/mcdi_mon.c b/drivers/net/ethernet/sfc/mcdi_mon.c index 4cc5d95b2a5a..d72ad4fc3617 100644 --- a/drivers/net/ethernet/sfc/mcdi_mon.c +++ b/drivers/net/ethernet/sfc/mcdi_mon.c | |||
| @@ -139,17 +139,10 @@ static int efx_mcdi_mon_update(struct efx_nic *efx) | |||
| 139 | return rc; | 139 | return rc; |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | static ssize_t efx_mcdi_mon_show_name(struct device *dev, | ||
| 143 | struct device_attribute *attr, | ||
| 144 | char *buf) | ||
| 145 | { | ||
| 146 | return sprintf(buf, "%s\n", KBUILD_MODNAME); | ||
| 147 | } | ||
| 148 | |||
| 149 | static int efx_mcdi_mon_get_entry(struct device *dev, unsigned int index, | 142 | static int efx_mcdi_mon_get_entry(struct device *dev, unsigned int index, |
| 150 | efx_dword_t *entry) | 143 | efx_dword_t *entry) |
| 151 | { | 144 | { |
| 152 | struct efx_nic *efx = dev_get_drvdata(dev); | 145 | struct efx_nic *efx = dev_get_drvdata(dev->parent); |
| 153 | struct efx_mcdi_mon *hwmon = efx_mcdi_mon(efx); | 146 | struct efx_mcdi_mon *hwmon = efx_mcdi_mon(efx); |
| 154 | int rc; | 147 | int rc; |
| 155 | 148 | ||
| @@ -263,7 +256,7 @@ static ssize_t efx_mcdi_mon_show_label(struct device *dev, | |||
| 263 | efx_mcdi_sensor_type[mon_attr->type].label); | 256 | efx_mcdi_sensor_type[mon_attr->type].label); |
| 264 | } | 257 | } |
| 265 | 258 | ||
| 266 | static int | 259 | static void |
| 267 | efx_mcdi_mon_add_attr(struct efx_nic *efx, const char *name, | 260 | efx_mcdi_mon_add_attr(struct efx_nic *efx, const char *name, |
| 268 | ssize_t (*reader)(struct device *, | 261 | ssize_t (*reader)(struct device *, |
| 269 | struct device_attribute *, char *), | 262 | struct device_attribute *, char *), |
| @@ -272,7 +265,6 @@ efx_mcdi_mon_add_attr(struct efx_nic *efx, const char *name, | |||
| 272 | { | 265 | { |
| 273 | struct efx_mcdi_mon *hwmon = efx_mcdi_mon(efx); | 266 | struct efx_mcdi_mon *hwmon = efx_mcdi_mon(efx); |
| 274 | struct efx_mcdi_mon_attribute *attr = &hwmon->attrs[hwmon->n_attrs]; | 267 | struct efx_mcdi_mon_attribute *attr = &hwmon->attrs[hwmon->n_attrs]; |
| 275 | int rc; | ||
| 276 | 268 | ||
| 277 | strlcpy(attr->name, name, sizeof(attr->name)); | 269 | strlcpy(attr->name, name, sizeof(attr->name)); |
| 278 | attr->index = index; | 270 | attr->index = index; |
| @@ -286,10 +278,7 @@ efx_mcdi_mon_add_attr(struct efx_nic *efx, const char *name, | |||
| 286 | attr->dev_attr.attr.name = attr->name; | 278 | attr->dev_attr.attr.name = attr->name; |
| 287 | attr->dev_attr.attr.mode = S_IRUGO; | 279 | attr->dev_attr.attr.mode = S_IRUGO; |
| 288 | attr->dev_attr.show = reader; | 280 | attr->dev_attr.show = reader; |
| 289 | rc = device_create_file(&efx->pci_dev->dev, &attr->dev_attr); | 281 | hwmon->group.attrs[hwmon->n_attrs++] = &attr->dev_attr.attr; |
| 290 | if (rc == 0) | ||
| 291 | ++hwmon->n_attrs; | ||
| 292 | return rc; | ||
| 293 | } | 282 | } |
| 294 | 283 | ||
| 295 | int efx_mcdi_mon_probe(struct efx_nic *efx) | 284 | int efx_mcdi_mon_probe(struct efx_nic *efx) |
| @@ -338,26 +327,22 @@ int efx_mcdi_mon_probe(struct efx_nic *efx) | |||
| 338 | efx_mcdi_mon_update(efx); | 327 | efx_mcdi_mon_update(efx); |
| 339 | 328 | ||
| 340 | /* Allocate space for the maximum possible number of | 329 | /* Allocate space for the maximum possible number of |
| 341 | * attributes for this set of sensors: name of the driver plus | 330 | * attributes for this set of sensors: |
| 342 | * value, min, max, crit, alarm and label for each sensor. | 331 | * value, min, max, crit, alarm and label for each sensor. |
| 343 | */ | 332 | */ |
| 344 | n_attrs = 1 + 6 * n_sensors; | 333 | n_attrs = 6 * n_sensors; |
| 345 | hwmon->attrs = kcalloc(n_attrs, sizeof(*hwmon->attrs), GFP_KERNEL); | 334 | hwmon->attrs = kcalloc(n_attrs, sizeof(*hwmon->attrs), GFP_KERNEL); |
| 346 | if (!hwmon->attrs) { | 335 | if (!hwmon->attrs) { |
| 347 | rc = -ENOMEM; | 336 | rc = -ENOMEM; |
| 348 | goto fail; | 337 | goto fail; |
| 349 | } | 338 | } |
| 350 | 339 | hwmon->group.attrs = kcalloc(n_attrs + 1, sizeof(struct attribute *), | |
| 351 | hwmon->device = hwmon_device_register(&efx->pci_dev->dev); | 340 | GFP_KERNEL); |
| 352 | if (IS_ERR(hwmon->device)) { | 341 | if (!hwmon->group.attrs) { |
| 353 | rc = PTR_ERR(hwmon->device); | 342 | rc = -ENOMEM; |
| 354 | goto fail; | 343 | goto fail; |
| 355 | } | 344 | } |
| 356 | 345 | ||
| 357 | rc = efx_mcdi_mon_add_attr(efx, "name", efx_mcdi_mon_show_name, 0, 0, 0); | ||
| 358 | if (rc) | ||
| 359 | goto fail; | ||
| 360 | |||
| 361 | for (i = 0, j = -1, type = -1; ; i++) { | 346 | for (i = 0, j = -1, type = -1; ; i++) { |
| 362 | enum efx_hwmon_type hwmon_type; | 347 | enum efx_hwmon_type hwmon_type; |
| 363 | const char *hwmon_prefix; | 348 | const char *hwmon_prefix; |
| @@ -372,7 +357,7 @@ int efx_mcdi_mon_probe(struct efx_nic *efx) | |||
| 372 | page = type / 32; | 357 | page = type / 32; |
| 373 | j = -1; | 358 | j = -1; |
| 374 | if (page == n_pages) | 359 | if (page == n_pages) |
| 375 | return 0; | 360 | goto hwmon_register; |
| 376 | 361 | ||
| 377 | MCDI_SET_DWORD(inbuf, SENSOR_INFO_EXT_IN_PAGE, | 362 | MCDI_SET_DWORD(inbuf, SENSOR_INFO_EXT_IN_PAGE, |
| 378 | page); | 363 | page); |
| @@ -453,28 +438,22 @@ int efx_mcdi_mon_probe(struct efx_nic *efx) | |||
| 453 | if (min1 != max1) { | 438 | if (min1 != max1) { |
| 454 | snprintf(name, sizeof(name), "%s%u_input", | 439 | snprintf(name, sizeof(name), "%s%u_input", |
| 455 | hwmon_prefix, hwmon_index); | 440 | hwmon_prefix, hwmon_index); |
| 456 | rc = efx_mcdi_mon_add_attr( | 441 | efx_mcdi_mon_add_attr( |
| 457 | efx, name, efx_mcdi_mon_show_value, i, type, 0); | 442 | efx, name, efx_mcdi_mon_show_value, i, type, 0); |
| 458 | if (rc) | ||
| 459 | goto fail; | ||
| 460 | 443 | ||
| 461 | if (hwmon_type != EFX_HWMON_POWER) { | 444 | if (hwmon_type != EFX_HWMON_POWER) { |
| 462 | snprintf(name, sizeof(name), "%s%u_min", | 445 | snprintf(name, sizeof(name), "%s%u_min", |
| 463 | hwmon_prefix, hwmon_index); | 446 | hwmon_prefix, hwmon_index); |
| 464 | rc = efx_mcdi_mon_add_attr( | 447 | efx_mcdi_mon_add_attr( |
| 465 | efx, name, efx_mcdi_mon_show_limit, | 448 | efx, name, efx_mcdi_mon_show_limit, |
| 466 | i, type, min1); | 449 | i, type, min1); |
| 467 | if (rc) | ||
| 468 | goto fail; | ||
| 469 | } | 450 | } |
| 470 | 451 | ||
| 471 | snprintf(name, sizeof(name), "%s%u_max", | 452 | snprintf(name, sizeof(name), "%s%u_max", |
| 472 | hwmon_prefix, hwmon_index); | 453 | hwmon_prefix, hwmon_index); |
| 473 | rc = efx_mcdi_mon_add_attr( | 454 | efx_mcdi_mon_add_attr( |
| 474 | efx, name, efx_mcdi_mon_show_limit, | 455 | efx, name, efx_mcdi_mon_show_limit, |
| 475 | i, type, max1); | 456 | i, type, max1); |
| 476 | if (rc) | ||
| 477 | goto fail; | ||
| 478 | 457 | ||
| 479 | if (min2 != max2) { | 458 | if (min2 != max2) { |
| 480 | /* Assume max2 is critical value. | 459 | /* Assume max2 is critical value. |
| @@ -482,32 +461,38 @@ int efx_mcdi_mon_probe(struct efx_nic *efx) | |||
| 482 | */ | 461 | */ |
| 483 | snprintf(name, sizeof(name), "%s%u_crit", | 462 | snprintf(name, sizeof(name), "%s%u_crit", |
| 484 | hwmon_prefix, hwmon_index); | 463 | hwmon_prefix, hwmon_index); |
| 485 | rc = efx_mcdi_mon_add_attr( | 464 | efx_mcdi_mon_add_attr( |
| 486 | efx, name, efx_mcdi_mon_show_limit, | 465 | efx, name, efx_mcdi_mon_show_limit, |
| 487 | i, type, max2); | 466 | i, type, max2); |
| 488 | if (rc) | ||
| 489 | goto fail; | ||
| 490 | } | 467 | } |
| 491 | } | 468 | } |
| 492 | 469 | ||
| 493 | snprintf(name, sizeof(name), "%s%u_alarm", | 470 | snprintf(name, sizeof(name), "%s%u_alarm", |
| 494 | hwmon_prefix, hwmon_index); | 471 | hwmon_prefix, hwmon_index); |
| 495 | rc = efx_mcdi_mon_add_attr( | 472 | efx_mcdi_mon_add_attr( |
| 496 | efx, name, efx_mcdi_mon_show_alarm, i, type, 0); | 473 | efx, name, efx_mcdi_mon_show_alarm, i, type, 0); |
| 497 | if (rc) | ||
| 498 | goto fail; | ||
| 499 | 474 | ||
| 500 | if (type < ARRAY_SIZE(efx_mcdi_sensor_type) && | 475 | if (type < ARRAY_SIZE(efx_mcdi_sensor_type) && |
| 501 | efx_mcdi_sensor_type[type].label) { | 476 | efx_mcdi_sensor_type[type].label) { |
| 502 | snprintf(name, sizeof(name), "%s%u_label", | 477 | snprintf(name, sizeof(name), "%s%u_label", |
| 503 | hwmon_prefix, hwmon_index); | 478 | hwmon_prefix, hwmon_index); |
| 504 | rc = efx_mcdi_mon_add_attr( | 479 | efx_mcdi_mon_add_attr( |
| 505 | efx, name, efx_mcdi_mon_show_label, i, type, 0); | 480 | efx, name, efx_mcdi_mon_show_label, i, type, 0); |
| 506 | if (rc) | ||
| 507 | goto fail; | ||
| 508 | } | 481 | } |
| 509 | } | 482 | } |
| 510 | 483 | ||
| 484 | hwmon_register: | ||
| 485 | hwmon->groups[0] = &hwmon->group; | ||
| 486 | hwmon->device = hwmon_device_register_with_groups(&efx->pci_dev->dev, | ||
| 487 | KBUILD_MODNAME, NULL, | ||
| 488 | hwmon->groups); | ||
| 489 | if (IS_ERR(hwmon->device)) { | ||
| 490 | rc = PTR_ERR(hwmon->device); | ||
| 491 | goto fail; | ||
| 492 | } | ||
| 493 | |||
| 494 | return 0; | ||
| 495 | |||
| 511 | fail: | 496 | fail: |
| 512 | efx_mcdi_mon_remove(efx); | 497 | efx_mcdi_mon_remove(efx); |
| 513 | return rc; | 498 | return rc; |
| @@ -516,14 +501,11 @@ fail: | |||
| 516 | void efx_mcdi_mon_remove(struct efx_nic *efx) | 501 | void efx_mcdi_mon_remove(struct efx_nic *efx) |
| 517 | { | 502 | { |
| 518 | struct efx_mcdi_mon *hwmon = efx_mcdi_mon(efx); | 503 | struct efx_mcdi_mon *hwmon = efx_mcdi_mon(efx); |
| 519 | unsigned int i; | ||
| 520 | 504 | ||
| 521 | for (i = 0; i < hwmon->n_attrs; i++) | ||
| 522 | device_remove_file(&efx->pci_dev->dev, | ||
| 523 | &hwmon->attrs[i].dev_attr); | ||
| 524 | kfree(hwmon->attrs); | ||
| 525 | if (hwmon->device) | 505 | if (hwmon->device) |
| 526 | hwmon_device_unregister(hwmon->device); | 506 | hwmon_device_unregister(hwmon->device); |
| 507 | kfree(hwmon->attrs); | ||
| 508 | kfree(hwmon->group.attrs); | ||
| 527 | efx_nic_free_buffer(efx, &hwmon->dma_buf); | 509 | efx_nic_free_buffer(efx, &hwmon->dma_buf); |
| 528 | } | 510 | } |
| 529 | 511 | ||
diff --git a/drivers/net/ethernet/smsc/smc91x.h b/drivers/net/ethernet/smsc/smc91x.h index c9d4c872e81d..749654b976bc 100644 --- a/drivers/net/ethernet/smsc/smc91x.h +++ b/drivers/net/ethernet/smsc/smc91x.h | |||
| @@ -46,7 +46,8 @@ | |||
| 46 | defined(CONFIG_MACH_LITTLETON) ||\ | 46 | defined(CONFIG_MACH_LITTLETON) ||\ |
| 47 | defined(CONFIG_MACH_ZYLONITE2) ||\ | 47 | defined(CONFIG_MACH_ZYLONITE2) ||\ |
| 48 | defined(CONFIG_ARCH_VIPER) ||\ | 48 | defined(CONFIG_ARCH_VIPER) ||\ |
| 49 | defined(CONFIG_MACH_STARGATE2) | 49 | defined(CONFIG_MACH_STARGATE2) ||\ |
| 50 | defined(CONFIG_ARCH_VERSATILE) | ||
| 50 | 51 | ||
| 51 | #include <asm/mach-types.h> | 52 | #include <asm/mach-types.h> |
| 52 | 53 | ||
| @@ -154,6 +155,8 @@ static inline void SMC_outw(u16 val, void __iomem *ioaddr, int reg) | |||
| 154 | #define SMC_outl(v, a, r) writel(v, (a) + (r)) | 155 | #define SMC_outl(v, a, r) writel(v, (a) + (r)) |
| 155 | #define SMC_insl(a, r, p, l) readsl((a) + (r), p, l) | 156 | #define SMC_insl(a, r, p, l) readsl((a) + (r), p, l) |
| 156 | #define SMC_outsl(a, r, p, l) writesl((a) + (r), p, l) | 157 | #define SMC_outsl(a, r, p, l) writesl((a) + (r), p, l) |
| 158 | #define SMC_insw(a, r, p, l) readsw((a) + (r), p, l) | ||
| 159 | #define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) | ||
| 157 | #define SMC_IRQ_FLAGS (-1) /* from resource */ | 160 | #define SMC_IRQ_FLAGS (-1) /* from resource */ |
| 158 | 161 | ||
| 159 | /* We actually can't write halfwords properly if not word aligned */ | 162 | /* We actually can't write halfwords properly if not word aligned */ |
| @@ -206,23 +209,6 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg) | |||
| 206 | #define RPC_LSA_DEFAULT RPC_LED_TX_RX | 209 | #define RPC_LSA_DEFAULT RPC_LED_TX_RX |
| 207 | #define RPC_LSB_DEFAULT RPC_LED_100_10 | 210 | #define RPC_LSB_DEFAULT RPC_LED_100_10 |
| 208 | 211 | ||
| 209 | #elif defined(CONFIG_ARCH_VERSATILE) | ||
| 210 | |||
| 211 | #define SMC_CAN_USE_8BIT 1 | ||
| 212 | #define SMC_CAN_USE_16BIT 1 | ||
| 213 | #define SMC_CAN_USE_32BIT 1 | ||
| 214 | #define SMC_NOWAIT 1 | ||
| 215 | |||
| 216 | #define SMC_inb(a, r) readb((a) + (r)) | ||
| 217 | #define SMC_inw(a, r) readw((a) + (r)) | ||
| 218 | #define SMC_inl(a, r) readl((a) + (r)) | ||
| 219 | #define SMC_outb(v, a, r) writeb(v, (a) + (r)) | ||
| 220 | #define SMC_outw(v, a, r) writew(v, (a) + (r)) | ||
| 221 | #define SMC_outl(v, a, r) writel(v, (a) + (r)) | ||
| 222 | #define SMC_insl(a, r, p, l) readsl((a) + (r), p, l) | ||
| 223 | #define SMC_outsl(a, r, p, l) writesl((a) + (r), p, l) | ||
| 224 | #define SMC_IRQ_FLAGS (-1) /* from resource */ | ||
| 225 | |||
| 226 | #elif defined(CONFIG_MN10300) | 212 | #elif defined(CONFIG_MN10300) |
| 227 | 213 | ||
| 228 | /* | 214 | /* |
diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index d022bf936572..ad61d26a44f3 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c | |||
| @@ -2172,16 +2172,13 @@ static int velocity_poll(struct napi_struct *napi, int budget) | |||
| 2172 | unsigned int rx_done; | 2172 | unsigned int rx_done; |
| 2173 | unsigned long flags; | 2173 | unsigned long flags; |
| 2174 | 2174 | ||
| 2175 | spin_lock_irqsave(&vptr->lock, flags); | ||
| 2176 | /* | 2175 | /* |
| 2177 | * Do rx and tx twice for performance (taken from the VIA | 2176 | * Do rx and tx twice for performance (taken from the VIA |
| 2178 | * out-of-tree driver). | 2177 | * out-of-tree driver). |
| 2179 | */ | 2178 | */ |
| 2180 | rx_done = velocity_rx_srv(vptr, budget / 2); | 2179 | rx_done = velocity_rx_srv(vptr, budget); |
| 2181 | velocity_tx_srv(vptr); | 2180 | spin_lock_irqsave(&vptr->lock, flags); |
| 2182 | rx_done += velocity_rx_srv(vptr, budget - rx_done); | ||
| 2183 | velocity_tx_srv(vptr); | 2181 | velocity_tx_srv(vptr); |
| 2184 | |||
| 2185 | /* If budget not fully consumed, exit the polling mode */ | 2182 | /* If budget not fully consumed, exit the polling mode */ |
| 2186 | if (rx_done < budget) { | 2183 | if (rx_done < budget) { |
| 2187 | napi_complete(napi); | 2184 | napi_complete(napi); |
| @@ -2342,6 +2339,8 @@ static int velocity_change_mtu(struct net_device *dev, int new_mtu) | |||
| 2342 | if (ret < 0) | 2339 | if (ret < 0) |
| 2343 | goto out_free_tmp_vptr_1; | 2340 | goto out_free_tmp_vptr_1; |
| 2344 | 2341 | ||
| 2342 | napi_disable(&vptr->napi); | ||
| 2343 | |||
| 2345 | spin_lock_irqsave(&vptr->lock, flags); | 2344 | spin_lock_irqsave(&vptr->lock, flags); |
| 2346 | 2345 | ||
| 2347 | netif_stop_queue(dev); | 2346 | netif_stop_queue(dev); |
| @@ -2362,6 +2361,8 @@ static int velocity_change_mtu(struct net_device *dev, int new_mtu) | |||
| 2362 | 2361 | ||
| 2363 | velocity_give_many_rx_descs(vptr); | 2362 | velocity_give_many_rx_descs(vptr); |
| 2364 | 2363 | ||
| 2364 | napi_enable(&vptr->napi); | ||
| 2365 | |||
| 2365 | mac_enable_int(vptr->mac_regs); | 2366 | mac_enable_int(vptr->mac_regs); |
| 2366 | netif_start_queue(dev); | 2367 | netif_start_queue(dev); |
| 2367 | 2368 | ||
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index dc76670c2f2a..9093004f9b63 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c | |||
| @@ -744,7 +744,7 @@ err: | |||
| 744 | rcu_read_lock(); | 744 | rcu_read_lock(); |
| 745 | vlan = rcu_dereference(q->vlan); | 745 | vlan = rcu_dereference(q->vlan); |
| 746 | if (vlan) | 746 | if (vlan) |
| 747 | vlan->dev->stats.tx_dropped++; | 747 | this_cpu_inc(vlan->pcpu_stats->tx_dropped); |
| 748 | rcu_read_unlock(); | 748 | rcu_read_unlock(); |
| 749 | 749 | ||
| 750 | return err; | 750 | return err; |
| @@ -767,7 +767,6 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q, | |||
| 767 | const struct sk_buff *skb, | 767 | const struct sk_buff *skb, |
| 768 | const struct iovec *iv, int len) | 768 | const struct iovec *iv, int len) |
| 769 | { | 769 | { |
| 770 | struct macvlan_dev *vlan; | ||
| 771 | int ret; | 770 | int ret; |
| 772 | int vnet_hdr_len = 0; | 771 | int vnet_hdr_len = 0; |
| 773 | int vlan_offset = 0; | 772 | int vlan_offset = 0; |
| @@ -821,15 +820,6 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q, | |||
| 821 | copied += len; | 820 | copied += len; |
| 822 | 821 | ||
| 823 | done: | 822 | done: |
| 824 | rcu_read_lock(); | ||
| 825 | vlan = rcu_dereference(q->vlan); | ||
| 826 | if (vlan) { | ||
| 827 | preempt_disable(); | ||
| 828 | macvlan_count_rx(vlan, copied - vnet_hdr_len, ret == 0, 0); | ||
| 829 | preempt_enable(); | ||
| 830 | } | ||
| 831 | rcu_read_unlock(); | ||
| 832 | |||
| 833 | return ret ? ret : copied; | 823 | return ret ? ret : copied; |
| 834 | } | 824 | } |
| 835 | 825 | ||
diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c index 508e4359338b..14372c65a7e8 100644 --- a/drivers/net/phy/vitesse.c +++ b/drivers/net/phy/vitesse.c | |||
| @@ -64,6 +64,7 @@ | |||
| 64 | 64 | ||
| 65 | #define PHY_ID_VSC8234 0x000fc620 | 65 | #define PHY_ID_VSC8234 0x000fc620 |
| 66 | #define PHY_ID_VSC8244 0x000fc6c0 | 66 | #define PHY_ID_VSC8244 0x000fc6c0 |
| 67 | #define PHY_ID_VSC8514 0x00070670 | ||
| 67 | #define PHY_ID_VSC8574 0x000704a0 | 68 | #define PHY_ID_VSC8574 0x000704a0 |
| 68 | #define PHY_ID_VSC8662 0x00070660 | 69 | #define PHY_ID_VSC8662 0x00070660 |
| 69 | #define PHY_ID_VSC8221 0x000fc550 | 70 | #define PHY_ID_VSC8221 0x000fc550 |
| @@ -131,6 +132,7 @@ static int vsc82xx_config_intr(struct phy_device *phydev) | |||
| 131 | err = phy_write(phydev, MII_VSC8244_IMASK, | 132 | err = phy_write(phydev, MII_VSC8244_IMASK, |
| 132 | (phydev->drv->phy_id == PHY_ID_VSC8234 || | 133 | (phydev->drv->phy_id == PHY_ID_VSC8234 || |
| 133 | phydev->drv->phy_id == PHY_ID_VSC8244 || | 134 | phydev->drv->phy_id == PHY_ID_VSC8244 || |
| 135 | phydev->drv->phy_id == PHY_ID_VSC8514 || | ||
| 134 | phydev->drv->phy_id == PHY_ID_VSC8574) ? | 136 | phydev->drv->phy_id == PHY_ID_VSC8574) ? |
| 135 | MII_VSC8244_IMASK_MASK : | 137 | MII_VSC8244_IMASK_MASK : |
| 136 | MII_VSC8221_IMASK_MASK); | 138 | MII_VSC8221_IMASK_MASK); |
| @@ -246,6 +248,18 @@ static struct phy_driver vsc82xx_driver[] = { | |||
| 246 | .config_intr = &vsc82xx_config_intr, | 248 | .config_intr = &vsc82xx_config_intr, |
| 247 | .driver = { .owner = THIS_MODULE,}, | 249 | .driver = { .owner = THIS_MODULE,}, |
| 248 | }, { | 250 | }, { |
| 251 | .phy_id = PHY_ID_VSC8514, | ||
| 252 | .name = "Vitesse VSC8514", | ||
| 253 | .phy_id_mask = 0x000ffff0, | ||
| 254 | .features = PHY_GBIT_FEATURES, | ||
| 255 | .flags = PHY_HAS_INTERRUPT, | ||
| 256 | .config_init = &vsc824x_config_init, | ||
| 257 | .config_aneg = &vsc82x4_config_aneg, | ||
| 258 | .read_status = &genphy_read_status, | ||
| 259 | .ack_interrupt = &vsc824x_ack_interrupt, | ||
| 260 | .config_intr = &vsc82xx_config_intr, | ||
| 261 | .driver = { .owner = THIS_MODULE,}, | ||
| 262 | }, { | ||
| 249 | .phy_id = PHY_ID_VSC8574, | 263 | .phy_id = PHY_ID_VSC8574, |
| 250 | .name = "Vitesse VSC8574", | 264 | .name = "Vitesse VSC8574", |
| 251 | .phy_id_mask = 0x000ffff0, | 265 | .phy_id_mask = 0x000ffff0, |
| @@ -315,6 +329,7 @@ module_exit(vsc82xx_exit); | |||
| 315 | static struct mdio_device_id __maybe_unused vitesse_tbl[] = { | 329 | static struct mdio_device_id __maybe_unused vitesse_tbl[] = { |
| 316 | { PHY_ID_VSC8234, 0x000ffff0 }, | 330 | { PHY_ID_VSC8234, 0x000ffff0 }, |
| 317 | { PHY_ID_VSC8244, 0x000fffc0 }, | 331 | { PHY_ID_VSC8244, 0x000fffc0 }, |
| 332 | { PHY_ID_VSC8514, 0x000ffff0 }, | ||
| 318 | { PHY_ID_VSC8574, 0x000ffff0 }, | 333 | { PHY_ID_VSC8574, 0x000ffff0 }, |
| 319 | { PHY_ID_VSC8662, 0x000ffff0 }, | 334 | { PHY_ID_VSC8662, 0x000ffff0 }, |
| 320 | { PHY_ID_VSC8221, 0x000ffff0 }, | 335 | { PHY_ID_VSC8221, 0x000ffff0 }, |
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 34b0de09d881..736050d6b451 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c | |||
| @@ -1366,6 +1366,8 @@ static int team_user_linkup_option_get(struct team *team, | |||
| 1366 | return 0; | 1366 | return 0; |
| 1367 | } | 1367 | } |
| 1368 | 1368 | ||
| 1369 | static void __team_carrier_check(struct team *team); | ||
| 1370 | |||
| 1369 | static int team_user_linkup_option_set(struct team *team, | 1371 | static int team_user_linkup_option_set(struct team *team, |
| 1370 | struct team_gsetter_ctx *ctx) | 1372 | struct team_gsetter_ctx *ctx) |
| 1371 | { | 1373 | { |
| @@ -1373,6 +1375,7 @@ static int team_user_linkup_option_set(struct team *team, | |||
| 1373 | 1375 | ||
| 1374 | port->user.linkup = ctx->data.bool_val; | 1376 | port->user.linkup = ctx->data.bool_val; |
| 1375 | team_refresh_port_linkup(port); | 1377 | team_refresh_port_linkup(port); |
| 1378 | __team_carrier_check(port->team); | ||
| 1376 | return 0; | 1379 | return 0; |
| 1377 | } | 1380 | } |
| 1378 | 1381 | ||
| @@ -1392,6 +1395,7 @@ static int team_user_linkup_en_option_set(struct team *team, | |||
| 1392 | 1395 | ||
| 1393 | port->user.linkup_enabled = ctx->data.bool_val; | 1396 | port->user.linkup_enabled = ctx->data.bool_val; |
| 1394 | team_refresh_port_linkup(port); | 1397 | team_refresh_port_linkup(port); |
| 1398 | __team_carrier_check(port->team); | ||
| 1395 | return 0; | 1399 | return 0; |
| 1396 | } | 1400 | } |
| 1397 | 1401 | ||
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 7bab4de658a9..916241d16c67 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
| @@ -299,35 +299,76 @@ static struct sk_buff *page_to_skb(struct receive_queue *rq, | |||
| 299 | return skb; | 299 | return skb; |
| 300 | } | 300 | } |
| 301 | 301 | ||
| 302 | static int receive_mergeable(struct receive_queue *rq, struct sk_buff *head_skb) | 302 | static struct sk_buff *receive_small(void *buf, unsigned int len) |
| 303 | { | 303 | { |
| 304 | struct skb_vnet_hdr *hdr = skb_vnet_hdr(head_skb); | 304 | struct sk_buff * skb = buf; |
| 305 | |||
| 306 | len -= sizeof(struct virtio_net_hdr); | ||
| 307 | skb_trim(skb, len); | ||
| 308 | |||
| 309 | return skb; | ||
| 310 | } | ||
| 311 | |||
| 312 | static struct sk_buff *receive_big(struct net_device *dev, | ||
| 313 | struct receive_queue *rq, | ||
| 314 | void *buf, | ||
| 315 | unsigned int len) | ||
| 316 | { | ||
| 317 | struct page *page = buf; | ||
| 318 | struct sk_buff *skb = page_to_skb(rq, page, 0, len, PAGE_SIZE); | ||
| 319 | |||
| 320 | if (unlikely(!skb)) | ||
| 321 | goto err; | ||
| 322 | |||
| 323 | return skb; | ||
| 324 | |||
| 325 | err: | ||
| 326 | dev->stats.rx_dropped++; | ||
| 327 | give_pages(rq, page); | ||
| 328 | return NULL; | ||
| 329 | } | ||
| 330 | |||
| 331 | static struct sk_buff *receive_mergeable(struct net_device *dev, | ||
| 332 | struct receive_queue *rq, | ||
| 333 | void *buf, | ||
| 334 | unsigned int len) | ||
| 335 | { | ||
| 336 | struct skb_vnet_hdr *hdr = buf; | ||
| 337 | int num_buf = hdr->mhdr.num_buffers; | ||
| 338 | struct page *page = virt_to_head_page(buf); | ||
| 339 | int offset = buf - page_address(page); | ||
| 340 | struct sk_buff *head_skb = page_to_skb(rq, page, offset, len, | ||
| 341 | MERGE_BUFFER_LEN); | ||
| 305 | struct sk_buff *curr_skb = head_skb; | 342 | struct sk_buff *curr_skb = head_skb; |
| 306 | char *buf; | ||
| 307 | struct page *page; | ||
| 308 | int num_buf, len, offset; | ||
| 309 | 343 | ||
| 310 | num_buf = hdr->mhdr.num_buffers; | 344 | if (unlikely(!curr_skb)) |
| 345 | goto err_skb; | ||
| 346 | |||
| 311 | while (--num_buf) { | 347 | while (--num_buf) { |
| 312 | int num_skb_frags = skb_shinfo(curr_skb)->nr_frags; | 348 | int num_skb_frags; |
| 349 | |||
| 313 | buf = virtqueue_get_buf(rq->vq, &len); | 350 | buf = virtqueue_get_buf(rq->vq, &len); |
| 314 | if (unlikely(!buf)) { | 351 | if (unlikely(!buf)) { |
| 315 | pr_debug("%s: rx error: %d buffers missing\n", | 352 | pr_debug("%s: rx error: %d buffers out of %d missing\n", |
| 316 | head_skb->dev->name, hdr->mhdr.num_buffers); | 353 | dev->name, num_buf, hdr->mhdr.num_buffers); |
| 317 | head_skb->dev->stats.rx_length_errors++; | 354 | dev->stats.rx_length_errors++; |
| 318 | return -EINVAL; | 355 | goto err_buf; |
| 319 | } | 356 | } |
| 320 | if (unlikely(len > MERGE_BUFFER_LEN)) { | 357 | if (unlikely(len > MERGE_BUFFER_LEN)) { |
| 321 | pr_debug("%s: rx error: merge buffer too long\n", | 358 | pr_debug("%s: rx error: merge buffer too long\n", |
| 322 | head_skb->dev->name); | 359 | dev->name); |
| 323 | len = MERGE_BUFFER_LEN; | 360 | len = MERGE_BUFFER_LEN; |
| 324 | } | 361 | } |
| 362 | |||
| 363 | page = virt_to_head_page(buf); | ||
| 364 | --rq->num; | ||
| 365 | |||
| 366 | num_skb_frags = skb_shinfo(curr_skb)->nr_frags; | ||
| 325 | if (unlikely(num_skb_frags == MAX_SKB_FRAGS)) { | 367 | if (unlikely(num_skb_frags == MAX_SKB_FRAGS)) { |
| 326 | struct sk_buff *nskb = alloc_skb(0, GFP_ATOMIC); | 368 | struct sk_buff *nskb = alloc_skb(0, GFP_ATOMIC); |
| 327 | if (unlikely(!nskb)) { | 369 | |
| 328 | head_skb->dev->stats.rx_dropped++; | 370 | if (unlikely(!nskb)) |
| 329 | return -ENOMEM; | 371 | goto err_skb; |
| 330 | } | ||
| 331 | if (curr_skb == head_skb) | 372 | if (curr_skb == head_skb) |
| 332 | skb_shinfo(curr_skb)->frag_list = nskb; | 373 | skb_shinfo(curr_skb)->frag_list = nskb; |
| 333 | else | 374 | else |
| @@ -341,8 +382,7 @@ static int receive_mergeable(struct receive_queue *rq, struct sk_buff *head_skb) | |||
| 341 | head_skb->len += len; | 382 | head_skb->len += len; |
| 342 | head_skb->truesize += MERGE_BUFFER_LEN; | 383 | head_skb->truesize += MERGE_BUFFER_LEN; |
| 343 | } | 384 | } |
| 344 | page = virt_to_head_page(buf); | 385 | offset = buf - page_address(page); |
| 345 | offset = buf - (char *)page_address(page); | ||
| 346 | if (skb_can_coalesce(curr_skb, num_skb_frags, page, offset)) { | 386 | if (skb_can_coalesce(curr_skb, num_skb_frags, page, offset)) { |
| 347 | put_page(page); | 387 | put_page(page); |
| 348 | skb_coalesce_rx_frag(curr_skb, num_skb_frags - 1, | 388 | skb_coalesce_rx_frag(curr_skb, num_skb_frags - 1, |
| @@ -351,9 +391,28 @@ static int receive_mergeable(struct receive_queue *rq, struct sk_buff *head_skb) | |||
| 351 | skb_add_rx_frag(curr_skb, num_skb_frags, page, | 391 | skb_add_rx_frag(curr_skb, num_skb_frags, page, |
| 352 | offset, len, MERGE_BUFFER_LEN); | 392 | offset, len, MERGE_BUFFER_LEN); |
| 353 | } | 393 | } |
| 394 | } | ||
| 395 | |||
| 396 | return head_skb; | ||
| 397 | |||
| 398 | err_skb: | ||
| 399 | put_page(page); | ||
| 400 | while (--num_buf) { | ||
| 401 | buf = virtqueue_get_buf(rq->vq, &len); | ||
| 402 | if (unlikely(!buf)) { | ||
| 403 | pr_debug("%s: rx error: %d buffers missing\n", | ||
| 404 | dev->name, num_buf); | ||
| 405 | dev->stats.rx_length_errors++; | ||
| 406 | break; | ||
| 407 | } | ||
| 408 | page = virt_to_head_page(buf); | ||
| 409 | put_page(page); | ||
| 354 | --rq->num; | 410 | --rq->num; |
| 355 | } | 411 | } |
| 356 | return 0; | 412 | err_buf: |
| 413 | dev->stats.rx_dropped++; | ||
| 414 | dev_kfree_skb(head_skb); | ||
| 415 | return NULL; | ||
| 357 | } | 416 | } |
| 358 | 417 | ||
| 359 | static void receive_buf(struct receive_queue *rq, void *buf, unsigned int len) | 418 | static void receive_buf(struct receive_queue *rq, void *buf, unsigned int len) |
| @@ -362,7 +421,6 @@ static void receive_buf(struct receive_queue *rq, void *buf, unsigned int len) | |||
| 362 | struct net_device *dev = vi->dev; | 421 | struct net_device *dev = vi->dev; |
| 363 | struct virtnet_stats *stats = this_cpu_ptr(vi->stats); | 422 | struct virtnet_stats *stats = this_cpu_ptr(vi->stats); |
| 364 | struct sk_buff *skb; | 423 | struct sk_buff *skb; |
| 365 | struct page *page; | ||
| 366 | struct skb_vnet_hdr *hdr; | 424 | struct skb_vnet_hdr *hdr; |
| 367 | 425 | ||
| 368 | if (unlikely(len < sizeof(struct virtio_net_hdr) + ETH_HLEN)) { | 426 | if (unlikely(len < sizeof(struct virtio_net_hdr) + ETH_HLEN)) { |
| @@ -377,33 +435,15 @@ static void receive_buf(struct receive_queue *rq, void *buf, unsigned int len) | |||
| 377 | return; | 435 | return; |
| 378 | } | 436 | } |
| 379 | 437 | ||
| 380 | if (!vi->mergeable_rx_bufs && !vi->big_packets) { | 438 | if (vi->mergeable_rx_bufs) |
| 381 | skb = buf; | 439 | skb = receive_mergeable(dev, rq, buf, len); |
| 382 | len -= sizeof(struct virtio_net_hdr); | 440 | else if (vi->big_packets) |
| 383 | skb_trim(skb, len); | 441 | skb = receive_big(dev, rq, buf, len); |
| 384 | } else if (vi->mergeable_rx_bufs) { | 442 | else |
| 385 | struct page *page = virt_to_head_page(buf); | 443 | skb = receive_small(buf, len); |
| 386 | skb = page_to_skb(rq, page, | 444 | |
| 387 | (char *)buf - (char *)page_address(page), | 445 | if (unlikely(!skb)) |
| 388 | len, MERGE_BUFFER_LEN); | 446 | return; |
| 389 | if (unlikely(!skb)) { | ||
| 390 | dev->stats.rx_dropped++; | ||
| 391 | put_page(page); | ||
| 392 | return; | ||
| 393 | } | ||
| 394 | if (receive_mergeable(rq, skb)) { | ||
| 395 | dev_kfree_skb(skb); | ||
| 396 | return; | ||
| 397 | } | ||
| 398 | } else { | ||
| 399 | page = buf; | ||
| 400 | skb = page_to_skb(rq, page, 0, len, PAGE_SIZE); | ||
| 401 | if (unlikely(!skb)) { | ||
| 402 | dev->stats.rx_dropped++; | ||
| 403 | give_pages(rq, page); | ||
| 404 | return; | ||
| 405 | } | ||
| 406 | } | ||
| 407 | 447 | ||
| 408 | hdr = skb_vnet_hdr(skb); | 448 | hdr = skb_vnet_hdr(skb); |
| 409 | 449 | ||
| @@ -1084,7 +1124,7 @@ static void virtnet_set_rx_mode(struct net_device *dev) | |||
| 1084 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_MAC, | 1124 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_MAC, |
| 1085 | VIRTIO_NET_CTRL_MAC_TABLE_SET, | 1125 | VIRTIO_NET_CTRL_MAC_TABLE_SET, |
| 1086 | sg, NULL)) | 1126 | sg, NULL)) |
| 1087 | dev_warn(&dev->dev, "Failed to set MAC fitler table.\n"); | 1127 | dev_warn(&dev->dev, "Failed to set MAC filter table.\n"); |
| 1088 | 1128 | ||
| 1089 | kfree(buf); | 1129 | kfree(buf); |
| 1090 | } | 1130 | } |
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index 919b6509455c..64f0e0d18b81 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c | |||
| @@ -39,6 +39,7 @@ | |||
| 39 | #include <linux/udp.h> | 39 | #include <linux/udp.h> |
| 40 | 40 | ||
| 41 | #include <net/tcp.h> | 41 | #include <net/tcp.h> |
| 42 | #include <net/ip6_checksum.h> | ||
| 42 | 43 | ||
| 43 | #include <xen/xen.h> | 44 | #include <xen/xen.h> |
| 44 | #include <xen/events.h> | 45 | #include <xen/events.h> |
diff --git a/drivers/pinctrl/pinctrl-abx500.c b/drivers/pinctrl/pinctrl-abx500.c index 4780959e11d4..5183e7bb8de3 100644 --- a/drivers/pinctrl/pinctrl-abx500.c +++ b/drivers/pinctrl/pinctrl-abx500.c | |||
| @@ -418,7 +418,7 @@ static int abx500_set_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip, | |||
| 418 | ret = abx500_gpio_set_bits(chip, | 418 | ret = abx500_gpio_set_bits(chip, |
| 419 | AB8500_GPIO_ALTFUN_REG, | 419 | AB8500_GPIO_ALTFUN_REG, |
| 420 | af.alt_bit1, | 420 | af.alt_bit1, |
| 421 | !!(af.alta_val && BIT(0))); | 421 | !!(af.alta_val & BIT(0))); |
| 422 | if (ret < 0) | 422 | if (ret < 0) |
| 423 | goto out; | 423 | goto out; |
| 424 | 424 | ||
| @@ -439,7 +439,7 @@ static int abx500_set_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip, | |||
| 439 | goto out; | 439 | goto out; |
| 440 | 440 | ||
| 441 | ret = abx500_gpio_set_bits(chip, AB8500_GPIO_ALTFUN_REG, | 441 | ret = abx500_gpio_set_bits(chip, AB8500_GPIO_ALTFUN_REG, |
| 442 | af.alt_bit1, !!(af.altb_val && BIT(0))); | 442 | af.alt_bit1, !!(af.altb_val & BIT(0))); |
| 443 | if (ret < 0) | 443 | if (ret < 0) |
| 444 | goto out; | 444 | goto out; |
| 445 | 445 | ||
| @@ -462,7 +462,7 @@ static int abx500_set_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip, | |||
| 462 | goto out; | 462 | goto out; |
| 463 | 463 | ||
| 464 | ret = abx500_gpio_set_bits(chip, AB8500_GPIO_ALTFUN_REG, | 464 | ret = abx500_gpio_set_bits(chip, AB8500_GPIO_ALTFUN_REG, |
| 465 | af.alt_bit2, !!(af.altc_val && BIT(1))); | 465 | af.alt_bit2, !!(af.altc_val & BIT(1))); |
| 466 | break; | 466 | break; |
| 467 | 467 | ||
| 468 | default: | 468 | default: |
diff --git a/drivers/pinctrl/pinctrl-abx500.h b/drivers/pinctrl/pinctrl-abx500.h index eeca8f973999..82293806e842 100644 --- a/drivers/pinctrl/pinctrl-abx500.h +++ b/drivers/pinctrl/pinctrl-abx500.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | #ifndef PINCTRL_PINCTRL_ABx5O0_H | 1 | #ifndef PINCTRL_PINCTRL_ABx500_H |
| 2 | #define PINCTRL_PINCTRL_ABx500_H | 2 | #define PINCTRL_PINCTRL_ABx500_H |
| 3 | 3 | ||
| 4 | /* Package definitions */ | 4 | /* Package definitions */ |
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index e939c28cbf1f..46dddc159286 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c | |||
| @@ -504,6 +504,7 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank, | |||
| 504 | data |= (3 << bit); | 504 | data |= (3 << bit); |
| 505 | break; | 505 | break; |
| 506 | default: | 506 | default: |
| 507 | spin_unlock_irqrestore(&bank->slock, flags); | ||
| 507 | dev_err(info->dev, "unsupported pull setting %d\n", | 508 | dev_err(info->dev, "unsupported pull setting %d\n", |
| 508 | pull); | 509 | pull); |
| 509 | return -EINVAL; | 510 | return -EINVAL; |
| @@ -1453,8 +1454,8 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev) | |||
| 1453 | if (ctrl->type == RK3188) { | 1454 | if (ctrl->type == RK3188) { |
| 1454 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 1455 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
| 1455 | info->reg_pull = devm_ioremap_resource(&pdev->dev, res); | 1456 | info->reg_pull = devm_ioremap_resource(&pdev->dev, res); |
| 1456 | if (IS_ERR(info->reg_base)) | 1457 | if (IS_ERR(info->reg_pull)) |
| 1457 | return PTR_ERR(info->reg_base); | 1458 | return PTR_ERR(info->reg_pull); |
| 1458 | } | 1459 | } |
| 1459 | 1460 | ||
| 1460 | ret = rockchip_gpiolib_register(pdev, info); | 1461 | ret = rockchip_gpiolib_register(pdev, info); |
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c index 009174d07767..bc5eb453a45c 100644 --- a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c | |||
| @@ -3720,7 +3720,7 @@ static void __iomem *r8a7740_pinmux_portcr(struct sh_pfc *pfc, unsigned int pin) | |||
| 3720 | const struct r8a7740_portcr_group *group = | 3720 | const struct r8a7740_portcr_group *group = |
| 3721 | &r8a7740_portcr_offsets[i]; | 3721 | &r8a7740_portcr_offsets[i]; |
| 3722 | 3722 | ||
| 3723 | if (i <= group->end_pin) | 3723 | if (pin <= group->end_pin) |
| 3724 | return pfc->window->virt + group->offset + pin; | 3724 | return pfc->window->virt + group->offset + pin; |
| 3725 | } | 3725 | } |
| 3726 | 3726 | ||
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7372.c b/drivers/pinctrl/sh-pfc/pfc-sh7372.c index 70b522d34821..cc097b693820 100644 --- a/drivers/pinctrl/sh-pfc/pfc-sh7372.c +++ b/drivers/pinctrl/sh-pfc/pfc-sh7372.c | |||
| @@ -2584,7 +2584,7 @@ static void __iomem *sh7372_pinmux_portcr(struct sh_pfc *pfc, unsigned int pin) | |||
| 2584 | const struct sh7372_portcr_group *group = | 2584 | const struct sh7372_portcr_group *group = |
| 2585 | &sh7372_portcr_offsets[i]; | 2585 | &sh7372_portcr_offsets[i]; |
| 2586 | 2586 | ||
| 2587 | if (i <= group->end_pin) | 2587 | if (pin <= group->end_pin) |
| 2588 | return pfc->window->virt + group->offset + pin; | 2588 | return pfc->window->virt + group->offset + pin; |
| 2589 | } | 2589 | } |
| 2590 | 2590 | ||
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c index 6936e0acedcd..f748cc8cbb03 100644 --- a/drivers/pnp/driver.c +++ b/drivers/pnp/driver.c | |||
| @@ -197,6 +197,11 @@ static int pnp_bus_freeze(struct device *dev) | |||
| 197 | return __pnp_bus_suspend(dev, PMSG_FREEZE); | 197 | return __pnp_bus_suspend(dev, PMSG_FREEZE); |
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | static int pnp_bus_poweroff(struct device *dev) | ||
| 201 | { | ||
| 202 | return __pnp_bus_suspend(dev, PMSG_HIBERNATE); | ||
| 203 | } | ||
| 204 | |||
| 200 | static int pnp_bus_resume(struct device *dev) | 205 | static int pnp_bus_resume(struct device *dev) |
| 201 | { | 206 | { |
| 202 | struct pnp_dev *pnp_dev = to_pnp_dev(dev); | 207 | struct pnp_dev *pnp_dev = to_pnp_dev(dev); |
| @@ -234,9 +239,14 @@ static int pnp_bus_resume(struct device *dev) | |||
| 234 | } | 239 | } |
| 235 | 240 | ||
| 236 | static const struct dev_pm_ops pnp_bus_dev_pm_ops = { | 241 | static const struct dev_pm_ops pnp_bus_dev_pm_ops = { |
| 242 | /* Suspend callbacks */ | ||
| 237 | .suspend = pnp_bus_suspend, | 243 | .suspend = pnp_bus_suspend, |
| 238 | .freeze = pnp_bus_freeze, | ||
| 239 | .resume = pnp_bus_resume, | 244 | .resume = pnp_bus_resume, |
| 245 | /* Hibernate callbacks */ | ||
| 246 | .freeze = pnp_bus_freeze, | ||
| 247 | .thaw = pnp_bus_resume, | ||
| 248 | .poweroff = pnp_bus_poweroff, | ||
| 249 | .restore = pnp_bus_resume, | ||
| 240 | }; | 250 | }; |
| 241 | 251 | ||
| 242 | struct bus_type pnp_bus_type = { | 252 | struct bus_type pnp_bus_type = { |
diff --git a/drivers/powercap/powercap_sys.c b/drivers/powercap/powercap_sys.c index 8d0fe431dbdd..84419af16f77 100644 --- a/drivers/powercap/powercap_sys.c +++ b/drivers/powercap/powercap_sys.c | |||
| @@ -377,9 +377,14 @@ static void create_power_zone_common_attributes( | |||
| 377 | if (power_zone->ops->get_max_energy_range_uj) | 377 | if (power_zone->ops->get_max_energy_range_uj) |
| 378 | power_zone->zone_dev_attrs[count++] = | 378 | power_zone->zone_dev_attrs[count++] = |
| 379 | &dev_attr_max_energy_range_uj.attr; | 379 | &dev_attr_max_energy_range_uj.attr; |
| 380 | if (power_zone->ops->get_energy_uj) | 380 | if (power_zone->ops->get_energy_uj) { |
| 381 | if (power_zone->ops->reset_energy_uj) | ||
| 382 | dev_attr_energy_uj.attr.mode = S_IWUSR | S_IRUGO; | ||
| 383 | else | ||
| 384 | dev_attr_energy_uj.attr.mode = S_IRUGO; | ||
| 381 | power_zone->zone_dev_attrs[count++] = | 385 | power_zone->zone_dev_attrs[count++] = |
| 382 | &dev_attr_energy_uj.attr; | 386 | &dev_attr_energy_uj.attr; |
| 387 | } | ||
| 383 | if (power_zone->ops->get_power_uw) | 388 | if (power_zone->ops->get_power_uw) |
| 384 | power_zone->zone_dev_attrs[count++] = | 389 | power_zone->zone_dev_attrs[count++] = |
| 385 | &dev_attr_power_uw.attr; | 390 | &dev_attr_power_uw.attr; |
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index 5e1e12c0cf42..0a7325361d29 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c | |||
| @@ -2025,7 +2025,8 @@ static struct scsi_host_template driver_template = { | |||
| 2025 | .cmd_per_lun = TW_MAX_CMDS_PER_LUN, | 2025 | .cmd_per_lun = TW_MAX_CMDS_PER_LUN, |
| 2026 | .use_clustering = ENABLE_CLUSTERING, | 2026 | .use_clustering = ENABLE_CLUSTERING, |
| 2027 | .shost_attrs = twa_host_attrs, | 2027 | .shost_attrs = twa_host_attrs, |
| 2028 | .emulated = 1 | 2028 | .emulated = 1, |
| 2029 | .no_write_same = 1, | ||
| 2029 | }; | 2030 | }; |
| 2030 | 2031 | ||
| 2031 | /* This function will probe and initialize a card */ | 2032 | /* This function will probe and initialize a card */ |
diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c index c845bdbeb6c0..4de346017e9f 100644 --- a/drivers/scsi/3w-sas.c +++ b/drivers/scsi/3w-sas.c | |||
| @@ -1600,7 +1600,8 @@ static struct scsi_host_template driver_template = { | |||
| 1600 | .cmd_per_lun = TW_MAX_CMDS_PER_LUN, | 1600 | .cmd_per_lun = TW_MAX_CMDS_PER_LUN, |
| 1601 | .use_clustering = ENABLE_CLUSTERING, | 1601 | .use_clustering = ENABLE_CLUSTERING, |
| 1602 | .shost_attrs = twl_host_attrs, | 1602 | .shost_attrs = twl_host_attrs, |
| 1603 | .emulated = 1 | 1603 | .emulated = 1, |
| 1604 | .no_write_same = 1, | ||
| 1604 | }; | 1605 | }; |
| 1605 | 1606 | ||
| 1606 | /* This function will probe and initialize a card */ | 1607 | /* This function will probe and initialize a card */ |
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c index b9276d10b25c..752624e6bc00 100644 --- a/drivers/scsi/3w-xxxx.c +++ b/drivers/scsi/3w-xxxx.c | |||
| @@ -2279,7 +2279,8 @@ static struct scsi_host_template driver_template = { | |||
| 2279 | .cmd_per_lun = TW_MAX_CMDS_PER_LUN, | 2279 | .cmd_per_lun = TW_MAX_CMDS_PER_LUN, |
| 2280 | .use_clustering = ENABLE_CLUSTERING, | 2280 | .use_clustering = ENABLE_CLUSTERING, |
| 2281 | .shost_attrs = tw_host_attrs, | 2281 | .shost_attrs = tw_host_attrs, |
| 2282 | .emulated = 1 | 2282 | .emulated = 1, |
| 2283 | .no_write_same = 1, | ||
| 2283 | }; | 2284 | }; |
| 2284 | 2285 | ||
| 2285 | /* This function will probe and initialize a card */ | 2286 | /* This function will probe and initialize a card */ |
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index f0d432c139d0..4921ed19a027 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c | |||
| @@ -1081,6 +1081,7 @@ static struct scsi_host_template aac_driver_template = { | |||
| 1081 | #endif | 1081 | #endif |
| 1082 | .use_clustering = ENABLE_CLUSTERING, | 1082 | .use_clustering = ENABLE_CLUSTERING, |
| 1083 | .emulated = 1, | 1083 | .emulated = 1, |
| 1084 | .no_write_same = 1, | ||
| 1084 | }; | 1085 | }; |
| 1085 | 1086 | ||
| 1086 | static void __aac_shutdown(struct aac_dev * aac) | 1087 | static void __aac_shutdown(struct aac_dev * aac) |
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c index 97fd450aff09..4f6a30b8e5f9 100644 --- a/drivers/scsi/arcmsr/arcmsr_hba.c +++ b/drivers/scsi/arcmsr/arcmsr_hba.c | |||
| @@ -137,6 +137,7 @@ static struct scsi_host_template arcmsr_scsi_host_template = { | |||
| 137 | .cmd_per_lun = ARCMSR_MAX_CMD_PERLUN, | 137 | .cmd_per_lun = ARCMSR_MAX_CMD_PERLUN, |
| 138 | .use_clustering = ENABLE_CLUSTERING, | 138 | .use_clustering = ENABLE_CLUSTERING, |
| 139 | .shost_attrs = arcmsr_host_attrs, | 139 | .shost_attrs = arcmsr_host_attrs, |
| 140 | .no_write_same = 1, | ||
| 140 | }; | 141 | }; |
| 141 | static struct pci_device_id arcmsr_device_id_table[] = { | 142 | static struct pci_device_id arcmsr_device_id_table[] = { |
| 142 | {PCI_DEVICE(PCI_VENDOR_ID_ARECA, PCI_DEVICE_ID_ARECA_1110)}, | 143 | {PCI_DEVICE(PCI_VENDOR_ID_ARECA, PCI_DEVICE_ID_ARECA_1110)}, |
diff --git a/drivers/scsi/bfa/bfa_fcs.h b/drivers/scsi/bfa/bfa_fcs.h index 94d5d0102f7d..42bcb970445a 100644 --- a/drivers/scsi/bfa/bfa_fcs.h +++ b/drivers/scsi/bfa/bfa_fcs.h | |||
| @@ -296,6 +296,7 @@ wwn_t bfa_fcs_lport_get_rport(struct bfa_fcs_lport_s *port, wwn_t wwn, | |||
| 296 | struct bfa_fcs_lport_s *bfa_fcs_lookup_port(struct bfa_fcs_s *fcs, | 296 | struct bfa_fcs_lport_s *bfa_fcs_lookup_port(struct bfa_fcs_s *fcs, |
| 297 | u16 vf_id, wwn_t lpwwn); | 297 | u16 vf_id, wwn_t lpwwn); |
| 298 | 298 | ||
| 299 | void bfa_fcs_lport_set_symname(struct bfa_fcs_lport_s *port, char *symname); | ||
| 299 | void bfa_fcs_lport_get_info(struct bfa_fcs_lport_s *port, | 300 | void bfa_fcs_lport_get_info(struct bfa_fcs_lport_s *port, |
| 300 | struct bfa_lport_info_s *port_info); | 301 | struct bfa_lport_info_s *port_info); |
| 301 | void bfa_fcs_lport_get_attr(struct bfa_fcs_lport_s *port, | 302 | void bfa_fcs_lport_get_attr(struct bfa_fcs_lport_s *port, |
diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c index 2f61a5af3658..f5e4e61a0fd7 100644 --- a/drivers/scsi/bfa/bfa_fcs_lport.c +++ b/drivers/scsi/bfa/bfa_fcs_lport.c | |||
| @@ -1097,6 +1097,17 @@ bfa_fcs_lport_init(struct bfa_fcs_lport_s *lport, | |||
| 1097 | bfa_sm_send_event(lport, BFA_FCS_PORT_SM_CREATE); | 1097 | bfa_sm_send_event(lport, BFA_FCS_PORT_SM_CREATE); |
| 1098 | } | 1098 | } |
| 1099 | 1099 | ||
| 1100 | void | ||
| 1101 | bfa_fcs_lport_set_symname(struct bfa_fcs_lport_s *port, | ||
| 1102 | char *symname) | ||
| 1103 | { | ||
| 1104 | strcpy(port->port_cfg.sym_name.symname, symname); | ||
| 1105 | |||
| 1106 | if (bfa_sm_cmp_state(port, bfa_fcs_lport_sm_online)) | ||
| 1107 | bfa_fcs_lport_ns_util_send_rspn_id( | ||
| 1108 | BFA_FCS_GET_NS_FROM_PORT(port), NULL); | ||
| 1109 | } | ||
| 1110 | |||
| 1100 | /* | 1111 | /* |
| 1101 | * fcs_lport_api | 1112 | * fcs_lport_api |
| 1102 | */ | 1113 | */ |
| @@ -5140,9 +5151,6 @@ bfa_fcs_lport_ns_util_send_rspn_id(void *cbarg, struct bfa_fcxp_s *fcxp_alloced) | |||
| 5140 | u8 *psymbl = &symbl[0]; | 5151 | u8 *psymbl = &symbl[0]; |
| 5141 | int len; | 5152 | int len; |
| 5142 | 5153 | ||
| 5143 | if (!bfa_sm_cmp_state(port, bfa_fcs_lport_sm_online)) | ||
| 5144 | return; | ||
| 5145 | |||
| 5146 | /* Avoid sending RSPN in the following states. */ | 5154 | /* Avoid sending RSPN in the following states. */ |
| 5147 | if (bfa_sm_cmp_state(ns, bfa_fcs_lport_ns_sm_offline) || | 5155 | if (bfa_sm_cmp_state(ns, bfa_fcs_lport_ns_sm_offline) || |
| 5148 | bfa_sm_cmp_state(ns, bfa_fcs_lport_ns_sm_plogi_sending) || | 5156 | bfa_sm_cmp_state(ns, bfa_fcs_lport_ns_sm_plogi_sending) || |
diff --git a/drivers/scsi/bfa/bfad_attr.c b/drivers/scsi/bfa/bfad_attr.c index e9a681d31223..40be670a1cbc 100644 --- a/drivers/scsi/bfa/bfad_attr.c +++ b/drivers/scsi/bfa/bfad_attr.c | |||
| @@ -593,11 +593,8 @@ bfad_im_vport_set_symbolic_name(struct fc_vport *fc_vport) | |||
| 593 | return; | 593 | return; |
| 594 | 594 | ||
| 595 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 595 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
| 596 | if (strlen(sym_name) > 0) { | 596 | if (strlen(sym_name) > 0) |
| 597 | strcpy(fcs_vport->lport.port_cfg.sym_name.symname, sym_name); | 597 | bfa_fcs_lport_set_symname(&fcs_vport->lport, sym_name); |
| 598 | bfa_fcs_lport_ns_util_send_rspn_id( | ||
| 599 | BFA_FCS_GET_NS_FROM_PORT((&fcs_vport->lport)), NULL); | ||
| 600 | } | ||
| 601 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 598 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
| 602 | } | 599 | } |
| 603 | 600 | ||
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index ee4fa40a50b1..ce5ef0190bad 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c | |||
| @@ -4684,6 +4684,7 @@ static struct scsi_host_template gdth_template = { | |||
| 4684 | .cmd_per_lun = GDTH_MAXC_P_L, | 4684 | .cmd_per_lun = GDTH_MAXC_P_L, |
| 4685 | .unchecked_isa_dma = 1, | 4685 | .unchecked_isa_dma = 1, |
| 4686 | .use_clustering = ENABLE_CLUSTERING, | 4686 | .use_clustering = ENABLE_CLUSTERING, |
| 4687 | .no_write_same = 1, | ||
| 4687 | }; | 4688 | }; |
| 4688 | 4689 | ||
| 4689 | #ifdef CONFIG_ISA | 4690 | #ifdef CONFIG_ISA |
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index f334859024c0..f2c5005f312a 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c | |||
| @@ -395,6 +395,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) | |||
| 395 | shost->use_clustering = sht->use_clustering; | 395 | shost->use_clustering = sht->use_clustering; |
| 396 | shost->ordered_tag = sht->ordered_tag; | 396 | shost->ordered_tag = sht->ordered_tag; |
| 397 | shost->eh_deadline = shost_eh_deadline * HZ; | 397 | shost->eh_deadline = shost_eh_deadline * HZ; |
| 398 | shost->no_write_same = sht->no_write_same; | ||
| 398 | 399 | ||
| 399 | if (sht->supported_mode == MODE_UNKNOWN) | 400 | if (sht->supported_mode == MODE_UNKNOWN) |
| 400 | /* means we didn't set it ... default to INITIATOR */ | 401 | /* means we didn't set it ... default to INITIATOR */ |
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 22f6432eb475..20a5e6ecf945 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c | |||
| @@ -561,6 +561,7 @@ static struct scsi_host_template hpsa_driver_template = { | |||
| 561 | .sdev_attrs = hpsa_sdev_attrs, | 561 | .sdev_attrs = hpsa_sdev_attrs, |
| 562 | .shost_attrs = hpsa_shost_attrs, | 562 | .shost_attrs = hpsa_shost_attrs, |
| 563 | .max_sectors = 8192, | 563 | .max_sectors = 8192, |
| 564 | .no_write_same = 1, | ||
| 564 | }; | 565 | }; |
| 565 | 566 | ||
| 566 | 567 | ||
| @@ -1288,7 +1289,7 @@ static void complete_scsi_command(struct CommandList *cp) | |||
| 1288 | "has check condition: aborted command: " | 1289 | "has check condition: aborted command: " |
| 1289 | "ASC: 0x%x, ASCQ: 0x%x\n", | 1290 | "ASC: 0x%x, ASCQ: 0x%x\n", |
| 1290 | cp, asc, ascq); | 1291 | cp, asc, ascq); |
| 1291 | cmd->result = DID_SOFT_ERROR << 16; | 1292 | cmd->result |= DID_SOFT_ERROR << 16; |
| 1292 | break; | 1293 | break; |
| 1293 | } | 1294 | } |
| 1294 | /* Must be some other type of check condition */ | 1295 | /* Must be some other type of check condition */ |
| @@ -4925,7 +4926,7 @@ reinit_after_soft_reset: | |||
| 4925 | hpsa_hba_inquiry(h); | 4926 | hpsa_hba_inquiry(h); |
| 4926 | hpsa_register_scsi(h); /* hook ourselves into SCSI subsystem */ | 4927 | hpsa_register_scsi(h); /* hook ourselves into SCSI subsystem */ |
| 4927 | start_controller_lockup_detector(h); | 4928 | start_controller_lockup_detector(h); |
| 4928 | return 1; | 4929 | return 0; |
| 4929 | 4930 | ||
| 4930 | clean4: | 4931 | clean4: |
| 4931 | hpsa_free_sg_chain_blocks(h); | 4932 | hpsa_free_sg_chain_blocks(h); |
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 36ac1c34ce97..573f4128b6b6 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
| @@ -6305,7 +6305,8 @@ static struct scsi_host_template driver_template = { | |||
| 6305 | .use_clustering = ENABLE_CLUSTERING, | 6305 | .use_clustering = ENABLE_CLUSTERING, |
| 6306 | .shost_attrs = ipr_ioa_attrs, | 6306 | .shost_attrs = ipr_ioa_attrs, |
| 6307 | .sdev_attrs = ipr_dev_attrs, | 6307 | .sdev_attrs = ipr_dev_attrs, |
| 6308 | .proc_name = IPR_NAME | 6308 | .proc_name = IPR_NAME, |
| 6309 | .no_write_same = 1, | ||
| 6309 | }; | 6310 | }; |
| 6310 | 6311 | ||
| 6311 | /** | 6312 | /** |
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c index 8d5ea8a1e5a6..52a216f21ae5 100644 --- a/drivers/scsi/ips.c +++ b/drivers/scsi/ips.c | |||
| @@ -374,6 +374,7 @@ static struct scsi_host_template ips_driver_template = { | |||
| 374 | .sg_tablesize = IPS_MAX_SG, | 374 | .sg_tablesize = IPS_MAX_SG, |
| 375 | .cmd_per_lun = 3, | 375 | .cmd_per_lun = 3, |
| 376 | .use_clustering = ENABLE_CLUSTERING, | 376 | .use_clustering = ENABLE_CLUSTERING, |
| 377 | .no_write_same = 1, | ||
| 377 | }; | 378 | }; |
| 378 | 379 | ||
| 379 | 380 | ||
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index 161c98efade9..d2895836f9fa 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c | |||
| @@ -211,7 +211,7 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc) | |||
| 211 | qc->tf.nsect = 0; | 211 | qc->tf.nsect = 0; |
| 212 | } | 212 | } |
| 213 | 213 | ||
| 214 | ata_tf_to_fis(&qc->tf, 1, 0, (u8*)&task->ata_task.fis); | 214 | ata_tf_to_fis(&qc->tf, qc->dev->link->pmp, 1, (u8 *)&task->ata_task.fis); |
| 215 | task->uldd_task = qc; | 215 | task->uldd_task = qc; |
| 216 | if (ata_is_atapi(qc->tf.protocol)) { | 216 | if (ata_is_atapi(qc->tf.protocol)) { |
| 217 | memcpy(task->ata_task.atapi_packet, qc->cdb, qc->dev->cdb_len); | 217 | memcpy(task->ata_task.atapi_packet, qc->cdb, qc->dev->cdb_len); |
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index 90c95a3385d1..816db12ef5d5 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c | |||
| @@ -4244,6 +4244,7 @@ static struct scsi_host_template megaraid_template = { | |||
| 4244 | .eh_device_reset_handler = megaraid_reset, | 4244 | .eh_device_reset_handler = megaraid_reset, |
| 4245 | .eh_bus_reset_handler = megaraid_reset, | 4245 | .eh_bus_reset_handler = megaraid_reset, |
| 4246 | .eh_host_reset_handler = megaraid_reset, | 4246 | .eh_host_reset_handler = megaraid_reset, |
| 4247 | .no_write_same = 1, | ||
| 4247 | }; | 4248 | }; |
| 4248 | 4249 | ||
| 4249 | static int | 4250 | static int |
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c index d1a4b82836ea..e2237a97cb9d 100644 --- a/drivers/scsi/megaraid/megaraid_mbox.c +++ b/drivers/scsi/megaraid/megaraid_mbox.c | |||
| @@ -367,6 +367,7 @@ static struct scsi_host_template megaraid_template_g = { | |||
| 367 | .eh_host_reset_handler = megaraid_reset_handler, | 367 | .eh_host_reset_handler = megaraid_reset_handler, |
| 368 | .change_queue_depth = megaraid_change_queue_depth, | 368 | .change_queue_depth = megaraid_change_queue_depth, |
| 369 | .use_clustering = ENABLE_CLUSTERING, | 369 | .use_clustering = ENABLE_CLUSTERING, |
| 370 | .no_write_same = 1, | ||
| 370 | .sdev_attrs = megaraid_sdev_attrs, | 371 | .sdev_attrs = megaraid_sdev_attrs, |
| 371 | .shost_attrs = megaraid_shost_attrs, | 372 | .shost_attrs = megaraid_shost_attrs, |
| 372 | }; | 373 | }; |
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 0a743a5d1647..c99812bf2a73 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c | |||
| @@ -2148,6 +2148,7 @@ static struct scsi_host_template megasas_template = { | |||
| 2148 | .bios_param = megasas_bios_param, | 2148 | .bios_param = megasas_bios_param, |
| 2149 | .use_clustering = ENABLE_CLUSTERING, | 2149 | .use_clustering = ENABLE_CLUSTERING, |
| 2150 | .change_queue_depth = megasas_change_queue_depth, | 2150 | .change_queue_depth = megasas_change_queue_depth, |
| 2151 | .no_write_same = 1, | ||
| 2151 | }; | 2152 | }; |
| 2152 | 2153 | ||
| 2153 | /** | 2154 | /** |
diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c index f16ece91b94a..0a1296a87d66 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.c +++ b/drivers/scsi/pm8001/pm8001_hwi.c | |||
| @@ -3403,6 +3403,7 @@ hw_event_sas_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
| 3403 | unsigned long flags; | 3403 | unsigned long flags; |
| 3404 | u8 deviceType = pPayload->sas_identify.dev_type; | 3404 | u8 deviceType = pPayload->sas_identify.dev_type; |
| 3405 | port->port_state = portstate; | 3405 | port->port_state = portstate; |
| 3406 | phy->phy_state = PHY_STATE_LINK_UP_SPC; | ||
| 3406 | PM8001_MSG_DBG(pm8001_ha, | 3407 | PM8001_MSG_DBG(pm8001_ha, |
| 3407 | pm8001_printk("HW_EVENT_SAS_PHY_UP port id = %d, phy id = %d\n", | 3408 | pm8001_printk("HW_EVENT_SAS_PHY_UP port id = %d, phy id = %d\n", |
| 3408 | port_id, phy_id)); | 3409 | port_id, phy_id)); |
| @@ -3483,6 +3484,7 @@ hw_event_sata_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
| 3483 | pm8001_printk("HW_EVENT_SATA_PHY_UP port id = %d," | 3484 | pm8001_printk("HW_EVENT_SATA_PHY_UP port id = %d," |
| 3484 | " phy id = %d\n", port_id, phy_id)); | 3485 | " phy id = %d\n", port_id, phy_id)); |
| 3485 | port->port_state = portstate; | 3486 | port->port_state = portstate; |
| 3487 | phy->phy_state = PHY_STATE_LINK_UP_SPC; | ||
| 3486 | port->port_attached = 1; | 3488 | port->port_attached = 1; |
| 3487 | pm8001_get_lrate_mode(phy, link_rate); | 3489 | pm8001_get_lrate_mode(phy, link_rate); |
| 3488 | phy->phy_type |= PORT_TYPE_SATA; | 3490 | phy->phy_type |= PORT_TYPE_SATA; |
diff --git a/drivers/scsi/pm8001/pm8001_hwi.h b/drivers/scsi/pm8001/pm8001_hwi.h index 6d91e2446542..e4867e690c84 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.h +++ b/drivers/scsi/pm8001/pm8001_hwi.h | |||
| @@ -131,6 +131,10 @@ | |||
| 131 | #define LINKRATE_30 (0x02 << 8) | 131 | #define LINKRATE_30 (0x02 << 8) |
| 132 | #define LINKRATE_60 (0x04 << 8) | 132 | #define LINKRATE_60 (0x04 << 8) |
| 133 | 133 | ||
| 134 | /* for phy state */ | ||
| 135 | |||
| 136 | #define PHY_STATE_LINK_UP_SPC 0x1 | ||
| 137 | |||
| 134 | /* for new SPC controllers MEMBASE III is shared between BIOS and DATA */ | 138 | /* for new SPC controllers MEMBASE III is shared between BIOS and DATA */ |
| 135 | #define GSM_SM_BASE 0x4F0000 | 139 | #define GSM_SM_BASE 0x4F0000 |
| 136 | struct mpi_msg_hdr{ | 140 | struct mpi_msg_hdr{ |
diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c index 34f5f5ffef05..73a120d81b4d 100644 --- a/drivers/scsi/pm8001/pm8001_init.c +++ b/drivers/scsi/pm8001/pm8001_init.c | |||
| @@ -175,20 +175,16 @@ static void pm8001_free(struct pm8001_hba_info *pm8001_ha) | |||
| 175 | static void pm8001_tasklet(unsigned long opaque) | 175 | static void pm8001_tasklet(unsigned long opaque) |
| 176 | { | 176 | { |
| 177 | struct pm8001_hba_info *pm8001_ha; | 177 | struct pm8001_hba_info *pm8001_ha; |
| 178 | u32 vec; | 178 | struct isr_param *irq_vector; |
| 179 | pm8001_ha = (struct pm8001_hba_info *)opaque; | 179 | |
| 180 | irq_vector = (struct isr_param *)opaque; | ||
| 181 | pm8001_ha = irq_vector->drv_inst; | ||
| 180 | if (unlikely(!pm8001_ha)) | 182 | if (unlikely(!pm8001_ha)) |
| 181 | BUG_ON(1); | 183 | BUG_ON(1); |
| 182 | vec = pm8001_ha->int_vector; | 184 | PM8001_CHIP_DISP->isr(pm8001_ha, irq_vector->irq_id); |
| 183 | PM8001_CHIP_DISP->isr(pm8001_ha, vec); | ||
| 184 | } | 185 | } |
| 185 | #endif | 186 | #endif |
| 186 | 187 | ||
| 187 | static struct pm8001_hba_info *outq_to_hba(u8 *outq) | ||
| 188 | { | ||
| 189 | return container_of((outq - *outq), struct pm8001_hba_info, outq[0]); | ||
| 190 | } | ||
| 191 | |||
| 192 | /** | 188 | /** |
| 193 | * pm8001_interrupt_handler_msix - main MSIX interrupt handler. | 189 | * pm8001_interrupt_handler_msix - main MSIX interrupt handler. |
| 194 | * It obtains the vector number and calls the equivalent bottom | 190 | * It obtains the vector number and calls the equivalent bottom |
| @@ -198,18 +194,20 @@ static struct pm8001_hba_info *outq_to_hba(u8 *outq) | |||
| 198 | */ | 194 | */ |
| 199 | static irqreturn_t pm8001_interrupt_handler_msix(int irq, void *opaque) | 195 | static irqreturn_t pm8001_interrupt_handler_msix(int irq, void *opaque) |
| 200 | { | 196 | { |
| 201 | struct pm8001_hba_info *pm8001_ha = outq_to_hba(opaque); | 197 | struct isr_param *irq_vector; |
| 202 | u8 outq = *(u8 *)opaque; | 198 | struct pm8001_hba_info *pm8001_ha; |
| 203 | irqreturn_t ret = IRQ_HANDLED; | 199 | irqreturn_t ret = IRQ_HANDLED; |
| 200 | irq_vector = (struct isr_param *)opaque; | ||
| 201 | pm8001_ha = irq_vector->drv_inst; | ||
| 202 | |||
| 204 | if (unlikely(!pm8001_ha)) | 203 | if (unlikely(!pm8001_ha)) |
| 205 | return IRQ_NONE; | 204 | return IRQ_NONE; |
| 206 | if (!PM8001_CHIP_DISP->is_our_interupt(pm8001_ha)) | 205 | if (!PM8001_CHIP_DISP->is_our_interupt(pm8001_ha)) |
| 207 | return IRQ_NONE; | 206 | return IRQ_NONE; |
| 208 | pm8001_ha->int_vector = outq; | ||
| 209 | #ifdef PM8001_USE_TASKLET | 207 | #ifdef PM8001_USE_TASKLET |
| 210 | tasklet_schedule(&pm8001_ha->tasklet); | 208 | tasklet_schedule(&pm8001_ha->tasklet[irq_vector->irq_id]); |
| 211 | #else | 209 | #else |
| 212 | ret = PM8001_CHIP_DISP->isr(pm8001_ha, outq); | 210 | ret = PM8001_CHIP_DISP->isr(pm8001_ha, irq_vector->irq_id); |
| 213 | #endif | 211 | #endif |
| 214 | return ret; | 212 | return ret; |
| 215 | } | 213 | } |
| @@ -230,9 +228,8 @@ static irqreturn_t pm8001_interrupt_handler_intx(int irq, void *dev_id) | |||
| 230 | if (!PM8001_CHIP_DISP->is_our_interupt(pm8001_ha)) | 228 | if (!PM8001_CHIP_DISP->is_our_interupt(pm8001_ha)) |
| 231 | return IRQ_NONE; | 229 | return IRQ_NONE; |
| 232 | 230 | ||
| 233 | pm8001_ha->int_vector = 0; | ||
| 234 | #ifdef PM8001_USE_TASKLET | 231 | #ifdef PM8001_USE_TASKLET |
| 235 | tasklet_schedule(&pm8001_ha->tasklet); | 232 | tasklet_schedule(&pm8001_ha->tasklet[0]); |
| 236 | #else | 233 | #else |
| 237 | ret = PM8001_CHIP_DISP->isr(pm8001_ha, 0); | 234 | ret = PM8001_CHIP_DISP->isr(pm8001_ha, 0); |
| 238 | #endif | 235 | #endif |
| @@ -457,7 +454,7 @@ static struct pm8001_hba_info *pm8001_pci_alloc(struct pci_dev *pdev, | |||
| 457 | { | 454 | { |
| 458 | struct pm8001_hba_info *pm8001_ha; | 455 | struct pm8001_hba_info *pm8001_ha; |
| 459 | struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); | 456 | struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); |
| 460 | 457 | int j; | |
| 461 | 458 | ||
| 462 | pm8001_ha = sha->lldd_ha; | 459 | pm8001_ha = sha->lldd_ha; |
| 463 | if (!pm8001_ha) | 460 | if (!pm8001_ha) |
| @@ -480,12 +477,14 @@ static struct pm8001_hba_info *pm8001_pci_alloc(struct pci_dev *pdev, | |||
| 480 | pm8001_ha->iomb_size = IOMB_SIZE_SPC; | 477 | pm8001_ha->iomb_size = IOMB_SIZE_SPC; |
| 481 | 478 | ||
| 482 | #ifdef PM8001_USE_TASKLET | 479 | #ifdef PM8001_USE_TASKLET |
| 483 | /** | 480 | /* Tasklet for non msi-x interrupt handler */ |
| 484 | * default tasklet for non msi-x interrupt handler/first msi-x | 481 | if ((!pdev->msix_cap) || (pm8001_ha->chip_id == chip_8001)) |
| 485 | * interrupt handler | 482 | tasklet_init(&pm8001_ha->tasklet[0], pm8001_tasklet, |
| 486 | **/ | 483 | (unsigned long)&(pm8001_ha->irq_vector[0])); |
| 487 | tasklet_init(&pm8001_ha->tasklet, pm8001_tasklet, | 484 | else |
| 488 | (unsigned long)pm8001_ha); | 485 | for (j = 0; j < PM8001_MAX_MSIX_VEC; j++) |
| 486 | tasklet_init(&pm8001_ha->tasklet[j], pm8001_tasklet, | ||
| 487 | (unsigned long)&(pm8001_ha->irq_vector[j])); | ||
| 489 | #endif | 488 | #endif |
| 490 | pm8001_ioremap(pm8001_ha); | 489 | pm8001_ioremap(pm8001_ha); |
| 491 | if (!pm8001_alloc(pm8001_ha, ent)) | 490 | if (!pm8001_alloc(pm8001_ha, ent)) |
| @@ -733,19 +732,20 @@ static u32 pm8001_setup_msix(struct pm8001_hba_info *pm8001_ha) | |||
| 733 | "pci_enable_msix request ret:%d no of intr %d\n", | 732 | "pci_enable_msix request ret:%d no of intr %d\n", |
| 734 | rc, pm8001_ha->number_of_intr)); | 733 | rc, pm8001_ha->number_of_intr)); |
| 735 | 734 | ||
| 736 | for (i = 0; i < number_of_intr; i++) | ||
| 737 | pm8001_ha->outq[i] = i; | ||
| 738 | 735 | ||
| 739 | for (i = 0; i < number_of_intr; i++) { | 736 | for (i = 0; i < number_of_intr; i++) { |
| 740 | snprintf(intr_drvname[i], sizeof(intr_drvname[0]), | 737 | snprintf(intr_drvname[i], sizeof(intr_drvname[0]), |
| 741 | DRV_NAME"%d", i); | 738 | DRV_NAME"%d", i); |
| 739 | pm8001_ha->irq_vector[i].irq_id = i; | ||
| 740 | pm8001_ha->irq_vector[i].drv_inst = pm8001_ha; | ||
| 741 | |||
| 742 | if (request_irq(pm8001_ha->msix_entries[i].vector, | 742 | if (request_irq(pm8001_ha->msix_entries[i].vector, |
| 743 | pm8001_interrupt_handler_msix, flag, | 743 | pm8001_interrupt_handler_msix, flag, |
| 744 | intr_drvname[i], &pm8001_ha->outq[i])) { | 744 | intr_drvname[i], &(pm8001_ha->irq_vector[i]))) { |
| 745 | for (j = 0; j < i; j++) | 745 | for (j = 0; j < i; j++) |
| 746 | free_irq( | 746 | free_irq( |
| 747 | pm8001_ha->msix_entries[j].vector, | 747 | pm8001_ha->msix_entries[j].vector, |
| 748 | &pm8001_ha->outq[j]); | 748 | &(pm8001_ha->irq_vector[i])); |
| 749 | pci_disable_msix(pm8001_ha->pdev); | 749 | pci_disable_msix(pm8001_ha->pdev); |
| 750 | break; | 750 | break; |
| 751 | } | 751 | } |
| @@ -907,7 +907,7 @@ static void pm8001_pci_remove(struct pci_dev *pdev) | |||
| 907 | { | 907 | { |
| 908 | struct sas_ha_struct *sha = pci_get_drvdata(pdev); | 908 | struct sas_ha_struct *sha = pci_get_drvdata(pdev); |
| 909 | struct pm8001_hba_info *pm8001_ha; | 909 | struct pm8001_hba_info *pm8001_ha; |
| 910 | int i; | 910 | int i, j; |
| 911 | pm8001_ha = sha->lldd_ha; | 911 | pm8001_ha = sha->lldd_ha; |
| 912 | sas_unregister_ha(sha); | 912 | sas_unregister_ha(sha); |
| 913 | sas_remove_host(pm8001_ha->shost); | 913 | sas_remove_host(pm8001_ha->shost); |
| @@ -921,13 +921,18 @@ static void pm8001_pci_remove(struct pci_dev *pdev) | |||
| 921 | synchronize_irq(pm8001_ha->msix_entries[i].vector); | 921 | synchronize_irq(pm8001_ha->msix_entries[i].vector); |
| 922 | for (i = 0; i < pm8001_ha->number_of_intr; i++) | 922 | for (i = 0; i < pm8001_ha->number_of_intr; i++) |
| 923 | free_irq(pm8001_ha->msix_entries[i].vector, | 923 | free_irq(pm8001_ha->msix_entries[i].vector, |
| 924 | &pm8001_ha->outq[i]); | 924 | &(pm8001_ha->irq_vector[i])); |
| 925 | pci_disable_msix(pdev); | 925 | pci_disable_msix(pdev); |
| 926 | #else | 926 | #else |
| 927 | free_irq(pm8001_ha->irq, sha); | 927 | free_irq(pm8001_ha->irq, sha); |
| 928 | #endif | 928 | #endif |
| 929 | #ifdef PM8001_USE_TASKLET | 929 | #ifdef PM8001_USE_TASKLET |
| 930 | tasklet_kill(&pm8001_ha->tasklet); | 930 | /* For non-msix and msix interrupts */ |
| 931 | if ((!pdev->msix_cap) || (pm8001_ha->chip_id == chip_8001)) | ||
| 932 | tasklet_kill(&pm8001_ha->tasklet[0]); | ||
| 933 | else | ||
| 934 | for (j = 0; j < PM8001_MAX_MSIX_VEC; j++) | ||
| 935 | tasklet_kill(&pm8001_ha->tasklet[j]); | ||
| 931 | #endif | 936 | #endif |
| 932 | pm8001_free(pm8001_ha); | 937 | pm8001_free(pm8001_ha); |
| 933 | kfree(sha->sas_phy); | 938 | kfree(sha->sas_phy); |
| @@ -948,7 +953,7 @@ static int pm8001_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
| 948 | { | 953 | { |
| 949 | struct sas_ha_struct *sha = pci_get_drvdata(pdev); | 954 | struct sas_ha_struct *sha = pci_get_drvdata(pdev); |
| 950 | struct pm8001_hba_info *pm8001_ha; | 955 | struct pm8001_hba_info *pm8001_ha; |
| 951 | int i; | 956 | int i, j; |
| 952 | u32 device_state; | 957 | u32 device_state; |
| 953 | pm8001_ha = sha->lldd_ha; | 958 | pm8001_ha = sha->lldd_ha; |
| 954 | flush_workqueue(pm8001_wq); | 959 | flush_workqueue(pm8001_wq); |
| @@ -964,13 +969,18 @@ static int pm8001_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
| 964 | synchronize_irq(pm8001_ha->msix_entries[i].vector); | 969 | synchronize_irq(pm8001_ha->msix_entries[i].vector); |
| 965 | for (i = 0; i < pm8001_ha->number_of_intr; i++) | 970 | for (i = 0; i < pm8001_ha->number_of_intr; i++) |
| 966 | free_irq(pm8001_ha->msix_entries[i].vector, | 971 | free_irq(pm8001_ha->msix_entries[i].vector, |
| 967 | &pm8001_ha->outq[i]); | 972 | &(pm8001_ha->irq_vector[i])); |
| 968 | pci_disable_msix(pdev); | 973 | pci_disable_msix(pdev); |
| 969 | #else | 974 | #else |
| 970 | free_irq(pm8001_ha->irq, sha); | 975 | free_irq(pm8001_ha->irq, sha); |
| 971 | #endif | 976 | #endif |
| 972 | #ifdef PM8001_USE_TASKLET | 977 | #ifdef PM8001_USE_TASKLET |
| 973 | tasklet_kill(&pm8001_ha->tasklet); | 978 | /* For non-msix and msix interrupts */ |
| 979 | if ((!pdev->msix_cap) || (pm8001_ha->chip_id == chip_8001)) | ||
| 980 | tasklet_kill(&pm8001_ha->tasklet[0]); | ||
| 981 | else | ||
| 982 | for (j = 0; j < PM8001_MAX_MSIX_VEC; j++) | ||
| 983 | tasklet_kill(&pm8001_ha->tasklet[j]); | ||
| 974 | #endif | 984 | #endif |
| 975 | device_state = pci_choose_state(pdev, state); | 985 | device_state = pci_choose_state(pdev, state); |
| 976 | pm8001_printk("pdev=0x%p, slot=%s, entering " | 986 | pm8001_printk("pdev=0x%p, slot=%s, entering " |
| @@ -993,7 +1003,7 @@ static int pm8001_pci_resume(struct pci_dev *pdev) | |||
| 993 | struct sas_ha_struct *sha = pci_get_drvdata(pdev); | 1003 | struct sas_ha_struct *sha = pci_get_drvdata(pdev); |
| 994 | struct pm8001_hba_info *pm8001_ha; | 1004 | struct pm8001_hba_info *pm8001_ha; |
| 995 | int rc; | 1005 | int rc; |
| 996 | u8 i = 0; | 1006 | u8 i = 0, j; |
| 997 | u32 device_state; | 1007 | u32 device_state; |
| 998 | pm8001_ha = sha->lldd_ha; | 1008 | pm8001_ha = sha->lldd_ha; |
| 999 | device_state = pdev->current_state; | 1009 | device_state = pdev->current_state; |
| @@ -1033,10 +1043,14 @@ static int pm8001_pci_resume(struct pci_dev *pdev) | |||
| 1033 | if (rc) | 1043 | if (rc) |
| 1034 | goto err_out_disable; | 1044 | goto err_out_disable; |
| 1035 | #ifdef PM8001_USE_TASKLET | 1045 | #ifdef PM8001_USE_TASKLET |
| 1036 | /* default tasklet for non msi-x interrupt handler/first msi-x | 1046 | /* Tasklet for non msi-x interrupt handler */ |
| 1037 | * interrupt handler */ | 1047 | if ((!pdev->msix_cap) || (pm8001_ha->chip_id == chip_8001)) |
| 1038 | tasklet_init(&pm8001_ha->tasklet, pm8001_tasklet, | 1048 | tasklet_init(&pm8001_ha->tasklet[0], pm8001_tasklet, |
| 1039 | (unsigned long)pm8001_ha); | 1049 | (unsigned long)&(pm8001_ha->irq_vector[0])); |
| 1050 | else | ||
| 1051 | for (j = 0; j < PM8001_MAX_MSIX_VEC; j++) | ||
| 1052 | tasklet_init(&pm8001_ha->tasklet[j], pm8001_tasklet, | ||
| 1053 | (unsigned long)&(pm8001_ha->irq_vector[j])); | ||
| 1040 | #endif | 1054 | #endif |
| 1041 | PM8001_CHIP_DISP->interrupt_enable(pm8001_ha, 0); | 1055 | PM8001_CHIP_DISP->interrupt_enable(pm8001_ha, 0); |
| 1042 | if (pm8001_ha->chip_id != chip_8001) { | 1056 | if (pm8001_ha->chip_id != chip_8001) { |
| @@ -1169,6 +1183,7 @@ module_exit(pm8001_exit); | |||
| 1169 | MODULE_AUTHOR("Jack Wang <jack_wang@usish.com>"); | 1183 | MODULE_AUTHOR("Jack Wang <jack_wang@usish.com>"); |
| 1170 | MODULE_AUTHOR("Anand Kumar Santhanam <AnandKumar.Santhanam@pmcs.com>"); | 1184 | MODULE_AUTHOR("Anand Kumar Santhanam <AnandKumar.Santhanam@pmcs.com>"); |
| 1171 | MODULE_AUTHOR("Sangeetha Gnanasekaran <Sangeetha.Gnanasekaran@pmcs.com>"); | 1185 | MODULE_AUTHOR("Sangeetha Gnanasekaran <Sangeetha.Gnanasekaran@pmcs.com>"); |
| 1186 | MODULE_AUTHOR("Nikith Ganigarakoppal <Nikith.Ganigarakoppal@pmcs.com>"); | ||
| 1172 | MODULE_DESCRIPTION( | 1187 | MODULE_DESCRIPTION( |
| 1173 | "PMC-Sierra PM8001/8081/8088/8089/8074/8076/8077 " | 1188 | "PMC-Sierra PM8001/8081/8088/8089/8074/8076/8077 " |
| 1174 | "SAS/SATA controller driver"); | 1189 | "SAS/SATA controller driver"); |
diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c index f4eb18e51631..f50ac44b950e 100644 --- a/drivers/scsi/pm8001/pm8001_sas.c +++ b/drivers/scsi/pm8001/pm8001_sas.c | |||
| @@ -1098,15 +1098,17 @@ int pm8001_lu_reset(struct domain_device *dev, u8 *lun) | |||
| 1098 | struct pm8001_tmf_task tmf_task; | 1098 | struct pm8001_tmf_task tmf_task; |
| 1099 | struct pm8001_device *pm8001_dev = dev->lldd_dev; | 1099 | struct pm8001_device *pm8001_dev = dev->lldd_dev; |
| 1100 | struct pm8001_hba_info *pm8001_ha = pm8001_find_ha_by_dev(dev); | 1100 | struct pm8001_hba_info *pm8001_ha = pm8001_find_ha_by_dev(dev); |
| 1101 | DECLARE_COMPLETION_ONSTACK(completion_setstate); | ||
| 1101 | if (dev_is_sata(dev)) { | 1102 | if (dev_is_sata(dev)) { |
| 1102 | struct sas_phy *phy = sas_get_local_phy(dev); | 1103 | struct sas_phy *phy = sas_get_local_phy(dev); |
| 1103 | rc = pm8001_exec_internal_task_abort(pm8001_ha, pm8001_dev , | 1104 | rc = pm8001_exec_internal_task_abort(pm8001_ha, pm8001_dev , |
| 1104 | dev, 1, 0); | 1105 | dev, 1, 0); |
| 1105 | rc = sas_phy_reset(phy, 1); | 1106 | rc = sas_phy_reset(phy, 1); |
| 1106 | sas_put_local_phy(phy); | 1107 | sas_put_local_phy(phy); |
| 1108 | pm8001_dev->setds_completion = &completion_setstate; | ||
| 1107 | rc = PM8001_CHIP_DISP->set_dev_state_req(pm8001_ha, | 1109 | rc = PM8001_CHIP_DISP->set_dev_state_req(pm8001_ha, |
| 1108 | pm8001_dev, 0x01); | 1110 | pm8001_dev, 0x01); |
| 1109 | msleep(2000); | 1111 | wait_for_completion(&completion_setstate); |
| 1110 | } else { | 1112 | } else { |
| 1111 | tmf_task.tmf = TMF_LU_RESET; | 1113 | tmf_task.tmf = TMF_LU_RESET; |
| 1112 | rc = pm8001_issue_ssp_tmf(dev, lun, &tmf_task); | 1114 | rc = pm8001_issue_ssp_tmf(dev, lun, &tmf_task); |
diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h index 6037d477a183..6c5fd5ee22d3 100644 --- a/drivers/scsi/pm8001/pm8001_sas.h +++ b/drivers/scsi/pm8001/pm8001_sas.h | |||
| @@ -466,6 +466,10 @@ struct pm8001_hba_memspace { | |||
| 466 | u64 membase; | 466 | u64 membase; |
| 467 | u32 memsize; | 467 | u32 memsize; |
| 468 | }; | 468 | }; |
| 469 | struct isr_param { | ||
| 470 | struct pm8001_hba_info *drv_inst; | ||
| 471 | u32 irq_id; | ||
| 472 | }; | ||
| 469 | struct pm8001_hba_info { | 473 | struct pm8001_hba_info { |
| 470 | char name[PM8001_NAME_LENGTH]; | 474 | char name[PM8001_NAME_LENGTH]; |
| 471 | struct list_head list; | 475 | struct list_head list; |
| @@ -519,14 +523,13 @@ struct pm8001_hba_info { | |||
| 519 | int number_of_intr;/*will be used in remove()*/ | 523 | int number_of_intr;/*will be used in remove()*/ |
| 520 | #endif | 524 | #endif |
| 521 | #ifdef PM8001_USE_TASKLET | 525 | #ifdef PM8001_USE_TASKLET |
| 522 | struct tasklet_struct tasklet; | 526 | struct tasklet_struct tasklet[PM8001_MAX_MSIX_VEC]; |
| 523 | #endif | 527 | #endif |
| 524 | u32 logging_level; | 528 | u32 logging_level; |
| 525 | u32 fw_status; | 529 | u32 fw_status; |
| 526 | u32 smp_exp_mode; | 530 | u32 smp_exp_mode; |
| 527 | u32 int_vector; | ||
| 528 | const struct firmware *fw_image; | 531 | const struct firmware *fw_image; |
| 529 | u8 outq[PM8001_MAX_MSIX_VEC]; | 532 | struct isr_param irq_vector[PM8001_MAX_MSIX_VEC]; |
| 530 | }; | 533 | }; |
| 531 | 534 | ||
| 532 | struct pm8001_work { | 535 | struct pm8001_work { |
diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index 8987b1706216..c950dc5c9943 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c | |||
| @@ -2894,6 +2894,7 @@ hw_event_sas_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
| 2894 | unsigned long flags; | 2894 | unsigned long flags; |
| 2895 | u8 deviceType = pPayload->sas_identify.dev_type; | 2895 | u8 deviceType = pPayload->sas_identify.dev_type; |
| 2896 | port->port_state = portstate; | 2896 | port->port_state = portstate; |
| 2897 | phy->phy_state = PHY_STATE_LINK_UP_SPCV; | ||
| 2897 | PM8001_MSG_DBG(pm8001_ha, pm8001_printk( | 2898 | PM8001_MSG_DBG(pm8001_ha, pm8001_printk( |
| 2898 | "portid:%d; phyid:%d; linkrate:%d; " | 2899 | "portid:%d; phyid:%d; linkrate:%d; " |
| 2899 | "portstate:%x; devicetype:%x\n", | 2900 | "portstate:%x; devicetype:%x\n", |
| @@ -2978,6 +2979,7 @@ hw_event_sata_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
| 2978 | port_id, phy_id, link_rate, portstate)); | 2979 | port_id, phy_id, link_rate, portstate)); |
| 2979 | 2980 | ||
| 2980 | port->port_state = portstate; | 2981 | port->port_state = portstate; |
| 2982 | phy->phy_state = PHY_STATE_LINK_UP_SPCV; | ||
| 2981 | port->port_attached = 1; | 2983 | port->port_attached = 1; |
| 2982 | pm8001_get_lrate_mode(phy, link_rate); | 2984 | pm8001_get_lrate_mode(phy, link_rate); |
| 2983 | phy->phy_type |= PORT_TYPE_SATA; | 2985 | phy->phy_type |= PORT_TYPE_SATA; |
diff --git a/drivers/scsi/pm8001/pm80xx_hwi.h b/drivers/scsi/pm8001/pm80xx_hwi.h index c86816bea424..9970a385795d 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.h +++ b/drivers/scsi/pm8001/pm80xx_hwi.h | |||
| @@ -215,6 +215,8 @@ | |||
| 215 | #define SAS_DOPNRJT_RTRY_TMO 128 | 215 | #define SAS_DOPNRJT_RTRY_TMO 128 |
| 216 | #define SAS_COPNRJT_RTRY_TMO 128 | 216 | #define SAS_COPNRJT_RTRY_TMO 128 |
| 217 | 217 | ||
| 218 | /* for phy state */ | ||
| 219 | #define PHY_STATE_LINK_UP_SPCV 0x2 | ||
| 218 | /* | 220 | /* |
| 219 | Making ORR bigger than IT NEXUS LOSS which is 2000000us = 2 second. | 221 | Making ORR bigger than IT NEXUS LOSS which is 2000000us = 2 second. |
| 220 | Assuming a bigger value 3 second, 3000000/128 = 23437.5 where 128 | 222 | Assuming a bigger value 3 second, 3000000/128 = 23437.5 where 128 |
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c index bd6f743d87a7..be8ce54f99b2 100644 --- a/drivers/scsi/pmcraid.c +++ b/drivers/scsi/pmcraid.c | |||
| @@ -1404,11 +1404,22 @@ enum { | |||
| 1404 | }; | 1404 | }; |
| 1405 | #define PMCRAID_AEN_CMD_MAX (__PMCRAID_AEN_CMD_MAX - 1) | 1405 | #define PMCRAID_AEN_CMD_MAX (__PMCRAID_AEN_CMD_MAX - 1) |
| 1406 | 1406 | ||
| 1407 | static struct genl_multicast_group pmcraid_mcgrps[] = { | ||
| 1408 | { .name = "events", /* not really used - see ID discussion below */ }, | ||
| 1409 | }; | ||
| 1410 | |||
| 1407 | static struct genl_family pmcraid_event_family = { | 1411 | static struct genl_family pmcraid_event_family = { |
| 1408 | .id = GENL_ID_GENERATE, | 1412 | /* |
| 1413 | * Due to prior multicast group abuse (the code having assumed that | ||
| 1414 | * the family ID can be used as a multicast group ID) we need to | ||
| 1415 | * statically allocate a family (and thus group) ID. | ||
| 1416 | */ | ||
| 1417 | .id = GENL_ID_PMCRAID, | ||
| 1409 | .name = "pmcraid", | 1418 | .name = "pmcraid", |
| 1410 | .version = 1, | 1419 | .version = 1, |
| 1411 | .maxattr = PMCRAID_AEN_ATTR_MAX | 1420 | .maxattr = PMCRAID_AEN_ATTR_MAX, |
| 1421 | .mcgrps = pmcraid_mcgrps, | ||
| 1422 | .n_mcgrps = ARRAY_SIZE(pmcraid_mcgrps), | ||
| 1412 | }; | 1423 | }; |
| 1413 | 1424 | ||
| 1414 | /** | 1425 | /** |
| @@ -1511,9 +1522,8 @@ static int pmcraid_notify_aen( | |||
| 1511 | return result; | 1522 | return result; |
| 1512 | } | 1523 | } |
| 1513 | 1524 | ||
| 1514 | result = | 1525 | result = genlmsg_multicast(&pmcraid_event_family, skb, |
| 1515 | genlmsg_multicast(&pmcraid_event_family, skb, 0, | 1526 | 0, 0, GFP_ATOMIC); |
| 1516 | pmcraid_event_family.id, GFP_ATOMIC); | ||
| 1517 | 1527 | ||
| 1518 | /* If there are no listeners, genlmsg_multicast may return non-zero | 1528 | /* If there are no listeners, genlmsg_multicast may return non-zero |
| 1519 | * value. | 1529 | * value. |
| @@ -4315,6 +4325,7 @@ static struct scsi_host_template pmcraid_host_template = { | |||
| 4315 | .this_id = -1, | 4325 | .this_id = -1, |
| 4316 | .sg_tablesize = PMCRAID_MAX_IOADLS, | 4326 | .sg_tablesize = PMCRAID_MAX_IOADLS, |
| 4317 | .max_sectors = PMCRAID_IOA_MAX_SECTORS, | 4327 | .max_sectors = PMCRAID_IOA_MAX_SECTORS, |
| 4328 | .no_write_same = 1, | ||
| 4318 | .cmd_per_lun = PMCRAID_MAX_CMD_PER_LUN, | 4329 | .cmd_per_lun = PMCRAID_MAX_CMD_PER_LUN, |
| 4319 | .use_clustering = ENABLE_CLUSTERING, | 4330 | .use_clustering = ENABLE_CLUSTERING, |
| 4320 | .shost_attrs = pmcraid_host_attrs, | 4331 | .shost_attrs = pmcraid_host_attrs, |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index e6c4bff04339..69725f7c32c1 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
| @@ -2659,6 +2659,12 @@ static void sd_read_write_same(struct scsi_disk *sdkp, unsigned char *buffer) | |||
| 2659 | { | 2659 | { |
| 2660 | struct scsi_device *sdev = sdkp->device; | 2660 | struct scsi_device *sdev = sdkp->device; |
| 2661 | 2661 | ||
| 2662 | if (sdev->host->no_write_same) { | ||
| 2663 | sdev->no_write_same = 1; | ||
| 2664 | |||
| 2665 | return; | ||
| 2666 | } | ||
| 2667 | |||
| 2662 | if (scsi_report_opcode(sdev, buffer, SD_BUF_SIZE, INQUIRY) < 0) { | 2668 | if (scsi_report_opcode(sdev, buffer, SD_BUF_SIZE, INQUIRY) < 0) { |
| 2663 | /* too large values might cause issues with arcmsr */ | 2669 | /* too large values might cause issues with arcmsr */ |
| 2664 | int vpd_buf_len = 64; | 2670 | int vpd_buf_len = 64; |
diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 1a28f5632797..17d740427240 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c | |||
| @@ -1697,6 +1697,7 @@ static struct scsi_host_template scsi_driver = { | |||
| 1697 | .use_clustering = DISABLE_CLUSTERING, | 1697 | .use_clustering = DISABLE_CLUSTERING, |
| 1698 | /* Make sure we dont get a sg segment crosses a page boundary */ | 1698 | /* Make sure we dont get a sg segment crosses a page boundary */ |
| 1699 | .dma_boundary = PAGE_SIZE-1, | 1699 | .dma_boundary = PAGE_SIZE-1, |
| 1700 | .no_write_same = 1, | ||
| 1700 | }; | 1701 | }; |
| 1701 | 1702 | ||
| 1702 | enum { | 1703 | enum { |
diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c index 3ed666fe840a..9025edd7dc45 100644 --- a/drivers/spi/spi-bcm2835.c +++ b/drivers/spi/spi-bcm2835.c | |||
| @@ -377,7 +377,7 @@ out_master_put: | |||
| 377 | 377 | ||
| 378 | static int bcm2835_spi_remove(struct platform_device *pdev) | 378 | static int bcm2835_spi_remove(struct platform_device *pdev) |
| 379 | { | 379 | { |
| 380 | struct spi_master *master = spi_master_get(platform_get_drvdata(pdev)); | 380 | struct spi_master *master = platform_get_drvdata(pdev); |
| 381 | struct bcm2835_spi *bs = spi_master_get_devdata(master); | 381 | struct bcm2835_spi *bs = spi_master_get_devdata(master); |
| 382 | 382 | ||
| 383 | free_irq(bs->irq, master); | 383 | free_irq(bs->irq, master); |
diff --git a/drivers/spi/spi-bcm63xx.c b/drivers/spi/spi-bcm63xx.c index 80d56b214eb5..469ecd876358 100644 --- a/drivers/spi/spi-bcm63xx.c +++ b/drivers/spi/spi-bcm63xx.c | |||
| @@ -435,7 +435,7 @@ out: | |||
| 435 | 435 | ||
| 436 | static int bcm63xx_spi_remove(struct platform_device *pdev) | 436 | static int bcm63xx_spi_remove(struct platform_device *pdev) |
| 437 | { | 437 | { |
| 438 | struct spi_master *master = spi_master_get(platform_get_drvdata(pdev)); | 438 | struct spi_master *master = platform_get_drvdata(pdev); |
| 439 | struct bcm63xx_spi *bs = spi_master_get_devdata(master); | 439 | struct bcm63xx_spi *bs = spi_master_get_devdata(master); |
| 440 | 440 | ||
| 441 | /* reset spi block */ | 441 | /* reset spi block */ |
diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c index 9602bbd8d7ea..87676587d783 100644 --- a/drivers/spi/spi-mpc512x-psc.c +++ b/drivers/spi/spi-mpc512x-psc.c | |||
| @@ -557,7 +557,7 @@ free_master: | |||
| 557 | 557 | ||
| 558 | static int mpc512x_psc_spi_do_remove(struct device *dev) | 558 | static int mpc512x_psc_spi_do_remove(struct device *dev) |
| 559 | { | 559 | { |
| 560 | struct spi_master *master = spi_master_get(dev_get_drvdata(dev)); | 560 | struct spi_master *master = dev_get_drvdata(dev); |
| 561 | struct mpc512x_psc_spi *mps = spi_master_get_devdata(master); | 561 | struct mpc512x_psc_spi *mps = spi_master_get_devdata(master); |
| 562 | 562 | ||
| 563 | clk_disable_unprepare(mps->clk_mclk); | 563 | clk_disable_unprepare(mps->clk_mclk); |
diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c index 73afb56c08cc..3adebfa22e3d 100644 --- a/drivers/spi/spi-mxs.c +++ b/drivers/spi/spi-mxs.c | |||
| @@ -565,7 +565,7 @@ static int mxs_spi_remove(struct platform_device *pdev) | |||
| 565 | struct mxs_spi *spi; | 565 | struct mxs_spi *spi; |
| 566 | struct mxs_ssp *ssp; | 566 | struct mxs_ssp *ssp; |
| 567 | 567 | ||
| 568 | master = spi_master_get(platform_get_drvdata(pdev)); | 568 | master = platform_get_drvdata(pdev); |
| 569 | spi = spi_master_get_devdata(master); | 569 | spi = spi_master_get_devdata(master); |
| 570 | ssp = &spi->ssp; | 570 | ssp = &spi->ssp; |
| 571 | 571 | ||
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index cb0e1f1137ad..7765b1999537 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c | |||
| @@ -1073,6 +1073,8 @@ pxa2xx_spi_acpi_get_pdata(struct platform_device *pdev) | |||
| 1073 | static struct acpi_device_id pxa2xx_spi_acpi_match[] = { | 1073 | static struct acpi_device_id pxa2xx_spi_acpi_match[] = { |
| 1074 | { "INT33C0", 0 }, | 1074 | { "INT33C0", 0 }, |
| 1075 | { "INT33C1", 0 }, | 1075 | { "INT33C1", 0 }, |
| 1076 | { "INT3430", 0 }, | ||
| 1077 | { "INT3431", 0 }, | ||
| 1076 | { "80860F0E", 0 }, | 1078 | { "80860F0E", 0 }, |
| 1077 | { }, | 1079 | { }, |
| 1078 | }; | 1080 | }; |
| @@ -1291,6 +1293,9 @@ static int pxa2xx_spi_resume(struct device *dev) | |||
| 1291 | /* Enable the SSP clock */ | 1293 | /* Enable the SSP clock */ |
| 1292 | clk_prepare_enable(ssp->clk); | 1294 | clk_prepare_enable(ssp->clk); |
| 1293 | 1295 | ||
| 1296 | /* Restore LPSS private register bits */ | ||
| 1297 | lpss_ssp_setup(drv_data); | ||
| 1298 | |||
| 1294 | /* Start the queue running */ | 1299 | /* Start the queue running */ |
| 1295 | status = spi_master_resume(drv_data->master); | 1300 | status = spi_master_resume(drv_data->master); |
| 1296 | if (status != 0) { | 1301 | if (status != 0) { |
diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c index 58449ad4ad0d..9e829cee7357 100644 --- a/drivers/spi/spi-rspi.c +++ b/drivers/spi/spi-rspi.c | |||
| @@ -885,14 +885,13 @@ static void rspi_release_dma(struct rspi_data *rspi) | |||
| 885 | 885 | ||
| 886 | static int rspi_remove(struct platform_device *pdev) | 886 | static int rspi_remove(struct platform_device *pdev) |
| 887 | { | 887 | { |
| 888 | struct rspi_data *rspi = spi_master_get(platform_get_drvdata(pdev)); | 888 | struct rspi_data *rspi = platform_get_drvdata(pdev); |
| 889 | 889 | ||
| 890 | spi_unregister_master(rspi->master); | 890 | spi_unregister_master(rspi->master); |
| 891 | rspi_release_dma(rspi); | 891 | rspi_release_dma(rspi); |
| 892 | free_irq(platform_get_irq(pdev, 0), rspi); | 892 | free_irq(platform_get_irq(pdev, 0), rspi); |
| 893 | clk_put(rspi->clk); | 893 | clk_put(rspi->clk); |
| 894 | iounmap(rspi->addr); | 894 | iounmap(rspi->addr); |
| 895 | spi_master_put(rspi->master); | ||
| 896 | 895 | ||
| 897 | return 0; | 896 | return 0; |
| 898 | } | 897 | } |
diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c index 0b71270fbf67..4396bd448540 100644 --- a/drivers/spi/spi-ti-qspi.c +++ b/drivers/spi/spi-ti-qspi.c | |||
| @@ -161,7 +161,7 @@ static int ti_qspi_setup(struct spi_device *spi) | |||
| 161 | qspi->spi_max_frequency, clk_div); | 161 | qspi->spi_max_frequency, clk_div); |
| 162 | 162 | ||
| 163 | ret = pm_runtime_get_sync(qspi->dev); | 163 | ret = pm_runtime_get_sync(qspi->dev); |
| 164 | if (ret) { | 164 | if (ret < 0) { |
| 165 | dev_err(qspi->dev, "pm_runtime_get_sync() failed\n"); | 165 | dev_err(qspi->dev, "pm_runtime_get_sync() failed\n"); |
| 166 | return ret; | 166 | return ret; |
| 167 | } | 167 | } |
| @@ -459,11 +459,10 @@ static int ti_qspi_probe(struct platform_device *pdev) | |||
| 459 | if (!of_property_read_u32(np, "num-cs", &num_cs)) | 459 | if (!of_property_read_u32(np, "num-cs", &num_cs)) |
| 460 | master->num_chipselect = num_cs; | 460 | master->num_chipselect = num_cs; |
| 461 | 461 | ||
| 462 | platform_set_drvdata(pdev, master); | ||
| 463 | |||
| 464 | qspi = spi_master_get_devdata(master); | 462 | qspi = spi_master_get_devdata(master); |
| 465 | qspi->master = master; | 463 | qspi->master = master; |
| 466 | qspi->dev = &pdev->dev; | 464 | qspi->dev = &pdev->dev; |
| 465 | platform_set_drvdata(pdev, qspi); | ||
| 467 | 466 | ||
| 468 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 467 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 469 | 468 | ||
| @@ -517,10 +516,26 @@ free_master: | |||
| 517 | 516 | ||
| 518 | static int ti_qspi_remove(struct platform_device *pdev) | 517 | static int ti_qspi_remove(struct platform_device *pdev) |
| 519 | { | 518 | { |
| 520 | struct ti_qspi *qspi = platform_get_drvdata(pdev); | 519 | struct spi_master *master; |
| 520 | struct ti_qspi *qspi; | ||
| 521 | int ret; | ||
| 522 | |||
| 523 | master = platform_get_drvdata(pdev); | ||
| 524 | qspi = spi_master_get_devdata(master); | ||
| 525 | |||
| 526 | ret = pm_runtime_get_sync(qspi->dev); | ||
| 527 | if (ret < 0) { | ||
| 528 | dev_err(qspi->dev, "pm_runtime_get_sync() failed\n"); | ||
| 529 | return ret; | ||
| 530 | } | ||
| 521 | 531 | ||
| 522 | ti_qspi_write(qspi, QSPI_WC_INT_DISABLE, QSPI_INTR_ENABLE_CLEAR_REG); | 532 | ti_qspi_write(qspi, QSPI_WC_INT_DISABLE, QSPI_INTR_ENABLE_CLEAR_REG); |
| 523 | 533 | ||
| 534 | pm_runtime_put(qspi->dev); | ||
| 535 | pm_runtime_disable(&pdev->dev); | ||
| 536 | |||
| 537 | spi_unregister_master(master); | ||
| 538 | |||
| 524 | return 0; | 539 | return 0; |
| 525 | } | 540 | } |
| 526 | 541 | ||
diff --git a/drivers/spi/spi-txx9.c b/drivers/spi/spi-txx9.c index 637cce2b8bdd..18c9bb2b5f39 100644 --- a/drivers/spi/spi-txx9.c +++ b/drivers/spi/spi-txx9.c | |||
| @@ -425,7 +425,7 @@ exit: | |||
| 425 | 425 | ||
| 426 | static int txx9spi_remove(struct platform_device *dev) | 426 | static int txx9spi_remove(struct platform_device *dev) |
| 427 | { | 427 | { |
| 428 | struct spi_master *master = spi_master_get(platform_get_drvdata(dev)); | 428 | struct spi_master *master = platform_get_drvdata(dev); |
| 429 | struct txx9spi *c = spi_master_get_devdata(master); | 429 | struct txx9spi *c = spi_master_get_devdata(master); |
| 430 | 430 | ||
| 431 | destroy_workqueue(c->workqueue); | 431 | destroy_workqueue(c->workqueue); |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 18cc625d887f..349ebba4b199 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
| @@ -1415,7 +1415,7 @@ int devm_spi_register_master(struct device *dev, struct spi_master *master) | |||
| 1415 | return -ENOMEM; | 1415 | return -ENOMEM; |
| 1416 | 1416 | ||
| 1417 | ret = spi_register_master(master); | 1417 | ret = spi_register_master(master); |
| 1418 | if (ret != 0) { | 1418 | if (!ret) { |
| 1419 | *ptr = master; | 1419 | *ptr = master; |
| 1420 | devres_add(dev, ptr); | 1420 | devres_add(dev, ptr); |
| 1421 | } else { | 1421 | } else { |
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index 67beb8444930..f7beb6eb40c7 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c | |||
| @@ -653,6 +653,8 @@ static int uio_mmap_physical(struct vm_area_struct *vma) | |||
| 653 | return -EINVAL; | 653 | return -EINVAL; |
| 654 | mem = idev->info->mem + mi; | 654 | mem = idev->info->mem + mi; |
| 655 | 655 | ||
| 656 | if (mem->addr & ~PAGE_MASK) | ||
| 657 | return -ENODEV; | ||
| 656 | if (vma->vm_end - vma->vm_start > mem->size) | 658 | if (vma->vm_end - vma->vm_start > mem->size) |
| 657 | return -EINVAL; | 659 | return -EINVAL; |
| 658 | 660 | ||
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index 8521051cf946..cd961622f9c1 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c | |||
| @@ -131,6 +131,7 @@ static const struct platform_device_id atmel_lcdfb_devtypes[] = { | |||
| 131 | /* terminator */ | 131 | /* terminator */ |
| 132 | } | 132 | } |
| 133 | }; | 133 | }; |
| 134 | MODULE_DEVICE_TABLE(platform, atmel_lcdfb_devtypes); | ||
| 134 | 135 | ||
| 135 | static struct atmel_lcdfb_config * | 136 | static struct atmel_lcdfb_config * |
| 136 | atmel_lcdfb_get_config(struct platform_device *pdev) | 137 | atmel_lcdfb_get_config(struct platform_device *pdev) |
diff --git a/drivers/video/kyro/fbdev.c b/drivers/video/kyro/fbdev.c index 50c857477e4f..65041e15fd59 100644 --- a/drivers/video/kyro/fbdev.c +++ b/drivers/video/kyro/fbdev.c | |||
| @@ -624,15 +624,15 @@ static int kyrofb_ioctl(struct fb_info *info, | |||
| 624 | return -EINVAL; | 624 | return -EINVAL; |
| 625 | } | 625 | } |
| 626 | case KYRO_IOCTL_UVSTRIDE: | 626 | case KYRO_IOCTL_UVSTRIDE: |
| 627 | if (copy_to_user(argp, &deviceInfo.ulOverlayUVStride, sizeof(unsigned long))) | 627 | if (copy_to_user(argp, &deviceInfo.ulOverlayUVStride, sizeof(deviceInfo.ulOverlayUVStride))) |
| 628 | return -EFAULT; | 628 | return -EFAULT; |
| 629 | break; | 629 | break; |
| 630 | case KYRO_IOCTL_STRIDE: | 630 | case KYRO_IOCTL_STRIDE: |
| 631 | if (copy_to_user(argp, &deviceInfo.ulOverlayStride, sizeof(unsigned long))) | 631 | if (copy_to_user(argp, &deviceInfo.ulOverlayStride, sizeof(deviceInfo.ulOverlayStride))) |
| 632 | return -EFAULT; | 632 | return -EFAULT; |
| 633 | break; | 633 | break; |
| 634 | case KYRO_IOCTL_OVERLAY_OFFSET: | 634 | case KYRO_IOCTL_OVERLAY_OFFSET: |
| 635 | if (copy_to_user(argp, &deviceInfo.ulOverlayOffset, sizeof(unsigned long))) | 635 | if (copy_to_user(argp, &deviceInfo.ulOverlayOffset, sizeof(deviceInfo.ulOverlayOffset))) |
| 636 | return -EFAULT; | 636 | return -EFAULT; |
| 637 | break; | 637 | break; |
| 638 | } | 638 | } |
diff --git a/drivers/video/omap2/displays-new/panel-sony-acx565akm.c b/drivers/video/omap2/displays-new/panel-sony-acx565akm.c index e6d56f714ae4..d94f35dbd536 100644 --- a/drivers/video/omap2/displays-new/panel-sony-acx565akm.c +++ b/drivers/video/omap2/displays-new/panel-sony-acx565akm.c | |||
| @@ -526,6 +526,8 @@ static int acx565akm_panel_power_on(struct omap_dss_device *dssdev) | |||
| 526 | struct omap_dss_device *in = ddata->in; | 526 | struct omap_dss_device *in = ddata->in; |
| 527 | int r; | 527 | int r; |
| 528 | 528 | ||
| 529 | mutex_lock(&ddata->mutex); | ||
| 530 | |||
| 529 | dev_dbg(&ddata->spi->dev, "%s\n", __func__); | 531 | dev_dbg(&ddata->spi->dev, "%s\n", __func__); |
| 530 | 532 | ||
| 531 | in->ops.sdi->set_timings(in, &ddata->videomode); | 533 | in->ops.sdi->set_timings(in, &ddata->videomode); |
| @@ -614,10 +616,7 @@ static int acx565akm_enable(struct omap_dss_device *dssdev) | |||
| 614 | if (omapdss_device_is_enabled(dssdev)) | 616 | if (omapdss_device_is_enabled(dssdev)) |
| 615 | return 0; | 617 | return 0; |
| 616 | 618 | ||
| 617 | mutex_lock(&ddata->mutex); | ||
| 618 | r = acx565akm_panel_power_on(dssdev); | 619 | r = acx565akm_panel_power_on(dssdev); |
| 619 | mutex_unlock(&ddata->mutex); | ||
| 620 | |||
| 621 | if (r) | 620 | if (r) |
| 622 | return r; | 621 | return r; |
| 623 | 622 | ||
diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c index e0f098562a74..a297de5cc859 100644 --- a/drivers/video/sh_mobile_meram.c +++ b/drivers/video/sh_mobile_meram.c | |||
| @@ -569,6 +569,7 @@ EXPORT_SYMBOL_GPL(sh_mobile_meram_cache_update); | |||
| 569 | * Power management | 569 | * Power management |
| 570 | */ | 570 | */ |
| 571 | 571 | ||
| 572 | #if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM_RUNTIME) | ||
| 572 | static int sh_mobile_meram_suspend(struct device *dev) | 573 | static int sh_mobile_meram_suspend(struct device *dev) |
| 573 | { | 574 | { |
| 574 | struct platform_device *pdev = to_platform_device(dev); | 575 | struct platform_device *pdev = to_platform_device(dev); |
| @@ -611,6 +612,7 @@ static int sh_mobile_meram_resume(struct device *dev) | |||
| 611 | meram_write_reg(priv->base, common_regs[i], priv->regs[i]); | 612 | meram_write_reg(priv->base, common_regs[i], priv->regs[i]); |
| 612 | return 0; | 613 | return 0; |
| 613 | } | 614 | } |
| 615 | #endif /* CONFIG_PM_SLEEP || CONFIG_PM_RUNTIME */ | ||
| 614 | 616 | ||
| 615 | static UNIVERSAL_DEV_PM_OPS(sh_mobile_meram_dev_pm_ops, | 617 | static UNIVERSAL_DEV_PM_OPS(sh_mobile_meram_dev_pm_ops, |
| 616 | sh_mobile_meram_suspend, | 618 | sh_mobile_meram_suspend, |
diff --git a/drivers/video/vt8500lcdfb.c b/drivers/video/vt8500lcdfb.c index b30e5a439d1f..a8f2b280f796 100644 --- a/drivers/video/vt8500lcdfb.c +++ b/drivers/video/vt8500lcdfb.c | |||
| @@ -293,8 +293,7 @@ static int vt8500lcd_probe(struct platform_device *pdev) | |||
| 293 | + sizeof(u32) * 16, GFP_KERNEL); | 293 | + sizeof(u32) * 16, GFP_KERNEL); |
| 294 | if (!fbi) { | 294 | if (!fbi) { |
| 295 | dev_err(&pdev->dev, "Failed to initialize framebuffer device\n"); | 295 | dev_err(&pdev->dev, "Failed to initialize framebuffer device\n"); |
| 296 | ret = -ENOMEM; | 296 | return -ENOMEM; |
| 297 | goto failed; | ||
| 298 | } | 297 | } |
| 299 | 298 | ||
| 300 | strcpy(fbi->fb.fix.id, "VT8500 LCD"); | 299 | strcpy(fbi->fb.fix.id, "VT8500 LCD"); |
| @@ -327,15 +326,13 @@ static int vt8500lcd_probe(struct platform_device *pdev) | |||
| 327 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 326 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 328 | if (res == NULL) { | 327 | if (res == NULL) { |
| 329 | dev_err(&pdev->dev, "no I/O memory resource defined\n"); | 328 | dev_err(&pdev->dev, "no I/O memory resource defined\n"); |
| 330 | ret = -ENODEV; | 329 | return -ENODEV; |
| 331 | goto failed_fbi; | ||
| 332 | } | 330 | } |
| 333 | 331 | ||
| 334 | res = request_mem_region(res->start, resource_size(res), "vt8500lcd"); | 332 | res = request_mem_region(res->start, resource_size(res), "vt8500lcd"); |
| 335 | if (res == NULL) { | 333 | if (res == NULL) { |
| 336 | dev_err(&pdev->dev, "failed to request I/O memory\n"); | 334 | dev_err(&pdev->dev, "failed to request I/O memory\n"); |
| 337 | ret = -EBUSY; | 335 | return -EBUSY; |
| 338 | goto failed_fbi; | ||
| 339 | } | 336 | } |
| 340 | 337 | ||
| 341 | fbi->regbase = ioremap(res->start, resource_size(res)); | 338 | fbi->regbase = ioremap(res->start, resource_size(res)); |
| @@ -346,17 +343,19 @@ static int vt8500lcd_probe(struct platform_device *pdev) | |||
| 346 | } | 343 | } |
| 347 | 344 | ||
| 348 | disp_timing = of_get_display_timings(pdev->dev.of_node); | 345 | disp_timing = of_get_display_timings(pdev->dev.of_node); |
| 349 | if (!disp_timing) | 346 | if (!disp_timing) { |
| 350 | return -EINVAL; | 347 | ret = -EINVAL; |
| 348 | goto failed_free_io; | ||
| 349 | } | ||
| 351 | 350 | ||
| 352 | ret = of_get_fb_videomode(pdev->dev.of_node, &of_mode, | 351 | ret = of_get_fb_videomode(pdev->dev.of_node, &of_mode, |
| 353 | OF_USE_NATIVE_MODE); | 352 | OF_USE_NATIVE_MODE); |
| 354 | if (ret) | 353 | if (ret) |
| 355 | return ret; | 354 | goto failed_free_io; |
| 356 | 355 | ||
| 357 | ret = of_property_read_u32(pdev->dev.of_node, "bits-per-pixel", &bpp); | 356 | ret = of_property_read_u32(pdev->dev.of_node, "bits-per-pixel", &bpp); |
| 358 | if (ret) | 357 | if (ret) |
| 359 | return ret; | 358 | goto failed_free_io; |
| 360 | 359 | ||
| 361 | /* try allocating the framebuffer */ | 360 | /* try allocating the framebuffer */ |
| 362 | fb_mem_len = of_mode.xres * of_mode.yres * 2 * (bpp / 8); | 361 | fb_mem_len = of_mode.xres * of_mode.yres * 2 * (bpp / 8); |
| @@ -364,7 +363,8 @@ static int vt8500lcd_probe(struct platform_device *pdev) | |||
| 364 | GFP_KERNEL); | 363 | GFP_KERNEL); |
| 365 | if (!fb_mem_virt) { | 364 | if (!fb_mem_virt) { |
| 366 | pr_err("%s: Failed to allocate framebuffer\n", __func__); | 365 | pr_err("%s: Failed to allocate framebuffer\n", __func__); |
| 367 | return -ENOMEM; | 366 | ret = -ENOMEM; |
| 367 | goto failed_free_io; | ||
| 368 | } | 368 | } |
| 369 | 369 | ||
| 370 | fbi->fb.fix.smem_start = fb_mem_phys; | 370 | fbi->fb.fix.smem_start = fb_mem_phys; |
| @@ -447,9 +447,6 @@ failed_free_io: | |||
| 447 | iounmap(fbi->regbase); | 447 | iounmap(fbi->regbase); |
| 448 | failed_free_res: | 448 | failed_free_res: |
| 449 | release_mem_region(res->start, resource_size(res)); | 449 | release_mem_region(res->start, resource_size(res)); |
| 450 | failed_fbi: | ||
| 451 | kfree(fbi); | ||
| 452 | failed: | ||
| 453 | return ret; | 450 | return ret; |
| 454 | } | 451 | } |
| 455 | 452 | ||
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index 62ccf5424ba8..028387192b60 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c | |||
| @@ -930,9 +930,10 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops, | |||
| 930 | ret = m2p_add_override(mfn, pages[i], kmap_ops ? | 930 | ret = m2p_add_override(mfn, pages[i], kmap_ops ? |
| 931 | &kmap_ops[i] : NULL); | 931 | &kmap_ops[i] : NULL); |
| 932 | if (ret) | 932 | if (ret) |
| 933 | return ret; | 933 | goto out; |
| 934 | } | 934 | } |
| 935 | 935 | ||
| 936 | out: | ||
| 936 | if (lazy) | 937 | if (lazy) |
| 937 | arch_leave_lazy_mmu_mode(); | 938 | arch_leave_lazy_mmu_mode(); |
| 938 | 939 | ||
| @@ -969,9 +970,10 @@ int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops, | |||
| 969 | ret = m2p_remove_override(pages[i], kmap_ops ? | 970 | ret = m2p_remove_override(pages[i], kmap_ops ? |
| 970 | &kmap_ops[i] : NULL); | 971 | &kmap_ops[i] : NULL); |
| 971 | if (ret) | 972 | if (ret) |
| 972 | return ret; | 973 | goto out; |
| 973 | } | 974 | } |
| 974 | 975 | ||
| 976 | out: | ||
| 975 | if (lazy) | 977 | if (lazy) |
| 976 | arch_leave_lazy_mmu_mode(); | 978 | arch_leave_lazy_mmu_mode(); |
| 977 | 979 | ||
diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index a224bc74b6b9..1eac0731c349 100644 --- a/drivers/xen/swiotlb-xen.c +++ b/drivers/xen/swiotlb-xen.c | |||
| @@ -555,6 +555,11 @@ xen_swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, | |||
| 555 | sg_dma_len(sgl) = 0; | 555 | sg_dma_len(sgl) = 0; |
| 556 | return 0; | 556 | return 0; |
| 557 | } | 557 | } |
| 558 | xen_dma_map_page(hwdev, pfn_to_page(map >> PAGE_SHIFT), | ||
| 559 | map & ~PAGE_MASK, | ||
| 560 | sg->length, | ||
| 561 | dir, | ||
| 562 | attrs); | ||
| 558 | sg->dma_address = xen_phys_to_bus(map); | 563 | sg->dma_address = xen_phys_to_bus(map); |
| 559 | } else { | 564 | } else { |
| 560 | /* we are not interested in the dma_addr returned by | 565 | /* we are not interested in the dma_addr returned by |
