From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) (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 E230FED4; Fri, 15 Dec 2023 16:31:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=kernel.org X-IronPort-AV: E=McAfee;i="6600,9927,10924"; a="394171609" X-IronPort-AV: E=Sophos;i="6.04,279,1695711600"; d="scan'208";a="394171609" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2023 08:31:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10924"; a="840713621" X-IronPort-AV: E=Sophos;i="6.04,279,1695711600"; d="scan'208";a="840713621" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga008.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2023 08:31:05 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1rEB5a-00000006AWR-2XWd; Fri, 15 Dec 2023 18:31:02 +0200 Date: Fri, 15 Dec 2023 18:31:02 +0200 From: Andy Shevchenko To: Bartosz Golaszewski Cc: Kent Gibson , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linus.walleij@linaro.org Subject: Re: [PATCH v2 2/5] gpiolib: cdev: relocate debounce_period_us from struct gpio_desc Message-ID: References: <20231214095814.132400-1-warthog618@gmail.com> <20231214095814.132400-3-warthog618@gmail.com> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Thu, Dec 14, 2023 at 10:06:14PM +0100, Bartosz Golaszewski wrote: > On Thu, Dec 14, 2023 at 5:41 PM Andy Shevchenko wrote: > > On Fri, Dec 15, 2023 at 12:14:41AM +0800, Kent Gibson wrote: > > > On Thu, Dec 14, 2023 at 05:09:01PM +0200, Andy Shevchenko wrote: > > > > On Thu, Dec 14, 2023 at 05:03:03PM +0200, Andy Shevchenko wrote: > > > > > On Thu, Dec 14, 2023 at 05:58:11PM +0800, Kent Gibson wrote: ... > > > > > > +static void supinfo_init(void) > > > > > > +{ > > > > > > + supinfo.tree = RB_ROOT; > > > > > > + spin_lock_init(&supinfo.lock); > > > > > > +} > > > > > > > > > > Can it be done statically? > > > > > > > > > > supinfo = { > > > > > .tree = RB_ROOT, > > > > > .lock = __SPIN_LOCK_UNLOCKED(supinfo.lock), > > Double underscore typically means it's private and shouldn't be used. Right, but when you have a struct you have no other means to initialize this directly. > > > > I even checked the current tree, we have 32 users of this pattern in drivers/. See, there are users of the __ initializers. > > > Ah, that is what you meant. Yeah sure can - the supinfo_init() is > > > another hangover from when I was trying to create the supinfo per chip, > > > but now it is a global a static initialiser makes sense. > > > > Yep, the DEFINE_MUTEX() / DEFINE_SPINLOCK() / etc looks better naturally > > than above. > > Yeah, so maybe we should use non-struct, global variables after all. At least this will allow to get rid of (questionable) initcall. > > > And I still haven't received the email you quote there. > > > > :-( I'm not sure we will get it, it most likely that I removed it already > > and it has disappeared due to problems with email server... -- With Best Regards, Andy Shevchenko