From 51bcd85dc802213cd37a93d14694ef4ab23d1183 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Wed, 27 Jul 2005 01:06:35 -0700 Subject: [PATCH] --- yaml --- r: 5531 b: refs/heads/master c: faa725332f39329288f52b7f872ffda866ba5b09 h: refs/heads/master i: 5529: 3ca5fda8a68f4d99798a33a0aefbbc1ba8611615 5527: aa2acc61e4126a31b725b3efdaaa0646350d183d v: v3 --- [refs] | 2 +- trunk/Documentation/fb/vesafb.txt | 16 +- .../i386/kernel/cpu/cpufreq/acpi-cpufreq.c | 7 - trunk/arch/i386/pci/acpi.c | 1 - trunk/arch/i386/pci/common.c | 6 - trunk/arch/i386/pci/irq.c | 1 - trunk/arch/i386/pci/pci.h | 1 - trunk/arch/ppc/kernel/head_44x.S | 12 +- trunk/arch/ppc/kernel/misc.S | 3 - trunk/arch/ppc/platforms/4xx/ebony.c | 6 +- trunk/arch/ppc/platforms/4xx/ebony.h | 13 +- trunk/arch/ppc/platforms/4xx/ocotea.c | 4 - trunk/arch/ppc/platforms/4xx/ocotea.h | 13 +- trunk/arch/ppc64/kernel/misc.S | 6 - trunk/arch/x86_64/kernel/mpparse.c | 17 +- trunk/arch/x86_64/lib/csum-copy.S | 2 +- trunk/drivers/acpi/ec.c | 893 ++++-------------- trunk/drivers/acpi/pci_irq.c | 85 +- trunk/drivers/acpi/pci_link.c | 103 +- trunk/drivers/acpi/processor_idle.c | 31 +- trunk/drivers/net/sk98lin/skge.c | 77 -- trunk/drivers/pcmcia/yenta_socket.c | 9 + trunk/drivers/scsi/Kconfig | 2 +- trunk/drivers/video/fbsysfs.c | 8 - trunk/include/acpi/acpi_drivers.h | 3 +- trunk/include/asm-ppc/unistd.h | 5 +- trunk/include/asm-ppc64/unistd.h | 5 +- trunk/include/linux/acpi.h | 4 + trunk/include/net/tcp.h | 2 +- trunk/kernel/softirq.c | 4 +- trunk/mm/page_alloc.c | 21 +- trunk/net/core/dst.c | 15 +- trunk/net/ipv4/ip_gre.c | 21 +- trunk/net/ipv4/ipip.c | 20 +- trunk/net/ipv4/ipmr.c | 6 +- trunk/net/ipv4/netfilter/ip_conntrack_core.c | 5 - trunk/net/ipv6/sit.c | 21 +- trunk/sound/pci/intel8x0.c | 7 +- 38 files changed, 289 insertions(+), 1168 deletions(-) diff --git a/[refs] b/[refs] index affa0c456038..7cc59c273cd4 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 02459eaab98a6a57717bc0cacede148fc76af881 +refs/heads/master: faa725332f39329288f52b7f872ffda866ba5b09 diff --git a/trunk/Documentation/fb/vesafb.txt b/trunk/Documentation/fb/vesafb.txt index 62db6758d1c1..814e2f56a6ad 100644 --- a/trunk/Documentation/fb/vesafb.txt +++ b/trunk/Documentation/fb/vesafb.txt @@ -144,21 +144,7 @@ vgapal Use the standard vga registers for palette changes. This is the default. pmipal Use the protected mode interface for palette changes. -mtrr:n setup memory type range registers for the vesafb framebuffer - where n: - 0 - disabled (equivalent to nomtrr) - 1 - uncachable - 2 - write-back - 3 - write-combining (default) - 4 - write-through - - If you see the following in dmesg, choose the type that matches the - old one. In this example, use "mtrr:2". -... -mtrr: type mismatch for e0000000,8000000 old: write-back new: write-combining -... - -nomtrr disable mtrr +mtrr setup memory type range registers for the vesafb framebuffer. vremap:n remap 'n' MiB of video RAM. If 0 or not specified, remap memory diff --git a/trunk/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c b/trunk/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c index 60a9e54dd20e..963e17aa205d 100644 --- a/trunk/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/trunk/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c @@ -442,13 +442,6 @@ acpi_cpufreq_cpu_init ( (u32) data->acpi_data.states[i].transition_latency); cpufreq_frequency_table_get_attr(data->freq_table, policy->cpu); - - /* - * the first call to ->target() should result in us actually - * writing something to the appropriate registers. - */ - data->resume = 1; - return (result); err_freqfree: diff --git a/trunk/arch/i386/pci/acpi.c b/trunk/arch/i386/pci/acpi.c index 42913f43feb0..2db65ec45dc3 100644 --- a/trunk/arch/i386/pci/acpi.c +++ b/trunk/arch/i386/pci/acpi.c @@ -30,7 +30,6 @@ static int __init pci_acpi_init(void) acpi_irq_penalty_init(); pcibios_scanned++; pcibios_enable_irq = acpi_pci_irq_enable; - pcibios_disable_irq = acpi_pci_irq_disable; if (pci_routeirq) { /* diff --git a/trunk/arch/i386/pci/common.c b/trunk/arch/i386/pci/common.c index ade5bc57c34c..70bcd53451f6 100644 --- a/trunk/arch/i386/pci/common.c +++ b/trunk/arch/i386/pci/common.c @@ -254,9 +254,3 @@ int pcibios_enable_device(struct pci_dev *dev, int mask) return pcibios_enable_irq(dev); } - -void pcibios_disable_device (struct pci_dev *dev) -{ - if (pcibios_disable_irq) - pcibios_disable_irq(dev); -} diff --git a/trunk/arch/i386/pci/irq.c b/trunk/arch/i386/pci/irq.c index 86348b68fda1..d291fb7f1357 100644 --- a/trunk/arch/i386/pci/irq.c +++ b/trunk/arch/i386/pci/irq.c @@ -56,7 +56,6 @@ struct irq_router_handler { }; int (*pcibios_enable_irq)(struct pci_dev *dev) = NULL; -void (*pcibios_disable_irq)(struct pci_dev *dev) = NULL; /* * Check passed address for the PCI IRQ Routing Table signature diff --git a/trunk/arch/i386/pci/pci.h b/trunk/arch/i386/pci/pci.h index 127d53ad16be..a80f0f55ff51 100644 --- a/trunk/arch/i386/pci/pci.h +++ b/trunk/arch/i386/pci/pci.h @@ -73,4 +73,3 @@ extern int pcibios_scanned; extern spinlock_t pci_config_lock; extern int (*pcibios_enable_irq)(struct pci_dev *dev); -extern void (*pcibios_disable_irq)(struct pci_dev *dev); diff --git a/trunk/arch/ppc/kernel/head_44x.S b/trunk/arch/ppc/kernel/head_44x.S index 72ee8f33bde4..6c7ae6052464 100644 --- a/trunk/arch/ppc/kernel/head_44x.S +++ b/trunk/arch/ppc/kernel/head_44x.S @@ -179,14 +179,14 @@ skpinv: addi r4,r4,1 /* Increment */ 4: #ifdef CONFIG_SERIAL_TEXT_DEBUG /* - * Add temporary UART mapping for early debug. - * We can map UART registers wherever we want as long as they don't - * interfere with other system mappings (e.g. with pinned entries). - * For an example of how we handle this - see ocotea.h. --ebs + * Add temporary UART mapping for early debug. This + * mapping must be identical to that used by the early + * bootloader code since the same asm/serial.h parameters + * are used for polled operation. */ /* pageid fields */ lis r3,UART0_IO_BASE@h - ori r3,r3,PPC44x_TLB_VALID | PPC44x_TLB_4K + ori r3,r3,PPC44x_TLB_VALID | PPC44x_TLB_256M /* xlat fields */ lis r4,UART0_PHYS_IO_BASE@h /* RPN depends on SoC */ @@ -196,7 +196,7 @@ skpinv: addi r4,r4,1 /* Increment */ li r5,0 ori r5,r5,(PPC44x_TLB_SW | PPC44x_TLB_SR | PPC44x_TLB_I | PPC44x_TLB_G) - li r0,0 /* TLB slot 0 */ + li r0,1 /* TLB slot 1 */ tlbwe r3,r0,PPC44x_TLB_PAGEID /* Load the pageid fields */ tlbwe r4,r0,PPC44x_TLB_XLAT /* Load the translation fields */ diff --git a/trunk/arch/ppc/kernel/misc.S b/trunk/arch/ppc/kernel/misc.S index c2fb85b49a11..191a8def3bdb 100644 --- a/trunk/arch/ppc/kernel/misc.S +++ b/trunk/arch/ppc/kernel/misc.S @@ -1451,6 +1451,3 @@ _GLOBAL(sys_call_table) .long sys_waitid .long sys_ioprio_set .long sys_ioprio_get - .long sys_inotify_init /* 275 */ - .long sys_inotify_add_watch - .long sys_inotify_rm_watch diff --git a/trunk/arch/ppc/platforms/4xx/ebony.c b/trunk/arch/ppc/platforms/4xx/ebony.c index 509e69a095f0..cd11734ef7c5 100644 --- a/trunk/arch/ppc/platforms/4xx/ebony.c +++ b/trunk/arch/ppc/platforms/4xx/ebony.c @@ -7,7 +7,7 @@ * Copyright 2002-2005 MontaVista Software Inc. * * Eugene Surovegin or - * Copyright (c) 2003-2005 Zultys Technologies + * Copyright (c) 2003, 2004 Zultys Technologies * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -50,7 +50,6 @@ #include #include #include -#include #include #include @@ -249,9 +248,6 @@ ebony_early_serial_map(void) #if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB) /* Configure debug serial access */ gen550_init(0, &port); - - /* Purge TLB entry added in head_44x.S for early serial access */ - _tlbie(UART0_IO_BASE); #endif port.membase = ioremap64(PPC440GP_UART1_ADDR, 8); diff --git a/trunk/arch/ppc/platforms/4xx/ebony.h b/trunk/arch/ppc/platforms/4xx/ebony.h index d08faa46a0ae..47c391c9174d 100644 --- a/trunk/arch/ppc/platforms/4xx/ebony.h +++ b/trunk/arch/ppc/platforms/4xx/ebony.h @@ -56,18 +56,9 @@ * Serial port defines */ -#if defined(__BOOTER__) -/* OpenBIOS defined UART mappings, used by bootloader shim */ +/* OpenBIOS defined UART mappings, used before early_serial_setup */ #define UART0_IO_BASE 0xE0000200 #define UART1_IO_BASE 0xE0000300 -#else -/* head_44x.S created UART mapping, used before early_serial_setup. - * We cannot use default OpenBIOS UART mappings because they - * don't work for configurations with more than 512M RAM. --ebs - */ -#define UART0_IO_BASE 0xF0000200 -#define UART1_IO_BASE 0xF0000300 -#endif /* external Epson SG-615P */ #define BASE_BAUD 691200 @@ -75,7 +66,7 @@ #define STD_UART_OP(num) \ { 0, BASE_BAUD, 0, UART##num##_INT, \ (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST), \ - iomem_base: (void*)UART##num##_IO_BASE, \ + iomem_base: UART##num##_IO_BASE, \ io_type: SERIAL_IO_MEM}, #define SERIAL_PORT_DFNS \ diff --git a/trunk/arch/ppc/platforms/4xx/ocotea.c b/trunk/arch/ppc/platforms/4xx/ocotea.c index 8fc34a344769..5f82a6bc7046 100644 --- a/trunk/arch/ppc/platforms/4xx/ocotea.c +++ b/trunk/arch/ppc/platforms/4xx/ocotea.c @@ -48,7 +48,6 @@ #include #include #include -#include #include #include @@ -267,9 +266,6 @@ ocotea_early_serial_map(void) #if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB) /* Configure debug serial access */ gen550_init(0, &port); - - /* Purge TLB entry added in head_44x.S for early serial access */ - _tlbie(UART0_IO_BASE); #endif port.membase = ioremap64(PPC440GX_UART1_ADDR, 8); diff --git a/trunk/arch/ppc/platforms/4xx/ocotea.h b/trunk/arch/ppc/platforms/4xx/ocotea.h index 33251153ac5f..202dc8251190 100644 --- a/trunk/arch/ppc/platforms/4xx/ocotea.h +++ b/trunk/arch/ppc/platforms/4xx/ocotea.h @@ -55,24 +55,15 @@ */ #define RS_TABLE_SIZE 2 -#if defined(__BOOTER__) -/* OpenBIOS defined UART mappings, used by bootloader shim */ +/* OpenBIOS defined UART mappings, used before early_serial_setup */ #define UART0_IO_BASE 0xE0000200 #define UART1_IO_BASE 0xE0000300 -#else -/* head_44x.S created UART mapping, used before early_serial_setup. - * We cannot use default OpenBIOS UART mappings because they - * don't work for configurations with more than 512M RAM. --ebs - */ -#define UART0_IO_BASE 0xF0000200 -#define UART1_IO_BASE 0xF0000300 -#endif #define BASE_BAUD 11059200/16 #define STD_UART_OP(num) \ { 0, BASE_BAUD, 0, UART##num##_INT, \ (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST), \ - iomem_base: (void*)UART##num##_IO_BASE, \ + iomem_base: UART##num##_IO_BASE, \ io_type: SERIAL_IO_MEM}, #define SERIAL_PORT_DFNS \ diff --git a/trunk/arch/ppc64/kernel/misc.S b/trunk/arch/ppc64/kernel/misc.S index a05b50b738e9..59f4f9973818 100644 --- a/trunk/arch/ppc64/kernel/misc.S +++ b/trunk/arch/ppc64/kernel/misc.S @@ -1129,9 +1129,6 @@ _GLOBAL(sys_call_table32) .llong .compat_sys_waitid .llong .sys32_ioprio_set .llong .sys32_ioprio_get - .llong .sys_inotify_init /* 275 */ - .llong .sys_inotify_add_watch - .llong .sys_inotify_rm_watch .balign 8 _GLOBAL(sys_call_table) @@ -1410,6 +1407,3 @@ _GLOBAL(sys_call_table) .llong .sys_waitid .llong .sys_ioprio_set .llong .sys_ioprio_get - .llong .sys_inotify_init /* 275 */ - .llong .sys_inotify_add_watch - .llong .sys_inotify_rm_watch diff --git a/trunk/arch/x86_64/kernel/mpparse.c b/trunk/arch/x86_64/kernel/mpparse.c index 79c362d03e2e..08abf9f5b159 100644 --- a/trunk/arch/x86_64/kernel/mpparse.c +++ b/trunk/arch/x86_64/kernel/mpparse.c @@ -970,21 +970,8 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low) * due to unused I/O APIC pins. */ int irq = gsi; - if (gsi < MAX_GSI_NUM) { - if (gsi > 15) - gsi = pci_irq++; -#ifdef CONFIG_ACPI_BUS - /* - * Don't assign IRQ used by ACPI SCI - */ - if (gsi == acpi_fadt.sci_int) - gsi = pci_irq++; -#endif - gsi_to_irq[irq] = gsi; - } else { - printk(KERN_ERR "GSI %u is too high\n", gsi); - return gsi; - } + gsi = pci_irq++; + gsi_to_irq[irq] = gsi; } io_apic_set_pci_routing(ioapic, ioapic_pin, gsi, diff --git a/trunk/arch/x86_64/lib/csum-copy.S b/trunk/arch/x86_64/lib/csum-copy.S index 72fd55ee896e..01808ec37836 100644 --- a/trunk/arch/x86_64/lib/csum-copy.S +++ b/trunk/arch/x86_64/lib/csum-copy.S @@ -188,8 +188,8 @@ csum_partial_copy_generic: source movw (%rdi),%bx adcl %ebx,%eax - decl %ecx dest + decl %ecx movw %bx,(%rsi) leaq 2(%rdi),%rdi leaq 2(%rsi),%rsi diff --git a/trunk/drivers/acpi/ec.c b/trunk/drivers/acpi/ec.c index 2dadb7f63269..fca4140a50a9 100644 --- a/trunk/drivers/acpi/ec.c +++ b/trunk/drivers/acpi/ec.c @@ -59,185 +59,76 @@ ACPI_MODULE_NAME ("acpi_ec") #define ACPI_EC_DELAY 50 /* Wait 50ms max. during EC ops */ #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ -#define ACPI_EC_UDELAY 100 /* Poll @ 100us increments */ -#define ACPI_EC_UDELAY_COUNT 1000 /* Wait 10ms max. during EC ops */ - #define ACPI_EC_COMMAND_READ 0x80 #define ACPI_EC_COMMAND_WRITE 0x81 #define ACPI_EC_BURST_ENABLE 0x82 #define ACPI_EC_BURST_DISABLE 0x83 #define ACPI_EC_COMMAND_QUERY 0x84 -#define EC_POLLING 0xFF -#define EC_BURST 0x00 - - +static int acpi_ec_add (struct acpi_device *device); static int acpi_ec_remove (struct acpi_device *device, int type); static int acpi_ec_start (struct acpi_device *device); static int acpi_ec_stop (struct acpi_device *device, int type); -static int acpi_ec_burst_add ( struct acpi_device *device); static struct acpi_driver acpi_ec_driver = { .name = ACPI_EC_DRIVER_NAME, .class = ACPI_EC_CLASS, .ids = ACPI_EC_HID, .ops = { - .add = acpi_ec_burst_add, + .add = acpi_ec_add, .remove = acpi_ec_remove, .start = acpi_ec_start, .stop = acpi_ec_stop, }, }; -union acpi_ec { - struct { - u32 mode; - acpi_handle handle; - unsigned long uid; - unsigned long gpe_bit; - struct acpi_generic_address status_addr; - struct acpi_generic_address command_addr; - struct acpi_generic_address data_addr; - unsigned long global_lock; - } common; - - struct { - u32 mode; - acpi_handle handle; - unsigned long uid; - unsigned long gpe_bit; - struct acpi_generic_address status_addr; - struct acpi_generic_address command_addr; - struct acpi_generic_address data_addr; - unsigned long global_lock; - unsigned int expect_event; - atomic_t leaving_burst; /* 0 : No, 1 : Yes, 2: abort*/ - atomic_t pending_gpe; - struct semaphore sem; - wait_queue_head_t wait; - }burst; - - struct { - u32 mode; - acpi_handle handle; - unsigned long uid; - unsigned long gpe_bit; - struct acpi_generic_address status_addr; - struct acpi_generic_address command_addr; - struct acpi_generic_address data_addr; - unsigned long global_lock; - spinlock_t lock; - }polling; -}; -static int acpi_ec_polling_wait ( union acpi_ec *ec, u8 event); -static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event); -static int acpi_ec_polling_read ( union acpi_ec *ec, u8 address, u32 *data); -static int acpi_ec_burst_read( union acpi_ec *ec, u8 address, u32 *data); -static int acpi_ec_polling_write ( union acpi_ec *ec, u8 address, u8 data); -static int acpi_ec_burst_write ( union acpi_ec *ec, u8 address, u8 data); -static int acpi_ec_polling_query ( union acpi_ec *ec, u32 *data); -static int acpi_ec_burst_query ( union acpi_ec *ec, u32 *data); -static void acpi_ec_gpe_polling_query ( void *ec_cxt); -static void acpi_ec_gpe_burst_query ( void *ec_cxt); -static u32 acpi_ec_gpe_polling_handler ( void *data); -static u32 acpi_ec_gpe_burst_handler ( void *data); -static acpi_status __init -acpi_fake_ecdt_polling_callback ( - acpi_handle handle, - u32 Level, - void *context, - void **retval); - -static acpi_status __init -acpi_fake_ecdt_burst_callback ( - acpi_handle handle, - u32 Level, - void *context, - void **retval); +struct acpi_ec { + acpi_handle handle; + unsigned long uid; + unsigned long gpe_bit; + struct acpi_generic_address status_addr; + struct acpi_generic_address command_addr; + struct acpi_generic_address data_addr; + unsigned long global_lock; + unsigned int expect_event; + atomic_t leaving_burst; /* 0 : No, 1 : Yes, 2: abort*/ + atomic_t pending_gpe; + struct semaphore sem; + wait_queue_head_t wait; +}; -static int __init -acpi_ec_polling_get_real_ecdt(void); -static int __init -acpi_ec_burst_get_real_ecdt(void); /* If we find an EC via the ECDT, we need to keep a ptr to its context */ -static union acpi_ec *ec_ecdt; +static struct acpi_ec *ec_ecdt; /* External interfaces use first EC only, so remember */ static struct acpi_device *first_ec; -static int acpi_ec_polling_mode; /* -------------------------------------------------------------------------- Transaction Management -------------------------------------------------------------------------- */ -static inline u32 acpi_ec_read_status(union acpi_ec *ec) +static inline u32 acpi_ec_read_status(struct acpi_ec *ec) { u32 status = 0; - acpi_hw_low_level_read(8, &status, &ec->common.status_addr); + acpi_hw_low_level_read(8, &status, &ec->status_addr); return status; } -static int -acpi_ec_wait ( - union acpi_ec *ec, - u8 event) -{ - if (acpi_ec_polling_mode) - return acpi_ec_polling_wait (ec, event); - else - return acpi_ec_burst_wait (ec, event); -} - -static int -acpi_ec_polling_wait ( - union acpi_ec *ec, - u8 event) -{ - u32 acpi_ec_status = 0; - u32 i = ACPI_EC_UDELAY_COUNT; - - if (!ec) - return -EINVAL; - - /* Poll the EC status register waiting for the event to occur. */ - switch (event) { - case ACPI_EC_EVENT_OBF: - do { - acpi_hw_low_level_read(8, &acpi_ec_status, &ec->common.status_addr); - if (acpi_ec_status & ACPI_EC_FLAG_OBF) - return 0; - udelay(ACPI_EC_UDELAY); - } while (--i>0); - break; - case ACPI_EC_EVENT_IBE: - do { - acpi_hw_low_level_read(8, &acpi_ec_status, &ec->common.status_addr); - if (!(acpi_ec_status & ACPI_EC_FLAG_IBF)) - return 0; - udelay(ACPI_EC_UDELAY); - } while (--i>0); - break; - default: - return -EINVAL; - } - - return -ETIME; -} -static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event) +static int acpi_ec_wait(struct acpi_ec *ec, unsigned int event) { int result = 0; ACPI_FUNCTION_TRACE("acpi_ec_wait"); - ec->burst.expect_event = event; + ec->expect_event = event; smp_mb(); - result = wait_event_interruptible_timeout(ec->burst.wait, - !ec->burst.expect_event, + result = wait_event_interruptible_timeout(ec->wait, + !ec->expect_event, msecs_to_jiffies(ACPI_EC_DELAY)); - ec->burst.expect_event = 0; + ec->expect_event = 0; smp_mb(); if (result < 0){ @@ -269,7 +160,7 @@ static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event) static int acpi_ec_enter_burst_mode ( - union acpi_ec *ec) + struct acpi_ec *ec) { u32 tmp = 0; int status = 0; @@ -279,43 +170,43 @@ acpi_ec_enter_burst_mode ( status = acpi_ec_read_status(ec); if (status != -EINVAL && !(status & ACPI_EC_FLAG_BURST)){ - acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->common.command_addr); + acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->command_addr); status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); if (status){ - acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); + acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); return_VALUE(-EINVAL); } - acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr); - acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); + acpi_hw_low_level_read(8, &tmp, &ec->data_addr); + acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); if(tmp != 0x90 ) {/* Burst ACK byte*/ return_VALUE(-EINVAL); } } - atomic_set(&ec->burst.leaving_burst , 0); + atomic_set(&ec->leaving_burst , 0); return_VALUE(0); } static int acpi_ec_leave_burst_mode ( - union acpi_ec *ec) + struct acpi_ec *ec) { int status =0; ACPI_FUNCTION_TRACE("acpi_ec_leave_burst_mode"); - atomic_set(&ec->burst.leaving_burst , 1); + atomic_set(&ec->leaving_burst , 1); status = acpi_ec_read_status(ec); if (status != -EINVAL && (status & ACPI_EC_FLAG_BURST)){ - acpi_hw_low_level_write(8, ACPI_EC_BURST_DISABLE, &ec->common.command_addr); + acpi_hw_low_level_write(8, ACPI_EC_BURST_DISABLE, &ec->command_addr); status = acpi_ec_wait(ec, ACPI_EC_FLAG_IBF); if (status){ - acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); + acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"------->wait fail\n")); return_VALUE(-EINVAL); } - acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); + acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); status = acpi_ec_read_status(ec); } @@ -324,131 +215,7 @@ acpi_ec_leave_burst_mode ( static int acpi_ec_read ( - union acpi_ec *ec, - u8 address, - u32 *data) -{ - if (acpi_ec_polling_mode) - return acpi_ec_polling_read(ec, address, data); - else - return acpi_ec_burst_read(ec, address, data); -} -static int -acpi_ec_write ( - union acpi_ec *ec, - u8 address, - u8 data) -{ - if (acpi_ec_polling_mode) - return acpi_ec_polling_write(ec, address, data); - else - return acpi_ec_burst_write(ec, address, data); -} -static int -acpi_ec_polling_read ( - union acpi_ec *ec, - u8 address, - u32 *data) -{ - acpi_status status = AE_OK; - int result = 0; - unsigned long flags = 0; - u32 glk = 0; - - ACPI_FUNCTION_TRACE("acpi_ec_read"); - - if (!ec || !data) - return_VALUE(-EINVAL); - - *data = 0; - - if (ec->common.global_lock) { - status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); - if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); - } - - spin_lock_irqsave(&ec->polling.lock, flags); - - acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->common.command_addr); - result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); - if (result) - goto end; - - acpi_hw_low_level_write(8, address, &ec->common.data_addr); - result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); - if (result) - goto end; - - acpi_hw_low_level_read(8, data, &ec->common.data_addr); - - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n", - *data, address)); - -end: - spin_unlock_irqrestore(&ec->polling.lock, flags); - - if (ec->common.global_lock) - acpi_release_global_lock(glk); - - return_VALUE(result); -} - - -static int -acpi_ec_polling_write ( - union acpi_ec *ec, - u8 address, - u8 data) -{ - int result = 0; - acpi_status status = AE_OK; - unsigned long flags = 0; - u32 glk = 0; - - ACPI_FUNCTION_TRACE("acpi_ec_write"); - - if (!ec) - return_VALUE(-EINVAL); - - if (ec->common.global_lock) { - status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); - if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); - } - - spin_lock_irqsave(&ec->polling.lock, flags); - - acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->common.command_addr); - result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); - if (result) - goto end; - - acpi_hw_low_level_write(8, address, &ec->common.data_addr); - result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); - if (result) - goto end; - - acpi_hw_low_level_write(8, data, &ec->common.data_addr); - result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); - if (result) - goto end; - - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Wrote [%02x] to address [%02x]\n", - data, address)); - -end: - spin_unlock_irqrestore(&ec->polling.lock, flags); - - if (ec->common.global_lock) - acpi_release_global_lock(glk); - - return_VALUE(result); -} - -static int -acpi_ec_burst_read ( - union acpi_ec *ec, + struct acpi_ec *ec, u8 address, u32 *data) { @@ -463,51 +230,51 @@ acpi_ec_burst_read ( retry: *data = 0; - if (ec->common.global_lock) { + if (ec->global_lock) { status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); if (ACPI_FAILURE(status)) return_VALUE(-ENODEV); } WARN_ON(in_interrupt()); - down(&ec->burst.sem); + down(&ec->sem); if(acpi_ec_enter_burst_mode(ec)) goto end; - acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->common.command_addr); + acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->command_addr); status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); - acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); + acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); if (status) { goto end; } - acpi_hw_low_level_write(8, address, &ec->common.data_addr); + acpi_hw_low_level_write(8, address, &ec->data_addr); status= acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); if (status){ - acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); + acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); goto end; } - acpi_hw_low_level_read(8, data, &ec->common.data_addr); - acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); + acpi_hw_low_level_read(8, data, &ec->data_addr); + acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n", *data, address)); end: acpi_ec_leave_burst_mode(ec); - up(&ec->burst.sem); + up(&ec->sem); - if (ec->common.global_lock) + if (ec->global_lock) acpi_release_global_lock(glk); - if(atomic_read(&ec->burst.leaving_burst) == 2){ + if(atomic_read(&ec->leaving_burst) == 2){ ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n")); - while(atomic_read(&ec->burst.pending_gpe)){ + while(atomic_read(&ec->pending_gpe)){ msleep(1); } - acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); + acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); goto retry; } @@ -516,8 +283,8 @@ acpi_ec_burst_read ( static int -acpi_ec_burst_write ( - union acpi_ec *ec, +acpi_ec_write ( + struct acpi_ec *ec, u8 address, u8 data) { @@ -530,14 +297,14 @@ acpi_ec_burst_write ( if (!ec) return_VALUE(-EINVAL); retry: - if (ec->common.global_lock) { + if (ec->global_lock) { status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); if (ACPI_FAILURE(status)) return_VALUE(-ENODEV); } WARN_ON(in_interrupt()); - down(&ec->burst.sem); + down(&ec->sem); if(acpi_ec_enter_burst_mode(ec)) goto end; @@ -545,33 +312,33 @@ acpi_ec_burst_write ( status = acpi_ec_read_status(ec); if (status != -EINVAL && !(status & ACPI_EC_FLAG_BURST)){ - acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->common.command_addr); + acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->command_addr); status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); if (status) goto end; - acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr); + acpi_hw_low_level_read(8, &tmp, &ec->data_addr); if(tmp != 0x90 ) /* Burst ACK byte*/ goto end; } /*Now we are in burst mode*/ - acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->common.command_addr); + acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->command_addr); status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); - acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); + acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); if (status){ goto end; } - acpi_hw_low_level_write(8, address, &ec->common.data_addr); + acpi_hw_low_level_write(8, address, &ec->data_addr); status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); if (status){ - acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); + acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); goto end; } - acpi_hw_low_level_write(8, data, &ec->common.data_addr); + acpi_hw_low_level_write(8, data, &ec->data_addr); status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); - acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); + acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); if (status) goto end; @@ -580,17 +347,17 @@ acpi_ec_burst_write ( end: acpi_ec_leave_burst_mode(ec); - up(&ec->burst.sem); + up(&ec->sem); - if (ec->common.global_lock) + if (ec->global_lock) acpi_release_global_lock(glk); - if(atomic_read(&ec->burst.leaving_burst) == 2){ + if(atomic_read(&ec->leaving_burst) == 2){ ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n")); - while(atomic_read(&ec->burst.pending_gpe)){ + while(atomic_read(&ec->pending_gpe)){ msleep(1); } - acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); + acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); goto retry; } @@ -603,7 +370,7 @@ acpi_ec_burst_write ( int ec_read(u8 addr, u8 *val) { - union acpi_ec *ec; + struct acpi_ec *ec; int err; u32 temp_data; @@ -626,7 +393,7 @@ EXPORT_SYMBOL(ec_read); int ec_write(u8 addr, u8 val) { - union acpi_ec *ec; + struct acpi_ec *ec; int err; if (!first_ec) @@ -640,66 +407,10 @@ ec_write(u8 addr, u8 val) } EXPORT_SYMBOL(ec_write); -static int -acpi_ec_query ( - union acpi_ec *ec, - u32 *data) -{ - if (acpi_ec_polling_mode) - return acpi_ec_polling_query(ec, data); - else - return acpi_ec_burst_query(ec, data); -} -static int -acpi_ec_polling_query ( - union acpi_ec *ec, - u32 *data) -{ - int result = 0; - acpi_status status = AE_OK; - unsigned long flags = 0; - u32 glk = 0; - - ACPI_FUNCTION_TRACE("acpi_ec_query"); - - if (!ec || !data) - return_VALUE(-EINVAL); - - *data = 0; - - if (ec->common.global_lock) { - status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); - if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); - } - - /* - * Query the EC to find out which _Qxx method we need to evaluate. - * Note that successful completion of the query causes the ACPI_EC_SCI - * bit to be cleared (and thus clearing the interrupt source). - */ - spin_lock_irqsave(&ec->polling.lock, flags); - - acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->common.command_addr); - result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); - if (result) - goto end; - - acpi_hw_low_level_read(8, data, &ec->common.data_addr); - if (!*data) - result = -ENODATA; - -end: - spin_unlock_irqrestore(&ec->polling.lock, flags); - if (ec->common.global_lock) - acpi_release_global_lock(glk); - - return_VALUE(result); -} static int -acpi_ec_burst_query ( - union acpi_ec *ec, +acpi_ec_query ( + struct acpi_ec *ec, u32 *data) { int status = 0; @@ -711,13 +422,13 @@ acpi_ec_burst_query ( return_VALUE(-EINVAL); *data = 0; - if (ec->common.global_lock) { + if (ec->global_lock) { status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); if (ACPI_FAILURE(status)) return_VALUE(-ENODEV); } - down(&ec->burst.sem); + down(&ec->sem); if(acpi_ec_enter_burst_mode(ec)) goto end; /* @@ -725,28 +436,28 @@ acpi_ec_burst_query ( * Note that successful completion of the query causes the ACPI_EC_SCI * bit to be cleared (and thus clearing the interrupt source). */ - acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->common.command_addr); + acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->command_addr); status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); if (status){ - acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); + acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); goto end; } - acpi_hw_low_level_read(8, data, &ec->common.data_addr); - acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); + acpi_hw_low_level_read(8, data, &ec->data_addr); + acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); if (!*data) status = -ENODATA; end: acpi_ec_leave_burst_mode(ec); - up(&ec->burst.sem); + up(&ec->sem); - if (ec->common.global_lock) + if (ec->global_lock) acpi_release_global_lock(glk); - if(atomic_read(&ec->burst.leaving_burst) == 2){ + if(atomic_read(&ec->leaving_burst) == 2){ ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n")); - acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); + acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); status = -ENODATA; } return_VALUE(status); @@ -757,7 +468,7 @@ acpi_ec_burst_query ( Event Management -------------------------------------------------------------------------- */ -union acpi_ec_query_data { +struct acpi_ec_query_data { acpi_handle handle; u8 data; }; @@ -766,59 +477,7 @@ static void acpi_ec_gpe_query ( void *ec_cxt) { - if (acpi_ec_polling_mode) - acpi_ec_gpe_polling_query(ec_cxt); - else - acpi_ec_gpe_burst_query(ec_cxt); -} - -static void -acpi_ec_gpe_polling_query ( - void *ec_cxt) -{ - union acpi_ec *ec = (union acpi_ec *) ec_cxt; - u32 value = 0; - unsigned long flags = 0; - static char object_name[5] = {'_','Q','0','0','\0'}; - const char hex[] = {'0','1','2','3','4','5','6','7', - '8','9','A','B','C','D','E','F'}; - - ACPI_FUNCTION_TRACE("acpi_ec_gpe_query"); - - if (!ec_cxt) - goto end; - - spin_lock_irqsave(&ec->polling.lock, flags); - acpi_hw_low_level_read(8, &value, &ec->common.command_addr); - spin_unlock_irqrestore(&ec->polling.lock, flags); - - /* TBD: Implement asynch events! - * NOTE: All we care about are EC-SCI's. Other EC events are - * handled via polling (yuck!). This is because some systems - * treat EC-SCIs as level (versus EDGE!) triggered, preventing - * a purely interrupt-driven approach (grumble, grumble). - */ - if (!(value & ACPI_EC_FLAG_SCI)) - goto end; - - if (acpi_ec_query(ec, &value)) - goto end; - - object_name[2] = hex[((value >> 4) & 0x0F)]; - object_name[3] = hex[(value & 0x0F)]; - - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluating %s\n", object_name)); - - acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL); - -end: - acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); -} -static void -acpi_ec_gpe_burst_query ( - void *ec_cxt) -{ - union acpi_ec *ec = (union acpi_ec *) ec_cxt; + struct acpi_ec *ec = (struct acpi_ec *) ec_cxt; u32 value; int result = -ENODATA; static char object_name[5] = {'_','Q','0','0','\0'}; @@ -838,87 +497,58 @@ acpi_ec_gpe_burst_query ( ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluating %s\n", object_name)); - acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL); + acpi_evaluate_object(ec->handle, object_name, NULL, NULL); end: - atomic_dec(&ec->burst.pending_gpe); + atomic_dec(&ec->pending_gpe); return; } static u32 acpi_ec_gpe_handler ( void *data) -{ - if (acpi_ec_polling_mode) - return acpi_ec_gpe_polling_handler(data); - else - return acpi_ec_gpe_burst_handler(data); -} -static u32 -acpi_ec_gpe_polling_handler ( - void *data) -{ - acpi_status status = AE_OK; - union acpi_ec *ec = (union acpi_ec *) data; - - if (!ec) - return ACPI_INTERRUPT_NOT_HANDLED; - - acpi_disable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); - - status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, - acpi_ec_gpe_query, ec); - - if (status == AE_OK) - return ACPI_INTERRUPT_HANDLED; - else - return ACPI_INTERRUPT_NOT_HANDLED; -} -static u32 -acpi_ec_gpe_burst_handler ( - void *data) { acpi_status status = AE_OK; u32 value; - union acpi_ec *ec = (union acpi_ec *) data; + struct acpi_ec *ec = (struct acpi_ec *) data; if (!ec) return ACPI_INTERRUPT_NOT_HANDLED; - acpi_disable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); + acpi_disable_gpe(NULL, ec->gpe_bit, ACPI_ISR); value = acpi_ec_read_status(ec); if((value & ACPI_EC_FLAG_IBF) && !(value & ACPI_EC_FLAG_BURST) && - (atomic_read(&ec->burst.leaving_burst) == 0)) { + (atomic_read(&ec->leaving_burst) == 0)) { /* * the embedded controller disables * burst mode for any reason other * than the burst disable command * to process critical event. */ - atomic_set(&ec->burst.leaving_burst , 2); /* block current pending transaction + atomic_set(&ec->leaving_burst , 2); /* block current pending transaction and retry */ - wake_up(&ec->burst.wait); + wake_up(&ec->wait); }else { - if ((ec->burst.expect_event == ACPI_EC_EVENT_OBF && + if ((ec->expect_event == ACPI_EC_EVENT_OBF && (value & ACPI_EC_FLAG_OBF)) || - (ec->burst.expect_event == ACPI_EC_EVENT_IBE && + (ec->expect_event == ACPI_EC_EVENT_IBE && !(value & ACPI_EC_FLAG_IBF))) { - ec->burst.expect_event = 0; - wake_up(&ec->burst.wait); + ec->expect_event = 0; + wake_up(&ec->wait); return ACPI_INTERRUPT_HANDLED; } } if (value & ACPI_EC_FLAG_SCI){ - atomic_add(1, &ec->burst.pending_gpe) ; + atomic_add(1, &ec->pending_gpe) ; status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, acpi_ec_gpe_query, ec); return status == AE_OK ? ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; } - acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); + acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_ISR); return status == AE_OK ? ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; } @@ -955,7 +585,7 @@ acpi_ec_space_handler ( void *region_context) { int result = 0; - union acpi_ec *ec = NULL; + struct acpi_ec *ec = NULL; u64 temp = *value; acpi_integer f_v = 0; int i = 0; @@ -970,7 +600,7 @@ acpi_ec_space_handler ( return_VALUE(AE_BAD_PARAMETER); } - ec = (union acpi_ec *) handler_context; + ec = (struct acpi_ec *) handler_context; next_byte: switch (function) { @@ -1031,7 +661,7 @@ static struct proc_dir_entry *acpi_ec_dir; static int acpi_ec_read_info (struct seq_file *seq, void *offset) { - union acpi_ec *ec = (union acpi_ec *) seq->private; + struct acpi_ec *ec = (struct acpi_ec *) seq->private; ACPI_FUNCTION_TRACE("acpi_ec_read_info"); @@ -1039,12 +669,12 @@ acpi_ec_read_info (struct seq_file *seq, void *offset) goto end; seq_printf(seq, "gpe bit: 0x%02x\n", - (u32) ec->common.gpe_bit); + (u32) ec->gpe_bit); seq_printf(seq, "ports: 0x%02x, 0x%02x\n", - (u32) ec->common.status_addr.address, (u32) ec->common.data_addr.address); + (u32) ec->status_addr.address, (u32) ec->data_addr.address); seq_printf(seq, "use global lock: %s\n", - ec->common.global_lock?"yes":"no"); - acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); + ec->global_lock?"yes":"no"); + acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); end: return_VALUE(0); @@ -1067,7 +697,7 @@ static int acpi_ec_add_fs ( struct acpi_device *device) { - struct proc_dir_entry *entry = NULL; + struct proc_dir_entry *entry; ACPI_FUNCTION_TRACE("acpi_ec_add_fs"); @@ -1114,82 +744,13 @@ acpi_ec_remove_fs ( Driver Interface -------------------------------------------------------------------------- */ - -static int -acpi_ec_polling_add ( - struct acpi_device *device) -{ - int result = 0; - acpi_status status = AE_OK; - union acpi_ec *ec = NULL; - unsigned long uid; - - ACPI_FUNCTION_TRACE("acpi_ec_add"); - - if (!device) - return_VALUE(-EINVAL); - - ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); - if (!ec) - return_VALUE(-ENOMEM); - memset(ec, 0, sizeof(union acpi_ec)); - - ec->common.handle = device->handle; - ec->common.uid = -1; - spin_lock_init(&ec->polling.lock); - strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); - strcpy(acpi_device_class(device), ACPI_EC_CLASS); - acpi_driver_data(device) = ec; - - /* Use the global lock for all EC transactions? */ - acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, &ec->common.global_lock); - - /* If our UID matches the UID for the ECDT-enumerated EC, - we now have the *real* EC info, so kill the makeshift one.*/ - acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid); - if (ec_ecdt && ec_ecdt->common.uid == uid) { - acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, - ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); - - acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit, &acpi_ec_gpe_handler); - - kfree(ec_ecdt); - } - - /* Get GPE bit assignment (EC events). */ - /* TODO: Add support for _GPE returning a package */ - status = acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, &ec->common.gpe_bit); - if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error obtaining GPE bit assignment\n")); - result = -ENODEV; - goto end; - } - - result = acpi_ec_add_fs(device); - if (result) - goto end; - - printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n", - acpi_device_name(device), acpi_device_bid(device), - (u32) ec->common.gpe_bit); - - if (!first_ec) - first_ec = device; - -end: - if (result) - kfree(ec); - - return_VALUE(result); -} static int -acpi_ec_burst_add ( +acpi_ec_add ( struct acpi_device *device) { - int result = 0; - acpi_status status = AE_OK; - union acpi_ec *ec = NULL; + int result; + acpi_status status; + struct acpi_ec *ec; unsigned long uid; ACPI_FUNCTION_TRACE("acpi_ec_add"); @@ -1197,39 +758,39 @@ acpi_ec_burst_add ( if (!device) return_VALUE(-EINVAL); - ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); + ec = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL); if (!ec) return_VALUE(-ENOMEM); - memset(ec, 0, sizeof(union acpi_ec)); - - ec->common.handle = device->handle; - ec->common.uid = -1; - atomic_set(&ec->burst.pending_gpe, 0); - atomic_set(&ec->burst.leaving_burst , 1); - init_MUTEX(&ec->burst.sem); - init_waitqueue_head(&ec->burst.wait); + memset(ec, 0, sizeof(struct acpi_ec)); + + ec->handle = device->handle; + ec->uid = -1; + atomic_set(&ec->pending_gpe, 0); + atomic_set(&ec->leaving_burst , 1); + init_MUTEX(&ec->sem); + init_waitqueue_head(&ec->wait); strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); strcpy(acpi_device_class(device), ACPI_EC_CLASS); acpi_driver_data(device) = ec; /* Use the global lock for all EC transactions? */ - acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, &ec->common.global_lock); + acpi_evaluate_integer(ec->handle, "_GLK", NULL, &ec->global_lock); /* If our UID matches the UID for the ECDT-enumerated EC, we now have the *real* EC info, so kill the makeshift one.*/ - acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid); - if (ec_ecdt && ec_ecdt->common.uid == uid) { + acpi_evaluate_integer(ec->handle, "_UID", NULL, &uid); + if (ec_ecdt && ec_ecdt->uid == uid) { acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); - acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit, &acpi_ec_gpe_handler); + acpi_remove_gpe_handler(NULL, ec_ecdt->gpe_bit, &acpi_ec_gpe_handler); kfree(ec_ecdt); } /* Get GPE bit assignment (EC events). */ /* TODO: Add support for _GPE returning a package */ - status = acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, &ec->common.gpe_bit); + status = acpi_evaluate_integer(ec->handle, "_GPE", NULL, &ec->gpe_bit); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error obtaining GPE bit assignment\n")); @@ -1243,7 +804,7 @@ acpi_ec_burst_add ( printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n", acpi_device_name(device), acpi_device_bid(device), - (u32) ec->common.gpe_bit); + (u32) ec->gpe_bit); if (!first_ec) first_ec = device; @@ -1261,7 +822,7 @@ acpi_ec_remove ( struct acpi_device *device, int type) { - union acpi_ec *ec = NULL; + struct acpi_ec *ec; ACPI_FUNCTION_TRACE("acpi_ec_remove"); @@ -1283,7 +844,7 @@ acpi_ec_io_ports ( struct acpi_resource *resource, void *context) { - union acpi_ec *ec = (union acpi_ec *) context; + struct acpi_ec *ec = (struct acpi_ec *) context; struct acpi_generic_address *addr; if (resource->id != ACPI_RSTYPE_IO) { @@ -1295,10 +856,10 @@ acpi_ec_io_ports ( * the second address region returned is the status/command * port. */ - if (ec->common.data_addr.register_bit_width == 0) { - addr = &ec->common.data_addr; - } else if (ec->common.command_addr.register_bit_width == 0) { - addr = &ec->common.command_addr; + if (ec->data_addr.register_bit_width == 0) { + addr = &ec->data_addr; + } else if (ec->command_addr.register_bit_width == 0) { + addr = &ec->command_addr; } else { return AE_CTRL_TERMINATE; } @@ -1316,8 +877,8 @@ static int acpi_ec_start ( struct acpi_device *device) { - acpi_status status = AE_OK; - union acpi_ec *ec = NULL; + acpi_status status; + struct acpi_ec *ec; ACPI_FUNCTION_TRACE("acpi_ec_start"); @@ -1332,36 +893,35 @@ acpi_ec_start ( /* * Get I/O port addresses. Convert to GAS format. */ - status = acpi_walk_resources(ec->common.handle, METHOD_NAME__CRS, + status = acpi_walk_resources(ec->handle, METHOD_NAME__CRS, acpi_ec_io_ports, ec); - if (ACPI_FAILURE(status) || ec->common.command_addr.register_bit_width == 0) { + if (ACPI_FAILURE(status) || ec->command_addr.register_bit_width == 0) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error getting I/O port addresses")); return_VALUE(-ENODEV); } - ec->common.status_addr = ec->common.command_addr; + ec->status_addr = ec->command_addr; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "gpe=0x%02x, ports=0x%2x,0x%2x\n", - (u32) ec->common.gpe_bit, (u32) ec->common.command_addr.address, - (u32) ec->common.data_addr.address)); - + (u32) ec->gpe_bit, (u32) ec->command_addr.address, + (u32) ec->data_addr.address)); /* * Install GPE handler */ - status = acpi_install_gpe_handler(NULL, ec->common.gpe_bit, + status = acpi_install_gpe_handler(NULL, ec->gpe_bit, ACPI_GPE_EDGE_TRIGGERED, &acpi_ec_gpe_handler, ec); if (ACPI_FAILURE(status)) { return_VALUE(-ENODEV); } - acpi_set_gpe_type (NULL, ec->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME); - acpi_enable_gpe (NULL, ec->common.gpe_bit, ACPI_NOT_ISR); + acpi_set_gpe_type (NULL, ec->gpe_bit, ACPI_GPE_TYPE_RUNTIME); + acpi_enable_gpe (NULL, ec->gpe_bit, ACPI_NOT_ISR); - status = acpi_install_address_space_handler (ec->common.handle, + status = acpi_install_address_space_handler (ec->handle, ACPI_ADR_SPACE_EC, &acpi_ec_space_handler, &acpi_ec_space_setup, ec); if (ACPI_FAILURE(status)) { - acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, &acpi_ec_gpe_handler); + acpi_remove_gpe_handler(NULL, ec->gpe_bit, &acpi_ec_gpe_handler); return_VALUE(-ENODEV); } @@ -1374,8 +934,8 @@ acpi_ec_stop ( struct acpi_device *device, int type) { - acpi_status status = AE_OK; - union acpi_ec *ec = NULL; + acpi_status status; + struct acpi_ec *ec; ACPI_FUNCTION_TRACE("acpi_ec_stop"); @@ -1384,12 +944,12 @@ acpi_ec_stop ( ec = acpi_driver_data(device); - status = acpi_remove_address_space_handler(ec->common.handle, + status = acpi_remove_address_space_handler(ec->handle, ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); if (ACPI_FAILURE(status)) return_VALUE(-ENODEV); - status = acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, &acpi_ec_gpe_handler); + status = acpi_remove_gpe_handler(NULL, ec->gpe_bit, &acpi_ec_gpe_handler); if (ACPI_FAILURE(status)) return_VALUE(-ENODEV); @@ -1403,76 +963,26 @@ acpi_fake_ecdt_callback ( void *context, void **retval) { - - if (acpi_ec_polling_mode) - return acpi_fake_ecdt_polling_callback(handle, - Level, context, retval); - else - return acpi_fake_ecdt_burst_callback(handle, - Level, context, retval); -} - -static acpi_status __init -acpi_fake_ecdt_polling_callback ( - acpi_handle handle, - u32 Level, - void *context, - void **retval) -{ - acpi_status status; - - status = acpi_walk_resources(handle, METHOD_NAME__CRS, - acpi_ec_io_ports, ec_ecdt); - if (ACPI_FAILURE(status)) - return status; - ec_ecdt->common.status_addr = ec_ecdt->common.command_addr; - - ec_ecdt->common.uid = -1; - acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->common.uid); - - status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->common.gpe_bit); - if (ACPI_FAILURE(status)) - return status; - spin_lock_init(&ec_ecdt->polling.lock); - ec_ecdt->common.global_lock = TRUE; - ec_ecdt->common.handle = handle; - - printk(KERN_INFO PREFIX "GPE=0x%02x, ports=0x%2x, 0x%2x\n", - (u32) ec_ecdt->common.gpe_bit, (u32) ec_ecdt->common.command_addr.address, - (u32) ec_ecdt->common.data_addr.address); - - return AE_CTRL_TERMINATE; -} - -static acpi_status __init -acpi_fake_ecdt_burst_callback ( - acpi_handle handle, - u32 Level, - void *context, - void **retval) -{ acpi_status status; - init_MUTEX(&ec_ecdt->burst.sem); - init_waitqueue_head(&ec_ecdt->burst.wait); status = acpi_walk_resources(handle, METHOD_NAME__CRS, acpi_ec_io_ports, ec_ecdt); if (ACPI_FAILURE(status)) return status; - ec_ecdt->common.status_addr = ec_ecdt->common.command_addr; + ec_ecdt->status_addr = ec_ecdt->command_addr; - ec_ecdt->common.uid = -1; - acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->common.uid); + ec_ecdt->uid = -1; + acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->uid); - status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->common.gpe_bit); + status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->gpe_bit); if (ACPI_FAILURE(status)) return status; - ec_ecdt->common.global_lock = TRUE; - ec_ecdt->common.handle = handle; + ec_ecdt->global_lock = TRUE; + ec_ecdt->handle = handle; printk(KERN_INFO PREFIX "GPE=0x%02x, ports=0x%2x, 0x%2x\n", - (u32) ec_ecdt->common.gpe_bit, (u32) ec_ecdt->common.command_addr.address, - (u32) ec_ecdt->common.data_addr.address); + (u32) ec_ecdt->gpe_bit, (u32) ec_ecdt->command_addr.address, + (u32) ec_ecdt->data_addr.address); return AE_CTRL_TERMINATE; } @@ -1495,12 +1005,12 @@ acpi_ec_fake_ecdt(void) printk(KERN_INFO PREFIX "Try to make an fake ECDT\n"); - ec_ecdt = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); + ec_ecdt = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL); if (!ec_ecdt) { ret = -ENOMEM; goto error; } - memset(ec_ecdt, 0, sizeof(union acpi_ec)); + memset(ec_ecdt, 0, sizeof(struct acpi_ec)); status = acpi_get_devices (ACPI_EC_HID, acpi_fake_ecdt_callback, @@ -1520,60 +1030,6 @@ acpi_ec_fake_ecdt(void) static int __init acpi_ec_get_real_ecdt(void) -{ - if (acpi_ec_polling_mode) - return acpi_ec_polling_get_real_ecdt(); - else - return acpi_ec_burst_get_real_ecdt(); -} - -static int __init -acpi_ec_polling_get_real_ecdt(void) -{ - acpi_status status; - struct acpi_table_ecdt *ecdt_ptr; - - status = acpi_get_firmware_table("ECDT", 1, ACPI_LOGICAL_ADDRESSING, - (struct acpi_table_header **) &ecdt_ptr); - if (ACPI_FAILURE(status)) - return -ENODEV; - - printk(KERN_INFO PREFIX "Found ECDT\n"); - - /* - * Generate a temporary ec context to use until the namespace is scanned - */ - ec_ecdt = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); - if (!ec_ecdt) - return -ENOMEM; - memset(ec_ecdt, 0, sizeof(union acpi_ec)); - - ec_ecdt->common.command_addr = ecdt_ptr->ec_control; - ec_ecdt->common.status_addr = ecdt_ptr->ec_control; - ec_ecdt->common.data_addr = ecdt_ptr->ec_data; - ec_ecdt->common.gpe_bit = ecdt_ptr->gpe_bit; - spin_lock_init(&ec_ecdt->polling.lock); - /* use the GL just to be safe */ - ec_ecdt->common.global_lock = TRUE; - ec_ecdt->common.uid = ecdt_ptr->uid; - - status = acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->common.handle); - if (ACPI_FAILURE(status)) { - goto error; - } - - return 0; -error: - printk(KERN_ERR PREFIX "Could not use ECDT\n"); - kfree(ec_ecdt); - ec_ecdt = NULL; - - return -ENODEV; -} - - -static int __init -acpi_ec_burst_get_real_ecdt(void) { acpi_status status; struct acpi_table_ecdt *ecdt_ptr; @@ -1588,22 +1044,22 @@ acpi_ec_burst_get_real_ecdt(void) /* * Generate a temporary ec context to use until the namespace is scanned */ - ec_ecdt = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); + ec_ecdt = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL); if (!ec_ecdt) return -ENOMEM; - memset(ec_ecdt, 0, sizeof(union acpi_ec)); - - init_MUTEX(&ec_ecdt->burst.sem); - init_waitqueue_head(&ec_ecdt->burst.wait); - ec_ecdt->common.command_addr = ecdt_ptr->ec_control; - ec_ecdt->common.status_addr = ecdt_ptr->ec_control; - ec_ecdt->common.data_addr = ecdt_ptr->ec_data; - ec_ecdt->common.gpe_bit = ecdt_ptr->gpe_bit; + memset(ec_ecdt, 0, sizeof(struct acpi_ec)); + + init_MUTEX(&ec_ecdt->sem); + init_waitqueue_head(&ec_ecdt->wait); + ec_ecdt->command_addr = ecdt_ptr->ec_control; + ec_ecdt->status_addr = ecdt_ptr->ec_control; + ec_ecdt->data_addr = ecdt_ptr->ec_data; + ec_ecdt->gpe_bit = ecdt_ptr->gpe_bit; /* use the GL just to be safe */ - ec_ecdt->common.global_lock = TRUE; - ec_ecdt->common.uid = ecdt_ptr->uid; + ec_ecdt->global_lock = TRUE; + ec_ecdt->uid = ecdt_ptr->uid; - status = acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->common.handle); + status = acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->handle); if (ACPI_FAILURE(status)) { goto error; } @@ -1636,20 +1092,20 @@ acpi_ec_ecdt_probe (void) /* * Install GPE handler */ - status = acpi_install_gpe_handler(NULL, ec_ecdt->common.gpe_bit, + status = acpi_install_gpe_handler(NULL, ec_ecdt->gpe_bit, ACPI_GPE_EDGE_TRIGGERED, &acpi_ec_gpe_handler, ec_ecdt); if (ACPI_FAILURE(status)) { goto error; } - acpi_set_gpe_type (NULL, ec_ecdt->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME); - acpi_enable_gpe (NULL, ec_ecdt->common.gpe_bit, ACPI_NOT_ISR); + acpi_set_gpe_type (NULL, ec_ecdt->gpe_bit, ACPI_GPE_TYPE_RUNTIME); + acpi_enable_gpe (NULL, ec_ecdt->gpe_bit, ACPI_NOT_ISR); status = acpi_install_address_space_handler (ACPI_ROOT_OBJECT, ACPI_ADR_SPACE_EC, &acpi_ec_space_handler, &acpi_ec_space_setup, ec_ecdt); if (ACPI_FAILURE(status)) { - acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit, + acpi_remove_gpe_handler(NULL, ec_ecdt->gpe_bit, &acpi_ec_gpe_handler); goto error; } @@ -1667,7 +1123,7 @@ acpi_ec_ecdt_probe (void) static int __init acpi_ec_init (void) { - int result = 0; + int result; ACPI_FUNCTION_TRACE("acpi_ec_init"); @@ -1711,10 +1167,3 @@ static int __init acpi_fake_ecdt_setup(char *str) return 0; } __setup("acpi_fake_ecdt", acpi_fake_ecdt_setup); -static int __init acpi_ec_set_polling_mode(char *str) -{ - acpi_ec_polling_mode = EC_POLLING; - acpi_ec_driver.ops.add = acpi_ec_polling_add; - return 0; -} -__setup("ec_polling", acpi_ec_set_polling_mode); diff --git a/trunk/drivers/acpi/pci_irq.c b/trunk/drivers/acpi/pci_irq.c index bb973d2109a1..d1f42b972821 100644 --- a/trunk/drivers/acpi/pci_irq.c +++ b/trunk/drivers/acpi/pci_irq.c @@ -269,51 +269,7 @@ acpi_pci_irq_del_prt (int segment, int bus) /* -------------------------------------------------------------------------- PCI Interrupt Routing Support -------------------------------------------------------------------------- */ -typedef int (*irq_lookup_func)(struct acpi_prt_entry *, int *, int *, char **); -static int -acpi_pci_allocate_irq(struct acpi_prt_entry *entry, - int *edge_level, - int *active_high_low, - char **link) -{ - int irq; - - ACPI_FUNCTION_TRACE("acpi_pci_allocate_irq"); - - if (entry->link.handle) { - irq = acpi_pci_link_allocate_irq(entry->link.handle, - entry->link.index, edge_level, active_high_low, link); - if (irq < 0) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid IRQ link routing entry\n")); - return_VALUE(-1); - } - } else { - irq = entry->link.index; - *edge_level = ACPI_LEVEL_SENSITIVE; - *active_high_low = ACPI_ACTIVE_LOW; - } - - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq)); - return_VALUE(irq); -} - -static int -acpi_pci_free_irq(struct acpi_prt_entry *entry, - int *edge_level, - int *active_high_low, - char **link) -{ - int irq; - - ACPI_FUNCTION_TRACE("acpi_pci_free_irq"); - if (entry->link.handle) { - irq = acpi_pci_link_free_irq(entry->link.handle); - } else { - irq = entry->link.index; - } - return_VALUE(irq); -} /* * acpi_pci_irq_lookup * success: return IRQ >= 0 @@ -326,13 +282,12 @@ acpi_pci_irq_lookup ( int pin, int *edge_level, int *active_high_low, - char **link, - irq_lookup_func func) + char **link) { struct acpi_prt_entry *entry = NULL; int segment = pci_domain_nr(bus); int bus_nr = bus->number; - int ret; + int irq; ACPI_FUNCTION_TRACE("acpi_pci_irq_lookup"); @@ -346,8 +301,22 @@ acpi_pci_irq_lookup ( return_VALUE(-1); } - ret = func(entry, edge_level, active_high_low, link); - return_VALUE(ret); + if (entry->link.handle) { + irq = acpi_pci_link_get_irq(entry->link.handle, + entry->link.index, edge_level, active_high_low, link); + if (irq < 0) { + ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid IRQ link routing entry\n")); + return_VALUE(-1); + } + } else { + irq = entry->link.index; + *edge_level = ACPI_LEVEL_SENSITIVE; + *active_high_low = ACPI_ACTIVE_LOW; + } + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq)); + + return_VALUE(irq); } /* @@ -361,8 +330,7 @@ acpi_pci_irq_derive ( int pin, int *edge_level, int *active_high_low, - char **link, - irq_lookup_func func) + char **link) { struct pci_dev *bridge = dev; int irq = -1; @@ -395,7 +363,7 @@ acpi_pci_irq_derive ( } irq = acpi_pci_irq_lookup(bridge->bus, PCI_SLOT(bridge->devfn), - pin, edge_level, active_high_low, link, func); + pin, edge_level, active_high_low, link); } if (irq < 0) { @@ -447,7 +415,7 @@ acpi_pci_irq_enable ( * values override any BIOS-assigned IRQs set during boot. */ irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, - &edge_level, &active_high_low, &link, acpi_pci_allocate_irq); + &edge_level, &active_high_low, &link); /* * If no PRT entry was found, we'll try to derive an IRQ from the @@ -455,7 +423,7 @@ acpi_pci_irq_enable ( */ if (irq < 0) irq = acpi_pci_irq_derive(dev, pin, &edge_level, - &active_high_low, &link, acpi_pci_allocate_irq); + &active_high_low, &link); /* * No IRQ known to the ACPI subsystem - maybe the BIOS / @@ -494,9 +462,7 @@ acpi_pci_irq_enable ( EXPORT_SYMBOL(acpi_pci_irq_enable); -/* FIXME: implement x86/x86_64 version */ -void __attribute__((weak)) acpi_unregister_gsi(u32 i) {} - +#ifdef CONFIG_ACPI_DEALLOCATE_IRQ void acpi_pci_irq_disable ( struct pci_dev *dev) @@ -523,14 +489,14 @@ acpi_pci_irq_disable ( * First we check the PCI IRQ routing table (PRT) for an IRQ. */ gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, - &edge_level, &active_high_low, NULL, acpi_pci_free_irq); + &edge_level, &active_high_low, NULL); /* * If no PRT entry was found, we'll try to derive an IRQ from the * device's parent bridge. */ if (gsi < 0) gsi = acpi_pci_irq_derive(dev, pin, - &edge_level, &active_high_low, NULL, acpi_pci_free_irq); + &edge_level, &active_high_low, NULL); if (gsi < 0) return_VOID; @@ -546,3 +512,4 @@ acpi_pci_irq_disable ( return_VOID; } +#endif /* CONFIG_ACPI_DEALLOCATE_IRQ */ diff --git a/trunk/drivers/acpi/pci_link.c b/trunk/drivers/acpi/pci_link.c index 6a29610edc11..6ad0e77df9b3 100644 --- a/trunk/drivers/acpi/pci_link.c +++ b/trunk/drivers/acpi/pci_link.c @@ -68,10 +68,6 @@ static struct acpi_driver acpi_pci_link_driver = { }, }; -/* - * If a link is initialized, we never change its active and initialized - * later even the link is disable. Instead, we just repick the active irq - */ struct acpi_pci_link_irq { u8 active; /* Current IRQ */ u8 edge_level; /* All IRQs */ @@ -80,7 +76,8 @@ struct acpi_pci_link_irq { u8 possible_count; u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; u8 initialized:1; - u8 reserved:7; + u8 suspend_resume:1; + u8 reserved:6; }; struct acpi_pci_link { @@ -88,14 +85,12 @@ struct acpi_pci_link { struct acpi_device *device; acpi_handle handle; struct acpi_pci_link_irq irq; - int refcnt; }; static struct { int count; struct list_head entries; } acpi_link; -DECLARE_MUTEX(acpi_link_lock); /* -------------------------------------------------------------------------- @@ -537,12 +532,12 @@ static int acpi_pci_link_allocate( ACPI_FUNCTION_TRACE("acpi_pci_link_allocate"); - if (link->irq.initialized) { - if (link->refcnt == 0) - /* This means the link is disabled but initialized */ - acpi_pci_link_set(link, link->irq.active); - return_VALUE(0); + if (link->irq.suspend_resume) { + acpi_pci_link_set(link, link->irq.active); + link->irq.suspend_resume = 0; } + if (link->irq.initialized) + return_VALUE(0); /* * search for active IRQ in list of possible IRQs. @@ -601,13 +596,13 @@ static int acpi_pci_link_allocate( } /* - * acpi_pci_link_allocate_irq + * acpi_pci_link_get_irq * success: return IRQ >= 0 * failure: return -1 */ int -acpi_pci_link_allocate_irq ( +acpi_pci_link_get_irq ( acpi_handle handle, int index, int *edge_level, @@ -618,7 +613,7 @@ acpi_pci_link_allocate_irq ( struct acpi_device *device = NULL; struct acpi_pci_link *link = NULL; - ACPI_FUNCTION_TRACE("acpi_pci_link_allocate_irq"); + ACPI_FUNCTION_TRACE("acpi_pci_link_get_irq"); result = acpi_bus_get_device(handle, &device); if (result) { @@ -638,70 +633,21 @@ acpi_pci_link_allocate_irq ( return_VALUE(-1); } - down(&acpi_link_lock); - if (acpi_pci_link_allocate(link)) { - up(&acpi_link_lock); + if (acpi_pci_link_allocate(link)) return_VALUE(-1); - } if (!link->irq.active) { - up(&acpi_link_lock); ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link active IRQ is 0!\n")); return_VALUE(-1); } - link->refcnt ++; - up(&acpi_link_lock); if (edge_level) *edge_level = link->irq.edge_level; if (active_high_low) *active_high_low = link->irq.active_high_low; if (name) *name = acpi_device_bid(link->device); - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Link %s is referenced\n", acpi_device_bid(link->device))); return_VALUE(link->irq.active); } -/* - * We don't change link's irq information here. After it is reenabled, we - * continue use the info - */ -int -acpi_pci_link_free_irq(acpi_handle handle) -{ - struct acpi_device *device = NULL; - struct acpi_pci_link *link = NULL; - acpi_status result; - - ACPI_FUNCTION_TRACE("acpi_pci_link_free_irq"); - - result = acpi_bus_get_device(handle, &device); - if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link device\n")); - return_VALUE(-1); - } - link = (struct acpi_pci_link *) acpi_driver_data(device); - if (!link) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n")); - return_VALUE(-1); - } - - down(&acpi_link_lock); - if (!link->irq.initialized) { - up(&acpi_link_lock); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link isn't initialized\n")); - return_VALUE(-1); - } - - link->refcnt --; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Link %s is dereferenced\n", acpi_device_bid(link->device))); - - if (link->refcnt == 0) { - acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); - } - up(&acpi_link_lock); - return_VALUE(link->irq.active); -} /* -------------------------------------------------------------------------- Driver Interface -------------------------------------------------------------------------- */ @@ -731,7 +677,6 @@ acpi_pci_link_add ( strcpy(acpi_device_class(device), ACPI_PCI_LINK_CLASS); acpi_driver_data(device) = link; - down(&acpi_link_lock); result = acpi_pci_link_get_possible(link); if (result) goto end; @@ -767,7 +712,6 @@ acpi_pci_link_add ( end: /* disable all links -- to be activated on use */ acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); - up(&acpi_link_lock); if (result) kfree(link); @@ -782,32 +726,19 @@ irqrouter_suspend( { struct list_head *node = NULL; struct acpi_pci_link *link = NULL; - int ret = 0; ACPI_FUNCTION_TRACE("irqrouter_suspend"); list_for_each(node, &acpi_link.entries) { link = list_entry(node, struct acpi_pci_link, node); if (!link) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid link context\n")); + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n")); continue; } - if (link->irq.initialized && link->refcnt != 0 - /* We ignore legacy IDE device irq */ - && link->irq.active != 14 && link->irq.active !=15) { - printk(KERN_WARNING PREFIX - "%d drivers with interrupt %d neglected to call" - " pci_disable_device at .suspend\n", - link->refcnt, - link->irq.active); - printk(KERN_WARNING PREFIX - "Fix the driver, or rmmod before suspend\n"); - link->refcnt = 0; - ret = -EINVAL; - } + if (link->irq.active && link->irq.initialized) + link->irq.suspend_resume = 1; } - return_VALUE(ret); + return_VALUE(0); } @@ -825,9 +756,8 @@ acpi_pci_link_remove ( link = (struct acpi_pci_link *) acpi_driver_data(device); - down(&acpi_link_lock); + /* TBD: Acquire/release lock */ list_del(&link->node); - up(&acpi_link_lock); kfree(link); @@ -919,7 +849,6 @@ int __init acpi_irq_balance_set(char *str) __setup("acpi_irq_balance", acpi_irq_balance_set); -/* FIXME: we will remove this interface after all drivers call pci_disable_device */ static struct sysdev_class irqrouter_sysdev_class = { set_kset_name("irqrouter"), .suspend = irqrouter_suspend, diff --git a/trunk/drivers/acpi/processor_idle.c b/trunk/drivers/acpi/processor_idle.c index af271d994f15..893b074e3d1a 100644 --- a/trunk/drivers/acpi/processor_idle.c +++ b/trunk/drivers/acpi/processor_idle.c @@ -81,33 +81,30 @@ module_param(bm_history, uint, 0644); * * To skip this limit, boot/load with a large max_cstate limit. */ -static int set_max_cstate(struct dmi_system_id *id) +static int no_c2c3(struct dmi_system_id *id) { if (max_cstate > ACPI_PROCESSOR_MAX_POWER) return 0; - printk(KERN_NOTICE PREFIX "%s detected - %s disabled." + printk(KERN_NOTICE PREFIX "%s detected - C2,C3 disabled." " Override with \"processor.max_cstate=%d\"\n", id->ident, - ((int)id->driver_data == 1)? "C2,C3":"C3", ACPI_PROCESSOR_MAX_POWER + 1); - max_cstate = (int)id->driver_data; + max_cstate = 1; return 0; } + + static struct dmi_system_id __initdata processor_power_dmi_table[] = { - { set_max_cstate, "IBM ThinkPad R40e", { + { no_c2c3, "IBM ThinkPad R40e", { DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), - DMI_MATCH(DMI_BIOS_VERSION,"1SET60WW") }, (void*)1}, - { set_max_cstate, "Medion 41700", { - DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"), - DMI_MATCH(DMI_BIOS_VERSION,"R01-A1J") }, (void*)1}, - { set_max_cstate, "Clevo 5600D", { + DMI_MATCH(DMI_BIOS_VERSION,"1SET60WW") }}, + { no_c2c3, "Medion 41700", { DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"), - DMI_MATCH(DMI_BIOS_VERSION,"SHE845M0.86C.0013.D.0302131307") }, - (void*)2}, + DMI_MATCH(DMI_BIOS_VERSION,"R01-A1J") }}, {}, }; @@ -552,8 +549,7 @@ static int acpi_processor_get_power_info_default_c1 (struct acpi_processor *pr) ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1"); for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) - memset(&(pr->power.states[i]), 0, - sizeof(struct acpi_processor_cx)); + memset(pr->power.states, 0, sizeof(struct acpi_processor_cx)); /* if info is obtained from pblk/fadt, type equals state */ pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; @@ -584,8 +580,7 @@ static int acpi_processor_get_power_info_cst (struct acpi_processor *pr) pr->power.count = 0; for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) - memset(&(pr->power.states[i]), 0, - sizeof(struct acpi_processor_cx)); + memset(pr->power.states, 0, sizeof(struct acpi_processor_cx)); status = acpi_evaluate_object(pr->handle, "_CST", NULL, &buffer); if (ACPI_FAILURE(status)) { @@ -768,6 +763,7 @@ static void acpi_processor_power_verify_c3( } if (pr->flags.bm_check) { + printk("Disabling BM access before entering C3\n"); /* bus mastering control is necessary */ if (!pr->flags.bm_control) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, @@ -775,6 +771,7 @@ static void acpi_processor_power_verify_c3( return_VOID; } } else { + printk("Invalidating cache before entering C3\n"); /* * WBINVD should be set in fadt, for C3 state to be * supported on when bm_check is not required. @@ -845,7 +842,7 @@ static int acpi_processor_get_power_info ( result = acpi_processor_get_power_info_cst(pr); if ((result) || (acpi_processor_power_verify(pr) < 2)) { result = acpi_processor_get_power_info_fadt(pr); - if ((result) || (acpi_processor_power_verify(pr) < 2)) + if (result) result = acpi_processor_get_power_info_default_c1(pr); } diff --git a/trunk/drivers/net/sk98lin/skge.c b/trunk/drivers/net/sk98lin/skge.c index 49bd8c7c3f7d..82570ec44d8e 100644 --- a/trunk/drivers/net/sk98lin/skge.c +++ b/trunk/drivers/net/sk98lin/skge.c @@ -5133,81 +5133,6 @@ static void __devexit skge_remove_one(struct pci_dev *pdev) kfree(pAC); } -#ifdef CONFIG_PM -static int skge_suspend(struct pci_dev *pdev, pm_message_t state) -{ - struct net_device *dev = pci_get_drvdata(pdev); - DEV_NET *pNet = netdev_priv(dev); - SK_AC *pAC = pNet->pAC; - struct net_device *otherdev = pAC->dev[1]; - - if (netif_running(dev)) { - netif_carrier_off(dev); - DoPrintInterfaceChange = SK_FALSE; - SkDrvDeInitAdapter(pAC, 0); /* performs SkGeClose */ - netif_device_detach(dev); - } - if (otherdev != dev) { - if (netif_running(otherdev)) { - netif_carrier_off(otherdev); - DoPrintInterfaceChange = SK_FALSE; - SkDrvDeInitAdapter(pAC, 1); /* performs SkGeClose */ - netif_device_detach(otherdev); - } - } - - pci_save_state(pdev); - pci_enable_wake(pdev, pci_choose_state(pdev, state), 0); - if (pAC->AllocFlag & SK_ALLOC_IRQ) { - free_irq(dev->irq, dev); - } - pci_disable_device(pdev); - pci_set_power_state(pdev, pci_choose_state(pdev, state)); - - return 0; -} - -static int skge_resume(struct pci_dev *pdev) -{ - struct net_device *dev = pci_get_drvdata(pdev); - DEV_NET *pNet = netdev_priv(dev); - SK_AC *pAC = pNet->pAC; - struct net_device *otherdev = pAC->dev[1]; - int ret; - - pci_set_power_state(pdev, PCI_D0); - pci_restore_state(pdev); - pci_enable_device(pdev); - pci_set_master(pdev); - if (pAC->GIni.GIMacsFound == 2) - ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, pAC->Name, dev); - else - ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, pAC->Name, dev); - if (ret) { - printk(KERN_WARNING "sk98lin: unable to acquire IRQ %d\n", dev->irq); - pAC->AllocFlag &= ~SK_ALLOC_IRQ; - dev->irq = 0; - pci_disable_device(pdev); - return -EBUSY; - } - - netif_device_attach(dev); - if (netif_running(dev)) { - DoPrintInterfaceChange = SK_FALSE; - SkDrvInitAdapter(pAC, 0); /* first device */ - } - if (otherdev != dev) { - netif_device_attach(otherdev); - if (netif_running(otherdev)) { - DoPrintInterfaceChange = SK_FALSE; - SkDrvInitAdapter(pAC, 1); /* second device */ - } - } - - return 0; -} -#endif - static struct pci_device_id skge_pci_tbl[] = { { PCI_VENDOR_ID_3COM, 0x1700, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { PCI_VENDOR_ID_3COM, 0x80eb, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, @@ -5233,8 +5158,6 @@ static struct pci_driver skge_driver = { .id_table = skge_pci_tbl, .probe = skge_probe_one, .remove = __devexit_p(skge_remove_one), - .suspend = skge_suspend, - .resume = skge_resume, }; static int __init skge_init(void) diff --git a/trunk/drivers/pcmcia/yenta_socket.c b/trunk/drivers/pcmcia/yenta_socket.c index 6837491f021c..744e469a9eda 100644 --- a/trunk/drivers/pcmcia/yenta_socket.c +++ b/trunk/drivers/pcmcia/yenta_socket.c @@ -1107,6 +1107,8 @@ static int yenta_dev_suspend (struct pci_dev *dev, pm_message_t state) pci_read_config_dword(dev, 17*4, &socket->saved_state[1]); pci_disable_device(dev); + free_irq(dev->irq, socket); + /* * Some laptops (IBM T22) do not like us putting the Cardbus * bridge into D3. At a guess, some other laptop will @@ -1132,6 +1134,13 @@ static int yenta_dev_resume (struct pci_dev *dev) pci_enable_device(dev); pci_set_master(dev); + if (socket->cb_irq) + if (request_irq(socket->cb_irq, yenta_interrupt, + SA_SHIRQ, "yenta", socket)) { + printk(KERN_WARNING "Yenta: request_irq() failed on resume!\n"); + socket->cb_irq = 0; + } + if (socket->type && socket->type->restore_state) socket->type->restore_state(socket); } diff --git a/trunk/drivers/scsi/Kconfig b/trunk/drivers/scsi/Kconfig index 96df148ed969..f1e8c4223ed1 100644 --- a/trunk/drivers/scsi/Kconfig +++ b/trunk/drivers/scsi/Kconfig @@ -424,7 +424,7 @@ config SCSI_IN2000 source "drivers/scsi/megaraid/Kconfig.megaraid" config SCSI_SATA - bool "Serial ATA (SATA) support" + tristate "Serial ATA (SATA) support" depends on SCSI help This driver family supports Serial ATA host controllers diff --git a/trunk/drivers/video/fbsysfs.c b/trunk/drivers/video/fbsysfs.c index 1147b899f007..ed1d4d1ac4f7 100644 --- a/trunk/drivers/video/fbsysfs.c +++ b/trunk/drivers/video/fbsysfs.c @@ -414,13 +414,6 @@ static ssize_t show_pan(struct class_device *class_device, char *buf) fb_info->var.xoffset); } -static ssize_t show_name(struct class_device *class_device, char *buf) -{ - struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device); - - return snprintf(buf, PAGE_SIZE, "%s\n", fb_info->fix.id); -} - static struct class_device_attribute class_device_attrs[] = { __ATTR(bits_per_pixel, S_IRUGO|S_IWUSR, show_bpp, store_bpp), __ATTR(blank, S_IRUGO|S_IWUSR, show_blank, store_blank), @@ -431,7 +424,6 @@ static struct class_device_attribute class_device_attrs[] = { __ATTR(modes, S_IRUGO|S_IWUSR, show_modes, store_modes), __ATTR(pan, S_IRUGO|S_IWUSR, show_pan, store_pan), __ATTR(virtual_size, S_IRUGO|S_IWUSR, show_virtual, store_virtual), - __ATTR(name, S_IRUGO, show_name, NULL), }; int fb_init_class_device(struct fb_info *fb_info) diff --git a/trunk/include/acpi/acpi_drivers.h b/trunk/include/acpi/acpi_drivers.h index 579fe191b7e7..caeaa71a5663 100644 --- a/trunk/include/acpi/acpi_drivers.h +++ b/trunk/include/acpi/acpi_drivers.h @@ -56,9 +56,8 @@ /* ACPI PCI Interrupt Link (pci_link.c) */ int acpi_irq_penalty_init (void); -int acpi_pci_link_allocate_irq (acpi_handle handle, int index, int *edge_level, +int acpi_pci_link_get_irq (acpi_handle handle, int index, int *edge_level, int *active_high_low, char **name); -int acpi_pci_link_free_irq(acpi_handle handle); /* ACPI PCI Interrupt Routing (pci_irq.c) */ diff --git a/trunk/include/asm-ppc/unistd.h b/trunk/include/asm-ppc/unistd.h index 3173ab3d2eb9..a7894e0fbbb1 100644 --- a/trunk/include/asm-ppc/unistd.h +++ b/trunk/include/asm-ppc/unistd.h @@ -279,11 +279,8 @@ #define __NR_waitid 272 #define __NR_ioprio_set 273 #define __NR_ioprio_get 274 -#define __NR_inotify_init 275 -#define __NR_inotify_add_watch 276 -#define __NR_inotify_rm_watch 277 -#define __NR_syscalls 278 +#define __NR_syscalls 275 #define __NR(n) #n diff --git a/trunk/include/asm-ppc64/unistd.h b/trunk/include/asm-ppc64/unistd.h index 977bc980c1af..4a94acf6bfed 100644 --- a/trunk/include/asm-ppc64/unistd.h +++ b/trunk/include/asm-ppc64/unistd.h @@ -285,11 +285,8 @@ #define __NR_waitid 272 #define __NR_ioprio_set 273 #define __NR_ioprio_get 274 -#define __NR_inotify_init 275 -#define __NR_inotify_add_watch 276 -#define __NR_inotify_rm_watch 277 -#define __NR_syscalls 278 +#define __NR_syscalls 275 #ifdef __KERNEL__ #define NR_syscalls __NR_syscalls #endif diff --git a/trunk/include/linux/acpi.h b/trunk/include/linux/acpi.h index b46a5205ee7b..f85cbe919e13 100644 --- a/trunk/include/linux/acpi.h +++ b/trunk/include/linux/acpi.h @@ -453,7 +453,9 @@ int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); * If this matches the last registration, any IRQ resources for gsi * are freed. */ +#ifdef CONFIG_ACPI_DEALLOCATE_IRQ void acpi_unregister_gsi (u32 gsi); +#endif #ifdef CONFIG_ACPI_PCI @@ -478,7 +480,9 @@ struct pci_dev; int acpi_pci_irq_enable (struct pci_dev *dev); void acpi_penalize_isa_irq(int irq, int active); +#ifdef CONFIG_ACPI_DEALLOCATE_IRQ void acpi_pci_irq_disable (struct pci_dev *dev); +#endif struct acpi_pci_driver { struct acpi_pci_driver *next; diff --git a/trunk/include/net/tcp.h b/trunk/include/net/tcp.h index 5010f0c5a56e..f4f9aba07ac2 100644 --- a/trunk/include/net/tcp.h +++ b/trunk/include/net/tcp.h @@ -1236,7 +1236,7 @@ static inline void tcp_sync_left_out(struct tcp_sock *tp) tp->left_out = tp->sacked_out + tp->lost_out; } -/* Set slow start threshold and cwnd not falling to slow start */ +/* Set slow start threshould and cwnd not falling to slow start */ static inline void __tcp_enter_cwr(struct tcp_sock *tp) { tp->undo_marker = 0; diff --git a/trunk/kernel/softirq.c b/trunk/kernel/softirq.c index b4ab6af1dea8..31007d6542cc 100644 --- a/trunk/kernel/softirq.c +++ b/trunk/kernel/softirq.c @@ -86,7 +86,7 @@ asmlinkage void __do_softirq(void) /* Reset the pending bitmask before enabling irqs */ local_softirq_pending() = 0; - local_irq_enable(); + //local_irq_enable(); h = softirq_vec; @@ -99,7 +99,7 @@ asmlinkage void __do_softirq(void) pending >>= 1; } while (pending); - local_irq_disable(); + //local_irq_disable(); pending = local_softirq_pending(); if (pending && --max_restart) diff --git a/trunk/mm/page_alloc.c b/trunk/mm/page_alloc.c index 8d088371196a..42bccfb8464d 100644 --- a/trunk/mm/page_alloc.c +++ b/trunk/mm/page_alloc.c @@ -1061,19 +1061,20 @@ unsigned int nr_free_pages_pgdat(pg_data_t *pgdat) static unsigned int nr_free_zone_pages(int offset) { - /* Just pick one node, since fallback list is circular */ - pg_data_t *pgdat = NODE_DATA(numa_node_id()); + pg_data_t *pgdat; unsigned int sum = 0; - struct zonelist *zonelist = pgdat->node_zonelists + offset; - struct zone **zonep = zonelist->zones; - struct zone *zone; + for_each_pgdat(pgdat) { + struct zonelist *zonelist = pgdat->node_zonelists + offset; + struct zone **zonep = zonelist->zones; + struct zone *zone; - for (zone = *zonep++; zone; zone = *zonep++) { - unsigned long size = zone->present_pages; - unsigned long high = zone->pages_high; - if (size > high) - sum += size - high; + for (zone = *zonep++; zone; zone = *zonep++) { + unsigned long size = zone->present_pages; + unsigned long high = zone->pages_high; + if (size > high) + sum += size - high; + } } return sum; diff --git a/trunk/net/core/dst.c b/trunk/net/core/dst.c index 334790da9f16..fc434ade5270 100644 --- a/trunk/net/core/dst.c +++ b/trunk/net/core/dst.c @@ -45,7 +45,6 @@ static struct timer_list dst_gc_timer = static void dst_run_gc(unsigned long dummy) { int delayed = 0; - int work_performed; struct dst_entry * dst, **dstp; if (!spin_trylock(&dst_lock)) { @@ -53,9 +52,9 @@ static void dst_run_gc(unsigned long dummy) return; } + del_timer(&dst_gc_timer); dstp = &dst_garbage_list; - work_performed = 0; while ((dst = *dstp) != NULL) { if (atomic_read(&dst->__refcnt)) { dstp = &dst->next; @@ -63,7 +62,6 @@ static void dst_run_gc(unsigned long dummy) continue; } *dstp = dst->next; - work_performed = 1; dst = dst_destroy(dst); if (dst) { @@ -88,14 +86,9 @@ static void dst_run_gc(unsigned long dummy) dst_gc_timer_inc = DST_GC_MAX; goto out; } - if (!work_performed) { - if ((dst_gc_timer_expires += dst_gc_timer_inc) > DST_GC_MAX) - dst_gc_timer_expires = DST_GC_MAX; - dst_gc_timer_inc += DST_GC_INC; - } else { - dst_gc_timer_inc = DST_GC_INC; - dst_gc_timer_expires = DST_GC_MIN; - } + if ((dst_gc_timer_expires += dst_gc_timer_inc) > DST_GC_MAX) + dst_gc_timer_expires = DST_GC_MAX; + dst_gc_timer_inc += DST_GC_INC; dst_gc_timer.expires = jiffies + dst_gc_timer_expires; #if RT_CACHE_DEBUG >= 2 printk("dst_total: %d/%d %ld\n", diff --git a/trunk/net/ipv4/ip_gre.c b/trunk/net/ipv4/ip_gre.c index f0d5740d7e22..884835522224 100644 --- a/trunk/net/ipv4/ip_gre.c +++ b/trunk/net/ipv4/ip_gre.c @@ -290,6 +290,7 @@ static struct ip_tunnel * ipgre_tunnel_locate(struct ip_tunnel_parm *parms, int dev_hold(dev); ipgre_tunnel_link(nt); + /* Do not decrement MOD_USE_COUNT here. */ return nt; failed: @@ -1276,28 +1277,12 @@ static int __init ipgre_init(void) goto out; } -static void __exit ipgre_destroy_tunnels(void) -{ - int prio; - - for (prio = 0; prio < 4; prio++) { - int h; - for (h = 0; h < HASH_SIZE; h++) { - struct ip_tunnel *t; - while ((t = tunnels[prio][h]) != NULL) - unregister_netdevice(t->dev); - } - } -} - -static void __exit ipgre_fini(void) +static void ipgre_fini(void) { if (inet_del_protocol(&ipgre_protocol, IPPROTO_GRE) < 0) printk(KERN_INFO "ipgre close: can't remove protocol\n"); - rtnl_lock(); - ipgre_destroy_tunnels(); - rtnl_unlock(); + unregister_netdev(ipgre_fb_tunnel_dev); } module_init(ipgre_init); diff --git a/trunk/net/ipv4/ipip.c b/trunk/net/ipv4/ipip.c index c05c1df0bb04..c3947cd566b7 100644 --- a/trunk/net/ipv4/ipip.c +++ b/trunk/net/ipv4/ipip.c @@ -255,6 +255,7 @@ static struct ip_tunnel * ipip_tunnel_locate(struct ip_tunnel_parm *parms, int c dev_hold(dev); ipip_tunnel_link(nt); + /* Do not decrement MOD_USE_COUNT here. */ return nt; failed: @@ -919,29 +920,12 @@ static int __init ipip_init(void) goto out; } -static void __exit ipip_destroy_tunnels(void) -{ - int prio; - - for (prio = 1; prio < 4; prio++) { - int h; - for (h = 0; h < HASH_SIZE; h++) { - struct ip_tunnel *t; - while ((t = tunnels[prio][h]) != NULL) - unregister_netdevice(t->dev); - } - } -} - static void __exit ipip_fini(void) { if (ipip_unregister() < 0) printk(KERN_INFO "ipip close: can't deregister tunnel\n"); - rtnl_lock(); - ipip_destroy_tunnels(); - unregister_netdevice(ipip_fb_tunnel_dev); - rtnl_unlock(); + unregister_netdev(ipip_fb_tunnel_dev); } module_init(ipip_init); diff --git a/trunk/net/ipv4/ipmr.c b/trunk/net/ipv4/ipmr.c index dc806b578427..7833d920bdba 100644 --- a/trunk/net/ipv4/ipmr.c +++ b/trunk/net/ipv4/ipmr.c @@ -362,7 +362,7 @@ static void ipmr_expire_process(unsigned long dummy) /* Fill oifs list. It is called under write locked mrt_lock. */ -static void ipmr_update_thresholds(struct mfc_cache *cache, unsigned char *ttls) +static void ipmr_update_threshoulds(struct mfc_cache *cache, unsigned char *ttls) { int vifi; @@ -727,7 +727,7 @@ static int ipmr_mfc_add(struct mfcctl *mfc, int mrtsock) if (c != NULL) { write_lock_bh(&mrt_lock); c->mfc_parent = mfc->mfcc_parent; - ipmr_update_thresholds(c, mfc->mfcc_ttls); + ipmr_update_threshoulds(c, mfc->mfcc_ttls); if (!mrtsock) c->mfc_flags |= MFC_STATIC; write_unlock_bh(&mrt_lock); @@ -744,7 +744,7 @@ static int ipmr_mfc_add(struct mfcctl *mfc, int mrtsock) c->mfc_origin=mfc->mfcc_origin.s_addr; c->mfc_mcastgrp=mfc->mfcc_mcastgrp.s_addr; c->mfc_parent=mfc->mfcc_parent; - ipmr_update_thresholds(c, mfc->mfcc_ttls); + ipmr_update_threshoulds(c, mfc->mfcc_ttls); if (!mrtsock) c->mfc_flags |= MFC_STATIC; diff --git a/trunk/net/ipv4/netfilter/ip_conntrack_core.c b/trunk/net/ipv4/netfilter/ip_conntrack_core.c index a7f0c821a9b2..86f04e41dd8e 100644 --- a/trunk/net/ipv4/netfilter/ip_conntrack_core.c +++ b/trunk/net/ipv4/netfilter/ip_conntrack_core.c @@ -512,11 +512,6 @@ init_conntrack(const struct ip_conntrack_tuple *tuple, conntrack->master = exp->master; #ifdef CONFIG_IP_NF_CONNTRACK_MARK conntrack->mark = exp->master->mark; -#endif -#if defined(CONFIG_IP_NF_TARGET_MASQUERADE) || \ - defined(CONFIG_IP_NF_TARGET_MASQUERADE_MODULE) - /* this is ugly, but there is no other place where to put it */ - conntrack->nat.masq_index = exp->master->nat.masq_index; #endif nf_conntrack_get(&conntrack->master->ct_general); CONNTRACK_STAT_INC(expect_new); diff --git a/trunk/net/ipv6/sit.c b/trunk/net/ipv6/sit.c index e553e5b80d6e..b788f55e139b 100644 --- a/trunk/net/ipv6/sit.c +++ b/trunk/net/ipv6/sit.c @@ -195,6 +195,7 @@ static struct ip_tunnel * ipip6_tunnel_locate(struct ip_tunnel_parm *parms, int dev_hold(dev); ipip6_tunnel_link(nt); + /* Do not decrement MOD_USE_COUNT here. */ return nt; failed: @@ -793,28 +794,10 @@ static struct net_protocol sit_protocol = { .err_handler = ipip6_err, }; -static void __exit sit_destroy_tunnels(void) -{ - int prio; - - for (prio = 1; prio < 4; prio++) { - int h; - for (h = 0; h < HASH_SIZE; h++) { - struct ip_tunnel *t; - while ((t = tunnels[prio][h]) != NULL) - unregister_netdevice(t->dev); - } - } -} - void __exit sit_cleanup(void) { inet_del_protocol(&sit_protocol, IPPROTO_IPV6); - - rtnl_lock(); - sit_destroy_tunnels(); - unregister_netdevice(ipip6_fb_tunnel_dev); - rtnl_unlock(); + unregister_netdev(ipip6_fb_tunnel_dev); } int __init sit_init(void) diff --git a/trunk/sound/pci/intel8x0.c b/trunk/sound/pci/intel8x0.c index d7af3e474432..7c806bd9cc90 100644 --- a/trunk/sound/pci/intel8x0.c +++ b/trunk/sound/pci/intel8x0.c @@ -2376,9 +2376,6 @@ static int intel8x0_suspend(snd_card_t *card, pm_message_t state) snd_ac97_suspend(chip->ac97[i]); if (chip->device_type == DEVICE_INTEL_ICH4) chip->sdm_saved = igetbyte(chip, ICHREG(SDM)); - - if (chip->irq >= 0) - free_irq(chip->irq, (void *)chip); pci_disable_device(chip->pci); return 0; } @@ -2390,9 +2387,7 @@ static int intel8x0_resume(snd_card_t *card) pci_enable_device(chip->pci); pci_set_master(chip->pci); - request_irq(chip->irq, snd_intel8x0_interrupt, SA_INTERRUPT|SA_SHIRQ, card->shortname, (void *)chip); - synchronize_irq(chip->irq); - snd_intel8x0_chip_init(chip, 1); + snd_intel8x0_chip_init(chip, 0); /* re-initialize mixer stuff */ if (chip->device_type == DEVICE_INTEL_ICH4) {