From patchwork Wed Aug 26 14:41:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Reichel X-Patchwork-Id: 256916 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=-12.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, 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 4905EC433E1 for ; Wed, 26 Aug 2020 14:42:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2965B2224D for ; Wed, 26 Aug 2020 14:42:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726514AbgHZOmF (ORCPT ); Wed, 26 Aug 2020 10:42:05 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:43844 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726241AbgHZOmE (ORCPT ); Wed, 26 Aug 2020 10:42:04 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sre) with ESMTPSA id 8345E2994D6 Received: by jupiter.universe (Postfix, from userid 1000) id 57832480113; Wed, 26 Aug 2020 16:42:00 +0200 (CEST) From: Sebastian Reichel To: Dmitry Osipenko , Sebastian Reichel Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@collabora.com, Sebastian Reichel Subject: [PATCHv1 2/2] power: supply: smb347-charger: Use generic property framework Date: Wed, 26 Aug 2020 16:41:59 +0200 Message-Id: <20200826144159.353837-3-sebastian.reichel@collabora.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200826144159.353837-1-sebastian.reichel@collabora.com> References: <20200826144159.353837-1-sebastian.reichel@collabora.com> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Simplify the driver and remove the DT specific code by using the generic device property framework. Signed-off-by: Sebastian Reichel --- drivers/power/supply/smb347-charger.c | 40 +++++++++++++-------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/drivers/power/supply/smb347-charger.c b/drivers/power/supply/smb347-charger.c index b182727dfc90..d3bf35ed12ce 100644 --- a/drivers/power/supply/smb347-charger.c +++ b/drivers/power/supply/smb347-charger.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -1176,7 +1177,7 @@ static bool smb347_readable_reg(struct device *dev, unsigned int reg) static void smb347_dt_parse_dev_info(struct smb347_charger *smb) { - struct device_node *np = smb->dev->of_node; + struct device *dev = smb->dev; smb->soft_temp_limit_compensation = SMB3XX_SOFT_TEMP_COMPENSATE_DEFAULT; @@ -1190,32 +1191,29 @@ static void smb347_dt_parse_dev_info(struct smb347_charger *smb) smb->hard_hot_temp_limit = SMB3XX_TEMP_USE_DEFAULT; /* Charging constraints */ - of_property_read_u32(np, "summit,fast-voltage-threshold-microvolt", - &smb->pre_to_fast_voltage); - of_property_read_u32(np, "summit,mains-current-limit-microamp", - &smb->mains_current_limit); - of_property_read_u32(np, "summit,usb-current-limit-microamp", - &smb->usb_hc_current_limit); + device_property_read_u32(dev, "summit,fast-voltage-threshold-microvolt", + &smb->pre_to_fast_voltage); + device_property_read_u32(dev, "summit,mains-current-limit-microamp", + &smb->mains_current_limit); + device_property_read_u32(dev, "summit,usb-current-limit-microamp", + &smb->usb_hc_current_limit); /* For thermometer monitoring */ - of_property_read_u32(np, "summit,chip-temperature-threshold-celsius", - &smb->chip_temp_threshold); - of_property_read_u32(np, "summit,soft-compensation-method", - &smb->soft_temp_limit_compensation); - of_property_read_u32(np, "summit,charge-current-compensation-microamp", - &smb->charge_current_compensation); + device_property_read_u32(dev, "summit,chip-temperature-threshold-celsius", + &smb->chip_temp_threshold); + device_property_read_u32(dev, "summit,soft-compensation-method", + &smb->soft_temp_limit_compensation); + device_property_read_u32(dev, "summit,charge-current-compensation-microamp", + &smb->charge_current_compensation); /* Supported charging mode */ - smb->use_mains = - of_property_read_bool(np, "summit,enable-mains-charging"); - smb->use_usb = - of_property_read_bool(np, "summit,enable-usb-charging"); - smb->use_usb_otg = - of_property_read_bool(np, "summit,enable-otg-charging"); + smb->use_mains = device_property_read_bool(dev, "summit,enable-mains-charging"); + smb->use_usb = device_property_read_bool(dev, "summit,enable-usb-charging"); + smb->use_usb_otg = device_property_read_bool(dev, "summit,enable-otg-charging"); /* Select charging control */ - of_property_read_u32(np, "summit,enable-charge-control", - &smb->enable_control); + device_property_read_u32(dev, "summit,enable-charge-control", + &smb->enable_control); } static int smb347_get_battery_info(struct smb347_charger *smb)