linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/7] Add managed version of delayed work init
@ 2021-02-13 11:58 Matti Vaittinen
  2021-02-13 11:58 ` [RFC PATCH 1/7] drivers: base: Add resource " Matti Vaittinen
                   ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: Matti Vaittinen @ 2021-02-13 11:58 UTC (permalink / raw)
  To: mazziesaccount, matti.vaittinen
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, MyungJoo Ham,
	Chanwoo Choi, Andy Gross, Bjorn Andersson, Jean Delvare,
	Guenter Roeck, Hans de Goede, Mark Gross, Sebastian Reichel,
	Chen-Yu Tsai, Liam Girdwood, Mark Brown, Wim Van Sebroeck,
	Saravana Kannan, Heikki Krogerus, Andy Shevchenko, Joerg Roedel,
	Dan Williams, Bartosz Golaszewski, linux-kernel, linux-arm-msm,
	linux-hwmon, platform-driver-x86, linux-pm, linux-watchdog

It's not rare that device drivers need delayed work.
It's not rare that this work needs driver's data.

Often this means that driver must ensure the work is not queued when
driver exits. Usually this is done by ensuring new work is not added and
then calling cancel_delayed_work_sync() at remove(). In many cases this
may also require cleanup at probe error path - which is easy to forget.

It might be helpful for (a) few drivers if there was a work init
function which would ensure cancel_delayed_work_sync() is called at
driver exit. So this series implements one on top of devm and replaces
the obvious cases where only thing remove call-back in a driver does is
cancelling the work. There might be other cases where we could switch
more than just work cancellation to use managed version and thus get rid
of remove.

Main reson why this is RFC is that I had hard time deciding where this
function should be introduced. It's not nice to include all device stuff
in workqueue - because many workqueue users are not interested in
devices. In same way, not all of the devices are interested in WQs.
OTOH, adding own file just for this sounds like an overkill.

This time I decided that it is more correct that devices use WQs than
that WQs use devices. Hence the function is introduced in
include/linux/device.h and drivers/base/devres.c

--

Matti Vaittinen (7):
  drivers: base: Add resource managed version of delayed work init
  extconn: Clean-up few drivers by using managed work init
  hwmon: raspberry-pi: Clean-up few drivers by using managed work init
  platform/x86: gpd pocket fan: Clean-up by using managed work init
  power: supply: Clean-up few drivers by using managed work init
  regulator: qcom_spmi-regulator: Clean-up by using managed work init
  watchdog: retu_wdt: Clean-up by using managed work init

 drivers/base/devres.c                        | 33 ++++++++++++++++++++
 drivers/extcon/extcon-gpio.c                 | 14 ++-------
 drivers/extcon/extcon-intel-int3496.c        | 15 ++-------
 drivers/extcon/extcon-palmas.c               | 16 +++-------
 drivers/extcon/extcon-qcom-spmi-misc.c       | 16 +++-------
 drivers/hwmon/raspberrypi-hwmon.c            | 16 +++-------
 drivers/platform/x86/gpd-pocket-fan.c        | 16 +++-------
 drivers/power/supply/axp20x_usb_power.c      | 15 +++------
 drivers/power/supply/bq24735-charger.c       | 17 +++-------
 drivers/power/supply/ltc2941-battery-gauge.c | 19 ++++-------
 drivers/power/supply/sbs-battery.c           | 15 +++------
 drivers/regulator/qcom_spmi-regulator.c      | 33 +++++---------------
 drivers/watchdog/retu_wdt.c                  | 21 +++----------
 include/linux/device.h                       |  5 +++
 14 files changed, 95 insertions(+), 156 deletions(-)


base-commit: 92bf22614b21a2706f4993b278017e437f7785b3
-- 
2.25.4


-- 
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND

~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the translation =] 

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2021-02-19 10:36 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-13 11:58 [RFC PATCH 0/7] Add managed version of delayed work init Matti Vaittinen
2021-02-13 11:58 ` [RFC PATCH 1/7] drivers: base: Add resource " Matti Vaittinen
2021-02-13 12:16   ` Greg Kroah-Hartman
2021-02-13 12:26     ` Vaittinen, Matti
2021-02-13 12:38       ` gregkh
2021-02-13 13:18     ` Hans de Goede
2021-02-13 13:33       ` Greg Kroah-Hartman
2021-02-13 14:38         ` Hans de Goede
2021-02-13 14:52           ` Hans de Goede
2021-02-15  6:58       ` Matti Vaittinen
2021-02-13 15:03   ` Hans de Goede
2021-02-13 15:27     ` Guenter Roeck
2021-02-13 15:59       ` Hans de Goede
2021-02-13 18:17         ` Guenter Roeck
2021-02-15  7:22         ` Vaittinen, Matti
2021-02-15 10:37           ` Hans de Goede
2021-02-15 11:31             ` gregkh
2021-02-15 11:43               ` Hans de Goede
2021-02-15 13:12                 ` Vaittinen, Matti
2021-02-13 12:18 ` [RFC PATCH 7/7] watchdog: retu_wdt: Clean-up by using managed " Matti Vaittinen
2021-02-18 16:28 ` [RFC PATCH 0/7] Add managed version of delayed " mark gross
2021-02-19 10:35   ` Matti Vaittinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).