public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Linux and Kernel Video <video4linux-list@redhat.com>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	"davinci-linux-open-source@linux.davincidsp.com"
	<davinci-linux-open-source@linux.davincidsp.com>,
	linux-kernel@vger.kernel.org,
	Laurent Pinchart <laurent.pinchart@skynet.be>
Subject: Re: [PATCH v2] v4l2_device/v4l2_subdev: final (?) version
Date: Sat, 29 Nov 2008 12:20:47 -0800	[thread overview]
Message-ID: <200811291220.47542.david-b@pacbell.net> (raw)
In-Reply-To: <200811291852.41794.hverkuil@xs4all.nl>

On Saturday 29 November 2008, Hans Verkuil wrote:
> +void v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev)
> +{
> +       BUG_ON(!dev || !v4l2_dev || dev_get_drvdata(dev));
> 

Ouch.  Better to return -EINVAL, like most register() calls,
than *ever* use a BUG_ON() for bad parameters.  Same applies
every other place you use BUG_ON, from a quick scan ...

For the unregister() paths a WARN() would be fair.  Again,
any time you're tempted to use BUG() or BUG_ON(), you need
to re-think.  It's hardly ever the right thing to do.  Just
report the error and continue; callers should check, and
clean up if something went wrong.


> +EXPORT_SYMBOL(v4l2_device_register);

This may be a nit, but I wonder why not EXPORT_SYMBOL_GPL,
which seems to be more correct in this case.


Another quasi-style point:  v4l2-device.s and v4l-subdev.c
are so small, and conceptually related, that I'd be tempted
to have one file not two.  Ditto their headers.

- Dave

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2008-11-29 20:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-29 17:52 [PATCH v2] v4l2_device/v4l2_subdev: final (?) version Hans Verkuil
2008-11-29 20:20 ` David Brownell [this message]
2008-11-29 21:46   ` Hans Verkuil
2008-11-29 22:22     ` David Brownell
2008-11-29 23:06       ` Hans Verkuil
2008-11-30  2:56         ` David Brownell
2008-11-29 23:31 ` Andy Walls
2008-11-30  0:40   ` Hans Verkuil
2008-11-30  2:49     ` Andy Walls
2008-11-30 10:52       ` Hans Verkuil
2008-12-01  5:34         ` David Brownell

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=200811291220.47542.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=davinci-linux-open-source@linux.davincidsp.com \
    --cc=hverkuil@xs4all.nl \
    --cc=laurent.pinchart@skynet.be \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=video4linux-list@redhat.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