[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190711213911.23180-2-vaishali.thakkar@linaro.org>
Date: Fri, 12 Jul 2019 03:09:07 +0530
From: Vaishali Thakkar <vaishali.thakkar@...aro.org>
To: agross@...nel.org
Cc: david.brown@...aro.org, gregkh@...uxfoundation.org,
linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org,
rafael@...nel.org, bjorn.andersson@...aro.org, vkoul@...nel.org,
Vaishali Thakkar <vaishali.thakkar@...aro.org>
Subject: [PATCH v5 1/5] base: soc: Add serial_number attribute to soc
From: Bjorn Andersson <bjorn.andersson@...aro.org>
Add new attribute named "serial_number" as a standard interface for
user space to acquire the serial number of the device.
For ST-Ericsson SoCs this is exposed by the cryptically named "soc_id"
attribute, but this provides a human readable standardized name for this
property.
Signed-off-by: Bjorn Andersson <bjorn.andersson@...aro.org>
Signed-off-by: Vaishali Thakkar <vaishali.thakkar@...aro.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Reviewed-by: Stephen Boyd <swboyd@...omium.org>
---
Changes since v4:
- Add Stephen's reviewed-by
Changes since v3:
- Add Greg's Reviewed-by
Changes since v2:
- None
Changes since v1:
- Make comment more clear for the case when serial
number is not available
---
Documentation/ABI/testing/sysfs-devices-soc | 7 +++++++
drivers/base/soc.c | 7 +++++++
include/linux/sys_soc.h | 1 +
3 files changed, 15 insertions(+)
diff --git a/Documentation/ABI/testing/sysfs-devices-soc b/Documentation/ABI/testing/sysfs-devices-soc
index 6d9cc253f2b2..ba3a3fac0ee1 100644
--- a/Documentation/ABI/testing/sysfs-devices-soc
+++ b/Documentation/ABI/testing/sysfs-devices-soc
@@ -28,0 +29,7 @@ Description:
+What: /sys/devices/socX/serial_number
+Date: January 2019
+contact: Bjorn Andersson <bjorn.andersson@...aro.org>
+Description:
+ Read-only attribute supported by most SoCs. Contains the SoC's
+ serial number, if available.
+
diff --git a/drivers/base/soc.c b/drivers/base/soc.c
index 10b280f30217..b0933b9fe67f 100644
--- a/drivers/base/soc.c
+++ b/drivers/base/soc.c
@@ -35,0 +36 @@ static DEVICE_ATTR(family, S_IRUGO, soc_info_get, NULL);
+static DEVICE_ATTR(serial_number, S_IRUGO, soc_info_get, NULL);
@@ -59,0 +61,3 @@ static umode_t soc_attribute_mode(struct kobject *kobj,
+ if ((attr == &dev_attr_serial_number.attr)
+ && (soc_dev->attr->serial_number != NULL))
+ return attr->mode;
@@ -79,0 +84,2 @@ static ssize_t soc_info_get(struct device *dev,
+ if (attr == &dev_attr_serial_number)
+ return sprintf(buf, "%s\n", soc_dev->attr->serial_number);
@@ -89,0 +96 @@ static struct attribute *soc_attr[] = {
+ &dev_attr_serial_number.attr,
diff --git a/include/linux/sys_soc.h b/include/linux/sys_soc.h
index b7c70c3e953f..48ceea867dd6 100644
--- a/include/linux/sys_soc.h
+++ b/include/linux/sys_soc.h
@@ -14,0 +15 @@ struct soc_device_attribute {
+ const char *serial_number;
--
2.17.1
Powered by blists - more mailing lists