rt2x00: Allow dynamic addition of PCI/USB IDs.
Both USB and PCI drivers allow a system administrator to dynamically add USB/PCI IDs to the device table that a driver supports via the /sys/bus/{usb,pci,pci_express}/drivers/<driver-name>/new_id files. However, for the rt2x00 drivers using this method currently crashes the system with a NULL pointer failure. This is due to the set-up of rt2x00 where the probe functions require a rt2x00_ops structure in the driver_info field of the probed device. As this field is empty for the dynamically added devices this fails for these devices. Fix this by introducing driver-specific probe wrappers that do nothing but calling the bus-specific probe functions with the rt2x00_ops structure as an argument, rather than depending on the driver_info field. Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com> Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:

committed by
John W. Linville

parent
ce2919c9ff
commit
e01ae27f8c
@@ -2095,7 +2095,7 @@ static const struct rt2x00_ops rt2500pci_ops = {
|
||||
* RT2500pci module information.
|
||||
*/
|
||||
static DEFINE_PCI_DEVICE_TABLE(rt2500pci_device_table) = {
|
||||
{ PCI_DEVICE(0x1814, 0x0201), PCI_DEVICE_DATA(&rt2500pci_ops) },
|
||||
{ PCI_DEVICE(0x1814, 0x0201) },
|
||||
{ 0, }
|
||||
};
|
||||
|
||||
@@ -2106,10 +2106,16 @@ MODULE_SUPPORTED_DEVICE("Ralink RT2560 PCI & PCMCIA chipset based cards");
|
||||
MODULE_DEVICE_TABLE(pci, rt2500pci_device_table);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static int rt2500pci_probe(struct pci_dev *pci_dev,
|
||||
const struct pci_device_id *id)
|
||||
{
|
||||
return rt2x00pci_probe(pci_dev, &rt2500pci_ops);
|
||||
}
|
||||
|
||||
static struct pci_driver rt2500pci_driver = {
|
||||
.name = KBUILD_MODNAME,
|
||||
.id_table = rt2500pci_device_table,
|
||||
.probe = rt2x00pci_probe,
|
||||
.probe = rt2500pci_probe,
|
||||
.remove = __devexit_p(rt2x00pci_remove),
|
||||
.suspend = rt2x00pci_suspend,
|
||||
.resume = rt2x00pci_resume,
|
||||
|
Reference in New Issue
Block a user