From patchwork Sat May 11 08:56:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lubomir Rintel X-Patchwork-Id: 10939703 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E79BA924 for ; Sat, 11 May 2019 08:56:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE59120069 for ; Sat, 11 May 2019 08:56:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BEE2520134; Sat, 11 May 2019 08:56:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D043720069 for ; Sat, 11 May 2019 08:56:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727935AbfEKI43 (ORCPT ); Sat, 11 May 2019 04:56:29 -0400 Received: from shell.v3.sk ([90.176.6.54]:51860 "EHLO shell.v3.sk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725887AbfEKI43 (ORCPT ); Sat, 11 May 2019 04:56:29 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 3E9C8104088; Sat, 11 May 2019 10:56:25 +0200 (CEST) Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id SgZ03tkjHUY6; Sat, 11 May 2019 10:56:20 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id E5B9E104101; Sat, 11 May 2019 10:56:19 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.v3.sk Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id u9iqiHrguB1a; Sat, 11 May 2019 10:56:19 +0200 (CEST) Received: from furthur.local (g-server-2.ign.cz [91.219.240.2]) by zimbra.v3.sk (Postfix) with ESMTPSA id CC94C104088; Sat, 11 May 2019 10:56:18 +0200 (CEST) From: Lubomir Rintel To: Sebastian Reichel Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Lubomir Rintel , kbuild test robot Subject: [PATCH] power: supply: olpc_battery: force the le/be casts Date: Sat, 11 May 2019 10:56:14 +0200 Message-Id: <20190511085614.29677-1-lkundrak@v3.sk> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The endianness of data returned from the EC depends on the particular EC version determined at run time. Cast from little/big endian explicitey in the routine that flips endianness to the native one to make sparse happy. Signed-off-by: Lubomir Rintel Reported-by: kbuild test robot Fixes: 76311b9a3295 ("power: supply: olpc_battery: Add OLPC XO 1.75 support") --- drivers/power/supply/olpc_battery.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/power/supply/olpc_battery.c b/drivers/power/supply/olpc_battery.c index 4ccd242fcf72..066ec9a11153 100644 --- a/drivers/power/supply/olpc_battery.c +++ b/drivers/power/supply/olpc_battery.c @@ -326,9 +326,9 @@ static int olpc_bat_get_voltage_max_design(union power_supply_propval *val) static u16 ecword_to_cpu(struct olpc_battery_data *data, u16 ec_word) { if (data->little_endian) - return le16_to_cpu(ec_word); + return le16_to_cpu((__force __le16)ec_word); else - return be16_to_cpu(ec_word); + return be16_to_cpu((__force __be16)ec_word); } /********************************************************************* @@ -340,7 +340,7 @@ static int olpc_bat_get_property(struct power_supply *psy, { struct olpc_battery_data *data = power_supply_get_drvdata(psy); int ret = 0; - __be16 ec_word; + u16 ec_word; uint8_t ec_byte; __be64 ser_buf;