Received: by 10.223.185.116 with SMTP id b49csp1172275wrg; Wed, 14 Feb 2018 12:47:43 -0800 (PST) X-Google-Smtp-Source: AH8x227bVLeMpSXPu06+x5WTYrqbD/HLTHoyx/rsH3q61Q+60otrUa6Fv2i+X6rjXkbxSXGZ8BDi X-Received: by 10.99.150.2 with SMTP id c2mr241188pge.424.1518641263463; Wed, 14 Feb 2018 12:47:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518641263; cv=none; d=google.com; s=arc-20160816; b=N6WcyBGm+QL8ox6hbWVQ8vh7aJIM5P3kO4AwbbLiWmPEZQriTzK6Hg/YasdDBqKA7/ AzJPYqyhX/ootfhBgnwitO3b29twUKSwDMnLkixIn4dPcEZz7kU0vN1LPhlvFB05mpua KG+t6UEdlZZkuLc0OxVpPqpXj53h9PK3INBUfnZlkyYINJFBpprf/C1jANwvstqLBscy ULBYK1WXaC3ub+Y6dkv6OxKaPI04vPbaOeUSSaato8sp4ba1/+YSxbErHpBgmjVDgT5c 4TqEV14sKyoiADa2t0fEzfDWqzR9dbVpxxVxXAenP90TdQM/re/lGkv9fMbSNKNAV5ys kshw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=qyJeAlhvcdHDhxaG7XFH5RfuB0V5dYFtpl/owX8fQJA=; b=qFzVQE98lql+mXjYh4JWT1hKGoUYK127/AdwPh7pr6U/Cum43UGylJNR4D1y3ZUC3M sGICUhm+OiyrV3bJD8V4C47L8dVqEOfYHcIjiezhzN3HBhsLnEwoIc3XWDpuDsfHlBUx eT0LrxBgKRx0E3AB6Ig0dJeNeGlul+fP8u0KgW/Gp0cO0RDzbVLSLBayMTW3q+7iG45M yAlunx/EcfPQmBLXhxKc8d2iq8M+XwIptdUl6txLtGisXcvVZri7nK1oIjq3xKnejrre S8fxA6QsgxIN03HlUHKPPjT/hDJ25t1e5Q1i9gFZ7GUuoy1fjrR+N5H0ApPtQIIrqjbI QJ3w== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i7-v6si1957622plt.572.2018.02.14.12.47.29; Wed, 14 Feb 2018 12:47:43 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030888AbeBNUqo (ORCPT + 99 others); Wed, 14 Feb 2018 15:46:44 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35374 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1030206AbeBNUql (ORCPT ); Wed, 14 Feb 2018 15:46:41 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C86C07D85D; Wed, 14 Feb 2018 20:46:40 +0000 (UTC) Received: from redhat.com (ovpn-121-104.rdu2.redhat.com [10.10.121.104]) by smtp.corp.redhat.com (Postfix) with ESMTP id 19D5A2166BAE; Wed, 14 Feb 2018 20:46:40 +0000 (UTC) Date: Wed, 14 Feb 2018 22:46:39 +0200 From: "Michael S. Tsirkin" To: =?iso-8859-1?Q?Marc-Andr=E9?= Lureau Cc: linux-kernel@vger.kernel.org, bhe@redhat.com, slp@redhat.com, somlo@cmu.edu, xiaolong.ye@intel.com Subject: Re: [PATCH v14 3/9] fw_cfg: fix sparse warnings in fw_cfg_sel_endianness() Message-ID: <20180214224149-mutt-send-email-mst@kernel.org> References: <20180214141850.4017-1-marcandre.lureau@redhat.com> <20180214141850.4017-4-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180214141850.4017-4-marcandre.lureau@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 14 Feb 2018 20:46:40 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 14 Feb 2018 20:46:40 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mst@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 14, 2018 at 03:18:44PM +0100, Marc-Andr? Lureau wrote: > The function is used for both LE & BE target type, use __force casting. > > Fixes: > $ make C=1 CF=-D__CHECK_ENDIAN__ drivers/firmware/qemu_fw_cfg.o > > drivers/firmware/qemu_fw_cfg.c:55:33: warning: restricted __be16 degrades to integer > drivers/firmware/qemu_fw_cfg.c:55:52: warning: restricted __le16 degrades to integer > > Signed-off-by: Marc-Andr? Lureau > --- > drivers/firmware/qemu_fw_cfg.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/firmware/qemu_fw_cfg.c b/drivers/firmware/qemu_fw_cfg.c > index 90f467232777..85e693287d87 100644 > --- a/drivers/firmware/qemu_fw_cfg.c > +++ b/drivers/firmware/qemu_fw_cfg.c > @@ -52,7 +52,9 @@ static DEFINE_MUTEX(fw_cfg_dev_lock); > /* pick appropriate endianness for selector key */ > static inline u16 fw_cfg_sel_endianness(u16 key) > { > - return fw_cfg_is_mmio ? cpu_to_be16(key) : cpu_to_le16(key); > + return fw_cfg_is_mmio ? > + (u16 __force)cpu_to_be16(key) : > + (u16 __force)cpu_to_le16(key); > } > > /* read chunk of given fw_cfg blob (caller responsible for sanity-check) */ Well the caller does cpu_to_le16 on the result ... All this makes my head spin. IMHO what you want is a wrapper that does iowrite and iowritebe rather than __force. > -- > 2.16.1.73.g5832b7e9f2