Re: [PATCH v1] media: dvb: Add devm_dvb_register_adapter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux