From: Alan Cox Date: Sun, 1 Oct 2006 06:27:32 +0000 (-0700) Subject: [PATCH] via* : switch to pci_get_device refcounted PCI API X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=edceeaf50be1764db4aa7c1b19e540067a051e77;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git [PATCH] via* : switch to pci_get_device refcounted PCI API If we can clean up these remainders we can finally delete pci_find_* Signed-off-by: Alan Cox Cc: Greg KH Acked-by: Benjamin Herrenschmidt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c index dda03985dcf..80b89649e67 100644 --- a/drivers/macintosh/via-pmu.c +++ b/drivers/macintosh/via-pmu.c @@ -1827,7 +1827,7 @@ pbook_alloc_pci_save(void) struct pci_dev *pd = NULL; npci = 0; - while ((pd = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) { + while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) { ++npci; } if (npci == 0) @@ -1857,9 +1857,11 @@ pbook_pci_save(void) if (ps == NULL) return; - while ((pd = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) { - if (npci-- == 0) + while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) { + if (npci-- == 0) { + pci_dev_put(pd); return; + } #ifndef HACKED_PCI_SAVE pci_read_config_word(pd, PCI_COMMAND, &ps->command); pci_read_config_word(pd, PCI_CACHE_LINE_SIZE, &ps->cache_lat); @@ -1887,11 +1889,13 @@ pbook_pci_restore(void) int npci = pbook_npci_saves; int j; - while ((pd = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) { + while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) { #ifdef HACKED_PCI_SAVE int i; - if (npci-- == 0) + if (npci-- == 0) { + pci_dev_put(pd); return; + } ps++; for (i=2;i<16;i++) pci_write_config_dword(pd, i<<4, ps->config[i]); diff --git a/drivers/macintosh/via-pmu68k.c b/drivers/macintosh/via-pmu68k.c index 35b70323e7e..9f4eff1d1a0 100644 --- a/drivers/macintosh/via-pmu68k.c +++ b/drivers/macintosh/via-pmu68k.c @@ -843,7 +843,7 @@ pbook_pci_save(void) struct pci_save *ps; npci = 0; - while ((pd = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) + while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) ++npci; n_pbook_pci_saves = npci; if (npci == 0) @@ -854,7 +854,7 @@ pbook_pci_save(void) return; pd = NULL; - while ((pd = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) { + while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) { pci_read_config_word(pd, PCI_COMMAND, &ps->command); pci_read_config_word(pd, PCI_CACHE_LINE_SIZE, &ps->cache_lat); pci_read_config_word(pd, PCI_INTERRUPT_LINE, &ps->intr); @@ -871,7 +871,7 @@ pbook_pci_restore(void) struct pci_dev *pd = NULL; int j; - while ((pd = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) { + while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) { if (ps->command == 0) continue; pci_read_config_word(pd, PCI_COMMAND, &cmd);