linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boris BREZILLON <boris.brezillon@free-electrons.com>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: Thierry Reding <thierry.reding@gmail.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	David Airlie <airlied@linux.ie>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	linux-api@vger.kernel.org,
	Mauro Carvalho Chehab <m.chehab@samsung.com>,
	linux-media@vger.kernel.org
Subject: Re: [PATCH 1/5] video: move mediabus format definition to a more standard place
Date: Tue, 23 Sep 2014 18:09:23 +0200	[thread overview]
Message-ID: <20140923180923.287758a7@bbrezillon> (raw)
In-Reply-To: <Pine.LNX.4.64.1409231426220.17074@axis700.grange>

Hi Guennadi,

On Tue, 23 Sep 2014 14:33:20 +0200 (CEST)
Guennadi Liakhovetski <g.liakhovetski@gmx.de> wrote:

> Hi Boris,
> 
> On Tue, 22 Jul 2014, Boris BREZILLON wrote:
> 
> > Rename mediabus formats and move the enum into a separate header file so
> > that it can be used by DRM/KMS subsystem without any reference to the V4L2
> > subsystem.
> > 
> > Old V4L2_MBUS_FMT_ definitions are now macros that points to VIDEO_BUS_FMT_
> > definitions.
> > 
> > Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com>
> 
> In principle I find this a good idea, certainly it's good to reuse code. 
> Just wondering, wouldn't it be better instead of adding those defines to 
> define a macro like
> 
> #define VIDEO_BUS_TO_MBUS(x)	V4L2_MBUS_ ## x = VIDEO_BUS_ ## x
> 
> and then do
> 
> enum v4l2_mbus_pixelcode {
> 	VIDEO_BUS_TO_MBUS(FIXED),
> 	VIDEO_BUS_TO_MBUS(RGB444_2X8_PADHI_BE),
> 	...
> };
> 
> ? I'm not very strong on this, I just think an enum is nicer than a bunch 
> of defines and this way copy-paste errors are less likely, but if you or 
> others strongly disagree - I won't insist :)

I'd say it might be a good solution if we enforce new users (including
user space users) to use video_bus_format enum values instead of
v4l2_mbus_pixelcode ones. But if we keep adding new values to this enum
I'd say this approach is less readable than having the full names
(V4L2_MBUS_XXX) expressed, because users will still have to use those
full names.

Anyway, I can still replace this macro list by an enum:

enum v4l2_mbus_pixelcode {
	V4L2_MBUS_FIXED = VIDEO_BUS_FIXED,
	V4L2_MBUS_RGB444_2X8_PADHI_BE = VIDEO_BUS_RGB444_2X8_PADHI_BE,
	...
};

Best Regards,

Boris

-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  reply	other threads:[~2014-09-23 16:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-22 12:23 [PATCH 0/5] video: describe data bus formats Boris BREZILLON
2014-07-22 12:23 ` [PATCH 1/5] video: move mediabus format definition to a more standard place Boris BREZILLON
2014-09-23 12:33   ` Guennadi Liakhovetski
2014-09-23 16:09     ` Boris BREZILLON [this message]
2014-07-22 12:23 ` [PATCH 2/5] video: add RGB444_1X12 and RGB565_1X16 bus formats Boris BREZILLON
2014-07-22 12:23 ` [PATCH 3/5] drm: add bus_formats and nbus_formats fields to drm_display_info Boris BREZILLON
2014-09-23 14:04   ` Thierry Reding
2014-09-23 14:15     ` Boris BREZILLON
2014-07-22 12:23 ` [PATCH 4/5] drm: panel: simple-panel: add support for bus_format retrieval Boris BREZILLON
2014-07-22 12:23 ` [PATCH 5/5] drm: panel: simple-panel: add bus format information for foxlink panel Boris BREZILLON
2014-09-23 14:06   ` Thierry Reding
2014-09-23 14:13     ` Boris BREZILLON
2014-08-12 11:02 ` [PATCH 0/5] video: describe data bus formats Boris BREZILLON

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=20140923180923.287758a7@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=g.liakhovetski@gmx.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=m.chehab@samsung.com \
    --cc=thierry.reding@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).