[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4fd0d418-ff34-8a3f-a233-5cdf80fe744f@codeaurora.org>
Date: Mon, 29 Jan 2018 17:01:51 -0500
From: Sinan Kaya <okaya@...eaurora.org>
To: Dave Airlie <airlied@...il.com>
Cc: Linux PCI <linux-pci@...r.kernel.org>, timur@...eaurora.org,
linux-arm-msm <linux-arm-msm@...r.kernel.org>,
linux-arm-kernel@...ts.infradead.org,
David Airlie <airlied@...ux.ie>, Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH V4 05/26] agp: nvidia: deprecate pci_get_bus_and_slot()
On 1/29/2018 4:43 PM, Dave Airlie wrote:
>> 12/19/2017 12:37 AM, Sinan Kaya wrote:
>>> pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as
>>> where a PCI device is present. This restricts the device drivers to be
>>> reused for other domain numbers.
> So not a major problem, but it would be pretty much impossible for either
> of these agp drivers to be used in any other domain ever.
>
> What does this buy us, maybe just rename pci_get_bus_and_slot to
> pci_get_domain0_bus_and_slot as a helper, or just pass the pdev in
> and have it do the right thing always.
There is nothing wrong with doing all three. Since nobody replied until
patch v4, I did the heavy-lifting and converted code to use pci_domain_nr()
as much as I can rather than hard-coding a 0 while calling
pci_get_domain_bus_and_slot().
>From PCI coding perspective, pci_domain_nr() call is the right thing. It is
guaranteed to work no matter what your domain number is.
People look at other code for examples on how to write a PCI driver
in general. You want to minimize the exceptions as much as possible.
Some discussion here about the benefits:
https://lkml.org/lkml/2017/12/19/349
--
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
Powered by blists - more mailing lists