[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210218162821.GP154917@linux.intel.com>
Date: Thu, 18 Feb 2021 08:28:21 -0800
From: mark gross <mgross@...ux.intel.com>
To: Matti Vaittinen <matti.vaittinen@...rohmeurope.com>
Cc: mazziesaccount@...il.com,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
MyungJoo Ham <myungjoo.ham@...sung.com>,
Chanwoo Choi <cw00.choi@...sung.com>,
Andy Gross <agross@...nel.org>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Jean Delvare <jdelvare@...e.com>,
Guenter Roeck <linux@...ck-us.net>,
Hans de Goede <hdegoede@...hat.com>,
Mark Gross <mgross@...ux.intel.com>,
Sebastian Reichel <sre@...nel.org>,
Chen-Yu Tsai <wens@...e.org>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Wim Van Sebroeck <wim@...ux-watchdog.org>,
Saravana Kannan <saravanak@...gle.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Joerg Roedel <jroedel@...e.de>,
Dan Williams <dan.j.williams@...el.com>,
Bartosz Golaszewski <bgolaszewski@...libre.com>,
linux-kernel@...r.kernel.org, linux-arm-msm@...r.kernel.org,
linux-hwmon@...r.kernel.org, platform-driver-x86@...r.kernel.org,
linux-pm@...r.kernel.org, linux-watchdog@...r.kernel.org
Subject: Re: [RFC PATCH 0/7] Add managed version of delayed work init
On Sat, Feb 13, 2021 at 01:58:17PM +0200, Matti Vaittinen wrote:
> 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
why the (a) and not just a?
> 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.
s/own/one
--mark
>
> 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 =]
Powered by blists - more mailing lists