lkml.org 
[lkml]   [2006]   [Aug]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: RFC-patch - make sysfs_create_group skip members with attr.mode == 0
On Thu, Aug 17, 2006 at 04:50:25PM -0600, Jim Cromie wrote:
> Currently, code in hwmon/*.c uses sysfs_create_group less than it could.

Please, provide sample patch which will use this feature. And I personally
don't understand the reasoning: can i2c code use sysfs_create_group()
with elements of struct attribute_group::attrs array ifdeffed?

> A contributing reason is that many individual attr-files are created
> conditionally,
> depending upon both underlying hardware, driver configuration, etc.

> --- try1/fs/sysfs/group.c 2006-06-17 19:49:35.000000000 -0600
> +++ try2/fs/sysfs/group.c 2006-08-17 10:06:26.000000000 -0600
> @@ -32,7 +33,8 @@ static int create_files(struct dentry *
> int error = 0;
>
> for (attr = grp->attrs; *attr && !error; attr++) {
> - error = sysfs_add_file(dir, *attr, SYSFS_KOBJ_ATTR);
> + if ((*attr)->mode)
> + error = sysfs_add_file(dir, *attr, SYSFS_KOBJ_ATTR);
> }

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

\
 
 \ /
  Last update: 2006-08-18 03:53    [W:0.038 / U:0.648 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site