Re: pci_find_device removal

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

 



On Tue, Jan 03, 2006 at 05:41:59PM -0800, Sanjay Acharya wrote:
> Greg KH wrote:
> 
> >On Tue, Jan 03, 2006 at 05:25:32PM -0800, Sanjay Acharya wrote:
> > 
> >
> >>What is the exact reason for deprecating pci_find_device and replacing 
> >>it with pci_get_device?
> >>   
> >>
> >
> >Did you read the description of what pci_get_device() does?  If you only
> >use pci_find_device(), your code will not work in systems that support
> >pci hotplug (which is becoming more and more popular due to pci express
> >and cardbus and expresscard)
> >
> Yes I read the documentation but did not get a clear picture of it.

The problem is the pointer returned from pci_find_device() is not
properly reference counted, and can go away at any moment in time.  The
pointer returned by pci_get_device() has proper reference counting and
is safe to use.

> >In reality, I'd also like to get rid of pci_get_device() too, so neither
> >of these calls should _ever_ be added to new code.
> > 
> >
> Yes, I read in the document that newer drivers should be using 
> pci_register_driver and almost all of the pci drivers that I checked 
> seem to be using this. I will be using this in our driver.

Great.

thanks,

greg k-h

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux