Re: [ACPI] PATCH-ACPI based CPU hotplug[2/6]-ACPI Eject interface support

Keshavamurthy Anil S
2004-09-27T16:53:48Z

On Mon, Sep 27, 2004 at 01:12:28AM -0500, Dmitry Torokhov wrote:
> On Friday 24 September 2004 06:28 pm, Keshavamurthy Anil S wrote:
> > +typedef void acpi_device_sysfs_files(struct kobject *,
> > +                               const struct attribute *);
> > +
> > +static void setup_sys_fs_device_files(struct acpi_device *dev,
> > +               acpi_device_sysfs_files *func);
> > +
> > +#define create_sysfs_device_files(dev) \
> > +       setup_sys_fs_device_files(dev, (acpi_device_sysfs_files *)&sysfs_create_file)
> > +#define remove_sysfs_device_files(dev) \
> > +       setup_sys_fs_device_files(dev, (acpi_device_sysfs_files *)&sysfs_remove_file)
>
>
> Hi Anil,
>
> It looks very nice except for the part above. I am really confused what the
> purpose of this code is... It looks like it just complicates things?
Hi Dmitry,
I just wanted to have a single function i.e setup_sys_fs_device_files() for both
creating and removing sysfs files. So I have #defined create_sysfs_device_files() and
remove_sysfs_device_files() and one of the arguments to the setup_sys_fs_device_files()
is a function pointer, i.e for one it takes sysfs_create_file and for other it takes
sysfs_remove_file.

Having single function for creating and removing sysfs files make it easy
from the maintaince perspective, as oppose to remember to code for remove
as well when one adds the new file.

thanks,
Anil
-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html