em28xx: ir-kbd-i2c init data needs a persistent object
commit45af991d4e6a44e663c1314545e53bfae91bde68
authorBrian Rogers <brian@xyzw.org>
Wed, 23 Sep 2009 10:05:02 +0000 (23 03:05 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 5 Oct 2009 16:33:04 +0000 (5 09:33 -0700)
tree5c921d2a6c3f38cc5d3f7f6081e4bf173959c449
parent1934acbe047d32dcdf74ad75d61c8646ca0ced7b
em28xx: ir-kbd-i2c init data needs a persistent object

commit d2ebd0f806fdb6104903365e355675934eec22b2 upstream.

Original commit message:

ir-kbd-i2c's ir_probe() function can be called much later (i.e. at
ir-kbd-i2c module load), than the lifetime of a struct IR_i2c_init_data
allocated off of the stack in cx18_i2c_new_ir() at registration time.
Make sure we pass a pointer to a persistent IR_i2c_init_data object at
i2c registration time.

Thanks to Brian Rogers, Dustin Mitchell, Andy Walls and Jean Delvare to
rise this question.

Before this patch, if ir-kbd-i2c were probed after em28xx, trash data
were used. After the patch, no matter what order, it is properly
reported as tested by me:

input: i2c IR (i2c IR (EM2840 Hauppaug as /class/input/input10
ir-kbd-i2c: i2c IR (i2c IR (EM2840 Hauppaug detected at i2c-4/4-0030/ir0 [em28xx #0]

Original-patch-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[brian@xyzw.org: backported for 2.6.31]
Signed-off-by: Brian Rogers <brian@xyzw.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/media/video/em28xx/em28xx-cards.c
drivers/media/video/em28xx/em28xx.h