From patchwork Tue Sep 5 18:52:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13374937 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 06AEECA0FFA for ; Tue, 5 Sep 2023 18:54:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OZuSNWkC6Xu1PLFpLo/tQR41+9HKVSZ5GQicZw0mXg4=; b=hsIBIrZ6DY3tG4 t1Wn8WMLiv646eh3aIBxtS4nllWt/C9NUS+ttCU+sSF0FAFQCXWxL2NgwVbtk3EVa4bExNgHpeizP KvoCyg2p/m4IaRpNy3vJXR1blZP6Hn1BUn08hpOsY3TiSCE+0ApLLBCyP/uetl7N6BJ6dUlUKNAJf ifYVgG0JHqRE0Eag8w4txTm2ci1ob2/eXuygyNtDr2lDPwAnck9a5RjSdqpKjyG54Gpw490VZVT4T 3v0UI/ni9HlKaxLk8koFZuh1S/Cy4v92SeClXUvDfn1U6CsgZKPQZU5sEG86pSGj9d+pRGUo/dfeo LNodEm9ym6RCnvke+nSg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qdbBJ-006YVo-0a; Tue, 05 Sep 2023 18:53:45 +0000 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qdbBC-006YQU-2I for linux-arm-kernel@lists.infradead.org; Tue, 05 Sep 2023 18:53:40 +0000 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-401da71b7c5so28350865e9.2 for ; Tue, 05 Sep 2023 11:53:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1693940016; x=1694544816; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gD8mhbYtSpsp4MugkXhi33yXQT05nfWNxdtLBId4RL8=; b=rkC6tQy6JzYk+15ZwH22jHEo7Q+pBw7DeWe1HH7wBdWxjNtCivQ8s143XgAMdu+UqK ElA+nba3RtAYsHqJsuLxCrFu4X8W2K6g43zz68b3Wt/KjK5iWqaELtDxoROZL7yeZAHi AvmorZpxs9AB2RQ6I/TlWIn9N3lYvynagYl8WCcXWI+JRJAcBtZsT3GF2dPAGAm0ZuWc 0wpbfYOMDvmRAYKyvBogyYcftw7nMEZqFTRbWcNO8BP++02QQcv4F8q2IwEPRN30fcNV pHH2/dZuXq+xzQB7PEVgYmB0lUUHJMQLNdr83nR5VTJscb5YOE09re8gjNOrk13TrsWc 8WtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693940016; x=1694544816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gD8mhbYtSpsp4MugkXhi33yXQT05nfWNxdtLBId4RL8=; b=OQ77b3q2V9/7nWn7b/YbCi/NGbPISMHb1uHxn3KhCgvq01KqfaErO7QkfCqk20/qRU h++3eZEt+8TfKd232AmWg+NddJORw8B4XBmJJS9rDAKX7tSzfcQdmbp62ggxJkoZAF2T g/5J0mzyTnh16vaw1k885GMC2qMlK5y3/ZibUj+JT+0EDIfMj4AN5TliJ2zRS9c2noCd gVMso+ZSRbITI3ikBZfM8SUQxLaSNIH8F/jISejmJxiZZIxmsc0t3qq4/wC1gx6IMNu2 muPClHCDmxgV6Vd7jD5uKqZ8K5VtPM0e1APZecU9Ptx0peohLgDU5jJMzwPsUxU+qtKR AIgQ== X-Gm-Message-State: AOJu0Yx/XiCJoG5yVMKPcq+Yiwj0awa18zEuf7GpI5W3/D75lNiJq4LF YKrOZNUnrGAsplo3tbk24NLxWg== X-Google-Smtp-Source: AGHT+IFIMVvhNg464qJima4kezuYWuRmRs+hpxgOQnc+URZYC5BvtqpinR7GN44km7chTJtWGj8fDQ== X-Received: by 2002:a7b:c390:0:b0:401:38dc:8918 with SMTP id s16-20020a7bc390000000b0040138dc8918mr481515wmj.24.1693940015869; Tue, 05 Sep 2023 11:53:35 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:7a54:5dbc:6d09:48b7]) by smtp.gmail.com with ESMTPSA id 17-20020a05600c249100b003fbc30825fbsm17550010wms.39.2023.09.05.11.53.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Sep 2023 11:53:35 -0700 (PDT) From: Bartosz Golaszewski To: Aaro Koskinen , Janusz Krzysztofik , Tony Lindgren , Russell King , Mika Westerberg , Andy Shevchenko , Linus Walleij , Bartosz Golaszewski , Dipen Patel , Thierry Reding , Jonathan Hunter , Hans de Goede , Mark Gross Cc: 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: [PATCH 08/21] gpio: acpi: provide acpi_gpio_device_free_interrupts() Date: Tue, 5 Sep 2023 20:52:56 +0200 Message-Id: <20230905185309.131295-9-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230905185309.131295-1-brgl@bgdev.pl> References: <20230905185309.131295-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230905_115338_752111_42D2E503 X-CRM114-Status: GOOD ( 15.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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(). 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 + * + * 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. + */ +#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) +{ +} +#endif + #endif /* __LINUX_GPIO_DRIVER_H */