From: "Marco Scardovi (scardracs)" <mscardovi95@gmail.com>
To: Linus Walleij <linusw@kernel.org>, Bartosz Golaszewski <brgl@kernel.org>
Cc: Mika Westerberg <westeri@kernel.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Marco Scardovi (scardracs)" <mscardovi95@gmail.com>
Subject: [PATCH 09/12] gpiolib: acpi: Remove unused static address space emulation from core
Date: Mon, 18 May 2026 09:53:54 +0200 [thread overview]
Message-ID: <20260518075357.112584-10-mscardovi95@gmail.com> (raw)
In-Reply-To: <20260518075357.112584-1-mscardovi95@gmail.com>
Assisted-by: Antigravity:gemini-3-flash
Signed-off-by: Marco Scardovi <mscardovi95@gmail.com>
---
drivers/gpio/gpiolib-acpi-core.c | 120 -------------------------------
1 file changed, 120 deletions(-)
diff --git a/drivers/gpio/gpiolib-acpi-core.c b/drivers/gpio/gpiolib-acpi-core.c
index 4802d4948f89..b8976a0c798e 100644
--- a/drivers/gpio/gpiolib-acpi-core.c
+++ b/drivers/gpio/gpiolib-acpi-core.c
@@ -1049,126 +1049,6 @@ int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *con_id,
}
EXPORT_SYMBOL_GPL(acpi_dev_gpio_irq_wake_get_by);
-static acpi_status
-acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address,
- u32 bits, u64 *value, void *handler_context,
- void *region_context)
-{
- struct acpi_gpio_chip *achip = region_context;
- struct gpio_chip *chip = achip->chip;
- struct acpi_resource_gpio *agpio;
- struct acpi_resource *ares;
- u16 pin_index = address;
- acpi_status status;
- int length;
- int i;
-
- status = acpi_buffer_to_resource(achip->conn_info.connection,
- achip->conn_info.length, &ares);
- if (ACPI_FAILURE(status))
- return status;
-
- if (WARN_ON(ares->type != ACPI_RESOURCE_TYPE_GPIO)) {
- ACPI_FREE(ares);
- return AE_BAD_PARAMETER;
- }
-
- agpio = &ares->data.gpio;
-
- if (WARN_ON(agpio->io_restriction == ACPI_IO_RESTRICT_INPUT &&
- function == ACPI_WRITE)) {
- ACPI_FREE(ares);
- return AE_BAD_PARAMETER;
- }
-
- if (pin_index >= agpio->pin_table_length) {
- ACPI_FREE(ares);
- return AE_BAD_PARAMETER;
- }
-
- length = min(agpio->pin_table_length, pin_index + bits);
- for (i = pin_index; i < length; ++i) {
- unsigned int pin = agpio->pin_table[i];
- struct acpi_gpio_connection *conn;
- struct gpio_desc *desc;
- u16 word, shift;
- bool found;
-
- mutex_lock(&achip->conn_lock);
-
- found = false;
- list_for_each_entry(conn, &achip->conns, node) {
- if (conn->pin == pin) {
- found = true;
- desc = conn->desc;
- break;
- }
- }
-
- /*
- * The same GPIO can be shared between operation region and
- * event but only if the access here is ACPI_READ. In that
- * case we "borrow" the event GPIO instead.
- */
- if (!found && agpio->shareable == ACPI_SHARED &&
- function == ACPI_READ) {
- struct acpi_gpio_event *event;
-
- list_for_each_entry(event, &achip->events, node) {
- if (event->pin == pin) {
- desc = event->desc;
- found = true;
- break;
- }
- }
- }
-
- if (!found) {
- desc = acpi_request_own_gpiod(chip, agpio, i, "ACPI:OpRegion");
- if (IS_ERR(desc)) {
- mutex_unlock(&achip->conn_lock);
- status = AE_ERROR;
- goto out;
- }
-
- conn = kzalloc_obj(*conn);
- if (!conn) {
- gpiochip_free_own_desc(desc);
- mutex_unlock(&achip->conn_lock);
- status = AE_NO_MEMORY;
- goto out;
- }
-
- conn->pin = pin;
- conn->desc = desc;
- list_add_tail(&conn->node, &achip->conns);
- }
-
- mutex_unlock(&achip->conn_lock);
-
- /*
- * For the cases when OperationRegion() consists of more than
- * 64 bits calculate the word and bit shift to use that one to
- * access the value.
- */
- word = i / 64;
- shift = i % 64;
-
- if (function == ACPI_WRITE) {
- gpiod_set_raw_value_cansleep(desc, value[word] & BIT_ULL(shift));
- } else {
- if (gpiod_get_raw_value_cansleep(desc))
- value[word] |= BIT_ULL(shift);
- else
- value[word] &= ~BIT_ULL(shift);
- }
- }
-
-out:
- ACPI_FREE(ares);
- return status;
-}
-
void acpi_gpiochip_add(struct gpio_chip *chip)
{
--
2.54.0
next prev parent reply other threads:[~2026-05-18 7:54 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-18 7:53 [PATCH 00/12] gpiolib: acpi: Refactor, harden, and modularize ACPI GPIO support Marco Scardovi (scardracs)
2026-05-18 7:53 ` [PATCH 01/12] gpiolib: acpi: Use snprintf() for ACPI event name formatting Marco Scardovi (scardracs)
2026-05-18 8:07 ` Andy Shevchenko
2026-05-18 7:53 ` [PATCH 02/12] gpiolib: acpi: Modernize string parsing in quirks layer Marco Scardovi (scardracs)
2026-05-18 8:11 ` Andy Shevchenko
2026-05-18 7:53 ` [PATCH 03/12] gpiolib: acpi: Add robust bounds-checking for GPIO pin resources Marco Scardovi (scardracs)
2026-05-18 10:33 ` Mika Westerberg
2026-05-19 7:00 ` [PATCH v2 0/2] gpiolib: acpi: Add bounds-checking and fix leak in OpRegion Marco Scardovi (scardracs)
2026-05-19 7:00 ` [PATCH 1/2] gpiolib: acpi: Add robust bounds-checking for GPIO pin resources Marco Scardovi (scardracs)
2026-05-19 7:25 ` Andy Shevchenko
2026-05-19 7:00 ` [PATCH 2/2] gpiolib: acpi: Fix resource leak in OpRegion cleanup path Marco Scardovi (scardracs)
2026-05-19 8:28 ` Andy Shevchenko
2026-05-20 7:45 ` [PATCH v3 0/2] gpiolib: acpi: Fix bounds-checking and connection leak Marco Scardovi (scardracs)
2026-05-20 7:45 ` [PATCH v3 1/2] gpiolib: acpi: Add robust bounds-checking for GPIO pin resources Marco Scardovi (scardracs)
2026-06-02 7:34 ` Andy Shevchenko
2026-05-20 7:45 ` [PATCH v3 2/2] Fixes: gpiolib: acpi: resource leak in OpRegion Marco Scardovi (scardracs)
2026-06-02 7:45 ` Andy Shevchenko
2026-06-02 7:47 ` [PATCH v3 0/2] gpiolib: acpi: Fix bounds-checking and connection leak Andy Shevchenko
2026-05-18 7:53 ` [PATCH 04/12] gpiolib: acpi: Fix resource leak in OpRegion cleanup path Marco Scardovi (scardracs)
2026-05-18 7:53 ` [PATCH 05/12] gpiolib: acpi: Declare shared structures in gpiolib-acpi.h Marco Scardovi (scardracs)
2026-05-18 8:21 ` Andy Shevchenko
2026-05-18 7:53 ` [PATCH 06/12] gpiolib: acpi: Expose core GPIO resource and OpRegion helpers Marco Scardovi (scardracs)
2026-05-18 7:53 ` [PATCH 07/12] gpiolib: acpi: Add dedicated Operation Region module Marco Scardovi (scardracs)
2026-05-18 7:53 ` [PATCH 08/12] gpiolib: acpi: Divert OpRegion registration callbacks from core Marco Scardovi (scardracs)
2026-05-18 7:53 ` Marco Scardovi (scardracs) [this message]
2026-05-18 7:53 ` [PATCH 10/12] gpiolib: acpi: Declare shared event helpers in gpiolib-acpi.h Marco Scardovi (scardracs)
2026-05-18 7:53 ` [PATCH 11/12] gpiolib: acpi: Add dedicated ACPI GPIO events module Marco Scardovi (scardracs)
2026-05-18 7:53 ` [PATCH 12/12] gpiolib: acpi: Decouple Event and Interrupt handling from core Marco Scardovi (scardracs)
2026-05-18 8:19 ` [PATCH 00/12] gpiolib: acpi: Refactor, harden, and modularize ACPI GPIO support Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260518075357.112584-10-mscardovi95@gmail.com \
--to=mscardovi95@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=brgl@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=westeri@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox