From patchwork Fri Nov 30 11:57:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 13310 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 E1F7823FCD for ; Fri, 30 Nov 2012 11:58:08 +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 5A477A19887 for ; Fri, 30 Nov 2012 11:58:08 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so449761ieb.11 for ; Fri, 30 Nov 2012 03:58:08 -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=uaama4/56AXAxuU+gn4yrgZ8fpGEYrjWsIP6+PQ99KM=; b=FAP63rcmX2fy4uIGs4JUU8JXJlCVg5T7YtqyVG/n7h0kXWPgXYVr3roWm4mIfjIayb oIfaFEMuV4l1RRm07/2G2ptEoZa2pcba1moaH4TxSWkZ6061FdOAAaGrxZEHz2GfxnaA uYKYlXdC9aHsnXmsHvT8rvXiuPKeciM6PtAPIKOfhyOgG3RyrZDzeJ7/a4CwhgKkR9xV QjFMRI5P+iCXQJoQ8WWWLL0mkuMidJqgfB2JnG2fqOrQOS6EqrD0ltpDNtmLGE9oo4oA VX98pbjEKlYjtIM9spbQztFjb1it6pso2uKqn2AmIxM9IT4wVCrjNzcwZh85TXGbdGtx atYQ== Received: by 10.43.125.133 with SMTP id gs5mr668075icc.54.1354276688093; Fri, 30 Nov 2012 03:58:08 -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 n20csp1011288igt; Fri, 30 Nov 2012 03:58:06 -0800 (PST) Received: by 10.180.92.132 with SMTP id cm4mr43392661wib.12.1354276686260; Fri, 30 Nov 2012 03:58:06 -0800 (PST) Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) by mx.google.com with ESMTPS id ez10si5210162wib.1.2012.11.30.03.58.05 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 30 Nov 2012 03:58:06 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.172 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.212.172; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.172 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-wi0-f172.google.com with SMTP id o1so5883340wic.17 for ; Fri, 30 Nov 2012 03:58:05 -0800 (PST) Received: by 10.180.86.167 with SMTP id q7mr1634654wiz.21.1354276685796; Fri, 30 Nov 2012 03:58:05 -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.04 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 30 Nov 2012 03:58:05 -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 10/12] ab8500_fg: Reorder obtainment of platform specific battery management data Date: Fri, 30 Nov 2012 11:57:32 +0000 Message-Id: <1354276654-590-11-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: ALoCoQlnClNhUlytITvf+gZsF4rrIN94B8qVWayoVVgMwbB8TzZhRQ2UUPKJORRxGHv9xXjUsL9n 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/ab8500_fg.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c index 8bb9df9..df681a8 100644 --- a/drivers/power/ab8500_fg.c +++ b/drivers/power/ab8500_fg.c @@ -2448,6 +2448,7 @@ static char *supply_interface[] = { static int __devinit ab8500_fg_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; + struct abx500_bm_data *plat = pdev->dev.platform_data; struct ab8500_fg *di; int i, irq; int ret = 0; @@ -2457,21 +2458,19 @@ static int __devinit ab8500_fg_probe(struct platform_device *pdev) dev_err(&pdev->dev, "%s no mem for ab8500_fg\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_fg\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"); } mutex_init(&di->cc_lock);