Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) (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 29969362 for ; Wed, 6 Sep 2023 07:10:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1693984241; x=1725520241; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=CzVsvBBCQyE6nmVgfBDTPc4IJEBFPNuhlR6CIA56RSY=; b=A0zcfqaFsFrOd2QACHuvF3GaYEwwi3laqu/RXyHAS8+Gk+kKp2/sx4ot ZPMxxWn0fFp7UW0eBndnNpBoiIL6KV2TYOCOHfUcflzuq1Sun84FkdGw0 +1FSjRL0SH98xHHVqYX8NL7rk/aovJMu/3W5YIfZjCxAre2DmyZK7mBth kiN2+bKbacDoc3WCGE3WxHngCcPgvMVvMoBh3LAAXw2FTCyEnP+GbDsBx bBfC7KLD1+b8Rz5LhnVc2e2HoBPcyy12utFS8KHgVi82Nnn/Zq8ao53lO nuVnKyP1/mFeJIT4HRtzq4Mf1h9V1Q2A/352LQSB64ZmhQmzdA7Pup6df w==; X-IronPort-AV: E=McAfee;i="6600,9927,10824"; a="407993436" X-IronPort-AV: E=Sophos;i="6.02,231,1688454000"; d="scan'208";a="407993436" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Sep 2023 00:10:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10824"; a="734933655" X-IronPort-AV: E=Sophos;i="6.02,231,1688454000"; d="scan'208";a="734933655" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga007.jf.intel.com with ESMTP; 06 Sep 2023 00:10:33 -0700 Received: by black.fi.intel.com (Postfix, from userid 1001) id 1DF7F30D; Wed, 6 Sep 2023 10:10:32 +0300 (EEST) Date: Wed, 6 Sep 2023 10:10:32 +0300 From: Mika Westerberg To: Bartosz Golaszewski Cc: Aaro Koskinen , Janusz Krzysztofik , Tony Lindgren , Russell King , Andy Shevchenko , Linus Walleij , Dipen Patel , Thierry Reding , Jonathan Hunter , Hans de Goede , Mark Gross , linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org, timestamp@lists.linux.dev, linux-tegra@vger.kernel.org, platform-driver-x86@vger.kernel.org, Bartosz Golaszewski Subject: Re: [PATCH 08/21] gpio: acpi: provide acpi_gpio_device_free_interrupts() Message-ID: <20230906071032.GA1599918@black.fi.intel.com> References: <20230905185309.131295-1-brgl@bgdev.pl> <20230905185309.131295-9-brgl@bgdev.pl> Precedence: bulk X-Mailing-List: timestamp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230905185309.131295-9-brgl@bgdev.pl> Hi, On Tue, Sep 05, 2023 at 08:52:56PM +0200, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > We're moving away from public functions that take struct gpio_chip as > argument as the chip - unlike struct gpio_device - is owned by its > provider and tied to its lifetime. > > Provide an alternative to acpi_gpiochip_free_interrupts(). Looks good to me, few minor comments below. > > Signed-off-by: Bartosz Golaszewski Reviewed-by: Mika Westerberg > --- > drivers/gpio/gpiolib-acpi.c | 29 +++++++++++++++++++++++------ > include/linux/gpio/driver.h | 12 ++++++++++++ > 2 files changed, 35 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c > index fbda452fb4d6..5633e39396bc 100644 > --- a/drivers/gpio/gpiolib-acpi.c > +++ b/drivers/gpio/gpiolib-acpi.c > @@ -558,12 +558,9 @@ void acpi_gpiochip_request_interrupts(struct gpio_chip *chip) > } > EXPORT_SYMBOL_GPL(acpi_gpiochip_request_interrupts); > > -/** > - * acpi_gpiochip_free_interrupts() - Free GPIO ACPI event interrupts. > - * @chip: GPIO chip > - * > - * Free interrupts associated with GPIO ACPI event method for the given > - * GPIO chip. > +/* > + * This function is deprecated, use acpi_gpio_device_free_interrupts() > + * instead. > */ > void acpi_gpiochip_free_interrupts(struct gpio_chip *chip) > { > @@ -604,6 +601,26 @@ void acpi_gpiochip_free_interrupts(struct gpio_chip *chip) > } > EXPORT_SYMBOL_GPL(acpi_gpiochip_free_interrupts); > > +/** > + * acpi_gpio_device_free_interrupts() - Free GPIO ACPI event interrupts. > + * @chip GPIO device Should be: @chip: GPIO device > + * > + * Free interrupts associated with GPIO ACPI event method for the given > + * GPIO device. > + */ > +void acpi_gpio_device_free_interrupts(struct gpio_device *gdev) > +{ > + struct gpio_chip *gc; > + > + /* TODO: protect gdev->chip once SRCU is in place in GPIOLIB. */ > + gc = gdev->chip; > + if (!gc) > + return; > + > + acpi_gpiochip_free_interrupts(gc); > +} > +EXPORT_SYMBOL_GPL(acpi_gpio_device_free_interrupts); > + > int acpi_dev_add_driver_gpios(struct acpi_device *adev, > const struct acpi_gpio_mapping *gpios) > { > diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h > index b68b3493b29d..47906bc56b3d 100644 > --- a/include/linux/gpio/driver.h > +++ b/include/linux/gpio/driver.h > @@ -835,4 +835,16 @@ static inline struct fwnode_handle *gpiochip_node_get_first(struct device *dev) > return NULL; > } > > +/* > + * FIXME: Remove this once the only driver that uses it - android tablets - > + * becomes a good citizen and stops abusing GPIOLIB. There are a acouple of more when grepping for acpi_gpiochip_free_interrupts(). I'm not entirely sure why these functions are exposed to the drivers in the first place. IMHO GPIOLIB should deal with these but perhaps there is some good reason these drivers do it... > + */ > +#ifdef CONFIG_ACPI > +void acpi_gpio_device_free_interrupts(struct gpio_device *gdev); > +#else > +static inline void acpi_gpio_device_free_interrupts(struct gpio_device *gdev) > +{ > +} I would put these {} to the same line: static inline void acpi_gpio_device_free_interrupts(struct gpio_device *gdev) { } > +#endif > + > #endif /* __LINUX_GPIO_DRIVER_H */ > -- > 2.39.2