summaryrefslogtreecommitdiffstats
path: root/qcom-msm89xx-fixes.patch
blob: 4b5db842237244cb021624138ab3ab790db60cce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
From 283d0e00a18b294ec56f1fb904896a546704faaf Mon Sep 17 00:00:00 2001
From: Rob Clark <robdclark@gmail.com>
Date: Fri, 30 Jun 2017 11:47:21 -0400
Subject: [PATCH 3/6] soc: qcom: smsm: fix of_node refcnting problem

of_find_node_with_property() drops the reference to the 'from' node,
which eventually (after enough -EPROBE_DEFERs) drops the last reference
to the node causing all sorts of fun problems, and this nice splat.

  BUG: sleeping function called from invalid context at ../kernel/locking/mutex.c:747
  in_atomic(): 1, irqs_disabled(): 128, pid: 33, name: kworker/0:1
  4 locks held by kworker/0:1/33:
   #0:  ("events"){.+.+.+}, at: [<ffff0000080fa91c>] process_one_work+0x1a4/0x728
   #1:  (deferred_probe_work){+.+.+.}, at: [<ffff0000080fa91c>] process_one_work+0x1a4/0x728
   #2:  (&dev->mutex){......}, at: [<ffff000008676078>] __device_attach+0x30/0x168
   #3:  (devtree_lock){......}, at: [<ffff000008828fd0>] of_find_node_with_property+0x30/0xe0
  irq event stamp: 18976
  hardirqs last  enabled at (18975): [<ffff00000815794c>] __down_trylock_console_sem+0x74/0xb8
  hardirqs last disabled at (18976): [<ffff0000089e26d4>] _raw_spin_lock_irqsave+0x2c/0x78
  softirqs last  enabled at (16880): [<ffff0000080e0f00>] __do_softirq+0x580/0x640
  softirqs last disabled at (16871): [<ffff0000080e13a4>] irq_exit+0xe4/0x138
  CPU: 0 PID: 33 Comm: kworker/0:1 Tainted: G            E   4.12.0-rc5+ #1455
  Hardware name: qualcomm dragonboard410c/dragonboard410c, BIOS 2017.07-rc1-00234-g22fa70a-dirty 06/26/2017
  Workqueue: events deferred_probe_work_func
  Call trace:
  [<ffff000008089ee0>] dump_backtrace+0x0/0x230
  [<ffff00000808a134>] show_stack+0x24/0x30
  [<ffff0000084e1944>] dump_stack+0xac/0xe8
  [<ffff00000810d7e0>] ___might_sleep+0x150/0x230
  [<ffff00000810d918>] __might_sleep+0x58/0x90
  [<ffff0000089dde18>] __mutex_lock+0x50/0x870
  [<ffff0000089de674>] mutex_lock_nested+0x3c/0x50
  [<ffff000008388ae0>] kernfs_remove+0x30/0x50
  [<ffff00000838b720>] sysfs_remove_dir+0x58/0x70
  [<ffff0000084e393c>] kobject_del+0x1c/0x58
  [<ffff0000084e374c>] kobject_put+0xb4/0x208
  [<ffff00000882c364>] of_node_put+0x24/0x30
  [<ffff000008829018>] of_find_node_with_property+0x78/0xe0
  [<ffff000000aff5f4>] qcom_smsm_probe+0x194/0x720 [smsm]
  [<ffff0000086793b4>] platform_drv_probe+0x74/0x110
  [<ffff0000086765bc>] driver_probe_device+0x2b4/0x420
  [<ffff000008676920>] __device_attach_driver+0xd0/0x150
  [<ffff000008673e78>] bus_for_each_drv+0x68/0xa8
  [<ffff00000867611c>] __device_attach+0xd4/0x168
  [<ffff000008676a1c>] device_initial_probe+0x24/0x30
  [<ffff000008675380>] bus_probe_device+0xa0/0xa8
  [<ffff000008675948>] deferred_probe_work_func+0xb8/0xf8
  [<ffff0000080fa9d4>] process_one_work+0x25c/0x728
  [<ffff0000080faef4>] worker_thread+0x54/0x3d8
  [<ffff0000081031d8>] kthread+0x110/0x140
  [<ffff000008082d90>] ret_from_fork+0x10/0x40
  OF: ERROR: Bad of_node_put() on /smsm
  CPU: 0 PID: 33 Comm: kworker/0:1 Tainted: G        W   E   4.12.0-rc5+ #1455
  Hardware name: qualcomm dragonboard410c/dragonboard410c, BIOS 2017.07-rc1-00234-g22fa70a-dirty 06/26/2017
  Workqueue: events deferred_probe_work_func

Signed-off-by: Rob Clark <robdclark@gmail.com>
---
 drivers/soc/qcom/smsm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/qcom/smsm.c b/drivers/soc/qcom/smsm.c
index d0337b2a71c8..a64ecd597a22 100644
--- a/drivers/soc/qcom/smsm.c
+++ b/drivers/soc/qcom/smsm.c
@@ -495,7 +495,8 @@ static int qcom_smsm_probe(struct platform_device *pdev)
 	if (!smsm->hosts)
 		return -ENOMEM;
 
-	local_node = of_find_node_with_property(pdev->dev.of_node, "#qcom,smem-state-cells");
+	local_node = of_find_node_with_property(of_node_get(pdev->dev.of_node),
+						"#qcom,smem-state-cells");
 	if (!local_node) {
 		dev_err(&pdev->dev, "no state entry\n");
 		return -EINVAL;
-- 
2.13.0

From 40cb129048e5d2456da8d9d6468f292da3071b91 Mon Sep 17 00:00:00 2001
From: Rob Clark <robdclark@gmail.com>
Date: Fri, 30 Jun 2017 16:40:23 -0400
Subject: [PATCH 4/6] thermal: qcom: tsens: fix crash due to incorrect __init

init_common() is called from probe, which can happen after the __init
section is already unloaded in the case of -EPROBE_DEFER.  Causing a
later probe to attempt to branch to hyperspace.

Cc: <stable@vger.kernel.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
 drivers/thermal/qcom/tsens-common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c
index b1449ad67fc0..22ad37c9808c 100644
--- a/drivers/thermal/qcom/tsens-common.c
+++ b/drivers/thermal/qcom/tsens-common.c
@@ -123,7 +123,7 @@ static const struct regmap_config tsens_config = {
 	.reg_stride	= 4,
 };
 
-int __init init_common(struct tsens_device *tmdev)
+int init_common(struct tsens_device *tmdev)
 {
 	void __iomem *base;
 
-- 
2.13.0

From ae9b4fa55748cc9ce3c8ac039e46feab7257eff9 Mon Sep 17 00:00:00 2001
From: Rob Clark <robdclark@gmail.com>
Date: Sun, 2 Jul 2017 09:23:36 -0400
Subject: [PATCH 5/6] soc: qcom: wcnss_ctrl: add missing MODULE_DEVICE_TABLE()

This fixes a problem of wifi module not loading on db410c.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
 drivers/soc/qcom/wcnss_ctrl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/soc/qcom/wcnss_ctrl.c b/drivers/soc/qcom/wcnss_ctrl.c
index b9069184df19..d008e5b82db4 100644
--- a/drivers/soc/qcom/wcnss_ctrl.c
+++ b/drivers/soc/qcom/wcnss_ctrl.c
@@ -347,6 +347,7 @@ static const struct of_device_id wcnss_ctrl_of_match[] = {
 	{ .compatible = "qcom,wcnss", },
 	{}
 };
+MODULE_DEVICE_TABLE(of, wcnss_ctrl_of_match);
 
 static struct rpmsg_driver wcnss_ctrl_driver = {
 	.probe = wcnss_ctrl_probe,
-- 
2.13.0