* [PATCH v3 0/3] ACPI/device_sysfs: Add sysfs support for _HRV hardware revision
@ 2016-04-30 16:03 Betty Dall
2016-04-30 16:03 ` [PATCH v3 1/3] " Betty Dall
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Betty Dall @ 2016-04-30 16:03 UTC (permalink / raw)
To: rjw, lenb, linux-acpi; +Cc: linux-kernel
The ACPI _HRV object on the device is used to supply Linux with the
device's hardware revision. This is an optional object. Add sysfs support
for the _HRV object if it exists on the device.
This change allows users to easily find the hardware version of non-PCI
hardware by looking at the sysfs 'hrv' file. It is most useful for
non-PCI devices because lspci can list the hardware version for PCI
devices.
v1->v2
Changed hrv_show error return to -EIO.
Changed sun_show and status_show error return to -EIO.
Cleaned up checkpatch errors and warnings.
v2->v3
Left some of the checkpatch warnings in place.
Betty Dall (3):
ACPI/device_sysfs: Add sysfs support for _HRV hardware revision
ACPI/device_sysfs: Change _SUN and _STA show functions error return to EIO
ACPI/device_sysfs: Clean up checkpatch errors
drivers/acpi/device_sysfs.c | 44 +++++++++++++++++++++++++++++++++++---------
1 file changed, 35 insertions(+), 9 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 1/3] ACPI/device_sysfs: Add sysfs support for _HRV hardware revision
2016-04-30 16:03 [PATCH v3 0/3] ACPI/device_sysfs: Add sysfs support for _HRV hardware revision Betty Dall
@ 2016-04-30 16:03 ` Betty Dall
2016-04-30 16:03 ` [PATCH v3 2/3] ACPI/device_sysfs: Change _SUN and _STA show functions error return to EIO Betty Dall
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Betty Dall @ 2016-04-30 16:03 UTC (permalink / raw)
To: rjw, lenb, linux-acpi; +Cc: linux-kernel, Betty Dall
The ACPI _HRV object on the device is used to supply Linux with the
device's hardware revision. This is an optional object. Add sysfs support
for the _HRV object if it exists on the device.
This change allows users to easily find the hardware version of non-PCI
hardware by looking at the sysfs 'hrv' file. It is most useful for
non-PCI devices because lspci can list the hardware version for PCI
devices.
Signed-off-by: Betty Dall <betty.dall@hpe.com>
---
drivers/acpi/device_sysfs.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c
index b9afb47..49cc0cb 100644
--- a/drivers/acpi/device_sysfs.c
+++ b/drivers/acpi/device_sysfs.c
@@ -473,6 +473,21 @@ acpi_device_sun_show(struct device *dev, struct device_attribute *attr,
}
static DEVICE_ATTR(sun, 0444, acpi_device_sun_show, NULL);
+static ssize_t
+acpi_device_hrv_show(struct device *dev, struct device_attribute *attr,
+ char *buf) {
+ struct acpi_device *acpi_dev = to_acpi_device(dev);
+ acpi_status status;
+ unsigned long long hrv;
+
+ status = acpi_evaluate_integer(acpi_dev->handle, "_HRV", NULL, &hrv);
+ if (ACPI_FAILURE(status))
+ return -EIO;
+
+ return sprintf(buf, "%llu\n", hrv);
+}
+static DEVICE_ATTR(hrv, 0444, acpi_device_hrv_show, NULL);
+
static ssize_t status_show(struct device *dev, struct device_attribute *attr,
char *buf) {
struct acpi_device *acpi_dev = to_acpi_device(dev);
@@ -541,6 +556,12 @@ int acpi_device_setup_files(struct acpi_device *dev)
goto end;
}
+ if (acpi_has_method(dev->handle, "_HRV")) {
+ result = device_create_file(&dev->dev, &dev_attr_hrv);
+ if (result)
+ goto end;
+ }
+
if (acpi_has_method(dev->handle, "_STA")) {
result = device_create_file(&dev->dev, &dev_attr_status);
if (result)
@@ -604,6 +625,9 @@ void acpi_device_remove_files(struct acpi_device *dev)
if (acpi_has_method(dev->handle, "_SUN"))
device_remove_file(&dev->dev, &dev_attr_sun);
+ if (acpi_has_method(dev->handle, "_HRV"))
+ device_remove_file(&dev->dev, &dev_attr_hrv);
+
if (dev->pnp.unique_id)
device_remove_file(&dev->dev, &dev_attr_uid);
if (dev->pnp.type.bus_address)
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v3 2/3] ACPI/device_sysfs: Change _SUN and _STA show functions error return to EIO
2016-04-30 16:03 [PATCH v3 0/3] ACPI/device_sysfs: Add sysfs support for _HRV hardware revision Betty Dall
2016-04-30 16:03 ` [PATCH v3 1/3] " Betty Dall
@ 2016-04-30 16:03 ` Betty Dall
2016-04-30 16:03 ` [PATCH v3 3/3] ACPI/device_sysfs: Clean up checkpatch errors Betty Dall
2016-05-05 23:42 ` [PATCH v3 0/3] ACPI/device_sysfs: Add sysfs support for _HRV hardware revision Rafael J. Wysocki
3 siblings, 0 replies; 5+ messages in thread
From: Betty Dall @ 2016-04-30 16:03 UTC (permalink / raw)
To: rjw, lenb, linux-acpi; +Cc: linux-kernel, Betty Dall
The error return from a sysfs show function is passed up through
the call chain and visible as the return from the read system call.
The show functions for the _STA and _SUN object currently return
-ENODEV. This patch changes the return to -EIO. ENODEV makes less
sense since the "device' exists or there wouldn't be a sysfs file.
Signed-off-by: Betty Dall <betty.dall@hpe.com>
---
drivers/acpi/device_sysfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c
index 49cc0cb..e556a3e 100644
--- a/drivers/acpi/device_sysfs.c
+++ b/drivers/acpi/device_sysfs.c
@@ -467,7 +467,7 @@ acpi_device_sun_show(struct device *dev, struct device_attribute *attr,
status = acpi_evaluate_integer(acpi_dev->handle, "_SUN", NULL, &sun);
if (ACPI_FAILURE(status))
- return -ENODEV;
+ return -EIO;
return sprintf(buf, "%llu\n", sun);
}
@@ -496,7 +496,7 @@ static ssize_t status_show(struct device *dev, struct device_attribute *attr,
status = acpi_evaluate_integer(acpi_dev->handle, "_STA", NULL, &sta);
if (ACPI_FAILURE(status))
- return -ENODEV;
+ return -EIO;
return sprintf(buf, "%llu\n", sta);
}
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v3 3/3] ACPI/device_sysfs: Clean up checkpatch errors
2016-04-30 16:03 [PATCH v3 0/3] ACPI/device_sysfs: Add sysfs support for _HRV hardware revision Betty Dall
2016-04-30 16:03 ` [PATCH v3 1/3] " Betty Dall
2016-04-30 16:03 ` [PATCH v3 2/3] ACPI/device_sysfs: Change _SUN and _STA show functions error return to EIO Betty Dall
@ 2016-04-30 16:03 ` Betty Dall
2016-05-05 23:42 ` [PATCH v3 0/3] ACPI/device_sysfs: Add sysfs support for _HRV hardware revision Rafael J. Wysocki
3 siblings, 0 replies; 5+ messages in thread
From: Betty Dall @ 2016-04-30 16:03 UTC (permalink / raw)
To: rjw, lenb, linux-acpi; +Cc: linux-kernel, Betty Dall
Cleaning up two existing checkpatch errors (and 2 warnings) in
device_sysfs.c since the file is being changed.
The change in acpi_device_setup_files() is changing spaces to a tab.
Signed-off-by: Betty Dall <betty.dall@hpe.com>
---
drivers/acpi/device_sysfs.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c
index e556a3e..7b2c48f 100644
--- a/drivers/acpi/device_sysfs.c
+++ b/drivers/acpi/device_sysfs.c
@@ -35,7 +35,7 @@ static ssize_t acpi_object_path(acpi_handle handle, char *buf)
if (result)
return result;
- result = sprintf(buf, "%s\n", (char*)path.pointer);
+ result = sprintf(buf, "%s\n", (char *)path.pointer);
kfree(path.pointer);
return result;
}
@@ -333,7 +333,8 @@ int acpi_device_modalias(struct device *dev, char *buf, int size)
EXPORT_SYMBOL_GPL(acpi_device_modalias);
static ssize_t
-acpi_device_modalias_show(struct device *dev, struct device_attribute *attr, char *buf) {
+acpi_device_modalias_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
return __acpi_device_modalias(to_acpi_device(dev), buf, 1024);
}
static DEVICE_ATTR(modalias, 0444, acpi_device_modalias_show, NULL);
@@ -397,7 +398,8 @@ acpi_eject_store(struct device *d, struct device_attribute *attr,
static DEVICE_ATTR(eject, 0200, NULL, acpi_eject_store);
static ssize_t
-acpi_device_hid_show(struct device *dev, struct device_attribute *attr, char *buf) {
+acpi_device_hid_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
struct acpi_device *acpi_dev = to_acpi_device(dev);
return sprintf(buf, "%s\n", acpi_device_hid(acpi_dev));
@@ -568,10 +570,10 @@ int acpi_device_setup_files(struct acpi_device *dev)
goto end;
}
- /*
- * If device has _EJ0, 'eject' file is created that is used to trigger
- * hot-removal function from userland.
- */
+ /*
+ * If device has _EJ0, 'eject' file is created that is used to trigger
+ * hot-removal function from userland.
+ */
if (acpi_has_method(dev->handle, "_EJ0")) {
result = device_create_file(&dev->dev, &dev_attr_eject);
if (result)
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v3 0/3] ACPI/device_sysfs: Add sysfs support for _HRV hardware revision
2016-04-30 16:03 [PATCH v3 0/3] ACPI/device_sysfs: Add sysfs support for _HRV hardware revision Betty Dall
` (2 preceding siblings ...)
2016-04-30 16:03 ` [PATCH v3 3/3] ACPI/device_sysfs: Clean up checkpatch errors Betty Dall
@ 2016-05-05 23:42 ` Rafael J. Wysocki
3 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2016-05-05 23:42 UTC (permalink / raw)
To: Betty Dall; +Cc: lenb, linux-acpi, linux-kernel
On Saturday, April 30, 2016 10:03:36 AM Betty Dall wrote:
> The ACPI _HRV object on the device is used to supply Linux with the
> device's hardware revision. This is an optional object. Add sysfs support
> for the _HRV object if it exists on the device.
>
> This change allows users to easily find the hardware version of non-PCI
> hardware by looking at the sysfs 'hrv' file. It is most useful for
> non-PCI devices because lspci can list the hardware version for PCI
> devices.
>
> v1->v2
> Changed hrv_show error return to -EIO.
> Changed sun_show and status_show error return to -EIO.
> Cleaned up checkpatch errors and warnings.
>
> v2->v3
> Left some of the checkpatch warnings in place.
>
> Betty Dall (3):
> ACPI/device_sysfs: Add sysfs support for _HRV hardware revision
> ACPI/device_sysfs: Change _SUN and _STA show functions error return to EIO
> ACPI/device_sysfs: Clean up checkpatch errors
All [1-3/3] applied, thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-05-05 23:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-30 16:03 [PATCH v3 0/3] ACPI/device_sysfs: Add sysfs support for _HRV hardware revision Betty Dall
2016-04-30 16:03 ` [PATCH v3 1/3] " Betty Dall
2016-04-30 16:03 ` [PATCH v3 2/3] ACPI/device_sysfs: Change _SUN and _STA show functions error return to EIO Betty Dall
2016-04-30 16:03 ` [PATCH v3 3/3] ACPI/device_sysfs: Clean up checkpatch errors Betty Dall
2016-05-05 23:42 ` [PATCH v3 0/3] ACPI/device_sysfs: Add sysfs support for _HRV hardware revision Rafael J. Wysocki
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).