Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp41248pxx; Mon, 26 Oct 2020 02:48:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjeytSrvyp81RKTUzwCgsAgn6TLtYFYbtyZC7yLUlktq3tBdFVaVAUPjv1RwLws4WSncZW X-Received: by 2002:a17:906:c43:: with SMTP id t3mr14518696ejf.219.1603705714699; Mon, 26 Oct 2020 02:48:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603705714; cv=none; d=google.com; s=arc-20160816; b=DiXjeDnHBFkYrLXirjbXdmD5k2wPizhl4MAWAbjv8W6EJ7KMsrBZjs4v4bButfP1AE dWWeUpXB/zriUqqMF851Bn1S3zrRY0DJmm0RFfzqOI7wmFGO8GZLU4DrWTyzJif781NR Vl6XZeX/WVnEx6eFxxm3RDy1ELzhL6IsNnb7V8o3Gih2Qv4iijrZ1V+AqwYQO45/Ylrt BWlx24P3nPZDNU6MYjiSYjLqMNEUqzJW5bEzi/xrx4GiM1JbfCvHsHovh15P5tmbxPr/ ad3ranCd72WgpVt6VH44m8jwph3e80yYvrlafB6Zj8pR8jSoSCmP0liG0qyFTbAeeK+0 i8GA== 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:dkim-signature; bh=zkQv6PP/jqP7JpBqkyIwYWH1C5UcJlu2KgKr/pNdSNs=; b=E0KXvabkjvXM0rp8Wl9taxciO86OBktfxhQVM8dYIEu6c15ZpepmWlLDy9lNhsQVlZ KVrHbHEOtvChohBl0T6+XSmSi37Wl85OrKDj0cEu+wzklKvBdrLfEs/lcLMk/z0mOznk R3/chGO4u+ukEw1zLU2sJWCEvl2pWmsMvhnl7CDTu/3f4MlRlbTDFQaYdur7eXrTUGDA dTyvUEecMVTrJjOMr//gRWifQuw5qN6+Y+vxOf4XIS7dGoC1iS6PFdKlsal+QXt1msMU Gf8GhdTzHtSrDov3Qa2jW+IMncCPK9y4Qy0P4j5HXFi6962c4eQldF86qolhIOXRD4tm NhEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="K/Ee07W7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v13si5493663edy.123.2020.10.26.02.48.12; Mon, 26 Oct 2020 02:48:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="K/Ee07W7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1771751AbgJZIba (ORCPT + 99 others); Mon, 26 Oct 2020 04:31:30 -0400 Received: from casper.infradead.org ([90.155.50.34]:33838 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1771712AbgJZIb3 (ORCPT ); Mon, 26 Oct 2020 04:31:29 -0400 X-Greylist: delayed 1222 seconds by postgrey-1.27 at vger.kernel.org; Mon, 26 Oct 2020 04:31:29 EDT DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=zkQv6PP/jqP7JpBqkyIwYWH1C5UcJlu2KgKr/pNdSNs=; b=K/Ee07W7BXL26gQPzNcZFTdGaE idve07W5yNIGZ5ZVQg6P6GBgsyCS/e7I3oISmp0Pa5mojhAFma72JdjztC9fN2EyT1pFygN7gwZyF dhHxivnLlozdFPbSq8x1dQUkw2EYwaBo1mVzy38AjDhxlhukMmLlhEy7HTr7xrUCKFeJFz5WfO3lC UybBh8L1Rjs839EuclWBjgIhjm2WHzR9npIErGCO0HtosTjyvXDscnDzqWeSDBVdDOeoB+ZruRU6v 6H6O1yalKplcxq2O9s4nY5lVhumRQEJDZnaHcLjx7C+68fRw/ZcW+sb13qfWKWmWxlDR58R3HAtsS FyqUbY7Q==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kWxan-000481-3r; Mon, 26 Oct 2020 08:11:02 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id DC7353010D2; Mon, 26 Oct 2020 09:10:59 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id CAD6520325EC8; Mon, 26 Oct 2020 09:10:59 +0100 (CET) Date: Mon, 26 Oct 2020 09:10:59 +0100 From: Peter Zijlstra To: Mauro Carvalho Chehab Cc: Jonathan Corbet , Kees Cook , Linux Doc Mailing List , Ard Biesheuvel , Ingo Molnar , Jann Horn , Will Deacon , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 49/56] refcount.h: fix a kernel-doc markup Message-ID: <20201026081059.GB2628@hirez.programming.kicks-ass.net> References: <202010231039.DE05B63@keescook> <20201023193907.GI2974@worktop.programming.kicks-ass.net> <20201023134757.628f91b7@lwn.net> <20201024082827.08ad3010@coco.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201024082827.08ad3010@coco.lan> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Oct 24, 2020 at 08:28:27AM +0200, Mauro Carvalho Chehab wrote: > If the intent is to document the struct and its internal fields, > this kernel-doc should work: > > /** > * struct refcount_struct - variant of atomic_t specialized for reference counts > * @refs: atomic_t counter field > * > * The counter saturates at REFCOUNT_SATURATED and will not move once > * there. This avoids wrapping the counter and causing 'spurious' > * use-after-free bugs. > */ > > Which produces this result: Who cares... :-( > If you want both, then you would either split struct and typedef, e. g. > with something like: > > /** > * struct refcount_struct - variant of atomic_t specialized for reference counts > * @refs: atomic_t counter field > * > * The counter saturates at REFCOUNT_SATURATED and will not move once > * there. This avoids wrapping the counter and causing 'spurious' > * use-after-free bugs. > */ > struct refcount_struct { > atomic_t refs; > }; > > /** > * typedef refcount_t - variant of atomic_t specialized for reference counts > * @refs: atomic_t counter field > * > * The counter saturates at REFCOUNT_SATURATED and will not move once > * there. This avoids wrapping the counter and causing 'spurious' > * use-after-free bugs. > */ > typedef struct refcount_struct refcount_t; > > Or, you could add the member at the description field. E. g. something > like this: > > /** > * typedef refcount_t - variant of atomic_t specialized for reference counts > * > * The counter saturates at REFCOUNT_SATURATED and will not move once > * there. This avoids wrapping the counter and causing 'spurious' > * use-after-free bugs. > * > * Members: > * ``refs`` > * atomic_t counter field > */ > typedef struct refcount_struct { > atomic_t refs; > } refcount_t; > > If you want to test it, you can run kernel-doc directly, to see how > it will parse it. For ReST output, that's the syntax: > > ./scripts/kernel-doc --sphinx-version 3 include/linux/refcount.h I'll just go ahead and remove the superfluous * from the comment... It's trivially clear what is meant. If the stupid tool can't deal with that, I don't care. All this wanking about docs and making perfectly fine comments bloody unreadable shit has to stop.