All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: Tony Lindgren <tony@atomide.com>
Cc: Linux OMAP Mailing List <linux-omap@vger.kernel.org>,
	Felipe Balbi <balbi@ti.com>
Subject: [PATCH 3/6] cbus: retu: headset: don't save pdev pointer
Date: Wed, 16 Feb 2011 21:42:27 +0200	[thread overview]
Message-ID: <1297885350-3462-4-git-send-email-balbi@ti.com> (raw)
In-Reply-To: <1297885350-3462-1-git-send-email-balbi@ti.com>

... and save instead a device pointer. Generally
we only need a device pointer as we don't need
to poke with the platform_device that often and
if we do, we can always to_platform_device(dev).

Drop the pdev from the headset structure and
save dev instead.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 drivers/cbus/retu-headset.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/cbus/retu-headset.c b/drivers/cbus/retu-headset.c
index d0b39a7..3b8e138 100644
--- a/drivers/cbus/retu-headset.c
+++ b/drivers/cbus/retu-headset.c
@@ -38,7 +38,7 @@
 struct retu_headset {
 	spinlock_t			lock;
 	struct mutex			mutex;
-	struct platform_device		*pdev;
+	struct device			*dev;
 	struct input_dev		*idev;
 	unsigned			bias_enabled;
 	unsigned			detection_enabled;
@@ -51,13 +51,13 @@ struct retu_headset {
 static void retu_headset_set_bias(struct retu_headset *hs, int enable)
 {
 	if (enable) {
-		retu_set_clear_reg_bits(&hs->pdev->dev, RETU_REG_AUDTXR,
+		retu_set_clear_reg_bits(hs->dev, RETU_REG_AUDTXR,
 					(1 << 0) | (1 << 1), 0);
 		msleep(2);
-		retu_set_clear_reg_bits(&hs->pdev->dev, RETU_REG_AUDTXR,
+		retu_set_clear_reg_bits(hs->dev, RETU_REG_AUDTXR,
 				1 << 3, 0);
 	} else {
-		retu_set_clear_reg_bits(&hs->pdev->dev, RETU_REG_AUDTXR, 0,
+		retu_set_clear_reg_bits(hs->dev, RETU_REG_AUDTXR, 0,
 					(1 << 0) | (1 << 1) | (1 << 3));
 	}
 }
@@ -87,7 +87,7 @@ static void retu_headset_det_enable(struct retu_headset *hs)
 	mutex_lock(&hs->mutex);
 	if (!hs->detection_enabled) {
 		hs->detection_enabled = 1;
-		retu_set_clear_reg_bits(&hs->pdev->dev, RETU_REG_CC1,
+		retu_set_clear_reg_bits(hs->dev, RETU_REG_CC1,
 				(1 << 10) | (1 << 8), 0);
 	}
 	mutex_unlock(&hs->mutex);
@@ -106,7 +106,7 @@ static void retu_headset_det_disable(struct retu_headset *hs)
 		if (hs->pressed)
 			input_report_key(hs->idev, RETU_HEADSET_KEY, 0);
 		spin_unlock_irqrestore(&hs->lock, flags);
-		retu_set_clear_reg_bits(&hs->pdev->dev, RETU_REG_CC1, 0,
+		retu_set_clear_reg_bits(hs->dev, RETU_REG_CC1, 0,
 				(1 << 10) | (1 << 8));
 	}
 	mutex_unlock(&hs->mutex);
@@ -193,7 +193,7 @@ static irqreturn_t retu_headset_hook_interrupt(int irq, void *_hs)
 		input_report_key(hs->idev, RETU_HEADSET_KEY, 1);
 	}
 	spin_unlock_irqrestore(&hs->lock, flags);
-	retu_set_clear_reg_bits(&hs->pdev->dev, RETU_REG_CC1, 0,
+	retu_set_clear_reg_bits(hs->dev, RETU_REG_CC1, 0,
 			(1 << 10) | (1 << 8));
 	mod_timer(&hs->enable_timer, jiffies + msecs_to_jiffies(50));
 
@@ -204,7 +204,7 @@ static void retu_headset_enable_timer(unsigned long arg)
 {
 	struct retu_headset *hs = (struct retu_headset *) arg;
 
-	retu_set_clear_reg_bits(&hs->pdev->dev, RETU_REG_CC1,
+	retu_set_clear_reg_bits(hs->dev, RETU_REG_CC1,
 			(1 << 10) | (1 << 8), 0);
 	mod_timer(&hs->detect_timer, jiffies + msecs_to_jiffies(350));
 }
@@ -232,7 +232,7 @@ static int __init retu_headset_probe(struct platform_device *pdev)
 	if (hs == NULL)
 		return -ENOMEM;
 
-	hs->pdev = pdev;
+	hs->dev = &pdev->dev;
 
 	hs->idev = input_allocate_device();
 	if (hs->idev == NULL) {
-- 
1.7.4.rc2


  parent reply	other threads:[~2011-02-16 19:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-16 19:42 [PATCH 0/6] CBUS Second try Felipe Balbi
2011-02-16 19:42 ` [PATCH 1/6] cbus: retu: wdt: save dev in retu_wdt_dev Felipe Balbi
2011-02-16 19:42 ` [PATCH 2/6] cbus: retu: pass the child device pointer to all retu functions Felipe Balbi
2011-02-16 19:42 ` Felipe Balbi [this message]
2011-02-16 19:42 ` [PATCH 4/6] cbus: retu: replace EXPORT_SYMBOL with EXPORT_SYMBOL_GPL Felipe Balbi
2011-02-16 19:42 ` [PATCH 5/6] cbus: retu: tabify retu initialization Felipe Balbi
2011-02-16 19:49   ` Felipe Balbi
2011-02-16 19:42 ` [PATCH 6/6] cbus: retu: set pm_power_off to NULL when removing retu Felipe Balbi
2011-02-16 19:51   ` Felipe Balbi
2011-02-16 20:01 [PATCH 0/6] CBUS Third try Felipe Balbi
2011-02-16 20:01 ` [PATCH 3/6] cbus: retu: headset: don't save pdev pointer Felipe Balbi

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=1297885350-3462-4-git-send-email-balbi@ti.com \
    --to=balbi@ti.com \
    --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 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.