Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp405072rdb; Thu, 30 Nov 2023 07:51:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IGBRB4hecRd1HjmRZUSr8M4eMeb71NYOAKKqRF7rBjteHQuRcNQwiOE/cjyld5SebtJl9Hk X-Received: by 2002:a17:90b:1bd2:b0:285:da91:69c2 with SMTP id oa18-20020a17090b1bd200b00285da9169c2mr14344188pjb.45.1701359505003; Thu, 30 Nov 2023 07:51:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701359504; cv=none; d=google.com; s=arc-20160816; b=WH5ZC1TLgxVUJLuLEt6OKbj+MxmfgoK9zkOItwJma+dt0QobFB44y01pTx3WX1cHDm oV0wTXx3lKW/2IsX+xNOlbQbhNHjuumugPFwW93j0KMCp5pxUrQeMHIYB3pC0H5jlsTF OTgevCZaMPAU9aT8yk02/wdrbeu2gHU65hi5HJWlbF0YskX2cKICKEiiW6xEiP5bgiTe U3ks6s7+IBN2vfbjnqgDihaID8u9XSK40XJXqQQI/+sJLKGZzm+EdUGxzv0GgtT6KZtm vxrjRYtb0jYA9HZcM4OiaF7p5w7O7wsBSA438Qt6gf3r1J6nDeHbrvxzxAEWFccPsiza el4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=nYHScSNq3FEfjo+lbltV2Nrzug7N+XDTkHolzLf19HI=; fh=b5fBB3Vt6Kln9qw0GemVE9CkSNymu0gHw9CO48GOE28=; b=XYQxXNTRSn6n/8gI6HNbw2ewlmOXy2M0ELUbzdxiiLy3yLVh5NEXG23eRV6DRQJMm7 UfUnCAt13kUKMLbIYsqiVjzE7mnFvYTNo9QOG2ivNTHGxKcFO1RVNhodIuwQVWoQ31zM kV/BwuFCxwZrTuKGbgtjQiA+QbZLTQfD1muDJORITMYP7iYsFhUp+Z18ErxC/MFHE+qv lBlXTJUdRJ6bPFsB494Y6FMCfDuHc/HQ9CaeunX44R+8lILK88rqoVbvRLkBnioPtqES ONcJZLETjVxZ1+9H12a3ZmNCFXVQRqWYsGi/MZwfRu9psP4IOVijTIC3yjwLt0XxTSRX QrHQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id x20-20020a170902ea9400b001c9c9514db7si1343113plb.604.2023.11.30.07.51.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 07:51:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id EFE25807FCF9; Thu, 30 Nov 2023 07:50:40 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346430AbjK3PuI (ORCPT + 99 others); Thu, 30 Nov 2023 10:50:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346424AbjK3PuG (ORCPT ); Thu, 30 Nov 2023 10:50:06 -0500 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 8476310F8 for ; Thu, 30 Nov 2023 07:50:09 -0800 (PST) Received: (qmail 250227 invoked by uid 1000); 30 Nov 2023 10:50:08 -0500 Date: Thu, 30 Nov 2023 10:50:08 -0500 From: Alan Stern To: Jose Ignacio Tornos Martinez Cc: oneukum@suse.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, netdev@vger.kernel.org, pabeni@redhat.com Subject: Re: [PATCH] net: usb: ax88179_178a: avoid failed operations when device is disconnected Message-ID: References: <51cb747a-21fe-4b3b-9567-01b9cc9d8873@rowland.harvard.edu> <20231130084136.172052-1-jtornosm@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231130084136.172052-1-jtornosm@redhat.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 30 Nov 2023 07:50:41 -0800 (PST) On Thu, Nov 30, 2023 at 09:41:36AM +0100, Jose Ignacio Tornos Martinez wrote: > Hi Oliver, > > > I am sorry, but this is a layering violation. You are looking > > at an internal state of the USB layer to surpress logging > > -ENODEV. If you think these messages should go away, filter > > for ENODEV where they are generated. > Thank you for your comments and suggestion. > My intention was also to avoid unnecessary and failed operations > if disconnection was detected. What are these unnecessary operations? > Ok, let me research more and do better. > > Hi Alan, > > > In addition, you should be more careful about the distinction between > > "unbound" and "disconnected". It's possible for the driver to be > > unbound from the device even while the device is still plugged in. In > > this situation, submitting URBs will fail with an error even though the > > device state isn't USB_STATE_NOTATTACHED. > Thank you for you comments. > I also tested "unbound" and stop and unbind operations were correctly > executed. I just wanted to avoid the issues during disconnection, if other > operations are commanded later I think it is better to warn. In general, drivers should treat "unbind" the same as "disconnect" (in both cases, the ->disconnect() routine is called). If a driver tries to send commands to the device while the disconnect routine is running, it should expect that they might fail and not generate an error message if they do. (Also, note that the USB core will allow a driver to send commands to the device during unbind only if the .soft_unbind flag is set in the usb_driver structure.) And in any case, a driver should _never_ try to communicate with the device after the disconnect routine has returned. Alan Stern