* [PATCH] gpio: Wakeup gpio controller when it is used as IRQ controller
@ 2017-09-20 7:14 Michal Simek
2017-09-20 20:07 ` Grygorii Strashko
2017-09-22 0:08 ` kbuild test robot
0 siblings, 2 replies; 6+ messages in thread
From: Michal Simek @ 2017-09-20 7:14 UTC (permalink / raw)
To: linux-kernel, monstr; +Cc: Borsodi Petr, Linus Walleij, linux-gpio
From: Borsodi Petr <Petr.Borsodi@i.cz>
There is a problem with GPIO driver when used as IRQ controller.
It is not working because the module is sleeping (clock is disabled).
The patch enables clocks when IP is used as IRQ controller.
Signed-off-by: Borsodi Petr <Petr.Borsodi@i.cz>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
Based on discussion with Linus here https://lkml.org/lkml/2017/8/22/400
---
drivers/gpio/gpiolib.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index eb80dac4e26a..17258ad1fadb 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1676,14 +1676,22 @@ static void gpiochip_irq_unmap(struct irq_domain *d, unsigned int irq)
static int gpiochip_irq_reqres(struct irq_data *d)
{
struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
+ int ret;
if (!try_module_get(chip->gpiodev->owner))
return -ENODEV;
+ ret = pm_runtime_get_sync(chip->parent);
+ if (ret < 0) {
+ module_put(chip->gpiodev->owner);
+ return ret;
+ }
+
if (gpiochip_lock_as_irq(chip, d->hwirq)) {
chip_err(chip,
"unable to lock HW IRQ %lu for IRQ\n",
d->hwirq);
+ pm_runtime_put(chip->parent);
module_put(chip->gpiodev->owner);
return -EINVAL;
}
@@ -1695,6 +1703,7 @@ static void gpiochip_irq_relres(struct irq_data *d)
struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
gpiochip_unlock_as_irq(chip, d->hwirq);
+ pm_runtime_put(chip->parent);
module_put(chip->gpiodev->owner);
}
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] gpio: Wakeup gpio controller when it is used as IRQ controller
2017-09-20 7:14 [PATCH] gpio: Wakeup gpio controller when it is used as IRQ controller Michal Simek
@ 2017-09-20 20:07 ` Grygorii Strashko
2017-09-22 0:08 ` kbuild test robot
1 sibling, 0 replies; 6+ messages in thread
From: Grygorii Strashko @ 2017-09-20 20:07 UTC (permalink / raw)
To: Michal Simek, linux-kernel, monstr
Cc: Borsodi Petr, Linus Walleij, linux-gpio, Jon Hunter
On 09/20/2017 02:14 AM, Michal Simek wrote:
> From: Borsodi Petr <Petr.Borsodi@i.cz>
>
> There is a problem with GPIO driver when used as IRQ controller.
> It is not working because the module is sleeping (clock is disabled).
> The patch enables clocks when IP is used as IRQ controller.
I think, it should be solved already in genirq core.
commit be45beb "genirq: Add runtime power management support for IRQ chips"
>
> Signed-off-by: Borsodi Petr <Petr.Borsodi@i.cz>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
> Based on discussion with Linus here https://lkml.org/lkml/2017/8/22/400
> ---
> drivers/gpio/gpiolib.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index eb80dac4e26a..17258ad1fadb 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -1676,14 +1676,22 @@ static void gpiochip_irq_unmap(struct irq_domain *d, unsigned int irq)
> static int gpiochip_irq_reqres(struct irq_data *d)
> {
> struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
> + int ret;
>
> if (!try_module_get(chip->gpiodev->owner))
> return -ENODEV;
>
> + ret = pm_runtime_get_sync(chip->parent);
> + if (ret < 0) {
> + module_put(chip->gpiodev->owner);
> + return ret;
> + }
> +
> if (gpiochip_lock_as_irq(chip, d->hwirq)) {
> chip_err(chip,
> "unable to lock HW IRQ %lu for IRQ\n",
> d->hwirq);
> + pm_runtime_put(chip->parent);
> module_put(chip->gpiodev->owner);
> return -EINVAL;
> }
> @@ -1695,6 +1703,7 @@ static void gpiochip_irq_relres(struct irq_data *d)
> struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
>
> gpiochip_unlock_as_irq(chip, d->hwirq);
> + pm_runtime_put(chip->parent);
> module_put(chip->gpiodev->owner);
> }
>
>
--
regards,
-grygorii
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] gpio: Wakeup gpio controller when it is used as IRQ controller
@ 2017-09-20 20:07 ` Grygorii Strashko
0 siblings, 0 replies; 6+ messages in thread
From: Grygorii Strashko @ 2017-09-20 20:07 UTC (permalink / raw)
To: Michal Simek, linux-kernel, monstr
Cc: Borsodi Petr, Linus Walleij, linux-gpio, Jon Hunter
On 09/20/2017 02:14 AM, Michal Simek wrote:
> From: Borsodi Petr <Petr.Borsodi@i.cz>
>
> There is a problem with GPIO driver when used as IRQ controller.
> It is not working because the module is sleeping (clock is disabled).
> The patch enables clocks when IP is used as IRQ controller.
I think, it should be solved already in genirq core.
commit be45beb "genirq: Add runtime power management support for IRQ chips"
>
> Signed-off-by: Borsodi Petr <Petr.Borsodi@i.cz>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
> Based on discussion with Linus here https://lkml.org/lkml/2017/8/22/400
> ---
> drivers/gpio/gpiolib.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index eb80dac4e26a..17258ad1fadb 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -1676,14 +1676,22 @@ static void gpiochip_irq_unmap(struct irq_domain *d, unsigned int irq)
> static int gpiochip_irq_reqres(struct irq_data *d)
> {
> struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
> + int ret;
>
> if (!try_module_get(chip->gpiodev->owner))
> return -ENODEV;
>
> + ret = pm_runtime_get_sync(chip->parent);
> + if (ret < 0) {
> + module_put(chip->gpiodev->owner);
> + return ret;
> + }
> +
> if (gpiochip_lock_as_irq(chip, d->hwirq)) {
> chip_err(chip,
> "unable to lock HW IRQ %lu for IRQ\n",
> d->hwirq);
> + pm_runtime_put(chip->parent);
> module_put(chip->gpiodev->owner);
> return -EINVAL;
> }
> @@ -1695,6 +1703,7 @@ static void gpiochip_irq_relres(struct irq_data *d)
> struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
>
> gpiochip_unlock_as_irq(chip, d->hwirq);
> + pm_runtime_put(chip->parent);
> module_put(chip->gpiodev->owner);
> }
>
>
--
regards,
-grygorii
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] gpio: Wakeup gpio controller when it is used as IRQ controller
2017-09-20 20:07 ` Grygorii Strashko
(?)
@ 2017-09-21 12:19 ` Linus Walleij
2017-10-16 13:40 ` Michal Simek
-1 siblings, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2017-09-21 12:19 UTC (permalink / raw)
To: Grygorii Strashko
Cc: Michal Simek, linux-kernel, monstr, Borsodi Petr, linux-gpio, Jon Hunter
On Wed, Sep 20, 2017 at 10:07 PM, Grygorii Strashko
<grygorii.strashko@ti.com> wrote:
> On 09/20/2017 02:14 AM, Michal Simek wrote:
>> From: Borsodi Petr <Petr.Borsodi@i.cz>
>>
>> There is a problem with GPIO driver when used as IRQ controller.
>> It is not working because the module is sleeping (clock is disabled).
>> The patch enables clocks when IP is used as IRQ controller.
>
> I think, it should be solved already in genirq core.
> commit be45beb "genirq: Add runtime power management support for IRQ chips"
Michal, can you verify?
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] gpio: Wakeup gpio controller when it is used as IRQ controller
2017-09-20 7:14 [PATCH] gpio: Wakeup gpio controller when it is used as IRQ controller Michal Simek
2017-09-20 20:07 ` Grygorii Strashko
@ 2017-09-22 0:08 ` kbuild test robot
1 sibling, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2017-09-22 0:08 UTC (permalink / raw)
To: Michal Simek
Cc: kbuild-all, linux-kernel, monstr, Borsodi Petr, Linus Walleij,
linux-gpio
[-- Attachment #1: Type: text/plain, Size: 6977 bytes --]
Hi Borsodi,
[auto build test ERROR on gpio/for-next]
[also build test ERROR on v4.14-rc1 next-20170921]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Michal-Simek/gpio-Wakeup-gpio-controller-when-it-is-used-as-IRQ-controller/20170922-070306
base: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git for-next
config: i386-randconfig-x000-201738 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
drivers//gpio/gpiolib.c: In function 'gpiochip_irq_reqres':
>> drivers//gpio/gpiolib.c:1684:8: error: implicit declaration of function 'pm_runtime_get_sync' [-Werror=implicit-function-declaration]
ret = pm_runtime_get_sync(chip->parent);
^~~~~~~~~~~~~~~~~~~
>> drivers//gpio/gpiolib.c:1694:3: error: implicit declaration of function 'pm_runtime_put' [-Werror=implicit-function-declaration]
pm_runtime_put(chip->parent);
^~~~~~~~~~~~~~
In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/linux/bitmap.h:6,
from drivers//gpio/gpiolib.c:1:
drivers//gpio/gpiolib.c: At top level:
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'strcpy' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:421:2: note: in expansion of macro 'if'
if (p_size == (size_t)-1 && q_size == (size_t)-1)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'kmemdup' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:411:2: note: in expansion of macro 'if'
if (p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'kmemdup' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:409:2: note: in expansion of macro 'if'
if (__builtin_constant_p(size) && p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr_inv' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:400:2: note: in expansion of macro 'if'
if (p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr_inv' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:398:2: note: in expansion of macro 'if'
if (__builtin_constant_p(size) && p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:389:2: note: in expansion of macro 'if'
if (p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memchr' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:387:2: note: in expansion of macro 'if'
if (__builtin_constant_p(size) && p_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memcmp' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:379:2: note: in expansion of macro 'if'
if (p_size < size || q_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memcmp' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:376:3: note: in expansion of macro 'if'
if (q_size < size)
^~
include/linux/compiler.h:162:4: warning: '______f' is static but declared in inline function 'memcmp' which is not static
______f = { \
^
include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
include/linux/string.h:374:3: note: in expansion of macro 'if'
if (p_size < size)
^~
vim +/pm_runtime_get_sync +1684 drivers//gpio/gpiolib.c
1675
1676 static int gpiochip_irq_reqres(struct irq_data *d)
1677 {
1678 struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
1679 int ret;
1680
1681 if (!try_module_get(chip->gpiodev->owner))
1682 return -ENODEV;
1683
> 1684 ret = pm_runtime_get_sync(chip->parent);
1685 if (ret < 0) {
1686 module_put(chip->gpiodev->owner);
1687 return ret;
1688 }
1689
1690 if (gpiochip_lock_as_irq(chip, d->hwirq)) {
1691 chip_err(chip,
1692 "unable to lock HW IRQ %lu for IRQ\n",
1693 d->hwirq);
> 1694 pm_runtime_put(chip->parent);
1695 module_put(chip->gpiodev->owner);
1696 return -EINVAL;
1697 }
1698 return 0;
1699 }
1700
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 29438 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] gpio: Wakeup gpio controller when it is used as IRQ controller
2017-09-21 12:19 ` Linus Walleij
@ 2017-10-16 13:40 ` Michal Simek
0 siblings, 0 replies; 6+ messages in thread
From: Michal Simek @ 2017-10-16 13:40 UTC (permalink / raw)
To: Linus Walleij, Grygorii Strashko
Cc: Michal Simek, linux-kernel, monstr, Borsodi Petr, linux-gpio, Jon Hunter
Hi Linus,
On 21.9.2017 14:19, Linus Walleij wrote:
> On Wed, Sep 20, 2017 at 10:07 PM, Grygorii Strashko
> <grygorii.strashko@ti.com> wrote:
>> On 09/20/2017 02:14 AM, Michal Simek wrote:
>>> From: Borsodi Petr <Petr.Borsodi@i.cz>
>>>
>>> There is a problem with GPIO driver when used as IRQ controller.
>>> It is not working because the module is sleeping (clock is disabled).
>>> The patch enables clocks when IP is used as IRQ controller.
>>
>> I think, it should be solved already in genirq core.
>> commit be45beb "genirq: Add runtime power management support for IRQ chips"
>
> Michal, can you verify?
sorry for delay. I have just confirmed that this patch is not needed.
At least I am not able to replicate the issue again that's why please
skip this patch.
Thanks,
Michal
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-10-16 13:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-20 7:14 [PATCH] gpio: Wakeup gpio controller when it is used as IRQ controller Michal Simek
2017-09-20 20:07 ` Grygorii Strashko
2017-09-20 20:07 ` Grygorii Strashko
2017-09-21 12:19 ` Linus Walleij
2017-10-16 13:40 ` Michal Simek
2017-09-22 0:08 ` kbuild test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.