Re: Any reason why media_entity_pads_init() isn't void?

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

 



Em Mon, 14 Mar 2016 12:36:44 +0200
Sakari Ailus <sakari.ailus@xxxxxx> escreveu:

> Hi Hans,
> 
> On Mon, Mar 14, 2016 at 09:25:51AM +0100, Hans Verkuil wrote:
> > I was fixing a sparse warning in media_entity_pads_init() and I noticed
> > that that function always returns 0. Any reason why this can't be changed
> > to a void function?  
> 
> I was thinking of the same function but I had a different question: why
> would one call this *after* entity->graph_obj.mdev is set? It is set by
> media_device_register_entity(), but once mdev it's set, you're not expected
> to call pads_init anymore...

Ideally, drivers should *first* create mdev, and then create the
graph objects, as all objects should be registered at the mdev, in
order to get their object ID and to be registered at the mdev's object
lists.

However, some legacy drivers used to do just the reverse. So, we had
to add a code there, and at media_device_register_entity() to support
the drivers that postpone the creation of the mdev instance.

Once this gets fixed everywhere, we can remove the code that supports
the legacy behavior.

Regards,
Mauro

> 
> I'm fine making this return void.
> 
> > 
> > That return value is checked a zillion times in the media code. By making
> > it void it should simplify code all over.
> > 
> > See e.g. uvc_mc_init_entity in drivers/media/usb/uvc/uvc_entity.c: that
> > whole function can become a void function itself.  
> 


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



[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