Re: [RFC PATCH] device-core: sysfs open - close notify

From: Ming Lei
Date: Sun Oct 31 2010 - 12:14:11 EST


2010/10/31 Samu Onkalo <samu.p.onkalo@xxxxxxxxx>:
> Device drivers have no idea when somebody in userspace keeps some sysfs entry
> open. The driver just received read or write calls. The driver may want to
> control HW state based on activity so it either have to turn HW on and off
> for each sysfs access or it needs separate enable disable entry which controls
> the HW state. In cases where sysfs is used to pass some events under interrupt
> control (like proximity events from the proximity sensors) it is not enough to
> just keep sysfs entry open in userspace.

Since very few drivers have this kind of requirement, why not take notifier
call chain mechanism to do such thing? eg. register a notifier function
if the driver is interested in such kind of open/close events.

Your patch may cause many unnecessary memory waste because
most of drivers does not need attribute file .open/.close notifier.


thanks,
--
Lei Ming
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/