From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85133C04A6A for ; Tue, 15 Aug 2023 15:59:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235417AbjHOP6k (ORCPT ); Tue, 15 Aug 2023 11:58:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238478AbjHOP6X (ORCPT ); Tue, 15 Aug 2023 11:58:23 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFC3D1BF8; Tue, 15 Aug 2023 08:58:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1692115095; x=1723651095; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=o2Eb+5rz5n+LyEqDEQcpJWsHJ40eqEd9SL2bfrfu7A4=; b=QDiN448Itx7NQgi2HD+d77fv7NeynydSEwbIlujnipEWZ3DKHMFPmSoz F4u7DIMGJ7RzprCS+LW7GshocF/6gxbqXcjDSwj8aESGs7+Z1CElwYARM tXFR15cvCSff2Il8+0WDCrYqcVKOypAH3fIyjl8515IMyWSFuAa4Tzlsh 5e6W+SkAfBKQIttyLLWqLJts3iJPG0NBBDf6wq3TrD2eRzcaSPlNIE88S UuehgiO9pk+kXgtjtu1nKfqZgeLlmmxnCstXBkI+YtOVaht/vZJw8620s 0tAzarLv/fw3DGlbxSdSn/va4/t8lSAgrtTzoVNeUbqy8XTqm6G3NSdPv g==; X-IronPort-AV: E=McAfee;i="6600,9927,10803"; a="438650368" X-IronPort-AV: E=Sophos;i="6.01,174,1684825200"; d="scan'208";a="438650368" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Aug 2023 08:58:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10803"; a="857488813" X-IronPort-AV: E=Sophos;i="6.01,174,1684825200"; d="scan'208";a="857488813" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga004.jf.intel.com with ESMTP; 15 Aug 2023 08:58:12 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1qVwQs-008KLb-2S; Tue, 15 Aug 2023 18:58:10 +0300 Date: Tue, 15 Aug 2023 18:58:10 +0300 From: Andy Shevchenko To: Peter Zijlstra Cc: Linus Walleij , Bartosz Golaszewski , Kent Gibson , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: Re: [PATCH 2/2] gpio: sim: simplify code with cleanup helpers Message-ID: References: <20230809131442.25524-1-brgl@bgdev.pl> <20230809131442.25524-2-brgl@bgdev.pl> <20230815155253.GK212435@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230815155253.GK212435@hirez.programming.kicks-ass.net> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org On Tue, Aug 15, 2023 at 05:52:53PM +0200, Peter Zijlstra wrote: > On Tue, Aug 15, 2023 at 10:04:32AM +0200, Linus Walleij wrote: > > On Wed, Aug 9, 2023 at 3:14 PM Bartosz Golaszewski wrote: > > > - mutex_lock(&chip->lock); > > > + guard(mutex)(&chip->lock); > Looks about right. Btw, why don't we have something like guard_mutex() to be used as guard_mutex(&chip->lock); Moreover, maybe some macro that can predict the API call from the type of the parameter? -- With Best Regards, Andy Shevchenko