From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="gCgpIgK5" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8379111B for ; Thu, 14 Dec 2023 05:53:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702562000; x=1734098000; h=resent-from:resent-date:resent-message-id:resent-to:date: from:to:cc:subject:message-id:references:mime-version: in-reply-to; bh=zKPcMKNBLeHW6dwGMo4dXzEnGw5ow/M15/TjNTUWIsw=; b=gCgpIgK56/8Yh+t+HWAgsUQrLdPbhIMdwfqPoxcrclfCxUI4aLDTvGWu DWoA6pnW50mI/OT1fbM66sZeuMaY6a1KqxfoE/EShA5mnw1V2cUoV97GX jdjh3opdwoZEwJebmSjHQCs/Ncvn4ys5KIthTMYulUhnTRnTM/HsGwHff y4ayWZm1r+pJDd3wWwUsxxJAZ06gGiNNQnSkOXqE2/jEgQw85qnAeEKtJ IcXEDzCchVQFdMp8TxWLPsX+HpFXfSslfiUpdmVo4XljR8HK9/Ncr1E2N HMdn9oHmpc1Co1SVBWOzwkgso9qaV1c/G2xewBpVQEexo6dPvGpEuS0Xn Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10924"; a="1957331" X-IronPort-AV: E=Sophos;i="6.04,275,1695711600"; d="scan'208";a="1957331" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2023 05:53:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10924"; a="947581748" X-IronPort-AV: E=Sophos;i="6.04,275,1695711600"; d="scan'208";a="947581748" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga005.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2023 05:53:17 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1rDm9K-00000005rDN-3l3s; Thu, 14 Dec 2023 15:53:14 +0200 Resent-From: Andy Shevchenko Resent-Date: Thu, 14 Dec 2023 15:53:14 +0200 Resent-Message-ID: Resent-To: brgl@bgdev.pl, linus.walleij@linaro.org, warthog618@gmail.com, linux-gpio@vger.kernel.org Date: Fri, 8 Dec 2023 16:05:31 +0200 From: Andy Shevchenko To: Bartosz Golaszewski Cc: Linus Walleij , Kent Gibson , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: Re: [PATCH v2 2/2] gpiolib: use a mutex to protect the list of GPIO devices Message-ID: References: <20231208102020.36390-1-brgl@bgdev.pl> <20231208102020.36390-3-brgl@bgdev.pl> Precedence: bulk X-Mailing-List: linux-gpio@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: <20231208102020.36390-3-brgl@bgdev.pl> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Fri, Dec 08, 2023 at 11:20:20AM +0100, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > The global list of GPIO devices is never modified or accessed from > atomic context so it's fine to protect it using a mutex. Add a new > global lock dedicated to the gpio_devices list and use it whenever > accessing or modifying it. ... > While at it: fold the sysfs registering of existing devices into > gpiolib.c and make gpio_devices static within its compilation unit. TBH I do not like injecting sysfs (legacy!) code into gpiolib. It makes things at very least confusing. That _ugly_ ifdeffery and sysfs in the function name are not okay. If you want do that, please create a separate change and explain the rationale behind with answering to the Q "Why do we need all that and why is it better than any alternatives?". -- With Best Regards, Andy Shevchenko