Hello, my eventual goal is to provide a chardev API to PWMs similar to the gpioctl API. For that to work flawlessly it's required that a pwmchip stays around while the corresponding device is opened even if the respective lowlevel driver goes away. See Wolfram's EOSS talk[1] for some more details. This series provides a new function devm_pwmchip_alloc() that allocates a struct pwm_chip together with driver data. Currently this is still using devm_kzalloc and so goes away when the device is unbound from the driver. However this can be changed without having to touch all drivers again. The function devm_pwmchip_alloc() is modelled after similar functions from spi, counter and networking code. The first patch provides the allocator function and an accessor for driver data, the following patches convert a subset of the available drivers to this new API. The series is fully bisectable and the only interdependency is that patch #1 is needed for all other patches. The idea is to complete conversion of all remaining drivers and then add a struct device to struct pwm_chip and so make pwm_chip reference counted. There are still a few more drivers to convert, but I thought to send out the current patch set to get some early feedback. The base for this series is v6.5-rc1 plus the following series: [PATCH v2 0/8] pwm: Get rid of pwm_[sg]et_chip_data() 20230705080650.2353391-1-u.kleine-koenig@xxxxxxxxxxxxxx [PATCH 0/2] pwm: stm32: A (small) fix and a cleanup 20230713155142.2454010-1-u.kleine-koenig@xxxxxxxxxxxxxx [PATCH 00/10] pwm: Constistenly name pwm_chip variables "chip" 20230714205623.2496590-1-u.kleine-koenig@xxxxxxxxxxxxxx [PATCH] staging: greybus: pwm: Drop unused member from driver struct 20230714201622.2490792-1-u.kleine-koenig@xxxxxxxxxxxxxx [PATCH] pwm: lpc18xx-sct: Simplify using devm_clk_get_enabled() 20230718144128.371818-1-u.kleine-koenig@xxxxxxxxxxxxxx [PATCH] pwm: lpc32xx: remove handling of PWM channels 20230717155257.2568627-1-u.kleine-koenig@xxxxxxxxxxxxxx [PATCH] pwm: pxa: Don't reimplement of_device_get_match_data() 20230718150657.1728166-1-u.kleine-koenig@xxxxxxxxxxxxxx [PATCH] pwm: ntxec: Drop a write-only variable from driver data 20230718152327.2583886-1-u.kleine-koenig@xxxxxxxxxxxxxx [PATCH] gpio: mvebu: Make use of devm_pwmchip_add 20230717142743.2555739-1-u.kleine-koenig@xxxxxxxxxxxxxx [PATCH] pwm: ntxec: Use device_set_of_node_from_dev() 20230718175310.3946687-1-u.kleine-koenig@xxxxxxxxxxxxxx [PATCH] pwm: berlin: Simplify using devm functions 20230718175545.3946935-1-u.kleine-koenig@xxxxxxxxxxxxxx I'm not sure the build bots can properly handle that, so it would be great to get these base series into next soon. Best regards Uwe [1] https://static.sched.com/hosted_files/eoss2023/e3/LifecycleIssues_WolframSang_2023.pdf Uwe Kleine-König (18): pwm: Provide devm_pwmchip_alloc() function pwm: ab8500: Make use of devm_pwmchip_alloc() function pwm: apple: Make use of devm_pwmchip_alloc() function pwm: berlin: Make use of devm_pwmchip_alloc() function pwm: clk: Make use of devm_pwmchip_alloc() function pwm: fsl-ftm: Make use of devm_pwmchip_alloc() function pwm: hibvt: Make use of devm_pwmchip_alloc() function pwm: imx1: Make use of devm_pwmchip_alloc() function pwm: imx27: Make use of devm_pwmchip_alloc() function pwm: jz4740: Make use of devm_pwmchip_alloc() function pwm: keembay: Make use of devm_pwmchip_alloc() function pwm: lpc18xx-sct: Make use of devm_pwmchip_alloc() function pwm: lpc32xx: Make use of devm_pwmchip_alloc() function pwm: mxs: Make use of devm_pwmchip_alloc() function pwm: ntxec: Make use of devm_pwmchip_alloc() function pwm: pxa: Make use of devm_pwmchip_alloc() function pwm: stm32: Make use of devm_pwmchip_alloc() function gpio: mvebu: Make use of devm_pwmchip_alloc() function .../driver-api/driver-model/devres.rst | 1 + Documentation/driver-api/pwm.rst | 10 ++-- drivers/gpio/gpio-mvebu.c | 17 +++---- drivers/pwm/core.c | 23 +++++++++ drivers/pwm/pwm-ab8500.c | 17 +++---- drivers/pwm/pwm-apple.c | 17 +++---- drivers/pwm/pwm-berlin.c | 28 ++++++----- drivers/pwm/pwm-clk.c | 26 +++++----- drivers/pwm/pwm-fsl-ftm.c | 47 ++++++++++--------- drivers/pwm/pwm-hibvt.c | 26 +++++----- drivers/pwm/pwm-imx1.c | 16 +++---- drivers/pwm/pwm-imx27.c | 19 ++++---- drivers/pwm/pwm-jz4740.c | 25 +++++----- drivers/pwm/pwm-keembay.c | 16 +++---- drivers/pwm/pwm-lpc18xx-sct.c | 24 +++++----- drivers/pwm/pwm-lpc32xx.c | 18 +++---- drivers/pwm/pwm-mxs.c | 19 ++++---- drivers/pwm/pwm-ntxec.c | 27 +++++------ drivers/pwm/pwm-pxa.c | 20 ++++---- drivers/pwm/pwm-stm32.c | 42 +++++++++++------ include/linux/pwm.h | 4 ++ 21 files changed, 249 insertions(+), 193 deletions(-) base-commit: 06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5 prerequisite-patch-id: c856e0baabfc22d250b7ce881427cdb74613e69a prerequisite-patch-id: 2a5f9c04e4b5794b5a5d0b30280f75b76a05092b prerequisite-patch-id: a48b05b94b61f8029b4bb9a78ae1f2cd8c476d80 prerequisite-patch-id: c7dfd3798f024b27b6e236da1eae40b79bb3e281 prerequisite-patch-id: 313ada72ab57438a8d54df0df9c0926bb4f69b36 prerequisite-patch-id: 318824c08f3e7d6500e3c5a47a11c5daffaea34a prerequisite-patch-id: ea75bfd48ea4d0132c637172564bc1a57061377a prerequisite-patch-id: 278b25a8d5fef49f7e5c46b627d4862d0b24baaf prerequisite-patch-id: a3b11e0a7c8f6564e668e2ed1b637351e5fd9dd2 prerequisite-patch-id: 55588b25ea7ce69d716a33a7aaed662d75bb9687 prerequisite-patch-id: 399d7e94bafc5dc970a0f213745e4982066b8583 prerequisite-patch-id: 87aca1beb6efdaab95ddce7e2d9eed89a89252a1 prerequisite-patch-id: e13e3db807f2c5b49180e24492f496f8e945e42d prerequisite-patch-id: 8712b17dee2a5f2441908e2de260ceec8ce6ff37 prerequisite-patch-id: 987b0a351801b1e361932beeeedbc5245540037c prerequisite-patch-id: 869d3932983f3ae6a8982e186b27df11c56e9e5e prerequisite-patch-id: 4f60b0afb435011b58b7cc6bead1d385db7d8e11 prerequisite-patch-id: 0e86da52c02300d407d4c0b6f2b9f8293e3320dc prerequisite-patch-id: a731856f5d7dee7f3465f021e5c56981a803b22d prerequisite-patch-id: b759d036cf578083ec76aa7ba01dd8643667d4f6 prerequisite-patch-id: 9abd8b16e74625e2630655da7d22e75bbe0c6231 prerequisite-patch-id: 6ad03ceb505a293f2308235161c54ff6b508e59f prerequisite-patch-id: cb6d75be9b72cc04069b6952ba9e5ac80a26a1ab prerequisite-patch-id: c8fa7296a736f42ec49ab1334cb19947d647a2b4 prerequisite-patch-id: b601ea695815fb65ed704349302ba66442277fc3 prerequisite-patch-id: 7a0daa2918f8a317333e57c1d1698078a1968720 prerequisite-patch-id: b6762f6deeb74aaf73afe2d8dd816d48cec4e1ee prerequisite-patch-id: a0c8d63424241e64c3e5f9991ea04018a51fcc94 -- 2.39.2