From patchwork Sun Oct 13 09:30:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 176069 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp3126552ill; Sun, 13 Oct 2019 02:32:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqxwbp+xKqXyAsuCQA+XFH4MUarao+OdXIGeH+mZEl7vGxwPJ/wD2HTLgNK5xTg5eUB2yPUv X-Received: by 2002:a50:eb95:: with SMTP id y21mr23009646edr.155.1570959153064; Sun, 13 Oct 2019 02:32:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570959153; cv=none; d=google.com; s=arc-20160816; b=0k7Mw29CwyyUQQzzrte3otAQfW/b3L8mZgaha996ArOXOJU3ohTGJwdYUYDSbHXjYp YouXVQI2U0IWgbqdWvQf1ROiHv3G7cuXxPcl+dxFCOjH538ifzkaS4+Bq70PpHIIrpPv Iue+FC24YwelvWQGWEKSWaCogdEg8XqqLvhbrxMxCmIJY63Fl7NY1C0DGj3OtSj4nq18 YPa/+wkXjBaBXh42GHGmXYGmannEVIKdXY5TNLh0aS38u9nr5ZDOSadJupRfr75jZ0Ui oFEfcQLkOkBOrzntXiok1wTbWq1bLheaEzQ0pgCz0byO2yzzH5Fx+kX4aZAnLOlf17jV byXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=S7qSG3wETirGyqbCmQuuE/+F2EA2fYVP48UBi18VQww=; b=HIcQnnb5oUuUdYE5bXHxQJSG+HXKX9gG+jSfd8OrdvcunFIwX+OuTwOjMuHwR6lNse OdCmYiEB96fM/AvST2ikY8hhpeuJuMJV51kNlHuFwxHppgz4rJNCiB6NBXcjf8GJJdep ACIC3wNRcVQNV5cVlqA6lU/v16NVRvBLSzuyQqR68a8Zbg8/kOHnKzyW+nNcmLGi6z8w NB/rck2IzAoBri/Mrehh4+tg+z5D5Yhd63J78HnMszK1L/UhxJYdoinbg7ojVIm8q2zV pYb0oCy0J94OlfBO59cStoCJLBoQceIql74w6BpOXXdkPee7wY/wRtOPzTs1GRmVbLxi 3MPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YkQEcJsB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n26si8454221eja.273.2019.10.13.02.32.32; Sun, 13 Oct 2019 02:32:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YkQEcJsB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1728762AbfJMJcY (ORCPT + 21 others); Sun, 13 Oct 2019 05:32:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:46644 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728080AbfJMJcY (ORCPT ); Sun, 13 Oct 2019 05:32:24 -0400 Received: from localhost.localdomain (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 69EB420679; Sun, 13 Oct 2019 09:32:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570959143; bh=vv0x3V4u3Fs9k+8MDwLKn2jmOM3f5l4VL12Gif3ewN8=; h=From:To:Cc:Subject:Date:From; b=YkQEcJsBAKIdXzqvLn7D8KCQEBYA+mbKYNfTYeOfQiTBw/o7DhjFp+biKWQq0pgwz Fu/hIww+rwhTCz4GwpHm4MtsmXL5AH8Ids5l5cwFnH9ewlMlYeqhupD2Lahq0W/p0M D60f4d1OECvI4mV7vlMCAnbgEY/12Se1ZKJUEOoo= From: jic23@kernel.org To: linux-iio@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Jonathan Cameron , Lee Jones Subject: [PATCH] mfd: twl: endian fixups in i2c write and read wrappers. Date: Sun, 13 Oct 2019 10:30:15 +0100 Message-Id: <20191013093015.1395332-1-jic23@kernel.org> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Cameron Use a local variable to ensure correct endian types for intermediate results. Identified by sparse when building the IIO driver. Signed-off-by: Jonathan Cameron Cc: Lee Jones --- include/linux/mfd/twl.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) -- 2.23.0 diff --git a/include/linux/mfd/twl.h b/include/linux/mfd/twl.h index 44aff52a5002..089e8942223a 100644 --- a/include/linux/mfd/twl.h +++ b/include/linux/mfd/twl.h @@ -181,14 +181,18 @@ static inline int twl_i2c_read_u8(u8 mod_no, u8 *val, u8 reg) { } static inline int twl_i2c_write_u16(u8 mod_no, u16 val, u8 reg) { - val = cpu_to_le16(val); - return twl_i2c_write(mod_no, (u8*) &val, reg, 2); + __le16 value; + + value = cpu_to_le16(val); + return twl_i2c_write(mod_no, (u8 *) &value, reg, 2); } static inline int twl_i2c_read_u16(u8 mod_no, u16 *val, u8 reg) { int ret; - ret = twl_i2c_read(mod_no, (u8*) val, reg, 2); - *val = le16_to_cpu(*val); + __le16 value; + + ret = twl_i2c_read(mod_no, (u8 *) &value, reg, 2); + *val = le16_to_cpu(value); return ret; }