Re: [RFC] BKL in open functions in drivers

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

 



On Thu, Apr 2, 2009 at 11:29 AM, Hans Verkuil <hverkuil@xxxxxxxxx> wrote:

[...]

>> So, questions are:
>>
>> 1) What for is lock/unlock_kernel() used in open?
>
> It's pointless. Just remove it.

Actually, i can see lock/unlock_kernel() in open in other V4L drivers too.
What for is it used in other drivers?

>> 2) Can it be replaced by mutex, for example?
>
> No need.

Good, so we can remove it.

>> Please, comments, explanations are more than welcome.
>
> But what is really wrong is the way the 'users' field is used: that should
> be an atomic counter: on the first-time-open you set up the device, and
> when the last user goes away you can close it down.
>
> Currently if you open the device a second time and then close that second
> fh, the first gets muted by that close. Not what you want!
>
> Actually, I don't see why this stuff is in the open/close at all, unless
> this saves some measurable amount of power consumption. I'd just move the
> setup code in the open() to the probe() and after that both the open() and
> close() functions become no-ops.
>
> Regards,
>
>        Hans
>
> --
> Hans Verkuil - video4linux developer - sponsored by TANDBERG

Agreed, thanks for explanations and suggestions.

-- 
Best regards, Klimov Alexey
--
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