Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4451886yba; Mon, 29 Apr 2019 21:21:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqyHsz1mU3C2+pH9QW+g6dv31s+QQeIu7ltDP4sn4y/f8fxXMUI7QAU8UHSQmuSzGNTZ0Y8e X-Received: by 2002:a65:6644:: with SMTP id z4mr31269617pgv.300.1556598091056; Mon, 29 Apr 2019 21:21:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556598091; cv=none; d=google.com; s=arc-20160816; b=ch/z3rgdMU7s5iXhzuhIS+tnMFuBEQBZjZ/t9bbcOSIsSNoDfXBHhp8Vvjx98swa10 DmwmgduxIdP9FUyo4N1Rrd8j6Qhht8YuaIECXAGIV+ZUoEGt0eias95CUStr51eR0eD3 R+qBn9UpigbmwwCfBFKzAvUkrCWainPjRQD0FS+aV9bXE47hhBIuyx3B56KRw+ar/cR2 WKC5MEgPkRRMtcLY3gGnxS9ZWYl2cszJ4otVEQgyPyQ8SZgFh1O8oXMSg0ZrCSf57VZg avgghioNDQXu+wBDR3bXuZEi6P/OnkEKopcXJCKMTrDSlvk7WBuXHO/w43WFvxTXoQkg +mJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=jQYSVv/Ym9vy1sD++uKSgaC5MhmnZC64U0qPd+Y8hNQ=; b=iENFv+Zc+UZkfMZcbvlebosgumOP39p2fEvX5d0kxp7eimSXI8fIiViKMlgwCAJPSC CAxZPhJPozrRHAVdepKzr2rQzbGXIlq3X1kPev8Yo54lh5Ruawf2UikST2H5VjGL5QmP SNhdSc8Sqx4voYjDHxwdAAfXpy+qCJMrQLWzItttAvPkbWpVgG696xAcN2F7fJu/oLiz nUZ8GxVFcominNd2SUc4Ngemvr84POwL1hm4iq6hfQ/RHafObk5RY1d+PPz6CE1znb26 q/U4gggyub4FSWdG2fFVPQKr/xWF947++qQjmbIr7NHR8qojt5dzavRZqWiXnoh/71ox tf8g== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l5si17038329pgj.560.2019.04.29.21.21.02; Mon, 29 Apr 2019 21:21:31 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726081AbfD3ETl (ORCPT + 99 others); Tue, 30 Apr 2019 00:19:41 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:38462 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725838AbfD3ETl (ORCPT ); Tue, 30 Apr 2019 00:19:41 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92 #3 (Red Hat Linux)) id 1hLKEw-0007Ls-Ie; Tue, 30 Apr 2019 04:19:34 +0000 Date: Tue, 30 Apr 2019 05:19:34 +0100 From: Al Viro To: Nicholas Mc Guire Cc: Sven Van Asbroeck , Nicholas Mc Guire , Greg Kroah-Hartman , devel@driverdev.osuosl.org, Linux Kernel Mailing List Subject: Re: [PATCH V2] staging: fieldbus: anybus-s: force endiannes annotation Message-ID: <20190430041934.GI23075@ZenIV.linux.org.uk> References: <1556517940-13725-1-git-send-email-hofrat@osadl.org> <20190430022238.GA22593@osadl.at> <20190430030223.GE23075@ZenIV.linux.org.uk> <20190430033310.GB23144@osadl.at> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190430033310.GB23144@osadl.at> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 30, 2019 at 05:33:10AM +0200, Nicholas Mc Guire wrote: > ok - my bad thn - I had assumed that using __force is reasonable > if the handling is correct and its a localized conversoin only > like var = be16_to_cpu(var) which evaded introducing additinal > variables just to have different types but no different function. If compiler can't recognize that in T1 v1; T2 v2; code using v1, but not v2 v2 = f(v1); code using v2, but not v1 it can use the same memory for v1 and v2, file a bug against the compiler. Or stop using that toy altogether - that kind of optimizations is early 60s stuff and any real compiler will handle that. Both gcc and clang certainly do handle that. Another thing they handle is figuring out that be16_to_cpu() et.al. are pure functions, so f(be16_to_cpu(n)); no modifications of n g(be16_to_cpu(n)); doesn't need to have le16_to_cpu recalculated. IOW, that particular code could as well have been dev_info(dev, "Fieldbus type: %04X", be16_to_cpu(fieldbus_type)); ... cd->client->fieldbus_type = be16_to_cpu(fieldbus_type); ... not that there's much sense keeping ->fieldbus_type in host-endian, while we are at it.