Commit 970a61363be4a6633de0fbbe6fe3a249238c4acc

Authored by Alan Cox
Committed by Linus Torvalds
1 parent 1424e50448

[PATCH] serverworks: Switch to pci refcounted interfaces

As we don't support hotplug we end up leaking an isa_dev reference which if
unload was ever added we would drop at the end of unloading.  This is fine
because we do genuinely need the isa_dev pointer until unload.

Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 1 changed file with 5 additions and 3 deletions Side-by-side Diff

drivers/ide/pci/serverworks.c
... ... @@ -359,7 +359,7 @@
359 359  
360 360 /* OSB4 : South Bridge and IDE */
361 361 if (dev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) {
362   - isa_dev = pci_find_device(PCI_VENDOR_ID_SERVERWORKS,
  362 + isa_dev = pci_get_device(PCI_VENDOR_ID_SERVERWORKS,
363 363 PCI_DEVICE_ID_SERVERWORKS_OSB4, NULL);
364 364 if (isa_dev) {
365 365 pci_read_config_dword(isa_dev, 0x64, &reg);
... ... @@ -380,7 +380,7 @@
380 380 if (!(PCI_FUNC(dev->devfn) & 1)) {
381 381 struct pci_dev * findev = NULL;
382 382 u32 reg4c = 0;
383   - findev = pci_find_device(PCI_VENDOR_ID_SERVERWORKS,
  383 + findev = pci_get_device(PCI_VENDOR_ID_SERVERWORKS,
384 384 PCI_DEVICE_ID_SERVERWORKS_CSB5, NULL);
385 385 if (findev) {
386 386 pci_read_config_dword(findev, 0x4C, &reg4c);
... ... @@ -388,6 +388,7 @@
388 388 reg4c |= 0x00000040;
389 389 reg4c |= 0x00000020;
390 390 pci_write_config_dword(findev, 0x4C, reg4c);
  391 + pci_dev_put(findev);
391 392 }
392 393 outb_p(0x06, 0x0c00);
393 394 dev->irq = inb_p(0x0c01);
394 395  
... ... @@ -395,12 +396,13 @@
395 396 struct pci_dev * findev = NULL;
396 397 u8 reg41 = 0;
397 398  
398   - findev = pci_find_device(PCI_VENDOR_ID_SERVERWORKS,
  399 + findev = pci_get_device(PCI_VENDOR_ID_SERVERWORKS,
399 400 PCI_DEVICE_ID_SERVERWORKS_CSB6, NULL);
400 401 if (findev) {
401 402 pci_read_config_byte(findev, 0x41, &reg41);
402 403 reg41 &= ~0x40;
403 404 pci_write_config_byte(findev, 0x41, reg41);
  405 + pci_dev_put(findev);
404 406 }
405 407 /*
406 408 * This is a device pin issue on CSB6.