From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1257917D6 for ; Wed, 7 Jan 2026 01:05:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.68 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767747957; cv=none; b=XyLtVliwZ6w6naavsQMMBxkvMPQwHUsyfnJGYCT5wHDC4JHq7z63T/aCk5pI8BpLCFumYcUPSEy2p6ox3ndYir+wNIckrbqC72P+YKgKElavwFJk6A0BFFWiT/ojVBMxsPn/O83/yKd0aDfi9WIw16WW1WqAO82PnabmGIICfvU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767747957; c=relaxed/simple; bh=3D/Z/R3tHFXur5aFsTPzJ9pnmJyxUWXGhoE+JwfEF98=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=itUhSKHOIg1MwMHwuLinw7IWqyJyHAsbvjz4bYHg7ej5ZGEP/aK8oKl5PFkkbWuXHuH5hbTqVauTEbLYpzgPNglsPsR3pjppFJfnA3g+YeudDYTAeLhdRwXE21v+Zs1/1R1mqQ3P6Kkfyp+tSi+0ETDlOHzPerbcBjeJvxAls7I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UShakIsv; arc=none smtp.client-ip=209.85.128.68 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UShakIsv" Received: by mail-wm1-f68.google.com with SMTP id 5b1f17b1804b1-47d63594f7eso9392145e9.0 for ; Tue, 06 Jan 2026 17:05:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767747954; x=1768352754; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=fZ7z6k/mdg3aeb4UUXHS8N+QdziURsYk9wSHDGAPWlA=; b=UShakIsvSmWBM1FiONLo4pjkFSo7qEBdsp+x7mIZ0HTTz5NTpEAk8nEL/tc9o1RI3M RZHY8Cw3kNzy4CyAZrwIXBDKUvaceZUFr8ZTjV20Qzz7xYIGTgJV1MFq7tgsIvEMvoAk gH2Z5jMDY+ZsdyplNrkFIGdrN9D5s+LFGiygr4MvGBEktOb+X8t69IesNCxq3TNvnbPM IuAcpTXX07lSiWUCjS1ybhUDbcel7YMvORSbEsApDDGcOexv6dTlTp20o3NwU0+bx12b DkUwgKP2fXATN9n1JvtiMzNBBS9ibJkoOg1MF0Uvse9sQ1JsRi1OS+BO7Up5IXCzJIUl 8Ywg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767747954; x=1768352754; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fZ7z6k/mdg3aeb4UUXHS8N+QdziURsYk9wSHDGAPWlA=; b=kN8RY3sMwSfxIeQMlZYyClp4uYe0u0rLCv/6kmFtohEjokg0oDd7SEpItCI4ETreTI IiF4AzqdtT1KV2WCFoHtwhDB2oOan+9YSMqT9wusnUzW9YHyS6m/XCUvrYJysdZfxyn9 1e2uSM5yThvLTyaANR4y3aA9KNeoPCwN50TjThtwEbK+bwL2sb8e701f6iyVHHRvWO12 1cYbo4Rt616H5uBpfRgGdrWq/7C9DvE//OH70fRxMsxemOQ81tlIgoXFg6hBBV4PDjrT AA9uL0QnPA00wTvVI5jbg+8GVscR0N84IVvfQM9hJdajmEAehapB6DzOSpQRBYcDWwOz mzDQ== X-Forwarded-Encrypted: i=1; AJvYcCWx9mP1CHcS0ydUdVrM//NAy09RS555Q9mkbfSkJwmV0FJy3vG+VmY+xTgn3IMy74pK1L/WH9j6xhP68xI=@vger.kernel.org X-Gm-Message-State: AOJu0Yzep6dBW/4Z1RptbUw+ISofzO/impnbntIlvCPWgSkLsBW7+qP/ Dh5rHFY7B1ibNMbshIhALgHQskfDwzXFqOinHO9wtBzn6VLWSOpMrFz3 X-Gm-Gg: AY/fxX4ese6GZoFrtZ4vS1BGtJzR1af70zhwwKMx/5kT642ZqV+qww/LXt8Qo8zPGEy p5p0UpAHaBYuXghjwr3Q64m5P4XGa9BhW0bcnNyS0JerDS9ZtDwgIbghMeS0av5leX9HwMOg8Im IQu3vEuq57+CkTbJK3rUy0tCRsZWfTbbj8SC7ebcwXcxP/ZjQ2QNRVt3kd+G/TInvvwV8y9uSSb CQpqiAFiptmLx6e1Eucd8kvcaxp0LWx9jyrdhczVXP8UpiUEwSvuGuvxi3+9c3Bl01XJ7yut6SZ CFYO0gFtjizyVsUASDsFC0zRqPwWKFwHK4ie6Z1dRmUNpKszPDy14W/7jYEgNgTqx5SAzgmnHQW GqoBYU4kvPVb8QGhjrRxTJi2cTnspMwMbj/zQ7JuY5+6QPZFXC15ozW8pwyLxOtfAW05umj+hON jdKjIODqMdx/hlqQ9Lhq8BpYHt X-Google-Smtp-Source: AGHT+IERDNJCq8k87UVbW0RyawA/iHoAcxUbYcwO0//cg7ECWUBahAJU1pWM60NUKnflNKLsh6+jQA== X-Received: by 2002:a05:600c:b86:b0:479:3a86:dc1e with SMTP id 5b1f17b1804b1-47d84b41007mr7537025e9.36.1767747954236; Tue, 06 Jan 2026 17:05:54 -0800 (PST) Received: from [192.168.0.2] ([212.50.121.5]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47d7fb65ed7sm27843825e9.19.2026.01.06.17.05.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Jan 2026 17:05:53 -0800 (PST) Message-ID: <83c51a99-038d-4283-9a39-97129966a500@gmail.com> Date: Wed, 7 Jan 2026 03:06:05 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [net-next v4 7/8] net: wwan: prevent premature device unregister when NMEA port is present To: Slark Xiao , loic.poulain@oss.qualcomm.com, johannes@sipsolutions.net Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mani@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Daniele Palmas References: <20260105102018.62731-1-slark_xiao@163.com> <20260105102018.62731-8-slark_xiao@163.com> Content-Language: en-US From: Sergey Ryazanov In-Reply-To: <20260105102018.62731-8-slark_xiao@163.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 > > 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