[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <83c51a99-038d-4283-9a39-97129966a500@gmail.com>
Date: Wed, 7 Jan 2026 03:06:05 +0200
From: Sergey Ryazanov <ryazanov.s.a@...il.com>
To: Slark Xiao <slark_xiao@....com>, loic.poulain@....qualcomm.com,
johannes@...solutions.net
Cc: andrew+netdev@...n.ch, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, mani@...nel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, Daniele Palmas <dnlplm@...il.com>
Subject: Re: [net-next v4 7/8] net: wwan: prevent premature device unregister
when NMEA port is present
Hi Slark, Loic,
sorry for late joining the discussion, please find a design question below.
On 1/5/26 12:20, Slark Xiao wrote:
> From: Loic Poulain <loic.poulain@....qualcomm.com>
>
> The WWAN core unregisters the device when it has no remaining WWAN ops
> or child devices. For NMEA port types, the child is registered under
> the GNSS class instead of WWAN, so the core incorrectly assumes there
> are no children and unregisters the WWAN device too early. This leads
> to a second unregister attempt after the NMEA device is removed.
>
> To fix this issue, we register a virtual WWAN port device along the
> GNSS device, this ensures the WWAN device remains registered until
> all associated ports, including NMEA, are properly removed.
wwan core assumes whole responsibility for managing a WWAN device. We
already use wwan_create_dev()/wwan_remove_dev() everywhere. But, we are
checking the reminding references in an implicit way using
device_for_each_child() and registered OPS existence. Thus, we need this
trick with a virtual child port.
Does it make sense to switch to an explicit reference counting? We can
introduce such counter to the wwan_device structure, and
increment/decrement it on every wwan_create_dev()/wwan_remove_dev()
call. So, we will do device_unregister() upon reference number becoming
zero.
If it sounds promising, I can send a RFC, let's say, tomorrow.
--
Sergey
Powered by blists - more mailing lists