* kernel panic on gpio-keys @ 2013-12-11 19:17 Paul Cercueil 2013-12-14 9:39 ` Dmitry Torokhov 0 siblings, 1 reply; 6+ messages in thread From: Paul Cercueil @ 2013-12-11 19:17 UTC (permalink / raw) To: linux-input; +Cc: dmitry.torokhov Hi there, I am trying to use the gpio-keys driver to inject joystick events. There seems to be some basic support of it, looking at <linux/gpio_keys.h>. However, registering the following will trigger a kernel panic in the kernel: static struct gpio_keys_button my_buttons[] { { .gpio = GPIO_FOO, .type = EV_ABS, .code = ABS_HAT0X, .value = 1, }, }; (tested on kernel 3.12). I don't know well the input subsystem, so I have no idea of what is going wrong. Could anybody try to at least reproduce the issue? Regards. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: kernel panic on gpio-keys 2013-12-11 19:17 kernel panic on gpio-keys Paul Cercueil @ 2013-12-14 9:39 ` Dmitry Torokhov 2013-12-17 15:17 ` Paul Cercueil 0 siblings, 1 reply; 6+ messages in thread From: Dmitry Torokhov @ 2013-12-14 9:39 UTC (permalink / raw) To: Paul Cercueil; +Cc: linux-input On Wed, Dec 11, 2013 at 08:17:29PM +0100, Paul Cercueil wrote: > Hi there, > > I am trying to use the gpio-keys driver to inject joystick events. > There seems to be some basic support of it, looking at <linux/gpio_keys.h>. > > However, registering the following will trigger a kernel panic in > the kernel: > > static struct gpio_keys_button my_buttons[] { > { > .gpio = GPIO_FOO, > .type = EV_ABS, > .code = ABS_HAT0X, > .value = 1, > }, > }; > > (tested on kernel 3.12). > > I don't know well the input subsystem, so I have no idea of what is > going wrong. Could anybody try to at least reproduce the issue? It woudl be helpful if you poster the stack trace from panic so we'd have an idea where the fault happens. Thanks. -- Dmitry ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: kernel panic on gpio-keys 2013-12-14 9:39 ` Dmitry Torokhov @ 2013-12-17 15:17 ` Paul Cercueil 2013-12-27 1:56 ` Dmitry Torokhov 0 siblings, 1 reply; 6+ messages in thread From: Paul Cercueil @ 2013-12-17 15:17 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: linux-input On 14/12/2013 10:39, Dmitry Torokhov wrote: > On Wed, Dec 11, 2013 at 08:17:29PM +0100, Paul Cercueil wrote: >> Hi there, >> >> I am trying to use the gpio-keys driver to inject joystick events. >> There seems to be some basic support of it, looking at <linux/gpio_keys.h>. >> >> However, registering the following will trigger a kernel panic in >> the kernel: >> >> static struct gpio_keys_button my_buttons[] { >> { >> .gpio = GPIO_FOO, >> .type = EV_ABS, >> .code = ABS_HAT0X, >> .value = 1, >> }, >> }; >> >> (tested on kernel 3.12). >> >> I don't know well the input subsystem, so I have no idea of what is >> going wrong. Could anybody try to at least reproduce the issue? > > It woudl be helpful if you poster the stack trace from panic so we'd > have an idea where the fault happens. > > Thanks. > Here is the crash log I get: http://pastebin.com/FzTTGxsR (I did put it on pastebin because it's huge, 200+ lines). The first OOPS happen as soon as the GPIO button is pressed; the other ones seem to happen recursively. I included only a part of the log I get, as the OOPSes continue to flow until the watchdog kicks in. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: kernel panic on gpio-keys 2013-12-17 15:17 ` Paul Cercueil @ 2013-12-27 1:56 ` Dmitry Torokhov 2013-12-30 15:13 ` Paul Cercueil 0 siblings, 1 reply; 6+ messages in thread From: Dmitry Torokhov @ 2013-12-27 1:56 UTC (permalink / raw) To: Paul Cercueil; +Cc: linux-input, Henrik Rydberg On Tue, Dec 17, 2013 at 04:17:34PM +0100, Paul Cercueil wrote: > On 14/12/2013 10:39, Dmitry Torokhov wrote: > >On Wed, Dec 11, 2013 at 08:17:29PM +0100, Paul Cercueil wrote: > >>Hi there, > >> > >>I am trying to use the gpio-keys driver to inject joystick events. > >>There seems to be some basic support of it, looking at <linux/gpio_keys.h>. > >> > >>However, registering the following will trigger a kernel panic in > >>the kernel: > >> > >>static struct gpio_keys_button my_buttons[] { > >> { > >> .gpio = GPIO_FOO, > >> .type = EV_ABS, > >> .code = ABS_HAT0X, > >> .value = 1, > >> }, > >>}; > >> > >>(tested on kernel 3.12). > >> > >>I don't know well the input subsystem, so I have no idea of what is > >>going wrong. Could anybody try to at least reproduce the issue? > > > >It woudl be helpful if you poster the stack trace from panic so we'd > >have an idea where the fault happens. > > > >Thanks. > > > > Here is the crash log I get: http://pastebin.com/FzTTGxsR > (I did put it on pastebin because it's huge, 200+ lines). > > The first OOPS happen as soon as the GPIO button is pressed; the > other ones seem to happen recursively. I included only a part of the > log I get, as the OOPSes continue to flow until the watchdog kicks > in. Hmm, I have an idea: this driver is one of few that does not use input_set_abs_info() and this does not allocate memory for absinfo data that input core uses to handle absolute events. Does the patch below work for you? Thanks. -- Dmitry Input: allocate absinfo data when setting ABS capability From: Dmitry Torokhov <dmitry.torokhov@gmail.com> We need to make sure we allocate absinfo data when we are setting one of EV_ABS/ABS_XXX capabilities, otherwise we may bomb when we try to emit this event. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> --- drivers/input/input.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/input/input.c b/drivers/input/input.c index 692435a..1c4c0db 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -1909,6 +1909,10 @@ void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int break; case EV_ABS: + input_alloc_absinfo(dev); + if (!dev->absinfo) + return; + __set_bit(code, dev->absbit); break; ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: kernel panic on gpio-keys 2013-12-27 1:56 ` Dmitry Torokhov @ 2013-12-30 15:13 ` Paul Cercueil 2013-12-30 18:42 ` Dmitry Torokhov 0 siblings, 1 reply; 6+ messages in thread From: Paul Cercueil @ 2013-12-30 15:13 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: linux-input, Henrik Rydberg On 27/12/2013 02:56, Dmitry Torokhov wrote: > On Tue, Dec 17, 2013 at 04:17:34PM +0100, Paul Cercueil wrote: >> On 14/12/2013 10:39, Dmitry Torokhov wrote: >>> On Wed, Dec 11, 2013 at 08:17:29PM +0100, Paul Cercueil wrote: >>>> Hi there, >>>> >>>> I am trying to use the gpio-keys driver to inject joystick events. >>>> There seems to be some basic support of it, looking at <linux/gpio_keys.h>. >>>> >>>> However, registering the following will trigger a kernel panic in >>>> the kernel: >>>> >>>> static struct gpio_keys_button my_buttons[] { >>>> { >>>> .gpio = GPIO_FOO, >>>> .type = EV_ABS, >>>> .code = ABS_HAT0X, >>>> .value = 1, >>>> }, >>>> }; >>>> >>>> (tested on kernel 3.12). >>>> >>>> I don't know well the input subsystem, so I have no idea of what is >>>> going wrong. Could anybody try to at least reproduce the issue? >>> >>> It woudl be helpful if you poster the stack trace from panic so we'd >>> have an idea where the fault happens. >>> >>> Thanks. >>> >> >> Here is the crash log I get: http://pastebin.com/FzTTGxsR >> (I did put it on pastebin because it's huge, 200+ lines). >> >> The first OOPS happen as soon as the GPIO button is pressed; the >> other ones seem to happen recursively. I included only a part of the >> log I get, as the OOPSes continue to flow until the watchdog kicks >> in. > > Hmm, I have an idea: this driver is one of few that does not use > input_set_abs_info() and this does not allocate memory for absinfo data > that input core uses to handle absolute events. > > Does the patch below work for you? > > Thanks. > Hi, The patch works just fine, thank you! ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: kernel panic on gpio-keys 2013-12-30 15:13 ` Paul Cercueil @ 2013-12-30 18:42 ` Dmitry Torokhov 0 siblings, 0 replies; 6+ messages in thread From: Dmitry Torokhov @ 2013-12-30 18:42 UTC (permalink / raw) To: Paul Cercueil; +Cc: linux-input, Henrik Rydberg On Mon, Dec 30, 2013 at 04:13:12PM +0100, Paul Cercueil wrote: > On 27/12/2013 02:56, Dmitry Torokhov wrote: > >On Tue, Dec 17, 2013 at 04:17:34PM +0100, Paul Cercueil wrote: > >>On 14/12/2013 10:39, Dmitry Torokhov wrote: > >>>On Wed, Dec 11, 2013 at 08:17:29PM +0100, Paul Cercueil wrote: > >>>>Hi there, > >>>> > >>>>I am trying to use the gpio-keys driver to inject joystick events. > >>>>There seems to be some basic support of it, looking at <linux/gpio_keys.h>. > >>>> > >>>>However, registering the following will trigger a kernel panic in > >>>>the kernel: > >>>> > >>>>static struct gpio_keys_button my_buttons[] { > >>>> { > >>>> .gpio = GPIO_FOO, > >>>> .type = EV_ABS, > >>>> .code = ABS_HAT0X, > >>>> .value = 1, > >>>> }, > >>>>}; > >>>> > >>>>(tested on kernel 3.12). > >>>> > >>>>I don't know well the input subsystem, so I have no idea of what is > >>>>going wrong. Could anybody try to at least reproduce the issue? > >>> > >>>It woudl be helpful if you poster the stack trace from panic so we'd > >>>have an idea where the fault happens. > >>> > >>>Thanks. > >>> > >> > >>Here is the crash log I get: http://pastebin.com/FzTTGxsR > >>(I did put it on pastebin because it's huge, 200+ lines). > >> > >>The first OOPS happen as soon as the GPIO button is pressed; the > >>other ones seem to happen recursively. I included only a part of the > >>log I get, as the OOPSes continue to flow until the watchdog kicks > >>in. > > > >Hmm, I have an idea: this driver is one of few that does not use > >input_set_abs_info() and this does not allocate memory for absinfo data > >that input core uses to handle absolute events. > > > >Does the patch below work for you? > > > >Thanks. > > > > Hi, > > The patch works just fine, thank you! Thanks Paul. -- Dmitry ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-12-30 18:42 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-12-11 19:17 kernel panic on gpio-keys Paul Cercueil 2013-12-14 9:39 ` Dmitry Torokhov 2013-12-17 15:17 ` Paul Cercueil 2013-12-27 1:56 ` Dmitry Torokhov 2013-12-30 15:13 ` Paul Cercueil 2013-12-30 18:42 ` Dmitry Torokhov
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).