linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Gonzalez <marc.w.gonzalez@free.fr>
To: "Jonathan Neuschäfer" <j.neuschaefer@gmx.net>
Cc: Sean Young <sean@mess.org>, Brad Love <brad@nextdimension.cc>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media <linux-media@vger.kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>
Subject: Re: [PATCH v1] media: dvb: Add devm_dvb_register_adapter
Date: Mon, 15 Jul 2019 12:50:16 +0200	[thread overview]
Message-ID: <9be0aa28-46c2-dac0-19c4-21be4098da1e@free.fr> (raw)
In-Reply-To: <20190712162618.GK22408@latitude>

On 12/07/2019 18:26, Jonathan Neuschäfer wrote:

> On Fri, Jul 12, 2019 at 04:19:20PM +0200, Marc Gonzalez wrote:
>
>> Add devm* variant for automagic resource release.
> 
> S-o-b missing.
> 
>> +int devm_dvb_register_adapter(struct device *dev, struct dvb_adapter *adap,
>> +		const char *name, struct module *module, short *adapter_nums)
>> +{
>> +	int v1, v2;
>> +
>> +	v1 = dvb_register_adapter(adap, name, module, dev, adapter_nums);
>> +	if (v1 < 0)
>> +		return v1;
>> +
>> +	v2 = devm_add_action_or_reset(dev, unregister_adapter, adap);
>> +	if (v2 < 0)
>> +		return v2;
>> +
>> +	return v1;
>> +}
>> +EXPORT_SYMBOL(devm_dvb_register_adapter);
> 
> What non-negative numbers can dvb_register_adapter and
> devm_add_action_or_reset return, and what are their meanings? Why should
> devm_dvb_register_adapter return the (non-negative) return value of
> dvb_register_adapter?
> (I really don't know, because I'm not familiar with the media/DVB subsystem)

It seems the return values of dvb_register_adapter() are not documented in
include/media/dvbdev.h -- Oh well...

Based on my reading of the implementation, dvb_register_adapter() returns
- either -ENFILE on error, or
- an index >= 0 in the dvb_adapter_list

Based on a small sampling of callers, it seems like most don't care about
the index. I'll spin a v2 that returns only 0 on success as you suggested.

I'll update Documentation/driver-model/devres.rst as you pointed out.

Regards.

      reply	other threads:[~2019-07-15 10:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-12 14:19 [PATCH v1] media: dvb: Add devm_dvb_register_adapter Marc Gonzalez
2019-07-12 16:26 ` Jonathan Neuschäfer
2019-07-15 10:50   ` Marc Gonzalez [this message]

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=9be0aa28-46c2-dac0-19c4-21be4098da1e@free.fr \
    --to=marc.w.gonzalez@free.fr \
    --cc=bjorn.andersson@linaro.org \
    --cc=brad@nextdimension.cc \
    --cc=j.neuschaefer@gmx.net \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sean@mess.org \
    /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).