* Re: [PATCH] gpiolib: translate pin number in GPIO ACPI callbacks
2015-03-10 17:15 [PATCH] gpiolib: translate pin number in GPIO ACPI callbacks qipeng.zha
@ 2015-03-10 15:04 ` Mika Westerberg
2015-03-19 8:23 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Mika Westerberg @ 2015-03-10 15:04 UTC (permalink / raw)
To: qipeng.zha; +Cc: linux-gpio, linus.walleij, qi.zheng, jason.cj.chen
On Wed, Mar 11, 2015 at 01:15:38AM +0800, qipeng.zha wrote:
> From: "qipeng.zha" <qipeng.zha@intel.com>
>
> If GPIO driver use pin mapping, need to translate pin number
> between ACPI table and GPIO driver.
>
> This issue is found on one platform with Cherryview gpio
> controller, kernel is hang when executed _PS0 method of
> one ACPI device, since without this translation, it access
> invalid gpiodesc array.
>
> Verified it works again with this patch.
>
> Signed-off-by: qipeng.zha <qipeng.zha@intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] gpiolib: translate pin number in GPIO ACPI callbacks
@ 2015-03-10 17:15 qipeng.zha
2015-03-10 15:04 ` Mika Westerberg
2015-03-19 8:23 ` Linus Walleij
0 siblings, 2 replies; 3+ messages in thread
From: qipeng.zha @ 2015-03-10 17:15 UTC (permalink / raw)
To: linux-gpio
Cc: linus.walleij, mika.westerberg, qi.zheng, jason.cj.chen,
qipeng.zha
From: "qipeng.zha" <qipeng.zha@intel.com>
If GPIO driver use pin mapping, need to translate pin number
between ACPI table and GPIO driver.
This issue is found on one platform with Cherryview gpio
controller, kernel is hang when executed _PS0 method of
one ACPI device, since without this translation, it access
invalid gpiodesc array.
Verified it works again with this patch.
Signed-off-by: qipeng.zha <qipeng.zha@intel.com>
---
drivers/gpio/gpiolib-acpi.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index c0929d9..df990f2 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -201,6 +201,10 @@ static acpi_status acpi_gpiochip_request_interrupt(struct acpi_resource *ares,
if (!handler)
return AE_BAD_PARAMETER;
+ pin = acpi_gpiochip_pin_to_gpio_offset(chip, pin);
+ if (pin < 0)
+ return AE_BAD_PARAMETER;
+
desc = gpiochip_request_own_desc(chip, pin, "ACPI:Event");
if (IS_ERR(desc)) {
dev_err(chip->dev, "Failed to request GPIO\n");
@@ -551,6 +555,12 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address,
struct gpio_desc *desc;
bool found;
+ pin = acpi_gpiochip_pin_to_gpio_offset(chip, pin);
+ if (pin < 0) {
+ status = AE_BAD_PARAMETER;
+ goto out;
+ }
+
mutex_lock(&achip->conn_lock);
found = false;
--
1.8.3.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] gpiolib: translate pin number in GPIO ACPI callbacks
2015-03-10 17:15 [PATCH] gpiolib: translate pin number in GPIO ACPI callbacks qipeng.zha
2015-03-10 15:04 ` Mika Westerberg
@ 2015-03-19 8:23 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2015-03-19 8:23 UTC (permalink / raw)
To: qipeng.zha
Cc: linux-gpio@vger.kernel.org, Westerberg, Mika, qi.zheng,
jason.cj.chen
On Tue, Mar 10, 2015 at 6:15 PM, qipeng.zha <qipeng.zha@intel.com> wrote:
> From: "qipeng.zha" <qipeng.zha@intel.com>
>
> If GPIO driver use pin mapping, need to translate pin number
> between ACPI table and GPIO driver.
>
> This issue is found on one platform with Cherryview gpio
> controller, kernel is hang when executed _PS0 method of
> one ACPI device, since without this translation, it access
> invalid gpiodesc array.
>
> Verified it works again with this patch.
>
> Signed-off-by: qipeng.zha <qipeng.zha@intel.com>
Patch applied with Mika's ACK.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-19 8:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-10 17:15 [PATCH] gpiolib: translate pin number in GPIO ACPI callbacks qipeng.zha
2015-03-10 15:04 ` Mika Westerberg
2015-03-19 8:23 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).