All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 1/9] drm: Make drm_num_cea_modes unsigned
Date: Fri, 18 Jan 2013 12:51:11 +0200	[thread overview]
Message-ID: <20130118105111.GX3503@intel.com> (raw)
In-Reply-To: <20130118103004.GA14129@avionic-0098.adnet.avionic-design.de>

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älä 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älä 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 that
> > > > > it will never be negative.
> > > > > 
> > > > > Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> > > > > ---
> > > > >  drivers/gpu/drm/drm_edid_modes.h | 2 +-
> > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > 
> > > > > 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_modes[] = {
> > > > >  		   2492, 2640, 0, 1080, 1084, 1094, 1125, 0,
> > > > >  		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > > > >  };
> > > > > -static const int drm_num_cea_modes = ARRAY_SIZE(edid_cea_modes);
> > > > > +static const unsigned int drm_num_cea_modes = ARRAY_SIZE(edid_cea_modes);
> > > > 
> > > > Why do we even have these num_foo things? I think it would be clearer to
> > > > use ARRAY_SIZE(foo) directly where appropriate.
> > > 
> > > 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.
> > 
> > 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().
> > 
> > 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__ != "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.

Yeah, I suppose there's no better way to do that. It's a bit ugly
though.

-- 
Ville Syrjälä
Intel OTC

  reply	other threads:[~2013-01-18 10:51 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-14 14:30 [PATCH v3 0/9] Add HDMI infoframe helpers Thierry Reding
2013-01-14 14:30 ` [PATCH v3 1/9] drm: Make drm_num_cea_modes unsigned Thierry Reding
2013-01-14 14:42   ` Ville Syrjälä
2013-01-14 15:06     ` Thierry Reding
2013-01-14 15:47       ` Ville Syrjälä
2013-01-18 10:30         ` Thierry Reding
2013-01-18 10:51           ` Ville Syrjälä [this message]
2013-01-18 11:08             ` Thierry Reding
2013-01-14 14:30 ` [PATCH v3 2/9] drm: Add some missing forward declarations Thierry Reding
2013-01-14 14:30 ` [PATCH v3 3/9] video: Add generic HDMI infoframe helpers Thierry Reding
2013-01-16 13:27   ` Ville Syrjälä
2013-01-18  8:56     ` Thierry Reding
2013-01-18 10:50       ` Ville Syrjälä
2013-01-14 14:30 ` [PATCH v3 4/9] drm: Add " Thierry Reding
2013-01-14 14:30 ` [PATCH v3 5/9] drm: Add EDID helper documentation Thierry Reding
2013-01-14 14:30 ` [PATCH v3 6/9] drm/tegra: Use generic HDMI infoframe helpers Thierry Reding
2013-01-14 14:30 ` [PATCH v3 7/9] drm/i915: " Thierry Reding
2013-01-14 14:30 ` [PATCH v3 8/9] drm/radeon: " Thierry Reding
2013-01-14 14:30 ` [PATCH v3 9/9] drm: Remove duplicate drm_mode_cea_vic() Thierry Reding
2013-01-14 14:57   ` Ville Syrjälä
2013-01-14 15:03     ` Thierry Reding

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=20130118105111.GX3503@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=paulo.r.zanoni@intel.com \
    --cc=thierry.reding@avionic-design.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.