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