* [PATCH] xen: export device state to sysfs
@ 2018-08-27 18:44 Joe Jin
2018-08-28 6:30 ` Juergen Gross
2018-08-28 6:30 ` Juergen Gross
0 siblings, 2 replies; 4+ messages in thread
From: Joe Jin @ 2018-08-27 18:44 UTC (permalink / raw)
To: Boris Ostrovsky, Juergen Gross; +Cc: linux-kernel, xen-devel, Joe Jin
Export device state to sysfs to allow for easier get device state.
Signed-off-by: Joe Jin <joe.jin@oracle.com>
Boris Ostrovsky <boris.ostrovsky@oracle.com>
Juergen Gross <jgross@suse.com>
---
drivers/xen/xenbus/xenbus_probe.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
index 74888cacd0b0..52f99b80a1c0 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -402,10 +402,19 @@ static ssize_t modalias_show(struct device *dev,
}
static DEVICE_ATTR_RO(modalias);
+static ssize_t state_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ return sprintf(buf, "%s\n",
+ xenbus_strstate(to_xenbus_device(dev)->state));
+}
+static DEVICE_ATTR_RO(state);
+
static struct attribute *xenbus_dev_attrs[] = {
&dev_attr_nodename.attr,
&dev_attr_devtype.attr,
&dev_attr_modalias.attr,
+ &dev_attr_state.attr,
NULL,
};
--
2.15.2 (Apple Git-101.1)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] xen: export device state to sysfs
2018-08-27 18:44 [PATCH] xen: export device state to sysfs Joe Jin
2018-08-28 6:30 ` Juergen Gross
@ 2018-08-28 6:30 ` Juergen Gross
1 sibling, 0 replies; 4+ messages in thread
From: Juergen Gross @ 2018-08-28 6:30 UTC (permalink / raw)
To: Joe Jin, Boris Ostrovsky; +Cc: linux-kernel, xen-devel
On 27/08/18 20:44, Joe Jin wrote:
> Export device state to sysfs to allow for easier get device state.
>
> Signed-off-by: Joe Jin <joe.jin@oracle.com>
> Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Juergen Gross <jgross@suse.com>
Please add the related documentation to
Documentation/ABI/stable/sysfs-bus-xen-backend
Juergen
> ---
> drivers/xen/xenbus/xenbus_probe.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
> index 74888cacd0b0..52f99b80a1c0 100644
> --- a/drivers/xen/xenbus/xenbus_probe.c
> +++ b/drivers/xen/xenbus/xenbus_probe.c
> @@ -402,10 +402,19 @@ static ssize_t modalias_show(struct device *dev,
> }
> static DEVICE_ATTR_RO(modalias);
>
> +static ssize_t state_show(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + return sprintf(buf, "%s\n",
> + xenbus_strstate(to_xenbus_device(dev)->state));
> +}
> +static DEVICE_ATTR_RO(state);
> +
> static struct attribute *xenbus_dev_attrs[] = {
> &dev_attr_nodename.attr,
> &dev_attr_devtype.attr,
> &dev_attr_modalias.attr,
> + &dev_attr_state.attr,
> NULL,
> };
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] xen: export device state to sysfs
2018-08-27 18:44 [PATCH] xen: export device state to sysfs Joe Jin
@ 2018-08-28 6:30 ` Juergen Gross
2018-08-28 6:30 ` Juergen Gross
1 sibling, 0 replies; 4+ messages in thread
From: Juergen Gross @ 2018-08-28 6:30 UTC (permalink / raw)
To: Joe Jin, Boris Ostrovsky; +Cc: xen-devel, linux-kernel
On 27/08/18 20:44, Joe Jin wrote:
> Export device state to sysfs to allow for easier get device state.
>
> Signed-off-by: Joe Jin <joe.jin@oracle.com>
> Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Juergen Gross <jgross@suse.com>
Please add the related documentation to
Documentation/ABI/stable/sysfs-bus-xen-backend
Juergen
> ---
> drivers/xen/xenbus/xenbus_probe.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
> index 74888cacd0b0..52f99b80a1c0 100644
> --- a/drivers/xen/xenbus/xenbus_probe.c
> +++ b/drivers/xen/xenbus/xenbus_probe.c
> @@ -402,10 +402,19 @@ static ssize_t modalias_show(struct device *dev,
> }
> static DEVICE_ATTR_RO(modalias);
>
> +static ssize_t state_show(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + return sprintf(buf, "%s\n",
> + xenbus_strstate(to_xenbus_device(dev)->state));
> +}
> +static DEVICE_ATTR_RO(state);
> +
> static struct attribute *xenbus_dev_attrs[] = {
> &dev_attr_nodename.attr,
> &dev_attr_devtype.attr,
> &dev_attr_modalias.attr,
> + &dev_attr_state.attr,
> NULL,
> };
>
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] xen: export device state to sysfs
@ 2018-08-27 18:44 Joe Jin
0 siblings, 0 replies; 4+ messages in thread
From: Joe Jin @ 2018-08-27 18:44 UTC (permalink / raw)
To: Boris Ostrovsky, Juergen Gross; +Cc: xen-devel, Joe Jin, linux-kernel
Export device state to sysfs to allow for easier get device state.
Signed-off-by: Joe Jin <joe.jin@oracle.com>
Boris Ostrovsky <boris.ostrovsky@oracle.com>
Juergen Gross <jgross@suse.com>
---
drivers/xen/xenbus/xenbus_probe.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
index 74888cacd0b0..52f99b80a1c0 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -402,10 +402,19 @@ static ssize_t modalias_show(struct device *dev,
}
static DEVICE_ATTR_RO(modalias);
+static ssize_t state_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ return sprintf(buf, "%s\n",
+ xenbus_strstate(to_xenbus_device(dev)->state));
+}
+static DEVICE_ATTR_RO(state);
+
static struct attribute *xenbus_dev_attrs[] = {
&dev_attr_nodename.attr,
&dev_attr_devtype.attr,
&dev_attr_modalias.attr,
+ &dev_attr_state.attr,
NULL,
};
--
2.15.2 (Apple Git-101.1)
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-08-28 6:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-27 18:44 [PATCH] xen: export device state to sysfs Joe Jin
2018-08-28 6:30 ` Juergen Gross
2018-08-28 6:30 ` Juergen Gross
-- strict thread matches above, loose matches on Subject: below --
2018-08-27 18:44 Joe Jin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.