* [PATCH 1/9] ACPI: processor: remove KOBJ_ONLINE/KOBJ_OFFLINE events
2009-06-22 20:40 [PATCH 0/9 v2] ACPI: remove .start() and .stop() methods Bjorn Helgaas
@ 2009-06-22 20:41 ` Bjorn Helgaas
2009-06-22 20:41 ` [PATCH 2/9] ACPI: processor: clean up in acpi_processor_start() error exits Bjorn Helgaas
` (9 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Bjorn Helgaas @ 2009-06-22 20:41 UTC (permalink / raw)
To: Len Brown
Cc: Dave Jones, Greg Kroah-Hartman, Kay Sievers, Zhao Yakui,
linux-acpi, Venkatesh Pallipadi, Thomas Renninger,
Matthew Garrett
This patch removes the KOBJ_ONLINE/KOBJ_OFFLINE events the driver used
to generate for CPU hotplug. As far as I know, nobody consumes these.
The driver core still generates KOBJ_ADD and KOBJ_REMOVE, of course.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
CC: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
CC: Zhao Yakui <yakui.zhao@intel.com>
CC: Matthew Garrett <mjg@redhat.com>
CC: Thomas Renninger <trenn@suse.de>
CC: Dave Jones <davej@codemonkey.org.uk>
CC: Kay Sievers <kay.sievers@vrfy.org>
CC: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/acpi/processor_core.c | 16 +---------------
1 files changed, 1 insertions(+), 15 deletions(-)
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index e3d15f9..d8e210a 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -954,9 +954,6 @@ int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device)
if (!pr)
return -ENODEV;
- if ((pr->id >= 0) && (pr->id < nr_cpu_ids)) {
- kobject_uevent(&(*device)->dev.kobj, KOBJ_ONLINE);
- }
return 0;
}
@@ -993,18 +990,10 @@ static void __ref acpi_processor_hotplug_notify(acpi_handle handle,
break;
}
- if (pr->id >= 0 && (pr->id < nr_cpu_ids)) {
- kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
- break;
- }
-
result = acpi_processor_start(device);
- if ((!result) && ((pr->id >= 0) && (pr->id < nr_cpu_ids))) {
- kobject_uevent(&device->dev.kobj, KOBJ_ONLINE);
- } else {
+ if (result)
printk(KERN_ERR PREFIX "Device [%s] failed to start\n",
acpi_device_bid(device));
- }
break;
case ACPI_NOTIFY_EJECT_REQUEST:
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
@@ -1021,9 +1010,6 @@ static void __ref acpi_processor_hotplug_notify(acpi_handle handle,
"Driver data is NULL, dropping EJECT\n");
return;
}
-
- if ((pr->id < nr_cpu_ids) && (cpu_present(pr->id)))
- kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
break;
default:
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 2/9] ACPI: processor: clean up in acpi_processor_start() error exits
2009-06-22 20:40 [PATCH 0/9 v2] ACPI: remove .start() and .stop() methods Bjorn Helgaas
2009-06-22 20:41 ` [PATCH 1/9] ACPI: processor: remove KOBJ_ONLINE/KOBJ_OFFLINE events Bjorn Helgaas
@ 2009-06-22 20:41 ` Bjorn Helgaas
2009-06-22 20:41 ` [PATCH 3/9] ACPI: processor: move acpi_processor_start() after acpi_processor_add() Bjorn Helgaas
` (8 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Bjorn Helgaas @ 2009-06-22 20:41 UTC (permalink / raw)
To: Len Brown; +Cc: Zhao Yakui, linux-acpi, Alex Chiang, Venkatesh Pallipadi
We used to leave crud around if things failed in acpi_processor_start().
This patch cleans up as much as we can before returning.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Reviewed-by: Alex Chiang <achiang@hp.com>
CC: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
CC: Zhao Yakui <yakui.zhao@intel.com>
---
drivers/acpi/processor_core.c | 29 ++++++++++++++++++++++-------
1 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index d8e210a..7f082b6 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -722,11 +722,13 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
result = acpi_processor_add_fs(device);
if (result)
- goto end;
+ return result;
sysdev = get_cpu_sysdev(pr->id);
- if (sysfs_create_link(&device->dev.kobj, &sysdev->kobj, "sysdev"))
- return -EFAULT;
+ if (sysfs_create_link(&device->dev.kobj, &sysdev->kobj, "sysdev")) {
+ result = -EFAULT;
+ goto err_remove_fs;
+ }
/* _PDC call should be done before doing anything else (if reqd.). */
arch_acpi_processor_init_pdc(pr);
@@ -746,7 +748,7 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
&processor_cooling_ops);
if (IS_ERR(pr->cdev)) {
result = PTR_ERR(pr->cdev);
- goto end;
+ goto err_power_exit;
}
dev_info(&device->dev, "registered as cooling_device%d\n",
@@ -755,13 +757,17 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
result = sysfs_create_link(&device->dev.kobj,
&pr->cdev->device.kobj,
"thermal_cooling");
- if (result)
+ if (result) {
printk(KERN_ERR PREFIX "Create sysfs link\n");
+ goto err_thermal_unregister;
+ }
result = sysfs_create_link(&pr->cdev->device.kobj,
&device->dev.kobj,
"device");
- if (result)
+ if (result) {
printk(KERN_ERR PREFIX "Create sysfs link\n");
+ goto err_remove_sysfs;
+ }
if (pr->flags.throttling) {
printk(KERN_INFO PREFIX "%s [%s] (supports",
@@ -770,7 +776,16 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
printk(")\n");
}
- end:
+ return 0;
+
+err_remove_sysfs:
+ sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
+err_thermal_unregister:
+ thermal_cooling_device_unregister(pr->cdev);
+err_power_exit:
+ acpi_processor_power_exit(pr, device);
+err_remove_fs:
+ acpi_processor_remove_fs(device);
return result;
}
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 3/9] ACPI: processor: move acpi_processor_start() after acpi_processor_add()
2009-06-22 20:40 [PATCH 0/9 v2] ACPI: remove .start() and .stop() methods Bjorn Helgaas
2009-06-22 20:41 ` [PATCH 1/9] ACPI: processor: remove KOBJ_ONLINE/KOBJ_OFFLINE events Bjorn Helgaas
2009-06-22 20:41 ` [PATCH 2/9] ACPI: processor: clean up in acpi_processor_start() error exits Bjorn Helgaas
@ 2009-06-22 20:41 ` Bjorn Helgaas
2009-06-22 20:41 ` [PATCH 4/9] ACPI: processor: remove .start() method Bjorn Helgaas
` (7 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Bjorn Helgaas @ 2009-06-22 20:41 UTC (permalink / raw)
To: Len Brown; +Cc: Zhao Yakui, linux-acpi, Venkatesh Pallipadi
Move acpi_processor_start() to just after acpi_processor_add().
A subsequent patch will merge them.
Code movement only; no functional change.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
CC: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
CC: Zhao Yakui <yakui.zhao@intel.com>
---
drivers/acpi/processor_core.c | 168 +++++++++++++++++++++--------------------
1 files changed, 84 insertions(+), 84 deletions(-)
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 7f082b6..393695f 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -689,6 +689,90 @@ static int acpi_processor_get_info(struct acpi_device *device)
static DEFINE_PER_CPU(void *, processor_device_array);
+static void acpi_processor_notify(struct acpi_device *device, u32 event)
+{
+ struct acpi_processor *pr = acpi_driver_data(device);
+ int saved;
+
+ if (!pr)
+ return;
+
+ switch (event) {
+ case ACPI_PROCESSOR_NOTIFY_PERFORMANCE:
+ saved = pr->performance_platform_limit;
+ acpi_processor_ppc_has_changed(pr);
+ if (saved == pr->performance_platform_limit)
+ break;
+ acpi_bus_generate_proc_event(device, event,
+ pr->performance_platform_limit);
+ acpi_bus_generate_netlink_event(device->pnp.device_class,
+ dev_name(&device->dev), event,
+ pr->performance_platform_limit);
+ break;
+ case ACPI_PROCESSOR_NOTIFY_POWER:
+ acpi_processor_cst_has_changed(pr);
+ acpi_bus_generate_proc_event(device, event, 0);
+ acpi_bus_generate_netlink_event(device->pnp.device_class,
+ dev_name(&device->dev), event, 0);
+ break;
+ case ACPI_PROCESSOR_NOTIFY_THROTTLING:
+ acpi_processor_tstate_has_changed(pr);
+ acpi_bus_generate_proc_event(device, event, 0);
+ acpi_bus_generate_netlink_event(device->pnp.device_class,
+ dev_name(&device->dev), event, 0);
+ default:
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+ "Unsupported event [0x%x]\n", event));
+ break;
+ }
+
+ return;
+}
+
+static int acpi_cpu_soft_notify(struct notifier_block *nfb,
+ unsigned long action, void *hcpu)
+{
+ unsigned int cpu = (unsigned long)hcpu;
+ struct acpi_processor *pr = per_cpu(processors, cpu);
+
+ if (action == CPU_ONLINE && pr) {
+ acpi_processor_ppc_has_changed(pr);
+ acpi_processor_cst_has_changed(pr);
+ acpi_processor_tstate_has_changed(pr);
+ }
+ return NOTIFY_OK;
+}
+
+static struct notifier_block acpi_cpu_notifier =
+{
+ .notifier_call = acpi_cpu_soft_notify,
+};
+
+static int acpi_processor_add(struct acpi_device *device)
+{
+ struct acpi_processor *pr = NULL;
+
+
+ if (!device)
+ return -EINVAL;
+
+ pr = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL);
+ if (!pr)
+ return -ENOMEM;
+
+ if (!zalloc_cpumask_var(&pr->throttling.shared_cpu_map, GFP_KERNEL)) {
+ kfree(pr);
+ return -ENOMEM;
+ }
+
+ pr->handle = device->handle;
+ strcpy(acpi_device_name(device), ACPI_PROCESSOR_DEVICE_NAME);
+ strcpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS);
+ device->driver_data = pr;
+
+ return 0;
+}
+
static int __cpuinit acpi_processor_start(struct acpi_device *device)
{
int result = 0;
@@ -790,90 +874,6 @@ err_remove_fs:
return result;
}
-static void acpi_processor_notify(struct acpi_device *device, u32 event)
-{
- struct acpi_processor *pr = acpi_driver_data(device);
- int saved;
-
- if (!pr)
- return;
-
- switch (event) {
- case ACPI_PROCESSOR_NOTIFY_PERFORMANCE:
- saved = pr->performance_platform_limit;
- acpi_processor_ppc_has_changed(pr);
- if (saved == pr->performance_platform_limit)
- break;
- acpi_bus_generate_proc_event(device, event,
- pr->performance_platform_limit);
- acpi_bus_generate_netlink_event(device->pnp.device_class,
- dev_name(&device->dev), event,
- pr->performance_platform_limit);
- break;
- case ACPI_PROCESSOR_NOTIFY_POWER:
- acpi_processor_cst_has_changed(pr);
- acpi_bus_generate_proc_event(device, event, 0);
- acpi_bus_generate_netlink_event(device->pnp.device_class,
- dev_name(&device->dev), event, 0);
- break;
- case ACPI_PROCESSOR_NOTIFY_THROTTLING:
- acpi_processor_tstate_has_changed(pr);
- acpi_bus_generate_proc_event(device, event, 0);
- acpi_bus_generate_netlink_event(device->pnp.device_class,
- dev_name(&device->dev), event, 0);
- default:
- ACPI_DEBUG_PRINT((ACPI_DB_INFO,
- "Unsupported event [0x%x]\n", event));
- break;
- }
-
- return;
-}
-
-static int acpi_cpu_soft_notify(struct notifier_block *nfb,
- unsigned long action, void *hcpu)
-{
- unsigned int cpu = (unsigned long)hcpu;
- struct acpi_processor *pr = per_cpu(processors, cpu);
-
- if (action == CPU_ONLINE && pr) {
- acpi_processor_ppc_has_changed(pr);
- acpi_processor_cst_has_changed(pr);
- acpi_processor_tstate_has_changed(pr);
- }
- return NOTIFY_OK;
-}
-
-static struct notifier_block acpi_cpu_notifier =
-{
- .notifier_call = acpi_cpu_soft_notify,
-};
-
-static int acpi_processor_add(struct acpi_device *device)
-{
- struct acpi_processor *pr = NULL;
-
-
- if (!device)
- return -EINVAL;
-
- pr = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL);
- if (!pr)
- return -ENOMEM;
-
- if (!zalloc_cpumask_var(&pr->throttling.shared_cpu_map, GFP_KERNEL)) {
- kfree(pr);
- return -ENOMEM;
- }
-
- pr->handle = device->handle;
- strcpy(acpi_device_name(device), ACPI_PROCESSOR_DEVICE_NAME);
- strcpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS);
- device->driver_data = pr;
-
- return 0;
-}
-
static int acpi_processor_remove(struct acpi_device *device, int type)
{
struct acpi_processor *pr = NULL;
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 4/9] ACPI: processor: remove .start() method
2009-06-22 20:40 [PATCH 0/9 v2] ACPI: remove .start() and .stop() methods Bjorn Helgaas
` (2 preceding siblings ...)
2009-06-22 20:41 ` [PATCH 3/9] ACPI: processor: move acpi_processor_start() after acpi_processor_add() Bjorn Helgaas
@ 2009-06-22 20:41 ` Bjorn Helgaas
2009-06-22 20:41 ` [PATCH 5/9] ACPI: memory hotplug: " Bjorn Helgaas
` (6 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Bjorn Helgaas @ 2009-06-22 20:41 UTC (permalink / raw)
To: Len Brown; +Cc: Zhao Yakui, linux-acpi, Alex Chiang, Venkatesh Pallipadi
This patch folds the .start() method into .add().
acpi_processor_start() is always called immediately after
acpi_processor_add(), so there's really no point in having them be
separate methods.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Reviewed-by: Alex Chiang <achiang@hp.com>
CC: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
CC: Zhao Yakui <yakui.zhao@intel.com>
---
drivers/acpi/processor_core.c | 44 +++++++----------------------------------
1 files changed, 7 insertions(+), 37 deletions(-)
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 393695f..af292bf 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -79,7 +79,6 @@ MODULE_DESCRIPTION("ACPI Processor Driver");
MODULE_LICENSE("GPL");
static int acpi_processor_add(struct acpi_device *device);
-static int acpi_processor_start(struct acpi_device *device);
static int acpi_processor_remove(struct acpi_device *device, int type);
static int acpi_processor_info_open_fs(struct inode *inode, struct file *file);
static void acpi_processor_notify(struct acpi_device *device, u32 event);
@@ -101,7 +100,6 @@ static struct acpi_driver acpi_processor_driver = {
.ops = {
.add = acpi_processor_add,
.remove = acpi_processor_remove,
- .start = acpi_processor_start,
.suspend = acpi_processor_suspend,
.resume = acpi_processor_resume,
.notify = acpi_processor_notify,
@@ -751,10 +749,8 @@ static struct notifier_block acpi_cpu_notifier =
static int acpi_processor_add(struct acpi_device *device)
{
struct acpi_processor *pr = NULL;
-
-
- if (!device)
- return -EINVAL;
+ int result = 0;
+ struct sys_device *sysdev;
pr = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL);
if (!pr)
@@ -770,17 +766,6 @@ static int acpi_processor_add(struct acpi_device *device)
strcpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS);
device->driver_data = pr;
- return 0;
-}
-
-static int __cpuinit acpi_processor_start(struct acpi_device *device)
-{
- int result = 0;
- struct acpi_processor *pr;
- struct sys_device *sysdev;
-
- pr = acpi_driver_data(device);
-
result = acpi_processor_get_info(device);
if (result) {
/* Processor is physically not present */
@@ -798,7 +783,8 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
per_cpu(processor_device_array, pr->id) != device) {
printk(KERN_WARNING "BIOS reported wrong ACPI id "
"for the processor\n");
- return -ENODEV;
+ result = -ENODEV;
+ goto err_free_cpumask;
}
per_cpu(processor_device_array, pr->id) = device;
@@ -806,7 +792,7 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
result = acpi_processor_add_fs(device);
if (result)
- return result;
+ goto err_free_cpumask;
sysdev = get_cpu_sysdev(pr->id);
if (sysfs_create_link(&device->dev.kobj, &sysdev->kobj, "sysdev")) {
@@ -870,6 +856,8 @@ err_power_exit:
acpi_processor_power_exit(pr, device);
err_remove_fs:
acpi_processor_remove_fs(device);
+err_free_cpumask:
+ free_cpumask_var(pr->throttling.shared_cpu_map);
return result;
}
@@ -948,7 +936,6 @@ int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device)
{
acpi_handle phandle;
struct acpi_device *pdev;
- struct acpi_processor *pr;
if (acpi_get_parent(handle, &phandle)) {
@@ -963,12 +950,6 @@ int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device)
return -ENODEV;
}
- acpi_bus_start(*device);
-
- pr = acpi_driver_data(*device);
- if (!pr)
- return -ENODEV;
-
return 0;
}
@@ -998,17 +979,6 @@ static void __ref acpi_processor_hotplug_notify(acpi_handle handle,
"Unable to add the device\n");
break;
}
-
- pr = acpi_driver_data(device);
- if (!pr) {
- printk(KERN_ERR PREFIX "Driver data is NULL\n");
- break;
- }
-
- result = acpi_processor_start(device);
- if (result)
- printk(KERN_ERR PREFIX "Device [%s] failed to start\n",
- acpi_device_bid(device));
break;
case ACPI_NOTIFY_EJECT_REQUEST:
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 5/9] ACPI: memory hotplug: remove .start() method
2009-06-22 20:40 [PATCH 0/9 v2] ACPI: remove .start() and .stop() methods Bjorn Helgaas
` (3 preceding siblings ...)
2009-06-22 20:41 ` [PATCH 4/9] ACPI: processor: remove .start() method Bjorn Helgaas
@ 2009-06-22 20:41 ` Bjorn Helgaas
2009-06-22 20:41 ` [PATCH 6/9] ACPI: EC: move acpi_ec_start() after acpi_ec_add() Bjorn Helgaas
` (5 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Bjorn Helgaas @ 2009-06-22 20:41 UTC (permalink / raw)
To: Len Brown; +Cc: linux-acpi, Dave Hansen, Alex Chiang, Yasunori Goto
This patch folds the .start() method into .add().
The .start() method is called in two paths: boot-time device enumeration
and run-time node addition, currently via container_device_add(). In both
cases, .start() is called immediately after .add(), so there's no reason
to make them separate methods.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Reviewed-by: Alex Chiang <achiang@hp.com>
CC: Yasunori Goto <y-goto@jp.fujitsu.com>
CC: Dave Hansen <haveblue@us.ibm.com>
---
drivers/acpi/acpi_memhotplug.c | 40 ++++++++++++++--------------------------
1 files changed, 14 insertions(+), 26 deletions(-)
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index 7a0f4aa..a8d9d8f 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -50,7 +50,6 @@ MODULE_LICENSE("GPL");
static int acpi_memory_device_add(struct acpi_device *device);
static int acpi_memory_device_remove(struct acpi_device *device, int type);
-static int acpi_memory_device_start(struct acpi_device *device);
static const struct acpi_device_id memory_device_ids[] = {
{ACPI_MEMORY_DEVICE_HID, 0},
@@ -65,7 +64,6 @@ static struct acpi_driver acpi_memory_device_driver = {
.ops = {
.add = acpi_memory_device_add,
.remove = acpi_memory_device_remove,
- .start = acpi_memory_device_start,
},
};
@@ -415,28 +413,6 @@ static int acpi_memory_device_add(struct acpi_device *device)
printk(KERN_DEBUG "%s \n", acpi_device_name(device));
- return result;
-}
-
-static int acpi_memory_device_remove(struct acpi_device *device, int type)
-{
- struct acpi_memory_device *mem_device = NULL;
-
-
- if (!device || !acpi_driver_data(device))
- return -EINVAL;
-
- mem_device = acpi_driver_data(device);
- kfree(mem_device);
-
- return 0;
-}
-
-static int acpi_memory_device_start (struct acpi_device *device)
-{
- struct acpi_memory_device *mem_device;
- int result = 0;
-
/*
* Early boot code has recognized memory area by EFI/E820.
* If DSDT shows these memory devices on boot, hotplug is not necessary
@@ -446,8 +422,6 @@ static int acpi_memory_device_start (struct acpi_device *device)
if (!acpi_hotmem_initialized)
return 0;
- mem_device = acpi_driver_data(device);
-
if (!acpi_memory_check_device(mem_device)) {
/* call add_memory func */
result = acpi_memory_enable_device(mem_device);
@@ -458,6 +432,20 @@ static int acpi_memory_device_start (struct acpi_device *device)
return result;
}
+static int acpi_memory_device_remove(struct acpi_device *device, int type)
+{
+ struct acpi_memory_device *mem_device = NULL;
+
+
+ if (!device || !acpi_driver_data(device))
+ return -EINVAL;
+
+ mem_device = acpi_driver_data(device);
+ kfree(mem_device);
+
+ return 0;
+}
+
/*
* Helper function to check for memory device
*/
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 6/9] ACPI: EC: move acpi_ec_start() after acpi_ec_add()
2009-06-22 20:40 [PATCH 0/9 v2] ACPI: remove .start() and .stop() methods Bjorn Helgaas
` (4 preceding siblings ...)
2009-06-22 20:41 ` [PATCH 5/9] ACPI: memory hotplug: " Bjorn Helgaas
@ 2009-06-22 20:41 ` Bjorn Helgaas
2009-06-22 20:41 ` [PATCH 7/9] ACPI: EC: remove .start() method Bjorn Helgaas
` (4 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Bjorn Helgaas @ 2009-06-22 20:41 UTC (permalink / raw)
To: Len Brown; +Cc: linux-acpi, Alexey Starikovskiy
This patch rearranges ec_install_handlers() and acpi_ec_start() so
acpi_ec_start() ends up just after acpi_ec_add(). A subsequent patch
will merge them.
Code movement only; no functional change.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
CC: Alexey Starikovskiy <astarikovskiy@suse.de>
---
drivers/acpi/ec.c | 112 +++++++++++++++++++++++++++--------------------------
1 files changed, 56 insertions(+), 56 deletions(-)
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 391f331..8b387a4 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -788,6 +788,42 @@ ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval)
return AE_CTRL_TERMINATE;
}
+static int ec_install_handlers(struct acpi_ec *ec)
+{
+ acpi_status status;
+ if (test_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags))
+ return 0;
+ status = acpi_install_gpe_handler(NULL, ec->gpe,
+ ACPI_GPE_EDGE_TRIGGERED,
+ &acpi_ec_gpe_handler, ec);
+ if (ACPI_FAILURE(status))
+ return -ENODEV;
+ acpi_set_gpe_type(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME);
+ acpi_enable_gpe(NULL, ec->gpe);
+ status = acpi_install_address_space_handler(ec->handle,
+ ACPI_ADR_SPACE_EC,
+ &acpi_ec_space_handler,
+ NULL, ec);
+ if (ACPI_FAILURE(status)) {
+ if (status == AE_NOT_FOUND) {
+ /*
+ * Maybe OS fails in evaluating the _REG object.
+ * The AE_NOT_FOUND error will be ignored and OS
+ * continue to initialize EC.
+ */
+ printk(KERN_ERR "Fail in evaluating the _REG object"
+ " of EC device. Broken bios is suspected.\n");
+ } else {
+ acpi_remove_gpe_handler(NULL, ec->gpe,
+ &acpi_ec_gpe_handler);
+ return -ENODEV;
+ }
+ }
+
+ set_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags);
+ return 0;
+}
+
static void ec_remove_handlers(struct acpi_ec *ec)
{
if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle,
@@ -842,6 +878,26 @@ static int acpi_ec_add(struct acpi_device *device)
return 0;
}
+static int acpi_ec_start(struct acpi_device *device)
+{
+ struct acpi_ec *ec;
+ int ret = 0;
+
+ if (!device)
+ return -EINVAL;
+
+ ec = acpi_driver_data(device);
+
+ if (!ec)
+ return -EINVAL;
+
+ ret = ec_install_handlers(ec);
+
+ /* EC is fully operational, allow queries */
+ clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
+ return ret;
+}
+
static int acpi_ec_remove(struct acpi_device *device, int type)
{
struct acpi_ec *ec;
@@ -888,62 +944,6 @@ ec_parse_io_ports(struct acpi_resource *resource, void *context)
return AE_OK;
}
-static int ec_install_handlers(struct acpi_ec *ec)
-{
- acpi_status status;
- if (test_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags))
- return 0;
- status = acpi_install_gpe_handler(NULL, ec->gpe,
- ACPI_GPE_EDGE_TRIGGERED,
- &acpi_ec_gpe_handler, ec);
- if (ACPI_FAILURE(status))
- return -ENODEV;
- acpi_set_gpe_type(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME);
- acpi_enable_gpe(NULL, ec->gpe);
- status = acpi_install_address_space_handler(ec->handle,
- ACPI_ADR_SPACE_EC,
- &acpi_ec_space_handler,
- NULL, ec);
- if (ACPI_FAILURE(status)) {
- if (status == AE_NOT_FOUND) {
- /*
- * Maybe OS fails in evaluating the _REG object.
- * The AE_NOT_FOUND error will be ignored and OS
- * continue to initialize EC.
- */
- printk(KERN_ERR "Fail in evaluating the _REG object"
- " of EC device. Broken bios is suspected.\n");
- } else {
- acpi_remove_gpe_handler(NULL, ec->gpe,
- &acpi_ec_gpe_handler);
- return -ENODEV;
- }
- }
-
- set_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags);
- return 0;
-}
-
-static int acpi_ec_start(struct acpi_device *device)
-{
- struct acpi_ec *ec;
- int ret = 0;
-
- if (!device)
- return -EINVAL;
-
- ec = acpi_driver_data(device);
-
- if (!ec)
- return -EINVAL;
-
- ret = ec_install_handlers(ec);
-
- /* EC is fully operational, allow queries */
- clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
- return ret;
-}
-
static int acpi_ec_stop(struct acpi_device *device, int type)
{
struct acpi_ec *ec;
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 7/9] ACPI: EC: remove .start() method
2009-06-22 20:40 [PATCH 0/9 v2] ACPI: remove .start() and .stop() methods Bjorn Helgaas
` (5 preceding siblings ...)
2009-06-22 20:41 ` [PATCH 6/9] ACPI: EC: move acpi_ec_start() after acpi_ec_add() Bjorn Helgaas
@ 2009-06-22 20:41 ` Bjorn Helgaas
2009-06-22 20:41 ` [PATCH 8/9] ACPI: EC: remove .stop() method Bjorn Helgaas
` (3 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Bjorn Helgaas @ 2009-06-22 20:41 UTC (permalink / raw)
To: Len Brown; +Cc: linux-acpi, Alexey Starikovskiy, Alex Chiang
This patch folds the .start() method into .add().
acpi_ec_start() is always called immediately after acpi_ec_add(),
so there's no need to have it be a separate method.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Reviewed-by: Alex Chiang <achiang@hp.com>
CC: Alexey Starikovskiy <astarikovskiy@suse.de>
---
drivers/acpi/ec.c | 19 +------------------
1 files changed, 1 insertions(+), 18 deletions(-)
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 8b387a4..1feedce 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -838,9 +838,8 @@ static void ec_remove_handlers(struct acpi_ec *ec)
static int acpi_ec_add(struct acpi_device *device)
{
struct acpi_ec *ec = NULL;
+ int ret;
- if (!device)
- return -EINVAL;
strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_EC_CLASS);
@@ -875,21 +874,6 @@ static int acpi_ec_add(struct acpi_device *device)
ec->gpe, ec->command_addr, ec->data_addr);
pr_info(PREFIX "driver started in %s mode\n",
(test_bit(EC_FLAGS_GPE_MODE, &ec->flags))?"interrupt":"poll");
- return 0;
-}
-
-static int acpi_ec_start(struct acpi_device *device)
-{
- struct acpi_ec *ec;
- int ret = 0;
-
- if (!device)
- return -EINVAL;
-
- ec = acpi_driver_data(device);
-
- if (!ec)
- return -EINVAL;
ret = ec_install_handlers(ec);
@@ -1077,7 +1061,6 @@ static struct acpi_driver acpi_ec_driver = {
.ops = {
.add = acpi_ec_add,
.remove = acpi_ec_remove,
- .start = acpi_ec_start,
.stop = acpi_ec_stop,
.suspend = acpi_ec_suspend,
.resume = acpi_ec_resume,
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 8/9] ACPI: EC: remove .stop() method
2009-06-22 20:40 [PATCH 0/9 v2] ACPI: remove .start() and .stop() methods Bjorn Helgaas
` (6 preceding siblings ...)
2009-06-22 20:41 ` [PATCH 7/9] ACPI: EC: remove .start() method Bjorn Helgaas
@ 2009-06-22 20:41 ` Bjorn Helgaas
2009-06-22 20:41 ` [PATCH 9/9] ACPI: remove unused acpi_device_ops .stop method Bjorn Helgaas
` (2 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Bjorn Helgaas @ 2009-06-22 20:41 UTC (permalink / raw)
To: Len Brown; +Cc: linux-acpi, Alexey Starikovskiy, Alex Chiang
This patch folds the .stop() method into .remove().
acpi_ec_stop() is only called via acpi_device_probe() and
acpi_device_remove(), and in both cases it is called immediately before
acpi_ec_remove(), so there's no need to have it be a separate method.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Reviewed-by: Alex Chiang <achiang@hp.com>
CC: Alexey Starikovskiy <astarikovskiy@suse.de>
---
drivers/acpi/ec.c | 15 +--------------
1 files changed, 1 insertions(+), 14 deletions(-)
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 1feedce..d6bf057 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -891,6 +891,7 @@ static int acpi_ec_remove(struct acpi_device *device, int type)
return -EINVAL;
ec = acpi_driver_data(device);
+ ec_remove_handlers(ec);
mutex_lock(&ec->lock);
list_for_each_entry_safe(handler, tmp, &ec->list, node) {
list_del(&handler->node);
@@ -928,19 +929,6 @@ ec_parse_io_ports(struct acpi_resource *resource, void *context)
return AE_OK;
}
-static int acpi_ec_stop(struct acpi_device *device, int type)
-{
- struct acpi_ec *ec;
- if (!device)
- return -EINVAL;
- ec = acpi_driver_data(device);
- if (!ec)
- return -EINVAL;
- ec_remove_handlers(ec);
-
- return 0;
-}
-
int __init acpi_boot_ec_enable(void)
{
if (!boot_ec || test_bit(EC_FLAGS_HANDLERS_INSTALLED, &boot_ec->flags))
@@ -1061,7 +1049,6 @@ static struct acpi_driver acpi_ec_driver = {
.ops = {
.add = acpi_ec_add,
.remove = acpi_ec_remove,
- .stop = acpi_ec_stop,
.suspend = acpi_ec_suspend,
.resume = acpi_ec_resume,
},
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 9/9] ACPI: remove unused acpi_device_ops .stop method
2009-06-22 20:40 [PATCH 0/9 v2] ACPI: remove .start() and .stop() methods Bjorn Helgaas
` (7 preceding siblings ...)
2009-06-22 20:41 ` [PATCH 8/9] ACPI: EC: remove .stop() method Bjorn Helgaas
@ 2009-06-22 20:41 ` Bjorn Helgaas
2009-06-24 1:23 ` [PATCH 0/9 v2] ACPI: remove .start() and .stop() methods Len Brown
2009-06-25 2:09 ` Yasunori Goto
10 siblings, 0 replies; 14+ messages in thread
From: Bjorn Helgaas @ 2009-06-22 20:41 UTC (permalink / raw)
To: Len Brown; +Cc: linux-acpi, Alex Chiang
No drivers use the .stop method, so remove it.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Reviewed-by: Alex Chiang <achiang@hp.com>
---
drivers/acpi/scan.c | 5 -----
include/acpi/acpi_bus.h | 2 --
2 files changed, 0 insertions(+), 7 deletions(-)
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index c40515e..538bdbb 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -430,9 +430,6 @@ static int acpi_device_probe(struct device * dev)
if (acpi_drv->ops.notify) {
ret = acpi_device_install_notify_handler(acpi_dev);
if (ret) {
- if (acpi_drv->ops.stop)
- acpi_drv->ops.stop(acpi_dev,
- acpi_dev->removal_type);
if (acpi_drv->ops.remove)
acpi_drv->ops.remove(acpi_dev,
acpi_dev->removal_type);
@@ -456,8 +453,6 @@ static int acpi_device_remove(struct device * dev)
if (acpi_drv) {
if (acpi_drv->ops.notify)
acpi_device_remove_notify_handler(acpi_dev);
- if (acpi_drv->ops.stop)
- acpi_drv->ops.stop(acpi_dev, acpi_dev->removal_type);
if (acpi_drv->ops.remove)
acpi_drv->ops.remove(acpi_dev, acpi_dev->removal_type);
}
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index c65e4ce..79a6c5e 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -89,7 +89,6 @@ struct acpi_device;
typedef int (*acpi_op_add) (struct acpi_device * device);
typedef int (*acpi_op_remove) (struct acpi_device * device, int type);
typedef int (*acpi_op_start) (struct acpi_device * device);
-typedef int (*acpi_op_stop) (struct acpi_device * device, int type);
typedef int (*acpi_op_suspend) (struct acpi_device * device,
pm_message_t state);
typedef int (*acpi_op_resume) (struct acpi_device * device);
@@ -106,7 +105,6 @@ struct acpi_device_ops {
acpi_op_add add;
acpi_op_remove remove;
acpi_op_start start;
- acpi_op_stop stop;
acpi_op_suspend suspend;
acpi_op_resume resume;
acpi_op_bind bind;
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH 0/9 v2] ACPI: remove .start() and .stop() methods
2009-06-22 20:40 [PATCH 0/9 v2] ACPI: remove .start() and .stop() methods Bjorn Helgaas
` (8 preceding siblings ...)
2009-06-22 20:41 ` [PATCH 9/9] ACPI: remove unused acpi_device_ops .stop method Bjorn Helgaas
@ 2009-06-24 1:23 ` Len Brown
2009-06-25 2:09 ` Yasunori Goto
10 siblings, 0 replies; 14+ messages in thread
From: Len Brown @ 2009-06-24 1:23 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: linux-acpi
On Mon, 22 Jun 2009, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bjorn.helgaas@hp.com>
>
> These patches remove several .start() methods (by folding them into
> .add() methods) and a .stop() method (by folding it into .remove()).
> There are no remaining .stop() methods, so I also removed it from
> the driver_ops structure.
>
> This simplifies the ACPI driver structure and will make it easier to
> support hotplug in the Linux/ACPI core.
>
> They also remove the KOBJ_ONLINE and KOBJ_OFFLINE events generated
> by the processor driver for CPU hotplug events. As far as I know,
> these events are unused.
>
> I don't have a way to test most of these changes, unfortunately, so
> I'd welcome any feedback or testing reports.
>
> These apply to the acpi-test branch.
>
> ---
>
> Bjorn Helgaas (9):
> ACPI: processor: remove KOBJ_ONLINE/KOBJ_OFFLINE events
> ACPI: processor: clean up in acpi_processor_start() error exits
> ACPI: processor: move acpi_processor_start() after acpi_processor_add()
> ACPI: processor: remove .start() method
> ACPI: memory hotplug: remove .start() method
> ACPI: EC: move acpi_ec_start() after acpi_ec_add()
> ACPI: EC: remove .start() method
> ACPI: EC: remove .stop() method
> ACPI: remove unused acpi_device_ops .stop method
>
>
> drivers/acpi/acpi_memhotplug.c | 40 +++----
> drivers/acpi/ec.c | 118 ++++++++--------------
> drivers/acpi/processor_core.c | 219 +++++++++++++++++-----------------------
> drivers/acpi/scan.c | 5 -
> include/acpi/acpi_bus.h | 2
> 5 files changed, 153 insertions(+), 231 deletions(-)
WARNING: line over 80 characters
#229: FILE: drivers/acpi/processor_core.c:710:
+
pr->performance_platform_limit);
WARNING: line over 80 characters
#235: FILE: drivers/acpi/processor_core.c:716:
+ dev_name(&device->dev),
event, 0);
WARNING: line over 80 characters
#241: FILE: drivers/acpi/processor_core.c:722:
+ dev_name(&device->dev),
event, 0);
ERROR: that open brace { should be on the previous line
#266: FILE: drivers/acpi/processor_core.c:747:
+static struct notifier_block acpi_cpu_notifier =
applied to acpi-test
thanks,
Len Brown, Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH 0/9 v2] ACPI: remove .start() and .stop() methods
2009-06-22 20:40 [PATCH 0/9 v2] ACPI: remove .start() and .stop() methods Bjorn Helgaas
` (9 preceding siblings ...)
2009-06-24 1:23 ` [PATCH 0/9 v2] ACPI: remove .start() and .stop() methods Len Brown
@ 2009-06-25 2:09 ` Yasunori Goto
2009-06-29 20:32 ` Bjorn Helgaas
10 siblings, 1 reply; 14+ messages in thread
From: Yasunori Goto @ 2009-06-25 2:09 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: Len Brown, linux-acpi
> From: Bjorn Helgaas <bjorn.helgaas@hp.com>
>
> These patches remove several .start() methods (by folding them into
> .add() methods) and a .stop() method (by folding it into .remove()).
> There are no remaining .stop() methods, so I also removed it from
> the driver_ops structure.
>
> This simplifies the ACPI driver structure and will make it easier to
> support hotplug in the Linux/ACPI core.
>
> They also remove the KOBJ_ONLINE and KOBJ_OFFLINE events generated
> by the processor driver for CPU hotplug events. As far as I know,
> these events are unused.
>
> I don't have a way to test most of these changes, unfortunately, so
> I'd welcome any feedback or testing reports.
Hi.
I could make a time to test this patch set.
It works well on my box. :-)
Tested-by: Yasunori Goto <y-goto@jp.fujitsu.com>
Bye.
>
> These apply to the acpi-test branch.
>
> ---
>
> Bjorn Helgaas (9):
> ACPI: processor: remove KOBJ_ONLINE/KOBJ_OFFLINE events
> ACPI: processor: clean up in acpi_processor_start() error exits
> ACPI: processor: move acpi_processor_start() after acpi_processor_add()
> ACPI: processor: remove .start() method
> ACPI: memory hotplug: remove .start() method
> ACPI: EC: move acpi_ec_start() after acpi_ec_add()
> ACPI: EC: remove .start() method
> ACPI: EC: remove .stop() method
> ACPI: remove unused acpi_device_ops .stop method
>
>
> drivers/acpi/acpi_memhotplug.c | 40 +++----
> drivers/acpi/ec.c | 118 ++++++++--------------
> drivers/acpi/processor_core.c | 219 +++++++++++++++++-----------------------
> drivers/acpi/scan.c | 5 -
> include/acpi/acpi_bus.h | 2
> 5 files changed, 153 insertions(+), 231 deletions(-)
>
> --
> Bjorn
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Yasunori Goto
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH 0/9 v2] ACPI: remove .start() and .stop() methods
2009-06-25 2:09 ` Yasunori Goto
@ 2009-06-29 20:32 ` Bjorn Helgaas
0 siblings, 0 replies; 14+ messages in thread
From: Bjorn Helgaas @ 2009-06-29 20:32 UTC (permalink / raw)
To: Yasunori Goto; +Cc: Len Brown, linux-acpi
On Wednesday 24 June 2009 8:09:07 pm Yasunori Goto wrote:
> > From: Bjorn Helgaas <bjorn.helgaas@hp.com>
> >
> > These patches remove several .start() methods (by folding them into
> > .add() methods) and a .stop() method (by folding it into .remove()).
> > There are no remaining .stop() methods, so I also removed it from
> > the driver_ops structure.
> >
> > This simplifies the ACPI driver structure and will make it easier to
> > support hotplug in the Linux/ACPI core.
> >
> > They also remove the KOBJ_ONLINE and KOBJ_OFFLINE events generated
> > by the processor driver for CPU hotplug events. As far as I know,
> > these events are unused.
> >
> > I don't have a way to test most of these changes, unfortunately, so
> > I'd welcome any feedback or testing reports.
>
> Hi.
>
> I could make a time to test this patch set.
> It works well on my box. :-)
>
> Tested-by: Yasunori Goto <y-goto@jp.fujitsu.com>
Thanks a lot for testing these. I appreciate it!
Bjorn
^ permalink raw reply [flat|nested] 14+ messages in thread