From: Felipe Balbi <me@felipebalbi.com>
To: David Brownell <david-b@pacbell.net>
Cc: me@felipebalbi.com,
davinci-linux-open-source@linux.davincidsp.com,
linux-input@vger.kernel.org,
Felipe Balbi <felipebalbi@users.sourceforge.net>
Subject: Re: [patch 2.6.28-rc6-davinci1 5/6] dm355evm input driver
Date: Mon, 8 Dec 2008 23:41:38 +0200 [thread overview]
Message-ID: <20081208214138.GH13076@frodo> (raw)
In-Reply-To: <200812071228.38475.david-b@pacbell.net>
On Sun, Dec 07, 2008 at 12:28:38PM -0800, David Brownell wrote:
> On Sunday 07 December 2008, Felipe Balbi wrote:
> > > + platform_set_drvdata(pdev, keys);
> > > + keys->pdev = pdev;
> >
> > you could be holding only the device pointer.
> >
> > keys->dev = &pdev->dev;
> >
> > then, if you really happen to need the pdev pointer you can use
> >
> > to_platform_device(keys->dev);
>
> True, that would be a bit simpler; the device handle is what's
> normally needed, e.g. for dev_dbg(). I'd take an update patch;
> but for now I'll avoid a re-test cycle. :)
Here's an update patch for your input driver:
================ cut here ===================
diff --git a/drivers/input/keyboard/dm355evm_keys.c b/drivers/input/keyboard/dm355evm_keys.c
index ed36127..0871d9c 100644
--- a/drivers/input/keyboard/dm355evm_keys.c
+++ b/drivers/input/keyboard/dm355evm_keys.c
@@ -33,7 +33,7 @@
struct dm355evm_keys {
struct work_struct work;
struct input_dev *input;
- struct platform_device *pdev;
+ struct device *dev;
int irq;
};
@@ -128,7 +128,7 @@ static void dm355evm_keys_work(struct work_struct *work)
status = dm355evm_msp_read(DM355EVM_MSP_INPUT_HIGH);
if (status < 0) {
- dev_dbg(&keys->pdev->dev, "input high err %d\n",
+ dev_dbg(keys->dev, "input high err %d\n",
status);
break;
}
@@ -136,7 +136,7 @@ static void dm355evm_keys_work(struct work_struct *work)
status = dm355evm_msp_read(DM355EVM_MSP_INPUT_LOW);
if (status < 0) {
- dev_dbg(&keys->pdev->dev, "input low err %d\n",
+ dev_dbg(keys->dev, "input low err %d\n",
status);
break;
}
@@ -155,7 +155,7 @@ static void dm355evm_keys_work(struct work_struct *work)
keycode = dm355evm_keys[i].keycode;
break;
}
- dev_dbg(&keys->pdev->dev,
+ dev_dbg(keys->dev,
"input event 0x%04x--> keycode %d\n",
event, keycode);
@@ -200,7 +200,7 @@ static int __devinit dm355evm_keys_probe(struct platform_device *pdev)
if (!keys)
goto fail0;
platform_set_drvdata(pdev, keys);
- keys->pdev = pdev;
+ keys->dev = &pdev->dev;
/* ... and input dev ... */
input = input_allocate_device();
@@ -257,6 +257,7 @@ fail1:
fail0:
kfree(keys);
dev_err(&pdev->dev, "can't register, err %d\n", status);
+
return status;
}
@@ -267,6 +268,7 @@ static int __devexit dm355evm_keys_remove(struct platform_device *pdev)
free_irq(keys->irq, keys);
input_unregister_device(keys->input);
kfree(keys);
+
return 0;
}
--
balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2008-12-08 21:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-07 19:59 [patch 2.6.28-rc6-davinci1 5/6] dm355evm input driver David Brownell
2008-12-07 20:21 ` Felipe Balbi
2008-12-07 20:28 ` David Brownell
2008-12-07 20:34 ` Felipe Balbi
2008-12-08 21:41 ` Felipe Balbi [this message]
2008-12-08 22:19 ` David Brownell
2008-12-11 4:08 ` David Brownell
2009-01-13 6:13 ` Dmitry Torokhov
2009-01-13 9:42 ` David Brownell
2009-01-14 5:42 ` Dmitry Torokhov
2009-01-14 19:38 ` David Brownell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081208214138.GH13076@frodo \
--to=me@felipebalbi.com \
--cc=david-b@pacbell.net \
--cc=davinci-linux-open-source@linux.davincidsp.com \
--cc=felipebalbi@users.sourceforge.net \
--cc=linux-input@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.