After commit 0edb555a65 ("platform: Make platform_driver::remove()
return void") .remove() is (again) the right callback to implement for
platform drivers.
Convert all platform drivers below drivers/hwmonto use .remove(), with
the eventual goal to drop struct platform_driver::remove_new(). As
.remove() and .remove_new() have the same prototypes, conversion is done
by just changing the structure member name in the driver initializer.
While touching these files, make indention of the struct initializer
consistent in several files.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Message-ID: <20241017155900.137357-2-u.kleine-koenig@baylibre.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Use scoped for_each_child_of_node_scoped() when iterating over device
nodes to make code a bit simpler.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Message-ID: <20240822062956.3490387-2-ruanjinjie@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Apart for the normal updates for dt bindings, cleanups and support for
new device variants to existing drivers this completes the conversion to
pwmchip_alloc() which was started in the v6.9 development cycle.
Using pwmchip_alloc() is a precondition to the character device support
which allows easier and faster access to PWM devices. However there are
some issues I want to clean up before including it in mainline, so this
isn't contained here despite it was in next for some time.
Thanks to Alexandre Mergnat, Binbin Zhou, Dmitry Rokosov, George Stark,
Jerome Brunet and Varshini Rajendran for their contributions. Further
thanks go to AngeloGioacchino Del Regno, Conor Dooley, David Lechner,
Fabrice Gasnier, Florian Fainelli, Guenter Roeck, Gustavo A. R. Silva,
Krzysztof Kozlowski and Rob Herring for valuable patch review.
-----BEGIN PGP SIGNATURE-----
iQEzBAABCgAdFiEEP4GsaTp6HlmJrf7Tj4D7WH0S/k4FAmZBz1cACgkQj4D7WH0S
/k4lXQf9HTSvbCz4x6PAxXPEe5trXlnUxGUsPa73mj2bVV8jpnJIy3vIrzZ0C2BG
dV6Pfo4rLZYdjFQJW3CalfQShmDXwBWhAbQ7jupt3CdJsZC8Uoqt3R9hJA6A2sp+
g8JkHZ3YateggLIUWWyOosanSGdzLKayOXtmjhHeywD+VTMAjHNglYlB8XjqzbnC
ti4F4Q4pJjjvap9oT6sKPGH05J43Z8LDJ3zo/0oQfo1NV5pPfxcBs6GqzuWROaW9
DHWovz/KV06oYfiHHmtgxQxC6HO1J4lUQTMoF2kjcRmVwqeZXPWn8l1mmpQynJ/P
94bixYQUUT+V2B0snhgnzEJNN6vEvw==
=JaHr
-----END PGP SIGNATURE-----
Merge tag 'pwm/for-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux
Pull pwm updates from Uwe Kleine-König:
"Apart for the normal updates for dt bindings, cleanups and support for
new device variants to existing drivers this completes the conversion
to pwmchip_alloc() which was started in the v6.9 development cycle.
Using pwmchip_alloc() is a precondition to the character device
support which allows easier and faster access to PWM devices. However
there are some issues I want to clean up before including it in
mainline, so this isn't contained here despite it was in next for some
time.
Thanks to Alexandre Mergnat, Binbin Zhou, Dmitry Rokosov, George
Stark, Jerome Brunet and Varshini Rajendran for their contributions.
Further thanks go to AngeloGioacchino Del Regno, Conor Dooley, David
Lechner, Fabrice Gasnier, Florian Fainelli, Guenter Roeck, Gustavo A.
R. Silva, Krzysztof Kozlowski and Rob Herring for valuable patch
review"
* tag 'pwm/for-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux: (34 commits)
pwm: pca9685: Drop explicit initialization of struct i2c_device_id::driver_data to 0
dt-bindings: pwm: snps,dw-apb-timers: Do not require pwm-cells twice
dt-bindings: pwm: mediatek,pwm-disp: Do not require pwm-cells twice
dt-bindings: pwm: mediatek,mt2712: Do not require pwm-cells twice
dt-bindings: pwm: marvell,pxa: Do not require pwm-cells twice
dt-bindings: pwm: google,cros-ec: Do not require pwm-cells twice
dt-bindings: pwm: bcm2835: Do not require pwm-cells twice
pwm: meson: Use mul_u64_u64_div_u64() for frequency calculating
pwm: meson: Add check for error from clk_round_rate()
pwm: meson: Drop unneeded check in .get_state()
dt-bindings: pwm: mediatek,pwm-disp: add compatible for mt8365 SoC
pwm: meson: Add generic compatible for meson8 to sm1
pwm: bcm2835: Drop open coded variant of devm_clk_rate_exclusive_get()
pwm: bcm2835: Introduce a local variable for &pdev->dev
pwm: stm32: Calculate prescaler with a division instead of a loop
pwm: stm32: Fix for settings using period > UINT32_MAX
pwm: stm32: Improve precision of calculation in .apply()
pwm: stm32: Add error messages in .probe()'s error paths
pwm: Make pwmchip_[sg]et_drvdata() a wrapper around dev_set_drvdata()
pwm: Don't check pointer for being non-NULL after use
...
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Link: https://lore.kernel.org/r/20240409085552.19868-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
The driver support two functions: PWM and Tachometer. The PWM feature can
handle up to 16 output ports, while the Tachometer can monitor to up to 16
input ports as well. This driver implements them by exposing two kernel
subsystems: PWM and HWMON. The PWM subsystem can be utilized alongside
existing drivers for controlling elements such as fans (pwm-fan.c),
beepers (pwm-beeper.c) and so on. Through the HWMON subsystem, the driver
provides sysfs interfaces for fan.
Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
Link: https://lore.kernel.org/r/20240221104025.1306227-4-billy_tsai@aspeedtech.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>