Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp225265ybh; Tue, 14 Jul 2020 23:48:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLxrOpLC5Cvy0e+S5fRUuMK6xruTzWnlqBVrZ3/U2X7r/PP6OSRZ8FzuqjF0RYRiTfvY5C X-Received: by 2002:a17:906:364a:: with SMTP id r10mr7695236ejb.122.1594795714050; Tue, 14 Jul 2020 23:48:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594795714; cv=none; d=google.com; s=arc-20160816; b=0hJ0A6/oU9MdsYCFCx2AhvBffwU+R7iQzdX8G77MLbYm5btaJq6Bf/SVYXdZ/fUbO+ QisXQklMOp/g7AYiPxGIEIwic5eVDLl4HuTc3Pvk3sM0rIQtDm7KjCLNyvuz+2CSWebC Cwbcrwz+uYYcjAcJs87JYtZ/Rk6F2Ov/nElHu7weTKwyzxylshJUfRb63XEnWOM9O9me U2XqSIrUiLxYN0UC5gzKdBQ1PHl5TNYC44rp5r7BfXloQHvIGNKcMktTJ4LX1AMv7F1j 1dL4/Fcw0Be+p3atKCo2DCFSexfCi2pfw9QH0TgeWaMIwGsTKCGuKYf5VcisOk85JELJ sVrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=0fW/pY/tG41JLvSGC6qdTaU5J7+qr4zyHfUaibiKoa0=; b=Z7TjtrQJZRONUHsu1ZoqIQ1f/qSaigE7S3usdJ2bfigp/Yy+zE2+Mvfx74svDPIOPK 9Cm3iWTZLtIWql1FVPIz8BMa4gyIGhr/xqRwH/YIVtq54ImgsUVRZq0lU+XdJxGOrKsx bl/Ej940YZQbmBcLdKSE97TkmvW4lLyA8iDv74HEC7y7g2Go01+2fj8zgNZ8jGv81Ayc eXf7DABp6PWMPXlXCHnngOnQv50kqwa1x2Hexv8OeVF/RuarBMttY3wl8cQQhRmzSvFe yXke3NVIBry/uVW83+o/ehdjSIjK4m1OcU2J5elv/TE2eobNcymzzJN+4Z8vf0nhWbGR mKwg== 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 r9si715668edm.321.2020.07.14.23.48.10; Tue, 14 Jul 2020 23:48:34 -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 S1728855AbgGOGrj (ORCPT + 99 others); Wed, 15 Jul 2020 02:47:39 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:50153 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725924AbgGOGrj (ORCPT ); Wed, 15 Jul 2020 02:47:39 -0400 Received: from mail-qk1-f174.google.com ([209.85.222.174]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.145]) with ESMTPSA (Nemesis) id 1M7sQ8-1jzSp816GY-0050Q9; Wed, 15 Jul 2020 08:47:36 +0200 Received: by mail-qk1-f174.google.com with SMTP id b185so871202qkg.1; Tue, 14 Jul 2020 23:47:35 -0700 (PDT) X-Gm-Message-State: AOAM532LrhM8hiVVJOK5szknGYigk+QyT6hGxaJj8ouEmzM0Tan6qN4p 6sOhYgiDfFfclZnxoY+vKIyb0FSRZ+r/GKo5AeU= X-Received: by 2002:a37:a496:: with SMTP id n144mr8314087qke.286.1594795654855; Tue, 14 Jul 2020 23:47:34 -0700 (PDT) MIME-Version: 1.0 References: <20200714234625.GA428442@bjorn-Precision-5520> In-Reply-To: <20200714234625.GA428442@bjorn-Precision-5520> From: Arnd Bergmann Date: Wed, 15 Jul 2020 08:47:17 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 00/35] Move all PCIBIOS* definitions into arch/x86 To: Bjorn Helgaas Cc: "Saheed O. Bolarinwa" , bjorn@helgaas.com, Shuah Khan , linux-pci , linux-kernel-mentees@lists.linuxfoundation.org, "linux-kernel@vger.kernel.org" , Richard Henderson , Ivan Kokshaysky , Matt Turner , Greg Ungerer , Geert Uytterhoeven , Russell King , Boris Ostrovsky , Juergen Gross , Thomas Bogendoerfer , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , linuxppc-dev , "David S. Miller" , sparclinux , Guenter Roeck , Greg Kroah-Hartman , Heiner Kallweit , Jakub Kicinski , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Lorenzo Pieralisi , Rob Herring , Bjorn Helgaas , Kevin Hilman , Philipp Zabel , Jingoo Han , Gustavo Pimentel , Toan Le , Ray Jui , Scott Branden , Ley Foon Tan , Marek Vasut , Kjetil Oftedal Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:Ov73+FkWwqGvDa0Nd9xKW4QYYDGcw0TUwF/8ivnuG1D8a0mbzvW LVK/98InOx7ZAWF2Ybaus8kHATrC0tfSvZSg6GJJ9RYYOLnSVyK2RzSSmyVYdKEvOpn7JtU xhXzOPSGrSBf06b3T2Ykg/Rtz55itFj0U9A1/pc5LbW/PXQY1V9e+H+YLfRFMdieO5Kp4RV abg3RR8d6mSOt/zih4tow== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:7ysEtf4/W10=:ErYqQP9WJNbcjMCKGNPZaL SXuVyVI8Bxq7mRI3jEh9IJ9wZ7h1Gk0VOJe7yAFPGFii1qYzZdmww9s+Vol7k4WSNbxrfTa9P maWNGQbXG6WgYs3uOa7b2HfWcgM5TiXYLZ5UTF9ty4hjHNaXkPEsd1LuDAI15xjDF6FZEhbOK GrlC93UXHHwXaBsZNes07PPGGEwfUoAlI2q+bvlbC9NiNJO34YYcLE8o/zOZ66VHWvN5mdKh8 TLiA9elD4OcrxVgkG6OD2URYvoob4IVTM/lWNpOOXELPT9V2LoB7eWTIALUWrz9vfLsId15KT ruYwqEziCy2jF8Q28G0+e5CehAY0Yn6z/xB30AOLme4Ue2vjKFkaHZv7qzDaBrm7fmXo7iHuj k6Snjwpf9oomxvUTYYwWuc+NqIcNwDvykgAm2XB9jYLtZUq5E9UiLpLBxdSbhJFGBlhGuP91p 6ddT/fhpEXn3St9B9Xburqq/AoI5BwWdltiYfO87oJ4HlzN7WPnvfuY5HvbvnCHkLwHx0T0lF jP5Tnn91+Z7BO6I5ENKT470MUe36vIXVwtJUKFtboh50d824RUOh9G1C7X5VwsTkkCooxeSN5 cV2XqpO83DRYqEofW8IHTHWiyDkugVqfDE8o+bJhC08etgjkpHa9J8mh3J1sVJ5jX1eU2jL5j Hv5OjT35eMzL8R7+Ij1iZIsFBBRwhSegzO+OfoTdvCLo/QAWiTnF8dxpuJITdPVDUpPOgothf MRViAVrKjnEP7+I7gEwYwwGFIk5mZFOgog1apOiWiGuvhPPxXI7ssB1PW+5CNcBbcFU2FcrBZ kdt0/qDvWkqAIt0nrrwAaooG0FS/5j4olvDVtvW/o2403TsGEWybMLig4sM+bICzMa3X47wwa h9Pn5bSTiPUVxs71Gphsj5L5hTW1T8ysjpauL1A1NtsPEdbDqbb4fxHU7PHWZ9ibT4fViOqJU InVriLguElFCSH67Fo/POd23hKoNMFlAmPNRjDK65NrGUGdl+trF9 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 15, 2020 at 1:46 AM Bjorn Helgaas wrote: So something like: > > void pci_read_config_word(struct pci_dev *dev, int where, u16 *val) > > and where we used to return anything non-zero, we just set *val = ~0 > instead? I think we do that already in most, maybe all, cases. Right, this is what I had in mind. If we start by removing the handling of the return code in all files that clearly don't need it, looking at whatever remains will give a much better idea of what a good interface should be. > git grep -E "(if|return|=).*\ finds about 400 matches. Right, and this is some 112 files to look at. I had a slightly different regex, which found more false-positives, but also these: arch/x86/kernel/amd_nb.c: : pci_read_config_dword(root, 0x64, value)); drivers/i2c/busses/i2c-sis630.c: pci_write_config_byte(sis630_dev, SIS630_BIOS_CTL_REG, b | 0x80)) { drivers/i2c/busses/i2c-viapro.c: !pci_read_config_word(pdev, SMBBA2, &vt596_smba) && drivers/ide/rz1000.c: !pci_write_config_word(dev, 0x40, reg & 0xdfff)) { drivers/net/ethernet/realtek/r8169_main.c: pci_write_config_byte(pdev, 0x070f, val) == PCIBIOS_SUCCESSFUL) include/linux/rtsx_pci.h:#define rtsx_pci_read_config_dword(pcr, where, val) pci_read_config_dword((pcr)->pci, where, val) include/linux/rtsx_pci.h:#define rtsx_pci_write_config_dword(pcr, where, val) pci_write_config_dword((pcr)->pci, where, val) drivers/misc/cardreader/rts5261.c: retval = rtsx_pci_read_config_dword(pcr, drivers/misc/cardreader/rts5261.c: retval = rtsx_pci_write_config_dword(pcr, PCR_SETTING_REG2, lval); That last one is interesting because I think this is a case in which we actually want to check for errors, as the driver seems to use it to ensure that accessing extended config space at offset 0x814 works before relying on the value. Unfortunately the implementation seems buggy as it a) keeps using the possibly uninitialized value after printing a warning and b) returns the PCIBIOS_* value in place of a negative errno and then ignores it in the caller. Arnd