All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] getting rid of "decl_subsys_name" macro?
@ 2007-02-26 23:25 Robert P. J. Day
  2007-02-26 23:41 ` Greg KH
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Robert P. J. Day @ 2007-02-26 23:25 UTC (permalink / raw)
  To: kernel-janitors


  just stumbled across the following -- the header file kobject.h
defines two macros for declaring sysfs subsystems:

#define decl_subsys(_name,_type,_uevent_ops) \
struct subsystem _name##_subsys = { \
        .kset = { \
                .kobj = { .name = __stringify(_name) }, \
                .ktype = _type, \
                .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, \
        } \
}

  note that the first makes more logical sense as the name of the
structure will match the name of the kobject, while the second allows
those two things to have *different* values.

  but a search of the entire tree turns up exactly *one* instance
where that second variation is being used:

$ grep -rw decl_subsys_name *
drivers/pci/hotplug/pci_hotplug_core.c:decl_subsys_name(pci_hotplug_slots,
   slots, &hotplug_slot_ktype, NULL);

  is it really worth defining an entirely new macro whose semantics
are potentially confusing for the sake of a single kernel-wide
subsystem?

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

http://fsdev.net/wiki/index.php?title=Main_Page
====================================
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] getting rid of "decl_subsys_name" macro?
  2007-02-26 23:25 [KJ] getting rid of "decl_subsys_name" macro? Robert P. J. Day
@ 2007-02-26 23:41 ` Greg KH
  2007-02-27 13:38 ` Robert P. J. Day
  2007-02-27 16:52 ` Greg KH
  2 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2007-02-26 23:41 UTC (permalink / raw)
  To: kernel-janitors

On Mon, Feb 26, 2007 at 06:25:10PM -0500, Robert P. J. Day wrote:
> 
>   just stumbled across the following -- the header file kobject.h
> defines two macros for declaring sysfs subsystems:
> 
> #define decl_subsys(_name,_type,_uevent_ops) \
> struct subsystem _name##_subsys = { \
>         .kset = { \
>                 .kobj = { .name = __stringify(_name) }, \
>                 .ktype = _type, \
>                 .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, \
>         } \
> }
> 
>   note that the first makes more logical sense as the name of the
> structure will match the name of the kobject, while the second allows
> those two things to have *different* values.
> 
>   but a search of the entire tree turns up exactly *one* instance
> where that second variation is being used:
> 
> $ grep -rw decl_subsys_name *
> drivers/pci/hotplug/pci_hotplug_core.c:decl_subsys_name(pci_hotplug_slots,
>    slots, &hotplug_slot_ktype, NULL);
> 
>   is it really worth defining an entirely new macro whose semantics
> are potentially confusing for the sake of a single kernel-wide
> subsystem?

Nope, drop it!

thanks,

greg k-h
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] getting rid of "decl_subsys_name" macro?
  2007-02-26 23:25 [KJ] getting rid of "decl_subsys_name" macro? Robert P. J. Day
  2007-02-26 23:41 ` Greg KH
@ 2007-02-27 13:38 ` Robert P. J. Day
  2007-02-27 16:52 ` Greg KH
  2 siblings, 0 replies; 4+ messages in thread
From: Robert P. J. Day @ 2007-02-27 13:38 UTC (permalink / raw)
  To: kernel-janitors

On Mon, 26 Feb 2007, Greg KH wrote:

> On Mon, Feb 26, 2007 at 06:25:10PM -0500, Robert P. J. Day wrote:
> >
> >   just stumbled across the following -- the header file kobject.h
> > defines two macros for declaring sysfs subsystems:
> >
> > #define decl_subsys(_name,_type,_uevent_ops) \
> > struct subsystem _name##_subsys = { \
> >         .kset = { \
> >                 .kobj = { .name = __stringify(_name) }, \
> >                 .ktype = _type, \
> >                 .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, \
> >         } \
> > }
> >
> >   note that the first makes more logical sense as the name of the
> > structure will match the name of the kobject, while the second allows
> > those two things to have *different* values.
> >
> >   but a search of the entire tree turns up exactly *one* instance
> > where that second variation is being used:
> >
> > $ grep -rw decl_subsys_name *
> > drivers/pci/hotplug/pci_hotplug_core.c:decl_subsys_name(pci_hotplug_slots,
> >    slots, &hotplug_slot_ktype, NULL);
> >
> >   is it really worth defining an entirely new macro whose semantics
> > are potentially confusing for the sake of a single kernel-wide
> > subsystem?
>
> Nope, drop it!

without having looked even briefly at this single example yet this
morning, i'm assuming the proper solution is to rename the structure,
since renaming the actual name as it appears in sysfs might cause
breakage, right?

rday

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

http://fsdev.net/wiki/index.php?title=Main_Page
====================================
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] getting rid of "decl_subsys_name" macro?
  2007-02-26 23:25 [KJ] getting rid of "decl_subsys_name" macro? Robert P. J. Day
  2007-02-26 23:41 ` Greg KH
  2007-02-27 13:38 ` Robert P. J. Day
@ 2007-02-27 16:52 ` Greg KH
  2 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2007-02-27 16:52 UTC (permalink / raw)
  To: kernel-janitors

On Tue, Feb 27, 2007 at 08:38:07AM -0500, Robert P. J. Day wrote:
> On Mon, 26 Feb 2007, Greg KH wrote:
> 
> > On Mon, Feb 26, 2007 at 06:25:10PM -0500, Robert P. J. Day wrote:
> > >
> > >   just stumbled across the following -- the header file kobject.h
> > > defines two macros for declaring sysfs subsystems:
> > >
> > > #define decl_subsys(_name,_type,_uevent_ops) \
> > > struct subsystem _name##_subsys = { \
> > >         .kset = { \
> > >                 .kobj = { .name = __stringify(_name) }, \
> > >                 .ktype = _type, \
> > >                 .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, \
> > >         } \
> > > }
> > >
> > >   note that the first makes more logical sense as the name of the
> > > structure will match the name of the kobject, while the second allows
> > > those two things to have *different* values.
> > >
> > >   but a search of the entire tree turns up exactly *one* instance
> > > where that second variation is being used:
> > >
> > > $ grep -rw decl_subsys_name *
> > > drivers/pci/hotplug/pci_hotplug_core.c:decl_subsys_name(pci_hotplug_slots,
> > >    slots, &hotplug_slot_ktype, NULL);
> > >
> > >   is it really worth defining an entirely new macro whose semantics
> > > are potentially confusing for the sake of a single kernel-wide
> > > subsystem?
> >
> > Nope, drop it!
> 
> without having looked even briefly at this single example yet this
> morning, i'm assuming the proper solution is to rename the structure,
> since renaming the actual name as it appears in sysfs might cause
> breakage, right?

Yes, rename the internal structure, not the externally visible one.

thanks,

greg k-h
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

end of thread, other threads:[~2007-02-27 16:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-26 23:25 [KJ] getting rid of "decl_subsys_name" macro? Robert P. J. Day
2007-02-26 23:41 ` Greg KH
2007-02-27 13:38 ` Robert P. J. Day
2007-02-27 16:52 ` Greg KH

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.