linux-uconsole/drivers/pwm
Fabrice Gasnier 7f68aa2e3e Revert "pwm: Set class for exported channels in sysfs"
commit c289d66252 upstream.

This reverts commit 7e5d1fd75c ("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>
Cc: John Keeping <john@metanate.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-08-25 10:47:46 +02:00
..
core.c pwm: Fix deadlock warning when removing PWM device 2019-06-15 11:54:10 +02:00
Kconfig pwm: mediatek: Add MT7628 support 2018-08-20 11:36:07 +02:00
Makefile
pwm-ab8500.c
pwm-atmel-hlcdc.c
pwm-atmel-tcb.c pwm: simplify getting .drvdata 2018-04-30 10:40:57 +02:00
pwm-atmel.c
pwm-bcm-iproc.c
pwm-bcm-kona.c
pwm-bcm2835.c
pwm-berlin.c pwm: berlin: Don't use broken prescaler values 2018-07-09 18:57:03 +02:00
pwm-brcmstb.c
pwm-clps711x.c
pwm-crc.c
pwm-cros-ec.c pwm: cros-ec: Switch to SPDX identifier 2018-07-09 19:02:23 +02:00
pwm-ep93xx.c
pwm-fsl-ftm.c pwm: fsl-ftm: Enable support for the new SoC i.MX8QM 2018-07-09 19:08:26 +02:00
pwm-hibvt.c
pwm-img.c
pwm-imx.c pwm: imx: Switch to SPDX identifier 2018-07-09 18:59:14 +02:00
pwm-jz4740.c
pwm-lp3943.c treewide: devm_kzalloc() -> devm_kcalloc() 2018-06-12 16:19:22 -07:00
pwm-lpc18xx-sct.c
pwm-lpc32xx.c
pwm-lpss-pci.c
pwm-lpss-platform.c pwm: lpss: platform: Save/restore the ctrl register over a suspend/resume 2018-06-06 10:00:39 +02:00
pwm-lpss.c pwm: lpss: platform: Save/restore the ctrl register over a suspend/resume 2018-06-06 10:00:39 +02:00
pwm-lpss.h pwm: lpss: platform: Save/restore the ctrl register over a suspend/resume 2018-06-06 10:00:39 +02:00
pwm-mediatek.c pwm: mediatek: Add MT7628 support 2018-08-20 11:36:07 +02:00
pwm-meson.c pwm: meson: Use the spin-lock only to protect register modifications 2019-06-15 11:54:03 +02:00
pwm-mtk-disp.c
pwm-mxs.c pwm: mxs: Switch to SPDX identifier 2018-07-12 09:03:06 +02:00
pwm-omap-dmtimer.c pwm: omap-dmtimer: Return -EPROBE_DEFER if no dmtimer platform data 2018-08-20 11:32:19 +02:00
pwm-pca9685.c
pwm-puv3.c
pwm-pxa.c
pwm-rcar.c pwm: simplify getting .drvdata 2018-04-30 10:40:57 +02:00
pwm-renesas-tpu.c
pwm-rockchip.c
pwm-samsung.c
pwm-spear.c
pwm-sti.c
pwm-stm32-lp.c pwm: stm32-lp: Remove useless loop in stm32_pwm_lp_remove() 2018-08-20 11:32:25 +02:00
pwm-stm32.c pwm: Changes for v4.18-rc1 2018-06-14 16:25:43 +09:00
pwm-stmpe.c
pwm-sun4i.c
pwm-tegra.c
pwm-tiecap.c
pwm-tiehrpwm.c pwm: tiehrpwm: Update shadow register for disabling PWMs 2019-06-15 11:54:10 +02:00
pwm-tipwmss.c
pwm-twl-led.c
pwm-twl.c
pwm-vt8500.c
pwm-zx.c
sysfs.c Revert "pwm: Set class for exported channels in sysfs" 2019-08-25 10:47:46 +02:00