RE: [PATCH 1/2] OMAP: Kill compile warnings

Syed Mohammed, Khasim
2007-05-25T23:17:25Z

>
>This warning is wrong, and we cannot mark sys_timer as initdata. See
>other mails related to this on this list. I'd assume this will get fixed
>once sys_timer is added to the list of things to ignore.
>
>Tony

Yes, I had a similar discussion with Dirk, he passed me few pointers yesterday, please see through if it helps....

-----Original Message-----
From: Dirk Behme [mailto:dirk.behme@googlemail.com]
Sent: Friday, May 25, 2007 7:56 AM
To: Syed Mohammed, Khasim
Subject: Re: Compiler warning in omap-twl4030keypad.c

Syed Mohammed, Khasim wrote:
> Hi Dirk,
>
> Thanks for the info. I was kind of busy with other stuff. Will look into
> this later this week and submit a patch.

I got the following stuff from Felipe Balbi regarding this in private
mail:

1) -- cut --
I don't think the problem is with TI's code for the omap-twl4030. If
you check the definition of struct input_dev, at
include/linux/input.h:

union { /* temporarily so while we switching to struct
device */
struct device *parent;
} dev;

Probably, we just need to wait until they switch to struct device
completely.
Or maybe this code will help if we assume that omap_twl4030->cdev->dev
points to the same place as omap_twl4030->dev. I would need any of you
guys to test it:

diff --git a/drivers/input/keyboard/omap-twl4030keypad.c
b/drivers/input/keyboard/omap-twl4030keypad.c
index b96e84f..3776f97 100644
--- a/drivers/input/keyboard/omap-twl4030keypad.c
+++ b/drivers/input/keyboard/omap-twl4030keypad.c
@@ -254,7 +254,7 @@ static int __init omap_kp_probe(struct
platform_device *pdev)
omap_twl4030kp->keycodemax = pdata->keymapsize;

/* Get the debug Device to omap keypad device */
- dbg_dev = &(omap_twl4030kp->dev);
+ dbg_dev = omap_twl4030kp->dev.parent;

ret = input_register_device(omap_twl4030kp);
if (ret < 0) {
-- cut --

2) -- cut --
I forgot to change the text... sorry...
I'm not using the struct class_device here... I'm just accessing the
struct device member inside the union dev.

This is an ugly hack :-P ... but it seems to work.
-- cut --

3) -- cut --
Still a hack, but probably looks better:

diff --git a/drivers/input/keyboard/omap-twl4030keypad.c
b/drivers/input/keyboard/omap-twl4030keypad.c
index b96e84f..5eb3ece 100644
--- a/drivers/input/keyboard/omap-twl4030keypad.c
+++ b/drivers/input/keyboard/omap-twl4030keypad.c
@@ -50,6 +50,8 @@
#define KEYNUM_MASK 0xFF000000
#define ROWCOL_MASK 0x00FFFFFF

+#define get_dbg_dev(d) (d).parent
+
static char *switch_name[NUM_ROWS][NUM_COLS] = {
{"S2_L", "S2_D", "S2_S", "S3", "S4", "S23"},
{"S2_R", "S2_U", "S5", "S6", "S7", "S24"},
@@ -254,7 +256,7 @@ static int __init omap_kp_probe(struct
platform_device *pdev)
omap_twl4030kp->keycodemax = pdata->keymapsize;

/* Get the debug Device to omap keypad device */
- dbg_dev = &(omap_twl4030kp->dev);
+ dbg_dev = get_dbg_dev(omap_twl4030kp->dev);

ret = input_register_device(omap_twl4030kp);
if (ret < 0) {

-- cut --

Regards

Dirk