From patchwork Wed Sep 2 22:46:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 7113741 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: X-Original-To: patchwork-linux-arm-msm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F20219F372 for ; Wed, 2 Sep 2015 22:47:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 240BC205FE for ; Wed, 2 Sep 2015 22:47:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2AF4D20602 for ; Wed, 2 Sep 2015 22:47:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754388AbbIBWrt (ORCPT ); Wed, 2 Sep 2015 18:47:49 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:45136 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753598AbbIBWqz (ORCPT ); Wed, 2 Sep 2015 18:46:55 -0400 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 2945F140C01; Wed, 2 Sep 2015 22:46:55 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 486) id 1789E140C02; Wed, 2 Sep 2015 22:46:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from sboyd-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: sboyd@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 5CAF1140C00; Wed, 2 Sep 2015 22:46:54 +0000 (UTC) From: Stephen Boyd To: Mark Brown Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Bjorn Andersson , Andy Gross Subject: [PATCH v2 8/8] regulator: qcom_smd: Handle big endian CPUs Date: Wed, 2 Sep 2015 15:46:51 -0700 Message-Id: <1441234011-4259-9-git-send-email-sboyd@codeaurora.org> X-Mailer: git-send-email 2.3.0.rc1.33.g42e4583 In-Reply-To: <1441234011-4259-1-git-send-email-sboyd@codeaurora.org> References: <1441234011-4259-1-git-send-email-sboyd@codeaurora.org> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The smd rpm structures are always in little endian, but this driver is not capable of being used on big endian CPUs. Annotate the little endian data members and update the code to do the proper byte swapping. Cc: Bjorn Andersson Cc: Andy Gross Signed-off-by: Stephen Boyd Reviewed-by: Bjorn Andersson --- Changes from v1: * New patch drivers/regulator/qcom_smd-regulator.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/regulator/qcom_smd-regulator.c b/drivers/regulator/qcom_smd-regulator.c index 9c6167dd2c8b..b72c693e29ff 100644 --- a/drivers/regulator/qcom_smd-regulator.c +++ b/drivers/regulator/qcom_smd-regulator.c @@ -36,9 +36,9 @@ struct qcom_rpm_reg { }; struct rpm_regulator_req { - u32 key; - u32 nbytes; - u32 value; + __le32 key; + __le32 nbytes; + __le32 value; }; #define RPM_KEY_SWEN 0x6e657773 /* "swen" */ @@ -62,9 +62,9 @@ static int rpm_reg_enable(struct regulator_dev *rdev) struct rpm_regulator_req req; int ret; - req.key = RPM_KEY_SWEN; - req.nbytes = sizeof(u32); - req.value = 1; + req.key = cpu_to_le32(RPM_KEY_SWEN); + req.nbytes = cpu_to_le32(sizeof(u32)); + req.value = cpu_to_le32(1); ret = rpm_reg_write_active(vreg, &req, sizeof(req)); if (!ret) @@ -86,8 +86,8 @@ static int rpm_reg_disable(struct regulator_dev *rdev) struct rpm_regulator_req req; int ret; - req.key = RPM_KEY_SWEN; - req.nbytes = sizeof(u32); + req.key = cpu_to_le32(RPM_KEY_SWEN); + req.nbytes = cpu_to_le32(sizeof(u32)); req.value = 0; ret = rpm_reg_write_active(vreg, &req, sizeof(req)); @@ -113,9 +113,9 @@ static int rpm_reg_set_voltage(struct regulator_dev *rdev, struct rpm_regulator_req req; int ret = 0; - req.key = RPM_KEY_UV; - req.nbytes = sizeof(u32); - req.value = min_uV; + req.key = cpu_to_le32(RPM_KEY_UV); + req.nbytes = cpu_to_le32(sizeof(u32)); + req.value = cpu_to_le32(min_uV); ret = rpm_reg_write_active(vreg, &req, sizeof(req)); if (!ret) @@ -129,9 +129,9 @@ static int rpm_reg_set_load(struct regulator_dev *rdev, int load_uA) struct qcom_rpm_reg *vreg = rdev_get_drvdata(rdev); struct rpm_regulator_req req; - req.key = RPM_KEY_MA; - req.nbytes = sizeof(u32); - req.value = load_uA; + req.key = cpu_to_le32(RPM_KEY_MA); + req.nbytes = cpu_to_le32(sizeof(u32)); + req.value = cpu_to_le32(load_uA); return rpm_reg_write_active(vreg, &req, sizeof(req)); }