From patchwork Fri Jun 16 21:10:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakob Hauser X-Patchwork-Id: 693544 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55BD2EB64D7 for ; Fri, 16 Jun 2023 21:11:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344628AbjFPVLW (ORCPT ); Fri, 16 Jun 2023 17:11:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230022AbjFPVLV (ORCPT ); Fri, 16 Jun 2023 17:11:21 -0400 Received: from sonic311-31.consmr.mail.ir2.yahoo.com (sonic311-31.consmr.mail.ir2.yahoo.com [77.238.176.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2D8CD8 for ; Fri, 16 Jun 2023 14:11:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rocketmail.com; s=s2048; t=1686949878; bh=YjKr9kfUpqIEiBIGHJQUMWUtyBPUuXHIW1WGIJcpt2o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=qOK92UQBcz4YTCNRW/ckInwSTYODoQGpaIcDCWIvecXWa5I8Vb9SAyq7k4que5nszxSJsmdqHWSPyXoAqDcHN2YKYgqeWd5DTDk3zGJ6c+j3zqYYpijPqz10s4e7ffeZl0IH1XGiAtTxGwSOmBBp1k+EgglnVUxgRVd+ccetxUuk/brW2ahvGnbKJyDa9sqvyzZ8vCyDCQCuJLTuQWKSNlKDF4uNRinq3NJTfhsfka5XVVT0WDlSqwjgLou+9QlhU5841UtFkxcLV5RplZ41T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JjxjeSOXlNcaSrMzoN1t qNK8Q4wxY6Guj8QT4wEs9I.Cf3ijOvfqXg_SjeUmjpxCkSXA2DmCiZ4YBAkmD5KkWk54FfZj3___ txy8GQLXRuXo7Pmo.FOO.S4y1nbExiSfNdF.IU.MScI5yv7eveaNBy1LwkRqEfeexcLVDuJsdg85 9Wz4M_hHJMmmRR4mOy50wPn6W2Ssz4EAnUPFEvfrM4yMJ9onu_OTHYK8PHYwskxL24Hlf1AY.YrI sAb7le599nRuOxOCGfaoNktC4LgH641RVpblADHXx5hOBMFm6TOfGV0Slqvlobyr8zUmoRQOVz_f FG6eHMgb83V_QYhjgYoRKEXpPjScSNy7IqjVlGqEAMJ2sYFpGAAenYcxWxGOwpcmbWcG6pkpBZto SVE6s4VlLLyCvYoxjFerEh81H2lyhzUblm98u08_X4rRKWnVOjOqK4U0Uvb9yVzz5qwipVyOhZOO AViwEts6h.F3VZowoSoy_oaJ5MT7RlJihYhfG6yC9wi9V09x4ZyBnKs.NdKQYizRBN7rfmCIRqX2 I143kwMeO4kr7NQSbUSf9tIF3a_ww.061IeMThKf5kv.AQoOWCUoVYLCYO_.OZ.qtUEoAIOear.n 9S8zROeEKdgyenXF_p2_6glhtDtLZS1LJtGJZpP33bYMSNvvMVqDJz05cwV8jkwHWxxNXR0XkSve H6cnQMf1te6pqA8uqYinJLOg9wd689fM3kiJzLP6zpAhK2MBkfGDWZs5cMWKYdVc2ovRjIGhiVNe mCtvw2i6hhf5HuZzBEq5p92E_vrFev995yg-- X-Sonic-MF: X-Sonic-ID: 03f28b74-5c07-42cd-8eba-1a8f59d9f5b9 Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.ir2.yahoo.com with HTTP; Fri, 16 Jun 2023 21:11:18 +0000 Received: by hermes--production-ir2-7867f454fc-gg9x8 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID c618d34c94eed5ad1e4505ee686233db; Fri, 16 Jun 2023 21:11:17 +0000 (UTC) From: Jakob Hauser To: Sebastian Reichel Cc: Lee Jones , Christophe Jaillet , Stephan Gerhold , Raymond Hackley , Henrik Grimler , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, phone-devel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Jakob Hauser Subject: [PATCH 1/2] power: supply: rt5033_charger: Simplify initialization of rt5033_charger_data Date: Fri, 16 Jun 2023 23:10:47 +0200 Message-Id: <3936e777efe1e9d11462ce81bb177690b982a807.1686948074.git.jahau@rocketmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Currently the struct "rt5033_charger_data" is initialized rather complicated. The cause lies inside of the struct "rt5033_charger", where struct "rt5033_charger_data" is implemented as a pointer *chg. Therefore, inside of struct "rt5033_charger" change the struct "rt5033_charger_data" to non-pointer "chg". It is then initialized right away and can be accessed more easily. Signed-off-by: Jakob Hauser --- drivers/power/supply/rt5033_charger.c | 29 +++++++++++---------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/drivers/power/supply/rt5033_charger.c b/drivers/power/supply/rt5033_charger.c index e0303ca5a8db..361a36c2a195 100644 --- a/drivers/power/supply/rt5033_charger.c +++ b/drivers/power/supply/rt5033_charger.c @@ -28,7 +28,7 @@ struct rt5033_charger { struct device *dev; struct regmap *regmap; struct power_supply *psy; - struct rt5033_charger_data *chg; + struct rt5033_charger_data chg; struct extcon_dev *edev; struct notifier_block extcon_nb; struct work_struct extcon_work; @@ -130,7 +130,7 @@ static int rt5033_get_charger_const_voltage(struct rt5033_charger *charger) static inline int rt5033_init_const_charge(struct rt5033_charger *charger) { - struct rt5033_charger_data *chg = charger->chg; + struct rt5033_charger_data *chg = &charger->chg; int ret; unsigned int val; u8 reg_data; @@ -204,7 +204,7 @@ static inline int rt5033_init_const_charge(struct rt5033_charger *charger) static inline int rt5033_init_fast_charge(struct rt5033_charger *charger) { - struct rt5033_charger_data *chg = charger->chg; + struct rt5033_charger_data *chg = &charger->chg; int ret; unsigned int val; u8 reg_data; @@ -249,7 +249,7 @@ static inline int rt5033_init_fast_charge(struct rt5033_charger *charger) static inline int rt5033_init_pre_charge(struct rt5033_charger *charger) { - struct rt5033_charger_data *chg = charger->chg; + struct rt5033_charger_data *chg = &charger->chg; int ret; unsigned int val; u8 reg_data; @@ -539,21 +539,16 @@ static int rt5033_charger_get_property(struct power_supply *psy, return 0; } -static struct rt5033_charger_data *rt5033_charger_dt_init( - struct rt5033_charger *charger) +static int rt5033_charger_dt_init(struct rt5033_charger *charger) { - struct rt5033_charger_data *chg; + struct rt5033_charger_data *chg = &charger->chg; struct power_supply_battery_info *info; int ret; - chg = devm_kzalloc(charger->dev, sizeof(*chg), GFP_KERNEL); - if (!chg) - return ERR_PTR(-ENOMEM); - ret = power_supply_get_battery_info(charger->psy, &info); if (ret) - return ERR_PTR(dev_err_probe(charger->dev, -EINVAL, - "missing battery info\n")); + return dev_err_probe(charger->dev, -EINVAL, + "missing battery info\n"); /* Assign data. Validity will be checked in the init functions. */ chg->pre_uamp = info->precharge_current_ua; @@ -562,7 +557,7 @@ static struct rt5033_charger_data *rt5033_charger_dt_init( chg->pre_uvolt = info->precharge_voltage_max_uv; chg->const_uvolt = info->constant_charge_voltage_max_uv; - return chg; + return 0; } static void rt5033_charger_extcon_work(struct work_struct *work) @@ -679,9 +674,9 @@ static int rt5033_charger_probe(struct platform_device *pdev) return dev_err_probe(&pdev->dev, PTR_ERR(charger->psy), "Failed to register power supply\n"); - charger->chg = rt5033_charger_dt_init(charger); - if (IS_ERR_OR_NULL(charger->chg)) - return PTR_ERR(charger->chg); + ret = rt5033_charger_dt_init(charger); + if (ret) + return ret; ret = rt5033_charger_reg_init(charger); if (ret) From patchwork Fri Jun 16 21:10:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakob Hauser X-Patchwork-Id: 693543 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65C43EB64D8 for ; Fri, 16 Jun 2023 21:11:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345724AbjFPVLd (ORCPT ); Fri, 16 Jun 2023 17:11:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345566AbjFPVL1 (ORCPT ); Fri, 16 Jun 2023 17:11:27 -0400 Received: from sonic306-21.consmr.mail.ir2.yahoo.com (sonic306-21.consmr.mail.ir2.yahoo.com [77.238.176.207]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A2F2359D for ; Fri, 16 Jun 2023 14:11:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rocketmail.com; s=s2048; t=1686949884; bh=2W0/s9Ei/3O15AUKoqqy+U+PAyRYFPdruzdJ33WOGco=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=IlbipCUnNwFJWBJMWof8BoQrRUxxcHM+casc6zwXMefAcLU4ICOt0KxjWc329Esd+HiWUrNKs/mP/Lnxwfm98qnRzCXMC5NpBSdmQH8SC29RnIE5T9OCQUbpOUL4HLco9reM2mjwqQEIzKpt3hDDOs8l7Gtr+xaeg7kBWk4MfOep/mpX248EzKVTJPA9ARIMmCTWcLlQvTy1JkPnMPO/bS5S9ZCR75iUr7gtnSkdbon9QoBsgfEqyQjFjh7iWqmZt8afYVnxKd0nNinzjtHlHKptqt/2d06dGhGYjKBgNj5evxVVHGKh3L/nvY50Od0auhRMdTNci6wbiulfSXKvMg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1686949884; bh=gYfF9Km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jgeeAtaxxHlJy3x3zwv8q8 ISVWMP4DCgb0tagzHbviMdbMnGLgtKikxXSpzeduWgEbUoZ3kLR6uXPG._KrWFF8_uvJSNLKbn6D THiaJMukf1bAH5FF8mSz.N1xg7RtbRi_5CVDiOyVsmJiWBISaNR1hRJEPL9ZKiM.bs6uYd2WZmeu yHVhjn2KywLgC9xhKVfVW0NuYVfNz9kXnNkOQXsPUfPmYDdnJiD1RkRifYSXI8WiATRec.SKOgxb 6oFC.KETpTdyg6aBTtxE_BDKAUcUfAj28keIwI9AOyZt0wHpD_TZxTcWdDR0fv9.VM.Gn_S32iMw PjCDjz5GthAXJKcDzkhnY3P9dpsDv4i0Y2GRgoVqwU2glquDoBIYHB8hkfZI53DzRLKFgenpIpjH 0XG3.KbeTvo3bmMBV_1Y7vACxJKGG6dapu7FmeoeMbj05hg.QiW9g4C7k7x0JZdz29jK7OXP0YO9 BvCxNRQcQSKUJjz8KJ85EWLFMOYAmb77aXQq_iMyEDAV5VHsFZpdx3lKFjC_QRuDgwCG6a6AyL7U F0kzalVh9ibkeLeAM3cVju8tkmYPr6xGKFrdwG3U6BLHDfCVGpTzKbXPdP08XaiBJhhnjJuh48ek N92Xo2ROKHnls1hR0l5p9peOusLlp41zXNA-- X-Sonic-MF: X-Sonic-ID: 5be4c50b-e39c-4e3f-8b4e-f2655f0c20ef Received: from sonic.gate.mail.ne1.yahoo.com by sonic306.consmr.mail.ir2.yahoo.com with HTTP; Fri, 16 Jun 2023 21:11:24 +0000 Received: by hermes--production-ir2-7867f454fc-gg9x8 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID c618d34c94eed5ad1e4505ee686233db; Fri, 16 Jun 2023 21:11:18 +0000 (UTC) From: Jakob Hauser To: Sebastian Reichel Cc: Lee Jones , Christophe Jaillet , Stephan Gerhold , Raymond Hackley , Henrik Grimler , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, phone-devel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Jakob Hauser Subject: [PATCH 2/2] power: supply: rt5033_charger: Replace "&pdev->dev" by "charger->dev" in probe Date: Fri, 16 Jun 2023 23:10:48 +0200 Message-Id: <99b76d5ed0d47f55ddbf55564a0424d67af1a447.1686948074.git.jahau@rocketmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org At the beginning of the probe function, "charger->dev" is set equal to "&pdev->dev". Therefore it's more clear to subsequently use "charger->dev" instead of "&pdev->dev". Signed-off-by: Jakob Hauser --- drivers/power/supply/rt5033_charger.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/power/supply/rt5033_charger.c b/drivers/power/supply/rt5033_charger.c index 361a36c2a195..71a237cd1d61 100644 --- a/drivers/power/supply/rt5033_charger.c +++ b/drivers/power/supply/rt5033_charger.c @@ -667,11 +667,11 @@ static int rt5033_charger_probe(struct platform_device *pdev) psy_cfg.of_node = pdev->dev.of_node; psy_cfg.drv_data = charger; - charger->psy = devm_power_supply_register(&pdev->dev, + charger->psy = devm_power_supply_register(charger->dev, &rt5033_charger_desc, &psy_cfg); if (IS_ERR(charger->psy)) - return dev_err_probe(&pdev->dev, PTR_ERR(charger->psy), + return dev_err_probe(charger->dev, PTR_ERR(charger->psy), "Failed to register power supply\n"); ret = rt5033_charger_dt_init(charger); @@ -690,22 +690,22 @@ static int rt5033_charger_probe(struct platform_device *pdev) np_edev = of_get_parent(np_conn); charger->edev = extcon_find_edev_by_node(np_edev); if (IS_ERR(charger->edev)) { - dev_warn(&pdev->dev, "no extcon device found in device-tree\n"); + dev_warn(charger->dev, "no extcon device found in device-tree\n"); goto out; } - ret = devm_work_autocancel(&pdev->dev, &charger->extcon_work, + ret = devm_work_autocancel(charger->dev, &charger->extcon_work, rt5033_charger_extcon_work); if (ret) { - dev_err(&pdev->dev, "failed to initialize extcon work\n"); + dev_err(charger->dev, "failed to initialize extcon work\n"); return ret; } charger->extcon_nb.notifier_call = rt5033_charger_extcon_notifier; - ret = devm_extcon_register_notifier_all(&pdev->dev, charger->edev, + ret = devm_extcon_register_notifier_all(charger->dev, charger->edev, &charger->extcon_nb); if (ret) { - dev_err(&pdev->dev, "failed to register extcon notifier\n"); + dev_err(charger->dev, "failed to register extcon notifier\n"); return ret; } out: