All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Remove "decl_subsys_name" macro and single usage of it.
@ 2007-03-01 17:09 Robert P. J. Day
  2007-03-15  7:25 ` Greg KH
  2007-03-15 10:22 ` Kay Sievers
  0 siblings, 2 replies; 5+ messages in thread
From: Robert P. J. Day @ 2007-03-01 17:09 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: Greg KH


  Remove the macro "decl_subsys_name" which can be used to declare a
sysfs subsystem, along with the single invocation of it in the source
tree, since there appears to be little value in creating a subsystem
whose subsystem name differs from its structure name.  Everyone else
just uses "decl_subsys".

Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>

---

  based on conversations with greg kh.  compile-tested on x86.

 drivers/pci/hotplug/acpiphp_ibm.c      |    4 ++--
 drivers/pci/hotplug/pci_hotplug_core.c |   16 ++++++++--------
 drivers/pci/hotplug/rpadlpar_sysfs.c   |    2 +-
 include/linux/kobject.h                |    8 --------
 include/linux/pci_hotplug.h            |    2 +-
 5 files changed, 12 insertions(+), 20 deletions(-)

diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c
index 7f03881..836194e 100644
--- a/drivers/pci/hotplug/acpiphp_ibm.c
+++ b/drivers/pci/hotplug/acpiphp_ibm.c
@@ -424,7 +424,7 @@ static int __init ibm_acpiphp_init(void)
 	int retval = 0;
 	acpi_status status;
 	struct acpi_device *device;
-	struct kobject *sysdir = &pci_hotplug_slots_subsys.kset.kobj;
+	struct kobject *sysdir = &slots_subsys.kset.kobj;

 	dbg("%s\n", __FUNCTION__);

@@ -471,7 +471,7 @@ init_return:
 static void __exit ibm_acpiphp_exit(void)
 {
 	acpi_status status;
-	struct kobject *sysdir = &pci_hotplug_slots_subsys.kset.kobj;
+	struct kobject *sysdir = &slots_subsys.kset.kobj;

 	dbg("%s\n", __FUNCTION__);

diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c
index f5d632e..bfbc46c 100644
--- a/drivers/pci/hotplug/pci_hotplug_core.c
+++ b/drivers/pci/hotplug/pci_hotplug_core.c
@@ -62,7 +62,7 @@ static int debug;

 static LIST_HEAD(pci_hotplug_slot_list);

-struct subsystem pci_hotplug_slots_subsys;
+struct subsystem slots_subsys;

 static ssize_t hotplug_slot_attr_show(struct kobject *kobj,
 		struct attribute *attr, char *buf)
@@ -97,7 +97,7 @@ static struct kobj_type hotplug_slot_ktype = {
 	.release = &hotplug_slot_release,
 };

-decl_subsys_name(pci_hotplug_slots, slots, &hotplug_slot_ktype, NULL);
+decl_subsys(slots, &hotplug_slot_ktype, NULL);

 /* these strings match up with the values in pci_bus_speed */
 static char *pci_bus_speed_strings[] = {
@@ -634,7 +634,7 @@ int pci_hp_register (struct hotplug_slot *slot)
 	}

 	kobject_set_name(&slot->kobj, "%s", slot->name);
-	kobj_set_kset_s(slot, pci_hotplug_slots_subsys);
+	kobj_set_kset_s(slot, slots_subsys);

 	/* this can fail if we have already registered a slot with the same name */
 	if (kobject_register(&slot->kobj)) {
@@ -764,8 +764,8 @@ static int __init pci_hotplug_init (void)
 {
 	int result;

-	kset_set_kset_s(&pci_hotplug_slots_subsys, pci_bus_type.subsys);
-	result = subsystem_register(&pci_hotplug_slots_subsys);
+	kset_set_kset_s(&slots_subsys, pci_bus_type.subsys);
+	result = subsystem_register(&slots_subsys);
 	if (result) {
 		err("Register subsys with error %d\n", result);
 		goto exit;
@@ -780,7 +780,7 @@ static int __init pci_hotplug_init (void)
 	goto exit;

 err_subsys:
-	subsystem_unregister(&pci_hotplug_slots_subsys);
+	subsystem_unregister(&slots_subsys);
 exit:
 	return result;
 }
@@ -788,7 +788,7 @@ exit:
 static void __exit pci_hotplug_exit (void)
 {
 	cpci_hotplug_exit();
-	subsystem_unregister(&pci_hotplug_slots_subsys);
+	subsystem_unregister(&slots_subsys);
 }

 module_init(pci_hotplug_init);
@@ -800,7 +800,7 @@ MODULE_LICENSE("GPL");
 module_param(debug, bool, 0644);
 MODULE_PARM_DESC(debug, "Debugging mode enabled or not");

-EXPORT_SYMBOL_GPL(pci_hotplug_slots_subsys);
+EXPORT_SYMBOL_GPL(slots_subsys);
 EXPORT_SYMBOL_GPL(pci_hp_register);
 EXPORT_SYMBOL_GPL(pci_hp_deregister);
 EXPORT_SYMBOL_GPL(pci_hp_change_slot_info);
diff --git a/drivers/pci/hotplug/rpadlpar_sysfs.c b/drivers/pci/hotplug/rpadlpar_sysfs.c
index 6c5be3f..5332294 100644
--- a/drivers/pci/hotplug/rpadlpar_sysfs.c
+++ b/drivers/pci/hotplug/rpadlpar_sysfs.c
@@ -129,7 +129,7 @@ struct kobj_type ktype_dlpar_io = {
 };

 struct kset dlpar_io_kset = {
-	.subsys = &pci_hotplug_slots_subsys,
+	.subsys = &slots_subsys,
 	.kobj = {.name = DLPAR_KOBJ_NAME, .ktype=&ktype_dlpar_io,},
 	.ktype = &ktype_dlpar_io,
 };
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index b850e03..13326de 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -186,14 +186,6 @@ struct subsystem _name##_subsys = { \
 		.uevent_ops =_uevent_ops, \
 	} \
 }
-#define decl_subsys_name(_varname,_name,_type,_uevent_ops) \
-struct subsystem _varname##_subsys = { \
-	.kset = { \
-		.kobj = { .name = __stringify(_name) }, \
-		.ktype = _type, \
-		.uevent_ops =_uevent_ops, \
-	} \
-}

 /* The global /sys/kernel/ subsystem for people to chain off of */
 extern struct subsystem kernel_subsys;
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index a675a05..82766a1 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -174,7 +174,7 @@ extern int pci_hp_register		(struct hotplug_slot *slot);
 extern int pci_hp_deregister		(struct hotplug_slot *slot);
 extern int __must_check pci_hp_change_slot_info	(struct hotplug_slot *slot,
 						 struct hotplug_slot_info *info);
-extern struct subsystem pci_hotplug_slots_subsys;
+extern struct subsystem slots_subsys;

 /* PCI Setting Record (Type 0) */
 struct hpp_type0 {

-- 
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://fsdev.net/wiki/index.php?title=Main_Page
========================================================================

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Remove "decl_subsys_name" macro and single usage of it.
  2007-03-01 17:09 [PATCH] Remove "decl_subsys_name" macro and single usage of it Robert P. J. Day
@ 2007-03-15  7:25 ` Greg KH
  2007-03-15 10:22 ` Kay Sievers
  1 sibling, 0 replies; 5+ messages in thread
From: Greg KH @ 2007-03-15  7:25 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: Linux Kernel Mailing List

On Thu, Mar 01, 2007 at 12:09:59PM -0500, Robert P. J. Day wrote:
> 
>   Remove the macro "decl_subsys_name" which can be used to declare a
> sysfs subsystem, along with the single invocation of it in the source
> tree, since there appears to be little value in creating a subsystem
> whose subsystem name differs from its structure name.  Everyone else
> just uses "decl_subsys".
> 
> Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>
> 
> @@ -800,7 +800,7 @@ MODULE_LICENSE("GPL");
>  module_param(debug, bool, 0644);
>  MODULE_PARM_DESC(debug, "Debugging mode enabled or not");
> 
> -EXPORT_SYMBOL_GPL(pci_hotplug_slots_subsys);
> +EXPORT_SYMBOL_GPL(slots_subsys);

No, don't polute the namespace incorrectly here.  We really want the
variable to still have the "pci_hotplug_" prefix if at all possible.

thanks,

greg k-h


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Remove "decl_subsys_name" macro and single usage of it.
  2007-03-01 17:09 [PATCH] Remove "decl_subsys_name" macro and single usage of it Robert P. J. Day
  2007-03-15  7:25 ` Greg KH
@ 2007-03-15 10:22 ` Kay Sievers
  2007-03-15 12:52   ` Robert P. J. Day
  1 sibling, 1 reply; 5+ messages in thread
From: Kay Sievers @ 2007-03-15 10:22 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: Linux Kernel Mailing List, Greg KH

On 3/1/07, Robert P. J. Day <rpjday@mindspring.com> wrote:
>
>   Remove the macro "decl_subsys_name" which can be used to declare a
> sysfs subsystem, along with the single invocation of it in the source
> tree, since there appears to be little value in creating a subsystem
> whose subsystem name differs from its structure name.  Everyone else
> just uses "decl_subsys".

Sometimes you want shorter variable names as the created objects in
sysfs, because the 80 columns limit of the kernel source makes long
variable names pretty inconvenient.
And all these decl_* macros, obviously can't create any names that
contain '-', which is pretty annoying. There is also a user in the
experimental patches in Greg's tree. Please leave it there for now.

Thanks,
Kay

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Remove "decl_subsys_name" macro and single usage of it.
  2007-03-15 10:22 ` Kay Sievers
@ 2007-03-15 12:52   ` Robert P. J. Day
  2007-03-15 13:08     ` Kay Sievers
  0 siblings, 1 reply; 5+ messages in thread
From: Robert P. J. Day @ 2007-03-15 12:52 UTC (permalink / raw)
  To: Kay Sievers; +Cc: Linux Kernel Mailing List, Greg KH

On Thu, 15 Mar 2007, Kay Sievers wrote:

> On 3/1/07, Robert P. J. Day <rpjday@mindspring.com> wrote:
> >
> >   Remove the macro "decl_subsys_name" which can be used to declare a
> > sysfs subsystem, along with the single invocation of it in the source
> > tree, since there appears to be little value in creating a subsystem
> > whose subsystem name differs from its structure name.  Everyone else
> > just uses "decl_subsys".
>
> Sometimes you want shorter variable names as the created objects in
> sysfs, because the 80 columns limit of the kernel source makes long
> variable names pretty inconvenient.
> And all these decl_* macros, obviously can't create any names that
> contain '-', which is pretty annoying. There is also a user in the
> experimental patches in Greg's tree. Please leave it there for now.

no problem but that patch *was* based on a suggestion by greg in the
first place.  i'm guessing he just forgot. :-)

rday
-- 
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://fsdev.net/wiki/index.php?title=Main_Page
========================================================================

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Remove "decl_subsys_name" macro and single usage of it.
  2007-03-15 12:52   ` Robert P. J. Day
@ 2007-03-15 13:08     ` Kay Sievers
  0 siblings, 0 replies; 5+ messages in thread
From: Kay Sievers @ 2007-03-15 13:08 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: Linux Kernel Mailing List, Greg KH

On Thu, 2007-03-15 at 08:52 -0400, Robert P. J. Day wrote:
> On Thu, 15 Mar 2007, Kay Sievers wrote:
> 
> > On 3/1/07, Robert P. J. Day <rpjday@mindspring.com> wrote:
> > >
> > >   Remove the macro "decl_subsys_name" which can be used to declare a
> > > sysfs subsystem, along with the single invocation of it in the source
> > > tree, since there appears to be little value in creating a subsystem
> > > whose subsystem name differs from its structure name.  Everyone else
> > > just uses "decl_subsys".
> >
> > Sometimes you want shorter variable names as the created objects in
> > sysfs, because the 80 columns limit of the kernel source makes long
> > variable names pretty inconvenient.
> > And all these decl_* macros, obviously can't create any names that
> > contain '-', which is pretty annoying. There is also a user in the
> > experimental patches in Greg's tree. Please leave it there for now.
> 
> no problem but that patch *was* based on a suggestion by greg in the
> first place.  i'm guessing he just forgot. :-)

A cleanup of the driver-core source is long overdue, that's why we like
everything that goes away here, that isn't really needed. :)

In the end, we should probably just get rid of the whole "struct
subsystem". We can move the lock to the kset and ditch the whole weird
idea of a "subsystem", which is nothing but a collection of ksets, which
the object model can handle without "struct subsystem" just fine.

Thanks,
Kay


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-03-15 13:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-01 17:09 [PATCH] Remove "decl_subsys_name" macro and single usage of it Robert P. J. Day
2007-03-15  7:25 ` Greg KH
2007-03-15 10:22 ` Kay Sievers
2007-03-15 12:52   ` Robert P. J. Day
2007-03-15 13:08     ` Kay Sievers

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.