public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Shobhit Kumar <shobhit.kumar@intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>,
	Daniel Vetter <daniel.vetter@intel.com>,
	intel-gfx <intel-gfx@lists.freedesktop.org>,
	dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [RFC v3 1/4] drm: Add support to find drm_panel by name
Date: Tue, 3 Feb 2015 14:00:56 +0100	[thread overview]
Message-ID: <20150203130054.GE15068@ulmo.nvidia.com> (raw)
In-Reply-To: <1421839093-7635-2-git-send-email-shobhit.kumar@intel.com>


[-- Attachment #1.1: Type: text/plain, Size: 1905 bytes --]

On Wed, Jan 21, 2015 at 04:48:10PM +0530, Shobhit Kumar 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..e1cb8cf 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 *drm_find_panel_by_name(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(drm_find_panel_by_name);
> +
>  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..1ef9ff3 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];

I thought I had said this before, but I can't find any record, so here
goes again: NAME_MAX is a pretty large number and it increases the size
of this structure a lot. Why not use dev_name(dev) to do the matching?
Or if that doesn't work for some reason, allocate a string of the right
size, or use a static one.

Thierry

[-- Attachment #1.2: Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-02-03 13:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-21 11:18 [RFC v3 0/4] Crystal Cove PMIC based Panel and Backlight Control Shobhit Kumar
2015-01-21 11:18 ` [RFC v3 1/4] drm: Add support to find drm_panel by name Shobhit Kumar
2015-02-03 13:00   ` Thierry Reding [this message]
2015-02-04 11:14   ` [PATCH] " Shobhit Kumar
2015-02-04 14:01     ` shuang.he
2015-01-21 11:18 ` [RFC v3 2/4] mfd: Add a new cell device for panel controlled by crystal cove pmic Shobhit Kumar
2015-02-03 13:05   ` Thierry Reding
2015-02-04  5:59     ` Shobhit Kumar
2015-01-21 11:18 ` [RFC v3 3/4] drm/i915: Add new panel driver based on " Shobhit Kumar
2015-02-03 13:16   ` Thierry Reding
2015-02-04  6:55     ` Shobhit Kumar
2015-02-05  9:46     ` [Intel-gfx] " Daniel Vetter
2015-01-21 11:18 ` [RFC v3 4/4] drm/i915: Enable DSI panel enable/disable based on PMIC Shobhit Kumar
  -- strict thread matches above, loose matches on Subject: below --
2015-01-27  9:31 [RFC v3 0/4] Crystal Cove PMIC based Panel and Backlight Control Shobhit Kumar
2015-01-27  9:31 ` [RFC v3 1/4] drm: Add support to find drm_panel by name Shobhit Kumar

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=20150203130054.GE15068@ulmo.nvidia.com \
    --to=thierry.reding@gmail.com \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@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