Re: [PATCH] sysfs: add sysfs_create/remove_groups()

From: Anthony Foiani
Date: Thu Aug 22 2013 - 01:03:42 EST


Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> writes:

> + * sysfs_create_groups - given a directory kobject, create a bunch of attribute groups
> + * @kobj: The kobject to create the group on
> + * @groups: The attribute groups to create, NULL terminated
> + *
> + * This function creates a bunch of attribute groups. If an error occurs when
> + * creating a group, all previously created groups will be removed, unwinding
> + * everything back to the original state when this function was called.
> + * It will explicitly warn and error if any of the attribute files being
> + * created already exist.
> + *
> + * Returns 0 on success or error code from sysfs_create_groups on error.

"... from sysfs_create_group on error"
^^^^^ (note singular, not plural)

Otherwise it's a bit of a tautology...

Maybe rename to "sysfs_(create|remove)_multiple_groups" (or
..._many_groups) to avoid this kind of one-char difference?

> + * sysfs_remove_groups - remove a list of groups
> + *
> + * kobj: The kobject for the groups to be removed from
> + * groups: NULL terminated list of groups to be removed
> + *
> + * If groups is not NULL, the all groups will be removed from the kobject

"If groups is not NULL, remove listed groups from the kobject"

(I also played around with using pointer arithmetic instead of array
accesses for these two functions; it cut a few lines of code, but not
enough to bother, I don't think.)

Thanks,
Tony
--
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/