Re: [PATCH 06/19] em28xx: move video_device structs from struct em28xx to struct v4l2

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

 



On 05/11/2014 10:50 PM, Frank Schäfer wrote:
> 
> Am 09.05.2014 11:19, schrieb Hans Verkuil:
>> On 03/24/2014 08:33 PM, Frank Schäfer wrote:
>>> Signed-off-by: Frank Schäfer <fschaefer.oss@xxxxxxxxxxxxxx>
>>> ---
>>>  drivers/media/usb/em28xx/em28xx-video.c | 120 ++++++++++++++------------------
>>>  drivers/media/usb/em28xx/em28xx.h       |   7 +-
>>>  2 files changed, 56 insertions(+), 71 deletions(-)
>>>
>>> diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h
>>> index a4d26bf..88d0589 100644
>>> --- a/drivers/media/usb/em28xx/em28xx.h
>>> +++ b/drivers/media/usb/em28xx/em28xx.h
>>> @@ -504,6 +504,10 @@ struct em28xx_v4l2 {
>>>  	struct v4l2_device v4l2_dev;
>>>  	struct v4l2_ctrl_handler ctrl_handler;
>>>  	struct v4l2_clk *clk;
>>> +
>>> +	struct video_device *vdev;
>>> +	struct video_device *vbi_dev;
>>> +	struct video_device *radio_dev;
>> Think about embedding these structs. That way you don't have to allocate them which
>> removes the complexity of checking for ENOMEM errors.
> 
> Yes, but consider that only em286x and em288x devices provide VBI
> support and we have even less devices with radio support (~ 3 of 100).
> So with most devices, we would waste memory.

The problem with v4l drivers is always complexity, never performance or memory.
Anything that reduces complexity is always a good thing. The extra memory used
is negligible. Since kmalloc rounds up the requested memory to the next power
of two you might even end up with allocating more memory instead of less, but
you'd have to calculate that to see if it is true.

Simplification is always key to media drivers.

Regards,

	Hans
--
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