lkml.org 
[lkml]   [2010]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Introduce {sysfs,device}_create_file_mode
On Wed, May 12, 2010 at 10:15:46PM +0400, Anton Vorontsov wrote:
> We need to create attributes with different modes across devices.
> We can do this by modifying attr.mode between device_create_file
> invocations, but that is racy in case of globally defined attrs.
>
> Luckily, there's sysfs_add_file_mode() function that seems to do
> exactly what we want, and if we use it, we don't need any locks
> to avoid races. Though, it isn't exposed via device-drivers core
> API.

But you race the creation of the device notifying userspace, and then
the file being created, right? Or is that properly taken care of
elsewhere?

> Greg, does the patch look OK? If so, I'd like it to go
> via battery-2.6.git tree, along with patches that need
> that one.

Looks good with one minor problem:

> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -440,6 +440,27 @@ struct kset *devices_kset;
> * device_create_file - create sysfs attribute file for device.

That should be "device_create_file_mode"

Make that change and then feel free to take it through your tree with
an:
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
on it.

thanks,

greg k-h


\
 
 \ /
  Last update: 2010-05-12 20:41    [W:0.082 / U:0.800 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site