Re: [RFC/PATCH] unregister_node() for hotplug use

From: Keiichiro Tokunaga
Date: Tue May 10 2005 - 10:06:40 EST


On Mon, 09 May 2005 15:44:03 -0700 Matthew Dobson wrote:
> Keiichiro Tokunaga wrote:
> > I updated the patch for 2.6.12-rc3-mm3 based on my
> > previous comments. Please apply.
> >
> > Thanks,
> > Keiichiro Tokunaga
> >
> >
> >
> > This adds a generic function 'unregister_node()'.
> > It is used to remove objects of a node going away
> > for hotplug.
> >
> > Signed-off-by: Keiichiro Tokunaga <tokunaga.keiich@xxxxxxxxxxxxxx>
> > ---
> >
> > linux-2.6.12-rc3-mm3-kei/drivers/base/node.c | 15 +++++++++++++--
> > linux-2.6.12-rc3-mm3-kei/include/linux/node.h | 1 +
> > 2 files changed, 14 insertions(+), 2 deletions(-)
> >
> > diff -puN drivers/base/node.c~numa_hp_base drivers/base/node.c
> > --- linux-2.6.12-rc3-mm3/drivers/base/node.c~numa_hp_base 2005-05-07 19:58:15.000000000 +0900
> > +++ linux-2.6.12-rc3-mm3-kei/drivers/base/node.c 2005-05-07 19:58:15.000000000 +0900
> > @@ -136,7 +136,7 @@ static SYSDEV_ATTR(distance, S_IRUGO, no
> > *
> > * Initialize and register the node device.
> > */
> > -int __init register_node(struct node *node, int num, struct node *parent)
> > +int register_node(struct node *node, int num, struct node *parent)
> > {
> > int error;
> >
> > @@ -153,8 +153,19 @@ int __init register_node(struct node *no
> > return error;
> > }
> >
> > +void unregister_node(struct node *node)
> > +{
> > + sysdev_remove_file(&node->sysdev, &attr_cpumap);
> > + sysdev_remove_file(&node->sysdev, &attr_meminfo);
> > + sysdev_remove_file(&node->sysdev, &attr_numastat);
> > + sysdev_remove_file(&node->sysdev, &attr_distance);
> > +
> > + sysdev_unregister(&node->sysdev);
> > +}
>
> Is there a reason to not make both register_node() and unregister_node()
> __devinit? If a user has CONFIG_HOTPLUG=y then they want these functions,
> otherwise there is no point, as they promised they won't be hotplugging
> anything, right?

The main reason is Greg advised me that we had the function
no matter if CONFIG_HOTPLUG is true or not. An addtional
advantage of this is that the source becomes cleaner because
I included unregister_node() with '#ifdef CONFIG_HOTPLUG' and
'#endif' in my previous version of patch.

Thanks,
Keiichiro Tokunaga
-
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/