mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: linux-kernel@vger.kernel.org
Cc: linus.walleij@stericsson.com, arnd@arndb.de, cbou@mail.ru,
	dwmw2@infradead.org, rajanikanth.hv@linaro.org,
	Lee Jones <lee.jones@linaro.org>
Subject: [PATCH 08/12] ab8500_btemp: Reorder obtainment of platform specific battery management data
Date: Fri, 30 Nov 2012 11:57:30 +0000	[thread overview]
Message-ID: <1354276654-590-9-git-send-email-lee.jones@linaro.org> (raw)
In-Reply-To: <1354276654-590-1-git-send-email-lee.jones@linaro.org>

Now that we always pass platform specific battery management data
through platform_data instead of obtaining it via different means
depending the way be boot the system (DT or ATAGs); we need to
re-jiggle the way we acquire it in the driver start-up functions.
Now it is wrong for it to be missing, but we still allow Device
Tree code to fiddle with it once we've confirmed it's there.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/power/ab8500_btemp.c |   27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/drivers/power/ab8500_btemp.c b/drivers/power/ab8500_btemp.c
index c0f7dcc..158cba5 100644
--- a/drivers/power/ab8500_btemp.c
+++ b/drivers/power/ab8500_btemp.c
@@ -976,6 +976,7 @@ static char *supply_interface[] = {
 static int __devinit ab8500_btemp_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
+	struct abx500_bm_data *plat = pdev->dev.platform_data;
 	struct ab8500_btemp *di;
 	int irq, i, ret = 0;
 	u8 val;
@@ -985,21 +986,19 @@ static int __devinit ab8500_btemp_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "%s no mem for ab8500_btemp\n", __func__);
 		return -ENOMEM;
 	}
-	di->bm = pdev->mfd_cell->platform_data;
-	if (!di->bm) {
-		if (np) {
-			ret = ab8500_bm_of_probe(&pdev->dev, np, di->bm);
-			if (ret) {
-				dev_err(&pdev->dev,
-					"failed to get battery information\n");
-				return ret;
-			}
-		} else {
-			dev_err(&pdev->dev, "missing dt node for ab8500_btemp\n");
-			return -EINVAL;
+
+	if (!plat) {
+		dev_err(&pdev->dev, "no battery management data supplied\n");
+		return -EINVAL;
+	}
+	di->bm = plat;
+
+	if (np) {
+		ret = ab8500_bm_of_probe(&pdev->dev, np, di->bm);
+		if (ret) {
+			dev_err(&pdev->dev, "failed to get battery information\n");
+			return ret;
 		}
-	} else {
-		dev_info(&pdev->dev, "falling back to legacy platform data\n");
 	}
 
 	/* get parent data */
-- 
1.7.9.5


  parent reply	other threads:[~2012-11-30 11:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-30 11:57 [PATCH 00/12] Refactoring the ab8500 battery management drivers Lee Jones
2012-11-30 11:57 ` [PATCH 01/12] ab8500_charger: Charger current step-up/down Lee Jones
2012-11-30 11:57 ` [PATCH 02/12] ab8500_fg: Don't clear the CCMuxOffset bit Lee Jones
2012-11-30 11:57 ` [PATCH 03/12] ab8500_btemp: Detect battery type in workqueue Lee Jones
2012-11-30 11:57 ` [PATCH 04/12] ab8500_btemp: Fix crazy tabbing implementation Lee Jones
2012-11-30 11:57 ` [PATCH 05/12] ab8500-bmdata: Re-jiggle bmdevs_of_probe to be more succinct Lee Jones
2012-11-30 11:57 ` [PATCH 06/12] ab8500_bm: Rename battery management platform data to something more logical Lee Jones
2012-11-30 11:57 ` [PATCH 07/12] ab8500_bm: Always send platform specific battery information via pdata Lee Jones
2012-11-30 11:57 ` Lee Jones [this message]
2012-11-30 11:57 ` [PATCH 09/12] ab8500_charger: Reorder obtainment of platform specific battery management data Lee Jones
2012-11-30 11:57 ` [PATCH 10/12] ab8500_fg: " Lee Jones
2012-11-30 11:57 ` [PATCH 11/12] abx500_chargalg: " Lee Jones
2012-11-30 11:57 ` [PATCH 12/12] ab8500_bm: Make the battery Device Tree node reference less cryptic Lee Jones
2012-12-01 18:45 ` [PATCH 00/12] Refactoring the ab8500 battery management drivers Linus Walleij
2012-12-11  3:34 ` Anton Vorontsov
2012-12-11  8:40   ` Lee Jones
2012-12-11 10:30   ` Lee Jones

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=1354276654-590-9-git-send-email-lee.jones@linaro.org \
    --to=lee.jones@linaro.org \
    --cc=arnd@arndb.de \
    --cc=cbou@mail.ru \
    --cc=dwmw2@infradead.org \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rajanikanth.hv@linaro.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

all inboxes | Powered by JetHome®