linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] Input: twl4030 - convert to using managed resources
       [not found] <20140104090147.GA16680@core.coreip.homeip.net>
@ 2014-01-05  3:47 ` Sebastian Reichel
  2014-01-06  2:25 ` Jingoo Han
  2014-01-07  0:39 ` Jingoo Han
  2 siblings, 0 replies; 8+ messages in thread
From: Sebastian Reichel @ 2014-01-05  3:47 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: linux-input, Jingoo Han, Fugang Duan, Peter Ujfalusi,
	".linux-kernel"

[-- Attachment #1: Type: text/plain, Size: 520 bytes --]

On Sat, Jan 04, 2014 at 01:01:48AM -0800, Dmitry Torokhov wrote:
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> 
> Compile-tested only.
> 
>  drivers/input/keyboard/twl4030_keypad.c | 70 +++++++++++----------------------
>  1 file changed, 22 insertions(+), 48 deletions(-)

I have successfully booted dtor/input.git:master with this patch on
top and the addition of twl4030-keypad DT nodes in omap3-n900.dts on
my N900.

Tested-by: Sebastian Reichel <sre@debian.org>

-- Sebastian

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Input: twl4030 - convert to using managed resources
       [not found] <20140104090147.GA16680@core.coreip.homeip.net>
  2014-01-05  3:47 ` [PATCH] Input: twl4030 - convert to using managed resources Sebastian Reichel
@ 2014-01-06  2:25 ` Jingoo Han
  2014-01-06  2:33   ` 'Sebastian Reichel'
       [not found]   ` <20140106180705.GB2754@core.coreip.homeip.net>
  2014-01-07  0:39 ` Jingoo Han
  2 siblings, 2 replies; 8+ messages in thread
From: Jingoo Han @ 2014-01-06  2:25 UTC (permalink / raw)
  To: 'Dmitry Torokhov', 'Sebastian Reichel'
  Cc: linux-input, 'Fugang Duan', 'Peter Ujfalusi',
	".linux-kernel", 'Jingoo Han'

On Saturday, January 04, 2014 6:02 PM, Dmitry Torokhov wrote:
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> 
> Compile-tested only.
> 
> 
>  drivers/input/keyboard/twl4030_keypad.c | 70 +++++++++++----------------------
>  1 file changed, 22 insertions(+), 48 deletions(-)
> 
> diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c
> index f663c19..71eb041 100644
> --- a/drivers/input/keyboard/twl4030_keypad.c
> +++ b/drivers/input/keyboard/twl4030_keypad.c

[.....]

> -static int twl4030_kp_remove(struct platform_device *pdev)
> -{
> -	struct twl4030_keypad *kp = platform_get_drvdata(pdev);
> -
> -	free_irq(kp->irq, kp);
> -	input_unregister_device(kp->input);

Hi Dmitry Torokhov,

IMHO, input_unregister_device() seems to be necessary,
because input_register_device() is still used.
If I am wrong, please let me know kindly.

Sebastian Reichel,
Would you repeat insmod & rmmod 'twl4030_keypad.ko'?

Happy New Year! :-)

Best regards,
Jingoo Han


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Input: twl4030 - convert to using managed resources
  2014-01-06  2:25 ` Jingoo Han
@ 2014-01-06  2:33   ` 'Sebastian Reichel'
  2014-01-06  2:50     ` Jingoo Han
       [not found]   ` <20140106180705.GB2754@core.coreip.homeip.net>
  1 sibling, 1 reply; 8+ messages in thread
From: 'Sebastian Reichel' @ 2014-01-06  2:33 UTC (permalink / raw)
  To: Jingoo Han
  Cc: 'Dmitry Torokhov', linux-input, 'Fugang Duan',
	'Peter Ujfalusi', ".linux-kernel"

[-- Attachment #1: Type: text/plain, Size: 476 bytes --]

On Mon, Jan 06, 2014 at 11:25:54AM +0900, Jingoo Han wrote:
> IMHO, input_unregister_device() seems to be necessary,
> because input_register_device() is still used.
> If I am wrong, please let me know kindly.
> 
> Sebastian Reichel,
> Would you repeat insmod & rmmod 'twl4030_keypad.ko'?

mh. I only tested with twl4030-keypad compiled into the kernel.
I will try building the driver as module and reloading it on
the device when I find some time.

-- Sebastian

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Input: twl4030 - convert to using managed resources
  2014-01-06  2:33   ` 'Sebastian Reichel'
@ 2014-01-06  2:50     ` Jingoo Han
  2014-01-06 22:14       ` 'Sebastian Reichel'
  0 siblings, 1 reply; 8+ messages in thread
From: Jingoo Han @ 2014-01-06  2:50 UTC (permalink / raw)
  To: 'Sebastian Reichel'
  Cc: 'Dmitry Torokhov', linux-input, 'Fugang Duan',
	'Peter Ujfalusi', ".linux-kernel",
	'Jingoo Han'

On Monday, January 06, 2014 11:34 AM, Sebastian Reichel wrote:
> On Mon, Jan 06, 2014 at 11:25:54AM +0900, Jingoo Han wrote:
> > IMHO, input_unregister_device() seems to be necessary,
> > because input_register_device() is still used.
> > If I am wrong, please let me know kindly.
> >
> > Sebastian Reichel,
> > Would you repeat insmod & rmmod 'twl4030_keypad.ko'?
> 
> mh. I only tested with twl4030-keypad compiled into the kernel.
> I will try building the driver as module and reloading it on
> the device when I find some time.

OK, I see. :-)

If you repeat at least twice insmod & rmmod 'twl4030_keypad.ko',
it will be good. If there are some bugs, it will make the error
messages or kernel panic.

In my case, Samsung Exynos SPI driver made kernel panic when
Repeating insmod & rmmod twice, after the patch to covert to
devm_* functions was applied. This was because there was a bug
of devm_spi_register_master().

Thank you.

Best regards,
Jingoo Han


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Input: twl4030 - convert to using managed resources
  2014-01-06  2:50     ` Jingoo Han
@ 2014-01-06 22:14       ` 'Sebastian Reichel'
  2014-01-07  0:38         ` Jingoo Han
  0 siblings, 1 reply; 8+ messages in thread
From: 'Sebastian Reichel' @ 2014-01-06 22:14 UTC (permalink / raw)
  To: Jingoo Han
  Cc: 'Dmitry Torokhov', linux-input, 'Fugang Duan',
	'Peter Ujfalusi', ".linux-kernel"

[-- Attachment #1: Type: text/plain, Size: 391 bytes --]

On Mon, Jan 06, 2014 at 11:50:46AM +0900, Jingoo Han wrote:
> If you repeat at least twice insmod & rmmod 'twl4030_keypad.ko',
> it will be good. If there are some bugs, it will make the error
> messages or kernel panic.

I tried load & unloading the twl4030_keypad module multiple times.
I didn't get any error messages or kernel panics. Everything seems
to behave correctly.

-- Sebastian

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Input: twl4030 - convert to using managed resources
       [not found]   ` <20140106180705.GB2754@core.coreip.homeip.net>
@ 2014-01-07  0:35     ` Jingoo Han
  0 siblings, 0 replies; 8+ messages in thread
From: Jingoo Han @ 2014-01-07  0:35 UTC (permalink / raw)
  To: 'Dmitry Torokhov'
  Cc: 'Sebastian Reichel', linux-input, 'Fugang Duan',
	'Peter Ujfalusi', ".linux-kernel",
	'Jingoo Han'

On Tuesday, January 07, 2014 3:07 AM, Dmitry Torokhov wrote:
> On Mon, Jan 06, 2014 at 11:25:54AM +0900, Jingoo Han wrote:
> > On Saturday, January 04, 2014 6:02 PM, Dmitry Torokhov wrote:
> > >
> > > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > > ---
> > >
> > > Compile-tested only.
> > >
> > >
> > >  drivers/input/keyboard/twl4030_keypad.c | 70 +++++++++++----------------------
> > >  1 file changed, 22 insertions(+), 48 deletions(-)
> > >
> > > diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c
> > > index f663c19..71eb041 100644
> > > --- a/drivers/input/keyboard/twl4030_keypad.c
> > > +++ b/drivers/input/keyboard/twl4030_keypad.c
> >
> > [.....]
> >
> > > -static int twl4030_kp_remove(struct platform_device *pdev)
> > > -{
> > > -	struct twl4030_keypad *kp = platform_get_drvdata(pdev);
> > > -
> > > -	free_irq(kp->irq, kp);
> > > -	input_unregister_device(kp->input);
> >
> > Hi Dmitry Torokhov,
> >
> > IMHO, input_unregister_device() seems to be necessary,
> > because input_register_device() is still used.
> > If I am wrong, please let me know kindly.
> 
> No, input_unregister_device() is not needed (although it can be used)
> with managed input devices (ones that are allocated with
> devm_input_allocate_device()) because input_register_device() will
> automatically insert devres entry for such devices. So for managed input
> devices that were registered with input subsystem there are 2 separate
> devres entries: one for unregistering the device and another is to
> finally release all resources. If you had a sequence:
> 
> 	devm_kzalloc(...);
> 	devm_input_allocate_device(...);
> 	devm_devm_ioremap_resource(...);
> 	devm_request_irq(...);
> 	input_register_device(...);
> 
> then unwind sequence will be:
> 
> 	unregister input device (but input device structure is still
> 		present in memory and input_event() can be called, but
> 		events won't be delivered anywhere - that is done so
> 		that we can survive releasing IRQs after unregistering
> 		managed input device)
> 	free IRQ
> 	release resources
> 	free input device structure
> 	free kzalloc memory
> 
> Hope this helps.

Oh, I really appreciate your detailed and kind comments. :-)

I checked the following. As you said, input_register_device()
automatically inserts devres entry.

./drivers/input/input.c
int input_register_device(struct input_dev *dev)
{
        struct input_devres *devres = NULL;
        struct input_handler *handler;
        unsigned int packet_size;
        const char *path;
        int error;

        if (dev->devres_managed) {
                devres = devres_alloc(devm_input_device_unregister,
                                      sizeof(struct input_devres), GFP_KERNEL);

Thank you so much.

Best regards,
Jingoo Han


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Input: twl4030 - convert to using managed resources
  2014-01-06 22:14       ` 'Sebastian Reichel'
@ 2014-01-07  0:38         ` Jingoo Han
  0 siblings, 0 replies; 8+ messages in thread
From: Jingoo Han @ 2014-01-07  0:38 UTC (permalink / raw)
  To: 'Sebastian Reichel'
  Cc: 'Dmitry Torokhov', linux-input, 'Fugang Duan',
	'Peter Ujfalusi', ".linux-kernel",
	'Jingoo Han'

On Tuesday, January 07, 2014 7:14 AM, Sebastian Reichel wrote:
> On Mon, Jan 06, 2014 at 11:50:46AM +0900, Jingoo Han wrote:
> > If you repeat at least twice insmod & rmmod 'twl4030_keypad.ko',
> > it will be good. If there are some bugs, it will make the error
> > messages or kernel panic.
> 
> I tried load & unloading the twl4030_keypad module multiple times.
> I didn't get any error messages or kernel panics. Everything seems
> to behave correctly.

Thank you for your testing. :-)
I checked the sequence; it looks good.
See you later.

Best regards,
Jingoo Han



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Input: twl4030 - convert to using managed resources
       [not found] <20140104090147.GA16680@core.coreip.homeip.net>
  2014-01-05  3:47 ` [PATCH] Input: twl4030 - convert to using managed resources Sebastian Reichel
  2014-01-06  2:25 ` Jingoo Han
@ 2014-01-07  0:39 ` Jingoo Han
  2 siblings, 0 replies; 8+ messages in thread
From: Jingoo Han @ 2014-01-07  0:39 UTC (permalink / raw)
  To: 'Dmitry Torokhov', 'Sebastian Reichel'
  Cc: linux-input, 'Fugang Duan', 'Peter Ujfalusi',
	".linux-kernel", 'Jingoo Han'

On Saturday, January 04, 2014 6:02 PM, Dmitry Torokhov wrote:
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

It looks good.

Reviewed-by: Jingoo Han <jg1.han@samsung.com>

Best regards,
Jingoo Han

> ---
> 
> Compile-tested only.
> 
> 
>  drivers/input/keyboard/twl4030_keypad.c | 70 +++++++++++----------------------
>  1 file changed, 22 insertions(+), 48 deletions(-)


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-01-07  0:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20140104090147.GA16680@core.coreip.homeip.net>
2014-01-05  3:47 ` [PATCH] Input: twl4030 - convert to using managed resources Sebastian Reichel
2014-01-06  2:25 ` Jingoo Han
2014-01-06  2:33   ` 'Sebastian Reichel'
2014-01-06  2:50     ` Jingoo Han
2014-01-06 22:14       ` 'Sebastian Reichel'
2014-01-07  0:38         ` Jingoo Han
     [not found]   ` <20140106180705.GB2754@core.coreip.homeip.net>
2014-01-07  0:35     ` Jingoo Han
2014-01-07  0:39 ` Jingoo Han

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).