]> git.baikalelectronics.ru Git - kernel.git/commit
Revert "pwm: Set class for exported channels in sysfs"
authorFabrice Gasnier <fabrice.gasnier@st.com>
Mon, 1 Oct 2018 13:23:56 +0000 (15:23 +0200)
committerThierry Reding <thierry.reding@gmail.com>
Fri, 12 Oct 2018 11:51:11 +0000 (13:51 +0200)
commit663600d1d4243869bae34c6be30334bec2df67f9
treec834725cf6230c60ed0919fd37e611f9a6d0243c
parent23fcfce77203b718c2aa4e4399b62c9c3a58bc9d
Revert "pwm: Set class for exported channels in sysfs"

This reverts commit b4c7764392af0b3c3753e410acb724ed7742165d ("pwm: Set
class for exported channels in sysfs") as it causes regression with
multiple pwm chip[1], when exporting a pwm channel (echo X > export):

- ABI (Documentation/ABI/testing/sysfs-class-pwm) states pwmX should be
  created in /sys/class/pwm/pwmchipN/pwmX
- Reverted patch causes new entry to be also created directly in
  /sys/class/pwm/pwmX
- 1st time, exporting pwmX will create an entry in /sys/class/pwm/pwmX
- class attributes are added under pwmX folder, such as export, unexport
  npwm, symlinks. This is wrong as it belongs to pwmchipN. It may cause
  bad behavior and report wrong values.
- when another export happens on another pwmchip, it can't be created
  (e.g. -EEXIST). This is causing the issue with multiple pwmchip.

Example on stm32 (stm32429i-eval) platform:
$ ls /sys/class/pwm
pwmchip0 pwmchip4

$ cd /sys/class/pwm/pwmchip0/
$ echo 0 > export
$ ls /sys/class/pwm
pwm0 pwmchip0 pwmchip4

$ cd /sys/class/pwm/pwmchip4/
$ echo 0 > export
sysfs: cannot create duplicate filename '/class/pwm/pwm0'
...Exception stack follows...

This is also seen on other platform [2]

[1] https://lkml.org/lkml/2018/9/25/713
[2] https://lkml.org/lkml/2018/9/25/447

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Tested-by: Gottfried Haider <gottfried.haider@gmail.com>
Tested-by: Michal Vokáč <michal.vokac@ysoft.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/sysfs.c