From: Toshi Kani <toshi.kani@hp.com>
To: rjw@sisk.pl, lenb@kernel.org, gregkh@linuxfoundation.org,
akpm@linux-foundation.org
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, bhelgaas@google.com,
isimatu.yasuaki@jp.fujitsu.com, jiang.liu@huawei.com,
wency@cn.fujitsu.com, guohanjun@huawei.com, yinghai@kernel.org,
srivatsa.bhat@linux.vnet.ibm.com, Toshi Kani <toshi.kani@hp.com>
Subject: [RFC PATCH 10/11] cpu: Update sysfs cpu/online for hotplug framework
Date: Wed, 12 Dec 2012 16:17:22 -0700 [thread overview]
Message-ID: <1355354243-18657-11-git-send-email-toshi.kani@hp.com> (raw)
In-Reply-To: <1355354243-18657-1-git-send-email-toshi.kani@hp.com>
Changed store_online() to request a cpu online or offline
operation by calling hp_submit_req(). It sets a target cpu
device information with hp_add_dev_info() before making the
request.
Signed-off-by: Toshi Kani <toshi.kani@hp.com>
---
drivers/base/cpu.c | 40 ++++++++++++++++++++++++++++------------
1 file changed, 28 insertions(+), 12 deletions(-)
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 3870231..dc50d17 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -41,27 +41,43 @@ static ssize_t __ref store_online(struct device *dev,
const char *buf, size_t count)
{
struct cpu *cpu = container_of(dev, struct cpu, dev);
- ssize_t ret;
+ struct hp_request *hp_req;
+ struct hp_device *hp_dev;
+ enum hp_operation operation;
+ ssize_t ret = count;
- cpu_hotplug_driver_lock();
switch (buf[0]) {
case '0':
- ret = cpu_down(cpu->dev.id);
- if (!ret)
- kobject_uevent(&dev->kobj, KOBJ_OFFLINE);
+ operation = HP_ONLINE_DEL;
break;
case '1':
- ret = cpu_up(cpu->dev.id);
- if (!ret)
- kobject_uevent(&dev->kobj, KOBJ_ONLINE);
+ operation = HP_ONLINE_ADD;
break;
default:
- ret = -EINVAL;
+ return -EINVAL;
+ }
+
+ hp_req = hp_alloc_request(operation);
+ if (!hp_req)
+ return -ENOMEM;
+
+ hp_dev = kzalloc(sizeof(*hp_dev), GFP_KERNEL);
+ if (!hp_dev) {
+ kfree(hp_req);
+ return -ENOMEM;
+ }
+
+ hp_dev->device = dev;
+ hp_dev->class = HP_CLS_CPU;
+ hp_dev->data.cpu.cpu_id = cpu->dev.id;
+ hp_add_dev_info(hp_req, hp_dev);
+
+ if (hp_submit_req(hp_req)) {
+ kfree(hp_dev);
+ kfree(hp_req);
+ return -EINVAL;
}
- cpu_hotplug_driver_unlock();
- if (ret >= 0)
- ret = count;
return ret;
}
static DEVICE_ATTR(online, 0644, show_online, store_online);
--
1.7.11.7
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2012-12-12 23:27 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-12 23:17 [RFC PATCH 00/11] Hot-plug and Online/Offline framework Toshi Kani
2012-12-12 23:17 ` [RFC PATCH 01/11] Add hotplug.h for hotplug framework Toshi Kani
2012-12-12 23:53 ` Greg KH
2012-12-13 3:56 ` Toshi Kani
2012-12-12 23:17 ` [RFC PATCH 02/11] drivers/base: Add hotplug framework code Toshi Kani
2012-12-12 23:54 ` Greg KH
2012-12-13 4:02 ` Toshi Kani
2012-12-13 4:24 ` Greg KH
2012-12-13 16:30 ` Toshi Kani
2012-12-13 18:24 ` Greg KH
2012-12-14 1:59 ` Toshi Kani
2012-12-12 23:55 ` Greg KH
2012-12-13 3:58 ` Toshi Kani
2012-12-12 23:17 ` [RFC PATCH 03/11] cpu: Add cpu hotplug handlers Toshi Kani
2012-12-12 23:17 ` [RFC PATCH 04/11] mm: Add memory " Toshi Kani
2012-12-12 23:17 ` [RFC PATCH 05/11] ACPI: Add ACPI bus " Toshi Kani
2012-12-12 23:17 ` [RFC PATCH 06/11] ACPI: Add ACPI resource hotplug handler Toshi Kani
2012-12-12 23:17 ` [RFC PATCH 07/11] ACPI: Update processor driver for hotplug framework Toshi Kani
2012-12-12 23:17 ` [RFC PATCH 08/11] ACPI: Update memory " Toshi Kani
2012-12-12 23:17 ` [RFC PATCH 09/11] ACPI: Update container " Toshi Kani
2012-12-12 23:17 ` Toshi Kani [this message]
2012-12-12 23:17 ` [RFC PATCH 11/11] ACPI: Update sysfs eject " Toshi Kani
2012-12-12 23:56 ` [RFC PATCH 00/11] Hot-plug and Online/Offline framework Greg KH
2012-12-13 0:39 ` Toshi Kani
2012-12-13 0:55 ` Greg KH
2012-12-13 3:37 ` Toshi Kani
2012-12-13 4:16 ` Greg KH
2012-12-13 16:03 ` Toshi Kani
2012-12-13 18:30 ` Greg KH
2012-12-14 1:51 ` Toshi Kani
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1355354243-18657-11-git-send-email-toshi.kani@hp.com \
--to=toshi.kani@hp.com \
--cc=akpm@linux-foundation.org \
--cc=bhelgaas@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=guohanjun@huawei.com \
--cc=isimatu.yasuaki@jp.fujitsu.com \
--cc=jiang.liu@huawei.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rjw@sisk.pl \
--cc=srivatsa.bhat@linux.vnet.ibm.com \
--cc=wency@cn.fujitsu.com \
--cc=yinghai@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).