summaryrefslogtreecommitdiffstats
path: root/drivers/net/usb
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2021-01-28 18:00:29 -0800
committerJakub Kicinski <kuba@kernel.org>2021-01-28 18:00:29 -0800
commitbbe25b7d694846e8946e7aea6ac9d342a4e43345 (patch)
tree2415ebdefc29ea8efcef6edb69fe863d3dcb6739 /drivers/net/usb
parentd7a177ea8fe6fc6fe146639d63a45090de196498 (diff)
parentb4b91e24094ad54b3d176e3fd2997fae62a315dc (diff)
downloadlinux-bbe25b7d694846e8946e7aea6ac9d342a4e43345.tar.bz2
Merge branch 'net-usb-qmi_wwan-new-mux_id-sysfs-file'
Daniele Palmas says: ==================== net: usb: qmi_wwan: new mux_id sysfs file this patch series add a sysfs file to let userspace know which mux id has been used to create a qmimux network interface. I'm aware that adding new sysfs files is not usually the right path, but my understanding is that this piece of information can't be retrieved in any other way and its absence restricts how userspace application (e.g. like libqmi) can take advantage of the qmimux implementation in qmi_wwan. ==================== Link: https://lore.kernel.org/r/20210127153433.12237-1-dnlplm@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r--drivers/net/usb/qmi_wwan.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index b96a3dc775a4..29568ea8a9f2 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -218,6 +218,28 @@ skip:
return 1;
}
+static ssize_t mux_id_show(struct device *d, struct device_attribute *attr, char *buf)
+{
+ struct net_device *dev = to_net_dev(d);
+ struct qmimux_priv *priv;
+
+ priv = netdev_priv(dev);
+
+ return sysfs_emit(buf, "0x%02x\n", priv->mux_id);
+}
+
+static DEVICE_ATTR_RO(mux_id);
+
+static struct attribute *qmi_wwan_sysfs_qmimux_attrs[] = {
+ &dev_attr_mux_id.attr,
+ NULL,
+};
+
+static struct attribute_group qmi_wwan_sysfs_qmimux_attr_group = {
+ .name = "qmap",
+ .attrs = qmi_wwan_sysfs_qmimux_attrs,
+};
+
static int qmimux_register_device(struct net_device *real_dev, u8 mux_id)
{
struct net_device *new_dev;
@@ -240,6 +262,8 @@ static int qmimux_register_device(struct net_device *real_dev, u8 mux_id)
goto out_free_newdev;
}
+ new_dev->sysfs_groups[0] = &qmi_wwan_sysfs_qmimux_attr_group;
+
err = register_netdevice(new_dev);
if (err < 0)
goto out_free_newdev;