* linux-next: manual merge of the driver-core tree with the pm tree
@ 2013-05-22 3:47 Stephen Rothwell
2013-05-22 4:02 ` Stephen Rothwell
0 siblings, 1 reply; 5+ messages in thread
From: Stephen Rothwell @ 2013-05-22 3:47 UTC (permalink / raw)
To: Greg KH; +Cc: linux-next, linux-kernel, Rafael J. Wysocki, Igor Mammedov
[-- Attachment #1: Type: text/plain, Size: 3583 bytes --]
Hi Greg,
Today's linux-next merge of the driver-core tree got a conflict in
drivers/base/cpu.c between commit 0902a9044fa5 ("Driver core: Use generic
offline/online for CPU offline/online") from the pm tree and commit
1c4e2d70afb1 ("cpu: make sure that cpu/online file created before
KOBJ_ADD is emitted") from the driver-core tree.
I fixed it up (they do some bits in common - see below) and can carry the
fix as necessary (no action is required).
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
diff --cc drivers/base/cpu.c
index 7431ba6,c377673..0000000
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@@ -38,39 -34,66 +38,48 @@@ static void change_cpu_under_node(struc
cpu->node_id = to_nid;
}
-static ssize_t show_online(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+static int __ref cpu_subsys_online(struct device *dev)
{
struct cpu *cpu = container_of(dev, struct cpu, dev);
+ int cpuid = dev->id;
+ int from_nid, to_nid;
+ int ret;
+
+ cpu_hotplug_driver_lock();
+
+ from_nid = cpu_to_node(cpuid);
+ ret = cpu_up(cpuid);
+ /*
+ * When hot adding memory to memoryless node and enabling a cpu
+ * on the node, node number of the cpu may internally change.
+ */
+ to_nid = cpu_to_node(cpuid);
+ if (from_nid != to_nid)
+ change_cpu_under_node(cpu, from_nid, to_nid);
- return sprintf(buf, "%u\n", !!cpu_online(cpu->dev.id));
+ cpu_hotplug_driver_unlock();
+ return ret;
}
-static ssize_t __ref store_online(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
+static int cpu_subsys_offline(struct device *dev)
{
- struct cpu *cpu = container_of(dev, struct cpu, dev);
- int cpuid = cpu->dev.id;
- int from_nid, to_nid;
- ssize_t ret;
+ int ret;
cpu_hotplug_driver_lock();
- switch (buf[0]) {
- case '0':
- ret = cpu_down(cpuid);
- if (!ret)
- kobject_uevent(&dev->kobj, KOBJ_OFFLINE);
- break;
- case '1':
- from_nid = cpu_to_node(cpuid);
- ret = cpu_up(cpuid);
-
- /*
- * When hot adding memory to memoryless node and enabling a cpu
- * on the node, node number of the cpu may internally change.
- */
- to_nid = cpu_to_node(cpuid);
- if (from_nid != to_nid)
- change_cpu_under_node(cpu, from_nid, to_nid);
-
- if (!ret)
- kobject_uevent(&dev->kobj, KOBJ_ONLINE);
- break;
- default:
- ret = -EINVAL;
- }
+ ret = cpu_down(dev->id);
cpu_hotplug_driver_unlock();
-
- if (ret >= 0)
- ret = count;
return ret;
}
-static DEVICE_ATTR(online, 0644, show_online, store_online);
+ static struct attribute *hotplug_cpu_attrs[] = {
+ &dev_attr_online.attr,
+ NULL
+ };
+
+ static struct attribute_group hotplug_cpu_attr_group = {
+ .attrs = hotplug_cpu_attrs,
+ };
+
void unregister_cpu(struct cpu *cpu)
{
int logical_cpu = cpu->dev.id;
@@@ -102,20 -125,8 +111,19 @@@ static ssize_t cpu_release_store(struc
static DEVICE_ATTR(probe, S_IWUSR, NULL, cpu_probe_store);
static DEVICE_ATTR(release, S_IWUSR, NULL, cpu_release_store);
#endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */
-
#endif /* CONFIG_HOTPLUG_CPU */
+struct bus_type cpu_subsys = {
+ .name = "cpu",
+ .dev_name = "cpu",
+ .match = cpu_subsys_match,
+#ifdef CONFIG_HOTPLUG_CPU
+ .online = cpu_subsys_online,
+ .offline = cpu_subsys_offline,
+#endif
+};
+EXPORT_SYMBOL_GPL(cpu_subsys);
+
#ifdef CONFIG_KEXEC
#include <linux/kexec.h>
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: linux-next: manual merge of the driver-core tree with the pm tree 2013-05-22 3:47 linux-next: manual merge of the driver-core tree with the pm tree Stephen Rothwell @ 2013-05-22 4:02 ` Stephen Rothwell 2013-05-22 11:26 ` Rafael J. Wysocki 2013-05-22 13:53 ` [PATCH linux-next] Driver core: cpu: remove not needed anymore hotplugable_cpu_attr_groups[] Igor Mammedov 0 siblings, 2 replies; 5+ messages in thread From: Stephen Rothwell @ 2013-05-22 4:02 UTC (permalink / raw) To: Greg KH; +Cc: linux-next, linux-kernel, Rafael J. Wysocki, Igor Mammedov [-- Attachment #1: Type: text/plain, Size: 4865 bytes --] Hi all, On Wed, 22 May 2013 13:47:41 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote: > > Today's linux-next merge of the driver-core tree got a conflict in > drivers/base/cpu.c between commit 0902a9044fa5 ("Driver core: Use generic > offline/online for CPU offline/online") from the pm tree and commit > 1c4e2d70afb1 ("cpu: make sure that cpu/online file created before > KOBJ_ADD is emitted") from the driver-core tree. > > I fixed it up (they do some bits in common - see below) and can carry the > fix as necessary (no action is required). > > diff --cc drivers/base/cpu.c > index 7431ba6,c377673..0000000 > --- a/drivers/base/cpu.c > +++ b/drivers/base/cpu.c > @@@ -38,39 -34,66 +38,48 @@@ static void change_cpu_under_node(struc > cpu->node_id = to_nid; > } > > -static ssize_t show_online(struct device *dev, > - struct device_attribute *attr, > - char *buf) > +static int __ref cpu_subsys_online(struct device *dev) > { > struct cpu *cpu = container_of(dev, struct cpu, dev); > + int cpuid = dev->id; > + int from_nid, to_nid; > + int ret; > + > + cpu_hotplug_driver_lock(); > + > + from_nid = cpu_to_node(cpuid); > + ret = cpu_up(cpuid); > + /* > + * When hot adding memory to memoryless node and enabling a cpu > + * on the node, node number of the cpu may internally change. > + */ > + to_nid = cpu_to_node(cpuid); > + if (from_nid != to_nid) > + change_cpu_under_node(cpu, from_nid, to_nid); > > - return sprintf(buf, "%u\n", !!cpu_online(cpu->dev.id)); > + cpu_hotplug_driver_unlock(); > + return ret; > } > > -static ssize_t __ref store_online(struct device *dev, > - struct device_attribute *attr, > - const char *buf, size_t count) > +static int cpu_subsys_offline(struct device *dev) > { > - struct cpu *cpu = container_of(dev, struct cpu, dev); > - int cpuid = cpu->dev.id; > - int from_nid, to_nid; > - ssize_t ret; > + int ret; > > cpu_hotplug_driver_lock(); > - switch (buf[0]) { > - case '0': > - ret = cpu_down(cpuid); > - if (!ret) > - kobject_uevent(&dev->kobj, KOBJ_OFFLINE); > - break; > - case '1': > - from_nid = cpu_to_node(cpuid); > - ret = cpu_up(cpuid); > - > - /* > - * When hot adding memory to memoryless node and enabling a cpu > - * on the node, node number of the cpu may internally change. > - */ > - to_nid = cpu_to_node(cpuid); > - if (from_nid != to_nid) > - change_cpu_under_node(cpu, from_nid, to_nid); > - > - if (!ret) > - kobject_uevent(&dev->kobj, KOBJ_ONLINE); > - break; > - default: > - ret = -EINVAL; > - } > + ret = cpu_down(dev->id); > cpu_hotplug_driver_unlock(); > - > - if (ret >= 0) > - ret = count; > return ret; > } > -static DEVICE_ATTR(online, 0644, show_online, store_online); > > + static struct attribute *hotplug_cpu_attrs[] = { > + &dev_attr_online.attr, > + NULL > + }; > + > + static struct attribute_group hotplug_cpu_attr_group = { > + .attrs = hotplug_cpu_attrs, > + }; > + > void unregister_cpu(struct cpu *cpu) > { > int logical_cpu = cpu->dev.id; > @@@ -102,20 -125,8 +111,19 @@@ static ssize_t cpu_release_store(struc > static DEVICE_ATTR(probe, S_IWUSR, NULL, cpu_probe_store); > static DEVICE_ATTR(release, S_IWUSR, NULL, cpu_release_store); > #endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */ > - > #endif /* CONFIG_HOTPLUG_CPU */ > > +struct bus_type cpu_subsys = { > + .name = "cpu", > + .dev_name = "cpu", > + .match = cpu_subsys_match, > +#ifdef CONFIG_HOTPLUG_CPU > + .online = cpu_subsys_online, > + .offline = cpu_subsys_offline, > +#endif > +}; > +EXPORT_SYMBOL_GPL(cpu_subsys); > + > #ifdef CONFIG_KEXEC > #include <linux/kexec.h> OK, after doing that I got this error: drivers/base/cpu.c:75:3: error: 'dev_attr_online' undeclared here (not in a function) &dev_attr_online.attr, ^ So I applied this merge fix patch: diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 811bb5a..ff97614 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -71,15 +71,6 @@ static int cpu_subsys_offline(struct device *dev) return ret; } -static struct attribute *hotplug_cpu_attrs[] = { - &dev_attr_online.attr, - NULL -}; - -static struct attribute_group hotplug_cpu_attr_group = { - .attrs = hotplug_cpu_attrs, -}; - void unregister_cpu(struct cpu *cpu) { int logical_cpu = cpu->dev.id; @@ -182,9 +173,6 @@ static const struct attribute_group *hotplugable_cpu_attr_groups[] = { #ifdef CONFIG_KEXEC &crash_note_cpu_attr_group, #endif -#ifdef CONFIG_HOTPLUG_CPU - &hotplug_cpu_attr_group, -#endif NULL }; Better ideas welcome :-) -- Cheers, Stephen Rothwell sfr@canb.auug.org.au [-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: linux-next: manual merge of the driver-core tree with the pm tree 2013-05-22 4:02 ` Stephen Rothwell @ 2013-05-22 11:26 ` Rafael J. Wysocki 2013-05-22 13:53 ` [PATCH linux-next] Driver core: cpu: remove not needed anymore hotplugable_cpu_attr_groups[] Igor Mammedov 1 sibling, 0 replies; 5+ messages in thread From: Rafael J. Wysocki @ 2013-05-22 11:26 UTC (permalink / raw) To: Stephen Rothwell, Greg KH; +Cc: linux-next, linux-kernel, Igor Mammedov On Wednesday, May 22, 2013 02:02:13 PM Stephen Rothwell wrote: > Hi all, Hi Stephen, Thanks for fixing this up! Hi Greg, What about merging my acpi-hotplug branch into the driver-core tree? That would make the Linus' life easier going forward I suppose. Thanks, Rafael > On Wed, 22 May 2013 13:47:41 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote: > > > > Today's linux-next merge of the driver-core tree got a conflict in > > drivers/base/cpu.c between commit 0902a9044fa5 ("Driver core: Use generic > > offline/online for CPU offline/online") from the pm tree and commit > > 1c4e2d70afb1 ("cpu: make sure that cpu/online file created before > > KOBJ_ADD is emitted") from the driver-core tree. > > > > I fixed it up (they do some bits in common - see below) and can carry the > > fix as necessary (no action is required). > > > > diff --cc drivers/base/cpu.c > > index 7431ba6,c377673..0000000 > > --- a/drivers/base/cpu.c > > +++ b/drivers/base/cpu.c > > @@@ -38,39 -34,66 +38,48 @@@ static void change_cpu_under_node(struc > > cpu->node_id = to_nid; > > } > > > > -static ssize_t show_online(struct device *dev, > > - struct device_attribute *attr, > > - char *buf) > > +static int __ref cpu_subsys_online(struct device *dev) > > { > > struct cpu *cpu = container_of(dev, struct cpu, dev); > > + int cpuid = dev->id; > > + int from_nid, to_nid; > > + int ret; > > + > > + cpu_hotplug_driver_lock(); > > + > > + from_nid = cpu_to_node(cpuid); > > + ret = cpu_up(cpuid); > > + /* > > + * When hot adding memory to memoryless node and enabling a cpu > > + * on the node, node number of the cpu may internally change. > > + */ > > + to_nid = cpu_to_node(cpuid); > > + if (from_nid != to_nid) > > + change_cpu_under_node(cpu, from_nid, to_nid); > > > > - return sprintf(buf, "%u\n", !!cpu_online(cpu->dev.id)); > > + cpu_hotplug_driver_unlock(); > > + return ret; > > } > > > > -static ssize_t __ref store_online(struct device *dev, > > - struct device_attribute *attr, > > - const char *buf, size_t count) > > +static int cpu_subsys_offline(struct device *dev) > > { > > - struct cpu *cpu = container_of(dev, struct cpu, dev); > > - int cpuid = cpu->dev.id; > > - int from_nid, to_nid; > > - ssize_t ret; > > + int ret; > > > > cpu_hotplug_driver_lock(); > > - switch (buf[0]) { > > - case '0': > > - ret = cpu_down(cpuid); > > - if (!ret) > > - kobject_uevent(&dev->kobj, KOBJ_OFFLINE); > > - break; > > - case '1': > > - from_nid = cpu_to_node(cpuid); > > - ret = cpu_up(cpuid); > > - > > - /* > > - * When hot adding memory to memoryless node and enabling a cpu > > - * on the node, node number of the cpu may internally change. > > - */ > > - to_nid = cpu_to_node(cpuid); > > - if (from_nid != to_nid) > > - change_cpu_under_node(cpu, from_nid, to_nid); > > - > > - if (!ret) > > - kobject_uevent(&dev->kobj, KOBJ_ONLINE); > > - break; > > - default: > > - ret = -EINVAL; > > - } > > + ret = cpu_down(dev->id); > > cpu_hotplug_driver_unlock(); > > - > > - if (ret >= 0) > > - ret = count; > > return ret; > > } > > -static DEVICE_ATTR(online, 0644, show_online, store_online); > > > > + static struct attribute *hotplug_cpu_attrs[] = { > > + &dev_attr_online.attr, > > + NULL > > + }; > > + > > + static struct attribute_group hotplug_cpu_attr_group = { > > + .attrs = hotplug_cpu_attrs, > > + }; > > + > > void unregister_cpu(struct cpu *cpu) > > { > > int logical_cpu = cpu->dev.id; > > @@@ -102,20 -125,8 +111,19 @@@ static ssize_t cpu_release_store(struc > > static DEVICE_ATTR(probe, S_IWUSR, NULL, cpu_probe_store); > > static DEVICE_ATTR(release, S_IWUSR, NULL, cpu_release_store); > > #endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */ > > - > > #endif /* CONFIG_HOTPLUG_CPU */ > > > > +struct bus_type cpu_subsys = { > > + .name = "cpu", > > + .dev_name = "cpu", > > + .match = cpu_subsys_match, > > +#ifdef CONFIG_HOTPLUG_CPU > > + .online = cpu_subsys_online, > > + .offline = cpu_subsys_offline, > > +#endif > > +}; > > +EXPORT_SYMBOL_GPL(cpu_subsys); > > + > > #ifdef CONFIG_KEXEC > > #include <linux/kexec.h> > > OK, after doing that I got this error: > > drivers/base/cpu.c:75:3: error: 'dev_attr_online' undeclared here (not in a function) > &dev_attr_online.attr, > ^ > > So I applied this merge fix patch: > > diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c > index 811bb5a..ff97614 100644 > --- a/drivers/base/cpu.c > +++ b/drivers/base/cpu.c > @@ -71,15 +71,6 @@ static int cpu_subsys_offline(struct device *dev) > return ret; > } > > -static struct attribute *hotplug_cpu_attrs[] = { > - &dev_attr_online.attr, > - NULL > -}; > - > -static struct attribute_group hotplug_cpu_attr_group = { > - .attrs = hotplug_cpu_attrs, > -}; > - > void unregister_cpu(struct cpu *cpu) > { > int logical_cpu = cpu->dev.id; > @@ -182,9 +173,6 @@ static const struct attribute_group *hotplugable_cpu_attr_groups[] = { > #ifdef CONFIG_KEXEC > &crash_note_cpu_attr_group, > #endif > -#ifdef CONFIG_HOTPLUG_CPU > - &hotplug_cpu_attr_group, > -#endif > NULL > }; > > Better ideas welcome :-) > -- I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH linux-next] Driver core: cpu: remove not needed anymore hotplugable_cpu_attr_groups[] 2013-05-22 4:02 ` Stephen Rothwell 2013-05-22 11:26 ` Rafael J. Wysocki @ 2013-05-22 13:53 ` Igor Mammedov 2013-05-23 0:32 ` Stephen Rothwell 1 sibling, 1 reply; 5+ messages in thread From: Igor Mammedov @ 2013-05-22 13:53 UTC (permalink / raw) To: Greg KH; +Cc: Stephen Rothwell, Rafael J. Wysocki, linux-kernel, linux-next after fixing conflict between 0902a9044 "Driver core: Use generic offline/online for CPU offline/online" and 1c4e2d70a "cpu: make sure that cpu/online file created before KOBJ_ADD is emitted" there was left some not needed remnants of the last commit, remove them since the first commit does the same thing in another way. Signed-off-by: Igor Mammedov <imammedo@redhat.com> --- PS: Alernative way is just to drop 1c4e2d70a if rebase of tree is acceptable. --- drivers/base/cpu.c | 9 --------- 1 files changed, 0 insertions(+), 9 deletions(-) diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index ff97614..130ba0b 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -169,13 +169,6 @@ static const struct attribute_group *common_cpu_attr_groups[] = { NULL }; -static const struct attribute_group *hotplugable_cpu_attr_groups[] = { -#ifdef CONFIG_KEXEC - &crash_note_cpu_attr_group, -#endif - NULL -}; - /* * Print cpu online, possible, present, and system maps */ @@ -292,8 +285,6 @@ int __cpuinit register_cpu(struct cpu *cpu, int num) cpu->dev.bus->uevent = arch_cpu_uevent; #endif cpu->dev.groups = common_cpu_attr_groups; - if (cpu->hotpluggable) - cpu->dev.groups = hotplugable_cpu_attr_groups; error = device_register(&cpu->dev); if (!error) per_cpu(cpu_sys_devices, num) = &cpu->dev; -- 1.7.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH linux-next] Driver core: cpu: remove not needed anymore hotplugable_cpu_attr_groups[] 2013-05-22 13:53 ` [PATCH linux-next] Driver core: cpu: remove not needed anymore hotplugable_cpu_attr_groups[] Igor Mammedov @ 2013-05-23 0:32 ` Stephen Rothwell 0 siblings, 0 replies; 5+ messages in thread From: Stephen Rothwell @ 2013-05-23 0:32 UTC (permalink / raw) To: Igor Mammedov; +Cc: Greg KH, Rafael J. Wysocki, linux-kernel, linux-next [-- Attachment #1: Type: text/plain, Size: 648 bytes --] Hi Igor, On Wed, 22 May 2013 15:53:32 +0200 Igor Mammedov <imammedo@redhat.com> wrote: > > after fixing conflict between > 0902a9044 "Driver core: Use generic offline/online > for CPU offline/online" > > and > > 1c4e2d70a "cpu: make sure that cpu/online file created > before KOBJ_ADD is emitted" > > there was left some not needed remnants of the last > commit, remove them since the first commit does the > same thing in another way. > > Signed-off-by: Igor Mammedov <imammedo@redhat.com> I have integrated this into my merge resolution, thanks. -- Cheers, Stephen Rothwell sfr@canb.auug.org.au [-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-05-23 0:32 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-05-22 3:47 linux-next: manual merge of the driver-core tree with the pm tree Stephen Rothwell 2013-05-22 4:02 ` Stephen Rothwell 2013-05-22 11:26 ` Rafael J. Wysocki 2013-05-22 13:53 ` [PATCH linux-next] Driver core: cpu: remove not needed anymore hotplugable_cpu_attr_groups[] Igor Mammedov 2013-05-23 0:32 ` Stephen Rothwell
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).