public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/9] ACPI: remove .start() and .stop() methods
@ 2009-06-19 21:31 Bjorn Helgaas
  2009-06-19 21:31 ` [PATCH 1/9] ACPI: memory hotplug: remove .start() method Bjorn Helgaas
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Bjorn Helgaas @ 2009-06-19 21:31 UTC (permalink / raw)
  To: Len Brown; +Cc: linux-acpi

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.

I don't have a way to test most of these changes, unfortunately, so
I'd welcome any feedback or testing reports.

---

Bjorn Helgaas (9):
      ACPI: memory hotplug: remove .start() method
      ACPI: processor: clean up in acpi_processor_start() error exits
      ACPI: processor: emit "online" event in acpi_processor_start()
      ACPI: processor: move acpi_processor_start() after acpi_processor_add()
      ACPI: processor: 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  |  213 ++++++++++++++++++----------------------
 drivers/acpi/scan.c            |    5 -
 include/acpi/acpi_bus.h        |    2 
 5 files changed, 152 insertions(+), 226 deletions(-)

-- 
Bjorn

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

* [PATCH 1/9] ACPI: memory hotplug: remove .start() method
  2009-06-19 21:31 [PATCH 0/9] ACPI: remove .start() and .stop() methods Bjorn Helgaas
@ 2009-06-19 21:31 ` Bjorn Helgaas
  2009-06-19 21:31 ` [PATCH 2/9] ACPI: processor: clean up in acpi_processor_start() error exits Bjorn Helgaas
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Bjorn Helgaas @ 2009-06-19 21:31 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] 10+ messages in thread

* [PATCH 2/9] ACPI: processor: clean up in acpi_processor_start() error exits
  2009-06-19 21:31 [PATCH 0/9] ACPI: remove .start() and .stop() methods Bjorn Helgaas
  2009-06-19 21:31 ` [PATCH 1/9] ACPI: memory hotplug: remove .start() method Bjorn Helgaas
@ 2009-06-19 21:31 ` Bjorn Helgaas
  2009-06-19 21:31 ` [PATCH 3/9] ACPI: processor: emit "online" event in acpi_processor_start() Bjorn Helgaas
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Bjorn Helgaas @ 2009-06-19 21:31 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 (we still leak some
space allocated in arch_acpi_processor_init_pdc(), but there's no cleanup
path for that yet).

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 0c0996a..bc27728 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);
@@ -744,7 +746,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",
@@ -753,13 +755,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",
@@ -768,7 +774,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] 10+ messages in thread

* [PATCH 3/9] ACPI: processor: emit "online" event in acpi_processor_start()
  2009-06-19 21:31 [PATCH 0/9] ACPI: remove .start() and .stop() methods Bjorn Helgaas
  2009-06-19 21:31 ` [PATCH 1/9] ACPI: memory hotplug: remove .start() method Bjorn Helgaas
  2009-06-19 21:31 ` [PATCH 2/9] ACPI: processor: clean up in acpi_processor_start() error exits Bjorn Helgaas
@ 2009-06-19 21:31 ` Bjorn Helgaas
  2009-06-19 21:31 ` [PATCH 4/9] ACPI: processor: move acpi_processor_start() after acpi_processor_add() Bjorn Helgaas
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Bjorn Helgaas @ 2009-06-19 21:31 UTC (permalink / raw)
  To: Len Brown; +Cc: Zhao Yakui, linux-acpi, Venkatesh Pallipadi

This patch moves the KOBJ_ONLINE uevent into acpi_processor_start().

We used to generate KOBJ_ONLINE, KOBJ_OFFLINE, KOBJ_ONLINE when hot-adding
a processor.  Now we'll only generate KOBJ_ONLINE.  In addition, we'll
generate KOBJ_ONLINE for all processors discovered when the processor
module initializes.

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 |   14 ++------------
 1 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index bc27728..11ff257 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -774,6 +774,7 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
 		printk(")\n");
 	}
 
+	kobject_uevent(&device->dev.kobj, KOBJ_ONLINE);
 	return 0;
 
 err_remove_sysfs:
@@ -967,9 +968,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;
 }
 
@@ -1006,18 +1004,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,


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

* [PATCH 4/9] ACPI: processor: move acpi_processor_start() after acpi_processor_add()
  2009-06-19 21:31 [PATCH 0/9] ACPI: remove .start() and .stop() methods Bjorn Helgaas
                   ` (2 preceding siblings ...)
  2009-06-19 21:31 ` [PATCH 3/9] ACPI: processor: emit "online" event in acpi_processor_start() Bjorn Helgaas
@ 2009-06-19 21:31 ` Bjorn Helgaas
  2009-06-19 21:31 ` [PATCH 5/9] ACPI: processor: remove .start() method Bjorn Helgaas
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Bjorn Helgaas @ 2009-06-19 21:31 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 11ff257..5335ab6 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;
@@ -789,90 +873,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] 10+ messages in thread

* [PATCH 5/9] ACPI: processor: remove .start() method
  2009-06-19 21:31 [PATCH 0/9] ACPI: remove .start() and .stop() methods Bjorn Helgaas
                   ` (3 preceding siblings ...)
  2009-06-19 21:31 ` [PATCH 4/9] ACPI: processor: move acpi_processor_start() after acpi_processor_add() Bjorn Helgaas
@ 2009-06-19 21:31 ` Bjorn Helgaas
  2009-06-19 21:32 ` [PATCH 6/9] ACPI: EC: move acpi_ec_start() after acpi_ec_add() Bjorn Helgaas
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Bjorn Helgaas @ 2009-06-19 21:31 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 5335ab6..3348c04 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")) {
@@ -869,6 +855,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;
 }
@@ -947,7 +935,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)) {
@@ -962,12 +949,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;
 }
 
@@ -997,17 +978,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] 10+ messages in thread

* [PATCH 6/9] ACPI: EC: move acpi_ec_start() after acpi_ec_add()
  2009-06-19 21:31 [PATCH 0/9] ACPI: remove .start() and .stop() methods Bjorn Helgaas
                   ` (4 preceding siblings ...)
  2009-06-19 21:31 ` [PATCH 5/9] ACPI: processor: remove .start() method Bjorn Helgaas
@ 2009-06-19 21:32 ` Bjorn Helgaas
  2009-06-19 21:32 ` [PATCH 7/9] ACPI: EC: remove .start() method Bjorn Helgaas
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Bjorn Helgaas @ 2009-06-19 21:32 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] 10+ messages in thread

* [PATCH 7/9] ACPI: EC: remove .start() method
  2009-06-19 21:31 [PATCH 0/9] ACPI: remove .start() and .stop() methods Bjorn Helgaas
                   ` (5 preceding siblings ...)
  2009-06-19 21:32 ` [PATCH 6/9] ACPI: EC: move acpi_ec_start() after acpi_ec_add() Bjorn Helgaas
@ 2009-06-19 21:32 ` Bjorn Helgaas
  2009-06-19 21:32 ` [PATCH 8/9] ACPI: EC: remove .stop() method Bjorn Helgaas
  2009-06-19 21:32 ` [PATCH 9/9] ACPI: remove unused acpi_device_ops .stop method Bjorn Helgaas
  8 siblings, 0 replies; 10+ messages in thread
From: Bjorn Helgaas @ 2009-06-19 21:32 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] 10+ messages in thread

* [PATCH 8/9] ACPI: EC: remove .stop() method
  2009-06-19 21:31 [PATCH 0/9] ACPI: remove .start() and .stop() methods Bjorn Helgaas
                   ` (6 preceding siblings ...)
  2009-06-19 21:32 ` [PATCH 7/9] ACPI: EC: remove .start() method Bjorn Helgaas
@ 2009-06-19 21:32 ` Bjorn Helgaas
  2009-06-19 21:32 ` [PATCH 9/9] ACPI: remove unused acpi_device_ops .stop method Bjorn Helgaas
  8 siblings, 0 replies; 10+ messages in thread
From: Bjorn Helgaas @ 2009-06-19 21:32 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] 10+ messages in thread

* [PATCH 9/9] ACPI: remove unused acpi_device_ops .stop method
  2009-06-19 21:31 [PATCH 0/9] ACPI: remove .start() and .stop() methods Bjorn Helgaas
                   ` (7 preceding siblings ...)
  2009-06-19 21:32 ` [PATCH 8/9] ACPI: EC: remove .stop() method Bjorn Helgaas
@ 2009-06-19 21:32 ` Bjorn Helgaas
  8 siblings, 0 replies; 10+ messages in thread
From: Bjorn Helgaas @ 2009-06-19 21:32 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 8ff510b..cce640b 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 84df486..339b2a9 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] 10+ messages in thread

end of thread, other threads:[~2009-06-19 21:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-19 21:31 [PATCH 0/9] ACPI: remove .start() and .stop() methods Bjorn Helgaas
2009-06-19 21:31 ` [PATCH 1/9] ACPI: memory hotplug: remove .start() method Bjorn Helgaas
2009-06-19 21:31 ` [PATCH 2/9] ACPI: processor: clean up in acpi_processor_start() error exits Bjorn Helgaas
2009-06-19 21:31 ` [PATCH 3/9] ACPI: processor: emit "online" event in acpi_processor_start() Bjorn Helgaas
2009-06-19 21:31 ` [PATCH 4/9] ACPI: processor: move acpi_processor_start() after acpi_processor_add() Bjorn Helgaas
2009-06-19 21:31 ` [PATCH 5/9] ACPI: processor: remove .start() method Bjorn Helgaas
2009-06-19 21:32 ` [PATCH 6/9] ACPI: EC: move acpi_ec_start() after acpi_ec_add() Bjorn Helgaas
2009-06-19 21:32 ` [PATCH 7/9] ACPI: EC: remove .start() method Bjorn Helgaas
2009-06-19 21:32 ` [PATCH 8/9] ACPI: EC: remove .stop() method Bjorn Helgaas
2009-06-19 21:32 ` [PATCH 9/9] ACPI: remove unused acpi_device_ops .stop method Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox