* [RFC] PMU: remove dead code
@ 2007-11-08 12:00 Johannes Berg
2007-11-11 20:54 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 2+ messages in thread
From: Johannes Berg @ 2007-11-08 12:00 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list
Some code in via-pmu.c is never compiled because of "compile options"
within the file. Remove the code completely.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
drivers/macintosh/via-pmu.c | 42 +-----------------------------------------
1 file changed, 1 insertion(+), 41 deletions(-)
--- everything.orig/drivers/macintosh/via-pmu.c 2007-11-08 11:47:42.332847765 +0100
+++ everything/drivers/macintosh/via-pmu.c 2007-11-08 11:48:37.192845813 +0100
@@ -65,9 +65,7 @@
#include "via-pmu-event.h"
/* Some compile options */
-#undef SUSPEND_USES_PMU
#define DEBUG_SLEEP
-#undef HACKED_PCI_SAVE
/* Misc minor number allocated for /dev/pmu */
#define PMU_MINOR 154
@@ -1255,9 +1253,7 @@ void
pmu_suspend(void)
{
unsigned long flags;
-#ifdef SUSPEND_USES_PMU
- struct adb_request *req;
-#endif
+
if (!via)
return;
@@ -1275,17 +1271,10 @@ pmu_suspend(void)
via_pmu_interrupt(0, NULL);
spin_lock_irqsave(&pmu_lock, flags);
if (!adb_int_pending && pmu_state == idle && !req_awaiting_reply) {
-#ifdef SUSPEND_USES_PMU
- pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, 0);
- spin_unlock_irqrestore(&pmu_lock, flags);
- while(!req.complete)
- pmu_poll();
-#else /* SUSPEND_USES_PMU */
if (gpio_irq >= 0)
disable_irq_nosync(gpio_irq);
out_8(&via[IER], CB1_INT | IER_CLR);
spin_unlock_irqrestore(&pmu_lock, flags);
-#endif /* SUSPEND_USES_PMU */
break;
}
} while (1);
@@ -1306,18 +1295,11 @@ pmu_resume(void)
return;
}
adb_int_pending = 1;
-#ifdef SUSPEND_USES_PMU
- pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, pmu_intr_mask);
- spin_unlock_irqrestore(&pmu_lock, flags);
- while(!req.complete)
- pmu_poll();
-#else /* SUSPEND_USES_PMU */
if (gpio_irq >= 0)
enable_irq(gpio_irq);
out_8(&via[IER], CB1_INT | IER_SET);
spin_unlock_irqrestore(&pmu_lock, flags);
pmu_poll();
-#endif /* SUSPEND_USES_PMU */
}
/* Interrupt data could be the result data from an ADB cmd */
@@ -1743,14 +1725,10 @@ pmu_present(void)
* PCI devices which may get powered off when we sleep.
*/
static struct pci_save {
-#ifndef HACKED_PCI_SAVE
u16 command;
u16 cache_lat;
u16 intr;
u32 rom_address;
-#else
- u32 config[16];
-#endif
} *pbook_pci_saves;
static int pbook_npci_saves;
@@ -1796,16 +1774,10 @@ pbook_pci_save(void)
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);
pci_read_config_word(pd, PCI_INTERRUPT_LINE, &ps->intr);
pci_read_config_dword(pd, PCI_ROM_ADDRESS, &ps->rom_address);
-#else
- int i;
- for (i=1;i<16;i++)
- pci_read_config_dword(pd, i<<4, &ps->config[i]);
-#endif
++ps;
}
}
@@ -1824,17 +1796,6 @@ pbook_pci_restore(void)
int j;
while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) {
-#ifdef HACKED_PCI_SAVE
- int i;
- 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]);
- pci_write_config_dword(pd, 4, ps->config[1]);
-#else
if (npci-- == 0)
return;
ps++;
@@ -1858,7 +1819,6 @@ pbook_pci_restore(void)
pci_write_config_word(pd, PCI_COMMAND, ps->command);
break;
}
-#endif
}
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [RFC] PMU: remove dead code
2007-11-08 12:00 [RFC] PMU: remove dead code Johannes Berg
@ 2007-11-11 20:54 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2007-11-11 20:54 UTC (permalink / raw)
To: Johannes Berg; +Cc: linuxppc-dev list
On Thu, 2007-11-08 at 13:00 +0100, Johannes Berg wrote:
> Some code in via-pmu.c is never compiled because of "compile options"
> within the file. Remove the code completely.
>
> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
> drivers/macintosh/via-pmu.c | 42 +-----------------------------------------
> 1 file changed, 1 insertion(+), 41 deletions(-)
>
> --- everything.orig/drivers/macintosh/via-pmu.c 2007-11-08 11:47:42.332847765 +0100
> +++ everything/drivers/macintosh/via-pmu.c 2007-11-08 11:48:37.192845813 +0100
> @@ -65,9 +65,7 @@
> #include "via-pmu-event.h"
>
> /* Some compile options */
> -#undef SUSPEND_USES_PMU
> #define DEBUG_SLEEP
> -#undef HACKED_PCI_SAVE
>
> /* Misc minor number allocated for /dev/pmu */
> #define PMU_MINOR 154
> @@ -1255,9 +1253,7 @@ void
> pmu_suspend(void)
> {
> unsigned long flags;
> -#ifdef SUSPEND_USES_PMU
> - struct adb_request *req;
> -#endif
> +
> if (!via)
> return;
>
> @@ -1275,17 +1271,10 @@ pmu_suspend(void)
> via_pmu_interrupt(0, NULL);
> spin_lock_irqsave(&pmu_lock, flags);
> if (!adb_int_pending && pmu_state == idle && !req_awaiting_reply) {
> -#ifdef SUSPEND_USES_PMU
> - pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, 0);
> - spin_unlock_irqrestore(&pmu_lock, flags);
> - while(!req.complete)
> - pmu_poll();
> -#else /* SUSPEND_USES_PMU */
> if (gpio_irq >= 0)
> disable_irq_nosync(gpio_irq);
> out_8(&via[IER], CB1_INT | IER_CLR);
> spin_unlock_irqrestore(&pmu_lock, flags);
> -#endif /* SUSPEND_USES_PMU */
> break;
> }
> } while (1);
> @@ -1306,18 +1295,11 @@ pmu_resume(void)
> return;
> }
> adb_int_pending = 1;
> -#ifdef SUSPEND_USES_PMU
> - pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, pmu_intr_mask);
> - spin_unlock_irqrestore(&pmu_lock, flags);
> - while(!req.complete)
> - pmu_poll();
> -#else /* SUSPEND_USES_PMU */
> if (gpio_irq >= 0)
> enable_irq(gpio_irq);
> out_8(&via[IER], CB1_INT | IER_SET);
> spin_unlock_irqrestore(&pmu_lock, flags);
> pmu_poll();
> -#endif /* SUSPEND_USES_PMU */
> }
>
> /* Interrupt data could be the result data from an ADB cmd */
> @@ -1743,14 +1725,10 @@ pmu_present(void)
> * PCI devices which may get powered off when we sleep.
> */
> static struct pci_save {
> -#ifndef HACKED_PCI_SAVE
> u16 command;
> u16 cache_lat;
> u16 intr;
> u32 rom_address;
> -#else
> - u32 config[16];
> -#endif
> } *pbook_pci_saves;
> static int pbook_npci_saves;
>
> @@ -1796,16 +1774,10 @@ pbook_pci_save(void)
> 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);
> pci_read_config_word(pd, PCI_INTERRUPT_LINE, &ps->intr);
> pci_read_config_dword(pd, PCI_ROM_ADDRESS, &ps->rom_address);
> -#else
> - int i;
> - for (i=1;i<16;i++)
> - pci_read_config_dword(pd, i<<4, &ps->config[i]);
> -#endif
> ++ps;
> }
> }
> @@ -1824,17 +1796,6 @@ pbook_pci_restore(void)
> int j;
>
> while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) {
> -#ifdef HACKED_PCI_SAVE
> - int i;
> - 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]);
> - pci_write_config_dword(pd, 4, ps->config[1]);
> -#else
> if (npci-- == 0)
> return;
> ps++;
> @@ -1858,7 +1819,6 @@ pbook_pci_restore(void)
> pci_write_config_word(pd, PCI_COMMAND, ps->command);
> break;
> }
> -#endif
> }
> }
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-11-11 20:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-08 12:00 [RFC] PMU: remove dead code Johannes Berg
2007-11-11 20:54 ` Benjamin Herrenschmidt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).