Merge branch 'for-linus' into for-next
[linux-2.6-microblaze.git] / drivers / remoteproc / remoteproc_sysfs.c
index 52b8713..eea514c 100644 (file)
@@ -15,8 +15,20 @@ static ssize_t firmware_show(struct device *dev, struct device_attribute *attr,
                          char *buf)
 {
        struct rproc *rproc = to_rproc(dev);
-
-       return sprintf(buf, "%s\n", rproc->firmware);
+       const char *firmware = rproc->firmware;
+
+       /*
+        * If the remote processor has been started by an external
+        * entity we have no idea of what image it is running.  As such
+        * simply display a generic string rather then rproc->firmware.
+        *
+        * Here we rely on the autonomous flag because a remote processor
+        * may have been attached to and currently in a running state.
+        */
+       if (rproc->autonomous)
+               firmware = "unknown";
+
+       return sprintf(buf, "%s\n", firmware);
 }
 
 /* Change firmware name via sysfs */
@@ -72,6 +84,7 @@ static const char * const rproc_state_string[] = {
        [RPROC_RUNNING]         = "running",
        [RPROC_CRASHED]         = "crashed",
        [RPROC_DELETED]         = "deleted",
+       [RPROC_DETACHED]        = "detached",
        [RPROC_LAST]            = "invalid",
 };