From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keshavamurthy Anil S Subject: Re: [ACPI] PATCH-ACPI based CPU hotplug[2/6]-ACPI Eject interface support Date: Mon, 27 Sep 2004 09:53:48 -0700 Sender: linux-ia64-owner@vger.kernel.org Message-ID: <20040927095348.A29594@unix-os.sc.intel.com> References: <20040920092520.A14208@unix-os.sc.intel.com> <200409201812.45933.dtor_core@ameritech.net> <20040924162823.B27778@unix-os.sc.intel.com> <200409270112.29422.dtor_core@ameritech.net> Reply-To: Keshavamurthy Anil S Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Content-Disposition: inline In-Reply-To: <200409270112.29422.dtor_core@ameritech.net>; from dtor_core@ameritech.net on Mon, Sep 27, 2004 at 01:12:28AM -0500 To: Dmitry Torokhov Cc: Keshavamurthy Anil S , Len Brown , acpi-devel@lists.sourceforge.net, LHNS list , Linux IA64 , Linux Kernel List-Id: linux-acpi@vger.kernel.org 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 *, > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0const struct attribute *); > > + > > +static void setup_sys_fs_device_files(struct acpi_device *dev, > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0acpi_device_sysfs_fil= es *func); > > + > > +#define create_sysfs_device_files(dev)=A0\ > > +=A0=A0=A0=A0=A0=A0=A0setup_sys_fs_device_files(dev, (acpi_device_s= ysfs_files *)&sysfs_create_file) > > +#define remove_sysfs_device_files(dev)=A0\ > > +=A0=A0=A0=A0=A0=A0=A0setup_sys_fs_device_files(dev, (acpi_device_s= ysfs_files *)&sysfs_remove_file) >=20 >=20 > Hi Anil, >=20 > It looks very nice except for the part above. I am really confused wh= at 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_devi= ce_files() and=20 remove_sysfs_device_files() and one of the arguments to the setup_sys_f= s_device_files() is a function pointer, i.e for one it takes sysfs_create_file and for o= ther it takes sysfs_remove_file. Having single function for creating and removing sysfs files make it ea= sy=20 from the maintaince perspective, as oppose to remember to code for remo= ve=20 as well when one adds the new file. thanks, Anil - To unsubscribe from this list: send the line "unsubscribe linux-ia64" i= n the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keshavamurthy Anil S Date: Mon, 27 Sep 2004 16:53:48 +0000 Subject: Re: [ACPI] PATCH-ACPI based CPU hotplug[2/6]-ACPI Eject interface support Message-Id: <20040927095348.A29594@unix-os.sc.intel.com> List-Id: References: <20040920092520.A14208@unix-os.sc.intel.com> <200409201812.45933.dtor_core@ameritech.net> <20040924162823.B27778@unix-os.sc.intel.com> <200409270112.29422.dtor_core@ameritech.net> In-Reply-To: <200409270112.29422.dtor_core@ameritech.net>; from dtor_core@ameritech.net on Mon, Sep 27, 2004 at 01:12:28AM -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: Dmitry Torokhov Cc: Keshavamurthy Anil S , Len Brown , acpi-devel@lists.sourceforge.net, LHNS list , Linux IA64 , Linux Kernel 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 *, > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0const struct attribute *); > > + > > +static void setup_sys_fs_device_files(struct acpi_device *dev, > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0acpi_device_sysfs_files *= func); > > + > > +#define create_sysfs_device_files(dev)=A0\ > > +=A0=A0=A0=A0=A0=A0=A0setup_sys_fs_device_files(dev, (acpi_device_sysfs= _files *)&sysfs_create_file) > > +#define remove_sysfs_device_files(dev)=A0\ > > +=A0=A0=A0=A0=A0=A0=A0setup_sys_fs_device_files(dev, (acpi_device_sysfs= _files *)&sysfs_remove_file) >=20 >=20 > Hi Anil, >=20 > It looks very nice except for the part above. I am really confused what t= he > 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() fo= r both creating and removing sysfs files. So I have #defined create_sysfs_device_f= iles() and=20 remove_sysfs_device_files() and one of the arguments to the setup_sys_fs_de= vice_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=20 from the maintaince perspective, as oppose to remember to code for remove=20 as well when one adds the new file. thanks, Anil From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S266821AbUI0QyO (ORCPT ); Mon, 27 Sep 2004 12:54:14 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S266753AbUI0QyH (ORCPT ); Mon, 27 Sep 2004 12:54:07 -0400 Received: from fmr04.intel.com ([143.183.121.6]:25576 "EHLO caduceus.sc.intel.com") by vger.kernel.org with ESMTP id S266643AbUI0Qx6 (ORCPT ); Mon, 27 Sep 2004 12:53:58 -0400 Date: Mon, 27 Sep 2004 09:53:48 -0700 From: Keshavamurthy Anil S To: Dmitry Torokhov Cc: Keshavamurthy Anil S , Len Brown , acpi-devel@lists.sourceforge.net, LHNS list , Linux IA64 , Linux Kernel Subject: Re: [ACPI] PATCH-ACPI based CPU hotplug[2/6]-ACPI Eject interface support Message-ID: <20040927095348.A29594@unix-os.sc.intel.com> Reply-To: Keshavamurthy Anil S References: <20040920092520.A14208@unix-os.sc.intel.com> <200409201812.45933.dtor_core@ameritech.net> <20040924162823.B27778@unix-os.sc.intel.com> <200409270112.29422.dtor_core@ameritech.net> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.2.5.1i In-Reply-To: <200409270112.29422.dtor_core@ameritech.net>; from dtor_core@ameritech.net on Mon, Sep 27, 2004 at 01:12:28AM -0500 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org 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