From patchwork Mon Dec 3 18:12:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\"Rajanikanth H.V" X-Patchwork-Id: 13340 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 6B19D23FCC for ; Mon, 3 Dec 2012 18:16:26 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 460E9A19547 for ; Mon, 3 Dec 2012 18:16:25 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id t4so2271930iag.11 for ; Mon, 03 Dec 2012 10:16:24 -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:x-gm-message-state; bh=/vfDcv9Jbn2PYC52QcWls+3ZVafSxyoeLH8LlNMfK90=; b=kvaihTjclFRc1ahSqJA4PvySJW+OrxwhYiPtYETGY+9ri/YvAJwVRMX8omcQGJHNdm cS2EZhcR+TPrU6PLke82qkDEv8xqiK7qSEioOVO+ZbQlL8Tc+dDnxm5gZBVPAFECx0de Odgzz7vb9ZKo4r+7iNlQMXEB9P0Qtl9IhmOXonNsIBV6vgnpMmkZ0f0lt6KcGthXi8ye iJUaa8dQTrZnuEsXDG62RUR1fZZP2CkalsuRNnLNfb6U/XbfQ1H/LgB+IE3qPRfO692E d0x2peOgctt5o00fNOoUqXpS9yYM6IdPDVt1krOEftr57/P35b7WANN5jLrlYzIyZiuT JWnw== Received: by 10.43.49.199 with SMTP id vb7mr8698501icb.6.1354558584663; Mon, 03 Dec 2012 10:16:24 -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 n20csp194762igt; Mon, 3 Dec 2012 10:16:24 -0800 (PST) Received: by 10.68.230.234 with SMTP id tb10mr31300609pbc.71.1354558583440; Mon, 03 Dec 2012 10:16:23 -0800 (PST) Received: from mail-da0-f48.google.com (mail-da0-f48.google.com [209.85.210.48]) by mx.google.com with ESMTPS id e3si19890011pax.225.2012.12.03.10.16.22 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 03 Dec 2012 10:16:23 -0800 (PST) Received-SPF: neutral (google.com: 209.85.210.48 is neither permitted nor denied by best guess record for domain of rajanikanth.hv@linaro.org) client-ip=209.85.210.48; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.48 is neither permitted nor denied by best guess record for domain of rajanikanth.hv@linaro.org) smtp.mail=rajanikanth.hv@linaro.org Received: by mail-da0-f48.google.com with SMTP id k18so1160711dae.7 for ; Mon, 03 Dec 2012 10:16:22 -0800 (PST) Received: by 10.68.232.71 with SMTP id tm7mr31419180pbc.118.1354558582422; Mon, 03 Dec 2012 10:16:22 -0800 (PST) Received: from localhost.localdomain ([117.235.125.150]) by mx.google.com with ESMTPS id o11sm8418107pby.8.2012.12.03.10.16.15 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 03 Dec 2012 10:16:21 -0800 (PST) From: "Rajanikanth H.V" To: anton.vorontsov@linaro.org Cc: francescolavra.fl@gmail.com, rob.herring@calxeda.com, lee.jones@linaro.org, arnd@arndb.de, linus.walleij@stericsson.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linaro-dev@lists.linaro.org, patches@linaro.org, STEricsson_nomadik_linux@list.st.com, rajanikanth.hv@stericsson.com Subject: [PATCH 1/2] ab8500: remove explicit handling of battery type Date: Mon, 3 Dec 2012 23:42:54 +0530 Message-Id: <1354558375-15110-1-git-send-email-rajanikanth.hv@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Gm-Message-State: ALoCoQmRqamUPozTW33CiJMzbZFi5X8lbK4vVhUj+inZ7Hv3WUQurCVrCzs+0MYCMeyIEOlpu7Q0 From: "Rajanikanth H.V" dt property, 'battery-type' shall be one of supported technology type instead blank. refer:Documentation/devicetree/bindings/power_supply/ab8500/fg.txt for the list of supported types thanks to Francesco Lavra for highlighting missing of_node_put(...) for '3.7-rc5': of git://git.infradead.org/battery-2.6.git Acked-by: Lee Jones Signed-off-by: Rajanikanth H.V --- drivers/power/ab8500_bmdata.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/power/ab8500_bmdata.c b/drivers/power/ab8500_bmdata.c index 03cc528..2230b2c 100644 --- a/drivers/power/ab8500_bmdata.c +++ b/drivers/power/ab8500_bmdata.c @@ -461,7 +461,6 @@ bmdevs_of_probe(struct device *dev, struct device_node *np_bat_supply; struct abx500_bm_data *bat; const char *btech; - char bat_tech[8]; int i, thermistor; *battery = &ab8500_bm_data; @@ -488,12 +487,10 @@ bmdevs_of_probe(struct device *dev, "stericsson,battery-type", NULL); if (!btech) { dev_warn(dev, "missing property battery-name/type\n"); - strcpy(bat_tech, "UNKNOWN"); - } else { - strcpy(bat_tech, btech); + of_node_put(np_bat_supply); + return -EINVAL; } - - if (strncmp(bat_tech, "LION", 4) == 0) { + if (strncmp(btech, "LION", 4) == 0) { bat->no_maintenance = true; bat->chg_unknown_bat = true; bat->bat_type[BATTERY_UNKNOWN].charge_full_design = 2600; @@ -508,7 +505,7 @@ bmdevs_of_probe(struct device *dev, if (thermistor == NTC_EXTERNAL) { btype->batres_tbl = temp_to_batres_tbl_ext_thermistor; - } else if (strncmp(bat_tech, "LION", 4) == 0) { + } else if (strncmp(btech, "LION", 4) == 0) { btype->batres_tbl = temp_to_batres_tbl_9100; } else {