From: Guenter Roeck <linux@roeck-us.net>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: LKML <linux-kernel@vger.kernel.org>,
Linux PM list <linux-pm@vger.kernel.org>,
Hans de Goede <hdegoede@redhat.com>,
Alistair John Strachan <alistair@devzero.co.uk>,
lm-sensors@lm-sensors.org, Jean Delvare <khali@linux-fr.org>,
Kukjin Kim <kgene.kim@samsung.com>
Subject: Re: [PATCH 4/4][update] hwmon / exynos4_tmu: Use struct dev_pm_ops for power management
Date: Sun, 8 Jul 2012 21:42:35 -0700 [thread overview]
Message-ID: <20120709044235.GA21850@roeck-us.net> (raw)
In-Reply-To: <201207082246.13006.rjw@sisk.pl>
On Sun, Jul 08, 2012 at 10:46:12PM +0200, Rafael J. Wysocki wrote:
> On Sunday, July 08, 2012, Guenter Roeck wrote:
> > On Sun, Jul 08, 2012 at 09:48:15PM +0200, Rafael J. Wysocki wrote:
> > > From: Rafael J. Wysocki <rjw@sisk.pl>
> > >
> > Hi Rafael,
> >
> > > Make the Exynos4 TMU driver define its PM callbacks through
> > > a struct dev_pm_ops object rather than by using legacy PM hooks
> > > in struct platform_driver.
> > >
> > > Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> > > ---
> > > drivers/hwmon/exynos4_tmu.c | 18 +++++++++++-------
> > > 1 file changed, 11 insertions(+), 7 deletions(-)
> > >
> > > Index: linux/drivers/hwmon/exynos4_tmu.c
> > > ===================================================================
> > > --- linux.orig/drivers/hwmon/exynos4_tmu.c
> > > +++ linux/drivers/hwmon/exynos4_tmu.c
> > > @@ -476,34 +476,38 @@ static int __devexit exynos4_tmu_remove(
> > > }
> > >
> > > #ifdef CONFIG_PM
> > > -static int exynos4_tmu_suspend(struct platform_device *pdev, pm_message_t state)
> > > +static int exynos4_tmu_suspend(struct device *dev)
> > > {
> > > - exynos4_tmu_control(pdev, false);
> > > + exynos4_tmu_control(to_platform_device(dev), false);
> > >
> > > return 0;
> > > }
> > >
> > > -static int exynos4_tmu_resume(struct platform_device *pdev)
> > > +static int exynos4_tmu_resume(struct device *dev)
> > > {
> > > + struct platform_device *pdev = to_platform_device(dev);
> > > +
> > > exynos4_tmu_initialize(pdev);
> > > exynos4_tmu_control(pdev, true);
> > >
> > > return 0;
> > > }
> > > +
> > > +static SIMPLE_DEV_PM_OPS(exynos4_tmu_pm,
> > > + exynos4_tmu_suspend, exynos4_tmu_resume);
> > > +#define EXYNOS4_TMU_PM (&exynos4_tmu_pm)
> > > #else
> > > -#define exynos4_tmu_suspend NULL
> > > -#define exynos4_tmu_resume NULL
> > > +#define EXYNOS4_TMU_PM NULL
> > > #endif
> >
> > Actually, looking into other drivers, the common approach seems to be to declare
> >
> > static SIMPLE_DEV_PM_OPS(exynos4_tmu_pm,
> > exynos4_tmu_suspend, exynos4_tmu_resume);
> >
> > outside the #ifdef code and then just assign
> >
> > .pm = &exynos4_tmu_pm;
> >
> > unconditionally.
> >
> > That seems to be a much simpler solution. Any special reason for not
> > implementing it this way ? Same question applies to the other patches in the
> > series.
>
> In fact, there are two ways. One of them is what you said, the other is to
> put SIMPLE_DEV_PM_OPS() under the #ifdef like I did. I'm not sure which one
> is prevalent, but what I did has the advatnage that the kernel data will
> be slightly smaller if CONFIG_PM is unset.
>
Ok, make sense. Applied to -next.
Thanks,
Guenter
prev parent reply other threads:[~2012-07-09 4:42 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-07 21:02 [PATCH 0/4] PM / hwmon: Convert platform hwmon drivers to PM handling based on struct dev_pm_ops Rafael J. Wysocki
2012-07-07 21:04 ` [PATCH 1/4] hwmon / abituguru: Use struct dev_pm_ops for power management Rafael J. Wysocki
2012-07-07 21:59 ` [PATCH 1/4][update] " Rafael J. Wysocki
2012-07-08 17:06 ` Guenter Roeck
2012-07-07 21:04 ` [PATCH 2/4] hwmon / abituguru3: " Rafael J. Wysocki
2012-07-07 22:00 ` [PATCH 2/4][update] " Rafael J. Wysocki
2012-07-08 17:06 ` Guenter Roeck
2012-07-07 21:05 ` [PATCH 3/4] hwmon / gpio-fan: " Rafael J. Wysocki
2012-07-07 22:01 ` [PATCH 3/4][update] " Rafael J. Wysocki
2012-07-08 17:07 ` Guenter Roeck
2012-07-07 21:06 ` [PATCH 4/4] hwmon / exynos4_tmu: " Rafael J. Wysocki
2012-07-08 17:02 ` Guenter Roeck
2012-07-08 19:48 ` [PATCH 4/4][update] " Rafael J. Wysocki
2012-07-08 20:30 ` Guenter Roeck
2012-07-08 20:46 ` Rafael J. Wysocki
2012-07-09 4:42 ` Guenter Roeck [this message]
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=20120709044235.GA21850@roeck-us.net \
--to=linux@roeck-us.net \
--cc=alistair@devzero.co.uk \
--cc=hdegoede@redhat.com \
--cc=kgene.kim@samsung.com \
--cc=khali@linux-fr.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lm-sensors@lm-sensors.org \
--cc=rjw@sisk.pl \
/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