From: Felipe Balbi <balbi@ti.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: balbi@ti.com, Illia Smyrnov <illia.smyrnov@ti.com>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-omap@vger.kernel.org, Greg KH <gregkh@linuxfoundation.org>
Subject: Re: [PATCH v3 1/3] Input: omap-keypad: Enable wakeup capability for keypad.
Date: Wed, 31 Jul 2013 12:49:48 +0300 [thread overview]
Message-ID: <20130731094948.GB15583@radagast> (raw)
In-Reply-To: <1861803.h9dhBdaB3X@dtor-d630.eng.vmware.com>
[-- Attachment #1: Type: text/plain, Size: 2727 bytes --]
On Mon, Jul 29, 2013 at 01:40:28PM -0700, Dmitry Torokhov wrote:
> On Monday, July 29, 2013 11:36:05 PM Felipe Balbi wrote:
> > Hi,
> >
> > On Mon, Jul 29, 2013 at 12:59:23PM -0700, Dmitry Torokhov wrote:
> > > > > > > @@ -439,12 +444,50 @@ static const struct of_device_id
> > > > > > > omap_keypad_dt_match[] = {>
> > > > > > >
> > > > > > > MODULE_DEVICE_TABLE(of, omap_keypad_dt_match);
> > > > > > > #endif
> > > > > > >
> > > > > > > +#ifdef CONFIG_PM_SLEEP
> > > > > > > +static int omap4_keypad_suspend(struct device *dev)
> > > > > > > +{
> > > > > > > + struct platform_device *pdev = to_platform_device(dev);
> > > > > >
> > > > > > you don't need to access the platform_device...
> > > > > >
> > > > > > > + struct omap4_keypad *keypad_data = platform_get_drvdata(pdev);
> > > > > >
> > > > > > ... since this can become:
> > > > > > struct omap4_keypad *keypad_data = dev_get_drvdata(dev);
> > > > >
> > > > > No, please use correct accessors for the objects. Platform drivers
> > > > > deal
> > > > > with platform devices and I prefer using platform_get_drvdata() on
> > > > > them.
> > > >
> > > > The argument to this function is a struct device, you prefer to do some
> > > > pointer math to find the containing pdev, then deref that back to dev,
> > > > then to struct device_private and further to driver_data ?
> > > >
> > > > Sounds like a waste of time IMHO. You already have the device pointer
> > > > anyway, why would you go through the trouble of calculating the
> > > > offsets for the containing struct platform_device ?
> > >
> > > This assumes knowledge of dev_get_drvdata() implementation and assumption
> > > that it will stay the same. Unless I hear from device core guys that
> > > <bus>_{get|set}_drvdata() methods are obsolete and will be eventually
> > > removed I will require proper accessors being used.
> >
> > they're not obsolete and will never be removed. They're nothing but
> > helpers though. Instead of calling:
> >
> > dev_set_drvdata(&pdev->dev);
> >
> > you call:
> >
> > platform_set_drvdata(pdev);
> >
> > same is valid for every single bus, but in the end they all just wrap a
> > call dev_{set,get}_drvdata() internally. If you already have a struct
> > device pointer as argument, why waste cycles doing pointer math just to
> > go back to the same struct device pointer on the next call ?
>
> Because I do not want to rely on the fact that what my driver set up
> with platform_set_drvdata(pdev, XXX) is the same as what dev_get_drvdata()
> will return *in the current implementation*. Software layers and all
> that...
fair enough, your call. It's a waste of CPU anyway.
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2013-07-31 9:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-29 16:45 [PATCH v3 0/3] Input: omap-keypad: Wakeup capability and w/a for i689 errata Illia Smyrnov
2013-07-29 16:45 ` [PATCH v3 1/3] Input: omap-keypad: Enable wakeup capability for keypad Illia Smyrnov
2013-07-29 18:04 ` Felipe Balbi
2013-07-29 18:59 ` Dmitry Torokhov
2013-07-29 19:13 ` Felipe Balbi
2013-07-29 19:59 ` Dmitry Torokhov
2013-07-29 20:36 ` Felipe Balbi
2013-07-29 20:40 ` Dmitry Torokhov
2013-07-31 9:49 ` Felipe Balbi [this message]
2013-07-29 16:45 ` [PATCH v3 2/3] Input: omap-keypad: errata i689: Correct debounce time Illia Smyrnov
2013-07-29 18:08 ` Felipe Balbi
2013-07-29 16:45 ` [PATCH v3 3/3] Input: omap-keypad: Setup irq type from DT Illia Smyrnov
2013-07-29 18:09 ` Felipe Balbi
2013-08-27 10:08 ` [PATCH v3 0/3] Input: omap-keypad: Wakeup capability and w/a for i689 errata Illia Smyrnov
2013-08-29 16:34 ` Dmitry Torokhov
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=20130731094948.GB15583@radagast \
--to=balbi@ti.com \
--cc=dmitry.torokhov@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=illia.smyrnov@ti.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@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 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).