Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6799082rdb; Fri, 15 Dec 2023 08:35:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IHwy0tsN07BhWDIWfe57Tac2okouyYzY97DXCEuW2z8abwJpU3icoYk1uMuGAsam8OhtIZH X-Received: by 2002:a05:6a00:1148:b0:6cd:fcef:5d94 with SMTP id b8-20020a056a00114800b006cdfcef5d94mr13025727pfm.16.1702658127442; Fri, 15 Dec 2023 08:35:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702658127; cv=none; d=google.com; s=arc-20160816; b=p6oIO09tuf5rhOISWXqPMSxcWAWIOZnGEm7p8GJ+T1eSN2w6R6HGIujsE5/Rf/I9uR GWG1II7Vyl7noMC/e86g2aFql2uR1Q8Ra88kH+KVdrIDRytjFHREklUDXpQWajpSdWw5 ZDYHpil/6sO//yOGpFuifEFbUUcymPmI7tUFw9JPDA2vaCg7nm3KQse6tOFZFLDsIt9D xsx9P4SvEb8eq8GBDfCD/EvvQqoBmTmlSdMuimlTsXEQSZiFhgWSnxfEhLNquQ1XVrR/ pgQrPzxIHNKD0BzMH43wGyuzEgd5nmFRPlvWrk4/VA1hc5HX27d2fsHpvax7dLXHXpk4 2rUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=organization:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date; bh=NrOdSUmyx6dquK2mWeUvTueEeGX0BXMhN2XPMZlnAmY=; fh=BiTih3HBn05OJvpBeKJCJhFgvirybBPBq65CdTV6sMo=; b=jCDzvo0/DumQbokI0fXkLtEq3x+9aBuFGMIVUXhkmInsP0iW1TAT54o6NTPyus5Hg0 RCa51za+TDTRUba9QWVg4YXSxVn7nsyOTI+FUz2VkQapGEQf42lNe5ug7KtvYHlYrgEL nveOjX2ZAY88lQdxTjJXg74SCa6HjWD4f3BW9k/dlBqdv83pl9Vuj3cyaS3mOsW7b3Ul DvUwdsZez9rvjjxyeUOdwLbYKH0otTDYIUxpxuDVJEH12HaNm8iBrIyQWXJ7rJcBVVkC /miS6v+5z2OMwJYm6eOglvUZoD51hP6mXp683/eHtrAINVyzEJtM5ry9rj0LxD5LX8OU Rc0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-1307-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1307-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id s9-20020a056a00194900b006ce11380ce4si13380878pfk.20.2023.12.15.08.35.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 08:35:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1307-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-1307-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1307-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 07E5E283A0D for ; Fri, 15 Dec 2023 16:35:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 634663DB81; Fri, 15 Dec 2023 16:35:21 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) (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 AC5E1249EA; Fri, 15 Dec 2023 16:35:19 +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="375442960" X-IronPort-AV: E=Sophos;i="6.04,279,1695711600"; d="scan'208";a="375442960" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2023 08:35:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10924"; a="809025747" X-IronPort-AV: E=Sophos;i="6.04,279,1695711600"; d="scan'208";a="809025747" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga001.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2023 08:35:17 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1rEB9e-00000006AZP-1Vsd; Fri, 15 Dec 2023 18:35:14 +0200 Date: Fri, 15 Dec 2023 18:35:14 +0200 From: Andy Shevchenko To: Kent Gibson Cc: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, brgl@bgdev.pl, linus.walleij@linaro.org Subject: Re: [PATCH v3 1/5] gpiolib: cdev: relocate debounce_period_us from struct gpio_desc Message-ID: References: <20231215023805.63289-1-warthog618@gmail.com> <20231215023805.63289-2-warthog618@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@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: <20231215023805.63289-2-warthog618@gmail.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Fri, Dec 15, 2023 at 10:38:01AM +0800, Kent Gibson wrote: > Store the debounce period for a requested line locally, rather than in > the debounce_period_us field in the gpiolib struct gpio_desc. > > Add a global tree of lines containing supplemental line information > to make the debounce period available to be reported by the > GPIO_V2_GET_LINEINFO_IOCTL and the line change notifier. LGTM, a few minor comments below. ... > +/* (now you can have a kernel doc :-) > + * a rbtree of the struct lines containing supplemental info. > + * Used to populate gpio_v2_line_info with cdev specific fields not contained > + * in the struct gpio_desc. > + * A line is determined to contain supplemental information by > + * line_is_supplemental(). > + */ > +static struct rb_root supinfo_tree = RB_ROOT; > +/* covers supinfo_tree */ > +DEFINE_SPINLOCK(supinfo_lock); Shouldn't this also be static? ... > + guard(spinlock)(&supinfo_lock); + cleanup.h ? ... > +static void supinfo_to_lineinfo(struct gpio_desc *desc, > + struct gpio_v2_line_info *info) > +{ > + struct gpio_v2_line_attribute *attr; > + struct line *line; > + > + guard(spinlock)(&supinfo_lock); > + > + line = supinfo_find(desc); > + if (line) { if (!line) return; ? > + attr = &info->attrs[info->num_attrs]; > + attr->id = GPIO_V2_LINE_ATTR_ID_DEBOUNCE; > + attr->debounce_period_us = READ_ONCE(line->debounce_period_us); > + info->num_attrs++; > + } > +} -- With Best Regards, Andy Shevchenko