Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6917684rwb; Mon, 12 Dec 2022 07:56:58 -0800 (PST) X-Google-Smtp-Source: AA0mqf7yfGcsZfxQhOxMYdZ3iRgaxttEoRaFomdGG5A2yp2vkSNvzP1Zf1qn0x2a59SMIbGz+jfc X-Received: by 2002:a05:6402:550d:b0:461:cdfb:3056 with SMTP id fi13-20020a056402550d00b00461cdfb3056mr14044805edb.20.1670860617971; Mon, 12 Dec 2022 07:56:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670860617; cv=none; d=google.com; s=arc-20160816; b=SIaUxFmEB0aq3E4ZsuGL/UtjqJZ3alt/01HnD6ji4JtelgoDvGfJmziqG97dah5011 c9bMSz2Z+zBEHcTh90mt5kQUYXFLNvMYX+7az5Hla3GLZzhYSekt3ct5OBms8CDEX1UT LYkXQJysrNZG1IEXu1o51/vEAi4Zo7KCJRWViYiqf4dpWqLFzc+SutLp3OW/3LwRwSVa Wp7i/PUC1z4XLkR4gN1eASgswjkKUMiA9gUNa/AMy7nv9Tsg7nYgbmSnTdcvoMr++HD0 41NbpNwLoPQOXsPlMZFrPlLF/QMqCH3m6wkpmooDKIbSza/CnePmS60r/iBLrT1TTSWU n8XA== 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=JvTseSCnZBI2qChuvoVr6BnRBIi74IK85GlPoaWvCT4=; b=cG1xMCGIO2s2Mcna75jhHd78KywDN28gF3KnSd1xvCZc0Q6z6+VW8gcJTvy0+sBuVU C/TbR5yMwP4PVtOtm/eBuDAe5V/e7RxLfI2loSpYAr9B1VO18bZNlWN9Dtt0/hOz6xTX XVH1mPSBq9CTHA2HcIdduL+jI8/4a63jQEEzz1/qIheiU0WditDMbEQpHfkVw90rstln g8kurctanzhRZb0yiIpchN7Lp+NDxzESZEZlo+AmDNSOB783kogJEbZz3KOgfM068uTW foHcAU6yDEKpC0shUeXsf+5eNfABufJVa66TtIyoq+gvstOH6aVA9JeBApqB8ZE5ts4E BbMA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w5-20020a05640234c500b0046b9715162asi9248041edc.6.2022.12.12.07.56.39; Mon, 12 Dec 2022 07:56:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232432AbiLLPZa (ORCPT + 74 others); Mon, 12 Dec 2022 10:25:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231757AbiLLPZ1 (ORCPT ); Mon, 12 Dec 2022 10:25:27 -0500 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 4A732FADA for ; Mon, 12 Dec 2022 07:25:26 -0800 (PST) Received: (qmail 854837 invoked by uid 1000); 12 Dec 2022 10:25:25 -0500 Date: Mon, 12 Dec 2022 10:25:25 -0500 From: Alan Stern To: Johan Hovold Cc: Oliver Neukum , Greg Kroah-Hartman , Vincent Mailhol , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] USB: drop misleading usb_set_intfdata() kernel doc Message-ID: References: <20221211120626.12210-1-johan@kernel.org> <4cf7bce3-dfbb-b064-9d91-27616bf11d6a@suse.com> <2a2935e6-ae3c-85d9-a2e9-f42fb4ca7d59@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 12, 2022 at 03:14:49PM +0100, Johan Hovold wrote: > On Mon, Dec 12, 2022 at 03:04:50PM +0100, Oliver Neukum wrote: > > > > > > On 12.12.22 14:40, Johan Hovold wrote: > > > On Mon, Dec 12, 2022 at 02:27:46PM +0100, Oliver Neukum wrote: > > >> On 12.12.22 14:14, Johan Hovold wrote: > > >>> On Mon, Dec 12, 2022 at 12:13:54PM +0100, Oliver Neukum wrote: > > > > > >>> And in this case there was also no kernel doc for usb_get_intfdata() > > >>> which is equally self documenting. Why add redundant docs for only one > > >>> of these functions? > > >> > > >> Because knowing that one of them exists makes the other much more > > >> obvious. > > > > > > I doubt anyone finds out about this function by reading generated kernel > > > documentation. You look at a driver, grep the function and look at the > > > single-line implementation. > > > > Look, we cannot solve the issue whether kerneldoc is a good idea > > in general here. If you want to open that can of worms on lkml, > > by all means. go for it. > > But failing that, silently eliminating it is just not nice. > > It was just added. It's mostly misleading and incorrect. Hence revert, > rather than put the burden of adding proper documentation on the person > calling out the misunderstanding (which has already led to a series of > bogus patches). > > > > But it was never perfectly good. It claims that a driver "should" use it, > > > when it may not need to (think simple driver using devres) and talks > > > > If you are presented with an interface something needs to be done > > specific to that interface. > > I'm not sure what you're saying here. > > > > about driver core resetting the pointer which is irrelevant. > > > > But correct and topical. I am not arguing what people should or should > > mot know. > > The comment is also misleading as it signals that this is something you > need to care about. > > > If you just remove the last sentence, all will be well. And if you > > insist replace "should" with "can". > > Since you insist, I'll just rewrite the whole thing. You're both missing the main point, which is that the USB core clears intfdata after a driver is unbound. As a consequence, drivers don't need to worry about clearing intfdata themselves -- a fact which is _not_ easily apparent from the implementation. This would be a useful thing to mention in the kerneldoc, as it may help prevent lots of drivers from making unnecessary function calls (like the ones that Vincent recently removed). Of course, this doesn't mean that drivers can't clear intfdata if they want to, for example, if they use it as an internal flag. But developers shouldn't feel that they _need_ to clear it as a sort of hygienic measure. IMO it's worthwhile keeping the kerneldoc (but correcting it) so that it can get this point across. Alan Stern