Commit e4e92ee7 authored by Loic Poulain's avatar Loic Poulain Committed by David S. Miller

net: wwan: core: Add WWAN device index sysfs attribute

Add index sysfs attribute for WWAN devices. This index is used to
uniquely indentify and reference a WWAN device. 'index' is the
attribute name that other device classes use (wireless, v4l2-dev,
rfkill, etc...).
Signed-off-by: default avatarLoic Poulain <loic.poulain@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1b19b3f7
......@@ -63,6 +63,20 @@ struct wwan_port {
wait_queue_head_t waitqueue;
};
static ssize_t index_show(struct device *dev, struct device_attribute *attr, char *buf)
{
struct wwan_device *wwan = to_wwan_dev(dev);
return sprintf(buf, "%d\n", wwan->id);
}
static DEVICE_ATTR_RO(index);
static struct attribute *wwan_dev_attrs[] = {
&dev_attr_index.attr,
NULL,
};
ATTRIBUTE_GROUPS(wwan_dev);
static void wwan_dev_destroy(struct device *dev)
{
struct wwan_device *wwandev = to_wwan_dev(dev);
......@@ -74,6 +88,7 @@ static void wwan_dev_destroy(struct device *dev)
static const struct device_type wwan_dev_type = {
.name = "wwan_dev",
.release = wwan_dev_destroy,
.groups = wwan_dev_groups,
};
static int wwan_dev_parent_match(struct device *dev, const void *parent)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment