Received: by 10.223.176.46 with SMTP id f43csp419010wra; Tue, 23 Jan 2018 23:49:56 -0800 (PST) X-Google-Smtp-Source: AH8x226TrFj9hP+AAvGa5E5nY77xiSmIWapI49S1QsWZjkU/C3P4D5uWRs5fOh6llZNATeiF8jyB X-Received: by 10.99.140.18 with SMTP id m18mr10267558pgd.59.1516780196446; Tue, 23 Jan 2018 23:49:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516780196; cv=none; d=google.com; s=arc-20160816; b=T0ZbcEdcOCXzsKEWEv6zjFeTEHjMGxyDHSV6HsAetJN6y9HgwF32ClpcJwUyV88PRS E9PeYFcNcJGz6tPmqEyiJB2CCTC1dsXBW4wbEYWqygYyUxH6/FLeW1RNB6Rr6XdIbfaG y+wNLi3AP49JtH9EjAf8VwxfhSslXR4RVQfxcY58aB6T/+VTatWakIETI7tX1bMX9mV9 eXXOA4zpgdW74oW5oAalGmV6mICCb5hDqhI8PlKLEFN12Qk7Rz+Vfu/RNBl047eCIMuy rtOga7io7mFMh8SceXI7D6avWMMmN4cAPdOVH35LbmZUyGWhY5q0t5i/6ALdv27+hW6b ysPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=MUxFTWlBkGMZZquslO6M1rcjb8IpHMIVaTjJCELqv6o=; b=vyS26uX7zyiznvl4IMU68LmyTH+Vo9ky3GjdJZONQLAHm5DJNdwktbOqiYgyKD2URH zManbbOlEyWgjPBXsdoRK6ce4OGWDR402HA9ZVG+cmwSWnCMwdDXt2GW0H/qdyL2GTMx 0Z/CkbxfsjCecVOLF/6OwVmC+BoVfU81F3oigB9rpX/F49Ywff0CZKTM7c/i9x0DZzoJ qzMPsee8cT7LvzPqDgEsGo9EqquN6JIA+12bfARRAzbihVlYWKGpE9gMKFAxRG8vf9pv w0xLWu+dmp9/r08dq+D8klkYdaU3wNzMNQfq1re/ZhjvEswkcPK7LclNmCk1tylRnoSY uL9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Hi98xsqX; 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=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u185si2621188pgd.397.2018.01.23.23.49.42; Tue, 23 Jan 2018 23:49:56 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=Hi98xsqX; 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=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932244AbeAXHtJ (ORCPT + 99 others); Wed, 24 Jan 2018 02:49:09 -0500 Received: from mail-lf0-f66.google.com ([209.85.215.66]:41108 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752602AbeAXHtH (ORCPT ); Wed, 24 Jan 2018 02:49:07 -0500 Received: by mail-lf0-f66.google.com with SMTP id f136so3927293lff.8 for ; Tue, 23 Jan 2018 23:49:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MUxFTWlBkGMZZquslO6M1rcjb8IpHMIVaTjJCELqv6o=; b=Hi98xsqXYGfFNclf7o+wxmHZPxgSQYNNPlLtaC/lY1x9VQx/O+F8kcMXKw3fgHCumH xFp1E0ChDuvvjAPr4I055w2AYS5nzySVwlD8wYYkiRKNWX0HJmvxgqbI9szbHzYOeoOt QC5FzcvmCRtXzLQ7G/Cj/rHiXhJkQaZoz2eik1AmHAMP2P+um25hcPfVzlCuCZBKcf6K YpDR4wSgMNcPrUQTRL8PWyy4s2zpzxDTHLYbIJwGyueClFe1sONWxD1WaijJdGphjpop oX/C29m8gDH/1U1c9/u89ds9fi0qJr0uVI9aSawieuTPcerj8NmRlYNyftAYnbBNzG7V Ztcw== 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:in-reply-to :references; bh=MUxFTWlBkGMZZquslO6M1rcjb8IpHMIVaTjJCELqv6o=; b=jQZ7KmrVognOappOVfmY36I50k50xKUFARjbREJ2/hawc5b5NjrOK02HWYs/ji7JV/ vbM0wV3xJ+TWbrZFDrHpYKnN6nO5EWxul/wcas/T7J2OE7Wz3JQUa7r6vspZVPZu3Uaj E+EBMIMwlmvBZNHYRwkAhVgrPcsozS5tUEKtp1mxtQAsax37CX7rD1VkMrs3f7vT16ci 22kCgm9WsKIajdi6S3cS6B0y6vD0+WYuCbHkpTgshwdopQk+kNbKScwl+50yjDncJWl5 YsTrldb7LTRpsC7NNmkEsPuUNj+llREEVolcm/Cdfzx0CCul01a8bcGCn14rzGm90RSj Ip5A== X-Gm-Message-State: AKwxytcx5lKhPeAbvxz7/c4GMsL6fJxnvCfRrfki2o9mzsrsPMMIf9Dp ZXL3aAMmJDcJtnzmWQjdl+4= X-Received: by 10.46.82.150 with SMTP id n22mr2841134lje.145.1516780145720; Tue, 23 Jan 2018 23:49:05 -0800 (PST) Received: from linux.local ([95.79.164.146]) by smtp.gmail.com with ESMTPSA id u192sm2772989lja.52.2018.01.23.23.49.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Jan 2018 23:49:04 -0800 (PST) From: Serge Semin To: jdmason@kudzu.us, dave.jiang@intel.com, allenbh@gmail.com, arnd@arndb.de Cc: gary.hook@amd.com, Sergey.Semin@t-platforms.ru, linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org, Serge Semin Subject: [PATCH v2] NTB: ntb_perf: fix cast to restricted __le32 Date: Wed, 24 Jan 2018 10:48:45 +0300 Message-Id: <20180124074845.32125-1-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20180119173044.8013-1-fancer.lancer@gmail.com> References: <20180119173044.8013-1-fancer.lancer@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sparse is whining about the u32 and __le32 mixed usage in the driver drivers/ntb/test/ntb_perf.c:288:21: warning: cast to restricted __le32 drivers/ntb/test/ntb_perf.c:295:37: warning: incorrect type in argument 4 (different base types) drivers/ntb/test/ntb_perf.c:295:37: expected unsigned int [unsigned] [usertype] val drivers/ntb/test/ntb_perf.c:295:37: got restricted __le32 [usertype] ... NTB hardware drivers shall accept CPU-endian data and translate it to the portable formate by internal means, so the explicit conversions are not necessary before Scratchpad/Messages API usage anymore. Fixes: b83003b3fdc1 ("NTB: ntb_perf: Add full multi-port NTB API support") Signed-off-by: Serge Semin --- drivers/ntb/test/ntb_perf.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/ntb/test/ntb_perf.c b/drivers/ntb/test/ntb_perf.c index 1829a17dd461..3fded6aeda08 100644 --- a/drivers/ntb/test/ntb_perf.c +++ b/drivers/ntb/test/ntb_perf.c @@ -273,21 +273,21 @@ static int perf_spad_cmd_send(struct perf_peer *peer, enum perf_cmd cmd, sts = ntb_peer_spad_read(perf->ntb, peer->pidx, PERF_SPAD_CMD(perf->gidx)); - if (le32_to_cpu(sts) != PERF_CMD_INVAL) { + if (sts != PERF_CMD_INVAL) { usleep_range(MSG_UDELAY_LOW, MSG_UDELAY_HIGH); continue; } ntb_peer_spad_write(perf->ntb, peer->pidx, PERF_SPAD_LDATA(perf->gidx), - cpu_to_le32(lower_32_bits(data))); + lower_32_bits(data)); ntb_peer_spad_write(perf->ntb, peer->pidx, PERF_SPAD_HDATA(perf->gidx), - cpu_to_le32(upper_32_bits(data))); + upper_32_bits(data)); mmiowb(); ntb_peer_spad_write(perf->ntb, peer->pidx, PERF_SPAD_CMD(perf->gidx), - cpu_to_le32(cmd)); + cmd); mmiowb(); ntb_peer_db_set(perf->ntb, PERF_SPAD_NOTIFY(peer->gidx)); @@ -321,21 +321,20 @@ static int perf_spad_cmd_recv(struct perf_ctx *perf, int *pidx, continue; val = ntb_spad_read(perf->ntb, PERF_SPAD_CMD(peer->gidx)); - val = le32_to_cpu(val); if (val == PERF_CMD_INVAL) continue; *cmd = val; val = ntb_spad_read(perf->ntb, PERF_SPAD_LDATA(peer->gidx)); - *data = le32_to_cpu(val); + *data = val; val = ntb_spad_read(perf->ntb, PERF_SPAD_HDATA(peer->gidx)); - *data |= (u64)le32_to_cpu(val) << 32; + *data |= (u64)val << 32; /* Next command can be retrieved from now */ ntb_spad_write(perf->ntb, PERF_SPAD_CMD(peer->gidx), - cpu_to_le32(PERF_CMD_INVAL)); + PERF_CMD_INVAL); dev_dbg(&perf->ntb->dev, "CMD recv: %d 0x%llx\n", *cmd, *data); @@ -371,7 +370,7 @@ static int perf_msg_cmd_send(struct perf_peer *peer, enum perf_cmd cmd, return ret; ntb_peer_msg_write(perf->ntb, peer->pidx, PERF_MSG_LDATA, - cpu_to_le32(lower_32_bits(data))); + lower_32_bits(data)); if (ntb_msg_read_sts(perf->ntb) & outbits) { usleep_range(MSG_UDELAY_LOW, MSG_UDELAY_HIGH); @@ -379,12 +378,11 @@ static int perf_msg_cmd_send(struct perf_peer *peer, enum perf_cmd cmd, } ntb_peer_msg_write(perf->ntb, peer->pidx, PERF_MSG_HDATA, - cpu_to_le32(upper_32_bits(data))); + upper_32_bits(data)); mmiowb(); /* This call shall trigger peer message event */ - ntb_peer_msg_write(perf->ntb, peer->pidx, PERF_MSG_CMD, - cpu_to_le32(cmd)); + ntb_peer_msg_write(perf->ntb, peer->pidx, PERF_MSG_CMD, cmd); break; } @@ -404,13 +402,13 @@ static int perf_msg_cmd_recv(struct perf_ctx *perf, int *pidx, return -ENODATA; val = ntb_msg_read(perf->ntb, pidx, PERF_MSG_CMD); - *cmd = le32_to_cpu(val); + *cmd = val; val = ntb_msg_read(perf->ntb, pidx, PERF_MSG_LDATA); - *data = le32_to_cpu(val); + *data = val; val = ntb_msg_read(perf->ntb, pidx, PERF_MSG_HDATA); - *data |= (u64)le32_to_cpu(val) << 32; + *data |= (u64)val << 32; /* Next command can be retrieved from now */ ntb_msg_clear_sts(perf->ntb, inbits); -- 2.12.0