netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] wwan: core: add print for wwan port attach/disconnect
@ 2023-04-12 11:44 Slark Xiao
  2023-04-13  7:07 ` Loic Poulain
  2023-04-13 16:10 ` Jakub Kicinski
  0 siblings, 2 replies; 5+ messages in thread
From: Slark Xiao @ 2023-04-12 11:44 UTC (permalink / raw)
  To: loic.poulain, ryazanov.s.a, johannes, davem, edumazet, kuba, pabeni
  Cc: netdev, linux-kernel, Slark Xiao

Refer to USB serial device or net device, there is notice to
let end user know the status of device, like attached or
disconnected. Add attach/disconnect print for wwan device as
well. This change works for MHI device and USB device.

Signed-off-by: Slark Xiao <slark_xiao@163.com>
---
 drivers/net/wwan/wwan_core.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/wwan/wwan_core.c b/drivers/net/wwan/wwan_core.c
index 2e1c01cf00a9..d3ac6c5b0b26 100644
--- a/drivers/net/wwan/wwan_core.c
+++ b/drivers/net/wwan/wwan_core.c
@@ -492,6 +492,8 @@ struct wwan_port *wwan_create_port(struct device *parent,
 	if (err)
 		goto error_put_device;
 
+	dev_info(&wwandev->dev, "%s converter now attached to %s\n",
+		 wwan_port_dev_type.name, port->dev.kobj.name);
 	return port;
 
 error_put_device:
@@ -517,6 +519,9 @@ void wwan_remove_port(struct wwan_port *port)
 
 	skb_queue_purge(&port->rxq);
 	dev_set_drvdata(&port->dev, NULL);
+
+	dev_info(&wwandev->dev, "%s converter now disconnected from %s\n",
+		 wwan_port_dev_type.name, port->dev.kobj.name);
 	device_unregister(&port->dev);
 
 	/* Release related wwan device */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net] wwan: core: add print for wwan port attach/disconnect
  2023-04-12 11:44 [PATCH net] wwan: core: add print for wwan port attach/disconnect Slark Xiao
@ 2023-04-13  7:07 ` Loic Poulain
  2023-04-13  7:25   ` Slark Xiao
  2023-04-13 16:10 ` Jakub Kicinski
  1 sibling, 1 reply; 5+ messages in thread
From: Loic Poulain @ 2023-04-13  7:07 UTC (permalink / raw)
  To: Slark Xiao
  Cc: ryazanov.s.a, johannes, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel

On Wed, 12 Apr 2023 at 13:45, Slark Xiao <slark_xiao@163.com> wrote:
>
> Refer to USB serial device or net device, there is notice to
> let end user know the status of device, like attached or
> disconnected. Add attach/disconnect print for wwan device as
> well. This change works for MHI device and USB device.

This change works for wwan port devices, whatever the bus is.

>
> Signed-off-by: Slark Xiao <slark_xiao@163.com>
> ---
>  drivers/net/wwan/wwan_core.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/net/wwan/wwan_core.c b/drivers/net/wwan/wwan_core.c
> index 2e1c01cf00a9..d3ac6c5b0b26 100644
> --- a/drivers/net/wwan/wwan_core.c
> +++ b/drivers/net/wwan/wwan_core.c
> @@ -492,6 +492,8 @@ struct wwan_port *wwan_create_port(struct device *parent,
>         if (err)
>                 goto error_put_device;
>
> +       dev_info(&wwandev->dev, "%s converter now attached to %s\n",
> +                wwan_port_dev_type.name, port->dev.kobj.name);

You should use `dev_name()` instead of direct reference to kobj.

Why 'converter' ? If you really want to print, it should be something like:
wwan0: wwan0at1 port attached

>         return port;
>
>  error_put_device:
> @@ -517,6 +519,9 @@ void wwan_remove_port(struct wwan_port *port)
>
>         skb_queue_purge(&port->rxq);
>         dev_set_drvdata(&port->dev, NULL);
> +
> +       dev_info(&wwandev->dev, "%s converter now disconnected from %s\n",
> +                wwan_port_dev_type.name, port->dev.kobj.name);
>         device_unregister(&port->dev);
>
>         /* Release related wwan device */
> --
> 2.34.1
>

Regards,
Loic

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re:Re: [PATCH net] wwan: core: add print for wwan port attach/disconnect
  2023-04-13  7:07 ` Loic Poulain
@ 2023-04-13  7:25   ` Slark Xiao
  2023-04-13 17:12     ` Loic Poulain
  0 siblings, 1 reply; 5+ messages in thread
From: Slark Xiao @ 2023-04-13  7:25 UTC (permalink / raw)
  To: Loic Poulain
  Cc: ryazanov.s.a, johannes, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel

At 2023-04-13 15:07:21, "Loic Poulain" <loic.poulain@linaro.org> wrote:
>On Wed, 12 Apr 2023 at 13:45, Slark Xiao <slark_xiao@163.com> wrote:
>>
>> Refer to USB serial device or net device, there is notice to
>> let end user know the status of device, like attached or
>> disconnected. Add attach/disconnect print for wwan device as
>> well. This change works for MHI device and USB device.
>
>This change works for wwan port devices, whatever the bus is.
>
Sure. Since wwan support USB device as well after integrating
WWAN framework into cdc-wdm.
>>
>> Signed-off-by: Slark Xiao <slark_xiao@163.com>
>> ---
>>  drivers/net/wwan/wwan_core.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/net/wwan/wwan_core.c b/drivers/net/wwan/wwan_core.c
>> index 2e1c01cf00a9..d3ac6c5b0b26 100644
>> --- a/drivers/net/wwan/wwan_core.c
>> +++ b/drivers/net/wwan/wwan_core.c
>> @@ -492,6 +492,8 @@ struct wwan_port *wwan_create_port(struct device *parent,
>>         if (err)
>>                 goto error_put_device;
>>
>> +       dev_info(&wwandev->dev, "%s converter now attached to %s\n",
>> +                wwan_port_dev_type.name, port->dev.kobj.name);
>
>You should use `dev_name()` instead of direct reference to kobj.
>
Will update this in v2.
>Why 'converter' ? If you really want to print, it should be something like:
>wwan0: wwan0at1 port attached
This refer to USB device attached info:
  696.444511] usb 2-3: GSM modem (1-port) converter now attached to ttyUSB0
[  696.444877] usb 2-3: GSM modem (1-port) converter now attached to ttyUSB1
[  696.445065] usb 2-3: GSM modem (1-port) converter now attached to ttyUSB2
currently, we will print it as below with above patch:
[  233.192123] wwan wwan0: wwan_port converter now attached to wwan0mbim0
[  694.530781] wwan wwan0: wwan_port converter now disconnected from wwan0mbim0
>
>>         return port;
>>
>>  error_put_device:
>> @@ -517,6 +519,9 @@ void wwan_remove_port(struct wwan_port *port)
>>
>>         skb_queue_purge(&port->rxq);
>>         dev_set_drvdata(&port->dev, NULL);
>> +
>> +       dev_info(&wwandev->dev, "%s converter now disconnected from %s\n",
>> +                wwan_port_dev_type.name, port->dev.kobj.name);
>>         device_unregister(&port->dev);
>>
>>         /* Release related wwan device */
>> --
>> 2.34.1
>>
>
>Regards,
>Loic

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] wwan: core: add print for wwan port attach/disconnect
  2023-04-12 11:44 [PATCH net] wwan: core: add print for wwan port attach/disconnect Slark Xiao
  2023-04-13  7:07 ` Loic Poulain
@ 2023-04-13 16:10 ` Jakub Kicinski
  1 sibling, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2023-04-13 16:10 UTC (permalink / raw)
  To: Slark Xiao
  Cc: loic.poulain, ryazanov.s.a, johannes, davem, edumazet, pabeni,
	netdev, linux-kernel

On Wed, 12 Apr 2023 19:44:02 +0800 Slark Xiao wrote:
> Subject: [PATCH net] wwan: core: add print for wwan port attach/disconnect

Subject should contain [PATCH net-next], "net" is for fixes.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: [PATCH net] wwan: core: add print for wwan port attach/disconnect
  2023-04-13  7:25   ` Slark Xiao
@ 2023-04-13 17:12     ` Loic Poulain
  0 siblings, 0 replies; 5+ messages in thread
From: Loic Poulain @ 2023-04-13 17:12 UTC (permalink / raw)
  To: Slark Xiao
  Cc: ryazanov.s.a, johannes, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel

On Thu, 13 Apr 2023 at 09:26, Slark Xiao <slark_xiao@163.com> wrote:
>
> At 2023-04-13 15:07:21, "Loic Poulain" <loic.poulain@linaro.org> wrote:
> >On Wed, 12 Apr 2023 at 13:45, Slark Xiao <slark_xiao@163.com> wrote:
> >>
> >> Refer to USB serial device or net device, there is notice to
> >> let end user know the status of device, like attached or
> >> disconnected. Add attach/disconnect print for wwan device as
> >> well. This change works for MHI device and USB device.
> >
> >This change works for wwan port devices, whatever the bus is.
> >
> Sure. Since wwan support USB device as well after integrating
> WWAN framework into cdc-wdm.
> >>
> >> Signed-off-by: Slark Xiao <slark_xiao@163.com>
> >> ---
> >>  drivers/net/wwan/wwan_core.c | 5 +++++
> >>  1 file changed, 5 insertions(+)
> >>
> >> diff --git a/drivers/net/wwan/wwan_core.c b/drivers/net/wwan/wwan_core.c
> >> index 2e1c01cf00a9..d3ac6c5b0b26 100644
> >> --- a/drivers/net/wwan/wwan_core.c
> >> +++ b/drivers/net/wwan/wwan_core.c
> >> @@ -492,6 +492,8 @@ struct wwan_port *wwan_create_port(struct device *parent,
> >>         if (err)
> >>                 goto error_put_device;
> >>
> >> +       dev_info(&wwandev->dev, "%s converter now attached to %s\n",
> >> +                wwan_port_dev_type.name, port->dev.kobj.name);
> >
> >You should use `dev_name()` instead of direct reference to kobj.
> >
> Will update this in v2.
> >Why 'converter' ? If you really want to print, it should be something like:
> >wwan0: wwan0at1 port attached
> This refer to USB device attached info:
>   696.444511] usb 2-3: GSM modem (1-port) converter now attached to ttyUSB0
> [  696.444877] usb 2-3: GSM modem (1-port) converter now attached to ttyUSB1
> [  696.445065] usb 2-3: GSM modem (1-port) converter now attached to ttyUSB2
> currently, we will print it as below with above patch:
> [  233.192123] wwan wwan0: wwan_port converter now attached to wwan0mbim0
> [  694.530781] wwan wwan0: wwan_port converter now disconnected from wwan0mbim0

Ok, but we don't have to mimic USB, and it's not a converter, keep
that simple (e.g. 'port %s attached').

Regards,
Loic

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-04-13 17:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-12 11:44 [PATCH net] wwan: core: add print for wwan port attach/disconnect Slark Xiao
2023-04-13  7:07 ` Loic Poulain
2023-04-13  7:25   ` Slark Xiao
2023-04-13 17:12     ` Loic Poulain
2023-04-13 16:10 ` Jakub Kicinski

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).