diff options
authorSuman Anna2019-08-09 17:20:57 -0500
committerSuman Anna2019-09-03 12:08:14 -0500
commit71d09746b3937a442e18c1c68b73820c1c3797fe (patch)
parent80e8ce38b7ad087765b21cecbd39ffd1dd820905 (diff)
remoteproc: Add a sysfs interface for name
[ Upstream commit 6ed756aa0148a5ad0dbdced6f14f22e2f5748d35 ] This patch adds a sysfs interface that provides the name of the remote processor to userspace. This allows the userspace to identify a remote processor as the remoteproc devices themselves are created based on probe order and can change from one boot to another or at runtime. The name is made available in debugfs originally, and is being retained for now. This can be cleaned up after couple of releases once users get familiar with the new interface. [s-anna@ti.com: cherry-pick commit '6ed756aa0148' from v5.4] Signed-off-by: Suman Anna <s-anna@ti.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2 files changed, 21 insertions, 0 deletions
diff --git a/Documentation/ABI/testing/sysfs-class-remoteproc b/Documentation/ABI/testing/sysfs-class-remoteproc
index c3afe9fab646..36094fbeb974 100644
--- a/Documentation/ABI/testing/sysfs-class-remoteproc
+++ b/Documentation/ABI/testing/sysfs-class-remoteproc
@@ -48,3 +48,13 @@ Description: Remote processor state
48 48
49 Writing "stop" will attempt to halt the remote processor and 49 Writing "stop" will attempt to halt the remote processor and
50 return it to the "offline" state. 50 return it to the "offline" state.
52What: /sys/class/remoteproc/.../name
53Date: August 2019
54KernelVersion: 5.4
55Contact: Suman Anna <s-anna@ti.com>
56Description: Remote processor name
58 Reports the name of the remote processor. This can be used by
59 userspace in exactly identifying a remote processor and ease
60 up the usage in modifying the 'firmware' or 'state' files.
diff --git a/drivers/remoteproc/remoteproc_sysfs.c b/drivers/remoteproc/remoteproc_sysfs.c
index 0c47bc0bb36a..f99c7607cdce 100644
--- a/drivers/remoteproc/remoteproc_sysfs.c
+++ b/drivers/remoteproc/remoteproc_sysfs.c
@@ -115,9 +115,20 @@ static ssize_t state_store(struct device *dev,
115} 115}
116static DEVICE_ATTR_RW(state); 116static DEVICE_ATTR_RW(state);
117 117
118/* Expose the name of the remote processor via sysfs */
119static ssize_t name_show(struct device *dev, struct device_attribute *attr,
120 char *buf)
122 struct rproc *rproc = to_rproc(dev);
124 return sprintf(buf, "%s\n", rproc->name);
126static DEVICE_ATTR_RO(name);
118static struct attribute *rproc_attrs[] = { 128static struct attribute *rproc_attrs[] = {
119 &dev_attr_firmware.attr, 129 &dev_attr_firmware.attr,
120 &dev_attr_state.attr, 130 &dev_attr_state.attr,
131 &dev_attr_name.attr,
121 NULL 132 NULL
122}; 133};
123 134