Skip to contentSkip to conversation

create sun sysfs file

PATCH Superseded Yasuaki Ishimatsu 2 participants 7 messages Aug 7, 2012 – Oct 9, 2012

Subsystems (2)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 create sun sysfs file

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.

---
 drivers/acpi/scan.c     |   24 ++++++++++++++++++++++++
 include/acpi/acpi_bus.h |    1 +
 2 files changed, 25 insertions(+)
include/acpi/acpi_bus.h +1 -0
Index: linux-3.5/include/acpi/acpi_bus.h
===================================================================
@@ -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)
drivers/acpi/scan.c +24 -0
Index: linux-3.5/drivers/acpi/scan.c
===================================================================
@@ -192,10 +192,20 @@ 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);
+
+	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 +227,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 +261,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)
#1 lore raw

Hi Len,

Three weeks passed after I post the patch.
All comments have already been applied to it. And I think there is no comments about it. So I want you to merge it into your tree.

Thanks,
Yasuaki Ishimatsu

Quoted 82 lines · Yasuaki Ishimatsu

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.

---
  drivers/acpi/scan.c     |   24 ++++++++++++++++++++++++
  include/acpi/acpi_bus.h |    1 +
  2 files changed, 25 insertions(+)

Index: linux-3.5/include/acpi/acpi_bus.h
===================================================================

include/acpi/acpi_bus.h +1 -0
@@ -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
===================================================================

drivers/acpi/scan.c +24 -1
@@ -192,10 +192,20 @@ 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);
+
+	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 +227,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 +261,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-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw

Hi Len,

Ping...
I want you to merge the patch into your tree for linux-3.7.

Thanks,
Yasuaki Ishimatsu

Quoted 99 lines · Yasuaki Ishimatsu

Hi Len,

Three weeks passed after I post the patch.
All comments have already been applied to it. And I think there is no comments about it. So I want you to merge it into your tree.

Thanks,
Yasuaki Ishimatsu

Quoted 78 lines · Yasuaki Ishimatsu

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.

---
   drivers/acpi/scan.c     |   24 ++++++++++++++++++++++++
   include/acpi/acpi_bus.h |    1 +
   2 files changed, 25 insertions(+)

Index: linux-3.5/include/acpi/acpi_bus.h
===================================================================

include/acpi/acpi_bus.h +1 -0
@@ -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
===================================================================

drivers/acpi/scan.c +24 -1
@@ -192,10 +192,20 @@ 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);
+
+	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 +227,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 +261,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)
 
--
Quoted 4 lines

To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw

Hi Len,

Ping...
Pleae merge the patch into your tree.

Thanks,
Yasuaki Ishimatsu

Quoted 115 lines · Yasuaki Ishimatsu

Hi Len,

Ping...
I want you to merge the patch into your tree for linux-3.7.

Thanks,
Yasuaki Ishimatsu

Quoted 87 lines · Yasuaki Ishimatsu

Hi Len,

Three weeks passed after I post the patch.
All comments have already been applied to it. And I think there is no comments about it. So I want you to merge it into your tree.

Thanks,
Yasuaki Ishimatsu

Quoted 77 lines · Yasuaki Ishimatsu

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.

---
    drivers/acpi/scan.c     |   24 ++++++++++++++++++++++++
    include/acpi/acpi_bus.h |    1 +
    2 files changed, 25 insertions(+)

Index: linux-3.5/include/acpi/acpi_bus.h
===================================================================

include/acpi/acpi_bus.h +1 -0
@@ -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
===================================================================

drivers/acpi/scan.c +24 -0
@@ -192,10 +192,20 @@ 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);
+
+	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 +227,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 +261,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)
Quoted 12 lines
Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

Hi Len,

What should I do to put this patch in your tree?

Thanks,
Yasuaki Ishimatsu

Quoted 131 lines · Yasuaki Ishimatsu

Hi Len,

Ping...
Pleae merge the patch into your tree.

Thanks,
Yasuaki Ishimatsu

Quoted 110 lines · Yasuaki Ishimatsu

Hi Len,

Ping...
I want you to merge the patch into your tree for linux-3.7.

Thanks,
Yasuaki Ishimatsu

Quoted 87 lines · Yasuaki Ishimatsu

Hi Len,

Three weeks passed after I post the patch.
All comments have already been applied to it. And I think there is no comments about it. So I want you to merge it into your tree.

Thanks,
Yasuaki Ishimatsu

Quoted 77 lines · Yasuaki Ishimatsu

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.

---
     drivers/acpi/scan.c     |   24 ++++++++++++++++++++++++
     include/acpi/acpi_bus.h |    1 +
     2 files changed, 25 insertions(+)

Index: linux-3.5/include/acpi/acpi_bus.h
===================================================================

include/acpi/acpi_bus.h +1 -0
@@ -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
===================================================================

drivers/acpi/scan.c +24 -0
@@ -192,10 +192,20 @@ 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);
+
+	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 +227,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 +261,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)
Quoted 12 lines
Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

reviewer
#5 lore raw
Quoted 3 lines · Yasuaki Ishimatsu

Hi Len,

What should I do to put this patch in your tree?

Please add a description of the attribute in
Documentation/ABI/testing/

A human needs to understand exactly what is in that file because you are proposing it as an ABI.

thanks,
Len Brown, Intel Open Source Technology Center

#6 lore raw

Hi Len,

Quoted 11 lines · Len Brown
Quoted 3 lines · Yasuaki Ishimatsu

Hi Len,

What should I do to put this patch in your tree?

Please add a description of the attribute in
Documentation/ABI/testing/

A human needs to understand exactly what is in that file because you are proposing it as an ABI.

Thank you for your comment. I'll update soon.

Regards,
Yasuaki Ishimatsu

Quoted 4 lines

thanks,
Len Brown, Intel Open Source Technology Center