Re: [PATCH 2.6.33 1/3] net: Micrel KSZ8841/2 PCI Ethernet driver
From: Alan Cox
Date: Tue Jan 19 2010 - 16:29:49 EST
> >> +#define PCI_VENDOR_ID_KS884X 0x16C6
> >> +#define PCI_DEVICE_ID_KS8841 0x8841
> >> +#define PCI_DEVICE_ID_KS8842 0x8842
> > Those belong in the pci device id header.
> I do not quite understand your suggestion. Do I need to put those IDs
> in one of the kernel headers?
> >> + hw->pdev = pdev;
> > If you make a private copy of pdev in your struct you should refcount
> it and use
> > pci_dev_get/pci_dev_put when you take and release the reference.
> I do not understand how pci_dev_get/pci_dev_put work. Does the pdev
> pointer actually change during the lifetime of the PCI driver?
No but it can go away if the device is removed. The pci_dev_get ensures
it won't go away while you have a pointer to it. and the pci_dev_put
gives up your reference.
> I also like the attribute to associate with the network device rather
> than the PCI device, as the KSZ8842 driver can create another virtual
> network device. I tried to pass the device pointer of the network
> device to device_create_file function and the driver crashed. I will
> investigate this matter further.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/