From: Maxime Ripard Subject: Re: [PATCH] drm/sun4i: use sun4i_tcon_of_table to check if a device node is a TCON Date: Thu, 30 Nov 2017 16:46:36 +0100 Message-ID: <20171130154636.kobtecri2i3rg6ea@flea.lan> References: <20171127084632.25511-1-wens@csie.org> <20171128100132.gcgk6ijhh4lndaax@flea.home> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1881510009==" Return-path: Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by gabe.freedesktop.org (Postfix) with ESMTP id C3F0E6EB05 for ; Thu, 30 Nov 2017 15:46:37 +0000 (UTC) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Chen-Yu Tsai Cc: David Airlie , dri-devel List-Id: dri-devel@lists.freedesktop.org --===============1881510009== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="nhc4zqmvmzug6vtp" Content-Disposition: inline --nhc4zqmvmzug6vtp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 29, 2017 at 11:43:14AM +0800, Chen-Yu Tsai wrote: > On Tue, Nov 28, 2017 at 6:01 PM, Maxime Ripard > wrote: > > Hi, > > > > On Mon, Nov 27, 2017 at 04:46:32PM +0800, Chen-Yu Tsai wrote: > >> The sun4i DRM driver maintains a list of compatible strings it uses to > >> check if a device node within the display component graph is a TCON. > >> The TCON driver also has this list, used to bind the TCON driver to > >> the device. These two lists are identical. > >> > >> Instead of maintaining two identical lists, export the list from the > >> TCON driver for the DRM driver to use. > >> > >> Suggested-by: Rob Herring > >> Signed-off-by: Chen-Yu Tsai > >> --- > >> drivers/gpu/drm/sun4i/sun4i_drv.c | 8 +------- > >> drivers/gpu/drm/sun4i/sun4i_tcon.c | 4 +++- > >> drivers/gpu/drm/sun4i/sun4i_tcon.h | 2 ++ > >> 3 files changed, 6 insertions(+), 8 deletions(-) > >> > >> diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i= /sun4i_drv.c > >> index 75c76cdd82bc..49215d91c853 100644 > >> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c > >> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c > >> @@ -187,13 +187,7 @@ static bool sun4i_drv_node_is_frontend(struct dev= ice_node *node) > >> > >> static bool sun4i_drv_node_is_tcon(struct device_node *node) > >> { > >> - return of_device_is_compatible(node, "allwinner,sun4i-a10-tcon")= || > >> - of_device_is_compatible(node, "allwinner,sun5i-a13-tcon"= ) || > >> - of_device_is_compatible(node, "allwinner,sun6i-a31-tcon"= ) || > >> - of_device_is_compatible(node, "allwinner,sun6i-a31s-tcon= ") || > >> - of_device_is_compatible(node, "allwinner,sun7i-a20-tcon"= ) || > >> - of_device_is_compatible(node, "allwinner,sun8i-a33-tcon"= ) || > >> - of_device_is_compatible(node, "allwinner,sun8i-v3s-tcon"= ); > >> + return !!of_match_node(sun4i_tcon_of_table, node); > >> } > >> > >> static int compare_of(struct device *dev, void *data) > >> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4= i/sun4i_tcon.c > >> index e122f5b2a395..a1ed462c2430 100644 > >> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c > >> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c > >> @@ -900,7 +900,8 @@ static const struct sun4i_tcon_quirks sun8i_v3s_qu= irks =3D { > >> /* nothing is supported */ > >> }; > >> > >> -static const struct of_device_id sun4i_tcon_of_table[] =3D { > >> +/* sun4i_drv uses this list to check if a device node is a TCON */ > >> +const struct of_device_id sun4i_tcon_of_table[] =3D { > >> { .compatible =3D "allwinner,sun4i-a10-tcon", .data =3D &sun4i_a= 10_quirks }, > >> { .compatible =3D "allwinner,sun5i-a13-tcon", .data =3D &sun5i_a= 13_quirks }, > >> { .compatible =3D "allwinner,sun6i-a31-tcon", .data =3D &sun6i_a= 31_quirks }, > >> @@ -911,6 +912,7 @@ static const struct of_device_id sun4i_tcon_of_tab= le[] =3D { > >> { } > >> }; > >> MODULE_DEVICE_TABLE(of, sun4i_tcon_of_table); > >> +EXPORT_SYMBOL(sun4i_tcon_of_table); > >> > >> static struct platform_driver sun4i_tcon_platform_driver =3D { > >> .probe =3D sun4i_tcon_probe, > >> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4= i/sun4i_tcon.h > >> index f61bf6d83b4a..839266a38505 100644 > >> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.h > >> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h > >> @@ -197,4 +197,6 @@ void sun4i_tcon_mode_set(struct sun4i_tcon *tcon, > >> void sun4i_tcon_set_status(struct sun4i_tcon *crtc, > >> const struct drm_encoder *encoder, bool enabl= e); > >> > >> +extern const struct of_device_id sun4i_tcon_of_table[]; > >> + > > > > I'm not very fond of that approach. Maybe we can place the structure > > in the tcon header? >=20 > Doesn't that mean you get one copy of everything wherever they are refere= nced? > This is assuming the compiler trims unused ones from files that include t= he > header file. Indeed. I've applied this patch, thanks! Maxime --=20 Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com --nhc4zqmvmzug6vtp Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE0VqZU19dR2zEVaqr0rTAlCFNr3QFAlogJ9kACgkQ0rTAlCFN r3SHEg//cfK4cUcBbBK05f1JhMS4uR0Jun64fLYv52Mx4MnYKnNOldnZNJnD7JCC HgVGVnORzt2/d4ZJp2x9X2L+XNFxAKj52FLdrkAj4QBQa0S/zu4ejXgoXEQNlEfl M/yl8wKKYpe3HFqaKxooqOhrxj2sgsD1tTDrqtVqMM2XZa2PaCRvLDnIkPUFXpiv j2ZFzzSwkzE3XcprmBcsxEZFrwCFh0hjIsDnYjyqGe19iTdgH07Z9jjbpa3c3UTV OKfjI+g5XTgJtqvTrpZLp2l79WAuhfEehMDczaMhlDH0ToLryGymkcDZSQW94/EE SACjfLQ2VVBP1rHPKmFgx0ngvPNEuUpAfuYUAJ0rjVHRupdjSJTSwzgYXqvc9Yrg +7+hNK60/9BlN3R2AvYKyIRilpOWXkfQjX+PNdhhq7XrnAf1Z0Oo5TDl3SNnOp6C t8K5TTuQgKBYVop9HXFDJU8rpQHUtqP3h7MOSKybBqUVe1ROxqygAb8tw7CVnWwB hIh5125i6BDp3d0cCU+ThmNcxPRqy+immIH4t/z60oWRGXDVRZVtvhXMVvU6rRWl mcHOpTuh5tiqvIXjiADocisMB2gEtmg6FPxMzamzPs4Tt4hCsYwbN6QHjH8z/ILe JxUgrZw8wgh15gyBNs82xIF7dX66C/ImMEwa0EEuBsJq0jxF5ig= =+ydf -----END PGP SIGNATURE----- --nhc4zqmvmzug6vtp-- --===============1881510009== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg== --===============1881510009==--