From patchwork Fri Nov 30 11:57:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 13311 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id E4E4423FCD for ; Fri, 30 Nov 2012 11:58:09 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 546FAA19A86 for ; Fri, 30 Nov 2012 11:58:09 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so449749ieb.11 for ; Fri, 30 Nov 2012 03:58:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=sXYpmcjCRdYa/RZ7I1WAPbc51GYQIE30mBFk2Ouc6fQ=; b=LJwwT+fiyP5s0vF+13j+EvInWoToqU9Ck5f/FXXV6Am75YcnDsaknsqDArQmIm1D6l AbG9SvdV8W1w31p2MNT0yadh13xbfSVoo1ll8BS5Ba5zc8HzKdjus1qfDdGN0M/6m6r0 7Zy/VTTgKMHVCvJNgEhbOVDcaF4iXzIjOWJUKxOCe/7tMkEhbuiYUUPcxsJQ3WuU01jP NHvTp8xCvykQhhqpupyLvD3CBenyyuywWNA7nwYFEbcAwzykL5W/RgGDlNI/N+b+CFh8 6i1LFQIXhGzSqwQkogEFNUrVszWKDk6v/gFD22SwV+ma6P22FBX4Prbih+GSpmoXw1dP 4Bkw== Received: by 10.50.161.169 with SMTP id xt9mr28075047igb.62.1354276689081; Fri, 30 Nov 2012 03:58:09 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp1011292igt; Fri, 30 Nov 2012 03:58:08 -0800 (PST) Received: by 10.180.86.167 with SMTP id q7mr1634807wiz.21.1354276687806; Fri, 30 Nov 2012 03:58:07 -0800 (PST) Received: from mail-we0-f177.google.com (mail-we0-f177.google.com [74.125.82.177]) by mx.google.com with ESMTPS id o10si10952679wic.2.2012.11.30.03.58.07 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 30 Nov 2012 03:58:07 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.177 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.177; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.177 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) smtp.mail=lee.jones@linaro.org Received: by mail-we0-f177.google.com with SMTP id x48so141619wey.8 for ; Fri, 30 Nov 2012 03:58:07 -0800 (PST) Received: by 10.216.73.195 with SMTP id v45mr359915wed.161.1354276687325; Fri, 30 Nov 2012 03:58:07 -0800 (PST) Received: from localhost.localdomain (cpc1-aztw13-0-0-cust473.18-1.cable.virginmedia.com. [77.102.241.218]) by mx.google.com with ESMTPS id i6sm14966896wix.5.2012.11.30.03.58.05 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 30 Nov 2012 03:58:06 -0800 (PST) From: Lee Jones 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 Subject: [PATCH 11/12] abx500_chargalg: Reorder obtainment of platform specific battery management data Date: Fri, 30 Nov 2012 11:57:33 +0000 Message-Id: <1354276654-590-12-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1354276654-590-1-git-send-email-lee.jones@linaro.org> References: <1354276654-590-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQkdM+lo9zfy6qmm5ARQqPK47Mrtbwtfsnq+Cg2TFnJPehLL589I7wi0m34jxqJx2kYl60dW 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 --- drivers/power/abx500_chargalg.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/power/abx500_chargalg.c b/drivers/power/abx500_chargalg.c index 22a511c..a8acfe5 100644 --- a/drivers/power/abx500_chargalg.c +++ b/drivers/power/abx500_chargalg.c @@ -1806,6 +1806,7 @@ static char *supply_interface[] = { static int __devinit abx500_chargalg_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; + struct abx500_bm_data *plat = pdev->dev.platform_data; struct abx500_chargalg *di; int ret = 0; @@ -1814,21 +1815,19 @@ static int __devinit abx500_chargalg_probe(struct platform_device *pdev) dev_err(&pdev->dev, "%s no mem for ab8500_chargalg\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_chargalg\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 device struct */