From: Jani Nikula <jani.nikula@intel.com>
To: intel-gfx <intel-gfx@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@intel.com>,
jacob.jun.pan@intel.com, Shobhit Kumar <shobhit.kumar@intel.com>
Subject: Re: [RFC v2 1/4] drm: Add support to find drm_panel by name
Date: Fri, 09 Jan 2015 14:50:10 +0200 [thread overview]
Message-ID: <87a91syv7h.fsf@intel.com> (raw)
In-Reply-To: <1420206085-2913-2-git-send-email-shobhit.kumar@intel.com>
On Fri, 02 Jan 2015, Shobhit Kumar <shobhit.kumar@intel.com> wrote:
> For scenarios where OF is not available, we can use panel identification by
> name.
>
> Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
> ---
> drivers/gpu/drm/drm_panel.c | 18 ++++++++++++++++++
> include/drm/drm_panel.h | 3 +++
> 2 files changed, 21 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> index 2ef988e..773ebd6 100644
> --- a/drivers/gpu/drm/drm_panel.c
> +++ b/drivers/gpu/drm/drm_panel.c
> @@ -95,6 +95,24 @@ struct drm_panel *of_drm_find_panel(struct device_node *np)
> EXPORT_SYMBOL(of_drm_find_panel);
> #endif
>
> +struct drm_panel *name_drm_find_panel(const char *name)
> +{
> + struct drm_panel *panel;
> +
> + mutex_lock(&panel_lock);
> +
> + list_for_each_entry(panel, &panel_list, list) {
> + if (strcmp(panel->name, name) == 0) {
> + mutex_unlock(&panel_lock);
> + return panel;
> + }
> + }
> +
> + mutex_unlock(&panel_lock);
> + return NULL;
> +}
> +EXPORT_SYMBOL(name_drm_find_panel);
This patch needs to be sent to drm-devel.
The name should probably be something like drm_find_panel_by_name.
I have a slightly uneasy feeling about handing out drm_panel pointers
(both from here and of_drm_find_panel) without refcounting. If the panel
driver gets removed, whoever called the find functions will have a
dangling pointer. I supposed this will be discussed on drm-devel.
BR,
Jani.
> +
> MODULE_AUTHOR("Thierry Reding <treding@nvidia.com>");
> MODULE_DESCRIPTION("DRM panel infrastructure");
> MODULE_LICENSE("GPL and additional rights");
> diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
> index 1fbcc96..b120b5d 100644
> --- a/include/drm/drm_panel.h
> +++ b/include/drm/drm_panel.h
> @@ -74,6 +74,7 @@ struct drm_panel {
> struct drm_device *drm;
> struct drm_connector *connector;
> struct device *dev;
> + char name[NAME_MAX];
>
> const struct drm_panel_funcs *funcs;
>
> @@ -137,4 +138,6 @@ static inline struct drm_panel *of_drm_find_panel(struct device_node *np)
> }
> #endif
>
> +struct drm_panel *name_drm_find_panel(const char *name);
> +
> #endif
> --
> 1.9.1
>
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-01-09 12:49 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-02 13:41 [RFC v2 0/4] Crystal Cove PMIC based Panel and Backlight Control Shobhit Kumar
2015-01-02 13:41 ` [RFC v2 1/4] drm: Add support to find drm_panel by name Shobhit Kumar
2015-01-09 12:50 ` Jani Nikula [this message]
2015-01-12 7:37 ` Kumar, Shobhit
2015-01-12 23:08 ` [Intel-gfx] " Daniel Vetter
2015-01-13 15:14 ` Andrzej Hajda
2015-01-16 12:19 ` Thierry Reding
2015-01-02 13:41 ` [RFC v2 2/4] mfd: Add a new cell device for panel controlled by crystal cove pmic Shobhit Kumar
2015-01-02 13:41 ` [RFC v2 3/4] drm/panel: Add new panel driver based on " Shobhit Kumar
2015-01-09 13:08 ` Jani Nikula
2015-01-12 8:26 ` Kumar, Shobhit
2015-01-12 9:02 ` Kumar, Shobhit
2015-01-02 13:41 ` [RFC v2 4/4] drm/i915: Enable DSI panel enable/disable based on PMIC Shobhit Kumar
2015-01-09 13:17 ` Jani Nikula
2015-01-12 8:23 ` Kumar, Shobhit
2015-01-12 23:11 ` Daniel Vetter
2015-01-07 5:06 ` [RFC v2 0/4] Crystal Cove PMIC based Panel and Backlight Control Kumar, Shobhit
2015-01-09 13:20 ` Jani Nikula
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=87a91syv7h.fsf@intel.com \
--to=jani.nikula@intel.com \
--cc=daniel.vetter@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jacob.jun.pan@intel.com \
--cc=shobhit.kumar@intel.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