From patchwork Mon Jan 8 22:12:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 10150675 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 34D4360210 for ; Mon, 8 Jan 2018 22:12:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B7E6287B8 for ; Mon, 8 Jan 2018 22:12:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 20A0F2891A; Mon, 8 Jan 2018 22:12:57 +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=-6.9 required=2.0 tests=BAYES_00,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 E6A4328919 for ; Mon, 8 Jan 2018 22:12:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757177AbeAHWMu (ORCPT ); Mon, 8 Jan 2018 17:12:50 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:36298 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757168AbeAHWMt (ORCPT ); Mon, 8 Jan 2018 17:12:49 -0500 Received: by mail-wr0-f193.google.com with SMTP id b76so12284589wrd.3 for ; Mon, 08 Jan 2018 14:12:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=S0JKaOyPGAl+BAAPQfZ3D7F2qOaCRMrYgHV4wFlZwW0=; b=SonD//T+OJgqmzc0yzJ887XEg+6KSLOcWy1CypFz11GXhsdC8l/DaX7W9+zx7aXyNQ WFozo9rWAawI1QSX+oK+M/1rXlS5JzVj18Xp+9rZNkQ9PnMuvflRn7OQ1lQlAm9N+UdP ICQwghrc0kZJ9hK2+veX0NjupZ9USGQVnkqWv3PNGUqvcVATeuBGnUsKkwHBwP5NMNKb ZlQR8XPjRf86OzmWxqv0vxaBnZo/qDqY+EYv+LpmQJTuz033OJUljcTKvbMHJrUxADTu XenEV/2PwGuRDtBFcp3umoweAVZdSMheB+VB35chiAIYpNl9txXfCgmCKjVajRaGIXCY wSKg== X-Gm-Message-State: AKGB3mLAHWc0+MjpkY0cQOxP1hX5mH4Ctz5x8LwxXTnksnWH9KgMkFxG IAmWRVTciGokOvH6z7eeHClVAw== X-Google-Smtp-Source: ACJfBosDJPUS5yahTgG1fUjg4N8X7LTSLCGCBYgom/1fCCcxiH58k61mMMeaVxKZa1RfkkYrz+w7vA== X-Received: by 10.223.146.129 with SMTP id 1mr10975060wrn.182.1515449568671; Mon, 08 Jan 2018 14:12:48 -0800 (PST) Received: from localhost.localdomain ([151.66.12.57]) by smtp.gmail.com with ESMTPSA id 34sm6964342wro.7.2018.01.08.14.12.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Jan 2018 14:12:48 -0800 (PST) From: Lorenzo Bianconi To: jic23@kernel.org Cc: linux-iio@vger.kernel.org Subject: [PATCH v3 1/4] iio: humidity: hts221: remove warnings in hts221_parse_{temp, rh}_caldata() Date: Mon, 8 Jan 2018 23:12:28 +0100 Message-Id: <20180108221231.13283-2-lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.15.1 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Remove following sparse warnings in hts221_parse_temp_caldata() and in hts221_parse_rh_caldata(): drivers/iio/humidity/hts221_core.c:302:19: warning: cast to restricted __le16 drivers/iio/humidity/hts221_core.c:314:18: warning: cast to restricted __le16 drivers/iio/humidity/hts221_core.c:320:18: warning: cast to restricted __le16 drivers/iio/humidity/hts221_core.c:355:18: warning: cast to restricted __le16 drivers/iio/humidity/hts221_core.c:361:18: warning: cast to restricted __le16 Fixes: e4a70e3e7d84 ("iio: humidity: add support to hts221 rh/temp combo device") Signed-off-by: Lorenzo Bianconi --- drivers/iio/humidity/hts221_core.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c index d3f7904766bd..b662afb2b35c 100644 --- a/drivers/iio/humidity/hts221_core.c +++ b/drivers/iio/humidity/hts221_core.c @@ -289,6 +289,7 @@ static int hts221_parse_temp_caldata(struct hts221_hw *hw) int err, *slope, *b_gen; s16 cal_x0, cal_x1, cal_y0, cal_y1; u8 cal0, cal1; + __le16 val; err = hw->tf->read(hw->dev, HTS221_REG_0T_CAL_Y_H, sizeof(cal0), &cal0); @@ -299,7 +300,7 @@ static int hts221_parse_temp_caldata(struct hts221_hw *hw) sizeof(cal1), &cal1); if (err < 0) return err; - cal_y0 = (le16_to_cpu(cal1 & 0x3) << 8) | cal0; + cal_y0 = ((cal1 & 0x3) << 8) | cal0; err = hw->tf->read(hw->dev, HTS221_REG_1T_CAL_Y_H, sizeof(cal0), &cal0); @@ -307,17 +308,17 @@ static int hts221_parse_temp_caldata(struct hts221_hw *hw) return err; cal_y1 = (((cal1 & 0xc) >> 2) << 8) | cal0; - err = hw->tf->read(hw->dev, HTS221_REG_0T_CAL_X_L, sizeof(cal_x0), - (u8 *)&cal_x0); + err = hw->tf->read(hw->dev, HTS221_REG_0T_CAL_X_L, sizeof(val), + (u8 *)&val); if (err < 0) return err; - cal_x0 = le16_to_cpu(cal_x0); + cal_x0 = le16_to_cpu(val); - err = hw->tf->read(hw->dev, HTS221_REG_1T_CAL_X_L, sizeof(cal_x1), - (u8 *)&cal_x1); + err = hw->tf->read(hw->dev, HTS221_REG_1T_CAL_X_L, sizeof(val), + (u8 *)&val); if (err < 0) return err; - cal_x1 = le16_to_cpu(cal_x1); + cal_x1 = le16_to_cpu(val); slope = &hw->sensors[HTS221_SENSOR_T].slope; b_gen = &hw->sensors[HTS221_SENSOR_T].b_gen; @@ -334,6 +335,7 @@ static int hts221_parse_rh_caldata(struct hts221_hw *hw) { int err, *slope, *b_gen; s16 cal_x0, cal_x1, cal_y0, cal_y1; + __le16 val; u8 data; err = hw->tf->read(hw->dev, HTS221_REG_0RH_CAL_Y_H, sizeof(data), @@ -348,17 +350,17 @@ static int hts221_parse_rh_caldata(struct hts221_hw *hw) return err; cal_y1 = data; - err = hw->tf->read(hw->dev, HTS221_REG_0RH_CAL_X_H, sizeof(cal_x0), - (u8 *)&cal_x0); + err = hw->tf->read(hw->dev, HTS221_REG_0RH_CAL_X_H, sizeof(val), + (u8 *)&val); if (err < 0) return err; - cal_x0 = le16_to_cpu(cal_x0); + cal_x0 = le16_to_cpu(val); - err = hw->tf->read(hw->dev, HTS221_REG_1RH_CAL_X_H, sizeof(cal_x1), - (u8 *)&cal_x1); + err = hw->tf->read(hw->dev, HTS221_REG_1RH_CAL_X_H, sizeof(val), + (u8 *)&val); if (err < 0) return err; - cal_x1 = le16_to_cpu(cal_x1); + cal_x1 = le16_to_cpu(val); slope = &hw->sensors[HTS221_SENSOR_H].slope; b_gen = &hw->sensors[HTS221_SENSOR_H].b_gen;