Re: [PATCH V4 05/26] agp: nvidia: deprecate pci_get_bus_and_slot()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux