From: Thierry Reding Subject: Re: [PATCH v3 1/9] drm: Make drm_num_cea_modes unsigned Date: Fri, 18 Jan 2013 11:30:04 +0100 Message-ID: <20130118103004.GA14129@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> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1247827748==" Return-path: Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.10]) by gabe.freedesktop.org (Postfix) with ESMTP id 3FFCAE5F67 for ; Fri, 18 Jan 2013 02:30:11 -0800 (PST) In-Reply-To: <20130114154713.GB3489@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 --===============1247827748== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="2fHTh5uZTiUOsy+g" Content-Disposition: inline --2fHTh5uZTiUOsy+g Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 wrote: > > > 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 assume t= hat > > > > 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_cea_m= odes[] =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_modes); > > > > +static const unsigned int drm_num_cea_modes =3D ARRAY_SIZE(edid_ce= a_modes); > > >=20 > > > Why do we even have these num_foo things? I think it would be clearer= to > > > use ARRAY_SIZE(foo) directly where appropriate. > >=20 > > Actually I was thinking about maybe writing a patch to move the table > > out of the header and into drm_edid.c (or drm_cea.c?) to make it less > > 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. There's also the possibility to put the tables along with the functions that access them into a drm_edid_modes.c. > Too bad cpp doesn't support this kind of thing: > #if __BASE_FILE__ !=3D "drm_edid.c" > #error ... > #endif 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. Thierry --2fHTh5uZTiUOsy+g Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iQIcBAEBAgAGBQJQ+SQsAAoJEN0jrNd/PrOh5DoP/jmwzjvl8fDQ8JFLJpUt5+OK J+lX8/INJLwekZEcMEEiylT+EaIz4STZJQOLMs48dThkCwglfRzHPYQqEM5noPbk zjdwu+Oi7efHjbNGNLNEios/p55+QnagveOa6HT1gwAuQIZjEO9tN9lophwFpkoF 0upN1L/kjypvRbl65PFbXX48Sf7czNULp+TNWKnEG9777pjArn+OMfbG/1FlRNou E1XumFfPcHbhTn1tUD+46eE9NN6pbYVNKcJ6N5rwh6tpgEcyL5570B1jTxoU3kTU OBQ/6tj0ZelzsBLz3IFnwCIJdOenKWtew+1rmVg2Db/q5MSwyp42/8oi9OaoBPLx a7601IN/ztuS6CrtPP3oK4txck4pMsVp4I3vhfD8LXwXgXtIsR/qAs0bHSKiWBgy 8PcV95cYX31QhCtpSpzVEKRh8opjOZlbzeFFAGzjc1D4rTncZNIH8qRVlVYuynm3 Oo4a5bMjolBcw402gm+mUZzlNjs4MILbXKoL5b2rim0uREp11FVlUqNcR3yMHE/C j1c+3gLhc0sI/82CkqLfCIV6VmMoo/K5oiwViT+37CFASbRqO26uYj9o1LxvQNlv dSoUagASI3B6CGVx1vSDEiCo+0Rju97Cs+0YeuGer/qOYJPwq/dMVThBVcNS1RGM 4aTkv8EAB4VnExxxs/z6 =rLxj -----END PGP SIGNATURE----- --2fHTh5uZTiUOsy+g-- --===============1247827748== 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 --===============1247827748==--