From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Reding Subject: Re: [PATCH v3 1/9] drm: Make drm_num_cea_modes unsigned Date: Fri, 18 Jan 2013 12:08:09 +0100 Message-ID: <20130118110809.GA12285@avionic-0098.adnet.avionic-design.de> References: <1358173828-31674-1-git-send-email-thierry.reding@avionic-design.de> <1358173828-31674-2-git-send-email-thierry.reding@avionic-design.de> <20130114144239.GF3867@intel.com> <20130114150613.GB24129@avionic-0098.adnet.avionic-design.de> <20130114154713.GB3489@intel.com> <20130118103004.GA14129@avionic-0098.adnet.avionic-design.de> <20130118105111.GX3503@intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1215106989==" Return-path: Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.8]) by gabe.freedesktop.org (Postfix) with ESMTP id ED065E66CD for ; Fri, 18 Jan 2013 03:08:17 -0800 (PST) In-Reply-To: <20130118105111.GX3503@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: Ville =?utf-8?B?U3lyasOkbMOk?= Cc: Paulo Zanoni , dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============1215106989== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="VbJkn9YxBvnuCH5J" Content-Disposition: inline --VbJkn9YxBvnuCH5J Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jan 18, 2013 at 12:51:11PM +0200, Ville Syrj=C3=A4l=C3=A4 wrote: > On Fri, Jan 18, 2013 at 11:30:04AM +0100, Thierry Reding wrote: > > On Mon, Jan 14, 2013 at 05:47:13PM +0200, Ville Syrj=C3=A4l=C3=A4 wrote: > > > On Mon, Jan 14, 2013 at 04:06:13PM +0100, Thierry Reding wrote: > > > > On Mon, Jan 14, 2013 at 04:42:39PM +0200, Ville Syrj=C3=A4l=C3=A4 w= rote: > > > > > On Mon, Jan 14, 2013 at 03:30:20PM +0100, Thierry Reding wrote: > > > > > > Since the variable's value is the size of an array, we can assu= me that > > > > > > it will never be negative. > > > > > >=20 > > > > > > Signed-off-by: Thierry Reding > > > > > > --- > > > > > > drivers/gpu/drm/drm_edid_modes.h | 2 +- > > > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > >=20 > > > > > > diff --git a/drivers/gpu/drm/drm_edid_modes.h b/drivers/gpu/drm= /drm_edid_modes.h > > > > > > index 5dbf7d2..d65d863 100644 > > > > > > --- a/drivers/gpu/drm/drm_edid_modes.h > > > > > > +++ b/drivers/gpu/drm/drm_edid_modes.h > > > > > > @@ -771,4 +771,4 @@ static const struct drm_display_mode edid_c= ea_modes[] =3D { > > > > > > 2492, 2640, 0, 1080, 1084, 1094, 1125, 0, > > > > > > DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, > > > > > > }; > > > > > > -static const int drm_num_cea_modes =3D ARRAY_SIZE(edid_cea_mod= es); > > > > > > +static const unsigned int drm_num_cea_modes =3D ARRAY_SIZE(edi= d_cea_modes); > > > > >=20 > > > > > Why do we even have these num_foo things? I think it would be cle= arer to > > > > > use ARRAY_SIZE(foo) directly where appropriate. > > > >=20 > > > > Actually I was thinking about maybe writing a patch to move the tab= le > > > > out of the header and into drm_edid.c (or drm_cea.c?) to make it le= ss > > > > easy to create duplicates of the table. In that case, using the > > > > ARRAY_SIZE macro directly wouldn't be an option. > > >=20 > > > Well drm_edid.c is the only one accessing these tables anyway, so it > > > they would be in drm_edid.c and static, you could still use > > > ARRAY_SIZE(). > > >=20 > > > Not that I really like the idea of polluting drm_edid.c with all these > > > massive tables. > >=20 > > There's also the possibility to put the tables along with the functions > > that access them into a drm_edid_modes.c. > >=20 > > > Too bad cpp doesn't support this kind of thing: > > > #if __BASE_FILE__ !=3D "drm_edid.c" > > > #error ... > > > #endif > >=20 > > We could fake that by protecting the tables using #ifdef NEED_CEA_MODES > > and define NEED_CEA_MODES in drm_edid.c before the drm_edid_modes.h file > > is included. >=20 > Yeah, I suppose there's no better way to do that. It's a bit ugly > though. What about moving them to a separate file altogether? It would involve moving the do_cea_modes() as well, but that would need to be called from drm_edid.c, so it isn't very pretty either. Thierry --VbJkn9YxBvnuCH5J Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iQIcBAEBAgAGBQJQ+S0ZAAoJEN0jrNd/PrOh/jYQAK/VSKH5P6xE4OfKFyE3mncn vdDQPw9eIzu/XoGZnDb47qASwkhv+XlwifdrKcXoD2oOnHxlZpsn4oG43GkLrX3R S0e0BJeg0LWMjagTettkgKvGjyIVtgrl2QCWRIvgNqmuvOa38ZaMqInedSiA/1Nk GsN07h4okg2Cj/wJIsAkBRerf+t7K/h2R7dDq08T2kS4DslALRZyKtnvbuGAC56C WQrYMZvUDtqxryvKQ/Qnq2vIP0jUp3CYTuUbOyhXIlkdGW6HHNy8PXSjq7iWPP5w SOnZ94TDU/o7vYRlyl6jObCqKSL6B2tmJrrWLtnmBp04aevCnRKeH0mo3ifWxx1Q PA1GJknOfT8noOPlB/ynzHu5jg/T6nEermde1h02Wazzc8TpHFx/wFBz9Ci2PcZ0 yRj33NzVbaM49B1pOF8fnLONMBhONU++yhk9ZjsRU0TNxflN/z0+2w1ir/36uuvq VIXeeakaCD6qQVDVg1tAesCQiH55QsTJfA7Wxf5O3KHkn42ncOnqDDbLqNMxF3rS wY9qqJwUtgbKeiCGqkw0sGrKb2z2GNwsWu+kK+NT+ofoKH1im7P1CI0m83oAD4Vm i5MjCLlkHX7LZLaJ9VS+dq4aNm+7HViHVaJE4wFLI6x2LD8atLdbKbtFl9hLij+z sWLlj6c4gt/fkwVwPLeJ =sUCJ -----END PGP SIGNATURE----- --VbJkn9YxBvnuCH5J-- --===============1215106989== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel --===============1215106989==--