Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp869067ybg; Mon, 27 Jul 2020 01:32:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxaEjAoZit5JC8qhUqlQcD5dU1E3lP5svzeBOukkZIWjZ9dCzn3LCZ/fN+ttlsOffdJyjWo X-Received: by 2002:aa7:d458:: with SMTP id q24mr20107137edr.25.1595838776609; Mon, 27 Jul 2020 01:32:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595838776; cv=none; d=google.com; s=arc-20160816; b=JP5BiSiRxcG1+Ir9ytSBpp+gfUvVwwdki9y5VyJN6LTlFQx9Hv37H7fihNlK3xTSs5 qbbQVkskYfE9dKqAh8OAQ3rEnypE009xzXYXUl3uagY410WMVxYolDJhreYIopxT71tK eFZ++H/pPk4Sd+xb+I4CQqtAWtTjYbAQnXE7xuuI2hBjIprkRonA8d6/b+42DNbdM3Nw enuhUw7hqNjoaVwoMX45y71WMMRDSZOwJRgfXurWGzklfYAIYBRCpYbuwEzb/SPCIRmv 4YDpEwKCIStBAGhaVjmC63K+Kf982GuTRiqjPVTu/9GJlDZ37t5JtHprJP2YovWzShMz cZ9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=2A79tCuOtEyjPrf1Yurb2rAaRR9Cl4exebuBHjQi4uo=; b=r5YGlTma89ZR5uc1VkJTiF2N2elD7oP3t2TacmJZxuVX90ueYEYvujsnwCSE02YTPe ZGk1lMKVCNOCjvgg88s1t7UMxCoj8EpfVnjjnxAON8BRlMHGOmWu6TCmbH3Oo1r1mWK7 sZQLQRY4gF4b4Qjj69vM1dtflpzuKV4hANUr5Rjrd4rEAWuZVhaxZCeXLflc5E6hXSDD O71tN5Bs0uYYOKadMTRn29epEJ3es4SFDni4HB1/LkqUAF9eBa1K17xDytsId/y1PBaL pYL8NQIQgZMLCSGlzdbyWChDFoOvVweKSLAjmC+37jNQRjqW50AGnsw5I/jcK46deHkX +Vtg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k19si5175213ejk.27.2020.07.27.01.32.33; Mon, 27 Jul 2020 01:32:56 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726357AbgG0IaY (ORCPT + 99 others); Mon, 27 Jul 2020 04:30:24 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:2525 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726139AbgG0IaX (ORCPT ); Mon, 27 Jul 2020 04:30:23 -0400 Received: from lhreml724-chm.china.huawei.com (unknown [172.18.7.108]) by Forcepoint Email with ESMTP id 1001EE1A7B0462DD1BCC; Mon, 27 Jul 2020 09:30:22 +0100 (IST) Received: from [127.0.0.1] (10.210.169.250) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Mon, 27 Jul 2020 09:30:21 +0100 Subject: Re: [PATCH] io: Fix return type of _inb and _inl To: Arnd Bergmann , Stafford Horne CC: Andy Shevchenko , LKML , Wei Xu , Linux-Arch References: <20200726031154.1012044-1-shorne@gmail.com> <20200726125325.GC80756@lianli.shorne-pla.net> From: John Garry Message-ID: Date: Mon, 27 Jul 2020 09:28:25 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.1.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.210.169.250] X-ClientProxiedBy: lhreml745-chm.china.huawei.com (10.201.108.195) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27/07/2020 09:04, Arnd Bergmann wrote:> On Sun, Jul 26, 2020 at 2:53 PM Stafford Horne wrote: >> >> On Sun, Jul 26, 2020 at 12:00:37PM +0300, Andy Shevchenko wrote: >>> On Sun, Jul 26, 2020 at 6:14 AM Stafford Horne wrote: >>>> >>>> The return type of functions _inb, _inw and _inl are all u16 which looks >>>> wrong. This patch makes them u8, u16 and u32 respectively. >>>> >>>> The original commit text for these does not indicate that these should >>>> be all forced to u16. >>> >>> Is it in alight with all architectures? that support this interface natively? >>> >>> (Return value is arch-dependent AFAIU, so it might actually return >>> 16-bit for byte read, but I agree that this is weird for 32-bit value. >>> I think you have elaborate more in the commit message) >> >> Well, this is the generic io code, at least these api's appear to not be different >> for each architecture. The output read by the architecture dependant code i.e. >> __raw_readb() below is getting is placed into a u8. So I think the output of >> the function will be u8. >> >> static inline u8 _inb(unsigned long addr) >> { >> u8 val; >> >> __io_pbr(); >> val = __raw_readb(PCI_IOBASE + addr); >> __io_par(val); >> return val; >> } >> >> I can expand the commit text, but I would like to get some comments from the >> original author to confirm if this is an issue. > > I think your original version is fine, this was clearly just a typo and I've > applied your fix now and will forward it to Linus in the next few days, > giving John the chance to add his Ack or further comments. > > Thanks a lot for spotting it and sending a fix. Thanks Arnd. Yeah, these looks like copy+paste errors on my part: Reviewed-by: John Garry I'll give this patch a spin, but not expecting any differences (since original seems ok). Note that kbuild robot also reported this: https://lore.kernel.org/lkml/202007140549.J7X9BVPT%25lkp@intel.com/ Extract: include/asm-generic/io.h:521:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@ include/asm-generic/io.h:521:22: sparse: expected unsigned int [usertype] value include/asm-generic/io.h:521:22: sparse: got restricted __le32 [usertype] But they look like issues which were in the existing code. I tried to recreate to verify any change, but trying to manually upgrade glibc busted my machine :( Thanks, John