ea8a2b2c06e03d7ae1a9e2fa102da26f1368b6c6
[openwrt/staging/neocturne.git] /
1 From d499c8f6171122d78a90c3a6403ac7c0c1f50887 Mon Sep 17 00:00:00 2001
2 From: Fabrice Gasnier <fabrice.gasnier@st.com>
3 Date: Mon, 1 Oct 2018 15:23:56 +0200
4 Subject: [PATCH 310/703] Revert "pwm: Set class for exported channels in
5 sysfs"
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 commit c289d6625237aa785b484b4e94c23b3b91ea7e60 upstream.
11
12 This reverts commit 7e5d1fd75c3dde9fc10c4472b9368089d1b81d00 ("pwm: Set
13 class for exported channels in sysfs") as it causes regression with
14 multiple pwm chip[1], when exporting a pwm channel (echo X > export):
15
16 - ABI (Documentation/ABI/testing/sysfs-class-pwm) states pwmX should be
17 created in /sys/class/pwm/pwmchipN/pwmX
18 - Reverted patch causes new entry to be also created directly in
19 /sys/class/pwm/pwmX
20 - 1st time, exporting pwmX will create an entry in /sys/class/pwm/pwmX
21 - class attributes are added under pwmX folder, such as export, unexport
22 npwm, symlinks. This is wrong as it belongs to pwmchipN. It may cause
23 bad behavior and report wrong values.
24 - when another export happens on another pwmchip, it can't be created
25 (e.g. -EEXIST). This is causing the issue with multiple pwmchip.
26
27 Example on stm32 (stm32429i-eval) platform:
28 $ ls /sys/class/pwm
29 pwmchip0 pwmchip4
30
31 $ cd /sys/class/pwm/pwmchip0/
32 $ echo 0 > export
33 $ ls /sys/class/pwm
34 pwm0 pwmchip0 pwmchip4
35
36 $ cd /sys/class/pwm/pwmchip4/
37 $ echo 0 > export
38 sysfs: cannot create duplicate filename '/class/pwm/pwm0'
39 ...Exception stack follows...
40
41 This is also seen on other platform [2]
42
43 [1] https://lkml.org/lkml/2018/9/25/713
44 [2] https://lkml.org/lkml/2018/9/25/447
45
46 Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
47 Tested-by: Gottfried Haider <gottfried.haider@gmail.com>
48 Tested-by: Michal Vokáč <michal.vokac@ysoft.com>
49 Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
50 ---
51 drivers/pwm/sysfs.c | 1 -
52 1 file changed, 1 deletion(-)
53
54 --- a/drivers/pwm/sysfs.c
55 +++ b/drivers/pwm/sysfs.c
56 @@ -263,7 +263,6 @@ static int pwm_export_child(struct devic
57 export->pwm = pwm;
58 mutex_init(&export->lock);
59
60 - export->child.class = parent->class;
61 export->child.release = pwm_export_release;
62 export->child.parent = parent;
63 export->child.devt = MKDEV(0, 0);