Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1124291pxb; Thu, 7 Oct 2021 01:00:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1zrcn7HPvCBX1G/fi1E5M7fa/Q5DYcUqVAxhAgXlDmm60FB1MxjxF/XOgj3+M+JWLCIhO X-Received: by 2002:a17:906:2816:: with SMTP id r22mr222570ejc.158.1633593604014; Thu, 07 Oct 2021 01:00:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633593604; cv=none; d=google.com; s=arc-20160816; b=pg40AL+0jq34HuLCafzZeXopEWW0m7ItmNT8AiMaT7bowqN3mhd4aGALfoXl+nwIM7 A2FpYer1agdZsqeUc2foCV0+JoEPplqmOZpbSlo12qhlHvGyjk4eRB+p2+d+rLQ8jIlz 8+fK6M2CEePlDik7ejZtjmM/xRQEDpYgMyDL/FbByfgHtRcwgwrnd8auydiXFubBfVwR +SCDATYVH2e83FKW4oZfyqvetQl0wahcAZHWwDYU+Z45nNz7P/F26zg7vccwc5Q8FhMr S7gJvIGQQJorTUC2rPzTl/cCFlyN+9N134emnqUhoO/wY2SHFvV0Jd1U9gLSBdW7qvN5 1VYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=LjakGGwyXq32FQAF6TV3MqlRFuKJSVQcdRvptqBzE7U=; b=JNobEfm8xds8luikgljI0DZb8hi0pOg+xXfFkSzC4JkuO70JLeRv+zP3aaeTr4AZjd K1B42CW9Chq7uZJ/GuiQ9/1mEOzIhtqHdN2gx/2xrz+sVX6FN4YossKr3aAxqXOPa7Md AKQBEwRDG2x+u21K0Drd1SrbiiERlzkWJLQT93Y5v1Y8Fv8RDK582FcSda7VjTOJXZFH lkmC/wKxyVW6G+sF4FmFmbh4Zf0v/AMQhPpPjkH7yAZGu1hXYMg7fk0PR2z9oQi0/fJ5 Zpd5pVAD/ql49VNOr0NuuZUCDcazCVUtQH5wunL2yxejDM002bk3v2lzcMggYyTiWuH3 yCBA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c22si19837847edn.592.2021.10.07.00.59.40; Thu, 07 Oct 2021 01:00:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232550AbhJGHzE convert rfc822-to-8bit (ORCPT + 99 others); Thu, 7 Oct 2021 03:55:04 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.85.151]:20360 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232584AbhJGHzB (ORCPT ); Thu, 7 Oct 2021 03:55:01 -0400 Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-38-fz1CuUWYNx6QMVBcOLTHFg-1; Thu, 07 Oct 2021 08:53:02 +0100 X-MC-Unique: fz1CuUWYNx6QMVBcOLTHFg-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) by AcuMS.aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Thu, 7 Oct 2021 08:53:01 +0100 Received: from AcuMS.Aculab.com ([fe80::994c:f5c2:35d6:9b65]) by AcuMS.aculab.com ([fe80::994c:f5c2:35d6:9b65%12]) with mapi id 15.00.1497.023; Thu, 7 Oct 2021 08:53:01 +0100 From: David Laight To: 'Segher Boessenkool' , Stafford Horne CC: Rich Felker , "Rafael J. Wysocki" , Catalin Marinas , "x86@kernel.org" , Guo Ren , "H. Peter Anvin" , "linux-riscv@lists.infradead.org" , "Will Deacon" , Jonas Bonn , Rob Herring , Florian Fainelli , Frank Rowand , "linux-sh@vger.kernel.org" , Russell King , "linux-csky@vger.kernel.org" , Ingo Molnar , "bcm-kernel-feedback-list@broadcom.com" , James Morse , "devicetree@vger.kernel.org" , Albert Ou , Ray Jui , Stefan Kristiansson , "openrisc@lists.librecores.org" , Borislav Petkov , "Paul Walmsley" , Thomas Gleixner , "linux-arm-kernel@lists.infradead.org" , Scott Branden , Yoshinori Sato , "linux-kernel@vger.kernel.org" , Palmer Dabbelt , Greg Kroah-Hartman , "Paul Mackerras" , "linuxppc-dev@lists.ozlabs.org" Subject: RE: [PATCH 06/12] openrisc: Use of_get_cpu_hwid() Thread-Topic: [PATCH 06/12] openrisc: Use of_get_cpu_hwid() Thread-Index: AQHXuvrQ2rKkD2ly1kazB6yB6/HdHavHKFTA Date: Thu, 7 Oct 2021 07:53:01 +0000 Message-ID: References: <20211006164332.1981454-1-robh@kernel.org> <20211006164332.1981454-7-robh@kernel.org> <20211006212728.GM10333@gate.crashing.org> In-Reply-To: <20211006212728.GM10333@gate.crashing.org> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Segher Boessenkool > Sent: 06 October 2021 22:27 > > On Thu, Oct 07, 2021 at 05:44:00AM +0900, Stafford Horne wrote: > > You have defined of_get_cpu_hwid to return u64, will this create compiler > > warnings when since we are storing a u64 into a u32? > > > > It seems only if we make with W=3. > > Yes. This is done by -Wconversion, "Warn for implicit conversions that > may alter a value." > > > I thought we usually warned on this. The microsoft compiler does - best to turn all those warnings off. > This warning is not in -Wall or -Wextra either, it suffers too much from > false positives. It is very natural to just ignore the high bits of > modulo types (which is what "unsigned" types *are*). Or the bits that > "fall off" on a conversion. The C standard makes this required > behaviour, it is useful, and it is the only convenient way of getting > this! I've also seen a compiler convert: struct->char_member = (char)(int_val & 0xff); into: reg = int_val; reg &= 0xff; // for the & 0xff reg &= 0xff; // for the cast struct->char_member = low_8bits(reg); You really don't want the extra noise. I'll bet that (char)int_val is actually an arithmetic expression. So its type will be 'int'. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)