diff options
author | David S. Miller <davem@davemloft.net> | 2016-11-26 23:42:21 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-11-26 23:42:21 -0500 |
commit | 0b42f25d2f123bb7fbd3565d003a8ea9e1e810fe (patch) | |
tree | 77856ad061e97e86027df1fa6efdf20a9fe309b5 /drivers | |
parent | e5f12b3f5ebb8a6ffd3864a04f687ea0ef78a48a (diff) | |
parent | d8e435f3ab6fea2ea324dce72b51dd7761747523 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
udplite conflict is resolved by taking what 'net-next' did
which removed the backlog receive method assignment, since
it is no longer necessary.
Two entries were added to the non-priv ethtool operations
switch statement, one in 'net' and one in 'net-next, so
simple overlapping changes.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
57 files changed, 581 insertions, 278 deletions
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index deb0ff78eba8..54abb26b7366 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -47,32 +47,15 @@ static void acpi_sleep_tts_switch(u32 acpi_state) | |||
47 | } | 47 | } |
48 | } | 48 | } |
49 | 49 | ||
50 | static void acpi_sleep_pts_switch(u32 acpi_state) | 50 | static int tts_notify_reboot(struct notifier_block *this, |
51 | { | ||
52 | acpi_status status; | ||
53 | |||
54 | status = acpi_execute_simple_method(NULL, "\\_PTS", acpi_state); | ||
55 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { | ||
56 | /* | ||
57 | * OS can't evaluate the _PTS object correctly. Some warning | ||
58 | * message will be printed. But it won't break anything. | ||
59 | */ | ||
60 | printk(KERN_NOTICE "Failure in evaluating _PTS object\n"); | ||
61 | } | ||
62 | } | ||
63 | |||
64 | static int sleep_notify_reboot(struct notifier_block *this, | ||
65 | unsigned long code, void *x) | 51 | unsigned long code, void *x) |
66 | { | 52 | { |
67 | acpi_sleep_tts_switch(ACPI_STATE_S5); | 53 | acpi_sleep_tts_switch(ACPI_STATE_S5); |
68 | |||
69 | acpi_sleep_pts_switch(ACPI_STATE_S5); | ||
70 | |||
71 | return NOTIFY_DONE; | 54 | return NOTIFY_DONE; |
72 | } | 55 | } |
73 | 56 | ||
74 | static struct notifier_block sleep_notifier = { | 57 | static struct notifier_block tts_notifier = { |
75 | .notifier_call = sleep_notify_reboot, | 58 | .notifier_call = tts_notify_reboot, |
76 | .next = NULL, | 59 | .next = NULL, |
77 | .priority = 0, | 60 | .priority = 0, |
78 | }; | 61 | }; |
@@ -916,9 +899,9 @@ int __init acpi_sleep_init(void) | |||
916 | pr_info(PREFIX "(supports%s)\n", supported); | 899 | pr_info(PREFIX "(supports%s)\n", supported); |
917 | 900 | ||
918 | /* | 901 | /* |
919 | * Register the sleep_notifier to reboot notifier list so that the _TTS | 902 | * Register the tts_notifier to reboot notifier list so that the _TTS |
920 | * and _PTS object can also be evaluated when the system enters S5. | 903 | * object can also be evaluated when the system enters S5. |
921 | */ | 904 | */ |
922 | register_reboot_notifier(&sleep_notifier); | 905 | register_reboot_notifier(&tts_notifier); |
923 | return 0; | 906 | return 0; |
924 | } | 907 | } |
diff --git a/drivers/clk/berlin/bg2.c b/drivers/clk/berlin/bg2.c index edf3b96b3b73..1d99292e2039 100644 --- a/drivers/clk/berlin/bg2.c +++ b/drivers/clk/berlin/bg2.c | |||
@@ -685,7 +685,7 @@ static void __init berlin2_clock_setup(struct device_node *np) | |||
685 | } | 685 | } |
686 | 686 | ||
687 | /* register clk-provider */ | 687 | /* register clk-provider */ |
688 | of_clk_add_hw_provider(np, of_clk_hw_onecell_get, &clk_data); | 688 | of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_data); |
689 | 689 | ||
690 | return; | 690 | return; |
691 | 691 | ||
diff --git a/drivers/clk/berlin/bg2q.c b/drivers/clk/berlin/bg2q.c index 0718e831475f..3b784b593afd 100644 --- a/drivers/clk/berlin/bg2q.c +++ b/drivers/clk/berlin/bg2q.c | |||
@@ -382,7 +382,7 @@ static void __init berlin2q_clock_setup(struct device_node *np) | |||
382 | } | 382 | } |
383 | 383 | ||
384 | /* register clk-provider */ | 384 | /* register clk-provider */ |
385 | of_clk_add_hw_provider(np, of_clk_hw_onecell_get, &clk_data); | 385 | of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_data); |
386 | 386 | ||
387 | return; | 387 | return; |
388 | 388 | ||
diff --git a/drivers/clk/clk-efm32gg.c b/drivers/clk/clk-efm32gg.c index 8802a2dd56ac..f674778fb3ac 100644 --- a/drivers/clk/clk-efm32gg.c +++ b/drivers/clk/clk-efm32gg.c | |||
@@ -82,6 +82,6 @@ static void __init efm32gg_cmu_init(struct device_node *np) | |||
82 | hws[clk_HFPERCLKDAC0] = clk_hw_register_gate(NULL, "HFPERCLK.DAC0", | 82 | hws[clk_HFPERCLKDAC0] = clk_hw_register_gate(NULL, "HFPERCLK.DAC0", |
83 | "HFXO", 0, base + CMU_HFPERCLKEN0, 17, 0, NULL); | 83 | "HFXO", 0, base + CMU_HFPERCLKEN0, 17, 0, NULL); |
84 | 84 | ||
85 | of_clk_add_hw_provider(np, of_clk_hw_onecell_get, &clk_data); | 85 | of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_data); |
86 | } | 86 | } |
87 | CLK_OF_DECLARE(efm32ggcmu, "efm32gg,cmu", efm32gg_cmu_init); | 87 | CLK_OF_DECLARE(efm32ggcmu, "efm32gg,cmu", efm32gg_cmu_init); |
diff --git a/drivers/clk/sunxi-ng/ccu-sun6i-a31.c b/drivers/clk/sunxi-ng/ccu-sun6i-a31.c index 79596463e0d9..4a82a49cff5e 100644 --- a/drivers/clk/sunxi-ng/ccu-sun6i-a31.c +++ b/drivers/clk/sunxi-ng/ccu-sun6i-a31.c | |||
@@ -191,6 +191,8 @@ static struct clk_div_table axi_div_table[] = { | |||
191 | static SUNXI_CCU_DIV_TABLE(axi_clk, "axi", "cpu", | 191 | static SUNXI_CCU_DIV_TABLE(axi_clk, "axi", "cpu", |
192 | 0x050, 0, 3, axi_div_table, 0); | 192 | 0x050, 0, 3, axi_div_table, 0); |
193 | 193 | ||
194 | #define SUN6I_A31_AHB1_REG 0x054 | ||
195 | |||
194 | static const char * const ahb1_parents[] = { "osc32k", "osc24M", | 196 | static const char * const ahb1_parents[] = { "osc32k", "osc24M", |
195 | "axi", "pll-periph" }; | 197 | "axi", "pll-periph" }; |
196 | 198 | ||
@@ -1230,6 +1232,16 @@ static void __init sun6i_a31_ccu_setup(struct device_node *node) | |||
1230 | val &= BIT(16); | 1232 | val &= BIT(16); |
1231 | writel(val, reg + SUN6I_A31_PLL_MIPI_REG); | 1233 | writel(val, reg + SUN6I_A31_PLL_MIPI_REG); |
1232 | 1234 | ||
1235 | /* Force AHB1 to PLL6 / 3 */ | ||
1236 | val = readl(reg + SUN6I_A31_AHB1_REG); | ||
1237 | /* set PLL6 pre-div = 3 */ | ||
1238 | val &= ~GENMASK(7, 6); | ||
1239 | val |= 0x2 << 6; | ||
1240 | /* select PLL6 / pre-div */ | ||
1241 | val &= ~GENMASK(13, 12); | ||
1242 | val |= 0x3 << 12; | ||
1243 | writel(val, reg + SUN6I_A31_AHB1_REG); | ||
1244 | |||
1233 | sunxi_ccu_probe(node, reg, &sun6i_a31_ccu_desc); | 1245 | sunxi_ccu_probe(node, reg, &sun6i_a31_ccu_desc); |
1234 | 1246 | ||
1235 | ccu_mux_notifier_register(pll_cpu_clk.common.hw.clk, | 1247 | ccu_mux_notifier_register(pll_cpu_clk.common.hw.clk, |
diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c index 838b22aa8b67..f2c9274b8bd5 100644 --- a/drivers/clk/sunxi/clk-sunxi.c +++ b/drivers/clk/sunxi/clk-sunxi.c | |||
@@ -373,7 +373,7 @@ static void sun4i_get_apb1_factors(struct factors_request *req) | |||
373 | else | 373 | else |
374 | calcp = 3; | 374 | calcp = 3; |
375 | 375 | ||
376 | calcm = (req->parent_rate >> calcp) - 1; | 376 | calcm = (div >> calcp) - 1; |
377 | 377 | ||
378 | req->rate = (req->parent_rate >> calcp) / (calcm + 1); | 378 | req->rate = (req->parent_rate >> calcp) / (calcm + 1); |
379 | req->m = calcm; | 379 | req->m = calcm; |
diff --git a/drivers/dax/dax.c b/drivers/dax/dax.c index 0e499bfca41c..3d94ff20fdca 100644 --- a/drivers/dax/dax.c +++ b/drivers/dax/dax.c | |||
@@ -270,8 +270,8 @@ static int check_vma(struct dax_dev *dax_dev, struct vm_area_struct *vma, | |||
270 | if (!dax_dev->alive) | 270 | if (!dax_dev->alive) |
271 | return -ENXIO; | 271 | return -ENXIO; |
272 | 272 | ||
273 | /* prevent private / writable mappings from being established */ | 273 | /* prevent private mappings from being established */ |
274 | if ((vma->vm_flags & (VM_NORESERVE|VM_SHARED|VM_WRITE)) == VM_WRITE) { | 274 | if ((vma->vm_flags & VM_SHARED) != VM_SHARED) { |
275 | dev_info(dev, "%s: %s: fail, attempted private mapping\n", | 275 | dev_info(dev, "%s: %s: fail, attempted private mapping\n", |
276 | current->comm, func); | 276 | current->comm, func); |
277 | return -EINVAL; | 277 | return -EINVAL; |
diff --git a/drivers/dax/pmem.c b/drivers/dax/pmem.c index 4a15fa5df98b..73c6ce93a0d9 100644 --- a/drivers/dax/pmem.c +++ b/drivers/dax/pmem.c | |||
@@ -78,7 +78,9 @@ static int dax_pmem_probe(struct device *dev) | |||
78 | nsio = to_nd_namespace_io(&ndns->dev); | 78 | nsio = to_nd_namespace_io(&ndns->dev); |
79 | 79 | ||
80 | /* parse the 'pfn' info block via ->rw_bytes */ | 80 | /* parse the 'pfn' info block via ->rw_bytes */ |
81 | devm_nsio_enable(dev, nsio); | 81 | rc = devm_nsio_enable(dev, nsio); |
82 | if (rc) | ||
83 | return rc; | ||
82 | altmap = nvdimm_setup_pfn(nd_pfn, &res, &__altmap); | 84 | altmap = nvdimm_setup_pfn(nd_pfn, &res, &__altmap); |
83 | if (IS_ERR(altmap)) | 85 | if (IS_ERR(altmap)) |
84 | return PTR_ERR(altmap); | 86 | return PTR_ERR(altmap); |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c index dae35a96a694..02ca5dd978f6 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | |||
@@ -34,6 +34,7 @@ struct amdgpu_atpx { | |||
34 | 34 | ||
35 | static struct amdgpu_atpx_priv { | 35 | static struct amdgpu_atpx_priv { |
36 | bool atpx_detected; | 36 | bool atpx_detected; |
37 | bool bridge_pm_usable; | ||
37 | /* handle for device - and atpx */ | 38 | /* handle for device - and atpx */ |
38 | acpi_handle dhandle; | 39 | acpi_handle dhandle; |
39 | acpi_handle other_handle; | 40 | acpi_handle other_handle; |
@@ -205,7 +206,11 @@ static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx) | |||
205 | atpx->is_hybrid = false; | 206 | atpx->is_hybrid = false; |
206 | if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) { | 207 | if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) { |
207 | printk("ATPX Hybrid Graphics\n"); | 208 | printk("ATPX Hybrid Graphics\n"); |
208 | atpx->functions.power_cntl = false; | 209 | /* |
210 | * Disable legacy PM methods only when pcie port PM is usable, | ||
211 | * otherwise the device might fail to power off or power on. | ||
212 | */ | ||
213 | atpx->functions.power_cntl = !amdgpu_atpx_priv.bridge_pm_usable; | ||
209 | atpx->is_hybrid = true; | 214 | atpx->is_hybrid = true; |
210 | } | 215 | } |
211 | 216 | ||
@@ -480,6 +485,7 @@ static int amdgpu_atpx_power_state(enum vga_switcheroo_client_id id, | |||
480 | */ | 485 | */ |
481 | static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev) | 486 | static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev) |
482 | { | 487 | { |
488 | struct pci_dev *parent_pdev = pci_upstream_bridge(pdev); | ||
483 | acpi_handle dhandle, atpx_handle; | 489 | acpi_handle dhandle, atpx_handle; |
484 | acpi_status status; | 490 | acpi_status status; |
485 | 491 | ||
@@ -494,6 +500,7 @@ static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev) | |||
494 | } | 500 | } |
495 | amdgpu_atpx_priv.dhandle = dhandle; | 501 | amdgpu_atpx_priv.dhandle = dhandle; |
496 | amdgpu_atpx_priv.atpx.handle = atpx_handle; | 502 | amdgpu_atpx_priv.atpx.handle = atpx_handle; |
503 | amdgpu_atpx_priv.bridge_pm_usable = parent_pdev && parent_pdev->bridge_d3; | ||
497 | return true; | 504 | return true; |
498 | } | 505 | } |
499 | 506 | ||
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c index 13f2b705ea49..08cd0bd3ebe5 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | |||
@@ -2984,19 +2984,19 @@ static int smu7_get_pp_table_entry_callback_func_v0(struct pp_hwmgr *hwmgr, | |||
2984 | if (!(data->mc_micro_code_feature & DISABLE_MC_LOADMICROCODE) && memory_clock > data->highest_mclk) | 2984 | if (!(data->mc_micro_code_feature & DISABLE_MC_LOADMICROCODE) && memory_clock > data->highest_mclk) |
2985 | data->highest_mclk = memory_clock; | 2985 | data->highest_mclk = memory_clock; |
2986 | 2986 | ||
2987 | performance_level = &(ps->performance_levels | ||
2988 | [ps->performance_level_count++]); | ||
2989 | |||
2990 | PP_ASSERT_WITH_CODE( | 2987 | PP_ASSERT_WITH_CODE( |
2991 | (ps->performance_level_count < smum_get_mac_definition(hwmgr->smumgr, SMU_MAX_LEVELS_GRAPHICS)), | 2988 | (ps->performance_level_count < smum_get_mac_definition(hwmgr->smumgr, SMU_MAX_LEVELS_GRAPHICS)), |
2992 | "Performance levels exceeds SMC limit!", | 2989 | "Performance levels exceeds SMC limit!", |
2993 | return -EINVAL); | 2990 | return -EINVAL); |
2994 | 2991 | ||
2995 | PP_ASSERT_WITH_CODE( | 2992 | PP_ASSERT_WITH_CODE( |
2996 | (ps->performance_level_count <= | 2993 | (ps->performance_level_count < |
2997 | hwmgr->platform_descriptor.hardwareActivityPerformanceLevels), | 2994 | hwmgr->platform_descriptor.hardwareActivityPerformanceLevels), |
2998 | "Performance levels exceeds Driver limit!", | 2995 | "Performance levels exceeds Driver limit, Skip!", |
2999 | return -EINVAL); | 2996 | return 0); |
2997 | |||
2998 | performance_level = &(ps->performance_levels | ||
2999 | [ps->performance_level_count++]); | ||
3000 | 3000 | ||
3001 | /* Performance levels are arranged from low to high. */ | 3001 | /* Performance levels are arranged from low to high. */ |
3002 | performance_level->memory_clock = memory_clock; | 3002 | performance_level->memory_clock = memory_clock; |
diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c index 48019ae22ddb..28341b32067f 100644 --- a/drivers/gpu/drm/arm/hdlcd_crtc.c +++ b/drivers/gpu/drm/arm/hdlcd_crtc.c | |||
@@ -150,15 +150,14 @@ static void hdlcd_crtc_enable(struct drm_crtc *crtc) | |||
150 | clk_prepare_enable(hdlcd->clk); | 150 | clk_prepare_enable(hdlcd->clk); |
151 | hdlcd_crtc_mode_set_nofb(crtc); | 151 | hdlcd_crtc_mode_set_nofb(crtc); |
152 | hdlcd_write(hdlcd, HDLCD_REG_COMMAND, 1); | 152 | hdlcd_write(hdlcd, HDLCD_REG_COMMAND, 1); |
153 | drm_crtc_vblank_on(crtc); | ||
153 | } | 154 | } |
154 | 155 | ||
155 | static void hdlcd_crtc_disable(struct drm_crtc *crtc) | 156 | static void hdlcd_crtc_disable(struct drm_crtc *crtc) |
156 | { | 157 | { |
157 | struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc); | 158 | struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc); |
158 | 159 | ||
159 | if (!crtc->state->active) | 160 | drm_crtc_vblank_off(crtc); |
160 | return; | ||
161 | |||
162 | hdlcd_write(hdlcd, HDLCD_REG_COMMAND, 0); | 161 | hdlcd_write(hdlcd, HDLCD_REG_COMMAND, 0); |
163 | clk_disable_unprepare(hdlcd->clk); | 162 | clk_disable_unprepare(hdlcd->clk); |
164 | } | 163 | } |
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index e8fb6ef947ee..38eaa63afb31 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c | |||
@@ -1907,6 +1907,8 @@ err_disable_pm_runtime: | |||
1907 | err_hdmiphy: | 1907 | err_hdmiphy: |
1908 | if (hdata->hdmiphy_port) | 1908 | if (hdata->hdmiphy_port) |
1909 | put_device(&hdata->hdmiphy_port->dev); | 1909 | put_device(&hdata->hdmiphy_port->dev); |
1910 | if (hdata->regs_hdmiphy) | ||
1911 | iounmap(hdata->regs_hdmiphy); | ||
1910 | err_ddc: | 1912 | err_ddc: |
1911 | put_device(&hdata->ddc_adpt->dev); | 1913 | put_device(&hdata->ddc_adpt->dev); |
1912 | 1914 | ||
@@ -1929,6 +1931,9 @@ static int hdmi_remove(struct platform_device *pdev) | |||
1929 | if (hdata->hdmiphy_port) | 1931 | if (hdata->hdmiphy_port) |
1930 | put_device(&hdata->hdmiphy_port->dev); | 1932 | put_device(&hdata->hdmiphy_port->dev); |
1931 | 1933 | ||
1934 | if (hdata->regs_hdmiphy) | ||
1935 | iounmap(hdata->regs_hdmiphy); | ||
1936 | |||
1932 | put_device(&hdata->ddc_adpt->dev); | 1937 | put_device(&hdata->ddc_adpt->dev); |
1933 | 1938 | ||
1934 | return 0; | 1939 | return 0; |
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c index f75c5b5a536c..c70310206ac5 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c | |||
@@ -251,13 +251,6 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev) | |||
251 | if (irq < 0) | 251 | if (irq < 0) |
252 | return irq; | 252 | return irq; |
253 | 253 | ||
254 | ret = devm_request_irq(dev, irq, mtk_disp_ovl_irq_handler, | ||
255 | IRQF_TRIGGER_NONE, dev_name(dev), priv); | ||
256 | if (ret < 0) { | ||
257 | dev_err(dev, "Failed to request irq %d: %d\n", irq, ret); | ||
258 | return ret; | ||
259 | } | ||
260 | |||
261 | comp_id = mtk_ddp_comp_get_id(dev->of_node, MTK_DISP_OVL); | 254 | comp_id = mtk_ddp_comp_get_id(dev->of_node, MTK_DISP_OVL); |
262 | if (comp_id < 0) { | 255 | if (comp_id < 0) { |
263 | dev_err(dev, "Failed to identify by alias: %d\n", comp_id); | 256 | dev_err(dev, "Failed to identify by alias: %d\n", comp_id); |
@@ -273,6 +266,13 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev) | |||
273 | 266 | ||
274 | platform_set_drvdata(pdev, priv); | 267 | platform_set_drvdata(pdev, priv); |
275 | 268 | ||
269 | ret = devm_request_irq(dev, irq, mtk_disp_ovl_irq_handler, | ||
270 | IRQF_TRIGGER_NONE, dev_name(dev), priv); | ||
271 | if (ret < 0) { | ||
272 | dev_err(dev, "Failed to request irq %d: %d\n", irq, ret); | ||
273 | return ret; | ||
274 | } | ||
275 | |||
276 | ret = component_add(dev, &mtk_disp_ovl_component_ops); | 276 | ret = component_add(dev, &mtk_disp_ovl_component_ops); |
277 | if (ret) | 277 | if (ret) |
278 | dev_err(dev, "Failed to add component: %d\n", ret); | 278 | dev_err(dev, "Failed to add component: %d\n", ret); |
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c index df33b3ca6ffd..48cc01fd20c7 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | |||
@@ -123,7 +123,7 @@ static void mtk_od_config(struct mtk_ddp_comp *comp, unsigned int w, | |||
123 | unsigned int bpc) | 123 | unsigned int bpc) |
124 | { | 124 | { |
125 | writel(w << 16 | h, comp->regs + DISP_OD_SIZE); | 125 | writel(w << 16 | h, comp->regs + DISP_OD_SIZE); |
126 | writel(OD_RELAYMODE, comp->regs + OD_RELAYMODE); | 126 | writel(OD_RELAYMODE, comp->regs + DISP_OD_CFG); |
127 | mtk_dither_set(comp, bpc, DISP_OD_CFG); | 127 | mtk_dither_set(comp, bpc, DISP_OD_CFG); |
128 | } | 128 | } |
129 | 129 | ||
diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c index 28b2044ed9f2..eaa5a2240c0c 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c | |||
@@ -86,7 +86,7 @@ | |||
86 | 86 | ||
87 | #define DSI_PHY_TIMECON0 0x110 | 87 | #define DSI_PHY_TIMECON0 0x110 |
88 | #define LPX (0xff << 0) | 88 | #define LPX (0xff << 0) |
89 | #define HS_PRPR (0xff << 8) | 89 | #define HS_PREP (0xff << 8) |
90 | #define HS_ZERO (0xff << 16) | 90 | #define HS_ZERO (0xff << 16) |
91 | #define HS_TRAIL (0xff << 24) | 91 | #define HS_TRAIL (0xff << 24) |
92 | 92 | ||
@@ -102,10 +102,16 @@ | |||
102 | #define CLK_TRAIL (0xff << 24) | 102 | #define CLK_TRAIL (0xff << 24) |
103 | 103 | ||
104 | #define DSI_PHY_TIMECON3 0x11c | 104 | #define DSI_PHY_TIMECON3 0x11c |
105 | #define CLK_HS_PRPR (0xff << 0) | 105 | #define CLK_HS_PREP (0xff << 0) |
106 | #define CLK_HS_POST (0xff << 8) | 106 | #define CLK_HS_POST (0xff << 8) |
107 | #define CLK_HS_EXIT (0xff << 16) | 107 | #define CLK_HS_EXIT (0xff << 16) |
108 | 108 | ||
109 | #define T_LPX 5 | ||
110 | #define T_HS_PREP 6 | ||
111 | #define T_HS_TRAIL 8 | ||
112 | #define T_HS_EXIT 7 | ||
113 | #define T_HS_ZERO 10 | ||
114 | |||
109 | #define NS_TO_CYCLE(n, c) ((n) / (c) + (((n) % (c)) ? 1 : 0)) | 115 | #define NS_TO_CYCLE(n, c) ((n) / (c) + (((n) % (c)) ? 1 : 0)) |
110 | 116 | ||
111 | struct phy; | 117 | struct phy; |
@@ -161,20 +167,18 @@ static void mtk_dsi_mask(struct mtk_dsi *dsi, u32 offset, u32 mask, u32 data) | |||
161 | static void dsi_phy_timconfig(struct mtk_dsi *dsi) | 167 | static void dsi_phy_timconfig(struct mtk_dsi *dsi) |
162 | { | 168 | { |
163 | u32 timcon0, timcon1, timcon2, timcon3; | 169 | u32 timcon0, timcon1, timcon2, timcon3; |
164 | unsigned int ui, cycle_time; | 170 | u32 ui, cycle_time; |
165 | unsigned int lpx; | ||
166 | 171 | ||
167 | ui = 1000 / dsi->data_rate + 0x01; | 172 | ui = 1000 / dsi->data_rate + 0x01; |
168 | cycle_time = 8000 / dsi->data_rate + 0x01; | 173 | cycle_time = 8000 / dsi->data_rate + 0x01; |
169 | lpx = 5; | ||
170 | 174 | ||
171 | timcon0 = (8 << 24) | (0xa << 16) | (0x6 << 8) | lpx; | 175 | timcon0 = T_LPX | T_HS_PREP << 8 | T_HS_ZERO << 16 | T_HS_TRAIL << 24; |
172 | timcon1 = (7 << 24) | (5 * lpx << 16) | ((3 * lpx) / 2) << 8 | | 176 | timcon1 = 4 * T_LPX | (3 * T_LPX / 2) << 8 | 5 * T_LPX << 16 | |
173 | (4 * lpx); | 177 | T_HS_EXIT << 24; |
174 | timcon2 = ((NS_TO_CYCLE(0x64, cycle_time) + 0xa) << 24) | | 178 | timcon2 = ((NS_TO_CYCLE(0x64, cycle_time) + 0xa) << 24) | |
175 | (NS_TO_CYCLE(0x150, cycle_time) << 16); | 179 | (NS_TO_CYCLE(0x150, cycle_time) << 16); |
176 | timcon3 = (2 * lpx) << 16 | NS_TO_CYCLE(80 + 52 * ui, cycle_time) << 8 | | 180 | timcon3 = NS_TO_CYCLE(0x40, cycle_time) | (2 * T_LPX) << 16 | |
177 | NS_TO_CYCLE(0x40, cycle_time); | 181 | NS_TO_CYCLE(80 + 52 * ui, cycle_time) << 8; |
178 | 182 | ||
179 | writel(timcon0, dsi->regs + DSI_PHY_TIMECON0); | 183 | writel(timcon0, dsi->regs + DSI_PHY_TIMECON0); |
180 | writel(timcon1, dsi->regs + DSI_PHY_TIMECON1); | 184 | writel(timcon1, dsi->regs + DSI_PHY_TIMECON1); |
@@ -202,19 +206,47 @@ static int mtk_dsi_poweron(struct mtk_dsi *dsi) | |||
202 | { | 206 | { |
203 | struct device *dev = dsi->dev; | 207 | struct device *dev = dsi->dev; |
204 | int ret; | 208 | int ret; |
209 | u64 pixel_clock, total_bits; | ||
210 | u32 htotal, htotal_bits, bit_per_pixel, overhead_cycles, overhead_bits; | ||
205 | 211 | ||
206 | if (++dsi->refcount != 1) | 212 | if (++dsi->refcount != 1) |
207 | return 0; | 213 | return 0; |
208 | 214 | ||
215 | switch (dsi->format) { | ||
216 | case MIPI_DSI_FMT_RGB565: | ||
217 | bit_per_pixel = 16; | ||
218 | break; | ||
219 | case MIPI_DSI_FMT_RGB666_PACKED: | ||
220 | bit_per_pixel = 18; | ||
221 | break; | ||
222 | case MIPI_DSI_FMT_RGB666: | ||
223 | case MIPI_DSI_FMT_RGB888: | ||
224 | default: | ||
225 | bit_per_pixel = 24; | ||
226 | break; | ||
227 | } | ||
228 | |||
209 | /** | 229 | /** |
210 | * data_rate = (pixel_clock / 1000) * pixel_dipth * mipi_ratio; | 230 | * vm.pixelclock is in kHz, pixel_clock unit is Hz, so multiply by 1000 |
211 | * pixel_clock unit is Khz, data_rata unit is MHz, so need divide 1000. | 231 | * htotal_time = htotal * byte_per_pixel / num_lanes |
212 | * mipi_ratio is mipi clk coefficient for balance the pixel clk in mipi. | 232 | * overhead_time = lpx + hs_prepare + hs_zero + hs_trail + hs_exit |
213 | * we set mipi_ratio is 1.05. | 233 | * mipi_ratio = (htotal_time + overhead_time) / htotal_time |
234 | * data_rate = pixel_clock * bit_per_pixel * mipi_ratio / num_lanes; | ||
214 | */ | 235 | */ |
215 | dsi->data_rate = dsi->vm.pixelclock * 3 * 21 / (1 * 1000 * 10); | 236 | pixel_clock = dsi->vm.pixelclock * 1000; |
237 | htotal = dsi->vm.hactive + dsi->vm.hback_porch + dsi->vm.hfront_porch + | ||
238 | dsi->vm.hsync_len; | ||
239 | htotal_bits = htotal * bit_per_pixel; | ||
240 | |||
241 | overhead_cycles = T_LPX + T_HS_PREP + T_HS_ZERO + T_HS_TRAIL + | ||
242 | T_HS_EXIT; | ||
243 | overhead_bits = overhead_cycles * dsi->lanes * 8; | ||
244 | total_bits = htotal_bits + overhead_bits; | ||
245 | |||
246 | dsi->data_rate = DIV_ROUND_UP_ULL(pixel_clock * total_bits, | ||
247 | htotal * dsi->lanes); | ||
216 | 248 | ||
217 | ret = clk_set_rate(dsi->hs_clk, dsi->data_rate * 1000000); | 249 | ret = clk_set_rate(dsi->hs_clk, dsi->data_rate); |
218 | if (ret < 0) { | 250 | if (ret < 0) { |
219 | dev_err(dev, "Failed to set data rate: %d\n", ret); | 251 | dev_err(dev, "Failed to set data rate: %d\n", ret); |
220 | goto err_refcount; | 252 | goto err_refcount; |
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c index 2fdcd04bc93f..4129b12521a6 100644 --- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c +++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c | |||
@@ -34,6 +34,7 @@ struct radeon_atpx { | |||
34 | 34 | ||
35 | static struct radeon_atpx_priv { | 35 | static struct radeon_atpx_priv { |
36 | bool atpx_detected; | 36 | bool atpx_detected; |
37 | bool bridge_pm_usable; | ||
37 | /* handle for device - and atpx */ | 38 | /* handle for device - and atpx */ |
38 | acpi_handle dhandle; | 39 | acpi_handle dhandle; |
39 | struct radeon_atpx atpx; | 40 | struct radeon_atpx atpx; |
@@ -203,7 +204,11 @@ static int radeon_atpx_validate(struct radeon_atpx *atpx) | |||
203 | atpx->is_hybrid = false; | 204 | atpx->is_hybrid = false; |
204 | if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) { | 205 | if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) { |
205 | printk("ATPX Hybrid Graphics\n"); | 206 | printk("ATPX Hybrid Graphics\n"); |
206 | atpx->functions.power_cntl = false; | 207 | /* |
208 | * Disable legacy PM methods only when pcie port PM is usable, | ||
209 | * otherwise the device might fail to power off or power on. | ||
210 | */ | ||
211 | atpx->functions.power_cntl = !radeon_atpx_priv.bridge_pm_usable; | ||
207 | atpx->is_hybrid = true; | 212 | atpx->is_hybrid = true; |
208 | } | 213 | } |
209 | 214 | ||
@@ -474,6 +479,7 @@ static int radeon_atpx_power_state(enum vga_switcheroo_client_id id, | |||
474 | */ | 479 | */ |
475 | static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev) | 480 | static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev) |
476 | { | 481 | { |
482 | struct pci_dev *parent_pdev = pci_upstream_bridge(pdev); | ||
477 | acpi_handle dhandle, atpx_handle; | 483 | acpi_handle dhandle, atpx_handle; |
478 | acpi_status status; | 484 | acpi_status status; |
479 | 485 | ||
@@ -487,6 +493,7 @@ static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev) | |||
487 | 493 | ||
488 | radeon_atpx_priv.dhandle = dhandle; | 494 | radeon_atpx_priv.dhandle = dhandle; |
489 | radeon_atpx_priv.atpx.handle = atpx_handle; | 495 | radeon_atpx_priv.atpx.handle = atpx_handle; |
496 | radeon_atpx_priv.bridge_pm_usable = parent_pdev && parent_pdev->bridge_d3; | ||
490 | return true; | 497 | return true; |
491 | } | 498 | } |
492 | 499 | ||
diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c index 086d8a507157..60d30203a5fa 100644 --- a/drivers/hid/hid-cp2112.c +++ b/drivers/hid/hid-cp2112.c | |||
@@ -32,6 +32,11 @@ | |||
32 | #include <linux/usb/ch9.h> | 32 | #include <linux/usb/ch9.h> |
33 | #include "hid-ids.h" | 33 | #include "hid-ids.h" |
34 | 34 | ||
35 | #define CP2112_REPORT_MAX_LENGTH 64 | ||
36 | #define CP2112_GPIO_CONFIG_LENGTH 5 | ||
37 | #define CP2112_GPIO_GET_LENGTH 2 | ||
38 | #define CP2112_GPIO_SET_LENGTH 3 | ||
39 | |||
35 | enum { | 40 | enum { |
36 | CP2112_GPIO_CONFIG = 0x02, | 41 | CP2112_GPIO_CONFIG = 0x02, |
37 | CP2112_GPIO_GET = 0x03, | 42 | CP2112_GPIO_GET = 0x03, |
@@ -161,6 +166,8 @@ struct cp2112_device { | |||
161 | atomic_t read_avail; | 166 | atomic_t read_avail; |
162 | atomic_t xfer_avail; | 167 | atomic_t xfer_avail; |
163 | struct gpio_chip gc; | 168 | struct gpio_chip gc; |
169 | u8 *in_out_buffer; | ||
170 | spinlock_t lock; | ||
164 | }; | 171 | }; |
165 | 172 | ||
166 | static int gpio_push_pull = 0xFF; | 173 | static int gpio_push_pull = 0xFF; |
@@ -171,62 +178,86 @@ static int cp2112_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | |||
171 | { | 178 | { |
172 | struct cp2112_device *dev = gpiochip_get_data(chip); | 179 | struct cp2112_device *dev = gpiochip_get_data(chip); |
173 | struct hid_device *hdev = dev->hdev; | 180 | struct hid_device *hdev = dev->hdev; |
174 | u8 buf[5]; | 181 | u8 *buf = dev->in_out_buffer; |
182 | unsigned long flags; | ||
175 | int ret; | 183 | int ret; |
176 | 184 | ||
185 | spin_lock_irqsave(&dev->lock, flags); | ||
186 | |||
177 | ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, | 187 | ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, |
178 | sizeof(buf), HID_FEATURE_REPORT, | 188 | CP2112_GPIO_CONFIG_LENGTH, HID_FEATURE_REPORT, |
179 | HID_REQ_GET_REPORT); | 189 | HID_REQ_GET_REPORT); |
180 | if (ret != sizeof(buf)) { | 190 | if (ret != CP2112_GPIO_CONFIG_LENGTH) { |
181 | hid_err(hdev, "error requesting GPIO config: %d\n", ret); | 191 | hid_err(hdev, "error requesting GPIO config: %d\n", ret); |
182 | return ret; | 192 | goto exit; |
183 | } | 193 | } |
184 | 194 | ||
185 | buf[1] &= ~(1 << offset); | 195 | buf[1] &= ~(1 << offset); |
186 | buf[2] = gpio_push_pull; | 196 | buf[2] = gpio_push_pull; |
187 | 197 | ||
188 | ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, sizeof(buf), | 198 | ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, |
189 | HID_FEATURE_REPORT, HID_REQ_SET_REPORT); | 199 | CP2112_GPIO_CONFIG_LENGTH, HID_FEATURE_REPORT, |
200 | HID_REQ_SET_REPORT); | ||
190 | if (ret < 0) { | 201 | if (ret < 0) { |
191 | hid_err(hdev, "error setting GPIO config: %d\n", ret); | 202 | hid_err(hdev, "error setting GPIO config: %d\n", ret); |
192 | return ret; | 203 | goto exit; |
193 | } | 204 | } |
194 | 205 | ||
195 | return 0; | 206 | ret = 0; |
207 | |||
208 | exit: | ||
209 | spin_unlock_irqrestore(&dev->lock, flags); | ||
210 | return ret <= 0 ? ret : -EIO; | ||
196 | } | 211 | } |
197 | 212 | ||
198 | static void cp2112_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | 213 | static void cp2112_gpio_set(struct gpio_chip *chip, unsigned offset, int value) |
199 | { | 214 | { |
200 | struct cp2112_device *dev = gpiochip_get_data(chip); | 215 | struct cp2112_device *dev = gpiochip_get_data(chip); |
201 | struct hid_device *hdev = dev->hdev; | 216 | struct hid_device *hdev = dev->hdev; |
202 | u8 buf[3]; | 217 | u8 *buf = dev->in_out_buffer; |
218 | unsigned long flags; | ||
203 | int ret; | 219 | int ret; |
204 | 220 | ||
221 | spin_lock_irqsave(&dev->lock, flags); | ||
222 | |||
205 | buf[0] = CP2112_GPIO_SET; | 223 | buf[0] = CP2112_GPIO_SET; |
206 | buf[1] = value ? 0xff : 0; | 224 | buf[1] = value ? 0xff : 0; |
207 | buf[2] = 1 << offset; | 225 | buf[2] = 1 << offset; |
208 | 226 | ||
209 | ret = hid_hw_raw_request(hdev, CP2112_GPIO_SET, buf, sizeof(buf), | 227 | ret = hid_hw_raw_request(hdev, CP2112_GPIO_SET, buf, |
210 | HID_FEATURE_REPORT, HID_REQ_SET_REPORT); | 228 | CP2112_GPIO_SET_LENGTH, HID_FEATURE_REPORT, |
229 | HID_REQ_SET_REPORT); | ||
211 | if (ret < 0) | 230 | if (ret < 0) |
212 | hid_err(hdev, "error setting GPIO values: %d\n", ret); | 231 | hid_err(hdev, "error setting GPIO values: %d\n", ret); |
232 | |||
233 | spin_unlock_irqrestore(&dev->lock, flags); | ||
213 | } | 234 | } |
214 | 235 | ||
215 | static int cp2112_gpio_get(struct gpio_chip *chip, unsigned offset) | 236 | static int cp2112_gpio_get(struct gpio_chip *chip, unsigned offset) |
216 | { | 237 | { |
217 | struct cp2112_device *dev = gpiochip_get_data(chip); | 238 | struct cp2112_device *dev = gpiochip_get_data(chip); |
218 | struct hid_device *hdev = dev->hdev; | 239 | struct hid_device *hdev = dev->hdev; |
219 | u8 buf[2]; | 240 | u8 *buf = dev->in_out_buffer; |
241 | unsigned long flags; | ||
220 | int ret; | 242 | int ret; |
221 | 243 | ||
222 | ret = hid_hw_raw_request(hdev, CP2112_GPIO_GET, buf, sizeof(buf), | 244 | spin_lock_irqsave(&dev->lock, flags); |
223 | HID_FEATURE_REPORT, HID_REQ_GET_REPORT); | 245 | |
224 | if (ret != sizeof(buf)) { | 246 | ret = hid_hw_raw_request(hdev, CP2112_GPIO_GET, buf, |
247 | CP2112_GPIO_GET_LENGTH, HID_FEATURE_REPORT, | ||
248 | HID_REQ_GET_REPORT); | ||
249 | if (ret != CP2112_GPIO_GET_LENGTH) { | ||
225 | hid_err(hdev, "error requesting GPIO values: %d\n", ret); | 250 | hid_err(hdev, "error requesting GPIO values: %d\n", ret); |
226 | return ret; | 251 | ret = ret < 0 ? ret : -EIO; |
252 | goto exit; | ||
227 | } | 253 | } |
228 | 254 | ||
229 | return (buf[1] >> offset) & 1; | 255 | ret = (buf[1] >> offset) & 1; |
256 | |||
257 | exit: | ||
258 | spin_unlock_irqrestore(&dev->lock, flags); | ||
259 | |||
260 | return ret; | ||
230 | } | 261 | } |
231 | 262 | ||
232 | static int cp2112_gpio_direction_output(struct gpio_chip *chip, | 263 | static int cp2112_gpio_direction_output(struct gpio_chip *chip, |
@@ -234,27 +265,33 @@ static int cp2112_gpio_direction_output(struct gpio_chip *chip, | |||
234 | { | 265 | { |
235 | struct cp2112_device *dev = gpiochip_get_data(chip); | 266 | struct cp2112_device *dev = gpiochip_get_data(chip); |
236 | struct hid_device *hdev = dev->hdev; | 267 | struct hid_device *hdev = dev->hdev; |
237 | u8 buf[5]; | 268 | u8 *buf = dev->in_out_buffer; |
269 | unsigned long flags; | ||
238 | int ret; | 270 | int ret; |
239 | 271 | ||
272 | spin_lock_irqsave(&dev->lock, flags); | ||
273 | |||
240 | ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, | 274 | ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, |
241 | sizeof(buf), HID_FEATURE_REPORT, | 275 | CP2112_GPIO_CONFIG_LENGTH, HID_FEATURE_REPORT, |
242 | HID_REQ_GET_REPORT); | 276 | HID_REQ_GET_REPORT); |
243 | if (ret != sizeof(buf)) { | 277 | if (ret != CP2112_GPIO_CONFIG_LENGTH) { |
244 | hid_err(hdev, "error requesting GPIO config: %d\n", ret); | 278 | hid_err(hdev, "error requesting GPIO config: %d\n", ret); |
245 | return ret; | 279 | goto fail; |
246 | } | 280 | } |
247 | 281 | ||
248 | buf[1] |= 1 << offset; | 282 | buf[1] |= 1 << offset; |
249 | buf[2] = gpio_push_pull; | 283 | buf[2] = gpio_push_pull; |
250 | 284 | ||
251 | ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, sizeof(buf), | 285 | ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, |
252 | HID_FEATURE_REPORT, HID_REQ_SET_REPORT); | 286 | CP2112_GPIO_CONFIG_LENGTH, HID_FEATURE_REPORT, |
287 | HID_REQ_SET_REPORT); | ||
253 | if (ret < 0) { | 288 | if (ret < 0) { |
254 | hid_err(hdev, "error setting GPIO config: %d\n", ret); | 289 | hid_err(hdev, "error setting GPIO config: %d\n", ret); |
255 | return ret; | 290 | goto fail; |
256 | } | 291 | } |
257 | 292 | ||
293 | spin_unlock_irqrestore(&dev->lock, flags); | ||
294 | |||
258 | /* | 295 | /* |
259 | * Set gpio value when output direction is already set, | 296 | * Set gpio value when output direction is already set, |
260 | * as specified in AN495, Rev. 0.2, cpt. 4.4 | 297 | * as specified in AN495, Rev. 0.2, cpt. 4.4 |
@@ -262,6 +299,10 @@ static int cp2112_gpio_direction_output(struct gpio_chip *chip, | |||
262 | cp2112_gpio_set(chip, offset, value); | 299 | cp2112_gpio_set(chip, offset, value); |
263 | 300 | ||
264 | return 0; | 301 | return 0; |
302 | |||
303 | fail: | ||
304 | spin_unlock_irqrestore(&dev->lock, flags); | ||
305 | return ret < 0 ? ret : -EIO; | ||
265 | } | 306 | } |
266 | 307 | ||
267 | static int cp2112_hid_get(struct hid_device *hdev, unsigned char report_number, | 308 | static int cp2112_hid_get(struct hid_device *hdev, unsigned char report_number, |
@@ -1007,6 +1048,17 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
1007 | struct cp2112_smbus_config_report config; | 1048 | struct cp2112_smbus_config_report config; |
1008 | int ret; | 1049 | int ret; |
1009 | 1050 | ||
1051 | dev = devm_kzalloc(&hdev->dev, sizeof(*dev), GFP_KERNEL); | ||
1052 | if (!dev) | ||
1053 | return -ENOMEM; | ||
1054 | |||
1055 | dev->in_out_buffer = devm_kzalloc(&hdev->dev, CP2112_REPORT_MAX_LENGTH, | ||
1056 | GFP_KERNEL); | ||
1057 | if (!dev->in_out_buffer) | ||
1058 | return -ENOMEM; | ||
1059 | |||
1060 | spin_lock_init(&dev->lock); | ||
1061 | |||
1010 | ret = hid_parse(hdev); | 1062 | ret = hid_parse(hdev); |
1011 | if (ret) { | 1063 | if (ret) { |
1012 | hid_err(hdev, "parse failed\n"); | 1064 | hid_err(hdev, "parse failed\n"); |
@@ -1063,12 +1115,6 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
1063 | goto err_power_normal; | 1115 | goto err_power_normal; |
1064 | } | 1116 | } |
1065 | 1117 | ||
1066 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | ||
1067 | if (!dev) { | ||
1068 | ret = -ENOMEM; | ||
1069 | goto err_power_normal; | ||
1070 | } | ||
1071 | |||
1072 | hid_set_drvdata(hdev, (void *)dev); | 1118 | hid_set_drvdata(hdev, (void *)dev); |
1073 | dev->hdev = hdev; | 1119 | dev->hdev = hdev; |
1074 | dev->adap.owner = THIS_MODULE; | 1120 | dev->adap.owner = THIS_MODULE; |
@@ -1087,7 +1133,7 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
1087 | 1133 | ||
1088 | if (ret) { | 1134 | if (ret) { |
1089 | hid_err(hdev, "error registering i2c adapter\n"); | 1135 | hid_err(hdev, "error registering i2c adapter\n"); |
1090 | goto err_free_dev; | 1136 | goto err_power_normal; |
1091 | } | 1137 | } |
1092 | 1138 | ||
1093 | hid_dbg(hdev, "adapter registered\n"); | 1139 | hid_dbg(hdev, "adapter registered\n"); |
@@ -1123,8 +1169,6 @@ err_gpiochip_remove: | |||
1123 | gpiochip_remove(&dev->gc); | 1169 | gpiochip_remove(&dev->gc); |
1124 | err_free_i2c: | 1170 | err_free_i2c: |
1125 | i2c_del_adapter(&dev->adap); | 1171 | i2c_del_adapter(&dev->adap); |
1126 | err_free_dev: | ||
1127 | kfree(dev); | ||
1128 | err_power_normal: | 1172 | err_power_normal: |
1129 | hid_hw_power(hdev, PM_HINT_NORMAL); | 1173 | hid_hw_power(hdev, PM_HINT_NORMAL); |
1130 | err_hid_close: | 1174 | err_hid_close: |
@@ -1149,7 +1193,6 @@ static void cp2112_remove(struct hid_device *hdev) | |||
1149 | */ | 1193 | */ |
1150 | hid_hw_close(hdev); | 1194 | hid_hw_close(hdev); |
1151 | hid_hw_stop(hdev); | 1195 | hid_hw_stop(hdev); |
1152 | kfree(dev); | ||
1153 | } | 1196 | } |
1154 | 1197 | ||
1155 | static int cp2112_raw_event(struct hid_device *hdev, struct hid_report *report, | 1198 | static int cp2112_raw_event(struct hid_device *hdev, struct hid_report *report, |
diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c index 76f644deb0a7..c5c5fbe9d605 100644 --- a/drivers/hid/hid-lg.c +++ b/drivers/hid/hid-lg.c | |||
@@ -756,11 +756,16 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
756 | 756 | ||
757 | /* Setup wireless link with Logitech Wii wheel */ | 757 | /* Setup wireless link with Logitech Wii wheel */ |
758 | if (hdev->product == USB_DEVICE_ID_LOGITECH_WII_WHEEL) { | 758 | if (hdev->product == USB_DEVICE_ID_LOGITECH_WII_WHEEL) { |
759 | unsigned char buf[] = { 0x00, 0xAF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | 759 | const unsigned char cbuf[] = { 0x00, 0xAF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; |
760 | u8 *buf = kmemdup(cbuf, sizeof(cbuf), GFP_KERNEL); | ||
760 | 761 | ||
761 | ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(buf), | 762 | if (!buf) { |
762 | HID_FEATURE_REPORT, HID_REQ_SET_REPORT); | 763 | ret = -ENOMEM; |
764 | goto err_free; | ||
765 | } | ||
763 | 766 | ||
767 | ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(cbuf), | ||
768 | HID_FEATURE_REPORT, HID_REQ_SET_REPORT); | ||
764 | if (ret >= 0) { | 769 | if (ret >= 0) { |
765 | /* insert a little delay of 10 jiffies ~ 40ms */ | 770 | /* insert a little delay of 10 jiffies ~ 40ms */ |
766 | wait_queue_head_t wait; | 771 | wait_queue_head_t wait; |
@@ -772,9 +777,10 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
772 | buf[1] = 0xB2; | 777 | buf[1] = 0xB2; |
773 | get_random_bytes(&buf[2], 2); | 778 | get_random_bytes(&buf[2], 2); |
774 | 779 | ||
775 | ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(buf), | 780 | ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(cbuf), |
776 | HID_FEATURE_REPORT, HID_REQ_SET_REPORT); | 781 | HID_FEATURE_REPORT, HID_REQ_SET_REPORT); |
777 | } | 782 | } |
783 | kfree(buf); | ||
778 | } | 784 | } |
779 | 785 | ||
780 | if (drv_data->quirks & LG_FF) | 786 | if (drv_data->quirks & LG_FF) |
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c index d6fa496d0ca2..20b40ad26325 100644 --- a/drivers/hid/hid-magicmouse.c +++ b/drivers/hid/hid-magicmouse.c | |||
@@ -493,7 +493,8 @@ static int magicmouse_input_configured(struct hid_device *hdev, | |||
493 | static int magicmouse_probe(struct hid_device *hdev, | 493 | static int magicmouse_probe(struct hid_device *hdev, |
494 | const struct hid_device_id *id) | 494 | const struct hid_device_id *id) |
495 | { | 495 | { |
496 | __u8 feature[] = { 0xd7, 0x01 }; | 496 | const u8 feature[] = { 0xd7, 0x01 }; |
497 | u8 *buf; | ||
497 | struct magicmouse_sc *msc; | 498 | struct magicmouse_sc *msc; |
498 | struct hid_report *report; | 499 | struct hid_report *report; |
499 | int ret; | 500 | int ret; |
@@ -544,6 +545,12 @@ static int magicmouse_probe(struct hid_device *hdev, | |||
544 | } | 545 | } |
545 | report->size = 6; | 546 | report->size = 6; |
546 | 547 | ||
548 | buf = kmemdup(feature, sizeof(feature), GFP_KERNEL); | ||
549 | if (!buf) { | ||
550 | ret = -ENOMEM; | ||
551 | goto err_stop_hw; | ||
552 | } | ||
553 | |||
547 | /* | 554 | /* |
548 | * Some devices repond with 'invalid report id' when feature | 555 | * Some devices repond with 'invalid report id' when feature |
549 | * report switching it into multitouch mode is sent to it. | 556 | * report switching it into multitouch mode is sent to it. |
@@ -552,8 +559,9 @@ static int magicmouse_probe(struct hid_device *hdev, | |||
552 | * but there seems to be no other way of switching the mode. | 559 | * but there seems to be no other way of switching the mode. |
553 | * Thus the super-ugly hacky success check below. | 560 | * Thus the super-ugly hacky success check below. |
554 | */ | 561 | */ |
555 | ret = hid_hw_raw_request(hdev, feature[0], feature, sizeof(feature), | 562 | ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(feature), |
556 | HID_FEATURE_REPORT, HID_REQ_SET_REPORT); | 563 | HID_FEATURE_REPORT, HID_REQ_SET_REPORT); |
564 | kfree(buf); | ||
557 | if (ret != -EIO && ret != sizeof(feature)) { | 565 | if (ret != -EIO && ret != sizeof(feature)) { |
558 | hid_err(hdev, "unable to request touch data (%d)\n", ret); | 566 | hid_err(hdev, "unable to request touch data (%d)\n", ret); |
559 | goto err_stop_hw; | 567 | goto err_stop_hw; |
diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c index 9cd2ca34a6be..be89bcbf6a71 100644 --- a/drivers/hid/hid-rmi.c +++ b/drivers/hid/hid-rmi.c | |||
@@ -188,10 +188,16 @@ static int rmi_set_page(struct hid_device *hdev, u8 page) | |||
188 | static int rmi_set_mode(struct hid_device *hdev, u8 mode) | 188 | static int rmi_set_mode(struct hid_device *hdev, u8 mode) |
189 | { | 189 | { |
190 | int ret; | 190 | int ret; |
191 | u8 txbuf[2] = {RMI_SET_RMI_MODE_REPORT_ID, mode}; | 191 | const u8 txbuf[2] = {RMI_SET_RMI_MODE_REPORT_ID, mode}; |
192 | u8 *buf; | ||
192 | 193 | ||
193 | ret = hid_hw_raw_request(hdev, RMI_SET_RMI_MODE_REPORT_ID, txbuf, | 194 | buf = kmemdup(txbuf, sizeof(txbuf), GFP_KERNEL); |
195 | if (!buf) | ||
196 | return -ENOMEM; | ||
197 | |||
198 | ret = hid_hw_raw_request(hdev, RMI_SET_RMI_MODE_REPORT_ID, buf, | ||
194 | sizeof(txbuf), HID_FEATURE_REPORT, HID_REQ_SET_REPORT); | 199 | sizeof(txbuf), HID_FEATURE_REPORT, HID_REQ_SET_REPORT); |
200 | kfree(buf); | ||
195 | if (ret < 0) { | 201 | if (ret < 0) { |
196 | dev_err(&hdev->dev, "unable to set rmi mode to %d (%d)\n", mode, | 202 | dev_err(&hdev->dev, "unable to set rmi mode to %d (%d)\n", mode, |
197 | ret); | 203 | ret); |
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c index c5c3d6111729..60875625cbdf 100644 --- a/drivers/hid/hid-sensor-hub.c +++ b/drivers/hid/hid-sensor-hub.c | |||
@@ -212,6 +212,7 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, | |||
212 | __s32 value; | 212 | __s32 value; |
213 | int ret = 0; | 213 | int ret = 0; |
214 | 214 | ||
215 | memset(buffer, 0, buffer_size); | ||
215 | mutex_lock(&data->mutex); | 216 | mutex_lock(&data->mutex); |
216 | report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT); | 217 | report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT); |
217 | if (!report || (field_index >= report->maxfield)) { | 218 | if (!report || (field_index >= report->maxfield)) { |
diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c index 11e866d05368..b403fa5ecf49 100644 --- a/drivers/i2c/busses/i2c-designware-core.c +++ b/drivers/i2c/busses/i2c-designware-core.c | |||
@@ -91,9 +91,7 @@ | |||
91 | DW_IC_INTR_TX_ABRT | \ | 91 | DW_IC_INTR_TX_ABRT | \ |
92 | DW_IC_INTR_STOP_DET) | 92 | DW_IC_INTR_STOP_DET) |
93 | 93 | ||
94 | #define DW_IC_STATUS_ACTIVITY 0x1 | 94 | #define DW_IC_STATUS_ACTIVITY 0x1 |
95 | #define DW_IC_STATUS_TFE BIT(2) | ||
96 | #define DW_IC_STATUS_MST_ACTIVITY BIT(5) | ||
97 | 95 | ||
98 | #define DW_IC_SDA_HOLD_RX_SHIFT 16 | 96 | #define DW_IC_SDA_HOLD_RX_SHIFT 16 |
99 | #define DW_IC_SDA_HOLD_RX_MASK GENMASK(23, DW_IC_SDA_HOLD_RX_SHIFT) | 97 | #define DW_IC_SDA_HOLD_RX_MASK GENMASK(23, DW_IC_SDA_HOLD_RX_SHIFT) |
@@ -478,25 +476,9 @@ static void i2c_dw_xfer_init(struct dw_i2c_dev *dev) | |||
478 | { | 476 | { |
479 | struct i2c_msg *msgs = dev->msgs; | 477 | struct i2c_msg *msgs = dev->msgs; |
480 | u32 ic_tar = 0; | 478 | u32 ic_tar = 0; |
481 | bool enabled; | ||
482 | 479 | ||
483 | enabled = dw_readl(dev, DW_IC_ENABLE_STATUS) & 1; | 480 | /* Disable the adapter */ |
484 | 481 | __i2c_dw_enable_and_wait(dev, false); | |
485 | if (enabled) { | ||
486 | u32 ic_status; | ||
487 | |||
488 | /* | ||
489 | * Only disable adapter if ic_tar and ic_con can't be | ||
490 | * dynamically updated | ||
491 | */ | ||
492 | ic_status = dw_readl(dev, DW_IC_STATUS); | ||
493 | if (!dev->dynamic_tar_update_enabled || | ||
494 | (ic_status & DW_IC_STATUS_MST_ACTIVITY) || | ||
495 | !(ic_status & DW_IC_STATUS_TFE)) { | ||
496 | __i2c_dw_enable_and_wait(dev, false); | ||
497 | enabled = false; | ||
498 | } | ||
499 | } | ||
500 | 482 | ||
501 | /* if the slave address is ten bit address, enable 10BITADDR */ | 483 | /* if the slave address is ten bit address, enable 10BITADDR */ |
502 | if (dev->dynamic_tar_update_enabled) { | 484 | if (dev->dynamic_tar_update_enabled) { |
@@ -526,8 +508,8 @@ static void i2c_dw_xfer_init(struct dw_i2c_dev *dev) | |||
526 | /* enforce disabled interrupts (due to HW issues) */ | 508 | /* enforce disabled interrupts (due to HW issues) */ |
527 | i2c_dw_disable_int(dev); | 509 | i2c_dw_disable_int(dev); |
528 | 510 | ||
529 | if (!enabled) | 511 | /* Enable the adapter */ |
530 | __i2c_dw_enable(dev, true); | 512 | __i2c_dw_enable(dev, true); |
531 | 513 | ||
532 | /* Clear and enable interrupts */ | 514 | /* Clear and enable interrupts */ |
533 | dw_readl(dev, DW_IC_CLR_INTR); | 515 | dw_readl(dev, DW_IC_CLR_INTR); |
@@ -611,7 +593,7 @@ i2c_dw_xfer_msg(struct dw_i2c_dev *dev) | |||
611 | if (msgs[dev->msg_write_idx].flags & I2C_M_RD) { | 593 | if (msgs[dev->msg_write_idx].flags & I2C_M_RD) { |
612 | 594 | ||
613 | /* avoid rx buffer overrun */ | 595 | /* avoid rx buffer overrun */ |
614 | if (rx_limit - dev->rx_outstanding <= 0) | 596 | if (dev->rx_outstanding >= dev->rx_fifo_depth) |
615 | break; | 597 | break; |
616 | 598 | ||
617 | dw_writel(dev, cmd | 0x100, DW_IC_DATA_CMD); | 599 | dw_writel(dev, cmd | 0x100, DW_IC_DATA_CMD); |
@@ -708,8 +690,7 @@ static int i2c_dw_handle_tx_abort(struct dw_i2c_dev *dev) | |||
708 | } | 690 | } |
709 | 691 | ||
710 | /* | 692 | /* |
711 | * Prepare controller for a transaction and start transfer by calling | 693 | * Prepare controller for a transaction and call i2c_dw_xfer_msg |
712 | * i2c_dw_xfer_init() | ||
713 | */ | 694 | */ |
714 | static int | 695 | static int |
715 | i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) | 696 | i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) |
@@ -752,13 +733,23 @@ i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) | |||
752 | goto done; | 733 | goto done; |
753 | } | 734 | } |
754 | 735 | ||
736 | /* | ||
737 | * We must disable the adapter before returning and signaling the end | ||
738 | * of the current transfer. Otherwise the hardware might continue | ||
739 | * generating interrupts which in turn causes a race condition with | ||
740 | * the following transfer. Needs some more investigation if the | ||
741 | * additional interrupts are a hardware bug or this driver doesn't | ||
742 | * handle them correctly yet. | ||
743 | */ | ||
744 | __i2c_dw_enable(dev, false); | ||
745 | |||
755 | if (dev->msg_err) { | 746 | if (dev->msg_err) { |
756 | ret = dev->msg_err; | 747 | ret = dev->msg_err; |
757 | goto done; | 748 | goto done; |
758 | } | 749 | } |
759 | 750 | ||
760 | /* no error */ | 751 | /* no error */ |
761 | if (likely(!dev->cmd_err)) { | 752 | if (likely(!dev->cmd_err && !dev->status)) { |
762 | ret = num; | 753 | ret = num; |
763 | goto done; | 754 | goto done; |
764 | } | 755 | } |
@@ -768,6 +759,11 @@ i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) | |||
768 | ret = i2c_dw_handle_tx_abort(dev); | 759 | ret = i2c_dw_handle_tx_abort(dev); |
769 | goto done; | 760 | goto done; |
770 | } | 761 | } |
762 | |||
763 | if (dev->status) | ||
764 | dev_err(dev->dev, | ||
765 | "transfer terminated early - interrupt latency too high?\n"); | ||
766 | |||
771 | ret = -EIO; | 767 | ret = -EIO; |
772 | 768 | ||
773 | done: | 769 | done: |
@@ -888,19 +884,9 @@ static irqreturn_t i2c_dw_isr(int this_irq, void *dev_id) | |||
888 | */ | 884 | */ |
889 | 885 | ||
890 | tx_aborted: | 886 | tx_aborted: |
891 | if ((stat & (DW_IC_INTR_TX_ABRT | DW_IC_INTR_STOP_DET)) | 887 | if ((stat & (DW_IC_INTR_TX_ABRT | DW_IC_INTR_STOP_DET)) || dev->msg_err) |
892 | || dev->msg_err) { | ||
893 | /* | ||
894 | * We must disable interruts before returning and signaling | ||
895 | * the end of the current transfer. Otherwise the hardware | ||
896 | * might continue generating interrupts for non-existent | ||
897 | * transfers. | ||
898 | */ | ||
899 | i2c_dw_disable_int(dev); | ||
900 | dw_readl(dev, DW_IC_CLR_INTR); | ||
901 | |||
902 | complete(&dev->cmd_complete); | 888 | complete(&dev->cmd_complete); |
903 | } else if (unlikely(dev->accessor_flags & ACCESS_INTR_MASK)) { | 889 | else if (unlikely(dev->accessor_flags & ACCESS_INTR_MASK)) { |
904 | /* workaround to trigger pending interrupt */ | 890 | /* workaround to trigger pending interrupt */ |
905 | stat = dw_readl(dev, DW_IC_INTR_MASK); | 891 | stat = dw_readl(dev, DW_IC_INTR_MASK); |
906 | i2c_dw_disable_int(dev); | 892 | i2c_dw_disable_int(dev); |
diff --git a/drivers/media/tuners/tuner-xc2028.c b/drivers/media/tuners/tuner-xc2028.c index 317ef63ee789..8d96a22647b3 100644 --- a/drivers/media/tuners/tuner-xc2028.c +++ b/drivers/media/tuners/tuner-xc2028.c | |||
@@ -281,6 +281,14 @@ static void free_firmware(struct xc2028_data *priv) | |||
281 | int i; | 281 | int i; |
282 | tuner_dbg("%s called\n", __func__); | 282 | tuner_dbg("%s called\n", __func__); |
283 | 283 | ||
284 | /* free allocated f/w string */ | ||
285 | if (priv->fname != firmware_name) | ||
286 | kfree(priv->fname); | ||
287 | priv->fname = NULL; | ||
288 | |||
289 | priv->state = XC2028_NO_FIRMWARE; | ||
290 | memset(&priv->cur_fw, 0, sizeof(priv->cur_fw)); | ||
291 | |||
284 | if (!priv->firm) | 292 | if (!priv->firm) |
285 | return; | 293 | return; |
286 | 294 | ||
@@ -291,9 +299,6 @@ static void free_firmware(struct xc2028_data *priv) | |||
291 | 299 | ||
292 | priv->firm = NULL; | 300 | priv->firm = NULL; |
293 | priv->firm_size = 0; | 301 | priv->firm_size = 0; |
294 | priv->state = XC2028_NO_FIRMWARE; | ||
295 | |||
296 | memset(&priv->cur_fw, 0, sizeof(priv->cur_fw)); | ||
297 | } | 302 | } |
298 | 303 | ||
299 | static int load_all_firmwares(struct dvb_frontend *fe, | 304 | static int load_all_firmwares(struct dvb_frontend *fe, |
@@ -884,9 +889,8 @@ read_not_reliable: | |||
884 | return 0; | 889 | return 0; |
885 | 890 | ||
886 | fail: | 891 | fail: |
887 | priv->state = XC2028_NO_FIRMWARE; | 892 | free_firmware(priv); |
888 | 893 | ||
889 | memset(&priv->cur_fw, 0, sizeof(priv->cur_fw)); | ||
890 | if (retry_count < 8) { | 894 | if (retry_count < 8) { |
891 | msleep(50); | 895 | msleep(50); |
892 | retry_count++; | 896 | retry_count++; |
@@ -1332,11 +1336,8 @@ static int xc2028_dvb_release(struct dvb_frontend *fe) | |||
1332 | mutex_lock(&xc2028_list_mutex); | 1336 | mutex_lock(&xc2028_list_mutex); |
1333 | 1337 | ||
1334 | /* only perform final cleanup if this is the last instance */ | 1338 | /* only perform final cleanup if this is the last instance */ |
1335 | if (hybrid_tuner_report_instance_count(priv) == 1) { | 1339 | if (hybrid_tuner_report_instance_count(priv) == 1) |
1336 | free_firmware(priv); | 1340 | free_firmware(priv); |
1337 | kfree(priv->ctrl.fname); | ||
1338 | priv->ctrl.fname = NULL; | ||
1339 | } | ||
1340 | 1341 | ||
1341 | if (priv) | 1342 | if (priv) |
1342 | hybrid_tuner_release_state(priv); | 1343 | hybrid_tuner_release_state(priv); |
@@ -1399,19 +1400,8 @@ static int xc2028_set_config(struct dvb_frontend *fe, void *priv_cfg) | |||
1399 | 1400 | ||
1400 | /* | 1401 | /* |
1401 | * Copy the config data. | 1402 | * Copy the config data. |
1402 | * For the firmware name, keep a local copy of the string, | ||
1403 | * in order to avoid troubles during device release. | ||
1404 | */ | 1403 | */ |
1405 | kfree(priv->ctrl.fname); | ||
1406 | priv->ctrl.fname = NULL; | ||
1407 | memcpy(&priv->ctrl, p, sizeof(priv->ctrl)); | 1404 | memcpy(&priv->ctrl, p, sizeof(priv->ctrl)); |
1408 | if (p->fname) { | ||
1409 | priv->ctrl.fname = kstrdup(p->fname, GFP_KERNEL); | ||
1410 | if (priv->ctrl.fname == NULL) { | ||
1411 | rc = -ENOMEM; | ||
1412 | goto unlock; | ||
1413 | } | ||
1414 | } | ||
1415 | 1405 | ||
1416 | /* | 1406 | /* |
1417 | * If firmware name changed, frees firmware. As free_firmware will | 1407 | * If firmware name changed, frees firmware. As free_firmware will |
@@ -1426,10 +1416,15 @@ static int xc2028_set_config(struct dvb_frontend *fe, void *priv_cfg) | |||
1426 | 1416 | ||
1427 | if (priv->state == XC2028_NO_FIRMWARE) { | 1417 | if (priv->state == XC2028_NO_FIRMWARE) { |
1428 | if (!firmware_name[0]) | 1418 | if (!firmware_name[0]) |
1429 | priv->fname = priv->ctrl.fname; | 1419 | priv->fname = kstrdup(p->fname, GFP_KERNEL); |
1430 | else | 1420 | else |
1431 | priv->fname = firmware_name; | 1421 | priv->fname = firmware_name; |
1432 | 1422 | ||
1423 | if (!priv->fname) { | ||
1424 | rc = -ENOMEM; | ||
1425 | goto unlock; | ||
1426 | } | ||
1427 | |||
1433 | rc = request_firmware_nowait(THIS_MODULE, 1, | 1428 | rc = request_firmware_nowait(THIS_MODULE, 1, |
1434 | priv->fname, | 1429 | priv->fname, |
1435 | priv->i2c_props.adap->dev.parent, | 1430 | priv->i2c_props.adap->dev.parent, |
diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c index 2f2225e845ef..b93fe4c4957a 100644 --- a/drivers/mfd/syscon.c +++ b/drivers/mfd/syscon.c | |||
@@ -73,8 +73,10 @@ static struct syscon *of_syscon_register(struct device_node *np) | |||
73 | /* Parse the device's DT node for an endianness specification */ | 73 | /* Parse the device's DT node for an endianness specification */ |
74 | if (of_property_read_bool(np, "big-endian")) | 74 | if (of_property_read_bool(np, "big-endian")) |
75 | syscon_config.val_format_endian = REGMAP_ENDIAN_BIG; | 75 | syscon_config.val_format_endian = REGMAP_ENDIAN_BIG; |
76 | else if (of_property_read_bool(np, "little-endian")) | 76 | else if (of_property_read_bool(np, "little-endian")) |
77 | syscon_config.val_format_endian = REGMAP_ENDIAN_LITTLE; | 77 | syscon_config.val_format_endian = REGMAP_ENDIAN_LITTLE; |
78 | else if (of_property_read_bool(np, "native-endian")) | ||
79 | syscon_config.val_format_endian = REGMAP_ENDIAN_NATIVE; | ||
78 | 80 | ||
79 | /* | 81 | /* |
80 | * search for reg-io-width property in DT. If it is not provided, | 82 | * search for reg-io-width property in DT. If it is not provided, |
diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c index 7eec619a6023..8588dbad3301 100644 --- a/drivers/mfd/wm8994-core.c +++ b/drivers/mfd/wm8994-core.c | |||
@@ -393,8 +393,13 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq) | |||
393 | BUG(); | 393 | BUG(); |
394 | goto err; | 394 | goto err; |
395 | } | 395 | } |
396 | 396 | ||
397 | ret = devm_regulator_bulk_get(wm8994->dev, wm8994->num_supplies, | 397 | /* |
398 | * Can't use devres helper here as some of the supplies are provided by | ||
399 | * wm8994->dev's children (regulators) and those regulators are | ||
400 | * unregistered by the devres core before the supplies are freed. | ||
401 | */ | ||
402 | ret = regulator_bulk_get(wm8994->dev, wm8994->num_supplies, | ||
398 | wm8994->supplies); | 403 | wm8994->supplies); |
399 | if (ret != 0) { | 404 | if (ret != 0) { |
400 | dev_err(wm8994->dev, "Failed to get supplies: %d\n", ret); | 405 | dev_err(wm8994->dev, "Failed to get supplies: %d\n", ret); |
@@ -405,7 +410,7 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq) | |||
405 | wm8994->supplies); | 410 | wm8994->supplies); |
406 | if (ret != 0) { | 411 | if (ret != 0) { |
407 | dev_err(wm8994->dev, "Failed to enable supplies: %d\n", ret); | 412 | dev_err(wm8994->dev, "Failed to enable supplies: %d\n", ret); |
408 | goto err; | 413 | goto err_regulator_free; |
409 | } | 414 | } |
410 | 415 | ||
411 | ret = wm8994_reg_read(wm8994, WM8994_SOFTWARE_RESET); | 416 | ret = wm8994_reg_read(wm8994, WM8994_SOFTWARE_RESET); |
@@ -596,6 +601,8 @@ err_irq: | |||
596 | err_enable: | 601 | err_enable: |
597 | regulator_bulk_disable(wm8994->num_supplies, | 602 | regulator_bulk_disable(wm8994->num_supplies, |
598 | wm8994->supplies); | 603 | wm8994->supplies); |
604 | err_regulator_free: | ||
605 | regulator_bulk_free(wm8994->num_supplies, wm8994->supplies); | ||
599 | err: | 606 | err: |
600 | mfd_remove_devices(wm8994->dev); | 607 | mfd_remove_devices(wm8994->dev); |
601 | return ret; | 608 | return ret; |
@@ -604,10 +611,11 @@ err: | |||
604 | static void wm8994_device_exit(struct wm8994 *wm8994) | 611 | static void wm8994_device_exit(struct wm8994 *wm8994) |
605 | { | 612 | { |
606 | pm_runtime_disable(wm8994->dev); | 613 | pm_runtime_disable(wm8994->dev); |
607 | mfd_remove_devices(wm8994->dev); | ||
608 | wm8994_irq_exit(wm8994); | 614 | wm8994_irq_exit(wm8994); |
609 | regulator_bulk_disable(wm8994->num_supplies, | 615 | regulator_bulk_disable(wm8994->num_supplies, |
610 | wm8994->supplies); | 616 | wm8994->supplies); |
617 | regulator_bulk_free(wm8994->num_supplies, wm8994->supplies); | ||
618 | mfd_remove_devices(wm8994->dev); | ||
611 | } | 619 | } |
612 | 620 | ||
613 | static const struct of_device_id wm8994_of_match[] = { | 621 | static const struct of_device_id wm8994_of_match[] = { |
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 50a674be6655..df478ae72e23 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c | |||
@@ -1058,6 +1058,7 @@ static int dw_mci_submit_data_dma(struct dw_mci *host, struct mmc_data *data) | |||
1058 | spin_unlock_irqrestore(&host->irq_lock, irqflags); | 1058 | spin_unlock_irqrestore(&host->irq_lock, irqflags); |
1059 | 1059 | ||
1060 | if (host->dma_ops->start(host, sg_len)) { | 1060 | if (host->dma_ops->start(host, sg_len)) { |
1061 | host->dma_ops->stop(host); | ||
1061 | /* We can't do DMA, try PIO for this one */ | 1062 | /* We can't do DMA, try PIO for this one */ |
1062 | dev_dbg(host->dev, | 1063 | dev_dbg(host->dev, |
1063 | "%s: fall back to PIO mode for current transfer\n", | 1064 | "%s: fall back to PIO mode for current transfer\n", |
diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c index fb71c866eacc..1bb11e4a9fe5 100644 --- a/drivers/mmc/host/sdhci-of-esdhc.c +++ b/drivers/mmc/host/sdhci-of-esdhc.c | |||
@@ -66,6 +66,20 @@ static u32 esdhc_readl_fixup(struct sdhci_host *host, | |||
66 | return ret; | 66 | return ret; |
67 | } | 67 | } |
68 | } | 68 | } |
69 | /* | ||
70 | * The DAT[3:0] line signal levels and the CMD line signal level are | ||
71 | * not compatible with standard SDHC register. The line signal levels | ||
72 | * DAT[7:0] are at bits 31:24 and the command line signal level is at | ||
73 | * bit 23. All other bits are the same as in the standard SDHC | ||
74 | * register. | ||
75 | */ | ||
76 | if (spec_reg == SDHCI_PRESENT_STATE) { | ||
77 | ret = value & 0x000fffff; | ||
78 | ret |= (value >> 4) & SDHCI_DATA_LVL_MASK; | ||
79 | ret |= (value << 1) & SDHCI_CMD_LVL; | ||
80 | return ret; | ||
81 | } | ||
82 | |||
69 | ret = value; | 83 | ret = value; |
70 | return ret; | 84 | return ret; |
71 | } | 85 | } |
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 766df17fb7eb..2570455b219a 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h | |||
@@ -73,6 +73,7 @@ | |||
73 | #define SDHCI_DATA_LVL_MASK 0x00F00000 | 73 | #define SDHCI_DATA_LVL_MASK 0x00F00000 |
74 | #define SDHCI_DATA_LVL_SHIFT 20 | 74 | #define SDHCI_DATA_LVL_SHIFT 20 |
75 | #define SDHCI_DATA_0_LVL_MASK 0x00100000 | 75 | #define SDHCI_DATA_0_LVL_MASK 0x00100000 |
76 | #define SDHCI_CMD_LVL 0x01000000 | ||
76 | 77 | ||
77 | #define SDHCI_HOST_CONTROL 0x28 | 78 | #define SDHCI_HOST_CONTROL 0x28 |
78 | #define SDHCI_CTRL_LED 0x01 | 79 | #define SDHCI_CTRL_LED 0x01 |
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 8c7bdbe66313..0e4f168bea9e 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c | |||
@@ -1812,6 +1812,9 @@ static int bnxt_busy_poll(struct napi_struct *napi) | |||
1812 | if (atomic_read(&bp->intr_sem) != 0) | 1812 | if (atomic_read(&bp->intr_sem) != 0) |
1813 | return LL_FLUSH_FAILED; | 1813 | return LL_FLUSH_FAILED; |
1814 | 1814 | ||
1815 | if (!bp->link_info.link_up) | ||
1816 | return LL_FLUSH_FAILED; | ||
1817 | |||
1815 | if (!bnxt_lock_poll(bnapi)) | 1818 | if (!bnxt_lock_poll(bnapi)) |
1816 | return LL_FLUSH_BUSY; | 1819 | return LL_FLUSH_BUSY; |
1817 | 1820 | ||
@@ -3211,11 +3214,17 @@ static int bnxt_hwrm_tunnel_dst_port_alloc(struct bnxt *bp, __be16 port, | |||
3211 | goto err_out; | 3214 | goto err_out; |
3212 | } | 3215 | } |
3213 | 3216 | ||
3214 | if (tunnel_type & TUNNEL_DST_PORT_ALLOC_REQ_TUNNEL_TYPE_VXLAN) | 3217 | switch (tunnel_type) { |
3218 | case TUNNEL_DST_PORT_ALLOC_REQ_TUNNEL_TYPE_VXLAN: | ||
3215 | bp->vxlan_fw_dst_port_id = resp->tunnel_dst_port_id; | 3219 | bp->vxlan_fw_dst_port_id = resp->tunnel_dst_port_id; |
3216 | 3220 | break; | |
3217 | else if (tunnel_type & TUNNEL_DST_PORT_ALLOC_REQ_TUNNEL_TYPE_GENEVE) | 3221 | case TUNNEL_DST_PORT_ALLOC_REQ_TUNNEL_TYPE_GENEVE: |
3218 | bp->nge_fw_dst_port_id = resp->tunnel_dst_port_id; | 3222 | bp->nge_fw_dst_port_id = resp->tunnel_dst_port_id; |
3223 | break; | ||
3224 | default: | ||
3225 | break; | ||
3226 | } | ||
3227 | |||
3219 | err_out: | 3228 | err_out: |
3220 | mutex_unlock(&bp->hwrm_cmd_lock); | 3229 | mutex_unlock(&bp->hwrm_cmd_lock); |
3221 | return rc; | 3230 | return rc; |
diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c b/drivers/net/ethernet/freescale/fman/fman_tgec.c index efabb04a1ae8..4b0f3a50b293 100644 --- a/drivers/net/ethernet/freescale/fman/fman_tgec.c +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c | |||
@@ -722,9 +722,6 @@ int tgec_free(struct fman_mac *tgec) | |||
722 | { | 722 | { |
723 | free_init_resources(tgec); | 723 | free_init_resources(tgec); |
724 | 724 | ||
725 | if (tgec->cfg) | ||
726 | tgec->cfg = NULL; | ||
727 | |||
728 | kfree(tgec->cfg); | 725 | kfree(tgec->cfg); |
729 | kfree(tgec); | 726 | kfree(tgec); |
730 | 727 | ||
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index 1e486d1312e9..c12596676bbb 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c | |||
@@ -74,7 +74,6 @@ | |||
74 | #include <asm/iommu.h> | 74 | #include <asm/iommu.h> |
75 | #include <linux/uaccess.h> | 75 | #include <linux/uaccess.h> |
76 | #include <asm/firmware.h> | 76 | #include <asm/firmware.h> |
77 | #include <linux/seq_file.h> | ||
78 | #include <linux/workqueue.h> | 77 | #include <linux/workqueue.h> |
79 | 78 | ||
80 | #include "ibmvnic.h" | 79 | #include "ibmvnic.h" |
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index 87274d4ab102..0a24571e44b9 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c | |||
@@ -4131,7 +4131,7 @@ static int mvneta_probe(struct platform_device *pdev) | |||
4131 | dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO; | 4131 | dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO; |
4132 | dev->hw_features |= dev->features; | 4132 | dev->hw_features |= dev->features; |
4133 | dev->vlan_features |= dev->features; | 4133 | dev->vlan_features |= dev->features; |
4134 | dev->priv_flags |= IFF_UNICAST_FLT | IFF_LIVE_ADDR_CHANGE; | 4134 | dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; |
4135 | dev->gso_max_segs = MVNETA_MAX_TSO_SEGS; | 4135 | dev->gso_max_segs = MVNETA_MAX_TSO_SEGS; |
4136 | 4136 | ||
4137 | /* MTU range: 68 - 9676 */ | 4137 | /* MTU range: 68 - 9676 */ |
diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c index ee857868bea5..dabc5418efcc 100644 --- a/drivers/net/ethernet/marvell/mvpp2.c +++ b/drivers/net/ethernet/marvell/mvpp2.c | |||
@@ -3293,7 +3293,7 @@ static void mvpp2_cls_init(struct mvpp2 *priv) | |||
3293 | mvpp2_write(priv, MVPP2_CLS_MODE_REG, MVPP2_CLS_MODE_ACTIVE_MASK); | 3293 | mvpp2_write(priv, MVPP2_CLS_MODE_REG, MVPP2_CLS_MODE_ACTIVE_MASK); |
3294 | 3294 | ||
3295 | /* Clear classifier flow table */ | 3295 | /* Clear classifier flow table */ |
3296 | memset(&fe.data, 0, MVPP2_CLS_FLOWS_TBL_DATA_WORDS); | 3296 | memset(&fe.data, 0, sizeof(fe.data)); |
3297 | for (index = 0; index < MVPP2_CLS_FLOWS_TBL_SIZE; index++) { | 3297 | for (index = 0; index < MVPP2_CLS_FLOWS_TBL_SIZE; index++) { |
3298 | fe.index = index; | 3298 | fe.index = index; |
3299 | mvpp2_cls_flow_write(priv, &fe); | 3299 | mvpp2_cls_flow_write(priv, &fe); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 9018bb1b2e12..c48ce3f366c3 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -129,6 +129,9 @@ static enum mlx4_net_trans_rule_id mlx4_ip_proto_to_trans_rule_id(u8 ip_proto) | |||
129 | } | 129 | } |
130 | }; | 130 | }; |
131 | 131 | ||
132 | /* Must not acquire state_lock, as its corresponding work_sync | ||
133 | * is done under it. | ||
134 | */ | ||
132 | static void mlx4_en_filter_work(struct work_struct *work) | 135 | static void mlx4_en_filter_work(struct work_struct *work) |
133 | { | 136 | { |
134 | struct mlx4_en_filter *filter = container_of(work, | 137 | struct mlx4_en_filter *filter = container_of(work, |
@@ -2239,13 +2242,13 @@ void mlx4_en_destroy_netdev(struct net_device *dev) | |||
2239 | mutex_lock(&mdev->state_lock); | 2242 | mutex_lock(&mdev->state_lock); |
2240 | mdev->pndev[priv->port] = NULL; | 2243 | mdev->pndev[priv->port] = NULL; |
2241 | mdev->upper[priv->port] = NULL; | 2244 | mdev->upper[priv->port] = NULL; |
2242 | mutex_unlock(&mdev->state_lock); | ||
2243 | 2245 | ||
2244 | #ifdef CONFIG_RFS_ACCEL | 2246 | #ifdef CONFIG_RFS_ACCEL |
2245 | mlx4_en_cleanup_filters(priv); | 2247 | mlx4_en_cleanup_filters(priv); |
2246 | #endif | 2248 | #endif |
2247 | 2249 | ||
2248 | mlx4_en_free_resources(priv); | 2250 | mlx4_en_free_resources(priv); |
2251 | mutex_unlock(&mdev->state_lock); | ||
2249 | 2252 | ||
2250 | for (t = 0; t < MLX4_EN_NUM_TX_TYPES; t++) { | 2253 | for (t = 0; t < MLX4_EN_NUM_TX_TYPES; t++) { |
2251 | kfree(priv->tx_ring[t]); | 2254 | kfree(priv->tx_ring[t]); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index b440a16101d2..2dc28695196c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c | |||
@@ -46,7 +46,6 @@ | |||
46 | #include <linux/mlx5/srq.h> | 46 | #include <linux/mlx5/srq.h> |
47 | #include <linux/debugfs.h> | 47 | #include <linux/debugfs.h> |
48 | #include <linux/kmod.h> | 48 | #include <linux/kmod.h> |
49 | #include <linux/delay.h> | ||
50 | #include <linux/mlx5/mlx5_ifc.h> | 49 | #include <linux/mlx5/mlx5_ifc.h> |
51 | #ifdef CONFIG_RFS_ACCEL | 50 | #ifdef CONFIG_RFS_ACCEL |
52 | #include <linux/cpu_rmap.h> | 51 | #include <linux/cpu_rmap.h> |
diff --git a/drivers/net/ethernet/synopsys/dwc_eth_qos.c b/drivers/net/ethernet/synopsys/dwc_eth_qos.c index 70533017aaa7..acce385f69d4 100644 --- a/drivers/net/ethernet/synopsys/dwc_eth_qos.c +++ b/drivers/net/ethernet/synopsys/dwc_eth_qos.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <linux/stat.h> | 33 | #include <linux/stat.h> |
34 | #include <linux/types.h> | 34 | #include <linux/types.h> |
35 | 35 | ||
36 | #include <linux/types.h> | ||
37 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
38 | #include <linux/delay.h> | 37 | #include <linux/delay.h> |
39 | #include <linux/mm.h> | 38 | #include <linux/mm.h> |
@@ -43,7 +42,6 @@ | |||
43 | 42 | ||
44 | #include <linux/phy.h> | 43 | #include <linux/phy.h> |
45 | #include <linux/mii.h> | 44 | #include <linux/mii.h> |
46 | #include <linux/delay.h> | ||
47 | #include <linux/dma-mapping.h> | 45 | #include <linux/dma-mapping.h> |
48 | #include <linux/vmalloc.h> | 46 | #include <linux/vmalloc.h> |
49 | 47 | ||
diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c index 4ff4c7d4b5e0..3e4c8b21403c 100644 --- a/drivers/net/ieee802154/adf7242.c +++ b/drivers/net/ieee802154/adf7242.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/skbuff.h> | 20 | #include <linux/skbuff.h> |
21 | #include <linux/of.h> | 21 | #include <linux/of.h> |
22 | #include <linux/irq.h> | 22 | #include <linux/irq.h> |
23 | #include <linux/delay.h> | ||
24 | #include <linux/debugfs.h> | 23 | #include <linux/debugfs.h> |
25 | #include <linux/bitops.h> | 24 | #include <linux/bitops.h> |
26 | #include <linux/ieee802154.h> | 25 | #include <linux/ieee802154.h> |
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 7ddfd2c917ea..3c0a1714977b 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -622,7 +622,8 @@ hash_add: | |||
622 | return 0; | 622 | return 0; |
623 | 623 | ||
624 | clear_multi: | 624 | clear_multi: |
625 | dev_set_allmulti(lowerdev, -1); | 625 | if (dev->flags & IFF_ALLMULTI) |
626 | dev_set_allmulti(lowerdev, -1); | ||
626 | del_unicast: | 627 | del_unicast: |
627 | dev_uc_del(lowerdev, dev->dev_addr); | 628 | dev_uc_del(lowerdev, dev->dev_addr); |
628 | out: | 629 | out: |
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 081df68d2ce1..ea92d524d5a8 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c | |||
@@ -318,12 +318,12 @@ static int ksz8041_config_init(struct phy_device *phydev) | |||
318 | /* Limit supported and advertised modes in fiber mode */ | 318 | /* Limit supported and advertised modes in fiber mode */ |
319 | if (of_property_read_bool(of_node, "micrel,fiber-mode")) { | 319 | if (of_property_read_bool(of_node, "micrel,fiber-mode")) { |
320 | phydev->dev_flags |= MICREL_PHY_FXEN; | 320 | phydev->dev_flags |= MICREL_PHY_FXEN; |
321 | phydev->supported &= SUPPORTED_FIBRE | | 321 | phydev->supported &= SUPPORTED_100baseT_Full | |
322 | SUPPORTED_100baseT_Full | | ||
323 | SUPPORTED_100baseT_Half; | 322 | SUPPORTED_100baseT_Half; |
324 | phydev->advertising &= ADVERTISED_FIBRE | | 323 | phydev->supported |= SUPPORTED_FIBRE; |
325 | ADVERTISED_100baseT_Full | | 324 | phydev->advertising &= ADVERTISED_100baseT_Full | |
326 | ADVERTISED_100baseT_Half; | 325 | ADVERTISED_100baseT_Half; |
326 | phydev->advertising |= ADVERTISED_FIBRE; | ||
327 | phydev->autoneg = AUTONEG_DISABLE; | 327 | phydev->autoneg = AUTONEG_DISABLE; |
328 | } | 328 | } |
329 | 329 | ||
diff --git a/drivers/phy/phy-twl4030-usb.c b/drivers/phy/phy-twl4030-usb.c index 87e6334eab93..547ca7b3f098 100644 --- a/drivers/phy/phy-twl4030-usb.c +++ b/drivers/phy/phy-twl4030-usb.c | |||
@@ -459,8 +459,6 @@ static int twl4030_phy_power_off(struct phy *phy) | |||
459 | struct twl4030_usb *twl = phy_get_drvdata(phy); | 459 | struct twl4030_usb *twl = phy_get_drvdata(phy); |
460 | 460 | ||
461 | dev_dbg(twl->dev, "%s\n", __func__); | 461 | dev_dbg(twl->dev, "%s\n", __func__); |
462 | pm_runtime_mark_last_busy(twl->dev); | ||
463 | pm_runtime_put_autosuspend(twl->dev); | ||
464 | 462 | ||
465 | return 0; | 463 | return 0; |
466 | } | 464 | } |
@@ -472,6 +470,8 @@ static int twl4030_phy_power_on(struct phy *phy) | |||
472 | dev_dbg(twl->dev, "%s\n", __func__); | 470 | dev_dbg(twl->dev, "%s\n", __func__); |
473 | pm_runtime_get_sync(twl->dev); | 471 | pm_runtime_get_sync(twl->dev); |
474 | schedule_delayed_work(&twl->id_workaround_work, HZ); | 472 | schedule_delayed_work(&twl->id_workaround_work, HZ); |
473 | pm_runtime_mark_last_busy(twl->dev); | ||
474 | pm_runtime_put_autosuspend(twl->dev); | ||
475 | 475 | ||
476 | return 0; | 476 | return 0; |
477 | } | 477 | } |
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index 8aa769a2d919..91b70bc46e7f 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c | |||
@@ -4010,7 +4010,10 @@ _scsih_eedp_error_handling(struct scsi_cmnd *scmd, u16 ioc_status) | |||
4010 | SAM_STAT_CHECK_CONDITION; | 4010 | SAM_STAT_CHECK_CONDITION; |
4011 | } | 4011 | } |
4012 | 4012 | ||
4013 | 4013 | static inline bool ata_12_16_cmd(struct scsi_cmnd *scmd) | |
4014 | { | ||
4015 | return (scmd->cmnd[0] == ATA_12 || scmd->cmnd[0] == ATA_16); | ||
4016 | } | ||
4014 | 4017 | ||
4015 | /** | 4018 | /** |
4016 | * scsih_qcmd - main scsi request entry point | 4019 | * scsih_qcmd - main scsi request entry point |
@@ -4038,6 +4041,13 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd) | |||
4038 | if (ioc->logging_level & MPT_DEBUG_SCSI) | 4041 | if (ioc->logging_level & MPT_DEBUG_SCSI) |
4039 | scsi_print_command(scmd); | 4042 | scsi_print_command(scmd); |
4040 | 4043 | ||
4044 | /* | ||
4045 | * Lock the device for any subsequent command until command is | ||
4046 | * done. | ||
4047 | */ | ||
4048 | if (ata_12_16_cmd(scmd)) | ||
4049 | scsi_internal_device_block(scmd->device); | ||
4050 | |||
4041 | sas_device_priv_data = scmd->device->hostdata; | 4051 | sas_device_priv_data = scmd->device->hostdata; |
4042 | if (!sas_device_priv_data || !sas_device_priv_data->sas_target) { | 4052 | if (!sas_device_priv_data || !sas_device_priv_data->sas_target) { |
4043 | scmd->result = DID_NO_CONNECT << 16; | 4053 | scmd->result = DID_NO_CONNECT << 16; |
@@ -4613,6 +4623,9 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply) | |||
4613 | if (scmd == NULL) | 4623 | if (scmd == NULL) |
4614 | return 1; | 4624 | return 1; |
4615 | 4625 | ||
4626 | if (ata_12_16_cmd(scmd)) | ||
4627 | scsi_internal_device_unblock(scmd->device, SDEV_RUNNING); | ||
4628 | |||
4616 | mpi_request = mpt3sas_base_get_msg_frame(ioc, smid); | 4629 | mpi_request = mpt3sas_base_get_msg_frame(ioc, smid); |
4617 | 4630 | ||
4618 | if (mpi_reply == NULL) { | 4631 | if (mpi_reply == NULL) { |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 567fa080e261..56d6142852a5 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -1456,15 +1456,20 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res) | |||
1456 | for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) { | 1456 | for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) { |
1457 | sp = req->outstanding_cmds[cnt]; | 1457 | sp = req->outstanding_cmds[cnt]; |
1458 | if (sp) { | 1458 | if (sp) { |
1459 | /* Get a reference to the sp and drop the lock. | 1459 | /* Don't abort commands in adapter during EEH |
1460 | * The reference ensures this sp->done() call | 1460 | * recovery as it's not accessible/responding. |
1461 | * - and not the call in qla2xxx_eh_abort() - | ||
1462 | * ends the SCSI command (with result 'res'). | ||
1463 | */ | 1461 | */ |
1464 | sp_get(sp); | 1462 | if (!ha->flags.eeh_busy) { |
1465 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 1463 | /* Get a reference to the sp and drop the lock. |
1466 | qla2xxx_eh_abort(GET_CMD_SP(sp)); | 1464 | * The reference ensures this sp->done() call |
1467 | spin_lock_irqsave(&ha->hardware_lock, flags); | 1465 | * - and not the call in qla2xxx_eh_abort() - |
1466 | * ends the SCSI command (with result 'res'). | ||
1467 | */ | ||
1468 | sp_get(sp); | ||
1469 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | ||
1470 | qla2xxx_eh_abort(GET_CMD_SP(sp)); | ||
1471 | spin_lock_irqsave(&ha->hardware_lock, flags); | ||
1472 | } | ||
1468 | req->outstanding_cmds[cnt] = NULL; | 1473 | req->outstanding_cmds[cnt] = NULL; |
1469 | sp->done(vha, sp, res); | 1474 | sp->done(vha, sp, res); |
1470 | } | 1475 | } |
diff --git a/drivers/thermal/intel_powerclamp.c b/drivers/thermal/intel_powerclamp.c index 7a223074df3d..afada655f861 100644 --- a/drivers/thermal/intel_powerclamp.c +++ b/drivers/thermal/intel_powerclamp.c | |||
@@ -669,9 +669,16 @@ static struct thermal_cooling_device_ops powerclamp_cooling_ops = { | |||
669 | .set_cur_state = powerclamp_set_cur_state, | 669 | .set_cur_state = powerclamp_set_cur_state, |
670 | }; | 670 | }; |
671 | 671 | ||
672 | static const struct x86_cpu_id __initconst intel_powerclamp_ids[] = { | ||
673 | { X86_VENDOR_INTEL, X86_FAMILY_ANY, X86_MODEL_ANY, X86_FEATURE_MWAIT }, | ||
674 | {} | ||
675 | }; | ||
676 | MODULE_DEVICE_TABLE(x86cpu, intel_powerclamp_ids); | ||
677 | |||
672 | static int __init powerclamp_probe(void) | 678 | static int __init powerclamp_probe(void) |
673 | { | 679 | { |
674 | if (!boot_cpu_has(X86_FEATURE_MWAIT)) { | 680 | |
681 | if (!x86_match_cpu(intel_powerclamp_ids)) { | ||
675 | pr_err("CPU does not support MWAIT"); | 682 | pr_err("CPU does not support MWAIT"); |
676 | return -ENODEV; | 683 | return -ENODEV; |
677 | } | 684 | } |
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 69426e644d17..3dbb4a21ab44 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c | |||
@@ -914,6 +914,7 @@ static int ci_hdrc_probe(struct platform_device *pdev) | |||
914 | if (!ci) | 914 | if (!ci) |
915 | return -ENOMEM; | 915 | return -ENOMEM; |
916 | 916 | ||
917 | spin_lock_init(&ci->lock); | ||
917 | ci->dev = dev; | 918 | ci->dev = dev; |
918 | ci->platdata = dev_get_platdata(dev); | 919 | ci->platdata = dev_get_platdata(dev); |
919 | ci->imx28_write_fix = !!(ci->platdata->flags & | 920 | ci->imx28_write_fix = !!(ci->platdata->flags & |
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 661f43fe0f9e..c9e80ad48fdc 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c | |||
@@ -1889,8 +1889,6 @@ static int udc_start(struct ci_hdrc *ci) | |||
1889 | struct usb_otg_caps *otg_caps = &ci->platdata->ci_otg_caps; | 1889 | struct usb_otg_caps *otg_caps = &ci->platdata->ci_otg_caps; |
1890 | int retval = 0; | 1890 | int retval = 0; |
1891 | 1891 | ||
1892 | spin_lock_init(&ci->lock); | ||
1893 | |||
1894 | ci->gadget.ops = &usb_gadget_ops; | 1892 | ci->gadget.ops = &usb_gadget_ops; |
1895 | ci->gadget.speed = USB_SPEED_UNKNOWN; | 1893 | ci->gadget.speed = USB_SPEED_UNKNOWN; |
1896 | ci->gadget.max_speed = USB_SPEED_HIGH; | 1894 | ci->gadget.max_speed = USB_SPEED_HIGH; |
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index e40d47d47d82..17989b72cdae 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c | |||
@@ -3225,11 +3225,11 @@ static bool ffs_func_req_match(struct usb_function *f, | |||
3225 | 3225 | ||
3226 | switch (creq->bRequestType & USB_RECIP_MASK) { | 3226 | switch (creq->bRequestType & USB_RECIP_MASK) { |
3227 | case USB_RECIP_INTERFACE: | 3227 | case USB_RECIP_INTERFACE: |
3228 | return ffs_func_revmap_intf(func, | 3228 | return (ffs_func_revmap_intf(func, |
3229 | le16_to_cpu(creq->wIndex) >= 0); | 3229 | le16_to_cpu(creq->wIndex)) >= 0); |
3230 | case USB_RECIP_ENDPOINT: | 3230 | case USB_RECIP_ENDPOINT: |
3231 | return ffs_func_revmap_ep(func, | 3231 | return (ffs_func_revmap_ep(func, |
3232 | le16_to_cpu(creq->wIndex) >= 0); | 3232 | le16_to_cpu(creq->wIndex)) >= 0); |
3233 | default: | 3233 | default: |
3234 | return (bool) (func->ffs->user_flags & | 3234 | return (bool) (func->ffs->user_flags & |
3235 | FUNCTIONFS_ALL_CTRL_RECIP); | 3235 | FUNCTIONFS_ALL_CTRL_RECIP); |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index e01116e4c067..c3e172e15ec3 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -986,7 +986,7 @@ b_host: | |||
986 | } | 986 | } |
987 | #endif | 987 | #endif |
988 | 988 | ||
989 | schedule_work(&musb->irq_work); | 989 | schedule_delayed_work(&musb->irq_work, 0); |
990 | 990 | ||
991 | return handled; | 991 | return handled; |
992 | } | 992 | } |
@@ -1855,14 +1855,23 @@ static void musb_pm_runtime_check_session(struct musb *musb) | |||
1855 | MUSB_DEVCTL_HR; | 1855 | MUSB_DEVCTL_HR; |
1856 | switch (devctl & ~s) { | 1856 | switch (devctl & ~s) { |
1857 | case MUSB_QUIRK_B_INVALID_VBUS_91: | 1857 | case MUSB_QUIRK_B_INVALID_VBUS_91: |
1858 | if (!musb->session && !musb->quirk_invalid_vbus) { | 1858 | if (musb->quirk_retries--) { |
1859 | musb->quirk_invalid_vbus = true; | ||
1860 | musb_dbg(musb, | 1859 | musb_dbg(musb, |
1861 | "First invalid vbus, assume no session"); | 1860 | "Poll devctl on invalid vbus, assume no session"); |
1861 | schedule_delayed_work(&musb->irq_work, | ||
1862 | msecs_to_jiffies(1000)); | ||
1863 | |||
1862 | return; | 1864 | return; |
1863 | } | 1865 | } |
1864 | break; | ||
1865 | case MUSB_QUIRK_A_DISCONNECT_19: | 1866 | case MUSB_QUIRK_A_DISCONNECT_19: |
1867 | if (musb->quirk_retries--) { | ||
1868 | musb_dbg(musb, | ||
1869 | "Poll devctl on possible host mode disconnect"); | ||
1870 | schedule_delayed_work(&musb->irq_work, | ||
1871 | msecs_to_jiffies(1000)); | ||
1872 | |||
1873 | return; | ||
1874 | } | ||
1866 | if (!musb->session) | 1875 | if (!musb->session) |
1867 | break; | 1876 | break; |
1868 | musb_dbg(musb, "Allow PM on possible host mode disconnect"); | 1877 | musb_dbg(musb, "Allow PM on possible host mode disconnect"); |
@@ -1886,9 +1895,9 @@ static void musb_pm_runtime_check_session(struct musb *musb) | |||
1886 | if (error < 0) | 1895 | if (error < 0) |
1887 | dev_err(musb->controller, "Could not enable: %i\n", | 1896 | dev_err(musb->controller, "Could not enable: %i\n", |
1888 | error); | 1897 | error); |
1898 | musb->quirk_retries = 3; | ||
1889 | } else { | 1899 | } else { |
1890 | musb_dbg(musb, "Allow PM with no session: %02x", devctl); | 1900 | musb_dbg(musb, "Allow PM with no session: %02x", devctl); |
1891 | musb->quirk_invalid_vbus = false; | ||
1892 | pm_runtime_mark_last_busy(musb->controller); | 1901 | pm_runtime_mark_last_busy(musb->controller); |
1893 | pm_runtime_put_autosuspend(musb->controller); | 1902 | pm_runtime_put_autosuspend(musb->controller); |
1894 | } | 1903 | } |
@@ -1899,7 +1908,7 @@ static void musb_pm_runtime_check_session(struct musb *musb) | |||
1899 | /* Only used to provide driver mode change events */ | 1908 | /* Only used to provide driver mode change events */ |
1900 | static void musb_irq_work(struct work_struct *data) | 1909 | static void musb_irq_work(struct work_struct *data) |
1901 | { | 1910 | { |
1902 | struct musb *musb = container_of(data, struct musb, irq_work); | 1911 | struct musb *musb = container_of(data, struct musb, irq_work.work); |
1903 | 1912 | ||
1904 | musb_pm_runtime_check_session(musb); | 1913 | musb_pm_runtime_check_session(musb); |
1905 | 1914 | ||
@@ -1969,6 +1978,7 @@ static struct musb *allocate_instance(struct device *dev, | |||
1969 | INIT_LIST_HEAD(&musb->control); | 1978 | INIT_LIST_HEAD(&musb->control); |
1970 | INIT_LIST_HEAD(&musb->in_bulk); | 1979 | INIT_LIST_HEAD(&musb->in_bulk); |
1971 | INIT_LIST_HEAD(&musb->out_bulk); | 1980 | INIT_LIST_HEAD(&musb->out_bulk); |
1981 | INIT_LIST_HEAD(&musb->pending_list); | ||
1972 | 1982 | ||
1973 | musb->vbuserr_retry = VBUSERR_RETRY_COUNT; | 1983 | musb->vbuserr_retry = VBUSERR_RETRY_COUNT; |
1974 | musb->a_wait_bcon = OTG_TIME_A_WAIT_BCON; | 1984 | musb->a_wait_bcon = OTG_TIME_A_WAIT_BCON; |
@@ -2018,6 +2028,84 @@ static void musb_free(struct musb *musb) | |||
2018 | musb_host_free(musb); | 2028 | musb_host_free(musb); |
2019 | } | 2029 | } |
2020 | 2030 | ||
2031 | struct musb_pending_work { | ||
2032 | int (*callback)(struct musb *musb, void *data); | ||
2033 | void *data; | ||
2034 | struct list_head node; | ||
2035 | }; | ||
2036 | |||
2037 | /* | ||
2038 | * Called from musb_runtime_resume(), musb_resume(), and | ||
2039 | * musb_queue_resume_work(). Callers must take musb->lock. | ||
2040 | */ | ||
2041 | static int musb_run_resume_work(struct musb *musb) | ||
2042 | { | ||
2043 | struct musb_pending_work *w, *_w; | ||
2044 | unsigned long flags; | ||
2045 | int error = 0; | ||
2046 | |||
2047 | spin_lock_irqsave(&musb->list_lock, flags); | ||
2048 | list_for_each_entry_safe(w, _w, &musb->pending_list, node) { | ||
2049 | if (w->callback) { | ||
2050 | error = w->callback(musb, w->data); | ||
2051 | if (error < 0) { | ||
2052 | dev_err(musb->controller, | ||
2053 | "resume callback %p failed: %i\n", | ||
2054 | w->callback, error); | ||
2055 | } | ||
2056 | } | ||
2057 | list_del(&w->node); | ||
2058 | devm_kfree(musb->controller, w); | ||
2059 | } | ||
2060 | spin_unlock_irqrestore(&musb->list_lock, flags); | ||
2061 | |||
2062 | return error; | ||
2063 | } | ||
2064 | |||
2065 | /* | ||
2066 | * Called to run work if device is active or else queue the work to happen | ||
2067 | * on resume. Caller must take musb->lock and must hold an RPM reference. | ||
2068 | * | ||
2069 | * Note that we cowardly refuse queuing work after musb PM runtime | ||
2070 | * resume is done calling musb_run_resume_work() and return -EINPROGRESS | ||
2071 | * instead. | ||
2072 | */ | ||
2073 | int musb_queue_resume_work(struct musb *musb, | ||
2074 | int (*callback)(struct musb *musb, void *data), | ||
2075 | void *data) | ||
2076 | { | ||
2077 | struct musb_pending_work *w; | ||
2078 | unsigned long flags; | ||
2079 | int error; | ||
2080 | |||
2081 | if (WARN_ON(!callback)) | ||
2082 | return -EINVAL; | ||
2083 | |||
2084 | if (pm_runtime_active(musb->controller)) | ||
2085 | return callback(musb, data); | ||
2086 | |||
2087 | w = devm_kzalloc(musb->controller, sizeof(*w), GFP_ATOMIC); | ||
2088 | if (!w) | ||
2089 | return -ENOMEM; | ||
2090 | |||
2091 | w->callback = callback; | ||
2092 | w->data = data; | ||
2093 | spin_lock_irqsave(&musb->list_lock, flags); | ||
2094 | if (musb->is_runtime_suspended) { | ||
2095 | list_add_tail(&w->node, &musb->pending_list); | ||
2096 | error = 0; | ||
2097 | } else { | ||
2098 | dev_err(musb->controller, "could not add resume work %p\n", | ||
2099 | callback); | ||
2100 | devm_kfree(musb->controller, w); | ||
2101 | error = -EINPROGRESS; | ||
2102 | } | ||
2103 | spin_unlock_irqrestore(&musb->list_lock, flags); | ||
2104 | |||
2105 | return error; | ||
2106 | } | ||
2107 | EXPORT_SYMBOL_GPL(musb_queue_resume_work); | ||
2108 | |||
2021 | static void musb_deassert_reset(struct work_struct *work) | 2109 | static void musb_deassert_reset(struct work_struct *work) |
2022 | { | 2110 | { |
2023 | struct musb *musb; | 2111 | struct musb *musb; |
@@ -2065,6 +2153,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
2065 | } | 2153 | } |
2066 | 2154 | ||
2067 | spin_lock_init(&musb->lock); | 2155 | spin_lock_init(&musb->lock); |
2156 | spin_lock_init(&musb->list_lock); | ||
2068 | musb->board_set_power = plat->set_power; | 2157 | musb->board_set_power = plat->set_power; |
2069 | musb->min_power = plat->min_power; | 2158 | musb->min_power = plat->min_power; |
2070 | musb->ops = plat->platform_ops; | 2159 | musb->ops = plat->platform_ops; |
@@ -2208,7 +2297,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
2208 | musb_generic_disable(musb); | 2297 | musb_generic_disable(musb); |
2209 | 2298 | ||
2210 | /* Init IRQ workqueue before request_irq */ | 2299 | /* Init IRQ workqueue before request_irq */ |
2211 | INIT_WORK(&musb->irq_work, musb_irq_work); | 2300 | INIT_DELAYED_WORK(&musb->irq_work, musb_irq_work); |
2212 | INIT_DELAYED_WORK(&musb->deassert_reset_work, musb_deassert_reset); | 2301 | INIT_DELAYED_WORK(&musb->deassert_reset_work, musb_deassert_reset); |
2213 | INIT_DELAYED_WORK(&musb->finish_resume_work, musb_host_finish_resume); | 2302 | INIT_DELAYED_WORK(&musb->finish_resume_work, musb_host_finish_resume); |
2214 | 2303 | ||
@@ -2291,6 +2380,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
2291 | if (status) | 2380 | if (status) |
2292 | goto fail5; | 2381 | goto fail5; |
2293 | 2382 | ||
2383 | musb->is_initialized = 1; | ||
2294 | pm_runtime_mark_last_busy(musb->controller); | 2384 | pm_runtime_mark_last_busy(musb->controller); |
2295 | pm_runtime_put_autosuspend(musb->controller); | 2385 | pm_runtime_put_autosuspend(musb->controller); |
2296 | 2386 | ||
@@ -2304,7 +2394,7 @@ fail4: | |||
2304 | musb_host_cleanup(musb); | 2394 | musb_host_cleanup(musb); |
2305 | 2395 | ||
2306 | fail3: | 2396 | fail3: |
2307 | cancel_work_sync(&musb->irq_work); | 2397 | cancel_delayed_work_sync(&musb->irq_work); |
2308 | cancel_delayed_work_sync(&musb->finish_resume_work); | 2398 | cancel_delayed_work_sync(&musb->finish_resume_work); |
2309 | cancel_delayed_work_sync(&musb->deassert_reset_work); | 2399 | cancel_delayed_work_sync(&musb->deassert_reset_work); |
2310 | if (musb->dma_controller) | 2400 | if (musb->dma_controller) |
@@ -2371,7 +2461,7 @@ static int musb_remove(struct platform_device *pdev) | |||
2371 | */ | 2461 | */ |
2372 | musb_exit_debugfs(musb); | 2462 | musb_exit_debugfs(musb); |
2373 | 2463 | ||
2374 | cancel_work_sync(&musb->irq_work); | 2464 | cancel_delayed_work_sync(&musb->irq_work); |
2375 | cancel_delayed_work_sync(&musb->finish_resume_work); | 2465 | cancel_delayed_work_sync(&musb->finish_resume_work); |
2376 | cancel_delayed_work_sync(&musb->deassert_reset_work); | 2466 | cancel_delayed_work_sync(&musb->deassert_reset_work); |
2377 | pm_runtime_get_sync(musb->controller); | 2467 | pm_runtime_get_sync(musb->controller); |
@@ -2557,6 +2647,7 @@ static int musb_suspend(struct device *dev) | |||
2557 | 2647 | ||
2558 | musb_platform_disable(musb); | 2648 | musb_platform_disable(musb); |
2559 | musb_generic_disable(musb); | 2649 | musb_generic_disable(musb); |
2650 | WARN_ON(!list_empty(&musb->pending_list)); | ||
2560 | 2651 | ||
2561 | spin_lock_irqsave(&musb->lock, flags); | 2652 | spin_lock_irqsave(&musb->lock, flags); |
2562 | 2653 | ||
@@ -2578,9 +2669,11 @@ static int musb_suspend(struct device *dev) | |||
2578 | 2669 | ||
2579 | static int musb_resume(struct device *dev) | 2670 | static int musb_resume(struct device *dev) |
2580 | { | 2671 | { |
2581 | struct musb *musb = dev_to_musb(dev); | 2672 | struct musb *musb = dev_to_musb(dev); |
2582 | u8 devctl; | 2673 | unsigned long flags; |
2583 | u8 mask; | 2674 | int error; |
2675 | u8 devctl; | ||
2676 | u8 mask; | ||
2584 | 2677 | ||
2585 | /* | 2678 | /* |
2586 | * For static cmos like DaVinci, register values were preserved | 2679 | * For static cmos like DaVinci, register values were preserved |
@@ -2614,6 +2707,13 @@ static int musb_resume(struct device *dev) | |||
2614 | 2707 | ||
2615 | musb_start(musb); | 2708 | musb_start(musb); |
2616 | 2709 | ||
2710 | spin_lock_irqsave(&musb->lock, flags); | ||
2711 | error = musb_run_resume_work(musb); | ||
2712 | if (error) | ||
2713 | dev_err(musb->controller, "resume work failed with %i\n", | ||
2714 | error); | ||
2715 | spin_unlock_irqrestore(&musb->lock, flags); | ||
2716 | |||
2617 | return 0; | 2717 | return 0; |
2618 | } | 2718 | } |
2619 | 2719 | ||
@@ -2622,14 +2722,16 @@ static int musb_runtime_suspend(struct device *dev) | |||
2622 | struct musb *musb = dev_to_musb(dev); | 2722 | struct musb *musb = dev_to_musb(dev); |
2623 | 2723 | ||
2624 | musb_save_context(musb); | 2724 | musb_save_context(musb); |
2725 | musb->is_runtime_suspended = 1; | ||
2625 | 2726 | ||
2626 | return 0; | 2727 | return 0; |
2627 | } | 2728 | } |
2628 | 2729 | ||
2629 | static int musb_runtime_resume(struct device *dev) | 2730 | static int musb_runtime_resume(struct device *dev) |
2630 | { | 2731 | { |
2631 | struct musb *musb = dev_to_musb(dev); | 2732 | struct musb *musb = dev_to_musb(dev); |
2632 | static int first = 1; | 2733 | unsigned long flags; |
2734 | int error; | ||
2633 | 2735 | ||
2634 | /* | 2736 | /* |
2635 | * When pm_runtime_get_sync called for the first time in driver | 2737 | * When pm_runtime_get_sync called for the first time in driver |
@@ -2640,9 +2742,10 @@ static int musb_runtime_resume(struct device *dev) | |||
2640 | * Also context restore without save does not make | 2742 | * Also context restore without save does not make |
2641 | * any sense | 2743 | * any sense |
2642 | */ | 2744 | */ |
2643 | if (!first) | 2745 | if (!musb->is_initialized) |
2644 | musb_restore_context(musb); | 2746 | return 0; |
2645 | first = 0; | 2747 | |
2748 | musb_restore_context(musb); | ||
2646 | 2749 | ||
2647 | if (musb->need_finish_resume) { | 2750 | if (musb->need_finish_resume) { |
2648 | musb->need_finish_resume = 0; | 2751 | musb->need_finish_resume = 0; |
@@ -2650,6 +2753,14 @@ static int musb_runtime_resume(struct device *dev) | |||
2650 | msecs_to_jiffies(USB_RESUME_TIMEOUT)); | 2753 | msecs_to_jiffies(USB_RESUME_TIMEOUT)); |
2651 | } | 2754 | } |
2652 | 2755 | ||
2756 | spin_lock_irqsave(&musb->lock, flags); | ||
2757 | error = musb_run_resume_work(musb); | ||
2758 | if (error) | ||
2759 | dev_err(musb->controller, "resume work failed with %i\n", | ||
2760 | error); | ||
2761 | musb->is_runtime_suspended = 0; | ||
2762 | spin_unlock_irqrestore(&musb->lock, flags); | ||
2763 | |||
2653 | return 0; | 2764 | return 0; |
2654 | } | 2765 | } |
2655 | 2766 | ||
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index 2cb88a498f8a..91817d77d59c 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h | |||
@@ -303,13 +303,14 @@ struct musb_context_registers { | |||
303 | struct musb { | 303 | struct musb { |
304 | /* device lock */ | 304 | /* device lock */ |
305 | spinlock_t lock; | 305 | spinlock_t lock; |
306 | spinlock_t list_lock; /* resume work list lock */ | ||
306 | 307 | ||
307 | struct musb_io io; | 308 | struct musb_io io; |
308 | const struct musb_platform_ops *ops; | 309 | const struct musb_platform_ops *ops; |
309 | struct musb_context_registers context; | 310 | struct musb_context_registers context; |
310 | 311 | ||
311 | irqreturn_t (*isr)(int, void *); | 312 | irqreturn_t (*isr)(int, void *); |
312 | struct work_struct irq_work; | 313 | struct delayed_work irq_work; |
313 | struct delayed_work deassert_reset_work; | 314 | struct delayed_work deassert_reset_work; |
314 | struct delayed_work finish_resume_work; | 315 | struct delayed_work finish_resume_work; |
315 | struct delayed_work gadget_work; | 316 | struct delayed_work gadget_work; |
@@ -337,6 +338,7 @@ struct musb { | |||
337 | struct list_head control; /* of musb_qh */ | 338 | struct list_head control; /* of musb_qh */ |
338 | struct list_head in_bulk; /* of musb_qh */ | 339 | struct list_head in_bulk; /* of musb_qh */ |
339 | struct list_head out_bulk; /* of musb_qh */ | 340 | struct list_head out_bulk; /* of musb_qh */ |
341 | struct list_head pending_list; /* pending work list */ | ||
340 | 342 | ||
341 | struct timer_list otg_timer; | 343 | struct timer_list otg_timer; |
342 | struct notifier_block nb; | 344 | struct notifier_block nb; |
@@ -379,12 +381,15 @@ struct musb { | |||
379 | 381 | ||
380 | int port_mode; /* MUSB_PORT_MODE_* */ | 382 | int port_mode; /* MUSB_PORT_MODE_* */ |
381 | bool session; | 383 | bool session; |
382 | bool quirk_invalid_vbus; | 384 | unsigned long quirk_retries; |
383 | bool is_host; | 385 | bool is_host; |
384 | 386 | ||
385 | int a_wait_bcon; /* VBUS timeout in msecs */ | 387 | int a_wait_bcon; /* VBUS timeout in msecs */ |
386 | unsigned long idle_timeout; /* Next timeout in jiffies */ | 388 | unsigned long idle_timeout; /* Next timeout in jiffies */ |
387 | 389 | ||
390 | unsigned is_initialized:1; | ||
391 | unsigned is_runtime_suspended:1; | ||
392 | |||
388 | /* active means connected and not suspended */ | 393 | /* active means connected and not suspended */ |
389 | unsigned is_active:1; | 394 | unsigned is_active:1; |
390 | 395 | ||
@@ -540,6 +545,10 @@ extern irqreturn_t musb_interrupt(struct musb *); | |||
540 | 545 | ||
541 | extern void musb_hnp_stop(struct musb *musb); | 546 | extern void musb_hnp_stop(struct musb *musb); |
542 | 547 | ||
548 | int musb_queue_resume_work(struct musb *musb, | ||
549 | int (*callback)(struct musb *musb, void *data), | ||
550 | void *data); | ||
551 | |||
543 | static inline void musb_platform_set_vbus(struct musb *musb, int is_on) | 552 | static inline void musb_platform_set_vbus(struct musb *musb, int is_on) |
544 | { | 553 | { |
545 | if (musb->ops->set_vbus) | 554 | if (musb->ops->set_vbus) |
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 0f17d2140db6..feae1561b9ab 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c | |||
@@ -185,24 +185,19 @@ static void dsps_musb_disable(struct musb *musb) | |||
185 | musb_writel(reg_base, wrp->coreintr_clear, wrp->usb_bitmap); | 185 | musb_writel(reg_base, wrp->coreintr_clear, wrp->usb_bitmap); |
186 | musb_writel(reg_base, wrp->epintr_clear, | 186 | musb_writel(reg_base, wrp->epintr_clear, |
187 | wrp->txep_bitmap | wrp->rxep_bitmap); | 187 | wrp->txep_bitmap | wrp->rxep_bitmap); |
188 | del_timer_sync(&glue->timer); | ||
188 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); | 189 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); |
189 | } | 190 | } |
190 | 191 | ||
191 | static void otg_timer(unsigned long _musb) | 192 | /* Caller must take musb->lock */ |
193 | static int dsps_check_status(struct musb *musb, void *unused) | ||
192 | { | 194 | { |
193 | struct musb *musb = (void *)_musb; | ||
194 | void __iomem *mregs = musb->mregs; | 195 | void __iomem *mregs = musb->mregs; |
195 | struct device *dev = musb->controller; | 196 | struct device *dev = musb->controller; |
196 | struct dsps_glue *glue = dev_get_drvdata(dev->parent); | 197 | struct dsps_glue *glue = dev_get_drvdata(dev->parent); |
197 | const struct dsps_musb_wrapper *wrp = glue->wrp; | 198 | const struct dsps_musb_wrapper *wrp = glue->wrp; |
198 | u8 devctl; | 199 | u8 devctl; |
199 | unsigned long flags; | ||
200 | int skip_session = 0; | 200 | int skip_session = 0; |
201 | int err; | ||
202 | |||
203 | err = pm_runtime_get_sync(dev); | ||
204 | if (err < 0) | ||
205 | dev_err(dev, "Poll could not pm_runtime_get: %i\n", err); | ||
206 | 201 | ||
207 | /* | 202 | /* |
208 | * We poll because DSPS IP's won't expose several OTG-critical | 203 | * We poll because DSPS IP's won't expose several OTG-critical |
@@ -212,7 +207,6 @@ static void otg_timer(unsigned long _musb) | |||
212 | dev_dbg(musb->controller, "Poll devctl %02x (%s)\n", devctl, | 207 | dev_dbg(musb->controller, "Poll devctl %02x (%s)\n", devctl, |
213 | usb_otg_state_string(musb->xceiv->otg->state)); | 208 | usb_otg_state_string(musb->xceiv->otg->state)); |
214 | 209 | ||
215 | spin_lock_irqsave(&musb->lock, flags); | ||
216 | switch (musb->xceiv->otg->state) { | 210 | switch (musb->xceiv->otg->state) { |
217 | case OTG_STATE_A_WAIT_VRISE: | 211 | case OTG_STATE_A_WAIT_VRISE: |
218 | mod_timer(&glue->timer, jiffies + | 212 | mod_timer(&glue->timer, jiffies + |
@@ -245,8 +239,30 @@ static void otg_timer(unsigned long _musb) | |||
245 | default: | 239 | default: |
246 | break; | 240 | break; |
247 | } | 241 | } |
248 | spin_unlock_irqrestore(&musb->lock, flags); | ||
249 | 242 | ||
243 | return 0; | ||
244 | } | ||
245 | |||
246 | static void otg_timer(unsigned long _musb) | ||
247 | { | ||
248 | struct musb *musb = (void *)_musb; | ||
249 | struct device *dev = musb->controller; | ||
250 | unsigned long flags; | ||
251 | int err; | ||
252 | |||
253 | err = pm_runtime_get(dev); | ||
254 | if ((err != -EINPROGRESS) && err < 0) { | ||
255 | dev_err(dev, "Poll could not pm_runtime_get: %i\n", err); | ||
256 | pm_runtime_put_noidle(dev); | ||
257 | |||
258 | return; | ||
259 | } | ||
260 | |||
261 | spin_lock_irqsave(&musb->lock, flags); | ||
262 | err = musb_queue_resume_work(musb, dsps_check_status, NULL); | ||
263 | if (err < 0) | ||
264 | dev_err(dev, "%s resume work: %i\n", __func__, err); | ||
265 | spin_unlock_irqrestore(&musb->lock, flags); | ||
250 | pm_runtime_mark_last_busy(dev); | 266 | pm_runtime_mark_last_busy(dev); |
251 | pm_runtime_put_autosuspend(dev); | 267 | pm_runtime_put_autosuspend(dev); |
252 | } | 268 | } |
@@ -767,28 +783,13 @@ static int dsps_probe(struct platform_device *pdev) | |||
767 | 783 | ||
768 | platform_set_drvdata(pdev, glue); | 784 | platform_set_drvdata(pdev, glue); |
769 | pm_runtime_enable(&pdev->dev); | 785 | pm_runtime_enable(&pdev->dev); |
770 | pm_runtime_use_autosuspend(&pdev->dev); | ||
771 | pm_runtime_set_autosuspend_delay(&pdev->dev, 200); | ||
772 | |||
773 | ret = pm_runtime_get_sync(&pdev->dev); | ||
774 | if (ret < 0) { | ||
775 | dev_err(&pdev->dev, "pm_runtime_get_sync FAILED"); | ||
776 | goto err2; | ||
777 | } | ||
778 | |||
779 | ret = dsps_create_musb_pdev(glue, pdev); | 786 | ret = dsps_create_musb_pdev(glue, pdev); |
780 | if (ret) | 787 | if (ret) |
781 | goto err3; | 788 | goto err; |
782 | |||
783 | pm_runtime_mark_last_busy(&pdev->dev); | ||
784 | pm_runtime_put_autosuspend(&pdev->dev); | ||
785 | 789 | ||
786 | return 0; | 790 | return 0; |
787 | 791 | ||
788 | err3: | 792 | err: |
789 | pm_runtime_put_sync(&pdev->dev); | ||
790 | err2: | ||
791 | pm_runtime_dont_use_autosuspend(&pdev->dev); | ||
792 | pm_runtime_disable(&pdev->dev); | 793 | pm_runtime_disable(&pdev->dev); |
793 | return ret; | 794 | return ret; |
794 | } | 795 | } |
@@ -799,9 +800,6 @@ static int dsps_remove(struct platform_device *pdev) | |||
799 | 800 | ||
800 | platform_device_unregister(glue->musb); | 801 | platform_device_unregister(glue->musb); |
801 | 802 | ||
802 | /* disable usbss clocks */ | ||
803 | pm_runtime_dont_use_autosuspend(&pdev->dev); | ||
804 | pm_runtime_put_sync(&pdev->dev); | ||
805 | pm_runtime_disable(&pdev->dev); | 803 | pm_runtime_disable(&pdev->dev); |
806 | 804 | ||
807 | return 0; | 805 | return 0; |
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 4042ea017985..a55173c9e564 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
@@ -1114,7 +1114,7 @@ static int musb_gadget_enable(struct usb_ep *ep, | |||
1114 | musb_ep->dma ? "dma, " : "", | 1114 | musb_ep->dma ? "dma, " : "", |
1115 | musb_ep->packet_sz); | 1115 | musb_ep->packet_sz); |
1116 | 1116 | ||
1117 | schedule_work(&musb->irq_work); | 1117 | schedule_delayed_work(&musb->irq_work, 0); |
1118 | 1118 | ||
1119 | fail: | 1119 | fail: |
1120 | spin_unlock_irqrestore(&musb->lock, flags); | 1120 | spin_unlock_irqrestore(&musb->lock, flags); |
@@ -1158,7 +1158,7 @@ static int musb_gadget_disable(struct usb_ep *ep) | |||
1158 | musb_ep->desc = NULL; | 1158 | musb_ep->desc = NULL; |
1159 | musb_ep->end_point.desc = NULL; | 1159 | musb_ep->end_point.desc = NULL; |
1160 | 1160 | ||
1161 | schedule_work(&musb->irq_work); | 1161 | schedule_delayed_work(&musb->irq_work, 0); |
1162 | 1162 | ||
1163 | spin_unlock_irqrestore(&(musb->lock), flags); | 1163 | spin_unlock_irqrestore(&(musb->lock), flags); |
1164 | 1164 | ||
@@ -1222,13 +1222,22 @@ void musb_ep_restart(struct musb *musb, struct musb_request *req) | |||
1222 | rxstate(musb, req); | 1222 | rxstate(musb, req); |
1223 | } | 1223 | } |
1224 | 1224 | ||
1225 | static int musb_ep_restart_resume_work(struct musb *musb, void *data) | ||
1226 | { | ||
1227 | struct musb_request *req = data; | ||
1228 | |||
1229 | musb_ep_restart(musb, req); | ||
1230 | |||
1231 | return 0; | ||
1232 | } | ||
1233 | |||
1225 | static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req, | 1234 | static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req, |
1226 | gfp_t gfp_flags) | 1235 | gfp_t gfp_flags) |
1227 | { | 1236 | { |
1228 | struct musb_ep *musb_ep; | 1237 | struct musb_ep *musb_ep; |
1229 | struct musb_request *request; | 1238 | struct musb_request *request; |
1230 | struct musb *musb; | 1239 | struct musb *musb; |
1231 | int status = 0; | 1240 | int status; |
1232 | unsigned long lockflags; | 1241 | unsigned long lockflags; |
1233 | 1242 | ||
1234 | if (!ep || !req) | 1243 | if (!ep || !req) |
@@ -1245,6 +1254,17 @@ static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req, | |||
1245 | if (request->ep != musb_ep) | 1254 | if (request->ep != musb_ep) |
1246 | return -EINVAL; | 1255 | return -EINVAL; |
1247 | 1256 | ||
1257 | status = pm_runtime_get(musb->controller); | ||
1258 | if ((status != -EINPROGRESS) && status < 0) { | ||
1259 | dev_err(musb->controller, | ||
1260 | "pm runtime get failed in %s\n", | ||
1261 | __func__); | ||
1262 | pm_runtime_put_noidle(musb->controller); | ||
1263 | |||
1264 | return status; | ||
1265 | } | ||
1266 | status = 0; | ||
1267 | |||
1248 | trace_musb_req_enq(request); | 1268 | trace_musb_req_enq(request); |
1249 | 1269 | ||
1250 | /* request is mine now... */ | 1270 | /* request is mine now... */ |
@@ -1255,7 +1275,6 @@ static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req, | |||
1255 | 1275 | ||
1256 | map_dma_buffer(request, musb, musb_ep); | 1276 | map_dma_buffer(request, musb, musb_ep); |
1257 | 1277 | ||
1258 | pm_runtime_get_sync(musb->controller); | ||
1259 | spin_lock_irqsave(&musb->lock, lockflags); | 1278 | spin_lock_irqsave(&musb->lock, lockflags); |
1260 | 1279 | ||
1261 | /* don't queue if the ep is down */ | 1280 | /* don't queue if the ep is down */ |
@@ -1271,8 +1290,14 @@ static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req, | |||
1271 | list_add_tail(&request->list, &musb_ep->req_list); | 1290 | list_add_tail(&request->list, &musb_ep->req_list); |
1272 | 1291 | ||
1273 | /* it this is the head of the queue, start i/o ... */ | 1292 | /* it this is the head of the queue, start i/o ... */ |
1274 | if (!musb_ep->busy && &request->list == musb_ep->req_list.next) | 1293 | if (!musb_ep->busy && &request->list == musb_ep->req_list.next) { |
1275 | musb_ep_restart(musb, request); | 1294 | status = musb_queue_resume_work(musb, |
1295 | musb_ep_restart_resume_work, | ||
1296 | request); | ||
1297 | if (status < 0) | ||
1298 | dev_err(musb->controller, "%s resume work: %i\n", | ||
1299 | __func__, status); | ||
1300 | } | ||
1276 | 1301 | ||
1277 | unlock: | 1302 | unlock: |
1278 | spin_unlock_irqrestore(&musb->lock, lockflags); | 1303 | spin_unlock_irqrestore(&musb->lock, lockflags); |
@@ -1969,7 +1994,7 @@ static int musb_gadget_stop(struct usb_gadget *g) | |||
1969 | */ | 1994 | */ |
1970 | 1995 | ||
1971 | /* Force check of devctl register for PM runtime */ | 1996 | /* Force check of devctl register for PM runtime */ |
1972 | schedule_work(&musb->irq_work); | 1997 | schedule_delayed_work(&musb->irq_work, 0); |
1973 | 1998 | ||
1974 | pm_runtime_mark_last_busy(musb->controller); | 1999 | pm_runtime_mark_last_busy(musb->controller); |
1975 | pm_runtime_put_autosuspend(musb->controller); | 2000 | pm_runtime_put_autosuspend(musb->controller); |
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index cc1225485509..e8be8e39ab8f 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
@@ -513,17 +513,18 @@ static int omap2430_probe(struct platform_device *pdev) | |||
513 | } | 513 | } |
514 | 514 | ||
515 | pm_runtime_enable(glue->dev); | 515 | pm_runtime_enable(glue->dev); |
516 | pm_runtime_use_autosuspend(glue->dev); | ||
517 | pm_runtime_set_autosuspend_delay(glue->dev, 100); | ||
518 | 516 | ||
519 | ret = platform_device_add(musb); | 517 | ret = platform_device_add(musb); |
520 | if (ret) { | 518 | if (ret) { |
521 | dev_err(&pdev->dev, "failed to register musb device\n"); | 519 | dev_err(&pdev->dev, "failed to register musb device\n"); |
522 | goto err2; | 520 | goto err3; |
523 | } | 521 | } |
524 | 522 | ||
525 | return 0; | 523 | return 0; |
526 | 524 | ||
525 | err3: | ||
526 | pm_runtime_disable(glue->dev); | ||
527 | |||
527 | err2: | 528 | err2: |
528 | platform_device_put(musb); | 529 | platform_device_put(musb); |
529 | 530 | ||
@@ -535,10 +536,7 @@ static int omap2430_remove(struct platform_device *pdev) | |||
535 | { | 536 | { |
536 | struct omap2430_glue *glue = platform_get_drvdata(pdev); | 537 | struct omap2430_glue *glue = platform_get_drvdata(pdev); |
537 | 538 | ||
538 | pm_runtime_get_sync(glue->dev); | ||
539 | platform_device_unregister(glue->musb); | 539 | platform_device_unregister(glue->musb); |
540 | pm_runtime_put_sync(glue->dev); | ||
541 | pm_runtime_dont_use_autosuspend(glue->dev); | ||
542 | pm_runtime_disable(glue->dev); | 540 | pm_runtime_disable(glue->dev); |
543 | 541 | ||
544 | return 0; | 542 | return 0; |
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index df7c9f46be54..e85cc8e4e7a9 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c | |||
@@ -724,7 +724,7 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase) | |||
724 | dev_dbg(musb->controller, "vbus change, %s, otg %03x\n", | 724 | dev_dbg(musb->controller, "vbus change, %s, otg %03x\n", |
725 | usb_otg_state_string(musb->xceiv->otg->state), otg_stat); | 725 | usb_otg_state_string(musb->xceiv->otg->state), otg_stat); |
726 | idle_timeout = jiffies + (1 * HZ); | 726 | idle_timeout = jiffies + (1 * HZ); |
727 | schedule_work(&musb->irq_work); | 727 | schedule_delayed_work(&musb->irq_work, 0); |
728 | 728 | ||
729 | } else /* A-dev state machine */ { | 729 | } else /* A-dev state machine */ { |
730 | dev_dbg(musb->controller, "vbus change, %s, otg %03x\n", | 730 | dev_dbg(musb->controller, "vbus change, %s, otg %03x\n", |
@@ -814,7 +814,7 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase) | |||
814 | break; | 814 | break; |
815 | } | 815 | } |
816 | } | 816 | } |
817 | schedule_work(&musb->irq_work); | 817 | schedule_delayed_work(&musb->irq_work, 0); |
818 | 818 | ||
819 | return idle_timeout; | 819 | return idle_timeout; |
820 | } | 820 | } |
@@ -864,7 +864,7 @@ static irqreturn_t tusb_musb_interrupt(int irq, void *__hci) | |||
864 | musb_writel(tbase, TUSB_PRCM_WAKEUP_CLEAR, reg); | 864 | musb_writel(tbase, TUSB_PRCM_WAKEUP_CLEAR, reg); |
865 | if (reg & ~TUSB_PRCM_WNORCS) { | 865 | if (reg & ~TUSB_PRCM_WNORCS) { |
866 | musb->is_active = 1; | 866 | musb->is_active = 1; |
867 | schedule_work(&musb->irq_work); | 867 | schedule_delayed_work(&musb->irq_work, 0); |
868 | } | 868 | } |
869 | dev_dbg(musb->controller, "wake %sactive %02x\n", | 869 | dev_dbg(musb->controller, "wake %sactive %02x\n", |
870 | musb->is_active ? "" : "in", reg); | 870 | musb->is_active ? "" : "in", reg); |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index f61477bed3a8..243ac5ebe46a 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -131,6 +131,7 @@ static const struct usb_device_id id_table[] = { | |||
131 | { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */ | 131 | { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */ |
132 | { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */ | 132 | { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */ |
133 | { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ | 133 | { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ |
134 | { USB_DEVICE(0x10C4, 0x8962) }, /* Brim Brothers charging dock */ | ||
134 | { USB_DEVICE(0x10C4, 0x8977) }, /* CEL MeshWorks DevKit Device */ | 135 | { USB_DEVICE(0x10C4, 0x8977) }, /* CEL MeshWorks DevKit Device */ |
135 | { USB_DEVICE(0x10C4, 0x8998) }, /* KCF Technologies PRN */ | 136 | { USB_DEVICE(0x10C4, 0x8998) }, /* KCF Technologies PRN */ |
136 | { USB_DEVICE(0x10C4, 0x8A2A) }, /* HubZ dual ZigBee and Z-Wave dongle */ | 137 | { USB_DEVICE(0x10C4, 0x8A2A) }, /* HubZ dual ZigBee and Z-Wave dongle */ |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 0ff7f38d7800..6e9fc8bcc285 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -1012,6 +1012,8 @@ static const struct usb_device_id id_table_combined[] = { | |||
1012 | { USB_DEVICE(ICPDAS_VID, ICPDAS_I7561U_PID) }, | 1012 | { USB_DEVICE(ICPDAS_VID, ICPDAS_I7561U_PID) }, |
1013 | { USB_DEVICE(ICPDAS_VID, ICPDAS_I7563U_PID) }, | 1013 | { USB_DEVICE(ICPDAS_VID, ICPDAS_I7563U_PID) }, |
1014 | { USB_DEVICE(WICED_VID, WICED_USB20706V2_PID) }, | 1014 | { USB_DEVICE(WICED_VID, WICED_USB20706V2_PID) }, |
1015 | { USB_DEVICE(TI_VID, TI_CC3200_LAUNCHPAD_PID), | ||
1016 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | ||
1015 | { } /* Terminating entry */ | 1017 | { } /* Terminating entry */ |
1016 | }; | 1018 | }; |
1017 | 1019 | ||
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 21011c0a4c64..48ee04c94a75 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -596,6 +596,12 @@ | |||
596 | #define STK541_PID 0x2109 /* Zigbee Controller */ | 596 | #define STK541_PID 0x2109 /* Zigbee Controller */ |
597 | 597 | ||
598 | /* | 598 | /* |
599 | * Texas Instruments | ||
600 | */ | ||
601 | #define TI_VID 0x0451 | ||
602 | #define TI_CC3200_LAUNCHPAD_PID 0xC32A /* SimpleLink Wi-Fi CC3200 LaunchPad */ | ||
603 | |||
604 | /* | ||
599 | * Blackfin gnICE JTAG | 605 | * Blackfin gnICE JTAG |
600 | * http://docs.blackfin.uclinux.org/doku.php?id=hw:jtag:gnice | 606 | * http://docs.blackfin.uclinux.org/doku.php?id=hw:jtag:gnice |
601 | */ | 607 | */ |
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index ffd086733421..1a59f335b063 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c | |||
@@ -954,10 +954,15 @@ int usb_stor_CB_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
954 | 954 | ||
955 | /* COMMAND STAGE */ | 955 | /* COMMAND STAGE */ |
956 | /* let's send the command via the control pipe */ | 956 | /* let's send the command via the control pipe */ |
957 | /* | ||
958 | * Command is sometime (f.e. after scsi_eh_prep_cmnd) on the stack. | ||
959 | * Stack may be vmallocated. So no DMA for us. Make a copy. | ||
960 | */ | ||
961 | memcpy(us->iobuf, srb->cmnd, srb->cmd_len); | ||
957 | result = usb_stor_ctrl_transfer(us, us->send_ctrl_pipe, | 962 | result = usb_stor_ctrl_transfer(us, us->send_ctrl_pipe, |
958 | US_CBI_ADSC, | 963 | US_CBI_ADSC, |
959 | USB_TYPE_CLASS | USB_RECIP_INTERFACE, 0, | 964 | USB_TYPE_CLASS | USB_RECIP_INTERFACE, 0, |
960 | us->ifnum, srb->cmnd, srb->cmd_len); | 965 | us->ifnum, us->iobuf, srb->cmd_len); |
961 | 966 | ||
962 | /* check the return code for the command */ | 967 | /* check the return code for the command */ |
963 | usb_stor_dbg(us, "Call to usb_stor_ctrl_transfer() returned %d\n", | 968 | usb_stor_dbg(us, "Call to usb_stor_ctrl_transfer() returned %d\n", |
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index fdd3228e0678..3eb58cb51e56 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
@@ -155,6 +155,7 @@ config TANGOX_WATCHDOG | |||
155 | config WDAT_WDT | 155 | config WDAT_WDT |
156 | tristate "ACPI Watchdog Action Table (WDAT)" | 156 | tristate "ACPI Watchdog Action Table (WDAT)" |
157 | depends on ACPI | 157 | depends on ACPI |
158 | select WATCHDOG_CORE | ||
158 | select ACPI_WATCHDOG | 159 | select ACPI_WATCHDOG |
159 | help | 160 | help |
160 | This driver adds support for systems with ACPI Watchdog Action | 161 | This driver adds support for systems with ACPI Watchdog Action |