From: Felipe Balbi <balbi@ti.com>
To: Tony Lindgren <tony@atomide.com>
Cc: Linux ARM Kernel Mailing List
<linux-arm-kernel@lists.infradead.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux OMAP Mailing List <linux-omap@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Felipe Balbi <balbi@ti.com>
Subject: [PATCH/RESEND #3 3/7] arm: omap: smartreflex: use dev_get_drvdata()
Date: Tue, 15 Nov 2011 10:46:01 +0200 [thread overview]
Message-ID: <1321346765-16633-4-git-send-email-balbi@ti.com> (raw)
In-Reply-To: <1321346765-16633-1-git-send-email-balbi@ti.com>
When we need to fetch struct omap_sr on PM
handlers, there's no need to access platform_data.
Instead, we can use dev_get_drvdata(dev) like
other drivers do.
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
arch/arm/mach-omap2/smartreflex.c | 51 ++++++------------------------------
1 files changed, 9 insertions(+), 42 deletions(-)
diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
index 443591b..bb3bfc0 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -1002,22 +1002,9 @@ err_free_devinfo:
static int __devexit omap_sr_remove(struct platform_device *pdev)
{
- struct omap_sr_data *pdata = pdev->dev.platform_data;
- struct omap_sr *sr_info;
+ struct omap_sr *sr_info = platform_get_drvdata(pdev);
struct resource *mem;
- if (!pdata) {
- dev_err(&pdev->dev, "%s: platform data missing\n", __func__);
- return -EINVAL;
- }
-
- sr_info = _sr_lookup(pdata->voltdm);
- if (IS_ERR(sr_info)) {
- dev_warn(&pdev->dev, "%s: omap_sr struct not found\n",
- __func__);
- return -EINVAL;
- }
-
if (sr_info->autocomp_active)
sr_stop_vddautocomp(sr_info);
if (sr_info->dbg_dir)
@@ -1034,20 +1021,10 @@ static int __devexit omap_sr_remove(struct platform_device *pdev)
static int omap_sr_suspend(struct device *dev)
{
- struct omap_sr_data *pdata;
- struct omap_sr *sr_info;
+ struct omap_sr *sr_info = dev_get_drvdata(dev);
- pdata = dev_get_platdata(dev);
- if (!pdata) {
- dev_err(dev, "%s: platform data missing\n", __func__);
- return -EINVAL;
- }
-
- sr_info = _sr_lookup(pdata->voltdm);
- if (IS_ERR(sr_info)) {
- dev_warn(dev, "%s: omap_sr struct not found\n", __func__);
- return -EINVAL;
- }
+ if (!sr_info)
+ return 0;
if (!sr_info->autocomp_active)
return 0;
@@ -1055,7 +1032,7 @@ static int omap_sr_suspend(struct device *dev)
if (sr_info->is_suspended)
return 0;
- omap_sr_disable_reset_volt(pdata->voltdm);
+ omap_sr_disable_reset_volt(sr_info->voltdm);
sr_info->is_suspended = true;
/* Flag the same info to the other CPUs */
smp_wmb();
@@ -1065,20 +1042,10 @@ static int omap_sr_suspend(struct device *dev)
static int omap_sr_resume(struct device *dev)
{
- struct omap_sr_data *pdata;
- struct omap_sr *sr_info;
+ struct omap_sr *sr_info = dev_get_drvdata(dev);
- pdata = dev_get_platdata(dev);
- if (!pdata) {
- dev_err(dev, "%s: platform data missing\n", __func__);
- return -EINVAL;
- }
-
- sr_info = _sr_lookup(pdata->voltdm);
- if (IS_ERR(sr_info)) {
- dev_warn(dev, "%s: omap_sr struct not found\n", __func__);
- return -EINVAL;
- }
+ if (!sr_info)
+ return 0;
if (!sr_info->autocomp_active)
return 0;
@@ -1089,7 +1056,7 @@ static int omap_sr_resume(struct device *dev)
sr_info->is_suspended = false;
/* Flag the same info to the other CPUs */
smp_wmb();
- omap_sr_enable(pdata->voltdm);
+ omap_sr_enable(sr_info->voltdm);
return 0;
}
--
1.7.8.rc0
next prev parent reply other threads:[~2011-11-15 8:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-15 8:45 [PATCH/RESEND #3 0/7] SmartReflex Patches Felipe Balbi
2011-11-15 8:45 ` [PATCH/RESEND #3 1/7] OMAP3+: PM: SR: add suspend/resume handlers Felipe Balbi
[not found] ` <87vcqj62gd.fsf@ti.com>
2011-11-19 0:35 ` Menon, Nishanth
2011-11-23 20:01 ` Kevin Hilman
2011-11-15 8:46 ` [PATCH/RESEND #3 2/7] arm: omap: smartreflex: add missing platform_set_drvdata() Felipe Balbi
2011-11-15 8:46 ` Felipe Balbi [this message]
2011-11-15 8:46 ` [PATCH/RESEND #3 4/7] arm: omap: smartreflex: move late_initcall() closer to its argument Felipe Balbi
2011-11-15 8:46 ` [PATCH/RESEND #3 5/7] arm: omap: smartreflex: clean ups all over Felipe Balbi
2011-11-16 0:39 ` Valdis.Kletnieks
2011-11-16 10:09 ` Felipe Balbi
2011-11-15 8:46 ` [PATCH/RESEND #3 6/7] arm: omap: smartreflex: fix IRQ handling bug Felipe Balbi
2011-11-17 0:06 ` Kevin Hilman
2011-11-17 7:08 ` Felipe Balbi
2011-11-15 8:46 ` [PATCH/RESEND #3 7/7] arm: omap: smartreflex: micro-optimization for sanity check Felipe Balbi
2011-11-17 0:09 ` [PATCH/RESEND #3 0/7] SmartReflex Patches Kevin Hilman
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=1321346765-16633-4-git-send-email-balbi@ti.com \
--to=balbi@ti.com \
--cc=akpm@linux-foundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=tony@atomide.com \
/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
all inboxes | Powered by JetHome®