2012-10-04 01:44:49

by Yasuaki Ishimatsu

[permalink] [raw]
Subject: [PATCH 0/2] acpi,memory-hotplug : remove memory device by acpi_bus_remove()

The patch-set was divided from following thread's patch-set.

https://lkml.org/lkml/2012/9/5/201

If you want to know the reason, please read following thread.

https://lkml.org/lkml/2012/10/2/83

The patch exports "acpi_bus_remove()" for removing a acpi device from a
acpi bus at memory hot plug.


2012-10-04 01:47:17

by Yasuaki Ishimatsu

[permalink] [raw]
Subject: [PATCH 1/2] acpi,memory-hotplug : export the function acpi_bus_remove()

From: Wen Congyang <[email protected]>

The function acpi_bus_remove() can remove a acpi device from acpi bus.
When a acpi device is removed, we need to call this function to remove
the acpi device from acpi bus. So export this function.

CC: Len Brown <[email protected]>
Reviewed-by: Yasuaki Ishimatsu <[email protected]>
Signed-off-by: Wen Congyang <[email protected]>
---
drivers/acpi/scan.c | 3 ++-
include/acpi/acpi_bus.h | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)

Index: linux-3.6/drivers/acpi/scan.c
===================================================================
--- linux-3.6.orig/drivers/acpi/scan.c 2012-10-03 18:16:57.206246798 +0900
+++ linux-3.6/drivers/acpi/scan.c 2012-10-03 18:17:49.974249714 +0900
@@ -1224,7 +1224,7 @@ static int acpi_device_set_context(struc
return -ENODEV;
}

-static int acpi_bus_remove(struct acpi_device *dev, int rmdevice)
+int acpi_bus_remove(struct acpi_device *dev, int rmdevice)
{
if (!dev)
return -EINVAL;
@@ -1246,6 +1246,7 @@ static int acpi_bus_remove(struct acpi_d

return 0;
}
+EXPORT_SYMBOL(acpi_bus_remove);

static int acpi_add_single_object(struct acpi_device **child,
acpi_handle handle, int type,
Index: linux-3.6/include/acpi/acpi_bus.h
===================================================================
--- linux-3.6.orig/include/acpi/acpi_bus.h 2012-10-03 18:16:57.208246800 +0900
+++ linux-3.6/include/acpi/acpi_bus.h 2012-10-03 18:17:49.976249717 +0900
@@ -360,6 +360,7 @@ bool acpi_bus_power_manageable(acpi_hand
bool acpi_bus_can_wakeup(acpi_handle handle);
int acpi_power_resource_register_device(struct device *dev, acpi_handle handle);
void acpi_power_resource_unregister_device(struct device *dev, acpi_handle handle);
+int acpi_bus_remove(struct acpi_device *dev, int rmdevice);
#ifdef CONFIG_ACPI_PROC_EVENT
int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data);
int acpi_bus_generate_proc_event4(const char *class, const char *bid, u8 type, int data);

2012-10-04 01:48:30

by Yasuaki Ishimatsu

[permalink] [raw]
Subject: [PATCH 2/2] acpi,memory-hotplug : call acpi_bus_remo() to remove memory device

From: Wen Congyang <[email protected]>

The memory device has been ejected and powoffed, so we can call
acpi_bus_remove() to remove the memory device from acpi bus.

CC: Len Brown <[email protected]>
Reviewed-by: Yasuaki Ishimatsu <[email protected]>
Signed-off-by: Wen Congyang <[email protected]>
---
drivers/acpi/acpi_memhotplug.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux-3.6/drivers/acpi/acpi_memhotplug.c
===================================================================
--- linux-3.6.orig/drivers/acpi/acpi_memhotplug.c 2012-10-03 18:17:47.802249170 +0900
+++ linux-3.6/drivers/acpi/acpi_memhotplug.c 2012-10-03 18:17:52.471250299 +0900
@@ -424,8 +424,9 @@ static void acpi_memory_device_notify(ac
}

/*
- * TBD: Invoke acpi_bus_remove to cleanup data structures
+ * Invoke acpi_bus_remove() to remove memory device
*/
+ acpi_bus_remove(device, 1);

/* _EJ0 succeeded; _OST is not necessary */
return;

2012-10-04 02:41:20

by Yinghai Lu

[permalink] [raw]
Subject: Re: [PATCH 2/2] acpi,memory-hotplug : call acpi_bus_remo() to remove memory device

On Wed, Oct 3, 2012 at 6:48 PM, Yasuaki Ishimatsu
<[email protected]> wrote:
> From: Wen Congyang <[email protected]>
>
> The memory device has been ejected and powoffed, so we can call
> acpi_bus_remove() to remove the memory device from acpi bus.
>
> CC: Len Brown <[email protected]>
> Reviewed-by: Yasuaki Ishimatsu <[email protected]>
> Signed-off-by: Wen Congyang <[email protected]>
> ---
> drivers/acpi/acpi_memhotplug.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> Index: linux-3.6/drivers/acpi/acpi_memhotplug.c
> ===================================================================
> --- linux-3.6.orig/drivers/acpi/acpi_memhotplug.c 2012-10-03 18:17:47.802249170 +0900
> +++ linux-3.6/drivers/acpi/acpi_memhotplug.c 2012-10-03 18:17:52.471250299 +0900
> @@ -424,8 +424,9 @@ static void acpi_memory_device_notify(ac
> }
>
> /*
> - * TBD: Invoke acpi_bus_remove to cleanup data structures
> + * Invoke acpi_bus_remove() to remove memory device
> */
> + acpi_bus_remove(device, 1);

why not using acpi_bus_trim instead?

Yinghai

2012-10-19 01:44:32

by Wen Congyang

[permalink] [raw]
Subject: Re: [PATCH 2/2] acpi,memory-hotplug : call acpi_bus_remo() to remove memory device

At 10/04/2012 10:41 AM, Yinghai Lu Wrote:
> On Wed, Oct 3, 2012 at 6:48 PM, Yasuaki Ishimatsu
> <[email protected]> wrote:
>> From: Wen Congyang <[email protected]>
>>
>> The memory device has been ejected and powoffed, so we can call
>> acpi_bus_remove() to remove the memory device from acpi bus.
>>
>> CC: Len Brown <[email protected]>
>> Reviewed-by: Yasuaki Ishimatsu <[email protected]>
>> Signed-off-by: Wen Congyang <[email protected]>
>> ---
>> drivers/acpi/acpi_memhotplug.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> Index: linux-3.6/drivers/acpi/acpi_memhotplug.c
>> ===================================================================
>> --- linux-3.6.orig/drivers/acpi/acpi_memhotplug.c 2012-10-03 18:17:47.802249170 +0900
>> +++ linux-3.6/drivers/acpi/acpi_memhotplug.c 2012-10-03 18:17:52.471250299 +0900
>> @@ -424,8 +424,9 @@ static void acpi_memory_device_notify(ac
>> }
>>
>> /*
>> - * TBD: Invoke acpi_bus_remove to cleanup data structures
>> + * Invoke acpi_bus_remove() to remove memory device
>> */
>> + acpi_bus_remove(device, 1);
>
> why not using acpi_bus_trim instead?

Sorry for late reply. It's OK to use acpi_bus_trim(), and I will
update this patch soon.

Thanks
Wen Congyang

>
> Yinghai
>