* [PATCH v3] create sun sysfs file
@ 2012-07-30 0:58 Yasuaki Ishimatsu
2012-07-30 15:18 ` Toshi Kani
2012-07-30 15:33 ` Jiang Liu
0 siblings, 2 replies; 5+ messages in thread
From: Yasuaki Ishimatsu @ 2012-07-30 0:58 UTC (permalink / raw)
To: lenb, toshi.kani, linux-acpi; +Cc: linux-kernel
Even if a device has _SUN method, there is no way to know the slot unique-ID.
Thus the patch creates "sun" file in sysfs so that we can recognize it.
Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
---
drivers/acpi/scan.c | 25 +++++++++++++++++++++++++
include/acpi/acpi_bus.h | 1 +
2 files changed, 26 insertions(+)
Index: linux-3.5/include/acpi/acpi_bus.h
===================================================================
--- linux-3.5.orig/include/acpi/acpi_bus.h 2012-07-27 10:20:22.722553439 +0900
+++ linux-3.5/include/acpi/acpi_bus.h 2012-07-27 10:20:25.741555954 +0900
@@ -209,6 +209,7 @@ struct acpi_device_pnp {
struct list_head ids; /* _HID and _CIDs */
acpi_device_name device_name; /* Driver-determined */
acpi_device_class device_class; /* " */
+ unsigned long sun; /* _SUN */
};
#define acpi_device_bid(d) ((d)->pnp.bus_id)
Index: linux-3.5/drivers/acpi/scan.c
===================================================================
--- linux-3.5.orig/drivers/acpi/scan.c 2012-07-27 10:20:22.721522499 +0900
+++ linux-3.5/drivers/acpi/scan.c 2012-07-30 09:52:32.581887304 +0900
@@ -192,10 +192,21 @@ end:
}
static DEVICE_ATTR(path, 0444, acpi_device_path_show, NULL);
+static ssize_t
+acpi_device_sun_show(struct device *dev, struct device_attribute *attr, char *buf) {
+ struct acpi_device *acpi_dev = to_acpi_device(dev);
+ int result;
+
+ result = sprintf(buf, "%lu\n", acpi_dev->pnp.sun);
+ return result;
+}
+static DEVICE_ATTR(sun, 0444, acpi_device_sun_show, NULL);
+
static int acpi_device_setup_files(struct acpi_device *dev)
{
acpi_status status;
acpi_handle temp;
+ unsigned long long sun;
int result = 0;
/*
@@ -217,6 +228,16 @@ static int acpi_device_setup_files(struc
goto end;
}
+ status = acpi_evaluate_integer(dev->handle, "_SUN", NULL, &sun);
+ if (ACPI_SUCCESS(status)) {
+ dev->pnp.sun = (unsigned long)sun;
+ result = device_create_file(&dev->dev, &dev_attr_sun);
+ if (result)
+ goto end;
+ } else {
+ dev->pnp.sun = (unsigned long)-1;
+ }
+
/*
* If device has _EJ0, 'eject' file is created that is used to trigger
* hot-removal function from userland.
@@ -241,6 +262,10 @@ static void acpi_device_remove_files(str
if (ACPI_SUCCESS(status))
device_remove_file(&dev->dev, &dev_attr_eject);
+ status = acpi_get_handle(dev->handle, "_SUN", &temp);
+ if (ACPI_SUCCESS(status))
+ device_remove_file(&dev->dev, &dev_attr_sun);
+
device_remove_file(&dev->dev, &dev_attr_modalias);
device_remove_file(&dev->dev, &dev_attr_hid);
if (dev->handle)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] create sun sysfs file
2012-07-30 0:58 [PATCH v3] create sun sysfs file Yasuaki Ishimatsu
@ 2012-07-30 15:18 ` Toshi Kani
2012-08-07 0:01 ` Yasuaki Ishimatsu
2012-07-30 15:33 ` Jiang Liu
1 sibling, 1 reply; 5+ messages in thread
From: Toshi Kani @ 2012-07-30 15:18 UTC (permalink / raw)
To: Yasuaki Ishimatsu; +Cc: lenb, linux-acpi, linux-kernel
On Mon, 2012-07-30 at 09:58 +0900, Yasuaki Ishimatsu wrote:
> Even if a device has _SUN method, there is no way to know the slot unique-ID.
> Thus the patch creates "sun" file in sysfs so that we can recognize it.
>
> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Hi Yasuaki,
Thanks for the quick update. Looks good.
Reviewed-by: Toshi Kani <toshi.kani@hp.com>
-Toshi
> ---
> drivers/acpi/scan.c | 25 +++++++++++++++++++++++++
> include/acpi/acpi_bus.h | 1 +
> 2 files changed, 26 insertions(+)
>
> Index: linux-3.5/include/acpi/acpi_bus.h
> ===================================================================
> --- linux-3.5.orig/include/acpi/acpi_bus.h 2012-07-27 10:20:22.722553439 +0900
> +++ linux-3.5/include/acpi/acpi_bus.h 2012-07-27 10:20:25.741555954 +0900
> @@ -209,6 +209,7 @@ struct acpi_device_pnp {
> struct list_head ids; /* _HID and _CIDs */
> acpi_device_name device_name; /* Driver-determined */
> acpi_device_class device_class; /* " */
> + unsigned long sun; /* _SUN */
> };
>
> #define acpi_device_bid(d) ((d)->pnp.bus_id)
> Index: linux-3.5/drivers/acpi/scan.c
> ===================================================================
> --- linux-3.5.orig/drivers/acpi/scan.c 2012-07-27 10:20:22.721522499 +0900
> +++ linux-3.5/drivers/acpi/scan.c 2012-07-30 09:52:32.581887304 +0900
> @@ -192,10 +192,21 @@ end:
> }
> static DEVICE_ATTR(path, 0444, acpi_device_path_show, NULL);
>
> +static ssize_t
> +acpi_device_sun_show(struct device *dev, struct device_attribute *attr, char *buf) {
> + struct acpi_device *acpi_dev = to_acpi_device(dev);
> + int result;
> +
> + result = sprintf(buf, "%lu\n", acpi_dev->pnp.sun);
> + return result;
> +}
> +static DEVICE_ATTR(sun, 0444, acpi_device_sun_show, NULL);
> +
> static int acpi_device_setup_files(struct acpi_device *dev)
> {
> acpi_status status;
> acpi_handle temp;
> + unsigned long long sun;
> int result = 0;
>
> /*
> @@ -217,6 +228,16 @@ static int acpi_device_setup_files(struc
> goto end;
> }
>
> + status = acpi_evaluate_integer(dev->handle, "_SUN", NULL, &sun);
> + if (ACPI_SUCCESS(status)) {
> + dev->pnp.sun = (unsigned long)sun;
> + result = device_create_file(&dev->dev, &dev_attr_sun);
> + if (result)
> + goto end;
> + } else {
> + dev->pnp.sun = (unsigned long)-1;
> + }
> +
> /*
> * If device has _EJ0, 'eject' file is created that is used to trigger
> * hot-removal function from userland.
> @@ -241,6 +262,10 @@ static void acpi_device_remove_files(str
> if (ACPI_SUCCESS(status))
> device_remove_file(&dev->dev, &dev_attr_eject);
>
> + status = acpi_get_handle(dev->handle, "_SUN", &temp);
> + if (ACPI_SUCCESS(status))
> + device_remove_file(&dev->dev, &dev_attr_sun);
> +
> device_remove_file(&dev->dev, &dev_attr_modalias);
> device_remove_file(&dev->dev, &dev_attr_hid);
> if (dev->handle)
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] create sun sysfs file
2012-07-30 0:58 [PATCH v3] create sun sysfs file Yasuaki Ishimatsu
2012-07-30 15:18 ` Toshi Kani
@ 2012-07-30 15:33 ` Jiang Liu
2012-08-07 0:00 ` Yasuaki Ishimatsu
1 sibling, 1 reply; 5+ messages in thread
From: Jiang Liu @ 2012-07-30 15:33 UTC (permalink / raw)
To: Yasuaki Ishimatsu; +Cc: lenb, toshi.kani, linux-acpi, linux-kernel
On 07/30/2012 08:58 AM, Yasuaki Ishimatsu wrote:
> Even if a device has _SUN method, there is no way to know the slot unique-ID.
> Thus the patch creates "sun" file in sysfs so that we can recognize it.
>
> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
>
> ---
> drivers/acpi/scan.c | 25 +++++++++++++++++++++++++
> include/acpi/acpi_bus.h | 1 +
> 2 files changed, 26 insertions(+)
>
> Index: linux-3.5/include/acpi/acpi_bus.h
> ===================================================================
> --- linux-3.5.orig/include/acpi/acpi_bus.h 2012-07-27 10:20:22.722553439 +0900
> +++ linux-3.5/include/acpi/acpi_bus.h 2012-07-27 10:20:25.741555954 +0900
> @@ -209,6 +209,7 @@ struct acpi_device_pnp {
> struct list_head ids; /* _HID and _CIDs */
> acpi_device_name device_name; /* Driver-determined */
> acpi_device_class device_class; /* " */
> + unsigned long sun; /* _SUN */
> };
>
> #define acpi_device_bid(d) ((d)->pnp.bus_id)
> Index: linux-3.5/drivers/acpi/scan.c
> ===================================================================
> --- linux-3.5.orig/drivers/acpi/scan.c 2012-07-27 10:20:22.721522499 +0900
> +++ linux-3.5/drivers/acpi/scan.c 2012-07-30 09:52:32.581887304 +0900
> @@ -192,10 +192,21 @@ end:
> }
> static DEVICE_ATTR(path, 0444, acpi_device_path_show, NULL);
>
> +static ssize_t
> +acpi_device_sun_show(struct device *dev, struct device_attribute *attr, char *buf) {
The above line is more than 80 characters.
> + struct acpi_device *acpi_dev = to_acpi_device(dev);
> + int result;
> +
> + result = sprintf(buf, "%lu\n", acpi_dev->pnp.sun);
> + return result;
How about just
return sprintf(buf, "%lu\n", acpi_dev->pnp.sun);
> +}
> +static DEVICE_ATTR(sun, 0444, acpi_device_sun_show, NULL);
> +
> static int acpi_device_setup_files(struct acpi_device *dev)
> {
> acpi_status status;
> acpi_handle temp;
> + unsigned long long sun;
> int result = 0;
>
> /*
> @@ -217,6 +228,16 @@ static int acpi_device_setup_files(struc
> goto end;
> }
>
> + status = acpi_evaluate_integer(dev->handle, "_SUN", NULL, &sun);
> + if (ACPI_SUCCESS(status)) {
> + dev->pnp.sun = (unsigned long)sun;
> + result = device_create_file(&dev->dev, &dev_attr_sun);
> + if (result)
> + goto end;
> + } else {
> + dev->pnp.sun = (unsigned long)-1;
> + }
> +
> /*
> * If device has _EJ0, 'eject' file is created that is used to trigger
> * hot-removal function from userland.
> @@ -241,6 +262,10 @@ static void acpi_device_remove_files(str
> if (ACPI_SUCCESS(status))
> device_remove_file(&dev->dev, &dev_attr_eject);
>
> + status = acpi_get_handle(dev->handle, "_SUN", &temp);
> + if (ACPI_SUCCESS(status))
> + device_remove_file(&dev->dev, &dev_attr_sun);
> +
> device_remove_file(&dev->dev, &dev_attr_modalias);
> device_remove_file(&dev->dev, &dev_attr_hid);
> if (dev->handle)
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] create sun sysfs file
2012-07-30 15:33 ` Jiang Liu
@ 2012-08-07 0:00 ` Yasuaki Ishimatsu
0 siblings, 0 replies; 5+ messages in thread
From: Yasuaki Ishimatsu @ 2012-08-07 0:00 UTC (permalink / raw)
To: Jiang Liu; +Cc: lenb, toshi.kani, linux-acpi, linux-kernel
Hi Jiang,
Sorry for late reply. I could not work by private reason.
2012/07/31 0:33, Jiang Liu wrote:
> On 07/30/2012 08:58 AM, Yasuaki Ishimatsu wrote:
>> Even if a device has _SUN method, there is no way to know the slot unique-ID.
>> Thus the patch creates "sun" file in sysfs so that we can recognize it.
>>
>> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
>>
>> ---
>> drivers/acpi/scan.c | 25 +++++++++++++++++++++++++
>> include/acpi/acpi_bus.h | 1 +
>> 2 files changed, 26 insertions(+)
>>
>> Index: linux-3.5/include/acpi/acpi_bus.h
>> ===================================================================
>> --- linux-3.5.orig/include/acpi/acpi_bus.h 2012-07-27 10:20:22.722553439 +0900
>> +++ linux-3.5/include/acpi/acpi_bus.h 2012-07-27 10:20:25.741555954 +0900
>> @@ -209,6 +209,7 @@ struct acpi_device_pnp {
>> struct list_head ids; /* _HID and _CIDs */
>> acpi_device_name device_name; /* Driver-determined */
>> acpi_device_class device_class; /* " */
>> + unsigned long sun; /* _SUN */
>> };
>>
>> #define acpi_device_bid(d) ((d)->pnp.bus_id)
>> Index: linux-3.5/drivers/acpi/scan.c
>> ===================================================================
>> --- linux-3.5.orig/drivers/acpi/scan.c 2012-07-27 10:20:22.721522499 +0900
>> +++ linux-3.5/drivers/acpi/scan.c 2012-07-30 09:52:32.581887304 +0900
>> @@ -192,10 +192,21 @@ end:
>> }
>> static DEVICE_ATTR(path, 0444, acpi_device_path_show, NULL);
>>
>> +static ssize_t
>> +acpi_device_sun_show(struct device *dev, struct device_attribute *attr, char *buf) {
> The above line is more than 80 characters.
I'll update it soon.
>
>> + struct acpi_device *acpi_dev = to_acpi_device(dev);
>> + int result;
>> +
>> + result = sprintf(buf, "%lu\n", acpi_dev->pnp.sun);
>> + return result;
> How about just
> return sprintf(buf, "%lu\n", acpi_dev->pnp.sun);
I'll update it soon.
Thanks,
Yasuaki Ishimatsu
>
>> +}
>> +static DEVICE_ATTR(sun, 0444, acpi_device_sun_show, NULL);
>> +
>> static int acpi_device_setup_files(struct acpi_device *dev)
>> {
>> acpi_status status;
>> acpi_handle temp;
>> + unsigned long long sun;
>> int result = 0;
>>
>> /*
>> @@ -217,6 +228,16 @@ static int acpi_device_setup_files(struc
>> goto end;
>> }
>>
>> + status = acpi_evaluate_integer(dev->handle, "_SUN", NULL, &sun);
>> + if (ACPI_SUCCESS(status)) {
>> + dev->pnp.sun = (unsigned long)sun;
>> + result = device_create_file(&dev->dev, &dev_attr_sun);
>> + if (result)
>> + goto end;
>> + } else {
>> + dev->pnp.sun = (unsigned long)-1;
>> + }
>> +
>> /*
>> * If device has _EJ0, 'eject' file is created that is used to trigger
>> * hot-removal function from userland.
>> @@ -241,6 +262,10 @@ static void acpi_device_remove_files(str
>> if (ACPI_SUCCESS(status))
>> device_remove_file(&dev->dev, &dev_attr_eject);
>>
>> + status = acpi_get_handle(dev->handle, "_SUN", &temp);
>> + if (ACPI_SUCCESS(status))
>> + device_remove_file(&dev->dev, &dev_attr_sun);
>> +
>> device_remove_file(&dev->dev, &dev_attr_modalias);
>> device_remove_file(&dev->dev, &dev_attr_hid);
>> if (dev->handle)
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at http://www.tux.org/lkml/
>>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] create sun sysfs file
2012-07-30 15:18 ` Toshi Kani
@ 2012-08-07 0:01 ` Yasuaki Ishimatsu
0 siblings, 0 replies; 5+ messages in thread
From: Yasuaki Ishimatsu @ 2012-08-07 0:01 UTC (permalink / raw)
To: Toshi Kani; +Cc: lenb, linux-acpi, linux-kernel
Hi Toshi,
2012/07/31 0:18, Toshi Kani wrote:
> On Mon, 2012-07-30 at 09:58 +0900, Yasuaki Ishimatsu wrote:
>> Even if a device has _SUN method, there is no way to know the slot unique-ID.
>> Thus the patch creates "sun" file in sysfs so that we can recognize it.
>>
>> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
>
> Hi Yasuaki,
>
> Thanks for the quick update. Looks good.
>
> Reviewed-by: Toshi Kani <toshi.kani@hp.com>
Thanks you for reviewing my patch.
Thanks,
Yasuaki Ishimatsu
>
> -Toshi
>
>> ---
>> drivers/acpi/scan.c | 25 +++++++++++++++++++++++++
>> include/acpi/acpi_bus.h | 1 +
>> 2 files changed, 26 insertions(+)
>>
>> Index: linux-3.5/include/acpi/acpi_bus.h
>> ===================================================================
>> --- linux-3.5.orig/include/acpi/acpi_bus.h 2012-07-27 10:20:22.722553439 +0900
>> +++ linux-3.5/include/acpi/acpi_bus.h 2012-07-27 10:20:25.741555954 +0900
>> @@ -209,6 +209,7 @@ struct acpi_device_pnp {
>> struct list_head ids; /* _HID and _CIDs */
>> acpi_device_name device_name; /* Driver-determined */
>> acpi_device_class device_class; /* " */
>> + unsigned long sun; /* _SUN */
>> };
>>
>> #define acpi_device_bid(d) ((d)->pnp.bus_id)
>> Index: linux-3.5/drivers/acpi/scan.c
>> ===================================================================
>> --- linux-3.5.orig/drivers/acpi/scan.c 2012-07-27 10:20:22.721522499 +0900
>> +++ linux-3.5/drivers/acpi/scan.c 2012-07-30 09:52:32.581887304 +0900
>> @@ -192,10 +192,21 @@ end:
>> }
>> static DEVICE_ATTR(path, 0444, acpi_device_path_show, NULL);
>>
>> +static ssize_t
>> +acpi_device_sun_show(struct device *dev, struct device_attribute *attr, char *buf) {
>> + struct acpi_device *acpi_dev = to_acpi_device(dev);
>> + int result;
>> +
>> + result = sprintf(buf, "%lu\n", acpi_dev->pnp.sun);
>> + return result;
>> +}
>> +static DEVICE_ATTR(sun, 0444, acpi_device_sun_show, NULL);
>> +
>> static int acpi_device_setup_files(struct acpi_device *dev)
>> {
>> acpi_status status;
>> acpi_handle temp;
>> + unsigned long long sun;
>> int result = 0;
>>
>> /*
>> @@ -217,6 +228,16 @@ static int acpi_device_setup_files(struc
>> goto end;
>> }
>>
>> + status = acpi_evaluate_integer(dev->handle, "_SUN", NULL, &sun);
>> + if (ACPI_SUCCESS(status)) {
>> + dev->pnp.sun = (unsigned long)sun;
>> + result = device_create_file(&dev->dev, &dev_attr_sun);
>> + if (result)
>> + goto end;
>> + } else {
>> + dev->pnp.sun = (unsigned long)-1;
>> + }
>> +
>> /*
>> * If device has _EJ0, 'eject' file is created that is used to trigger
>> * hot-removal function from userland.
>> @@ -241,6 +262,10 @@ static void acpi_device_remove_files(str
>> if (ACPI_SUCCESS(status))
>> device_remove_file(&dev->dev, &dev_attr_eject);
>>
>> + status = acpi_get_handle(dev->handle, "_SUN", &temp);
>> + if (ACPI_SUCCESS(status))
>> + device_remove_file(&dev->dev, &dev_attr_sun);
>> +
>> device_remove_file(&dev->dev, &dev_attr_modalias);
>> device_remove_file(&dev->dev, &dev_attr_hid);
>> if (dev->handle)
>>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-08-07 0:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-30 0:58 [PATCH v3] create sun sysfs file Yasuaki Ishimatsu
2012-07-30 15:18 ` Toshi Kani
2012-08-07 0:01 ` Yasuaki Ishimatsu
2012-07-30 15:33 ` Jiang Liu
2012-08-07 0:00 ` Yasuaki Ishimatsu
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).