Thread (5 messages) flat view 5 messages, 3 authors, 2021-01-27

Re: [PATCH net-next 1/2] net: usb: qmi_wwan: add qmap id sysfs file for qmimux interfaces

From: Greg KH <hidden>
Date: 2021-01-27 08:16:53
Also in: linux-usb

On Mon, Jan 25, 2021 at 04:22:34PM +0100, Daniele Palmas wrote:
quoted hunk ↗ jump to hunk
Add qmimux interface sysfs file qmap/mux_id to show qmap id set
during the interface creation, in order to provide a method for
userspace to associate QMI control channels to network interfaces.

Signed-off-by: Daniele Palmas <redacted>
---
 drivers/net/usb/qmi_wwan.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 7ea113f51074..9b85e2ed4760 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -218,6 +218,31 @@ static int qmimux_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
 	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;
+	ssize_t count = 0;
+
+	priv = netdev_priv(dev);
+	count += scnprintf(&buf[count], PAGE_SIZE - count,
+			   "0x%02x\n", priv->mux_id);
Odd way to do this, please just use sysfs_emit().  It looks like you
cut/pasted this from some other more complex logic.

thanks,

greg k-h
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help