From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Reding Subject: Re: [RFC v3 1/4] drm: Add support to find drm_panel by name Date: Tue, 3 Feb 2015 14:00:56 +0100 Message-ID: <20150203130054.GE15068@ulmo.nvidia.com> References: <1421839093-7635-1-git-send-email-shobhit.kumar@intel.com> <1421839093-7635-2-git-send-email-shobhit.kumar@intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1534652991==" Return-path: In-Reply-To: <1421839093-7635-2-git-send-email-shobhit.kumar@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Shobhit Kumar Cc: Jani Nikula , Daniel Vetter , intel-gfx , dri-devel List-Id: intel-gfx@lists.freedesktop.org --===============1534652991== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="DqhR8hV3EnoxUkKN" Content-Disposition: inline --DqhR8hV3EnoxUkKN Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. >=20 > Signed-off-by: Shobhit Kumar > --- > drivers/gpu/drm/drm_panel.c | 18 ++++++++++++++++++ > include/drm/drm_panel.h | 3 +++ > 2 files changed, 21 insertions(+) >=20 > 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 > =20 > +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) =3D=3D 0) { > + mutex_unlock(&panel_lock); > + return panel; > + } > + } > + > + mutex_unlock(&panel_lock); > + return NULL; > +} > +EXPORT_SYMBOL(drm_find_panel_by_name); > + > MODULE_AUTHOR("Thierry Reding "); > 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 --DqhR8hV3EnoxUkKN Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJU0MaGAAoJEN0jrNd/PrOhJogP/iF32DRRkIA4vHChD62rHKRU j/rF0W9RoipymI1qufzdrN42CEsPvg0/MClg1FfbzhnOtKGcDlCtPah9NlimST8y RiAT84u3oFIUTqGJvYikITqbS3kLWvCimpY/7xcC+aw2aKvpWEq3WRna8WJwW0Lb OMWOm6N4DU3eP3honG9l03mecKcC6ySWglnsCDmbdVvexREzmey5jMABxo1/RieE MTpbjDWhcZ9Bicw/jJL6UoXZvJCl0B6IMPKePvaFWQ5DoWmvrz2r2iZzuLQC9wgd mRpJSQuaJ9ednSUF8GAhzc5SOW+9y0rlw1LAHB/d0+ZVUw3Fqc7jn9RBksi3ee8M r/VSxBJfFpoiPDdLQpVnwZuAxNTToTwTDUm1v4C+64u7qon2zc5TEYZBwkM39Cg8 LmMxwoxqyoEkABrRnzFKuKP1wdvT+uXwR//tTOk9HODgEUTXiwOgjBI19vLyReEH zRf+5xgjRL/BXl0fgV+Bdn55I1SdZk7MovUEyBHPpcHTFch5OZnDmj9Dv/o2og6q U+8u6bWKDyhzWxl7rg62vG3EfjdjHEAl7IaM0CnGq25lxsBpV/14Q/R0fodE7l+n s5/WLsUN8fzR8BHjxpaZhL3IygG9HC50wwCdllty1q5k0wPEYYLWYoAlsrxsKw7d 9zGgzZ4uTS+XZwUekE7G =7q92 -----END PGP SIGNATURE----- --DqhR8hV3EnoxUkKN-- --===============1534652991== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHA6Ly9saXN0 cy5mcmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9pbnRlbC1nZngK --===============1534652991==--