From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Evan Green <evgreen@chromium.org>,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Peter Korsgaard <peter.korsgaard@barco.com>,
Peter Rosin <peda@axentia.se>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v1 1/3] i2c: mux: gpio: Replace custom acpi_get_local_address()
Date: Mon, 15 Nov 2021 17:41:59 +0200 [thread overview]
Message-ID: <20211115154201.46579-1-andriy.shevchenko@linux.intel.com> (raw)
Recently ACPI gained the acpi_get_local_address() API which may be used
instead of home grown i2c_mux_gpio_get_acpi_adr().
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/i2c/muxes/i2c-mux-gpio.c | 43 ++------------------------------
1 file changed, 2 insertions(+), 41 deletions(-)
diff --git a/drivers/i2c/muxes/i2c-mux-gpio.c b/drivers/i2c/muxes/i2c-mux-gpio.c
index bac415a52b78..31e6eb1591bb 100644
--- a/drivers/i2c/muxes/i2c-mux-gpio.c
+++ b/drivers/i2c/muxes/i2c-mux-gpio.c
@@ -49,45 +49,6 @@ static int i2c_mux_gpio_deselect(struct i2c_mux_core *muxc, u32 chan)
return 0;
}
-#ifdef CONFIG_ACPI
-
-static int i2c_mux_gpio_get_acpi_adr(struct device *dev,
- struct fwnode_handle *fwdev,
- unsigned int *adr)
-
-{
- unsigned long long adr64;
- acpi_status status;
-
- status = acpi_evaluate_integer(ACPI_HANDLE_FWNODE(fwdev),
- METHOD_NAME__ADR,
- NULL, &adr64);
-
- if (!ACPI_SUCCESS(status)) {
- dev_err(dev, "Cannot get address\n");
- return -EINVAL;
- }
-
- *adr = adr64;
- if (*adr != adr64) {
- dev_err(dev, "Address out of range\n");
- return -ERANGE;
- }
-
- return 0;
-}
-
-#else
-
-static int i2c_mux_gpio_get_acpi_adr(struct device *dev,
- struct fwnode_handle *fwdev,
- unsigned int *adr)
-{
- return -EINVAL;
-}
-
-#endif
-
static int i2c_mux_gpio_probe_fw(struct gpiomux *mux,
struct platform_device *pdev)
{
@@ -141,9 +102,9 @@ static int i2c_mux_gpio_probe_fw(struct gpiomux *mux,
fwnode_property_read_u32(child, "reg", values + i);
} else if (is_acpi_node(child)) {
- rc = i2c_mux_gpio_get_acpi_adr(dev, child, values + i);
+ rc = acpi_get_local_address(ACPI_HANDLE_FWNODE(child), values + i);
if (rc)
- return rc;
+ return dev_err_probe(dev, rc, "Cannot get address\n");
}
i++;
--
2.33.0
next reply other threads:[~2021-11-15 15:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-15 15:41 Andy Shevchenko [this message]
2021-11-15 15:42 ` [PATCH v1 2/3] i2c: mux: gpio: Don't dereference fwnode from struct device Andy Shevchenko
2021-11-15 17:01 ` Evan Green
2021-11-18 9:48 ` Peter Rosin
2021-11-23 10:55 ` Wolfram Sang
2021-11-15 15:42 ` [PATCH v1 3/3] i2c: mux: gpio: Use array_size() helper Andy Shevchenko
2021-11-15 17:01 ` Evan Green
2021-11-18 9:49 ` Peter Rosin
2021-11-23 10:55 ` Wolfram Sang
2021-11-15 16:55 ` [PATCH v1 1/3] i2c: mux: gpio: Replace custom acpi_get_local_address() Evan Green
2021-11-18 9:36 ` Peter Rosin
2021-11-18 10:33 ` Andy Shevchenko
2021-11-18 11:24 ` Peter Rosin
2021-11-23 10:52 ` Wolfram Sang
2021-11-23 10:55 ` Wolfram Sang
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=20211115154201.46579-1-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=evgreen@chromium.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peda@axentia.se \
--cc=peter.korsgaard@barco.com \
/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