diff options
author | Bhuvanchandra DV <bhuvanchandra.dv@toradex.com> | 2017-02-20 22:49:33 +0530 |
---|---|---|
committer | Philippe Schenker <philippe.schenker@toradex.com> | 2020-08-13 16:04:36 +0200 |
commit | af73d225d43e76778af738f37c2cfe46377ccf3c (patch) | |
tree | 640f485c13bff5577fe19d9b68f8f67ac3e618f0 | |
parent | 270b28eee578622372c5c613fd468690851d3785 (diff) |
drivers: soc: Add new sysfs attribute to expose SoC unique ID
Add new 'unique_id' sysfs attribute to expose SoC unique ID
Signed-off-by: Bhuvanchandra DV <bhuvanchandra.dv@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
(cherry picked from commit 8a098f2f1b8ae277a38ee0c5e0b974d5baa8dd01)
(cherry picked from commit fb67fb4b277c6df9b5032564d6ae6756c905206d)
Conflicts:
include/linux/sys_soc.h
Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
(cherry picked from commit 8d97c55c390d985a8e875b0d32c482de3a25414a)
-rw-r--r-- | drivers/base/soc.c | 7 | ||||
-rw-r--r-- | include/linux/sys_soc.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/drivers/base/soc.c b/drivers/base/soc.c index 7c0c5ca5953d..87318ec34702 100644 --- a/drivers/base/soc.c +++ b/drivers/base/soc.c @@ -35,6 +35,7 @@ static DEVICE_ATTR(machine, S_IRUGO, soc_info_get, NULL); static DEVICE_ATTR(family, S_IRUGO, soc_info_get, NULL); static DEVICE_ATTR(serial_number, S_IRUGO, soc_info_get, NULL); static DEVICE_ATTR(soc_id, S_IRUGO, soc_info_get, NULL); +static DEVICE_ATTR(unique_id, S_IRUGO, soc_info_get, NULL); static DEVICE_ATTR(revision, S_IRUGO, soc_info_get, NULL); struct device *soc_device_to_device(struct soc_device *soc_dev) @@ -64,6 +65,9 @@ static umode_t soc_attribute_mode(struct kobject *kobj, if ((attr == &dev_attr_soc_id.attr) && (soc_dev->attr->soc_id != NULL)) return attr->mode; + if ((attr == &dev_attr_unique_id.attr) + && (soc_dev->attr->unique_id != NULL)) + return attr->mode; /* Unknown or unfilled attribute. */ return 0; @@ -85,6 +89,8 @@ static ssize_t soc_info_get(struct device *dev, return sprintf(buf, "%s\n", soc_dev->attr->serial_number); if (attr == &dev_attr_soc_id) return sprintf(buf, "%s\n", soc_dev->attr->soc_id); + if (attr == &dev_attr_unique_id) + return sprintf(buf, "%s\n", soc_dev->attr->unique_id); return -EINVAL; @@ -95,6 +101,7 @@ static struct attribute *soc_attr[] = { &dev_attr_family.attr, &dev_attr_serial_number.attr, &dev_attr_soc_id.attr, + &dev_attr_unique_id.attr, &dev_attr_revision.attr, NULL, }; diff --git a/include/linux/sys_soc.h b/include/linux/sys_soc.h index 48ceea867dd6..99a39adb3ddb 100644 --- a/include/linux/sys_soc.h +++ b/include/linux/sys_soc.h @@ -15,6 +15,7 @@ struct soc_device_attribute { const char *serial_number; const char *soc_id; const void *data; + const char *unique_id; }; /** |