From patchwork Mon Feb 23 11:47:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 5864401 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EEA20BF440 for ; Mon, 23 Feb 2015 11:50:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1FD7F20610 for ; Mon, 23 Feb 2015 11:50:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1AC5120615 for ; Mon, 23 Feb 2015 11:50:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752711AbbBWLsa (ORCPT ); Mon, 23 Feb 2015 06:48:30 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:55615 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752641AbbBWLs1 (ORCPT ); Mon, 23 Feb 2015 06:48:27 -0500 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NK800FLH3NJXTA0@mailout1.w1.samsung.com>; Mon, 23 Feb 2015 11:52:31 +0000 (GMT) X-AuditID: cbfec7f4-b7f126d000001e9a-47-54eb12f73e62 Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id C1.7A.07834.7F21BE45; Mon, 23 Feb 2015 11:45:59 +0000 (GMT) Received: from AMDC1943.digital.local ([106.116.151.171]) by eusync2.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0NK8001843FJ0A90@eusync2.samsung.com>; Mon, 23 Feb 2015 11:48:24 +0000 (GMT) From: Krzysztof Kozlowski To: Sebastian Reichel , Dmitry Eremin-Solenikov , David Woodhouse , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, "Rafael J. Wysocki" , Len Brown , Jiri Kosina , David Herrmann , Cezary Jackiewicz , Darren Hart , Support Opensource , Milo Kim , Julian Andres Klode , Marc Dietrich , Greg Kroah-Hartman , linux-acpi@vger.kernel.org, linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@opensource.wolfsonmicro.com, ac100@lists.launchpad.net, linux-tegra@vger.kernel.org, devel@driverdev.osuosl.org, Linus Walleij , Samuel Ortiz , Lee Jones , linux-arm-kernel@lists.infradead.org, Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Daniel Mack , Haojian Zhuang , Robert Jarzmik Cc: Thomas Gleixner , Pavel Machek , Kyungmin Park , Marek Szyprowski , Krzysztof Kozlowski Subject: [PATCH v4 18/20] power_supply: bq2415x_charger: Decrement the power supply's device reference counter Date: Mon, 23 Feb 2015 12:47:39 +0100 Message-id: <1424692061-30624-19-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1424692061-30624-1-git-send-email-k.kozlowski@samsung.com> References: <1424692061-30624-1-git-send-email-k.kozlowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAy2ReUiTcRjH/e09NqXBi1evWgqDhCQvNHwIkQitl4Kyg/4oOt70RQWnsunS +kMxDOY5j4TUyrOZZ24lms5yOs3bvEDwTCNzHvMoy6s27b/P832+X77wPALMshm3F4RFRHOS CDZcRFrgPfudI65blvobHoYqEaT3GXhQ+jkFh8S9RRyy5lcxaO7d5kPJsC0kF3lA5ptsDJ6U 1JIwWOMDuXVH4fXaKxKaCkpw0C94Ql/iEh+mf+oQNM4uk5Czq+SBsiUDgWpujIDx9V8EDH8o IGEjrR2BfDOPhOr2ST7IB4oQKLdrcBj6VGhMLP8lYbJbR0Jl8wIGvT1DBOQtWUFPCgE9TdGg SfqCgVr1DIPfb+eIs85M+bo7M9XShjMZNRsE05g3yWcMa3eZb4psPqMud2HmF5UEo6qQk8zE WDPJrPT385mXXVeZjy+qjIbSeEaXOoEzPzJ3yEC7Wxa+wVx4mIyTuPvdtwgdLX6HoirtY/cS vuIJSGWTjMwFNOVN104qiEO2pQenakkTW1JliM7VcsnIwsjpPFo+UnVgIikvWq0sJU0La6rD nG6tTuOZBowaQvTcfBff5LKiomjdlgY3MU6doPUV4wdpIcXQo/kr/+sc6a6ObCMLBOZGfbpe dth8gU6ry0EKJCxEZhXIhosJipI+CBF7uklZsTQmIsQtKFKsQocf32xAJR1ntIgSINER4Yxs 8YYlwcqkcWItogWYyFro8McoCYPZuEecJPKeJCack2oRT2Bub7xAkvcp193BTvXNdN7elMOK gm3ba5j19tWfzOJY6r3znRltgHO3Y7pGfbqNiys+l52GR5kF+HdD6rG48w1O5f4ar+ffq4tl S1zg4pKPZ5nfQMsVw769VSz5NOVa56UaXr3heAXbl9/f6rTzeFQH8Q9lly9eV1T279jdFq8O 1opwaSjr6YJJpOw/EB4vMc8CAAA= Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use power_supply_put() to decrement the power supply's device reference counter (increased by power_supply_get_by_name() or power_supply_get_by_phandle()). Signed-off-by: Krzysztof Kozlowski Acked-by: Pavel Machek Reviewed-by: Bartlomiej Zolnierkiewicz Reviewed-by: Sebastian Reichel --- drivers/power/bq2415x_charger.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c index cb92022df8eb..27f197ad8053 100644 --- a/drivers/power/bq2415x_charger.c +++ b/drivers/power/bq2415x_charger.c @@ -1601,27 +1601,27 @@ static int bq2415x_probe(struct i2c_client *client, ret = of_property_read_u32(np, "ti,current-limit", &bq->init_data.current_limit); if (ret) - goto error_2; + goto error_3; ret = of_property_read_u32(np, "ti,weak-battery-voltage", &bq->init_data.weak_battery_voltage); if (ret) - goto error_2; + goto error_3; ret = of_property_read_u32(np, "ti,battery-regulation-voltage", &bq->init_data.battery_regulation_voltage); if (ret) - goto error_2; + goto error_3; ret = of_property_read_u32(np, "ti,charge-current", &bq->init_data.charge_current); if (ret) - goto error_2; + goto error_3; ret = of_property_read_u32(np, "ti,termination-current", &bq->init_data.termination_current); if (ret) - goto error_2; + goto error_3; ret = of_property_read_u32(np, "ti,resistor-sense", &bq->init_data.resistor_sense); if (ret) - goto error_2; + goto error_3; } else { memcpy(&bq->init_data, pdata, sizeof(bq->init_data)); } @@ -1631,19 +1631,19 @@ static int bq2415x_probe(struct i2c_client *client, ret = bq2415x_power_supply_init(bq); if (ret) { dev_err(bq->dev, "failed to register power supply: %d\n", ret); - goto error_2; + goto error_3; } ret = bq2415x_sysfs_init(bq); if (ret) { dev_err(bq->dev, "failed to create sysfs entries: %d\n", ret); - goto error_3; + goto error_4; } ret = bq2415x_set_defaults(bq); if (ret) { dev_err(bq->dev, "failed to set default values: %d\n", ret); - goto error_4; + goto error_5; } if (bq->notify_psy) { @@ -1651,7 +1651,7 @@ static int bq2415x_probe(struct i2c_client *client, ret = power_supply_reg_notifier(&bq->nb); if (ret) { dev_err(bq->dev, "failed to reg notifier: %d\n", ret); - goto error_5; + goto error_6; } /* Query for initial reported_mode and set it */ @@ -1671,11 +1671,14 @@ static int bq2415x_probe(struct i2c_client *client, dev_info(bq->dev, "driver registered\n"); return 0; +error_6: error_5: -error_4: bq2415x_sysfs_exit(bq); -error_3: +error_4: bq2415x_power_supply_exit(bq); +error_3: + if (bq->notify_psy) + power_supply_put(bq->notify_psy); error_2: kfree(name); error_1: @@ -1692,8 +1695,10 @@ static int bq2415x_remove(struct i2c_client *client) { struct bq2415x_device *bq = i2c_get_clientdata(client); - if (bq->notify_psy) + if (bq->notify_psy) { power_supply_unreg_notifier(&bq->nb); + power_supply_put(bq->notify_psy); + } bq2415x_sysfs_exit(bq); bq2415x_power_supply_exit(bq);