netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Daniele Palmas <dnlplm@gmail.com>
Cc: "Bjørn Mork" <bjorn@mork.no>,
	"David S . Miller" <davem@davemloft.net>,
	"Jakub Kicinski" <kuba@kernel.org>,
	netdev@vger.kernel.org, linux-usb@vger.kernel.org,
	"Aleksander Morgado" <aleksander@aleksander.es>
Subject: Re: [PATCH net-next 1/2] net: usb: qmi_wwan: add qmap id sysfs file for qmimux interfaces
Date: Wed, 27 Jan 2021 08:58:50 +0100	[thread overview]
Message-ID: <YBEdOlZIexe7niki@kroah.com> (raw)
In-Reply-To: <20210125152235.2942-2-dnlplm@gmail.com>

On Mon, Jan 25, 2021 at 04:22:34PM +0100, Daniele Palmas wrote:
> 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 <dnlplm@gmail.com>
> ---
>  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

  parent reply	other threads:[~2021-01-27  8:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25 15:22 [PATCH 0/2] net: usb: qmi_wwan: new mux_id sysfs file Daniele Palmas
2021-01-25 15:22 ` [PATCH net-next 1/2] net: usb: qmi_wwan: add qmap id sysfs file for qmimux interfaces Daniele Palmas
2021-01-25 16:14   ` Bjørn Mork
2021-01-27  2:02     ` Jakub Kicinski
2021-01-27  7:26       ` Bjørn Mork
2021-01-29  2:00         ` Jakub Kicinski
2021-01-25 16:33   ` Aleksander Morgado
2021-01-27  7:58   ` Greg KH [this message]
2021-01-25 15:22 ` [PATCH net-next 2/2] net: qmi_wwan: document qmap/mux_id sysfs file Daniele Palmas
2021-01-25 16:14   ` Bjørn Mork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YBEdOlZIexe7niki@kroah.com \
    --to=greg@kroah.com \
    --cc=aleksander@aleksander.es \
    --cc=bjorn@mork.no \
    --cc=davem@davemloft.net \
    --cc=dnlplm@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).