Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5558069rdb; Wed, 13 Dec 2023 12:07:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IGthihhDnCt7l9CENXeODeylBgIPMuIfBoNQ5rG3lh9uUw5Q+zQMKSf/6DyYWOyzDtukwZu X-Received: by 2002:a17:902:e789:b0:1d0:7c31:197e with SMTP id cp9-20020a170902e78900b001d07c31197emr9727678plb.57.1702498054980; Wed, 13 Dec 2023 12:07:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702498054; cv=none; d=google.com; s=arc-20160816; b=pMx9sgss/vJAgL/ZTLI8d9/yaqxYv9rhxpFTsijJy1g8WfEbD61Rm5ngaWn2vZbqx5 uabsVaw77IsWfD2/o/lxy07BG4tDescg2xcg71CmOi2ljGXKimAE/m4qo6iB4VsFocU5 OT9Hrkx/CTqFJrgPT5ryNOqsmOaY/7z5IukaenZpef6sE0XNPkJY3cR9ABKwcpr5pQ5C x7s4SJ5QsBCOn0oXydkRprpGeiUbjoTSOUSqjZbbSwN0Nbx21K07rPhpfhlxvLWt+219 HDFsLtoPb18AZQ8dWgx4L+Zl5R4daJMH0PqzIyazYqEBytglb7r4TIQL3nxsrXAOVp15 NIBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=4JqKBoZZ5gKZdHDKqywZd7eFDqKym9E17umxMuf448c=; fh=gWgQkwRx1pRN6B0a6aHplanYDEUMdd1fFwHIg8IIY4Q=; b=Vfuj2U9paSdmjDK//j6xWF9sFCvKJWLp+C/N5MNGLlafTlaSQcagNk8NcVz+iIxfju VtdS13mnL98bbwYTVXxW+VaPXrH+GESx1zXpNpowLOSuVoUItn8sMrAefFnwBC4hlgax R85PzHScDJ+6b8bwAQmCfFHRfoLwbZnq8SHkNvbROcN40vDYCezdL3e4IOe5Ek3Baal9 zUxMycx2NhLx6tBUP1Ws+n43CpLe8jI8r/f4drdE2PsPeSozPWrgOUruMWCR0AeW5xoB AZGxwcUHMIPFKz8ZBkNy8ykOJ7Vk2ygBGVdY6cYs1oVaPW1QcCIRFMQLHSEjSSLpd6hv T8Hg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id x3-20020a170902ea8300b001d07490028bsi9966297plb.178.2023.12.13.12.07.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 12:07:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id C72ED809FED5; Wed, 13 Dec 2023 12:07:25 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442230AbjLMUHL (ORCPT + 99 others); Wed, 13 Dec 2023 15:07:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233702AbjLMUHK (ORCPT ); Wed, 13 Dec 2023 15:07:10 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEF39C9; Wed, 13 Dec 2023 12:07:16 -0800 (PST) X-IronPort-AV: E=McAfee;i="6600,9927,10923"; a="374526113" X-IronPort-AV: E=Sophos;i="6.04,273,1695711600"; d="scan'208";a="374526113" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Dec 2023 12:07:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10923"; a="1105425546" X-IronPort-AV: E=Sophos;i="6.04,273,1695711600"; d="scan'208";a="1105425546" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga005.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Dec 2023 12:07:14 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1rDVVg-00000005dLp-1J2A; Wed, 13 Dec 2023 22:07:12 +0200 Date: Wed, 13 Dec 2023 22:07:12 +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 1/4] gpiolib: cdev: relocate debounce_period_us from struct gpio_desc Message-ID: References: <20231212054253.50094-1-warthog618@gmail.com> <20231212054253.50094-2-warthog618@gmail.com> 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 X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 13 Dec 2023 12:07:25 -0800 (PST) On Wed, Dec 13, 2023 at 08:03:44PM +0100, Bartosz Golaszewski wrote: > On Wed, Dec 13, 2023 at 5:29 PM Andy Shevchenko wrote: > > On Wed, Dec 13, 2023 at 05:15:38PM +0100, Bartosz Golaszewski wrote: > > > On Wed, Dec 13, 2023 at 5:12 PM Andy Shevchenko wrote: > > > > On Wed, Dec 13, 2023 at 11:59:26PM +0800, Kent Gibson wrote: > > > > > On Wed, Dec 13, 2023 at 04:40:12PM +0100, Bartosz Golaszewski wrote: > > > > > > On Wed, Dec 13, 2023 at 3:27 PM Kent Gibson wrote: > > > > > > > On Wed, Dec 13, 2023 at 03:54:53PM +0200, Andy Shevchenko wrote: > > > > > > > > On Tue, Dec 12, 2023 at 01:42:50PM +0800, Kent Gibson wrote: ... > > > > > > > > > +static struct supinfo supinfo; > > > > > > > > > > > > > > > > Why supinfo should be a struct to begin with? Seems to me as an unneeded > > > > > > > > complication. > > > > > > > > > > > > I think we should keep it as a struct but defined the following way: > > > > > > > > > > > > struct { > > > > > > spinlock_t lock; > > > > > > struct rb_root tree; > > > > > > } supinfo; > > > > > > > > > > That is what I meant be merging the struct definition with the variable > > > > > definition. Or is there some other way to completely do away with the > > > > > struct that I'm missing? > > > > > > > > Look at the top of gpiolib.c: > > > > > > > > static DEFINE_MUTEX(gpio_lookup_lock); > > > > static LIST_HEAD(gpio_lookup_list); > > > > > > > > In the similar way you can simply do > > > > > > > > static DEFINE_SPINLOCK(gpio_sup_lock); > > > > static struct rb_root gpio_sup_tree; > > > > > > The fact that this has been like this, doesn't mean it's the only > > > right way. IMO putting these into the same structure makes logical > > > sense. > > > > I disagree on the struct like this on the grounds: > > - it's global > > - it's one time use > > - it adds complications for no benefit > > - it makes code uglier and longer > > > > It boils down to supinfo.lock vs supinfo_lock. I do prefer the former > but it's a weak opinion, I won't die on that hill. Me neither, just showing rationale from my side. > > What we probably want to have is a singleton objects in C language or at least > > inside Linux kernel project. But I'm not sure it's feasible. > > > > > > > > > Yeah, that is a hangover from an earlier iteration where supinfo was > > > > > > > contained in other object rather than being a global. > > > > > > > Could merge the struct definition into the variable now. -- With Best Regards, Andy Shevchenko