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 D8D21C07CA9 for ; Thu, 30 Nov 2023 18:01:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346697AbjK3SBk (ORCPT ); Thu, 30 Nov 2023 13:01:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230030AbjK3SBi (ORCPT ); Thu, 30 Nov 2023 13:01:38 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84D55103; Thu, 30 Nov 2023 10:01:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701367304; x=1732903304; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=6DZD1WAOWgeywojsdbe0NogKW+Ei8+LB7XZhnS+io3A=; b=LniPfygC9Wj68jvqETDsf3pCZnNo2oB6Q+eq4v6rhiNJmE30w3pfFV7+ vkwCItVdBpnO/pxMcR6Ya64nLsykwFkKvBZtzue/dxXmKxwec6NGVraY+ g+LYO/k5bKH9uTWb8KdrULe1eaeGIF5k1KKm0RlcoBIQyCu2CLdVCtUzq 6OxYdyKvb9yVzucmdvdmjFH32dQeBkCuKIR6f1BNTEtZ17K06UZA+H9G0 zkVulLQdFnM5IwRiC6Ue6Uqw4BVWCJCpYJ2za1WDp22qR+dJtHg1NdUt0 lxKwIT5UhypC12ULJMVron/EcVrNesQ2+9/AqNOotBsK2vSc1FAyvTyk3 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10910"; a="457691441" X-IronPort-AV: E=Sophos;i="6.04,239,1695711600"; d="scan'208";a="457691441" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2023 10:01:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10910"; a="913274473" X-IronPort-AV: E=Sophos;i="6.04,239,1695711600"; d="scan'208";a="913274473" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga001.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2023 10:01:37 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1r8lLy-00000000m5B-3gEk; Thu, 30 Nov 2023 20:01:34 +0200 Date: Thu, 30 Nov 2023 20:01:34 +0200 From: Andy Shevchenko To: Bartosz Golaszewski Cc: Linus Walleij , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: Re: [PATCH v2 10/10] gpiolib: remove gpiochip_is_requested() Message-ID: References: <20231130134630.18198-1-brgl@bgdev.pl> <20231130134630.18198-11-brgl@bgdev.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 30, 2023 at 06:46:20PM +0100, Bartosz Golaszewski wrote: > On Thu, Nov 30, 2023 at 5:46 PM Andy Shevchenko > wrote: > > On Thu, Nov 30, 2023 at 02:46:30PM +0100, Bartosz Golaszewski wrote: ... > > > - cpy = kstrdup(label, GFP_KERNEL); > > > - if (!cpy) > > > - return ERR_PTR(-ENOMEM); > > > + scoped_guard(spinlock_irqsave, &gpio_lock) { > > > + if (!test_bit(FLAG_REQUESTED, &desc->flags)) > > > + return NULL; > > > > > + cpy = kstrdup(desc->label, GFP_KERNEL); > > > + if (!cpy) > > > + return ERR_PTR(-ENOMEM); > > > > You just introduced these lines earlier in the series, and here you moved > > them again. With guard() instead it may be kept in a better shape. > > > > I wanted to limit the critical section to a minimum hence scoped > variant. And this will go away as soon as we have a desc lock so it's > temporary anyway. What matters to me is how the code looks when > sending it to Torvalds. On the off chance that we don't get the > locking rework merged in time for v6.8, I want this to at least be > under the existing lock. guard() here is equally scoped, no? And what's wrong with that when gets to Torvalds? He accepted your guard() cases last time IIRC. > > > + } -- With Best Regards, Andy Shevchenko