Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp1121922lqp; Fri, 22 Mar 2024 06:21:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVJgMWOVjh4i7cEdA/CzRzCO3DlGpkRnfDw0wr5eOsUV+Q+ApNmbfqIDqVTB8Sy/zZOl2TlrEt7lEnZsYJA6q6bJdpl9f1czMY4A76FIA== X-Google-Smtp-Source: AGHT+IHDJdEQCcULrOJFaxHlYrqOy2TO7NJOp3njTYLmN+j0rz6owdh/BG7gE6mrRgn1Dt+GDPvV X-Received: by 2002:a50:bb0c:0:b0:56b:9162:92f with SMTP id y12-20020a50bb0c000000b0056b9162092fmr1787387ede.23.1711113719654; Fri, 22 Mar 2024 06:21:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711113719; cv=pass; d=google.com; s=arc-20160816; b=UZw9Y724Ex0PvEzavxswwioPRuv63w665LUmWx9pq3TASX1fbhfS+vPhEnOhtEcByS 2g8WUzMudbzvdUWkvHS3bTadL42SypJlTDo24V0n8fMiIXPpAiBD9mLnN7rBJnfNVnfS FV3S41/y7MyHGaKGUV6JaYc1lpm0VycABjZSdOlWSvtLxjSDB8m798JKRPzJGrmxhfzy yA4lZw8Xh3wFgUWpC9/zPYgjzkPrPzbhzEodKYb+pyBUWvcG2Hx2jufdHPHHyn4+3GDf ULgE8RkgphxgghjsWAww2vNKj4oWmWoTbUYxV1dckslv7jAD6z0zikQi/sASCCHQ2RwD FAIw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=pvjxLpRYZMp85nRI3hYI4aDOBGUY172EE0CsMfMFET4=; fh=KyMD9Bud72ev0T+qYfGQV25dGyGfzcwObLQLYG9lYyw=; b=IozWBv98ynfZZQ1qywu2qk2ksTIAPGFK9i9gphDcpOuvB1mfi3tFrl+89jIv+nr8NG ANDtOET9YI60hH9BHUvTqu6a3dEsP19mgzvIDa+ApbGW2cQeWxImr6yoqP5o7uPMhpiR Zt/Rm2L4zyUkewqLmDoGZ/CdC//uEEw2bSmzImdq0pzXO1L/Px9xXLR1kPvSkRh67WaP y+11qp74rjPT0CWbYTaTPdOjeSJjwsnMcmt2m41Y0Wo88hnn9QbXSsc5PB3IrYFH1TTb yvaCpN01MtNBRADZZP2Jheb9vqcj794dFhuRpdCdsCq8PQimWZtmQ0H6N1LxCegBgMPW SmLA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=tWMGIn7z; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-111183-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111183-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id o23-20020a509b17000000b0056b47bb68desi908292edi.479.2024.03.22.06.21.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 06:21:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-111183-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=tWMGIn7z; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-111183-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111183-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 59F241F21923 for ; Fri, 22 Mar 2024 09:06:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 31D301B819; Fri, 22 Mar 2024 09:06:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="tWMGIn7z" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3673A1B943; Fri, 22 Mar 2024 09:06:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711098406; cv=none; b=uScE2+gb1KotsbD+BhMs8Solxqd7xbf6n7Ft9W5pvZCrrUNlNuNvmq4COjp6suxTQJxzlnVzJoNO2WVjwJO/9MPdN2Ozl543TEAKI4Xn1vbS4kDdWs0QvzUKbuFNf6m2YGQWMI+7UUxLpn3JUr/5OJolk8MRgzLTNU2TOPkWt0g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711098406; c=relaxed/simple; bh=XxnnccNT1g9hjZXtIndNZirOkjP5hXPdgEGQvxPPqbw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=HgtGmp9qUfl/x3n5Pqej6Pkygy4k6ut31C5Sy/ZBl+9N/2ZqR6NCN8h6haxMxY4w0vPxH1YXeGWJ+oZm7oEDZJsDADt5oOEKo+g4bH1f5DM7JzkPWHsrYJUgHeyHd8VqPoGOnAJZY0LUlUKHlwPbnbMfuwGxlq1/2GBGXSYy2EA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=tWMGIn7z; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org 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=pvjxLpRYZMp85nRI3hYI4aDOBGUY172EE0CsMfMFET4=; b=tWMGIn7z9kaGYqXN3J4+0LDTns FE85wYkVSfu8zuirijxDTZvE1H5i8rbwJ4RA5QR7oGPke3PA0VwIQm4qDSL6Vb6qtiVeJ96jOqjAu Sal+b3Kh5Ks3XHnwB7opBsa/uvL7Q9bIp545Q6/YPLIwfcUMjlXC041NCqnW8TT9xn1s4JSkCHCzQ U9fEQePfMQYtZzAqhx0EmnFR8HIL4xeFq5TclcjExCKPCvT1TUYG1MbGvVTNkkdunboL6RHBWpcxi qZe/FIFxS6dRPeB3jGLK+o5AEFxGVMjkvX9GAhDCM8V9U/YyQ6m7mu+qk52yZ/mVgUD1UG1L95uch QEkDsVCw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnar8-00000008tIs-3XT7; Fri, 22 Mar 2024 09:06:30 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 7CFBD300399; Fri, 22 Mar 2024 10:06:30 +0100 (CET) Date: Fri, 22 Mar 2024 10:06:30 +0100 From: Peter Zijlstra To: Dan Williams Cc: torvalds@linux-foundation.org, Bjorn Helgaas , Ira Weiny , Jonathan Cameron , Jesse Brandeburg , Ilpo =?iso-8859-1?Q?J=E4rvinen?= , Lukas Wunner , Jonathan Corbet , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, linux-doc@vger.kernel.org Subject: Re: [PATCH] cleanup: Add usage and style documentation Message-ID: <20240322090630.GA40102@noisy.programming.kicks-ass.net> References: <171097196970.1011049.9726486429680041876.stgit@dwillia2-xfh.jf.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <171097196970.1011049.9726486429680041876.stgit@dwillia2-xfh.jf.intel.com> On Wed, Mar 20, 2024 at 03:04:41PM -0700, Dan Williams wrote: > diff --git a/include/linux/cleanup.h b/include/linux/cleanup.h > index c2d09bc4f976..4620a475faee 100644 > --- a/include/linux/cleanup.h > +++ b/include/linux/cleanup.h > @@ -4,6 +4,118 @@ > > #include > > +/** > + * DOC: scope-based cleanup helpers > + * > + * The "goto error" pattern is notorious for introducing subtle resource > + * leaks. It is tedious and error prone to add new resource acquisition > + * constraints into code paths that already have several unwind > + * conditions. The "cleanup" helpers enable the compiler to help with > + * this tedium and can aid in maintaining FILO (first in last out) > + * unwind ordering to avoid unintentional leaks. > + * > + * As drivers make up the majority of the kernel code base lets describe > + * the Theory of Operation, Coding Style implications, and motivation > + * for using these helpers through the example of cleaning up PCI > + * drivers with DEFINE_FREE() and DEFINE_GUARD(), e.g.: > + * > + * .. code-block:: c > + * So I despise all that RST stuff. It makes what should be trivially readable text into a trainwreck. We're coders, we use text editors to read comments.