From: Daniel Thompson <daniel.thompson@linaro.org>
To: "Meghana Madhyastha" <meghana.madhyastha@gmail.com>,
"Lee Jones" <lee.jones@linaro.org>,
"Jingoo Han" <jingoohan1@gmail.com>,
"Thierry Reding" <thierry.reding@gmail.com>,
"Noralf Trønnes" <noralf@tronnes.org>,
"Tomi Valkeinen" <tomi.valkeinen@ti.com>,
"Daniel Vetter" <daniel.vetter@intel.com>,
"Sean Paul" <seanpaul@chromium.org>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v16 05/10] video: backlight: Add devres versions of of_find_backlight
Date: Wed, 17 Jan 2018 17:09:57 +0000 [thread overview]
Message-ID: <8e3ad1f2-b4df-10a4-844c-8bbc8801aaf5@linaro.org> (raw)
In-Reply-To: <87984b3cb205b19d50f3093e34c6dc8d8179b768.1516098341.git.meghana.madhyastha@gmail.com>
On 16/01/18 10:34, Meghana Madhyastha wrote:
> Add devm_of_find_backlight and the corresponding release
> function because some drivers use devres versions of functions
> for acquiring device resources.
>
> Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
> ---
> drivers/video/backlight/backlight.c | 29 +++++++++++++++++++++++++++++
> include/linux/backlight.h | 7 +++++++
> 2 files changed, 36 insertions(+)
>
> diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
> index 7e4a5d77d..b3f76945f 100644
> --- a/drivers/video/backlight/backlight.c
> +++ b/drivers/video/backlight/backlight.c
> @@ -620,6 +620,35 @@ struct backlight_device *of_find_backlight(struct device *dev)
> }
> EXPORT_SYMBOL(of_find_backlight);
>
> +static void devm_backlight_put(void *data)
> +{
> + backlight_put(data);
Shouldn't this be using devres_release()?
> +}
> +
> +/**
> + * devm_of_find_backlight - Resource-managed of_find_backlight()
> + * @dev: Device
> + *
> + * Device managed version of of_find_backlight(). The reference on the backlight
> + * device is automatically dropped on driver detach.
> + */
> +struct backlight_device *devm_of_find_backlight(struct device *dev)
> +{
> + struct backlight_device *bd;
> + int ret;
> +
> + bd = of_find_backlight(dev);
> + if (IS_ERR_OR_NULL(bd))
> + return bd;
> + ret = devm_add_action(dev, devm_backlight_put, bd);
> + if (ret) {
> + backlight_put(bd);
> + return ERR_PTR(ret);
> + }
> + return bd;
> +}
> +EXPORT_SYMBOL(devm_of_find_backlight);
> +
> static void __exit backlight_class_exit(void)
> {
> class_destroy(backlight_class);
> diff --git a/include/linux/backlight.h b/include/linux/backlight.h
> index 32ea510da..1d373f5a6 100644
> --- a/include/linux/backlight.h
> +++ b/include/linux/backlight.h
> @@ -215,11 +215,18 @@ of_find_backlight_by_node(struct device_node *node)
>
> #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
> struct backlight_device *of_find_backlight(struct device *dev);
> +struct backlight_device *devm_of_find_backlight(struct device *dev);
> #else
> static inline struct backlight_device *of_find_backlight(struct device *dev)
> {
> return NULL;
> }
> +
> +static inline struct backlight_device *
> +devm_of_find_backlight(struct device *dev)
> +{
> + return NULL;
> +}
> #endif
>
> #endif
>
next prev parent reply other threads:[~2018-01-17 17:10 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-16 10:31 [PATCH v16 00/10] Add backlight helper functions Meghana Madhyastha
2018-01-16 10:31 ` [PATCH v16 01/10] video: backlight: Add helpers to enable and disable backlight Meghana Madhyastha
2018-01-16 16:50 ` Noralf Trønnes
2018-01-17 17:00 ` Daniel Thompson
2018-01-17 21:24 ` Daniel Vetter
2018-01-17 22:03 ` Noralf Trønnes
2018-01-18 10:59 ` Meghana Madhyastha
2018-01-18 12:02 ` Daniel Thompson
2018-01-16 10:32 ` [PATCH v16 02/10] drm/tinydrm: Convert tinydrm_enable/disable_backlight to backlight_enable/disable Meghana Madhyastha
2018-01-16 16:51 ` Noralf Trønnes
2018-01-16 10:33 ` [PATCH v16 03/10] video: backlight: Add of_find_backlight helper in backlight.c Meghana Madhyastha
2018-01-16 16:56 ` Noralf Trønnes
2018-01-17 17:01 ` Daniel Thompson
2018-01-16 10:34 ` [PATCH v16 04/10] drm/tinydrm: Replace tinydrm_of_find_backlight with of_find_backlight Meghana Madhyastha
2018-01-16 16:59 ` Noralf Trønnes
2018-01-16 10:34 ` [PATCH v16 05/10] video: backlight: Add devres versions of of_find_backlight Meghana Madhyastha
2018-01-16 17:02 ` Noralf Trønnes
2018-01-17 17:09 ` Daniel Thompson [this message]
2018-01-18 11:02 ` Meghana Madhyastha
2018-01-18 11:50 ` Daniel Thompson
2018-01-16 10:34 ` [PATCH v16 06/10] drm/tinydrm: Call devres version " Meghana Madhyastha
2018-01-16 17:03 ` Noralf Trønnes
2018-01-16 10:35 ` [PATCH v16 07/10] drm/panel: Use backlight_enable/disable helpers Meghana Madhyastha
2018-01-16 17:11 ` Noralf Trønnes
2018-01-16 10:35 ` [PATCH v16 08/10] drm/omapdrm: " Meghana Madhyastha
2018-01-16 10:36 ` [PATCH v16 09/10] drm/panel: Use of_find_backlight helper Meghana Madhyastha
2018-01-16 17:08 ` Noralf Trønnes
2018-01-18 12:07 ` Meghana Madhyastha
2018-01-18 14:51 ` Noralf Trønnes
2018-01-16 10:36 ` [PATCH v16 10/10] drm/omapdrm: " Meghana Madhyastha
2018-01-16 21:46 ` [PATCH v16 00/10] Add backlight helper functions Sean Paul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8e3ad1f2-b4df-10a4-844c-8bbc8801aaf5@linaro.org \
--to=daniel.thompson@linaro.org \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jingoohan1@gmail.com \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=meghana.madhyastha@gmail.com \
--cc=noralf@tronnes.org \
--cc=seanpaul@chromium.org \
--cc=thierry.reding@gmail.com \
--cc=tomi.valkeinen@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®