From patchwork Tue Feb 14 13:20:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 56915 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2969198wrn; Tue, 14 Feb 2023 05:24:19 -0800 (PST) X-Google-Smtp-Source: AK7set94yGqhzZzp46dinhPfu8tjEWxIC21PQOgSrROrpwH1ZozgkIHMek7vkXuf3cXvYv/iXnVa X-Received: by 2002:a17:906:8396:b0:8b1:3002:bd6d with SMTP id p22-20020a170906839600b008b13002bd6dmr1856987ejx.31.1676381059184; Tue, 14 Feb 2023 05:24:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676381059; cv=none; d=google.com; s=arc-20160816; b=cBRL9ZivoF9x/SXrNxAHwqSUwJ7jidU8GLi4rgkZmDn570CyNF7Vf+FLDZxq2QPxj6 C+/SiRKm2QUOR++EdysmzQlS8zr6fR5h9aoAdglkz8WLcO6iAIp6zpeZ2CGinTF+g2Cm fK36TfP9xRfWM0PLhpAGbfZkDB4JJ733fXh4hRlr7om6jDlvUzpBuvvnNdU4KcuRSIN4 nl8DA6vvJEVPxBqjl7GS5CE8qJ4Yy3bpo3647W8z+3iZEML3cld5jI+Vk/JZpPNunBrY yE0abfnAKS88nHXPnOPxV7K1er6HMV/daTjvvX8Xdq5Ah6CbPdXP93p4ZJAAbtLsdUoB O4Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=+NkeJTZ9jRxZwyeHxc8Q5BjGr/qG9SWWeArC9by5vLY=; b=i6PhF6CHwhd64tBi93r5C1gZAjpIvuJKpxH9VUkuQHNDjFSi7CBnGIjb/K6emaU4DG vHaU6nRrGlSVZ36QMpQdoqPSgAXu5reOMDLfO8xT4UCjA6PY1j+JBFt+Q+C0oLMJEQIj zHRIJe4nbWBshMIADVSgyzdPtxMeohdGJhI1igpx7r9cLsfV0e6dd2xGYqGZbJn8fyxi cbV1Zn/EMBtT49ruiegU5nMceFPmdYKpab4QUBjLxYUp5OlSwC0/T4lqRxlSPNHQQEN8 xpfXxKxNh0JuTeNlICFaGQ9l3Ia8O0w5U8GsiZn+WR0KckaTAcOAqP/JNF5Z4hrZh++y iIVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BM5Iz0iw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 25-20020a170906209900b008b1348199d7si1113784ejq.785.2023.02.14.05.23.55; Tue, 14 Feb 2023 05:24:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BM5Iz0iw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231637AbjBNNVR (ORCPT + 99 others); Tue, 14 Feb 2023 08:21:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231834AbjBNNVP (ORCPT ); Tue, 14 Feb 2023 08:21:15 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F5EF279B7; Tue, 14 Feb 2023 05:20:57 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AFE1B61637; Tue, 14 Feb 2023 13:20:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1588DC433D2; Tue, 14 Feb 2023 13:20:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1676380856; bh=9m8ZbKJsD+az2elSMPiB/zCuKKeWwdmecOz4rRFlokw=; h=From:To:Cc:Subject:Date:From; b=BM5Iz0iwcVDt6wMsJwSQqIgE769d6X+hnI4PuaEX4j/mDAXprrZJCBYjc49bgctp2 5AgbRg2mNfecieyWcPOz7FfuAEJ6jKznh9yFsaCG8fQC7uaGLhh25LTSOEVcu4bnNr Dwo588zvSBn/mojAkTU9P6Vc4OlzY4CSEVQyF4r/Fj3y7Aes9IJa+okDwm0fuCOaeH Eez00iOt94mjXZTDhGcC1QvpSXE+GvU811v+G+B5P2+j/rpt8Tt1Cm9+h8WJ2GXarK hszGdJV/dWlMpc94Au/83/mGc3pX7mAm07FIg6/MJOwQk58h3dH5G13qp+i319IcOi 1XHGvdaNI3+8w== From: Arnd Bergmann To: Andy Gross , Bjorn Andersson , Sebastian Reichel Cc: Arnd Bergmann , Konrad Dybcio , Neil Armstrong , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] power: supply: qcom_battmgr: remove bogus do_div() Date: Tue, 14 Feb 2023 14:20:42 +0100 Message-Id: <20230214132052.1556699-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757812945855899791?= X-GMAIL-MSGID: =?utf-8?q?1757812945855899791?= From: Arnd Bergmann The argument to do_div() is a 32-bit integer, and it was read from a 32-bit register so there is no point in doing a 64-bit division on it. On 32-bit arm, do_div() causes a compile-time warning here: include/asm-generic/div64.h:238:22: error: passing argument 1 of '__div64_32' from incompatible pointer type [-Werror=incompatible-pointer-types] 238 | __rem = __div64_32(&(n), __base); \ | ^~~~ | | | unsigned int * drivers/power/supply/qcom_battmgr.c:1130:4: note: in expansion of macro 'do_div' 1130 | do_div(battmgr->status.percent, 100); Signed-off-by: Arnd Bergmann Reviewed-by: Konrad Dybcio Acked-by: Sebastian Reichel Reviewed-by: Geert Uytterhoeven --- drivers/power/supply/qcom_battmgr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/power/supply/qcom_battmgr.c b/drivers/power/supply/qcom_battmgr.c index ec31f887184f..de77df97b3a4 100644 --- a/drivers/power/supply/qcom_battmgr.c +++ b/drivers/power/supply/qcom_battmgr.c @@ -1126,8 +1126,7 @@ static void qcom_battmgr_sm8350_callback(struct qcom_battmgr *battmgr, battmgr->info.charge_type = le32_to_cpu(resp->intval.value); break; case BATT_CAPACITY: - battmgr->status.percent = le32_to_cpu(resp->intval.value); - do_div(battmgr->status.percent, 100); + battmgr->status.percent = le32_to_cpu(resp->intval.value) / 100; break; case BATT_VOLT_OCV: battmgr->status.voltage_ocv = le32_to_cpu(resp->intval.value);