From patchwork Wed Aug 26 14:48:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 256914 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F0A8C433E3 for ; Wed, 26 Aug 2020 14:49:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4922822B3F for ; Wed, 26 Aug 2020 14:49:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598453349; bh=Dex4kuQ58Jrk7YN8qvgLtcRhN0dw9B7yef9ma5nqLPg=; h=From:To:Cc:Subject:Date:List-ID:From; b=a+bu5r/TxTU9OIMjYEdDfkNSVMQ6F/4Ysv0vG6LnaD5moVoV2bozalR7bqRlWhlq6 kCkI7Q1kKQBV6/ZjbfKbakbJ5i8TZgOC/UqS0AlSQoO/e0sw0UzRUQaZJGu/bxPMtc 1YYkjafZ6lVu5we6vprvly7WgL8lg2SySH0oEhos= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726734AbgHZOtI (ORCPT ); Wed, 26 Aug 2020 10:49:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:32938 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726700AbgHZOtH (ORCPT ); Wed, 26 Aug 2020 10:49:07 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2AC482078D; Wed, 26 Aug 2020 14:49:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598453347; bh=Dex4kuQ58Jrk7YN8qvgLtcRhN0dw9B7yef9ma5nqLPg=; h=From:To:Cc:Subject:Date:From; b=q3vz0znEM8dpxcfWXaoMSaWqBR/gJEeZvmy//WjI3XX4R8K2M/zxvzaKEERdpQ6Pq MSaxW/cqaAy3NCYGV2iYl/hwjqxdqmWij3jDa2/U4e2x1//C5BNTNfG2BSyNFR5MGu gI48cF07qqtQZn3IoupQZmFE+ESjyOQoEI3A7nmQ= From: Krzysztof Kozlowski To: =?utf-8?q?Pali_Roh=C3=A1r?= , "Andrew F. Davis" , Sebastian Reichel , Paul Cercueil , David Lechner , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH 1/5] power: supply: bq27xxx: Simplify with dev_err_probe() Date: Wed, 26 Aug 2020 16:48:54 +0200 Message-Id: <20200826144858.9584-1-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski --- drivers/power/supply/bq27xxx_battery.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c index a123f6e21f08..617689084ded 100644 --- a/drivers/power/supply/bq27xxx_battery.c +++ b/drivers/power/supply/bq27xxx_battery.c @@ -1992,13 +1992,9 @@ int bq27xxx_battery_setup(struct bq27xxx_device_info *di) psy_desc->external_power_changed = bq27xxx_external_power_changed; di->bat = power_supply_register_no_ws(di->dev, psy_desc, &psy_cfg); - if (IS_ERR(di->bat)) { - if (PTR_ERR(di->bat) == -EPROBE_DEFER) - dev_dbg(di->dev, "failed to register battery, deferring probe\n"); - else - dev_err(di->dev, "failed to register battery\n"); - return PTR_ERR(di->bat); - } + if (IS_ERR(di->bat)) + return dev_err_probe(di->dev, PTR_ERR(di->bat), + "failed to register battery\n"); bq27xxx_battery_settings(di); bq27xxx_battery_update(di); From patchwork Wed Aug 26 14:48:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 256912 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CE44C433DF for ; Wed, 26 Aug 2020 14:51:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F14D62177B for ; Wed, 26 Aug 2020 14:51:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598453508; bh=tntjrE3W6ey1gnNn/IdbM92+VGhVTc834lTJ3ifNujs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=dmrH41rCwtjomDFG2PwjHO48CeE365QwZ3VuTB626Mh8ij2ddrXO5zxPHFEGoAjby RHMkvkgIe2G3RER6vZGUlc1sd5muQKKwbSlOyccOsMOVwt/8HOdl4BzLutg6k3gDBg efiPJmVD0EscWjXVVT8pwGrqwgH7SArjV2TCdHbk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727793AbgHZOvn (ORCPT ); Wed, 26 Aug 2020 10:51:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:33352 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726700AbgHZOtP (ORCPT ); Wed, 26 Aug 2020 10:49:15 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5259C22B47; Wed, 26 Aug 2020 14:49:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598453354; bh=tntjrE3W6ey1gnNn/IdbM92+VGhVTc834lTJ3ifNujs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0DN4mAPsmz70MyK35VeOlHz8N424f2PxfrhWSox2+s62UMnLuGHg+ghFN1mFBaKJp j+y3d+x6ckYIkwByeLURJbwiKJKXE9tEVvUifew2ReF+NMjaBdxdsgmfbkrH2npvCe 1EQfkF6O4OeTpbsh0aJ8v4LmlKf4erNp0KkU2Eio= From: Krzysztof Kozlowski To: =?utf-8?q?Pali_Roh=C3=A1r?= , "Andrew F. Davis" , Sebastian Reichel , Paul Cercueil , David Lechner , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH 4/5] power: supply: ingenic: Simplify with dev_err_probe() Date: Wed, 26 Aug 2020 16:48:57 +0200 Message-Id: <20200826144858.9584-4-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200826144858.9584-1-krzk@kernel.org> References: <20200826144858.9584-1-krzk@kernel.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski --- drivers/power/supply/ingenic-battery.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/power/supply/ingenic-battery.c b/drivers/power/supply/ingenic-battery.c index dd3d93dfe3eb..32dc77fd9a95 100644 --- a/drivers/power/supply/ingenic-battery.c +++ b/drivers/power/supply/ingenic-battery.c @@ -147,11 +147,9 @@ static int ingenic_battery_probe(struct platform_device *pdev) psy_cfg.of_node = dev->of_node; bat->battery = devm_power_supply_register(dev, desc, &psy_cfg); - if (IS_ERR(bat->battery)) { - if (PTR_ERR(bat->battery) != -EPROBE_DEFER) - dev_err(dev, "Unable to register battery\n"); - return PTR_ERR(bat->battery); - } + if (IS_ERR(bat->battery)) + return dev_err_probe(dev, PTR_ERR(bat->battery), + "Unable to register battery\n"); ret = power_supply_get_battery_info(bat->battery, &bat->info); if (ret) { From patchwork Wed Aug 26 14:48:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 256913 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA683C433E3 for ; Wed, 26 Aug 2020 14:51:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9BF3021741 for ; Wed, 26 Aug 2020 14:51:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598453504; bh=ZBhWApDwCrDJpoKImS+nFVx4dksKMrud8X8VM0Co+6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=pfzcPBB9015tBUu+8DD0fdTwhp+CS+jZMH1JLPG9BnAbFE1prYU93k1zRkQ85uOn6 uOkj5FBWZb2qTBA2EvIEEfchPeBGxHU4lxIHpLa/V+BlOaytIJqH5LNuPD4efEJo2R YFZFgSQQ2da4jT57uEkZvv5Jpc2x2FSznTOdxhrM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726843AbgHZOvn (ORCPT ); Wed, 26 Aug 2020 10:51:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:33468 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727040AbgHZOtR (ORCPT ); Wed, 26 Aug 2020 10:49:17 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A39C722B40; Wed, 26 Aug 2020 14:49:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598453356; bh=ZBhWApDwCrDJpoKImS+nFVx4dksKMrud8X8VM0Co+6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ean4WHQ59iRFfzF4Ouy1Ef1zl4WcsGYtnATvmBVh9wuQybu3W98hJRX40J8lUarDH DoiBoHPhWewfzSV4DsNvL1yTuWnUExRoMmNdm78R8LCMqMFPbDA/GH7RpJLFNbbq3m Zt0S3fuKj9DwMz9FdQB6/opCUXZDcfv1bBmHwHRc= From: Krzysztof Kozlowski To: =?utf-8?q?Pali_Roh=C3=A1r?= , "Andrew F. Davis" , Sebastian Reichel , Paul Cercueil , David Lechner , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH 5/5] power: supply: lego_ev3: Simplify with dev_err_probe() Date: Wed, 26 Aug 2020 16:48:58 +0200 Message-Id: <20200826144858.9584-5-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200826144858.9584-1-krzk@kernel.org> References: <20200826144858.9584-1-krzk@kernel.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski --- drivers/power/supply/lego_ev3_battery.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/drivers/power/supply/lego_ev3_battery.c b/drivers/power/supply/lego_ev3_battery.c index 1ae3710909b7..ccb00be38e2c 100644 --- a/drivers/power/supply/lego_ev3_battery.c +++ b/drivers/power/supply/lego_ev3_battery.c @@ -166,27 +166,21 @@ static int lego_ev3_battery_probe(struct platform_device *pdev) batt->iio_v = devm_iio_channel_get(dev, "voltage"); err = PTR_ERR_OR_ZERO(batt->iio_v); - if (err) { - if (err != -EPROBE_DEFER) - dev_err(dev, "Failed to get voltage iio channel\n"); - return err; - } + if (err) + return dev_err_probe(dev, err, + "Failed to get voltage iio channel\n"); batt->iio_i = devm_iio_channel_get(dev, "current"); err = PTR_ERR_OR_ZERO(batt->iio_i); - if (err) { - if (err != -EPROBE_DEFER) - dev_err(dev, "Failed to get current iio channel\n"); - return err; - } + if (err) + return dev_err_probe(dev, err, + "Failed to get current iio channel\n"); batt->rechargeable_gpio = devm_gpiod_get(dev, "rechargeable", GPIOD_IN); err = PTR_ERR_OR_ZERO(batt->rechargeable_gpio); - if (err) { - if (err != -EPROBE_DEFER) - dev_err(dev, "Failed to get rechargeable gpio\n"); - return err; - } + if (err) + return dev_err_probe(dev, err, + "Failed to get rechargeable gpio\n"); /* * The rechargeable battery indication switch cannot be changed without