From patchwork Tue Jul 22 14:23:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dolev Raviv X-Patchwork-Id: 4603181 Return-Path: X-Original-To: patchwork-linux-arm-msm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8BB08C0515 for ; Tue, 22 Jul 2014 14:24:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C81DD200FE for ; Tue, 22 Jul 2014 14:24:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D3501200E5 for ; Tue, 22 Jul 2014 14:24:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753845AbaGVOYQ (ORCPT ); Tue, 22 Jul 2014 10:24:16 -0400 Received: from smtp.codeaurora.org ([198.145.11.231]:39198 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751695AbaGVOYQ (ORCPT ); Tue, 22 Jul 2014 10:24:16 -0400 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id B352F13FFA3; Tue, 22 Jul 2014 14:24:15 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 486) id 963C913FFA4; Tue, 22 Jul 2014 14:24:15 +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, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lx-draviv2.mea.qualcomm.com (unknown [185.23.60.4]) (using TLSv1.1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: draviv@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 4377013FF9F; Tue, 22 Jul 2014 14:24:13 +0000 (UTC) From: Dolev Raviv To: James.Bottomley@HansenPartnership.com Cc: linux-scsi@vger.kernel.org, linux-scsi-owner@vger.kernel.org, sthumma@codeaurora.org, linux-arm-msm@vger.kernel.org, santoshsy@gmail.com, Dolev Raviv Subject: [PATCH V2 2/5] scsi: ufs: fix endianness sparse warnings Date: Tue, 22 Jul 2014 17:23:47 +0300 Message-Id: <1406039030-14246-3-git-send-email-draviv@codeaurora.org> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1406039030-14246-1-git-send-email-draviv@codeaurora.org> References: <1406039030-14246-1-git-send-email-draviv@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 From: Sujit Reddy Thumma Fix many warnings with incorrect endian assumptions which makes the code unportable to new architectures. The UFS specification defines the byte order as big-endian for UPIU structure and little-endian for the host controller transfer/task management descriptors. Signed-off-by: Sujit Reddy Thumma Signed-off-by: Dolev Raviv --- drivers/scsi/ufs/ufshcd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 694c8cc..514f65a 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -1325,7 +1325,7 @@ static int ufshcd_query_descriptor(struct ufs_hba *hba, ufshcd_init_query(hba, &request, &response, opcode, idn, index, selector); hba->dev_cmd.query.descriptor = desc_buf; - request->upiu_req.length = *buf_len; + request->upiu_req.length = cpu_to_be16(*buf_len); switch (opcode) { case UPIU_QUERY_OPCODE_WRITE_DESC: @@ -1351,7 +1351,7 @@ static int ufshcd_query_descriptor(struct ufs_hba *hba, } hba->dev_cmd.query.descriptor = NULL; - *buf_len = response->upiu_res.length; + *buf_len = be16_to_cpu(response->upiu_res.length); out_unlock: mutex_unlock(&hba->dev_cmd.lock);