From 54da3fa0dbad4bb314af35b9f201d000ddd72867 Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 10 Jan 2008 12:33:54 +0000 Subject: [PATCH] --- yaml --- r: 75439 b: refs/heads/master c: 198a6d5a6189501e2b8abf4e3149ccb337866f65 h: refs/heads/master i: 75437: 8aef321da37f7ca52c1be71af8a272868580030c 75435: d8fcf95d0396b29fc2d22c9184329e7db8eb6ee6 75431: 5f14652be393a08f0ead6caf34472f80bbcac445 75423: 3a045f48a825755ecfa6490436adef816b895fc3 v: v3 --- [refs] | 2 +- trunk/Documentation/kernel-parameters.txt | 8 -- trunk/MAINTAINERS | 10 +- trunk/arch/mips/kernel/setup.c | 7 +- trunk/arch/mips/lasat/image/Makefile | 6 +- trunk/arch/mips/mips-boards/generic/memory.c | 2 + trunk/arch/mips/mips-boards/generic/reset.c | 10 +- trunk/arch/mips/mm/dma-default.c | 2 +- trunk/arch/mips/philips/pnx8550/common/time.c | 109 +++++---------- trunk/arch/powerpc/kernel/prom_init.c | 39 ------ trunk/arch/powerpc/mm/slb.c | 8 -- .../powerpc/platforms/pseries/hotplug-cpu.c | 2 - trunk/arch/powerpc/platforms/pseries/lpar.c | 1 - trunk/arch/x86/kernel/apm_32.c | 10 +- trunk/block/blktrace.c | 81 ++++++++++- trunk/drivers/acpi/Kconfig | 9 +- trunk/drivers/acpi/ac.c | 16 +-- trunk/drivers/acpi/battery.c | 31 +---- trunk/drivers/acpi/bus.c | 7 +- trunk/drivers/acpi/ec.c | 14 +- trunk/drivers/acpi/events/evregion.c | 8 +- trunk/drivers/acpi/pci_irq.c | 9 -- trunk/drivers/acpi/processor_idle.c | 4 - trunk/drivers/acpi/sbs.c | 23 +--- trunk/drivers/acpi/scan.c | 6 - trunk/drivers/ata/libata-eh.c | 24 ++-- trunk/drivers/ata/libata-pmp.c | 12 +- trunk/drivers/ata/libata-scsi.c | 3 +- trunk/drivers/ata/libata-sff.c | 7 +- trunk/drivers/ata/pata_ixp4xx_cf.c | 3 +- trunk/drivers/ata/pata_pdc202xx_old.c | 15 +-- trunk/drivers/ata/sata_qstor.c | 2 +- trunk/drivers/ata/sata_sil24.c | 37 ++--- trunk/drivers/block/loop.c | 2 +- trunk/drivers/crypto/padlock-aes.c | 4 +- trunk/drivers/ide/ide-acpi.c | 38 +----- trunk/drivers/ide/ide-iops.c | 6 +- trunk/drivers/ide/pci/trm290.c | 29 ++-- trunk/drivers/media/dvb/ttpci/av7110.c | 10 +- trunk/drivers/media/video/ivtv/ivtv-driver.c | 4 + trunk/drivers/mtd/chips/cfi_cmdset_0001.c | 7 +- trunk/drivers/net/3c509.c | 4 - trunk/drivers/net/Kconfig | 20 +-- trunk/drivers/net/fs_enet/fs_enet-main.c | 11 +- trunk/drivers/net/loopback.c | 2 +- trunk/drivers/net/netxen/netxen_nic.h | 69 +++++----- trunk/drivers/net/netxen/netxen_nic_init.c | 20 +-- trunk/drivers/net/netxen/netxen_nic_main.c | 70 ++++++---- trunk/drivers/net/netxen/netxen_nic_niu.c | 8 +- trunk/drivers/net/r8169.c | 2 +- trunk/drivers/net/sky2.c | 48 +++++-- trunk/drivers/net/sky2.h | 4 +- trunk/drivers/net/tulip/de4x5.c | 127 ++++++++++++------ trunk/drivers/net/tulip/tulip_core.c | 3 +- trunk/drivers/net/tulip/xircom_cb.c | 54 ++++---- trunk/drivers/net/usb/asix.c | 6 +- trunk/drivers/net/wireless/rt2x00/rt2500usb.c | 2 +- trunk/drivers/net/wireless/rt2x00/rt2x00pci.c | 20 +-- trunk/drivers/net/wireless/rt2x00/rt2x00usb.c | 17 +-- trunk/drivers/net/wireless/rt2x00/rt61pci.c | 12 -- trunk/drivers/pci/quirks.c | 6 - trunk/drivers/pnp/pnpacpi/rsparser.c | 14 +- trunk/drivers/scsi/qla1280.c | 2 +- trunk/drivers/video/ps3fb.c | 24 ++-- trunk/fs/namei.c | 4 +- trunk/fs/nfs/nfs4_fs.h | 1 - trunk/fs/nfs/nfs4state.c | 5 +- trunk/fs/nfsd/nfs3xdr.c | 5 +- trunk/fs/nfsd/nfsxdr.c | 5 +- trunk/fs/proc/array.c | 4 +- trunk/fs/xfs/linux-2.6/xfs_file.c | 16 +-- trunk/include/asm-arm/arch-pxa/hardware.h | 24 ++-- trunk/include/asm-arm/system.h | 13 ++ trunk/include/asm-powerpc/mmu-hash64.h | 1 - trunk/include/asm-sh/cacheflush.h | 6 - trunk/include/asm-sh/uaccess.h | 42 +++--- trunk/include/linux/pci_ids.h | 2 - trunk/include/linux/pm.h | 9 -- trunk/include/linux/pm_legacy.h | 6 + trunk/include/linux/pnp.h | 2 +- trunk/include/linux/scatterlist.h | 4 +- trunk/include/linux/sched.h | 13 ++ trunk/kernel/power/main.c | 3 - trunk/kernel/power/pm.c | 4 + trunk/kernel/timer.c | 2 +- 85 files changed, 593 insertions(+), 750 deletions(-) diff --git a/[refs] b/[refs] index aaa25a817f26..7307ca65aeb3 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d72ec9e20e4de995aa957f171cf84b136689e4c0 +refs/heads/master: 198a6d5a6189501e2b8abf4e3149ccb337866f65 diff --git a/trunk/Documentation/kernel-parameters.txt b/trunk/Documentation/kernel-parameters.txt index c4178778e7fd..e5b447a0acda 100644 --- a/trunk/Documentation/kernel-parameters.txt +++ b/trunk/Documentation/kernel-parameters.txt @@ -883,14 +883,6 @@ and is between 256 and 4096 characters. It is defined in the file lapic_timer_c2_ok [X86-32,x86-64,APIC] trust the local apic timer in C2 power state. - libata.dma= [LIBATA] DMA control - libata.dma=0 Disable all PATA and SATA DMA - libata.dma=1 PATA and SATA Disk DMA only - libata.dma=2 ATAPI (CDROM) DMA only - libata.dma=4 Compact Flash DMA only - Combinations also work, so libata.dma=3 enables DMA - for disks and CDROMs, but not CFs. - libata.noacpi [LIBATA] Disables use of ACPI in libata suspend/resume when set. Format: diff --git a/trunk/MAINTAINERS b/trunk/MAINTAINERS index 92aa0a7e58ea..b4f611c60cfc 100644 --- a/trunk/MAINTAINERS +++ b/trunk/MAINTAINERS @@ -2739,8 +2739,8 @@ T: git kernel.org:/pub/scm/linux/kernel/git/linville/wireless-2.6.git S: Maintained NETXEN (1/10) GbE SUPPORT -P: Dhananjay Phadke -M: dhananjay@netxen.com +P: Amit S. Kale +M: amitkale@netxen.com L: netdev@vger.kernel.org W: http://www.netxen.com S: Supported @@ -3611,10 +3611,8 @@ L: linux-kernel@vger.kernel.org ? S: Supported SPIDERNET NETWORK DRIVER for CELL -P: Ishizaki Kou -M: kou.ishizaki@toshiba.co.jp -P: Jens Osterkamp -M: jens@de.ibm.com +P: Linas Vepstas +M: linas@austin.ibm.com L: netdev@vger.kernel.org S: Supported diff --git a/trunk/arch/mips/kernel/setup.c b/trunk/arch/mips/kernel/setup.c index f8a535afce39..7f6ddcb5d485 100644 --- a/trunk/arch/mips/kernel/setup.c +++ b/trunk/arch/mips/kernel/setup.c @@ -269,7 +269,7 @@ static void __init bootmem_init(void) static void __init bootmem_init(void) { - unsigned long reserved_end; + unsigned long init_begin, reserved_end; unsigned long mapstart = ~0UL; unsigned long bootmap_size; int i; @@ -344,6 +344,7 @@ static void __init bootmem_init(void) min_low_pfn, max_low_pfn); + init_begin = PFN_UP(__pa_symbol(&__init_begin)); for (i = 0; i < boot_mem_map.nr_map; i++) { unsigned long start, end; @@ -351,8 +352,8 @@ static void __init bootmem_init(void) end = PFN_DOWN(boot_mem_map.map[i].addr + boot_mem_map.map[i].size); - if (start <= min_low_pfn) - start = min_low_pfn; + if (start <= init_begin) + start = init_begin; if (start >= end) continue; diff --git a/trunk/arch/mips/lasat/image/Makefile b/trunk/arch/mips/lasat/image/Makefile index 460626b6d62f..5332449ec040 100644 --- a/trunk/arch/mips/lasat/image/Makefile +++ b/trunk/arch/mips/lasat/image/Makefile @@ -12,11 +12,11 @@ endif MKLASATIMG = mklasatimg MKLASATIMG_ARCH = mq2,mqpro,sp100,sp200 -KERNEL_IMAGE = vmlinux +KERNEL_IMAGE = $(TOPDIR)/vmlinux KERNEL_START = $(shell $(NM) $(KERNEL_IMAGE) | grep " _text" | cut -f1 -d\ ) KERNEL_ENTRY = $(shell $(NM) $(KERNEL_IMAGE) | grep kernel_entry | cut -f1 -d\ ) -LDSCRIPT= -L$(srctree)/$(src) -Tromscript.normal +LDSCRIPT= -L$(obj) -Tromscript.normal HEAD_DEFINES := -D_kernel_start=0x$(KERNEL_START) \ -D_kernel_entry=0x$(KERNEL_ENTRY) \ @@ -24,7 +24,7 @@ HEAD_DEFINES := -D_kernel_start=0x$(KERNEL_START) \ -D TIMESTAMP=$(shell date +%s) $(obj)/head.o: $(obj)/head.S $(KERNEL_IMAGE) - $(CC) -fno-pic $(HEAD_DEFINES) $(LINUXINCLUDE) -c -o $@ $< + $(CC) -fno-pic $(HEAD_DEFINES) -I$(TOPDIR)/include -c -o $@ $< OBJECTS = head.o kImage.o diff --git a/trunk/arch/mips/mips-boards/generic/memory.c b/trunk/arch/mips/mips-boards/generic/memory.c index dc272c188233..2c5c27c8e86d 100644 --- a/trunk/arch/mips/mips-boards/generic/memory.c +++ b/trunk/arch/mips/mips-boards/generic/memory.c @@ -169,6 +169,7 @@ void __init prom_meminit(void) void __init prom_free_prom_memory(void) { +#if 0 /* for now ... */ unsigned long addr; int i; @@ -180,4 +181,5 @@ void __init prom_free_prom_memory(void) free_init_pages("prom memory", addr, addr + boot_mem_map.map[i].size); } +#endif } diff --git a/trunk/arch/mips/mips-boards/generic/reset.c b/trunk/arch/mips/mips-boards/generic/reset.c index 583d468d98a9..7a1bb51f81ee 100644 --- a/trunk/arch/mips/mips-boards/generic/reset.c +++ b/trunk/arch/mips/mips-boards/generic/reset.c @@ -39,18 +39,16 @@ static void atlas_machine_power_off(void); static void mips_machine_restart(char *command) { - unsigned int __iomem *softres_reg = - ioremap(SOFTRES_REG, sizeof(unsigned int)); + unsigned int __iomem *softres_reg = ioremap(SOFTRES_REG, sizeof(unsigned int)); - __raw_writel(GORESET, softres_reg); + writew(GORESET, softres_reg); } static void mips_machine_halt(void) { - unsigned int __iomem *softres_reg = - ioremap(SOFTRES_REG, sizeof(unsigned int)); + unsigned int __iomem *softres_reg = ioremap(SOFTRES_REG, sizeof(unsigned int)); - __raw_writel(GORESET, softres_reg); + writew(GORESET, softres_reg); } #if defined(CONFIG_MIPS_ATLAS) diff --git a/trunk/arch/mips/mm/dma-default.c b/trunk/arch/mips/mm/dma-default.c index 810535dd091b..ae76795685cc 100644 --- a/trunk/arch/mips/mm/dma-default.c +++ b/trunk/arch/mips/mm/dma-default.c @@ -45,7 +45,7 @@ static gfp_t massage_gfp_flags(const struct device *dev, gfp_t gfp) /* ignore region specifiers */ gfp &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM); -#ifdef CONFIG_ZONE_DMA +#ifdef CONFIG_ZONE_DMA32 if (dev == NULL) gfp |= __GFP_DMA; else if (dev->coherent_dma_mask < DMA_BIT_MASK(24)) diff --git a/trunk/arch/mips/philips/pnx8550/common/time.c b/trunk/arch/mips/philips/pnx8550/common/time.c index 6d494e0de3d9..e818fd0f1584 100644 --- a/trunk/arch/mips/philips/pnx8550/common/time.c +++ b/trunk/arch/mips/philips/pnx8550/common/time.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -40,60 +41,11 @@ static cycle_t hpt_read(void) return read_c0_count2(); } -static struct clocksource pnx_clocksource = { - .name = "pnx8xxx", - .rating = 200, - .read = hpt_read, - .flags = CLOCK_SOURCE_IS_CONTINUOUS, -}; - static void timer_ack(void) { write_c0_compare(cpj); } -static irqreturn_t pnx8xxx_timer_interrupt(int irq, void *dev_id) -{ - struct clock_event_device *c = dev_id; - - /* clear MATCH, signal the event */ - c->event_handler(c); - - return IRQ_HANDLED; -} - -static struct irqaction pnx8xxx_timer_irq = { - .handler = pnx8xxx_timer_interrupt, - .flags = IRQF_DISABLED | IRQF_PERCPU, - .name = "pnx8xxx_timer", -}; - -static irqreturn_t monotonic_interrupt(int irq, void *dev_id) -{ - /* Timer 2 clear interrupt */ - write_c0_compare2(-1); - return IRQ_HANDLED; -} - -static struct irqaction monotonic_irqaction = { - .handler = monotonic_interrupt, - .flags = IRQF_DISABLED, - .name = "Monotonic timer", -}; - -static int pnx8xxx_set_next_event(unsigned long delta, - struct clock_event_device *evt) -{ - write_c0_compare(delta); - return 0; -} - -static struct clock_event_device pnx8xxx_clockevent = { - .name = "pnx8xxx_clockevent", - .features = CLOCK_EVT_FEAT_ONESHOT, - .set_next_event = pnx8xxx_set_next_event, -}; - /* * plat_time_init() - it does the following things: * @@ -106,34 +58,11 @@ static struct clock_event_device pnx8xxx_clockevent = { __init void plat_time_init(void) { - unsigned int configPR; unsigned int n; unsigned int m; unsigned int p; unsigned int pow2p; - clockevents_register_device(&pnx8xxx_clockevent); - clocksource_register(&pnx_clocksource); - - setup_irq(PNX8550_INT_TIMER1, &pnx8xxx_timer_irq); - setup_irq(PNX8550_INT_TIMER2, &monotonic_irqaction); - - /* Timer 1 start */ - configPR = read_c0_config7(); - configPR &= ~0x00000008; - write_c0_config7(configPR); - - /* Timer 2 start */ - configPR = read_c0_config7(); - configPR &= ~0x00000010; - write_c0_config7(configPR); - - /* Timer 3 stop */ - configPR = read_c0_config7(); - configPR |= 0x00000020; - write_c0_config7(configPR); - - /* PLL0 sets MIPS clock (PLL1 <=> TM1, PLL6 <=> TM2, PLL5 <=> mem) */ /* (but only if CLK_MIPS_CTL select value [bits 3:1] is 1: FIXME) */ @@ -158,6 +87,42 @@ __init void plat_time_init(void) write_c0_count2(0); write_c0_compare2(0xffffffff); + clocksource_mips.read = hpt_read; + mips_timer_ack = timer_ack; +} + +static irqreturn_t monotonic_interrupt(int irq, void *dev_id) +{ + /* Timer 2 clear interrupt */ + write_c0_compare2(-1); + return IRQ_HANDLED; } +static struct irqaction monotonic_irqaction = { + .handler = monotonic_interrupt, + .flags = IRQF_DISABLED, + .name = "Monotonic timer", +}; +void __init plat_timer_setup(struct irqaction *irq) +{ + int configPR; + + setup_irq(PNX8550_INT_TIMER1, irq); + setup_irq(PNX8550_INT_TIMER2, &monotonic_irqaction); + + /* Timer 1 start */ + configPR = read_c0_config7(); + configPR &= ~0x00000008; + write_c0_config7(configPR); + + /* Timer 2 start */ + configPR = read_c0_config7(); + configPR &= ~0x00000010; + write_c0_config7(configPR); + + /* Timer 3 stop */ + configPR = read_c0_config7(); + configPR |= 0x00000020; + write_c0_config7(configPR); +} diff --git a/trunk/arch/powerpc/kernel/prom_init.c b/trunk/arch/powerpc/kernel/prom_init.c index 5d89a21dd0d6..1add6efdb315 100644 --- a/trunk/arch/powerpc/kernel/prom_init.c +++ b/trunk/arch/powerpc/kernel/prom_init.c @@ -2216,45 +2216,6 @@ static void __init fixup_device_tree_efika(void) prom_printf("fixup_device_tree_efika: ", "skipped entry %x - setprop error\n", i); } - - /* Make sure ethernet mdio bus node exists */ - node = call_prom("finddevice", 1, 1, ADDR("/builtin/mdio")); - if (!PHANDLE_VALID(node)) { - prom_printf("Adding Ethernet MDIO node\n"); - call_prom("interpret", 1, 1, - " s\" /builtin\" find-device" - " new-device" - " 1 encode-int s\" #address-cells\" property" - " 0 encode-int s\" #size-cells\" property" - " s\" mdio\" 2dup device-name device-type" - " s\" mpc5200b-fec-phy\" encode-string" - " s\" compatible\" property" - " 0xf0003000 0x400 reg" - " 0x2 encode-int" - " 0x5 encode-int encode+" - " 0x3 encode-int encode+" - " s\" interrupts\" property" - " finish-device"); - }; - - /* Make sure ethernet phy device node exist */ - node = call_prom("finddevice", 1, 1, ADDR("/builtin/mdio/ethernet-phy")); - if (!PHANDLE_VALID(node)) { - prom_printf("Adding Ethernet PHY node\n"); - call_prom("interpret", 1, 1, - " s\" /builtin/mdio\" find-device" - " new-device" - " s\" ethernet-phy\" device-name" - " 0x10 encode-int s\" reg\" property" - " my-self" - " ihandle>phandle" - " finish-device" - " s\" /builtin/ethernet\" find-device" - " encode-int" - " s\" phy-handle\" property" - " device-end"); - } - } #else #define fixup_device_tree_efika() diff --git a/trunk/arch/powerpc/mm/slb.c b/trunk/arch/powerpc/mm/slb.c index a282bc212e80..27922dff8b94 100644 --- a/trunk/arch/powerpc/mm/slb.c +++ b/trunk/arch/powerpc/mm/slb.c @@ -82,14 +82,6 @@ static inline void slb_shadow_clear(unsigned long entry) get_slb_shadow()->save_area[entry].esid = 0; } -void slb_shadow_clear_all(void) -{ - int i; - - for (i = 0; i < SLB_NUM_BOLTED; i++) - slb_shadow_clear(i); -} - static inline void create_shadowed_slbe(unsigned long ea, int ssize, unsigned long flags, unsigned long entry) diff --git a/trunk/arch/powerpc/platforms/pseries/hotplug-cpu.c b/trunk/arch/powerpc/platforms/pseries/hotplug-cpu.c index 412e6b42986f..fc48b96c81bf 100644 --- a/trunk/arch/powerpc/platforms/pseries/hotplug-cpu.c +++ b/trunk/arch/powerpc/platforms/pseries/hotplug-cpu.c @@ -29,7 +29,6 @@ #include #include #include "xics.h" -#include "plpar_wrappers.h" /* This version can't take the spinlock, because it never returns */ static struct rtas_args rtas_stop_self_args = { @@ -59,7 +58,6 @@ static void pseries_mach_cpu_die(void) local_irq_disable(); idle_task_exit(); xics_teardown_cpu(0); - unregister_slb_shadow(hard_smp_processor_id(), __pa(get_slb_shadow())); rtas_stop_self(); /* Should never get here... */ BUG(); diff --git a/trunk/arch/powerpc/platforms/pseries/lpar.c b/trunk/arch/powerpc/platforms/pseries/lpar.c index 34317aa148a8..9a455d46379d 100644 --- a/trunk/arch/powerpc/platforms/pseries/lpar.c +++ b/trunk/arch/powerpc/platforms/pseries/lpar.c @@ -272,7 +272,6 @@ void vpa_init(int cpu) */ addr = __pa(&slb_shadow[cpu]); if (firmware_has_feature(FW_FEATURE_SPLPAR)) { - slb_shadow_clear_all(); ret = register_slb_shadow(hwcpu, addr); if (ret) printk(KERN_ERR diff --git a/trunk/arch/x86/kernel/apm_32.c b/trunk/arch/x86/kernel/apm_32.c index af045ca0f653..17089a041028 100644 --- a/trunk/arch/x86/kernel/apm_32.c +++ b/trunk/arch/x86/kernel/apm_32.c @@ -2256,12 +2256,14 @@ static int __init apm_init(void) apm_info.disabled = 1; return -ENODEV; } - if (pm_flags & PM_ACPI) { + if (PM_IS_ACTIVE()) { printk(KERN_NOTICE "apm: overridden by ACPI.\n"); apm_info.disabled = 1; return -ENODEV; } - pm_flags |= PM_APM; +#ifdef CONFIG_PM_LEGACY + pm_active = 1; +#endif /* * Set up a segment that references the real mode segment 0x40 @@ -2364,7 +2366,9 @@ static void __exit apm_exit(void) kthread_stop(kapmd_task); kapmd_task = NULL; } - pm_flags &= ~PM_APM; +#ifdef CONFIG_PM_LEGACY + pm_active = 0; +#endif } module_init(apm_init); diff --git a/trunk/block/blktrace.c b/trunk/block/blktrace.c index 9b4da4ae3c7d..498a0a54a6aa 100644 --- a/trunk/block/blktrace.c +++ b/trunk/block/blktrace.c @@ -25,6 +25,7 @@ #include #include +static DEFINE_PER_CPU(unsigned long long, blk_trace_cpu_offset) = { 0, }; static unsigned int blktrace_seq __read_mostly = 1; /* @@ -40,7 +41,7 @@ static void trace_note(struct blk_trace *bt, pid_t pid, int action, const int cpu = smp_processor_id(); t->magic = BLK_IO_TRACE_MAGIC | BLK_IO_TRACE_VERSION; - t->time = ktime_to_ns(ktime_get()); + t->time = cpu_clock(cpu) - per_cpu(blk_trace_cpu_offset, cpu); t->device = bt->dev; t->action = action; t->pid = pid; @@ -158,7 +159,7 @@ void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes, t->magic = BLK_IO_TRACE_MAGIC | BLK_IO_TRACE_VERSION; t->sequence = ++(*sequence); - t->time = ktime_to_ns(ktime_get()); + t->time = cpu_clock(cpu) - per_cpu(blk_trace_cpu_offset, cpu); t->sector = sector; t->bytes = bytes; t->action = what; @@ -178,7 +179,7 @@ void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes, EXPORT_SYMBOL_GPL(__blk_add_trace); static struct dentry *blk_tree_root; -static DEFINE_MUTEX(blk_tree_mutex); +static struct mutex blk_tree_mutex; static unsigned int root_users; static inline void blk_remove_root(void) @@ -504,3 +505,77 @@ void blk_trace_shutdown(struct request_queue *q) blk_trace_remove(q); } } + +/* + * Average offset over two calls to cpu_clock() with a gettimeofday() + * in the middle + */ +static void blk_check_time(unsigned long long *t, int this_cpu) +{ + unsigned long long a, b; + struct timeval tv; + + a = cpu_clock(this_cpu); + do_gettimeofday(&tv); + b = cpu_clock(this_cpu); + + *t = tv.tv_sec * 1000000000 + tv.tv_usec * 1000; + *t -= (a + b) / 2; +} + +/* + * calibrate our inter-CPU timings + */ +static void blk_trace_check_cpu_time(void *data) +{ + unsigned long long *t; + int this_cpu = get_cpu(); + + t = &per_cpu(blk_trace_cpu_offset, this_cpu); + + /* + * Just call it twice, hopefully the second call will be cache hot + * and a little more precise + */ + blk_check_time(t, this_cpu); + blk_check_time(t, this_cpu); + + put_cpu(); +} + +static void blk_trace_set_ht_offsets(void) +{ +#if defined(CONFIG_SCHED_SMT) + int cpu, i; + + /* + * now make sure HT siblings have the same time offset + */ + preempt_disable(); + for_each_online_cpu(cpu) { + unsigned long long *cpu_off, *sibling_off; + + for_each_cpu_mask(i, per_cpu(cpu_sibling_map, cpu)) { + if (i == cpu) + continue; + + cpu_off = &per_cpu(blk_trace_cpu_offset, cpu); + sibling_off = &per_cpu(blk_trace_cpu_offset, i); + *sibling_off = *cpu_off; + } + } + preempt_enable(); +#endif +} + +static __init int blk_trace_init(void) +{ + mutex_init(&blk_tree_mutex); + on_each_cpu(blk_trace_check_cpu_time, NULL, 1, 1); + blk_trace_set_ht_offsets(); + + return 0; +} + +module_init(blk_trace_init); + diff --git a/trunk/drivers/acpi/Kconfig b/trunk/drivers/acpi/Kconfig index ccf6ea95f68c..b9f923ef173d 100644 --- a/trunk/drivers/acpi/Kconfig +++ b/trunk/drivers/acpi/Kconfig @@ -82,12 +82,6 @@ config ACPI_PROCFS_POWER and functions, which do not yet exist in /sys Say N to delete power /proc/acpi/ folders that have moved to /sys/ -config ACPI_SYSFS_POWER - bool "Future power /sys interface" - select POWER_SUPPLY - default y - ---help--- - Say N to disable power /sys interface config ACPI_PROC_EVENT bool "Deprecated /proc/acpi/event support" depends on PROC_FS @@ -109,6 +103,7 @@ config ACPI_PROC_EVENT config ACPI_AC tristate "AC Adapter" depends on X86 + select POWER_SUPPLY default y help This driver adds support for the AC Adapter object, which indicates @@ -118,6 +113,7 @@ config ACPI_AC config ACPI_BATTERY tristate "Battery" depends on X86 + select POWER_SUPPLY default y help This driver adds support for battery information through @@ -372,6 +368,7 @@ config ACPI_HOTPLUG_MEMORY config ACPI_SBS tristate "Smart Battery System" depends on X86 + select POWER_SUPPLY help This driver adds support for the Smart Battery System, another type of access to battery information, found on some laptops. diff --git a/trunk/drivers/acpi/ac.c b/trunk/drivers/acpi/ac.c index 76b9bea98b6d..76ed4f52bebd 100644 --- a/trunk/drivers/acpi/ac.c +++ b/trunk/drivers/acpi/ac.c @@ -31,9 +31,7 @@ #include #include #endif -#ifdef CONFIG_ACPI_SYSFS_POWER #include -#endif #include #include @@ -81,9 +79,7 @@ static struct acpi_driver acpi_ac_driver = { }; struct acpi_ac { -#ifdef CONFIG_ACPI_SYSFS_POWER struct power_supply charger; -#endif struct acpi_device * device; unsigned long state; }; @@ -98,7 +94,7 @@ static const struct file_operations acpi_ac_fops = { .release = single_release, }; #endif -#ifdef CONFIG_ACPI_SYSFS_POWER + static int get_ac_property(struct power_supply *psy, enum power_supply_property psp, union power_supply_propval *val) @@ -117,7 +113,7 @@ static int get_ac_property(struct power_supply *psy, static enum power_supply_property ac_props[] = { POWER_SUPPLY_PROP_ONLINE, }; -#endif + /* -------------------------------------------------------------------------- AC Adapter Management -------------------------------------------------------------------------- */ @@ -245,9 +241,7 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data) acpi_bus_generate_netlink_event(device->pnp.device_class, device->dev.bus_id, event, (u32) ac->state); -#ifdef CONFIG_ACPI_SYSFS_POWER kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); -#endif break; default: ACPI_DEBUG_PRINT((ACPI_DB_INFO, @@ -286,14 +280,12 @@ static int acpi_ac_add(struct acpi_device *device) #endif if (result) goto end; -#ifdef CONFIG_ACPI_SYSFS_POWER ac->charger.name = acpi_device_bid(device); ac->charger.type = POWER_SUPPLY_TYPE_MAINS; ac->charger.properties = ac_props; ac->charger.num_properties = ARRAY_SIZE(ac_props); ac->charger.get_property = get_ac_property; power_supply_register(&ac->device->dev, &ac->charger); -#endif status = acpi_install_notify_handler(device->handle, ACPI_ALL_NOTIFY, acpi_ac_notify, ac); @@ -327,10 +319,8 @@ static int acpi_ac_resume(struct acpi_device *device) old_state = ac->state; if (acpi_ac_get_state(ac)) return 0; -#ifdef CONFIG_ACPI_SYSFS_POWER if (old_state != ac->state) kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); -#endif return 0; } @@ -347,10 +337,8 @@ static int acpi_ac_remove(struct acpi_device *device, int type) status = acpi_remove_notify_handler(device->handle, ACPI_ALL_NOTIFY, acpi_ac_notify); -#ifdef CONFIG_ACPI_SYSFS_POWER if (ac->charger.dev) power_supply_unregister(&ac->charger); -#endif #ifdef CONFIG_ACPI_PROCFS_POWER acpi_ac_remove_fs(device); #endif diff --git a/trunk/drivers/acpi/battery.c b/trunk/drivers/acpi/battery.c index c4a769d1ba85..8f7505d304b5 100644 --- a/trunk/drivers/acpi/battery.c +++ b/trunk/drivers/acpi/battery.c @@ -40,9 +40,7 @@ #include #include -#ifdef CONFIG_ACPI_SYSFS_POWER #include -#endif #define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF @@ -88,9 +86,7 @@ MODULE_DEVICE_TABLE(acpi, battery_device_ids); struct acpi_battery { struct mutex lock; -#ifdef CONFIG_ACPI_SYSFS_POWER struct power_supply bat; -#endif struct acpi_device *device; unsigned long update_time; int current_now; @@ -121,7 +117,6 @@ inline int acpi_battery_present(struct acpi_battery *battery) return battery->device->status.battery_present; } -#ifdef CONFIG_ACPI_SYSFS_POWER static int acpi_battery_technology(struct acpi_battery *battery) { if (!strcasecmp("NiCd", battery->type)) @@ -227,7 +222,6 @@ static enum power_supply_property energy_battery_props[] = { POWER_SUPPLY_PROP_MODEL_NAME, POWER_SUPPLY_PROP_MANUFACTURER, }; -#endif #ifdef CONFIG_ACPI_PROCFS_POWER inline char *acpi_battery_units(struct acpi_battery *battery) @@ -404,7 +398,6 @@ static int acpi_battery_init_alarm(struct acpi_battery *battery) return acpi_battery_set_alarm(battery); } -#ifdef CONFIG_ACPI_SYSFS_POWER static ssize_t acpi_battery_alarm_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -436,6 +429,11 @@ static int sysfs_add_battery(struct acpi_battery *battery) { int result; + battery->update_time = 0; + result = acpi_battery_get_info(battery); + acpi_battery_init_alarm(battery); + if (result) + return result; if (battery->power_unit) { battery->bat.properties = charge_battery_props; battery->bat.num_properties = @@ -464,31 +462,18 @@ static void sysfs_remove_battery(struct acpi_battery *battery) power_supply_unregister(&battery->bat); battery->bat.dev = NULL; } -#endif static int acpi_battery_update(struct acpi_battery *battery) { - int result; - result = acpi_battery_get_status(battery); + int result = acpi_battery_get_status(battery); if (result) return result; -#ifdef CONFIG_ACPI_SYSFS_POWER if (!acpi_battery_present(battery)) { sysfs_remove_battery(battery); - battery->update_time = 0; return 0; } -#endif - if (!battery->update_time) { - result = acpi_battery_get_info(battery); - if (result) - return result; - acpi_battery_init_alarm(battery); - } -#ifdef CONFIG_ACPI_SYSFS_POWER if (!battery->bat.dev) sysfs_add_battery(battery); -#endif return acpi_battery_get_state(battery); } @@ -782,11 +767,9 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data) acpi_bus_generate_netlink_event(device->pnp.device_class, device->dev.bus_id, event, acpi_battery_present(battery)); -#ifdef CONFIG_ACPI_SYSFS_POWER /* acpi_batter_update could remove power_supply object */ if (battery->bat.dev) kobject_uevent(&battery->bat.dev->kobj, KOBJ_CHANGE); -#endif } static int acpi_battery_add(struct acpi_device *device) @@ -845,9 +828,7 @@ static int acpi_battery_remove(struct acpi_device *device, int type) #ifdef CONFIG_ACPI_PROCFS_POWER acpi_battery_remove_fs(device); #endif -#ifdef CONFIG_ACPI_SYSFS_POWER sysfs_remove_battery(battery); -#endif mutex_destroy(&battery->lock); kfree(battery); return 0; diff --git a/trunk/drivers/acpi/bus.c b/trunk/drivers/acpi/bus.c index d7a115c362d1..49d432d0a12c 100644 --- a/trunk/drivers/acpi/bus.c +++ b/trunk/drivers/acpi/bus.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #ifdef CONFIG_X86 @@ -763,14 +764,16 @@ static int __init acpi_init(void) result = acpi_bus_init(); if (!result) { - if (!(pm_flags & PM_APM)) - pm_flags |= PM_ACPI; +#ifdef CONFIG_PM_LEGACY + if (!PM_IS_ACTIVE()) + pm_active = 1; else { printk(KERN_INFO PREFIX "APM is already active, exiting\n"); disable_acpi(); result = -ENODEV; } +#endif } else disable_acpi(); diff --git a/trunk/drivers/acpi/ec.c b/trunk/drivers/acpi/ec.c index 97dc16155a55..d411017f8c06 100644 --- a/trunk/drivers/acpi/ec.c +++ b/trunk/drivers/acpi/ec.c @@ -892,17 +892,6 @@ static int acpi_ec_stop(struct acpi_device *device, int type) return 0; } -int __init acpi_boot_ec_enable(void) -{ - if (!boot_ec || boot_ec->handlers_installed) - return 0; - if (!ec_install_handlers(boot_ec)) { - first_ec = boot_ec; - return 0; - } - return -EFAULT; -} - int __init acpi_ec_ecdt_probe(void) { int ret; @@ -935,10 +924,9 @@ int __init acpi_ec_ecdt_probe(void) goto error; /* We really need to limit this workaround, the only ASUS, * which needs it, has fake EC._INI method, so use it as flag. - * Keep boot_ec struct as it will be needed soon. */ if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &x))) - return -ENODEV; + goto error; } ret = ec_install_handlers(boot_ec); diff --git a/trunk/drivers/acpi/events/evregion.c b/trunk/drivers/acpi/events/evregion.c index 58ad09725dd2..e99f0c435a47 100644 --- a/trunk/drivers/acpi/events/evregion.c +++ b/trunk/drivers/acpi/events/evregion.c @@ -344,7 +344,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, * setup will potentially execute control methods * (e.g., _REG method for this region) */ - acpi_ex_exit_interpreter(); + acpi_ex_relinquish_interpreter(); status = region_setup(region_obj, ACPI_REGION_ACTIVATE, handler_desc->address_space.context, @@ -352,7 +352,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, /* Re-enter the interpreter */ - acpi_ex_enter_interpreter(); + acpi_ex_reacquire_interpreter(); /* Check for failure of the Region Setup */ @@ -405,7 +405,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, * exit the interpreter because the handler *might* block -- we don't * know what it will do, so we can't hold the lock on the intepreter. */ - acpi_ex_exit_interpreter(); + acpi_ex_relinquish_interpreter(); } /* Call the handler */ @@ -426,7 +426,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, * We just returned from a non-default handler, we must re-enter the * interpreter */ - acpi_ex_enter_interpreter(); + acpi_ex_reacquire_interpreter(); } return_ACPI_STATUS(status); diff --git a/trunk/drivers/acpi/pci_irq.c b/trunk/drivers/acpi/pci_irq.c index 62010c2481b3..dd3186abe07a 100644 --- a/trunk/drivers/acpi/pci_irq.c +++ b/trunk/drivers/acpi/pci_irq.c @@ -429,15 +429,6 @@ int acpi_pci_irq_enable(struct pci_dev *dev) &polarity, &link, acpi_pci_allocate_irq); - if (irq < 0) { - /* - * IDE legacy mode controller IRQs are magic. Why do compat - * extensions always make such a nasty mess. - */ - if (dev->class >> 8 == PCI_CLASS_STORAGE_IDE && - (dev->class & 0x05) == 0) - return 0; - } /* * No IRQ known to the ACPI subsystem - maybe the BIOS / * driver reported one, then use it. Exit in any case. diff --git a/trunk/drivers/acpi/processor_idle.c b/trunk/drivers/acpi/processor_idle.c index 2235f4e02d26..2fe34cc73c13 100644 --- a/trunk/drivers/acpi/processor_idle.c +++ b/trunk/drivers/acpi/processor_idle.c @@ -76,11 +76,7 @@ static void (*pm_idle_save) (void) __read_mostly; #define PM_TIMER_TICKS_TO_US(p) (((p) * 1000)/(PM_TIMER_FREQUENCY/1000)) static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER; -#ifdef CONFIG_CPU_IDLE module_param(max_cstate, uint, 0000); -#else -module_param(max_cstate, uint, 0644); -#endif static unsigned int nocst __read_mostly; module_param(nocst, uint, 0000); diff --git a/trunk/drivers/acpi/sbs.c b/trunk/drivers/acpi/sbs.c index f136c7d3b3c2..22cb95b349e4 100644 --- a/trunk/drivers/acpi/sbs.c +++ b/trunk/drivers/acpi/sbs.c @@ -40,9 +40,7 @@ #include #include -#ifdef CONFIG_ACPI_SYSFS_POWER #include -#endif #include "sbshc.h" @@ -82,9 +80,7 @@ static const struct acpi_device_id sbs_device_ids[] = { MODULE_DEVICE_TABLE(acpi, sbs_device_ids); struct acpi_battery { -#ifdef CONFIG_ACPI_SYSFS_POWER struct power_supply bat; -#endif struct acpi_sbs *sbs; #ifdef CONFIG_ACPI_PROCFS_POWER struct proc_dir_entry *proc_entry; @@ -117,9 +113,7 @@ struct acpi_battery { #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); struct acpi_sbs { -#ifdef CONFIG_ACPI_SYSFS_POWER struct power_supply charger; -#endif struct acpi_device *device; struct acpi_smb_hc *hc; struct mutex lock; @@ -163,7 +157,6 @@ static inline int acpi_battery_scale(struct acpi_battery *battery) acpi_battery_ipscale(battery); } -#ifdef CONFIG_ACPI_SYSFS_POWER static int sbs_get_ac_property(struct power_supply *psy, enum power_supply_property psp, union power_supply_propval *val) @@ -301,7 +294,6 @@ static enum power_supply_property sbs_energy_battery_props[] = { POWER_SUPPLY_PROP_MODEL_NAME, POWER_SUPPLY_PROP_MANUFACTURER, }; -#endif /* -------------------------------------------------------------------------- Smart Battery System Management @@ -437,7 +429,6 @@ static int acpi_ac_get_present(struct acpi_sbs *sbs) return result; } -#ifdef CONFIG_ACPI_SYSFS_POWER static ssize_t acpi_battery_alarm_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -467,7 +458,6 @@ static struct device_attribute alarm_attr = { .show = acpi_battery_alarm_show, .store = acpi_battery_alarm_store, }; -#endif /* -------------------------------------------------------------------------- FS Interface (/proc/acpi) @@ -803,7 +793,6 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) &acpi_battery_state_fops, &acpi_battery_alarm_fops, battery); #endif -#ifdef CONFIG_ACPI_SYSFS_POWER battery->bat.name = battery->name; battery->bat.type = POWER_SUPPLY_TYPE_BATTERY; if (!acpi_battery_mode(battery)) { @@ -824,7 +813,6 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) goto end; battery->have_sysfs_alarm = 1; end: -#endif printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n", ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), battery->name, sbs->battery->present ? "present" : "absent"); @@ -834,13 +822,12 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) static void acpi_battery_remove(struct acpi_sbs *sbs, int id) { struct acpi_battery *battery = &sbs->battery[id]; -#ifdef CONFIG_ACPI_SYSFS_POWER + if (battery->bat.dev) { if (battery->have_sysfs_alarm) device_remove_file(battery->bat.dev, &alarm_attr); power_supply_unregister(&battery->bat); } -#endif #ifdef CONFIG_ACPI_PROCFS_POWER if (battery->proc_entry) acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir); @@ -861,14 +848,12 @@ static int acpi_charger_add(struct acpi_sbs *sbs) if (result) goto end; #endif -#ifdef CONFIG_ACPI_SYSFS_POWER sbs->charger.name = "sbs-charger"; sbs->charger.type = POWER_SUPPLY_TYPE_MAINS; sbs->charger.properties = sbs_ac_props; sbs->charger.num_properties = ARRAY_SIZE(sbs_ac_props); sbs->charger.get_property = sbs_get_ac_property; power_supply_register(&sbs->device->dev, &sbs->charger); -#endif printk(KERN_INFO PREFIX "%s [%s]: AC Adapter [%s] (%s)\n", ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), ACPI_AC_DIR_NAME, sbs->charger_present ? "on-line" : "off-line"); @@ -878,10 +863,8 @@ static int acpi_charger_add(struct acpi_sbs *sbs) static void acpi_charger_remove(struct acpi_sbs *sbs) { -#ifdef CONFIG_ACPI_SYSFS_POWER if (sbs->charger.dev) power_supply_unregister(&sbs->charger); -#endif #ifdef CONFIG_ACPI_PROCFS_POWER if (sbs->charger_entry) acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir); @@ -902,9 +885,7 @@ void acpi_sbs_callback(void *context) ACPI_SBS_NOTIFY_STATUS, sbs->charger_present); #endif -#ifdef CONFIG_ACPI_SYSFS_POWER kobject_uevent(&sbs->charger.dev->kobj, KOBJ_CHANGE); -#endif } if (sbs->manager_present) { for (id = 0; id < MAX_SBS_BAT; ++id) { @@ -921,9 +902,7 @@ void acpi_sbs_callback(void *context) ACPI_SBS_NOTIFY_STATUS, bat->present); #endif -#ifdef CONFIG_ACPI_SYSFS_POWER kobject_uevent(&bat->bat.dev->kobj, KOBJ_CHANGE); -#endif } } } diff --git a/trunk/drivers/acpi/scan.c b/trunk/drivers/acpi/scan.c index cbfe9ae7a9e5..5b4d462117cf 100644 --- a/trunk/drivers/acpi/scan.c +++ b/trunk/drivers/acpi/scan.c @@ -1449,8 +1449,6 @@ static int acpi_bus_scan_fixed(struct acpi_device *root) return result; } -int __init acpi_boot_ec_enable(void); - static int __init acpi_scan_init(void) { int result; @@ -1482,10 +1480,6 @@ static int __init acpi_scan_init(void) * Enumerate devices in the ACPI namespace. */ result = acpi_bus_scan_fixed(acpi_root); - - /* EC region might be needed at bus_scan, so enable it now */ - acpi_boot_ec_enable(); - if (!result) result = acpi_bus_scan(acpi_root, &ops); diff --git a/trunk/drivers/ata/libata-eh.c b/trunk/drivers/ata/libata-eh.c index 21a81cd148e4..f0124a8d3134 100644 --- a/trunk/drivers/ata/libata-eh.c +++ b/trunk/drivers/ata/libata-eh.c @@ -1733,15 +1733,11 @@ static void ata_eh_link_autopsy(struct ata_link *link) ehc->i.action &= ~ATA_EH_PERDEV_MASK; } - /* propagate timeout to host link */ - if ((all_err_mask & AC_ERR_TIMEOUT) && !ata_is_host_link(link)) - ap->link.eh_context.i.err_mask |= AC_ERR_TIMEOUT; - - /* record error and consider speeding down */ + /* consider speeding down */ dev = ehc->i.dev; - if (!dev && ((ata_link_max_devices(link) == 1 && - ata_dev_enabled(link->device)))) - dev = link->device; + if (!dev && ata_link_max_devices(link) == 1 && + ata_dev_enabled(link->device)) + dev = link->device; if (dev) ehc->i.action |= ata_eh_speed_down(dev, is_io, all_err_mask); @@ -1763,14 +1759,8 @@ void ata_eh_autopsy(struct ata_port *ap) { struct ata_link *link; - ata_port_for_each_link(link, ap) + __ata_port_for_each_link(link, ap) ata_eh_link_autopsy(link); - - /* Autopsy of fanout ports can affect host link autopsy. - * Perform host link autopsy last. - */ - if (ap->nr_pmp_links) - ata_eh_link_autopsy(&ap->link); } /** @@ -2167,11 +2157,13 @@ int ata_eh_reset(struct ata_link *link, int classify, if (ata_link_offline(link)) continue; - /* apply class override */ + /* apply class override and convert UNKNOWN to NONE */ if (lflags & ATA_LFLAG_ASSUME_ATA) classes[dev->devno] = ATA_DEV_ATA; else if (lflags & ATA_LFLAG_ASSUME_SEMB) classes[dev->devno] = ATA_DEV_SEMB_UNSUP; /* not yet */ + else if (classes[dev->devno] == ATA_DEV_UNKNOWN) + classes[dev->devno] = ATA_DEV_NONE; } /* record current link speed */ diff --git a/trunk/drivers/ata/libata-pmp.c b/trunk/drivers/ata/libata-pmp.c index caef2bbd4a8a..c0c4dbcde091 100644 --- a/trunk/drivers/ata/libata-pmp.c +++ b/trunk/drivers/ata/libata-pmp.c @@ -495,12 +495,14 @@ static void sata_pmp_quirks(struct ata_port *ap) /* SError.N need a kick in the ass to get working */ link->flags |= ATA_LFLAG_HRST_TO_RESUME; - /* Class code report is unreliable and SRST - * times out under certain configurations. - * Config device can be at port 0 or 5 and - * locks up on SRST. + /* class code report is unreliable */ + if (link->pmp < 5) + link->flags |= ATA_LFLAG_ASSUME_ATA; + + /* The config device, which can be either at + * port 0 or 5, locks up on SRST. */ - if (link->pmp <= 5) + if (link->pmp == 0 || link->pmp == 5) link->flags |= ATA_LFLAG_NO_SRST | ATA_LFLAG_ASSUME_ATA; diff --git a/trunk/drivers/ata/libata-scsi.c b/trunk/drivers/ata/libata-scsi.c index 264ae60e3fd8..a883bb03d4c7 100644 --- a/trunk/drivers/ata/libata-scsi.c +++ b/trunk/drivers/ata/libata-scsi.c @@ -872,8 +872,7 @@ int ata_scsi_slave_config(struct scsi_device *sdev) ata_scsi_sdev_config(sdev); - if (dev->class == ATA_DEV_ATA) - sdev->manage_start_stop = 1; + sdev->manage_start_stop = 1; if (dev) ata_scsi_dev_config(sdev, dev); diff --git a/trunk/drivers/ata/libata-sff.c b/trunk/drivers/ata/libata-sff.c index b7ac80b4b1fb..48acc09dab96 100644 --- a/trunk/drivers/ata/libata-sff.c +++ b/trunk/drivers/ata/libata-sff.c @@ -806,10 +806,7 @@ int ata_pci_init_one(struct pci_dev *pdev, if (rc) goto err_out; - if (!legacy_mode && pdev->irq) { - /* We may have no IRQ assigned in which case we can poll. This - shouldn't happen on a sane system but robustness is cheap - in this case */ + if (!legacy_mode) { rc = devm_request_irq(dev, pdev->irq, pi->port_ops->irq_handler, IRQF_SHARED, DRV_NAME, host); if (rc) @@ -817,7 +814,7 @@ int ata_pci_init_one(struct pci_dev *pdev, ata_port_desc(host->ports[0], "irq %d", pdev->irq); ata_port_desc(host->ports[1], "irq %d", pdev->irq); - } else if (legacy_mode) { + } else { if (!ata_port_is_dummy(host->ports[0])) { rc = devm_request_irq(dev, ATA_PRIMARY_IRQ(pdev), pi->port_ops->irq_handler, diff --git a/trunk/drivers/ata/pata_ixp4xx_cf.c b/trunk/drivers/ata/pata_ixp4xx_cf.c index 120b5bfa7ce6..fcd532afbf2e 100644 --- a/trunk/drivers/ata/pata_ixp4xx_cf.c +++ b/trunk/drivers/ata/pata_ixp4xx_cf.c @@ -130,11 +130,10 @@ static struct ata_port_operations ixp4xx_port_ops = { .port_start = ata_port_start, }; -static void ixp4xx_setup_port(struct ata_port *ap, +static void ixp4xx_setup_port(struct ata_ioports *ioaddr, struct ixp4xx_pata_data *data, unsigned long raw_cs0, unsigned long raw_cs1) { - struct ata_ioports *ioaddr = &ap->ioaddr; unsigned long raw_cmd = raw_cs0; unsigned long raw_ctl = raw_cs1 + 0x06; diff --git a/trunk/drivers/ata/pata_pdc202xx_old.c b/trunk/drivers/ata/pata_pdc202xx_old.c index 8f2815601791..bc7c2d5d8d5e 100644 --- a/trunk/drivers/ata/pata_pdc202xx_old.c +++ b/trunk/drivers/ata/pata_pdc202xx_old.c @@ -215,8 +215,8 @@ static void pdc2026x_bmdma_stop(struct ata_queued_cmd *qc) /* Flip back to 33Mhz for PIO */ if (adev->dma_mode >= XFER_UDMA_2) iowrite8(ioread8(clock) & ~sel66, clock); + ata_bmdma_stop(qc); - pdc202xx_set_piomode(ap, adev); } /** @@ -233,17 +233,6 @@ static void pdc2026x_dev_config(struct ata_device *adev) adev->max_sectors = 256; } -static int pdc2026x_port_start(struct ata_port *ap) -{ - void __iomem *bmdma = ap->ioaddr.bmdma_addr; - if (bmdma) { - /* Enable burst mode */ - u8 burst = ioread8(bmdma + 0x1f); - iowrite8(burst | 0x01, bmdma + 0x1f); - } - return ata_sff_port_start(ap); -} - static struct scsi_host_template pdc202xx_sht = { .module = THIS_MODULE, .name = DRV_NAME, @@ -324,7 +313,7 @@ static struct ata_port_operations pdc2026x_port_ops = { .irq_clear = ata_bmdma_irq_clear, .irq_on = ata_irq_on, - .port_start = pdc2026x_port_start, + .port_start = ata_sff_port_start, }; static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) diff --git a/trunk/drivers/ata/sata_qstor.c b/trunk/drivers/ata/sata_qstor.c index c68b241805fd..2f1de6ec044c 100644 --- a/trunk/drivers/ata/sata_qstor.c +++ b/trunk/drivers/ata/sata_qstor.c @@ -270,7 +270,7 @@ static int qs_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) static void qs_error_handler(struct ata_port *ap) { qs_enter_reg_mode(ap); - ata_do_eh(ap, qs_prereset, NULL, sata_std_hardreset, + ata_do_eh(ap, qs_prereset, ata_std_softreset, NULL, ata_std_postreset); } diff --git a/trunk/drivers/ata/sata_sil24.c b/trunk/drivers/ata/sata_sil24.c index b4c674d83769..96fd5260446d 100644 --- a/trunk/drivers/ata/sata_sil24.c +++ b/trunk/drivers/ata/sata_sil24.c @@ -832,31 +832,16 @@ static int sil24_qc_defer(struct ata_queued_cmd *qc) struct ata_link *link = qc->dev->link; struct ata_port *ap = link->ap; u8 prot = qc->tf.protocol; - - /* - * There is a bug in the chip: - * Port LRAM Causes the PRB/SGT Data to be Corrupted - * If the host issues a read request for LRAM and SActive registers - * while active commands are available in the port, PRB/SGT data in - * the LRAM can become corrupted. This issue applies only when - * reading from, but not writing to, the LRAM. - * - * Therefore, reading LRAM when there is no particular error [and - * other commands may be outstanding] is prohibited. - * - * To avoid this bug there are two situations where a command must run - * exclusive of any other commands on the port: - * - * - ATAPI commands which check the sense data - * - Passthrough ATA commands which always have ATA_QCFLAG_RESULT_TF - * set. - * - */ - int is_excl = (prot == ATA_PROT_ATAPI || - prot == ATA_PROT_ATAPI_NODATA || - prot == ATA_PROT_ATAPI_DMA || - (qc->flags & ATA_QCFLAG_RESULT_TF)); - + int is_atapi = (prot == ATA_PROT_ATAPI || + prot == ATA_PROT_ATAPI_NODATA || + prot == ATA_PROT_ATAPI_DMA); + + /* ATAPI commands completing with CHECK_SENSE cause various + * weird problems if other commands are active. PMP DMA CS + * errata doesn't cover all and HSM violation occurs even with + * only one other device active. Always run an ATAPI command + * by itself. + */ if (unlikely(ap->excl_link)) { if (link == ap->excl_link) { if (ap->nr_active_links) @@ -864,7 +849,7 @@ static int sil24_qc_defer(struct ata_queued_cmd *qc) qc->flags |= ATA_QCFLAG_CLEAR_EXCL; } else return ATA_DEFER_PORT; - } else if (unlikely(is_excl)) { + } else if (unlikely(is_atapi)) { ap->excl_link = link; if (ap->nr_active_links) return ATA_DEFER_PORT; diff --git a/trunk/drivers/block/loop.c b/trunk/drivers/block/loop.c index b8af22e610df..56e23042728a 100644 --- a/trunk/drivers/block/loop.c +++ b/trunk/drivers/block/loop.c @@ -610,7 +610,7 @@ static int loop_thread(void *data) static int loop_switch(struct loop_device *lo, struct file *file) { struct switch_request w; - struct bio *bio = bio_alloc(GFP_KERNEL, 0); + struct bio *bio = bio_alloc(GFP_KERNEL, 1); if (!bio) return -ENOMEM; init_completion(&w.wait); diff --git a/trunk/drivers/crypto/padlock-aes.c b/trunk/drivers/crypto/padlock-aes.c index 5f7e71810489..a337b693b6c9 100644 --- a/trunk/drivers/crypto/padlock-aes.c +++ b/trunk/drivers/crypto/padlock-aes.c @@ -429,8 +429,8 @@ static inline void padlock_xcrypt(const u8 *input, u8 *output, void *key, static void aes_crypt_copy(const u8 *in, u8 *out, u32 *key, struct cword *cword) { - u8 buf[AES_BLOCK_SIZE * 2 + PADLOCK_ALIGNMENT - 1]; - u8 *tmp = PTR_ALIGN(&buf[0], PADLOCK_ALIGNMENT); + u8 tmp[AES_BLOCK_SIZE * 2] + __attribute__ ((__aligned__(PADLOCK_ALIGNMENT))); memcpy(tmp, in, AES_BLOCK_SIZE); padlock_xcrypt(tmp, out, key, cword); diff --git a/trunk/drivers/ide/ide-acpi.c b/trunk/drivers/ide/ide-acpi.c index 899d56536e80..89df48fdc69d 100644 --- a/trunk/drivers/ide/ide-acpi.c +++ b/trunk/drivers/ide/ide-acpi.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include @@ -66,39 +65,6 @@ extern int ide_noacpi; extern int ide_noacpitfs; extern int ide_noacpionboot; -static bool ide_noacpi_psx; -static int no_acpi_psx(const struct dmi_system_id *id) -{ - ide_noacpi_psx = true; - printk(KERN_NOTICE"%s detected - disable ACPI _PSx.\n", id->ident); - return 0; -} - -static const struct dmi_system_id ide_acpi_dmi_table[] = { - /* Bug 9673. */ - /* We should check if this is because ACPI NVS isn't save/restored. */ - { - .callback = no_acpi_psx, - .ident = "HP nx9005", - .matches = { - DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies Ltd."), - DMI_MATCH(DMI_BIOS_VERSION, "KAM1.60") - }, - }, - - { } /* terminate list */ -}; - -static int ide_acpi_blacklist(void) -{ - static int done; - if (done) - return 0; - done = 1; - dmi_check_system(ide_acpi_dmi_table); - return 0; -} - /** * ide_get_dev_handle - finds acpi_handle and PCI device.function * @dev: device to locate @@ -657,7 +623,7 @@ void ide_acpi_set_state(ide_hwif_t *hwif, int on) { int unit; - if (ide_noacpi || ide_noacpi_psx) + if (ide_noacpi) return; DEBPRINT("ENTER:\n"); @@ -702,8 +668,6 @@ void ide_acpi_init(ide_hwif_t *hwif) struct ide_acpi_drive_link *master; struct ide_acpi_drive_link *slave; - ide_acpi_blacklist(); - hwif->acpidata = kzalloc(sizeof(struct ide_acpi_hwif_link), GFP_KERNEL); if (!hwif->acpidata) return; diff --git a/trunk/drivers/ide/ide-iops.c b/trunk/drivers/ide/ide-iops.c index bb9693dabe41..cef405ddaf0e 100644 --- a/trunk/drivers/ide/ide-iops.c +++ b/trunk/drivers/ide/ide-iops.c @@ -612,12 +612,12 @@ u8 eighty_ninty_three (ide_drive_t *drive) printk(KERN_DEBUG "%s: skipping word 93 validity check\n", drive->name); - if (ide_dev_is_sata(id) && !ivb) - return 1; - if (hwif->cbl != ATA_CBL_PATA80 && !ivb) goto no_80w; + if (ide_dev_is_sata(id)) + return 1; + /* * FIXME: * - force bit13 (80c cable present) check also for !ivb devices diff --git a/trunk/drivers/ide/pci/trm290.c b/trunk/drivers/ide/pci/trm290.c index 0151d7fdfb8a..0895e753a35d 100644 --- a/trunk/drivers/ide/pci/trm290.c +++ b/trunk/drivers/ide/pci/trm290.c @@ -1,8 +1,7 @@ /* - * linux/drivers/ide/pci/trm290.c Version 1.05 Dec. 26, 2007 + * linux/drivers/ide/pci/trm290.c Version 1.02 Mar. 18, 2000 * * Copyright (c) 1997-1998 Mark Lord - * Copyright (c) 2007 MontaVista Software, Inc. * May be copied or modified under the terms of the GNU General Public License * * June 22, 2004 - get rid of check_region @@ -178,7 +177,7 @@ static void trm290_selectproc (ide_drive_t *drive) trm290_prepare_drive(drive, drive->using_dma); } -static void trm290_dma_exec_cmd(ide_drive_t *drive, u8 command) +static void trm290_ide_dma_exec_cmd(ide_drive_t *drive, u8 command) { BUG_ON(HWGROUP(drive)->handler != NULL); /* paranoia check */ ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL); @@ -186,7 +185,7 @@ static void trm290_dma_exec_cmd(ide_drive_t *drive, u8 command) outb(command, IDE_COMMAND_REG); } -static int trm290_dma_setup(ide_drive_t *drive) +static int trm290_ide_dma_setup(ide_drive_t *drive) { ide_hwif_t *hwif = drive->hwif; struct request *rq = hwif->hwgroup->rq; @@ -216,7 +215,7 @@ static int trm290_dma_setup(ide_drive_t *drive) return 0; } -static void trm290_dma_start(ide_drive_t *drive) +static void trm290_ide_dma_start(ide_drive_t *drive) { } @@ -241,14 +240,6 @@ static int trm290_ide_dma_test_irq (ide_drive_t *drive) return (status == 0x00ff); } -static void trm290_dma_host_on(ide_drive_t *drive) -{ -} - -static void trm290_dma_host_off(ide_drive_t *drive) -{ -} - static void __devinit init_hwif_trm290(ide_hwif_t *hwif) { unsigned int cfgbase = 0; @@ -289,13 +280,11 @@ static void __devinit init_hwif_trm290(ide_hwif_t *hwif) ide_setup_dma(hwif, (hwif->config_data + 4) ^ (hwif->channel ? 0x0080 : 0x0000), 3); - hwif->dma_host_off = &trm290_dma_host_off; - hwif->dma_host_on = &trm290_dma_host_on; - hwif->dma_setup = &trm290_dma_setup; - hwif->dma_exec_cmd = &trm290_dma_exec_cmd; - hwif->dma_start = &trm290_dma_start; - hwif->ide_dma_end = &trm290_ide_dma_end; - hwif->ide_dma_test_irq = &trm290_ide_dma_test_irq; + hwif->dma_setup = &trm290_ide_dma_setup; + hwif->dma_exec_cmd = &trm290_ide_dma_exec_cmd; + hwif->dma_start = &trm290_ide_dma_start; + hwif->ide_dma_end = &trm290_ide_dma_end; + hwif->ide_dma_test_irq = &trm290_ide_dma_test_irq; hwif->selectproc = &trm290_selectproc; #if 1 diff --git a/trunk/drivers/media/dvb/ttpci/av7110.c b/trunk/drivers/media/dvb/ttpci/av7110.c index 0d36c155695b..8b8144f77a73 100644 --- a/trunk/drivers/media/dvb/ttpci/av7110.c +++ b/trunk/drivers/media/dvb/ttpci/av7110.c @@ -2800,12 +2800,12 @@ static void av7110_irq(struct saa7146_dev* dev, u32 *isr) } -static struct saa7146_extension av7110_extension_driver; +static struct saa7146_extension av7110_extension; #define MAKE_AV7110_INFO(x_var,x_name) \ static struct saa7146_pci_extension_data x_var = { \ .ext_priv = x_name, \ - .ext = &av7110_extension_driver } + .ext = &av7110_extension } MAKE_AV7110_INFO(tts_1_X_fsc,"Technotrend/Hauppauge WinTV DVB-S rev1.X or Fujitsu Siemens DVB-C"); MAKE_AV7110_INFO(ttt_1_X, "Technotrend/Hauppauge WinTV DVB-T rev1.X"); @@ -2843,7 +2843,7 @@ static struct pci_device_id pci_tbl[] = { MODULE_DEVICE_TABLE(pci, pci_tbl); -static struct saa7146_extension av7110_extension_driver = { +static struct saa7146_extension av7110_extension = { .name = "dvb", .flags = SAA7146_USE_I2C_IRQ, @@ -2860,14 +2860,14 @@ static struct saa7146_extension av7110_extension_driver = { static int __init av7110_init(void) { int retval; - retval = saa7146_register_extension(&av7110_extension_driver); + retval = saa7146_register_extension(&av7110_extension); return retval; } static void __exit av7110_exit(void) { - saa7146_unregister_extension(&av7110_extension_driver); + saa7146_unregister_extension(&av7110_extension); } module_init(av7110_init); diff --git a/trunk/drivers/media/video/ivtv/ivtv-driver.c b/trunk/drivers/media/video/ivtv/ivtv-driver.c index 6d2dd8764f81..10d6faf8ccda 100644 --- a/trunk/drivers/media/video/ivtv/ivtv-driver.c +++ b/trunk/drivers/media/video/ivtv/ivtv-driver.c @@ -1076,6 +1076,10 @@ static int __devinit ivtv_probe(struct pci_dev *dev, ivtv_process_eeprom(itv); } + /* The mspx4xx chips need a longer delay for some reason */ + if (!(itv->hw_flags & IVTV_HW_MSP34XX)) + itv->i2c_algo.udelay = 5; + if (itv->std == 0) { itv->std = V4L2_STD_NTSC_M; } diff --git a/trunk/drivers/mtd/chips/cfi_cmdset_0001.c b/trunk/drivers/mtd/chips/cfi_cmdset_0001.c index 1707f98c322c..a9eb1c516247 100644 --- a/trunk/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/trunk/drivers/mtd/chips/cfi_cmdset_0001.c @@ -1504,12 +1504,9 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, int ret, wbufsize, word_gap, words; const struct kvec *vec; unsigned long vec_seek; - unsigned long initial_adr; - int initial_len = len; wbufsize = cfi_interleave(cfi) << cfi->cfiq->MaxBufWriteSize; adr += chip->start; - initial_adr = adr; cmd_adr = adr & ~(wbufsize-1); /* Let's determine this according to the interleave only once */ @@ -1522,7 +1519,7 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, return ret; } - XIP_INVAL_CACHED_RANGE(map, initial_adr, initial_len); + XIP_INVAL_CACHED_RANGE(map, adr, len); ENABLE_VPP(map); xip_disable(map, chip, cmd_adr); @@ -1613,7 +1610,7 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, chip->state = FL_WRITING; ret = INVAL_CACHE_AND_WAIT(map, chip, cmd_adr, - initial_adr, initial_len, + adr, len, chip->buffer_write_time); if (ret) { map_write(map, CMD(0x70), cmd_adr); diff --git a/trunk/drivers/net/3c509.c b/trunk/drivers/net/3c509.c index 8fafac987e0b..edda6e10ebe5 100644 --- a/trunk/drivers/net/3c509.c +++ b/trunk/drivers/net/3c509.c @@ -385,7 +385,6 @@ static int __init el3_probe(int card_idx) #if defined(__ISAPNP__) static int pnp_cards; struct pnp_dev *idev = NULL; - int pnp_found = 0; if (nopnp == 1) goto no_pnp; @@ -431,7 +430,6 @@ static int __init el3_probe(int card_idx) pnp_cards++; netdev_boot_setup_check(dev); - pnp_found = 1; goto found; } } @@ -562,8 +560,6 @@ static int __init el3_probe(int card_idx) lp = netdev_priv(dev); #if defined(__ISAPNP__) lp->dev = &idev->dev; - if (pnp_found) - lp->type = EL3_PNP; #endif err = el3_common_init(dev); diff --git a/trunk/drivers/net/Kconfig b/trunk/drivers/net/Kconfig index 114771a2a133..d9107e542dfa 100644 --- a/trunk/drivers/net/Kconfig +++ b/trunk/drivers/net/Kconfig @@ -166,6 +166,16 @@ config NET_SB1000 If you don't have this card, of course say N. +config IP1000 + tristate "IP1000 Gigabit Ethernet support" + depends on PCI && EXPERIMENTAL + select MII + ---help--- + This driver supports IP1000 gigabit Ethernet cards. + + To compile this driver as a module, choose M here: the module + will be called ipg. This is recommended. + source "drivers/net/arcnet/Kconfig" source "drivers/net/phy/Kconfig" @@ -1982,16 +1992,6 @@ config E1000E To compile this driver as a module, choose M here. The module will be called e1000e. -config IP1000 - tristate "IP1000 Gigabit Ethernet support" - depends on PCI && EXPERIMENTAL - select MII - ---help--- - This driver supports IP1000 gigabit Ethernet cards. - - To compile this driver as a module, choose M here: the module - will be called ipg. This is recommended. - source "drivers/net/ixp2000/Kconfig" config MYRI_SBUS diff --git a/trunk/drivers/net/fs_enet/fs_enet-main.c b/trunk/drivers/net/fs_enet/fs_enet-main.c index c83bd6560088..3e1a57a42f11 100644 --- a/trunk/drivers/net/fs_enet/fs_enet-main.c +++ b/trunk/drivers/net/fs_enet/fs_enet-main.c @@ -894,21 +894,14 @@ static void fs_get_regs(struct net_device *dev, struct ethtool_regs *regs, static int fs_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) { struct fs_enet_private *fep = netdev_priv(dev); - - if (!fep->phydev) - return -ENODEV; - return phy_ethtool_gset(fep->phydev, cmd); } static int fs_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) { struct fs_enet_private *fep = netdev_priv(dev); - - if (!fep->phydev) - return -ENODEV; - - return phy_ethtool_sset(fep->phydev, cmd); + phy_ethtool_sset(fep->phydev, cmd); + return 0; } static int fs_nway_reset(struct net_device *dev) diff --git a/trunk/drivers/net/loopback.c b/trunk/drivers/net/loopback.c index fa147cd5d68c..662b8d16803c 100644 --- a/trunk/drivers/net/loopback.c +++ b/trunk/drivers/net/loopback.c @@ -242,7 +242,7 @@ static void loopback_setup(struct net_device *dev) | NETIF_F_NO_CSUM | NETIF_F_HIGHDMA | NETIF_F_LLTX - | NETIF_F_NETNS_LOCAL; + | NETIF_F_NETNS_LOCAL, dev->ethtool_ops = &loopback_ethtool_ops; dev->header_ops = ð_header_ops; dev->init = loopback_dev_init; diff --git a/trunk/drivers/net/netxen/netxen_nic.h b/trunk/drivers/net/netxen/netxen_nic.h index a8f63c47b3cd..fbc2553275dc 100644 --- a/trunk/drivers/net/netxen/netxen_nic.h +++ b/trunk/drivers/net/netxen/netxen_nic.h @@ -65,8 +65,8 @@ #define _NETXEN_NIC_LINUX_MAJOR 3 #define _NETXEN_NIC_LINUX_MINOR 4 -#define _NETXEN_NIC_LINUX_SUBVERSION 18 -#define NETXEN_NIC_LINUX_VERSIONID "3.4.18" +#define _NETXEN_NIC_LINUX_SUBVERSION 2 +#define NETXEN_NIC_LINUX_VERSIONID "3.4.2" #define NETXEN_NUM_FLASH_SECTORS (64) #define NETXEN_FLASH_SECTOR_SIZE (64 * 1024) @@ -309,26 +309,23 @@ struct netxen_ring_ctx { ((cmd_desc)->port_ctxid |= ((var) & 0xF0)) #define netxen_set_cmd_desc_flags(cmd_desc, val) \ - (cmd_desc)->flags_opcode = ((cmd_desc)->flags_opcode & \ - ~cpu_to_le16(0x7f)) | cpu_to_le16((val) & 0x7f) + ((cmd_desc)->flags_opcode &= ~cpu_to_le16(0x7f), \ + (cmd_desc)->flags_opcode |= cpu_to_le16((val) & 0x7f)) #define netxen_set_cmd_desc_opcode(cmd_desc, val) \ - (cmd_desc)->flags_opcode = ((cmd_desc)->flags_opcode & \ - ~cpu_to_le16((u16)0x3f << 7)) | cpu_to_le16(((val) & 0x3f) << 7) + ((cmd_desc)->flags_opcode &= ~cpu_to_le16(0x3f<<7), \ + (cmd_desc)->flags_opcode |= cpu_to_le16(((val & 0x3f)<<7))) #define netxen_set_cmd_desc_num_of_buff(cmd_desc, val) \ - (cmd_desc)->num_of_buffers_total_length = \ - ((cmd_desc)->num_of_buffers_total_length & \ - ~cpu_to_le32(0xff)) | cpu_to_le32((val) & 0xff) + ((cmd_desc)->num_of_buffers_total_length &= ~cpu_to_le32(0xff), \ + (cmd_desc)->num_of_buffers_total_length |= cpu_to_le32((val) & 0xff)) #define netxen_set_cmd_desc_totallength(cmd_desc, val) \ - (cmd_desc)->num_of_buffers_total_length = \ - ((cmd_desc)->num_of_buffers_total_length & \ - ~cpu_to_le32((u32)0xffffff << 8)) | \ - cpu_to_le32(((val) & 0xffffff) << 8) + ((cmd_desc)->num_of_buffers_total_length &= ~cpu_to_le32(0xffffff00), \ + (cmd_desc)->num_of_buffers_total_length |= cpu_to_le32(val << 8)) #define netxen_get_cmd_desc_opcode(cmd_desc) \ - ((le16_to_cpu((cmd_desc)->flags_opcode) >> 7) & 0x003f) + ((le16_to_cpu((cmd_desc)->flags_opcode) >> 7) & 0x003F) #define netxen_get_cmd_desc_totallength(cmd_desc) \ - ((le32_to_cpu((cmd_desc)->num_of_buffers_total_length) >> 8) & 0xffffff) + (le32_to_cpu((cmd_desc)->num_of_buffers_total_length) >> 8) struct cmd_desc_type0 { u8 tcp_hdr_offset; /* For LSO only */ @@ -415,29 +412,29 @@ struct rcv_desc { #define netxen_get_sts_desc_lro_last_frag(status_desc) \ (((status_desc)->lro & 0x80) >> 7) -#define netxen_get_sts_port(sts_data) \ - ((sts_data) & 0x0F) -#define netxen_get_sts_status(sts_data) \ - (((sts_data) >> 4) & 0x0F) -#define netxen_get_sts_type(sts_data) \ - (((sts_data) >> 8) & 0x0F) -#define netxen_get_sts_totallength(sts_data) \ - (((sts_data) >> 12) & 0xFFFF) -#define netxen_get_sts_refhandle(sts_data) \ - (((sts_data) >> 28) & 0xFFFF) -#define netxen_get_sts_prot(sts_data) \ - (((sts_data) >> 44) & 0x0F) -#define netxen_get_sts_opcode(sts_data) \ - (((sts_data) >> 58) & 0x03F) - +#define netxen_get_sts_port(status_desc) \ + (le64_to_cpu((status_desc)->status_desc_data) & 0x0F) +#define netxen_get_sts_status(status_desc) \ + ((le64_to_cpu((status_desc)->status_desc_data) >> 4) & 0x0F) +#define netxen_get_sts_type(status_desc) \ + ((le64_to_cpu((status_desc)->status_desc_data) >> 8) & 0x0F) +#define netxen_get_sts_totallength(status_desc) \ + ((le64_to_cpu((status_desc)->status_desc_data) >> 12) & 0xFFFF) +#define netxen_get_sts_refhandle(status_desc) \ + ((le64_to_cpu((status_desc)->status_desc_data) >> 28) & 0xFFFF) +#define netxen_get_sts_prot(status_desc) \ + ((le64_to_cpu((status_desc)->status_desc_data) >> 44) & 0x0F) #define netxen_get_sts_owner(status_desc) \ ((le64_to_cpu((status_desc)->status_desc_data) >> 56) & 0x03) -#define netxen_set_sts_owner(status_desc, val) { \ - (status_desc)->status_desc_data = \ - ((status_desc)->status_desc_data & \ - ~cpu_to_le64(0x3ULL << 56)) | \ - cpu_to_le64((u64)((val) & 0x3) << 56); \ -} +#define netxen_get_sts_opcode(status_desc) \ + ((le64_to_cpu((status_desc)->status_desc_data) >> 58) & 0x03F) + +#define netxen_clear_sts_owner(status_desc) \ + ((status_desc)->status_desc_data &= \ + ~cpu_to_le64(((unsigned long long)3) << 56 )) +#define netxen_set_sts_owner(status_desc, val) \ + ((status_desc)->status_desc_data |= \ + cpu_to_le64(((unsigned long long)((val) & 0x3)) << 56 )) struct status_desc { /* Bit pattern: 0-3 port, 4-7 status, 8-11 type, 12-27 total_length diff --git a/trunk/drivers/net/netxen/netxen_nic_init.c b/trunk/drivers/net/netxen/netxen_nic_init.c index 485ff9398910..37589265297e 100644 --- a/trunk/drivers/net/netxen/netxen_nic_init.c +++ b/trunk/drivers/net/netxen/netxen_nic_init.c @@ -1070,17 +1070,16 @@ netxen_process_rcv(struct netxen_adapter *adapter, int ctxid, { struct pci_dev *pdev = adapter->pdev; struct net_device *netdev = adapter->netdev; - u64 sts_data = le64_to_cpu(desc->status_desc_data); - int index = netxen_get_sts_refhandle(sts_data); + int index = netxen_get_sts_refhandle(desc); struct netxen_recv_context *recv_ctx = &(adapter->recv_ctx[ctxid]); struct netxen_rx_buffer *buffer; struct sk_buff *skb; - u32 length = netxen_get_sts_totallength(sts_data); + u32 length = netxen_get_sts_totallength(desc); u32 desc_ctx; struct netxen_rcv_desc_ctx *rcv_desc; int ret; - desc_ctx = netxen_get_sts_type(sts_data); + desc_ctx = netxen_get_sts_type(desc); if (unlikely(desc_ctx >= NUM_RCV_DESC_RINGS)) { printk("%s: %s Bad Rcv descriptor ring\n", netxen_nic_driver_name, netdev->name); @@ -1120,7 +1119,7 @@ netxen_process_rcv(struct netxen_adapter *adapter, int ctxid, skb = (struct sk_buff *)buffer->skb; if (likely(adapter->rx_csum && - netxen_get_sts_status(sts_data) == STATUS_CKSUM_OK)) { + netxen_get_sts_status(desc) == STATUS_CKSUM_OK)) { adapter->stats.csummed++; skb->ip_summed = CHECKSUM_UNNECESSARY; } else @@ -1210,6 +1209,7 @@ u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctxid, int max) break; } netxen_process_rcv(adapter, ctxid, desc); + netxen_clear_sts_owner(desc); netxen_set_sts_owner(desc, STATUS_OWNER_PHANTOM); consumer = (consumer + 1) & (adapter->max_rx_desc_count - 1); count++; @@ -1248,6 +1248,7 @@ int netxen_process_cmd_ring(unsigned long data) struct pci_dev *pdev; struct netxen_skb_frag *frag; u32 i; + struct sk_buff *skb = NULL; int done; spin_lock(&adapter->tx_lock); @@ -1277,8 +1278,9 @@ int netxen_process_cmd_ring(unsigned long data) while ((last_consumer != consumer) && (count1 < MAX_STATUS_HANDLE)) { buffer = &adapter->cmd_buf_arr[last_consumer]; pdev = adapter->pdev; - if (buffer->skb) { - frag = &buffer->frag_array[0]; + frag = &buffer->frag_array[0]; + skb = buffer->skb; + if (skb && (cmpxchg(&buffer->skb, skb, 0) == skb)) { pci_unmap_single(pdev, frag->dma, frag->length, PCI_DMA_TODEVICE); frag->dma = 0ULL; @@ -1291,8 +1293,8 @@ int netxen_process_cmd_ring(unsigned long data) } adapter->stats.skbfreed++; - dev_kfree_skb_any(buffer->skb); - buffer->skb = NULL; + dev_kfree_skb_any(skb); + skb = NULL; } else if (adapter->proc_cmd_buf_counter == 1) { adapter->stats.txnullskb++; } diff --git a/trunk/drivers/net/netxen/netxen_nic_main.c b/trunk/drivers/net/netxen/netxen_nic_main.c index 263b55e36c7a..454226f7baa8 100644 --- a/trunk/drivers/net/netxen/netxen_nic_main.c +++ b/trunk/drivers/net/netxen/netxen_nic_main.c @@ -732,6 +732,11 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) unregister_netdev(netdev); + if (adapter->stop_port) + adapter->stop_port(adapter); + + netxen_nic_disable_int(adapter); + if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) { init_firmware_done++; netxen_free_hw_resources(adapter); @@ -914,9 +919,6 @@ static int netxen_nic_close(struct net_device *netdev) netif_stop_queue(netdev); napi_disable(&adapter->napi); - if (adapter->stop_port) - adapter->stop_port(adapter); - netxen_nic_disable_int(adapter); cmd_buff = adapter->cmd_buf_arr; @@ -994,6 +996,28 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) return NETDEV_TX_OK; } + /* + * Everything is set up. Now, we just need to transmit it out. + * Note that we have to copy the contents of buffer over to + * right place. Later on, this can be optimized out by de-coupling the + * producer index from the buffer index. + */ + retry_getting_window: + spin_lock_bh(&adapter->tx_lock); + if (adapter->total_threads >= MAX_XMIT_PRODUCERS) { + spin_unlock_bh(&adapter->tx_lock); + /* + * Yield CPU + */ + if (!in_atomic()) + schedule(); + else { + for (i = 0; i < 20; i++) + cpu_relax(); /*This a nop instr on i386 */ + } + goto retry_getting_window; + } + local_producer = adapter->cmd_producer; /* There 4 fragments per descriptor */ no_of_desc = (frag_count + 3) >> 2; if (netdev->features & NETIF_F_TSO) { @@ -1007,19 +1031,16 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) } } } - - spin_lock_bh(&adapter->tx_lock); - if (adapter->total_threads >= MAX_XMIT_PRODUCERS) { - goto out_requeue; - } - local_producer = adapter->cmd_producer; k = adapter->cmd_producer; max_tx_desc_count = adapter->max_tx_desc_count; last_cmd_consumer = adapter->last_cmd_consumer; if ((k + no_of_desc) >= ((last_cmd_consumer <= k) ? last_cmd_consumer + max_tx_desc_count : last_cmd_consumer)) { - goto out_requeue; + netif_stop_queue(netdev); + adapter->flags |= NETXEN_NETDEV_STATUS; + spin_unlock_bh(&adapter->tx_lock); + return NETDEV_TX_BUSY; } k = get_index_range(k, max_tx_desc_count, no_of_desc); adapter->cmd_producer = k; @@ -1072,8 +1093,6 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) adapter->max_tx_desc_count); hwdesc = &hw->cmd_desc_head[producer]; memset(hwdesc, 0, sizeof(struct cmd_desc_type0)); - pbuf = &adapter->cmd_buf_arr[producer]; - pbuf->skb = NULL; } frag = &skb_shinfo(skb)->frags[i - 1]; len = frag->size; @@ -1129,8 +1148,6 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) } /* copy the MAC/IP/TCP headers to the cmd descriptor list */ hwdesc = &hw->cmd_desc_head[producer]; - pbuf = &adapter->cmd_buf_arr[producer]; - pbuf->skb = NULL; /* copy the first 64 bytes */ memcpy(((void *)hwdesc) + 2, @@ -1139,8 +1156,6 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) if (more_hdr) { hwdesc = &hw->cmd_desc_head[producer]; - pbuf = &adapter->cmd_buf_arr[producer]; - pbuf->skb = NULL; /* copy the next 64 bytes - should be enough except * for pathological case */ @@ -1152,8 +1167,16 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) } } + i = netxen_get_cmd_desc_totallength(&hw->cmd_desc_head[saved_producer]); + + hw->cmd_desc_head[saved_producer].flags_opcode = + cpu_to_le16(hw->cmd_desc_head[saved_producer].flags_opcode); + hw->cmd_desc_head[saved_producer].num_of_buffers_total_length = + cpu_to_le32(hw->cmd_desc_head[saved_producer]. + num_of_buffers_total_length); + spin_lock_bh(&adapter->tx_lock); - adapter->stats.txbytes += skb->len; + adapter->stats.txbytes += i; /* Code to update the adapter considering how many producer threads are currently working */ @@ -1166,17 +1189,14 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) } adapter->stats.xmitfinished++; - netdev->trans_start = jiffies; - spin_unlock_bh(&adapter->tx_lock); - return NETDEV_TX_OK; -out_requeue: - netif_stop_queue(netdev); - adapter->flags |= NETXEN_NETDEV_STATUS; + netdev->trans_start = jiffies; - spin_unlock_bh(&adapter->tx_lock); - return NETDEV_TX_BUSY; + DPRINTK(INFO, "wrote CMD producer %x to phantom\n", producer); + + DPRINTK(INFO, "Done. Send\n"); + return NETDEV_TX_OK; } static void netxen_watchdog(unsigned long v) diff --git a/trunk/drivers/net/netxen/netxen_nic_niu.c b/trunk/drivers/net/netxen/netxen_nic_niu.c index d04ecb77d08c..5b9e1b300fab 100644 --- a/trunk/drivers/net/netxen/netxen_nic_niu.c +++ b/trunk/drivers/net/netxen/netxen_nic_niu.c @@ -736,12 +736,12 @@ int netxen_niu_disable_xg_port(struct netxen_adapter *adapter) __u32 mac_cfg; u32 port = physical_port[adapter->portnum]; - if (port > NETXEN_NIU_MAX_XG_PORTS) + if (port != 0) return -EINVAL; - mac_cfg = 0; - if (netxen_nic_hw_write_wx(adapter, - NETXEN_NIU_XGE_CONFIG_0 + (0x10000 * port), &mac_cfg, 4)) + netxen_xg_soft_reset(mac_cfg); + if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_XGE_CONFIG_0, + &mac_cfg, 4)) return -EIO; return 0; } diff --git a/trunk/drivers/net/r8169.c b/trunk/drivers/net/r8169.c index 3acfeeabdee1..af8030981f10 100644 --- a/trunk/drivers/net/r8169.c +++ b/trunk/drivers/net/r8169.c @@ -2002,7 +2002,7 @@ static void rtl8169_set_magic_reg(void __iomem *ioaddr, unsigned mac_version) u32 clk; clk = RTL_R8(Config2) & PCI_Clock_66MHz; - for (i = 0; i < ARRAY_SIZE(cfg2_info); i++, p++) { + for (i = 0; i < ARRAY_SIZE(cfg2_info); i++) { if ((p->mac_version == mac_version) && (p->clk == clk)) { RTL_W32(0x7c, p->val); break; diff --git a/trunk/drivers/net/sky2.c b/trunk/drivers/net/sky2.c index 7023bbe545ee..52ec89b82f64 100644 --- a/trunk/drivers/net/sky2.c +++ b/trunk/drivers/net/sky2.c @@ -944,6 +944,7 @@ static void tx_init(struct sky2_port *sky2) le = get_tx_le(sky2); le->addr = 0; le->opcode = OP_ADDR64 | HW_OWNER; + sky2->tx_addr64 = 0; } static inline struct tx_ring_info *tx_le_re(struct sky2_port *sky2, @@ -977,11 +978,13 @@ static void sky2_rx_add(struct sky2_port *sky2, u8 op, dma_addr_t map, unsigned len) { struct sky2_rx_le *le; + u32 hi = upper_32_bits(map); - if (sizeof(dma_addr_t) > sizeof(u32)) { + if (sky2->rx_addr64 != hi) { le = sky2_next_rx(sky2); - le->addr = cpu_to_le32(upper_32_bits(map)); + le->addr = cpu_to_le32(hi); le->opcode = OP_ADDR64 | HW_OWNER; + sky2->rx_addr64 = upper_32_bits(map + len); } le = sky2_next_rx(sky2); @@ -1477,6 +1480,7 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev) struct tx_ring_info *re; unsigned i, len; dma_addr_t mapping; + u32 addr64; u16 mss; u8 ctrl; @@ -1489,12 +1493,15 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev) len = skb_headlen(skb); mapping = pci_map_single(hw->pdev, skb->data, len, PCI_DMA_TODEVICE); + addr64 = upper_32_bits(mapping); - /* Send high bits if needed */ - if (sizeof(dma_addr_t) > sizeof(u32)) { + /* Send high bits if changed or crosses boundary */ + if (addr64 != sky2->tx_addr64 || + upper_32_bits(mapping + len) != sky2->tx_addr64) { le = get_tx_le(sky2); - le->addr = cpu_to_le32(upper_32_bits(mapping)); + le->addr = cpu_to_le32(addr64); le->opcode = OP_ADDR64 | HW_OWNER; + sky2->tx_addr64 = upper_32_bits(mapping + len); } /* Check for TCP Segmentation Offload */ @@ -1575,12 +1582,13 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev) mapping = pci_map_page(hw->pdev, frag->page, frag->page_offset, frag->size, PCI_DMA_TODEVICE); - - if (sizeof(dma_addr_t) > sizeof(u32)) { + addr64 = upper_32_bits(mapping); + if (addr64 != sky2->tx_addr64) { le = get_tx_le(sky2); - le->addr = cpu_to_le32(upper_32_bits(mapping)); + le->addr = cpu_to_le32(addr64); le->ctrl = 0; le->opcode = OP_ADDR64 | HW_OWNER; + sky2->tx_addr64 = addr64; } le = get_tx_le(sky2); @@ -3949,7 +3957,7 @@ static __exit void sky2_debug_cleanup(void) /* Initialize network device */ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw, unsigned port, - int highmem) + int highmem, int wol) { struct sky2_port *sky2; struct net_device *dev = alloc_etherdev(sizeof(*sky2)); @@ -3989,7 +3997,7 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw, sky2->speed = -1; sky2->advertising = sky2_supported_modes(hw); sky2->rx_csum = (hw->chip_id != CHIP_ID_YUKON_XL); - sky2->wol = sky2_wol_supported(hw) & WAKE_MAGIC; + sky2->wol = wol; spin_lock_init(&sky2->phy_lock); sky2->tx_pending = TX_DEF_PENDING; @@ -4086,12 +4094,24 @@ static int __devinit sky2_test_msi(struct sky2_hw *hw) return err; } +static int __devinit pci_wake_enabled(struct pci_dev *dev) +{ + int pm = pci_find_capability(dev, PCI_CAP_ID_PM); + u16 value; + + if (!pm) + return 0; + if (pci_read_config_word(dev, pm + PCI_PM_CTRL, &value)) + return 0; + return value & PCI_PM_CTRL_PME_ENABLE; +} + static int __devinit sky2_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { struct net_device *dev; struct sky2_hw *hw; - int err, using_dac = 0; + int err, using_dac = 0, wol_default; err = pci_enable_device(pdev); if (err) { @@ -4124,6 +4144,8 @@ static int __devinit sky2_probe(struct pci_dev *pdev, } } + wol_default = pci_wake_enabled(pdev) ? WAKE_MAGIC : 0; + err = -ENOMEM; hw = kzalloc(sizeof(*hw), GFP_KERNEL); if (!hw) { @@ -4167,7 +4189,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev, sky2_reset(hw); - dev = sky2_init_netdev(hw, 0, using_dac); + dev = sky2_init_netdev(hw, 0, using_dac, wol_default); if (!dev) { err = -ENOMEM; goto err_out_free_pci; @@ -4204,7 +4226,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev, if (hw->ports > 1) { struct net_device *dev1; - dev1 = sky2_init_netdev(hw, 1, using_dac); + dev1 = sky2_init_netdev(hw, 1, using_dac, wol_default); if (!dev1) dev_warn(&pdev->dev, "allocation for second device failed\n"); else if ((err = register_netdev(dev1))) { diff --git a/trunk/drivers/net/sky2.h b/trunk/drivers/net/sky2.h index ffe9b8a50a1b..bc646a47edd2 100644 --- a/trunk/drivers/net/sky2.h +++ b/trunk/drivers/net/sky2.h @@ -1991,14 +1991,14 @@ struct sky2_port { u16 tx_cons; /* next le to check */ u16 tx_prod; /* next le to use */ u16 tx_next; /* debug only */ - + u32 tx_addr64; u16 tx_pending; u16 tx_last_mss; u32 tx_tcpsum; struct rx_ring_info *rx_ring ____cacheline_aligned_in_smp; struct sky2_rx_le *rx_le; - + u32 rx_addr64; u16 rx_next; /* next re to check */ u16 rx_put; /* next le index to use */ u16 rx_pending; diff --git a/trunk/drivers/net/tulip/de4x5.c b/trunk/drivers/net/tulip/de4x5.c index 6e8b18a3b3cc..41f34bb91cad 100644 --- a/trunk/drivers/net/tulip/de4x5.c +++ b/trunk/drivers/net/tulip/de4x5.c @@ -911,7 +911,7 @@ static int de4x5_init(struct net_device *dev); static int de4x5_sw_reset(struct net_device *dev); static int de4x5_rx(struct net_device *dev); static int de4x5_tx(struct net_device *dev); -static void de4x5_ast(struct net_device *dev); +static int de4x5_ast(struct net_device *dev); static int de4x5_txur(struct net_device *dev); static int de4x5_rx_ovfc(struct net_device *dev); @@ -984,9 +984,11 @@ static int test_bad_enet(struct net_device *dev, int status); static int an_exception(struct de4x5_private *lp); static char *build_setup_frame(struct net_device *dev, int mode); static void disable_ast(struct net_device *dev); +static void enable_ast(struct net_device *dev, u32 time_out); static long de4x5_switch_mac_port(struct net_device *dev); static int gep_rd(struct net_device *dev); static void gep_wr(s32 data, struct net_device *dev); +static void timeout(struct net_device *dev, void (*fn)(u_long data), u_long data, u_long msec); static void yawn(struct net_device *dev, int state); static void de4x5_parse_params(struct net_device *dev); static void de4x5_dbg_open(struct net_device *dev); @@ -1137,8 +1139,6 @@ de4x5_hw_init(struct net_device *dev, u_long iobase, struct device *gendev) lp->gendev = gendev; spin_lock_init(&lp->lock); init_timer(&lp->timer); - lp->timer.function = (void (*)(unsigned long))de4x5_ast; - lp->timer.data = (unsigned long)dev; de4x5_parse_params(dev); /* @@ -1311,7 +1311,7 @@ de4x5_open(struct net_device *dev) lp->state = OPEN; de4x5_dbg_open(dev); - if (request_irq(dev->irq, de4x5_interrupt, IRQF_SHARED, + if (request_irq(dev->irq, (void *)de4x5_interrupt, IRQF_SHARED, lp->adapter_name, dev)) { printk("de4x5_open(): Requested IRQ%d is busy - attemping FAST/SHARE...", dev->irq); if (request_irq(dev->irq, de4x5_interrupt, IRQF_DISABLED | IRQF_SHARED, @@ -1737,29 +1737,27 @@ de4x5_tx(struct net_device *dev) return 0; } -static void +static int de4x5_ast(struct net_device *dev) { - struct de4x5_private *lp = netdev_priv(dev); - int next_tick = DE4X5_AUTOSENSE_MS; - int dt; - - if (lp->useSROM) - next_tick = srom_autoconf(dev); - else if (lp->chipset == DC21140) - next_tick = dc21140m_autoconf(dev); - else if (lp->chipset == DC21041) - next_tick = dc21041_autoconf(dev); - else if (lp->chipset == DC21040) - next_tick = dc21040_autoconf(dev); - lp->linkOK = 0; + struct de4x5_private *lp = netdev_priv(dev); + int next_tick = DE4X5_AUTOSENSE_MS; - dt = (next_tick * HZ) / 1000; + disable_ast(dev); - if (!dt) - dt = 1; + if (lp->useSROM) { + next_tick = srom_autoconf(dev); + } else if (lp->chipset == DC21140) { + next_tick = dc21140m_autoconf(dev); + } else if (lp->chipset == DC21041) { + next_tick = dc21041_autoconf(dev); + } else if (lp->chipset == DC21040) { + next_tick = dc21040_autoconf(dev); + } + lp->linkOK = 0; + enable_ast(dev, next_tick); - mod_timer(&lp->timer, jiffies + dt); + return 0; } static int @@ -2176,7 +2174,7 @@ srom_search(struct net_device *dev, struct pci_dev *pdev) for (j=0, i=0; isrom + SROM_HWADD + i); } - if (j != 0 && j != 6 * 0xff) { + if ((j != 0) && (j != 0x5fa)) { last.chipset = device; last.bus = pb; last.irq = irq; @@ -2373,19 +2371,30 @@ static struct pci_driver de4x5_pci_driver = { static int autoconf_media(struct net_device *dev) { - struct de4x5_private *lp = netdev_priv(dev); - u_long iobase = dev->base_addr; + struct de4x5_private *lp = netdev_priv(dev); + u_long iobase = dev->base_addr; + int next_tick = DE4X5_AUTOSENSE_MS; - disable_ast(dev); + lp->linkOK = 0; + lp->c_media = AUTO; /* Bogus last media */ + disable_ast(dev); + inl(DE4X5_MFC); /* Zero the lost frames counter */ + lp->media = INIT; + lp->tcount = 0; - lp->c_media = AUTO; /* Bogus last media */ - inl(DE4X5_MFC); /* Zero the lost frames counter */ - lp->media = INIT; - lp->tcount = 0; + if (lp->useSROM) { + next_tick = srom_autoconf(dev); + } else if (lp->chipset == DC21040) { + next_tick = dc21040_autoconf(dev); + } else if (lp->chipset == DC21041) { + next_tick = dc21041_autoconf(dev); + } else if (lp->chipset == DC21140) { + next_tick = dc21140m_autoconf(dev); + } - de4x5_ast(dev); + enable_ast(dev, next_tick); - return lp->media; + return (lp->media); } /* @@ -4009,22 +4018,20 @@ DevicePresent(struct net_device *dev, u_long aprom_addr) outl(0, aprom_addr); /* Reset Ethernet Address ROM Pointer */ } } else { /* Read new srom */ - u_short tmp; - __le16 *p = (__le16 *)((char *)&lp->srom + SROM_HWADD); + u_short tmp, *p = (short *)((char *)&lp->srom + SROM_HWADD); for (i=0; i<(ETH_ALEN>>1); i++) { tmp = srom_rd(aprom_addr, (SROM_HWADD>>1) + i); - j += tmp; /* for check for 0:0:0:0:0:0 or ff:ff:ff:ff:ff:ff */ - *p = cpu_to_le16(tmp); + *p = le16_to_cpu(tmp); + j += *p++; } - if (j == 0 || j == 3 * 0xffff) { - /* could get 0 only from all-0 and 3 * 0xffff only from all-1 */ - return; + if ((j == 0) || (j == 0x2fffd)) { + return; } - p = (__le16 *)&lp->srom; + p=(short *)&lp->srom; for (i=0; i<(sizeof(struct de4x5_srom)>>1); i++) { tmp = srom_rd(aprom_addr, i); - *p++ = cpu_to_le16(tmp); + *p++ = le16_to_cpu(tmp); } de4x5_dbg_srom((struct de4x5_srom *)&lp->srom); } @@ -5153,11 +5160,22 @@ build_setup_frame(struct net_device *dev, int mode) return pa; /* Points to the next entry */ } +static void +enable_ast(struct net_device *dev, u32 time_out) +{ + timeout(dev, (void *)&de4x5_ast, (u_long)dev, time_out); + + return; +} + static void disable_ast(struct net_device *dev) { - struct de4x5_private *lp = netdev_priv(dev); - del_timer_sync(&lp->timer); + struct de4x5_private *lp = netdev_priv(dev); + + del_timer(&lp->timer); + + return; } static long @@ -5226,6 +5244,29 @@ gep_rd(struct net_device *dev) return 0; } +static void +timeout(struct net_device *dev, void (*fn)(u_long data), u_long data, u_long msec) +{ + struct de4x5_private *lp = netdev_priv(dev); + int dt; + + /* First, cancel any pending timer events */ + del_timer(&lp->timer); + + /* Convert msec to ticks */ + dt = (msec * HZ) / 1000; + if (dt==0) dt=1; + + /* Set up timer */ + init_timer(&lp->timer); + lp->timer.expires = jiffies + dt; + lp->timer.function = fn; + lp->timer.data = data; + add_timer(&lp->timer); + + return; +} + static void yawn(struct net_device *dev, int state) { diff --git a/trunk/drivers/net/tulip/tulip_core.c b/trunk/drivers/net/tulip/tulip_core.c index ed600bf56e78..e5e2c9c4ebfe 100644 --- a/trunk/drivers/net/tulip/tulip_core.c +++ b/trunk/drivers/net/tulip/tulip_core.c @@ -797,8 +797,7 @@ static int tulip_close (struct net_device *dev) tp->rx_ring[i].status = 0; /* Not owned by Tulip chip. */ tp->rx_ring[i].length = 0; - /* An invalid address. */ - tp->rx_ring[i].buffer1 = cpu_to_le32(0xBADF00D0); + tp->rx_ring[i].buffer1 = 0xBADF00D0; /* An invalid address. */ if (skb) { pci_unmap_single(tp->pdev, mapping, PKT_BUF_SZ, PCI_DMA_FROMDEVICE); diff --git a/trunk/drivers/net/tulip/xircom_cb.c b/trunk/drivers/net/tulip/xircom_cb.c index 8fc7274642eb..70befe33e454 100644 --- a/trunk/drivers/net/tulip/xircom_cb.c +++ b/trunk/drivers/net/tulip/xircom_cb.c @@ -83,8 +83,8 @@ static int bufferoffsets[NUMDESCRIPTORS] = {128,2048,4096,6144}; struct xircom_private { /* Send and receive buffers, kernel-addressable and dma addressable forms */ - __le32 *rx_buffer; - __le32 *tx_buffer; + unsigned int *rx_buffer; + unsigned int *tx_buffer; dma_addr_t rx_dma_handle; dma_addr_t tx_dma_handle; @@ -412,20 +412,19 @@ static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev) /* FIXME: The specification tells us that the length we send HAS to be a multiple of 4 bytes. */ - card->tx_buffer[4*desc+1] = cpu_to_le32(skb->len); - if (desc == NUMDESCRIPTORS - 1) /* bit 25: last descriptor of the ring */ - card->tx_buffer[4*desc+1] |= cpu_to_le32(1<<25); + card->tx_buffer[4*desc+1] = skb->len; + if (desc == NUMDESCRIPTORS-1) + card->tx_buffer[4*desc+1] |= (1<<25); /* bit 25: last descriptor of the ring */ - card->tx_buffer[4*desc+1] |= cpu_to_le32(0xF0000000); + card->tx_buffer[4*desc+1] |= 0xF0000000; /* 0xF0... means want interrupts*/ card->tx_skb[desc] = skb; wmb(); /* This gives the descriptor to the card */ - card->tx_buffer[4*desc] = cpu_to_le32(0x80000000); + card->tx_buffer[4*desc] = 0x80000000; trigger_transmit(card); - if (card->tx_buffer[nextdescriptor*4] & cpu_to_le32(0x8000000)) { - /* next descriptor is occupied... */ + if (((int)card->tx_buffer[nextdescriptor*4])<0) { /* next descriptor is occupied... */ netif_stop_queue(dev); } card->transmit_used = nextdescriptor; @@ -591,7 +590,8 @@ descriptors and programs the addresses into the card. */ static void setup_descriptors(struct xircom_private *card) { - u32 address; + unsigned int val; + unsigned int address; int i; enter("setup_descriptors"); @@ -604,16 +604,16 @@ static void setup_descriptors(struct xircom_private *card) for (i=0;i 0x80000000 */ - card->rx_buffer[i*4 + 0] = cpu_to_le32(0x80000000); + card->rx_buffer[i*4 + 0] = 0x80000000; /* Rx Descr1: buffer 1 is 1536 bytes, buffer 2 is 0 bytes */ - card->rx_buffer[i*4 + 1] = cpu_to_le32(1536); - if (i == NUMDESCRIPTORS - 1) /* bit 25 is "last descriptor" */ - card->rx_buffer[i*4 + 1] |= cpu_to_le32(1 << 25); + card->rx_buffer[i*4 + 1] = 1536; + if (i==NUMDESCRIPTORS-1) + card->rx_buffer[i*4 + 1] |= (1 << 25); /* bit 25 is "last descriptor" */ /* Rx Descr2: address of the buffer we store the buffer at the 2nd half of the page */ - address = card->rx_dma_handle; + address = (unsigned long) card->rx_dma_handle; card->rx_buffer[i*4 + 2] = cpu_to_le32(address + bufferoffsets[i]); /* Rx Desc3: address of 2nd buffer -> 0 */ card->rx_buffer[i*4 + 3] = 0; @@ -621,8 +621,9 @@ static void setup_descriptors(struct xircom_private *card) wmb(); /* Write the receive descriptor ring address to the card */ - address = card->rx_dma_handle; - outl(address, card->io_port + CSR3); /* Receive descr list address */ + address = (unsigned long) card->rx_dma_handle; + val = cpu_to_le32(address); + outl(val, card->io_port + CSR3); /* Receive descr list address */ /* transmit descriptors */ @@ -632,13 +633,13 @@ static void setup_descriptors(struct xircom_private *card) /* Tx Descr0: Empty, we own it, no errors -> 0x00000000 */ card->tx_buffer[i*4 + 0] = 0x00000000; /* Tx Descr1: buffer 1 is 1536 bytes, buffer 2 is 0 bytes */ - card->tx_buffer[i*4 + 1] = cpu_to_le32(1536); - if (i == NUMDESCRIPTORS - 1) /* bit 25 is "last descriptor" */ - card->tx_buffer[i*4 + 1] |= cpu_to_le32(1 << 25); + card->tx_buffer[i*4 + 1] = 1536; + if (i==NUMDESCRIPTORS-1) + card->tx_buffer[i*4 + 1] |= (1 << 25); /* bit 25 is "last descriptor" */ /* Tx Descr2: address of the buffer we store the buffer at the 2nd half of the page */ - address = card->tx_dma_handle; + address = (unsigned long) card->tx_dma_handle; card->tx_buffer[i*4 + 2] = cpu_to_le32(address + bufferoffsets[i]); /* Tx Desc3: address of 2nd buffer -> 0 */ card->tx_buffer[i*4 + 3] = 0; @@ -646,8 +647,9 @@ static void setup_descriptors(struct xircom_private *card) wmb(); /* wite the transmit descriptor ring to the card */ - address = card->tx_dma_handle; - outl(address, card->io_port + CSR4); /* xmit descr list address */ + address = (unsigned long) card->tx_dma_handle; + val =cpu_to_le32(address); + outl(val, card->io_port + CSR4); /* xmit descr list address */ leave("setup_descriptors"); } @@ -1178,7 +1180,7 @@ static void investigate_read_descriptor(struct net_device *dev,struct xircom_pri int status; enter("investigate_read_descriptor"); - status = le32_to_cpu(card->rx_buffer[4*descnr]); + status = card->rx_buffer[4*descnr]; if ((status > 0)) { /* packet received */ @@ -1208,7 +1210,7 @@ static void investigate_read_descriptor(struct net_device *dev,struct xircom_pri out: /* give the buffer back to the card */ - card->rx_buffer[4*descnr] = cpu_to_le32(0x80000000); + card->rx_buffer[4*descnr] = 0x80000000; trigger_receive(card); } @@ -1224,7 +1226,7 @@ static void investigate_write_descriptor(struct net_device *dev, struct xircom_p enter("investigate_write_descriptor"); - status = le32_to_cpu(card->tx_buffer[4*descnr]); + status = card->tx_buffer[4*descnr]; #if 0 if (status & 0x8000) { /* Major error */ printk(KERN_ERR "Major transmit error status %x \n", status); diff --git a/trunk/drivers/net/usb/asix.c b/trunk/drivers/net/usb/asix.c index 569028b2baf2..1249f444039e 100644 --- a/trunk/drivers/net/usb/asix.c +++ b/trunk/drivers/net/usb/asix.c @@ -202,10 +202,10 @@ static int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, buf, size, USB_CTRL_GET_TIMEOUT); - if (err == size) - memcpy(data, buf, size); - else if (err >= 0) + if (err >= 0 && err < size) err = -EINVAL; + if (!err) + memcpy(data, buf, size); kfree(buf); out: diff --git a/trunk/drivers/net/wireless/rt2x00/rt2500usb.c b/trunk/drivers/net/wireless/rt2x00/rt2500usb.c index 18b1f9145389..50775f9234cc 100644 --- a/trunk/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/trunk/drivers/net/wireless/rt2x00/rt2500usb.c @@ -257,7 +257,7 @@ static const struct rt2x00debug rt2500usb_rt2x00debug = { static void rt2500usb_config_mac_addr(struct rt2x00_dev *rt2x00dev, __le32 *mac) { - rt2500usb_register_multiwrite(rt2x00dev, MAC_CSR2, mac, + rt2500usb_register_multiwrite(rt2x00dev, MAC_CSR2, &mac, (3 * sizeof(__le16))); } diff --git a/trunk/drivers/net/wireless/rt2x00/rt2x00pci.c b/trunk/drivers/net/wireless/rt2x00/rt2x00pci.c index 6d5d9aba0b73..2780df00623c 100644 --- a/trunk/drivers/net/wireless/rt2x00/rt2x00pci.c +++ b/trunk/drivers/net/wireless/rt2x00/rt2x00pci.c @@ -124,10 +124,7 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev) struct data_entry *entry; struct data_desc *rxd; struct sk_buff *skb; - struct ieee80211_hdr *hdr; struct rxdata_entry_desc desc; - int header_size; - int align; u32 word; while (1) { @@ -141,26 +138,17 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev) memset(&desc, 0x00, sizeof(desc)); rt2x00dev->ops->lib->fill_rxdone(entry, &desc); - hdr = (struct ieee80211_hdr *)entry->data_addr; - header_size = - ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control)); - - /* - * The data behind the ieee80211 header must be - * aligned on a 4 byte boundary. - */ - align = NET_IP_ALIGN + (2 * (header_size % 4 == 0)); - /* * Allocate the sk_buffer, initialize it and copy * all data into it. */ - skb = dev_alloc_skb(desc.size + align); + skb = dev_alloc_skb(desc.size + NET_IP_ALIGN); if (!skb) return; - skb_reserve(skb, align); - memcpy(skb_put(skb, desc.size), entry->data_addr, desc.size); + skb_reserve(skb, NET_IP_ALIGN); + skb_put(skb, desc.size); + memcpy(skb->data, entry->data_addr, desc.size); /* * Send the frame to rt2x00lib for further processing. diff --git a/trunk/drivers/net/wireless/rt2x00/rt2x00usb.c b/trunk/drivers/net/wireless/rt2x00/rt2x00usb.c index ab4797ed94c9..1f5675dd329f 100644 --- a/trunk/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/trunk/drivers/net/wireless/rt2x00/rt2x00usb.c @@ -221,9 +221,7 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb) struct data_ring *ring = entry->ring; struct rt2x00_dev *rt2x00dev = ring->rt2x00dev; struct sk_buff *skb; - struct ieee80211_hdr *hdr; struct rxdata_entry_desc desc; - int header_size; int frame_size; if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) || @@ -255,20 +253,9 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb) skb_put(skb, frame_size); /* - * The data behind the ieee80211 header must be - * aligned on a 4 byte boundary. - * After that trim the entire buffer down to only - * contain the valid frame data excluding the device - * descriptor. + * Trim the skb_buffer to only contain the valid + * frame data (so ignore the device's descriptor). */ - hdr = (struct ieee80211_hdr *)entry->skb->data; - header_size = - ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control)); - - if (header_size % 4 == 0) { - skb_push(entry->skb, 2); - memmove(entry->skb->data, entry->skb->data + 2, skb->len - 2); - } skb_trim(entry->skb, desc.size); /* diff --git a/trunk/drivers/net/wireless/rt2x00/rt61pci.c b/trunk/drivers/net/wireless/rt2x00/rt61pci.c index ecae968ce091..01dbef19d651 100644 --- a/trunk/drivers/net/wireless/rt2x00/rt61pci.c +++ b/trunk/drivers/net/wireless/rt2x00/rt61pci.c @@ -1738,7 +1738,6 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev) { struct data_ring *ring; struct data_entry *entry; - struct data_entry *entry_done; struct data_desc *txd; u32 word; u32 reg; @@ -1792,17 +1791,6 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev) !rt2x00_get_field32(word, TXD_W0_VALID)) return; - entry_done = rt2x00_get_data_entry_done(ring); - while (entry != entry_done) { - /* Catch up. Just report any entries we missed as - * failed. */ - WARNING(rt2x00dev, - "TX status report missed for entry %p\n", - entry_done); - rt2x00lib_txdone(entry_done, TX_FAIL_OTHER, 0); - entry_done = rt2x00_get_data_entry_done(ring); - } - /* * Obtain the status about this packet. */ diff --git a/trunk/drivers/pci/quirks.c b/trunk/drivers/pci/quirks.c index 72e0bd5d80ac..26cc4dcf4f0e 100644 --- a/trunk/drivers/pci/quirks.c +++ b/trunk/drivers/pci/quirks.c @@ -465,12 +465,6 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_31, quirk DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_0, quirk_ich6_lpc_acpi ); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_2, quirk_ich6_lpc_acpi ); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_3, quirk_ich6_lpc_acpi ); -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_1, quirk_ich6_lpc_acpi ); -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_4, quirk_ich6_lpc_acpi ); -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_2, quirk_ich6_lpc_acpi ); -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_4, quirk_ich6_lpc_acpi ); -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_7, quirk_ich6_lpc_acpi ); -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_8, quirk_ich6_lpc_acpi ); /* * VIA ACPI: One IO region pointed to by longword at diff --git a/trunk/drivers/pnp/pnpacpi/rsparser.c b/trunk/drivers/pnp/pnpacpi/rsparser.c index f7b8648acbfa..3c5eb374adf8 100644 --- a/trunk/drivers/pnp/pnpacpi/rsparser.c +++ b/trunk/drivers/pnp/pnpacpi/rsparser.c @@ -76,7 +76,6 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, int i = 0; int irq; int p, t; - static unsigned char warned; if (!valid_IRQ(gsi)) return; @@ -84,10 +83,9 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) && i < PNP_MAX_IRQ) i++; - if (i >= PNP_MAX_IRQ && !warned) { + if (i >= PNP_MAX_IRQ) { printk(KERN_ERR "pnpacpi: exceeded the max number of IRQ " "resources: %d \n", PNP_MAX_IRQ); - warned = 1; return; } /* @@ -171,7 +169,6 @@ static void pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, int bus_master, int transfer) { int i = 0; - static unsigned char warned; while (i < PNP_MAX_DMA && !(res->dma_resource[i].flags & IORESOURCE_UNSET)) @@ -186,10 +183,9 @@ static void pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, } res->dma_resource[i].start = dma; res->dma_resource[i].end = dma; - } else if (!warned) { + } else { printk(KERN_ERR "pnpacpi: exceeded the max number of DMA " "resources: %d \n", PNP_MAX_DMA); - warned = 1; } } @@ -197,7 +193,6 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res, u64 io, u64 len, int io_decode) { int i = 0; - static unsigned char warned; while (!(res->port_resource[i].flags & IORESOURCE_UNSET) && i < PNP_MAX_PORT) @@ -212,7 +207,7 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res, } res->port_resource[i].start = io; res->port_resource[i].end = io + len - 1; - } else if (!warned) { + } else { printk(KERN_ERR "pnpacpi: exceeded the max number of IO " "resources: %d \n", PNP_MAX_PORT); } @@ -223,7 +218,6 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res, int write_protect) { int i = 0; - static unsigned char warned; while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) && (i < PNP_MAX_MEM)) @@ -239,7 +233,7 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res, res->mem_resource[i].start = mem; res->mem_resource[i].end = mem + len - 1; - } else if (!warned) { + } else { printk(KERN_ERR "pnpacpi: exceeded the max number of mem " "resources: %d\n", PNP_MAX_MEM); } diff --git a/trunk/drivers/scsi/qla1280.c b/trunk/drivers/scsi/qla1280.c index 288640756099..146d540f6281 100644 --- a/trunk/drivers/scsi/qla1280.c +++ b/trunk/drivers/scsi/qla1280.c @@ -3041,6 +3041,7 @@ qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp) int cnt; int req_cnt; int seg_cnt; + dma_addr_t dma_handle; u8 dir; ENTER("qla1280_32bit_start_scsi"); @@ -3049,7 +3050,6 @@ qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp) cmd->cmnd[0]); /* Calculate number of entries and segments required. */ - req_cnt = 1; seg_cnt = scsi_dma_map(cmd); if (seg_cnt) { /* diff --git a/trunk/drivers/video/ps3fb.c b/trunk/drivers/video/ps3fb.c index 044a423a72cb..b3128903d673 100644 --- a/trunk/drivers/video/ps3fb.c +++ b/trunk/drivers/video/ps3fb.c @@ -443,6 +443,8 @@ static int ps3fb_sync(struct fb_info *info, u32 frame) u32 ddr_line_length, xdr_line_length; u64 ddr_base, xdr_base; + acquire_console_sem(); + if (frame > par->num_frames - 1) { dev_dbg(info->device, "%s: invalid frame number (%u)\n", __func__, frame); @@ -462,6 +464,7 @@ static int ps3fb_sync(struct fb_info *info, u32 frame) xdr_line_length); out: + release_console_sem(); return error; } @@ -476,10 +479,7 @@ static int ps3fb_release(struct fb_info *info, int user) if (atomic_dec_and_test(&ps3fb.f_count)) { if (atomic_read(&ps3fb.ext_flip)) { atomic_set(&ps3fb.ext_flip, 0); - if (!try_acquire_console_sem()) { - ps3fb_sync(info, 0); /* single buffer */ - release_console_sem(); - } + ps3fb_sync(info, 0); /* single buffer */ } } return 0; @@ -865,9 +865,7 @@ static int ps3fb_ioctl(struct fb_info *info, unsigned int cmd, break; dev_dbg(info->device, "PS3FB_IOCTL_FSEL:%d\n", val); - acquire_console_sem(); retval = ps3fb_sync(info, val); - release_console_sem(); break; default: @@ -887,9 +885,7 @@ static int ps3fbd(void *arg) set_current_state(TASK_INTERRUPTIBLE); if (ps3fb.is_kicked) { ps3fb.is_kicked = 0; - acquire_console_sem(); ps3fb_sync(info, 0); /* single buffer */ - release_console_sem(); } schedule(); } @@ -1238,6 +1234,12 @@ static int ps3fb_shutdown(struct ps3_system_bus_device *dev) ps3fb_flip_ctl(0, &ps3fb); /* flip off */ ps3fb.dinfo->irq.mask = 0; + if (info) { + unregister_framebuffer(info); + fb_dealloc_cmap(&info->cmap); + framebuffer_release(info); + } + ps3av_register_flip_ctl(NULL, NULL); if (ps3fb.task) { struct task_struct *task = ps3fb.task; @@ -1248,12 +1250,6 @@ static int ps3fb_shutdown(struct ps3_system_bus_device *dev) free_irq(ps3fb.irq_no, &dev->core); ps3_irq_plug_destroy(ps3fb.irq_no); } - if (info) { - unregister_framebuffer(info); - fb_dealloc_cmap(&info->cmap); - framebuffer_release(info); - info = dev->core.driver_data = NULL; - } iounmap((u8 __iomem *)ps3fb.dinfo); status = lv1_gpu_context_free(ps3fb.context_handle); diff --git a/trunk/fs/namei.c b/trunk/fs/namei.c index 73e2e665817a..3b993db26cee 100644 --- a/trunk/fs/namei.c +++ b/trunk/fs/namei.c @@ -1605,7 +1605,7 @@ int may_open(struct nameidata *nd, int acc_mode, int flag) if (S_ISLNK(inode->i_mode)) return -ELOOP; - if (S_ISDIR(inode->i_mode) && (acc_mode & MAY_WRITE)) + if (S_ISDIR(inode->i_mode) && (flag & FMODE_WRITE)) return -EISDIR; /* @@ -1620,7 +1620,7 @@ int may_open(struct nameidata *nd, int acc_mode, int flag) return -EACCES; flag &= ~O_TRUNC; - } else if (IS_RDONLY(inode) && (acc_mode & MAY_WRITE)) + } else if (IS_RDONLY(inode) && (flag & FMODE_WRITE)) return -EROFS; error = vfs_permission(nd, acc_mode); diff --git a/trunk/fs/nfs/nfs4_fs.h b/trunk/fs/nfs/nfs4_fs.h index bd1b9d663fb9..b35069a2aa9e 100644 --- a/trunk/fs/nfs/nfs4_fs.h +++ b/trunk/fs/nfs/nfs4_fs.h @@ -115,7 +115,6 @@ struct nfs4_lock_state { #define NFS_LOCK_INITIALIZED 1 int ls_flags; struct nfs_seqid_counter ls_seqid; - struct rpc_sequence ls_sequence; struct nfs_unique_id ls_id; nfs4_stateid ls_stateid; atomic_t ls_count; diff --git a/trunk/fs/nfs/nfs4state.c b/trunk/fs/nfs/nfs4state.c index 5a39c6f78acf..23a9a36556bf 100644 --- a/trunk/fs/nfs/nfs4state.c +++ b/trunk/fs/nfs/nfs4state.c @@ -509,10 +509,7 @@ static struct nfs4_lock_state *nfs4_alloc_lock_state(struct nfs4_state *state, f lsp = kzalloc(sizeof(*lsp), GFP_KERNEL); if (lsp == NULL) return NULL; - rpc_init_wait_queue(&lsp->ls_sequence.wait, "lock_seqid_waitqueue"); - spin_lock_init(&lsp->ls_sequence.lock); - INIT_LIST_HEAD(&lsp->ls_sequence.list); - lsp->ls_seqid.sequence = &lsp->ls_sequence; + lsp->ls_seqid.sequence = &state->owner->so_sequence; atomic_set(&lsp->ls_count, 1); lsp->ls_owner = fl_owner; spin_lock(&clp->cl_lock); diff --git a/trunk/fs/nfsd/nfs3xdr.c b/trunk/fs/nfsd/nfs3xdr.c index f917fd25858a..2d116d2298f8 100644 --- a/trunk/fs/nfsd/nfs3xdr.c +++ b/trunk/fs/nfsd/nfs3xdr.c @@ -388,11 +388,8 @@ nfs3svc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p, * Round the length of the data which was specified up to * the next multiple of XDR units and then compare that * against the length which was actually received. - * Note that when RPCSEC/GSS (for example) is used, the - * data buffer can be padded so dlen might be larger - * than required. It must never be smaller. */ - if (dlen < XDR_QUADLEN(len)*4) + if (dlen != XDR_QUADLEN(len)*4) return 0; if (args->count > max_blocksize) { diff --git a/trunk/fs/nfsd/nfsxdr.c b/trunk/fs/nfsd/nfsxdr.c index b86e3658a0af..986f9b32083c 100644 --- a/trunk/fs/nfsd/nfsxdr.c +++ b/trunk/fs/nfsd/nfsxdr.c @@ -313,11 +313,8 @@ nfssvc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p, * Round the length of the data which was specified up to * the next multiple of XDR units and then compare that * against the length which was actually received. - * Note that when RPCSEC/GSS (for example) is used, the - * data buffer can be padded so dlen might be larger - * than required. It must never be smaller. */ - if (dlen < XDR_QUADLEN(len)*4) + if (dlen != XDR_QUADLEN(len)*4) return 0; rqstp->rq_vec[0].iov_base = (void*)p; diff --git a/trunk/fs/proc/array.c b/trunk/fs/proc/array.c index 810eb8fd6500..65c62e1bfd6f 100644 --- a/trunk/fs/proc/array.c +++ b/trunk/fs/proc/array.c @@ -169,7 +169,7 @@ static inline char *task_state(struct task_struct *p, char *buffer) ppid = pid_alive(p) ? task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0; tpid = pid_alive(p) && p->ptrace ? - task_pid_nr_ns(rcu_dereference(p->parent), ns) : 0; + task_ppid_nr_ns(rcu_dereference(p->parent), ns) : 0; buffer += sprintf(buffer, "State:\t%s\n" "Tgid:\t%d\n" @@ -426,7 +426,6 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole) cgtime = gtime = cputime_zero; rcu_read_lock(); - ppid = task_tgid_nr_ns(task->real_parent, ns); if (lock_task_sighand(task, &flags)) { struct signal_struct *sig = task->signal; @@ -466,6 +465,7 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole) sid = task_session_nr_ns(task, ns); pgid = task_pgrp_nr_ns(task, ns); + ppid = task_ppid_nr_ns(task, ns); unlock_task_sighand(task, &flags); } diff --git a/trunk/fs/xfs/linux-2.6/xfs_file.c b/trunk/fs/xfs/linux-2.6/xfs_file.c index 21a1c2b1c5fc..4847eb83fc18 100644 --- a/trunk/fs/xfs/linux-2.6/xfs_file.c +++ b/trunk/fs/xfs/linux-2.6/xfs_file.c @@ -261,9 +261,9 @@ xfs_file_readdir( #else struct hack_dirent { - u64 ino; - loff_t offset; int namlen; + loff_t offset; + u64 ino; unsigned int d_type; char name[]; }; @@ -285,10 +285,8 @@ xfs_hack_filldir( { struct hack_callback *buf = __buf; struct hack_dirent *de = (struct hack_dirent *)(buf->dirent + buf->used); - unsigned int reclen; - reclen = ALIGN(sizeof(struct hack_dirent) + namlen, sizeof(u64)); - if (buf->used + reclen > buf->len) + if (buf->used + sizeof(struct hack_dirent) + namlen > buf->len) return -EINVAL; de->namlen = namlen; @@ -296,7 +294,7 @@ xfs_hack_filldir( de->ino = ino; de->d_type = d_type; memcpy(de->name, name, namlen); - buf->used += reclen; + buf->used += sizeof(struct hack_dirent) + namlen; return 0; } @@ -336,8 +334,7 @@ xfs_file_readdir( offset = filp->f_pos; while (!eof) { - unsigned int reclen; - + int reclen; start_offset = offset; buf.used = 0; @@ -358,8 +355,7 @@ xfs_file_readdir( goto done; } - reclen = ALIGN(sizeof(struct hack_dirent) + de->namlen, - sizeof(u64)); + reclen = sizeof(struct hack_dirent) + de->namlen; size -= reclen; de = (struct hack_dirent *)((char *)de + reclen); curr_offset = de->offset /* & 0x7fffffff */; diff --git a/trunk/include/asm-arm/arch-pxa/hardware.h b/trunk/include/asm-arm/arch-pxa/hardware.h index ab2d963e742a..e25558faa5a4 100644 --- a/trunk/include/asm-arm/arch-pxa/hardware.h +++ b/trunk/include/asm-arm/arch-pxa/hardware.h @@ -121,38 +121,32 @@ #define cpu_is_pxa21x() \ ({ \ - unsigned int id = read_cpuid(CPUID_ID); \ - __cpu_is_pxa21x(id); \ + __cpu_is_pxa21x(read_cpuid_id()); \ }) #define cpu_is_pxa25x() \ ({ \ - unsigned int id = read_cpuid(CPUID_ID); \ - __cpu_is_pxa25x(id); \ + __cpu_is_pxa25x(read_cpuid_id()); \ }) #define cpu_is_pxa27x() \ ({ \ - unsigned int id = read_cpuid(CPUID_ID); \ - __cpu_is_pxa27x(id); \ + __cpu_is_pxa27x(read_cpuid_id()); \ }) #define cpu_is_pxa300() \ ({ \ - unsigned int id = read_cpuid(CPUID_ID); \ - __cpu_is_pxa300(id); \ + __cpu_is_pxa300(read_cpuid_id()); \ }) #define cpu_is_pxa310() \ ({ \ - unsigned int id = read_cpuid(CPUID_ID); \ - __cpu_is_pxa310(id); \ + __cpu_is_pxa310(read_cpuid_id()); \ }) #define cpu_is_pxa320() \ ({ \ - unsigned int id = read_cpuid(CPUID_ID); \ - __cpu_is_pxa320(id); \ + __cpu_is_pxa320(read_cpuid_id()); \ }) /* @@ -174,14 +168,12 @@ #define cpu_is_pxa2xx() \ ({ \ - unsigned int id = read_cpuid(CPUID_ID); \ - __cpu_is_pxa2xx(id); \ + __cpu_is_pxa2xx(read_cpuid_id()); \ }) #define cpu_is_pxa3xx() \ ({ \ - unsigned int id = read_cpuid(CPUID_ID); \ - __cpu_is_pxa3xx(id); \ + __cpu_is_pxa3xx(read_cpuid_id()); \ }) /* diff --git a/trunk/include/asm-arm/system.h b/trunk/include/asm-arm/system.h index 94ea8c6dc1a4..28425c473e71 100644 --- a/trunk/include/asm-arm/system.h +++ b/trunk/include/asm-arm/system.h @@ -75,8 +75,21 @@ #ifndef __ASSEMBLY__ #include +#include #include +/* + * The CPU ID never changes at run time, so we might as well tell the + * compiler that it's constant. Use this function to read the CPU ID + * rather than directly reading processor_id or read_cpuid() directly. + */ +static inline unsigned int read_cpuid_id(void) __attribute_const__; + +static inline unsigned int read_cpuid_id(void) +{ + return read_cpuid(CPUID_ID); +} + #define __exception __attribute__((section(".exception.text"))) struct thread_info; diff --git a/trunk/include/asm-powerpc/mmu-hash64.h b/trunk/include/asm-powerpc/mmu-hash64.h index 951e2487aa69..82328dec2b52 100644 --- a/trunk/include/asm-powerpc/mmu-hash64.h +++ b/trunk/include/asm-powerpc/mmu-hash64.h @@ -286,7 +286,6 @@ extern void hpte_init_iSeries(void); extern void hpte_init_beat(void); extern void hpte_init_beat_v3(void); -extern void slb_shadow_clear_all(void); extern void stabs_alloc(void); extern void slb_initialize(void); extern void slb_flush_and_rebolt(void); diff --git a/trunk/include/asm-sh/cacheflush.h b/trunk/include/asm-sh/cacheflush.h index e034c3604111..9d528ada3c14 100644 --- a/trunk/include/asm-sh/cacheflush.h +++ b/trunk/include/asm-sh/cacheflush.h @@ -43,12 +43,6 @@ extern void __flush_purge_region(void *start, int size); extern void __flush_invalidate_region(void *start, int size); #endif -#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE -static inline void flush_kernel_dcache_page(struct page *page) -{ - flush_dcache_page(page); -} - #if defined(CONFIG_CPU_SH4) && !defined(CONFIG_CACHE_OFF) extern void copy_to_user_page(struct vm_area_struct *vma, struct page *page, unsigned long vaddr, void *dst, const void *src, diff --git a/trunk/include/asm-sh/uaccess.h b/trunk/include/asm-sh/uaccess.h index 77c391fa93d6..f18a1a5c95c0 100644 --- a/trunk/include/asm-sh/uaccess.h +++ b/trunk/include/asm-sh/uaccess.h @@ -73,26 +73,38 @@ static inline int __access_ok(unsigned long addr, unsigned long size) /* * __access_ok: Check if address with size is OK or not. * - * Uhhuh, this needs 33-bit arithmetic. We have a carry.. + * We do three checks: + * (1) is it user space? + * (2) addr + size --> carry? + * (3) addr + size >= 0x80000000 (PAGE_OFFSET) * - * sum := addr + size; carry? --> flag = true; - * if (sum >= addr_limit) flag = true; + * (1) (2) (3) | RESULT + * 0 0 0 | ok + * 0 0 1 | ok + * 0 1 0 | bad + * 0 1 1 | bad + * 1 0 0 | ok + * 1 0 1 | bad + * 1 1 0 | bad + * 1 1 1 | bad */ static inline int __access_ok(unsigned long addr, unsigned long size) { - unsigned long flag, sum; - - __asm__("clrt\n\t" - "addc %3, %1\n\t" - "movt %0\n\t" - "cmp/hi %4, %1\n\t" - "rotcl %0" - :"=&r" (flag), "=r" (sum) - :"1" (addr), "r" (size), - "r" (current_thread_info()->addr_limit.seg) - :"t"); - return flag == 0; + unsigned long flag, tmp; + + __asm__("stc r7_bank, %0\n\t" + "mov.l @(8,%0), %0\n\t" + "clrt\n\t" + "addc %2, %1\n\t" + "and %1, %0\n\t" + "rotcl %0\n\t" + "rotcl %0\n\t" + "and #3, %0" + : "=&z" (flag), "=r" (tmp) + : "r" (addr), "1" (size) + : "t"); + return flag == 0; } #endif /* CONFIG_MMU */ diff --git a/trunk/include/linux/pci_ids.h b/trunk/include/linux/pci_ids.h index 7f2215139e9a..023656d2f1da 100644 --- a/trunk/include/linux/pci_ids.h +++ b/trunk/include/linux/pci_ids.h @@ -2322,8 +2322,6 @@ #define PCI_DEVICE_ID_INTEL_ICH9_4 0x2914 #define PCI_DEVICE_ID_INTEL_ICH9_5 0x2919 #define PCI_DEVICE_ID_INTEL_ICH9_6 0x2930 -#define PCI_DEVICE_ID_INTEL_ICH9_7 0x2916 -#define PCI_DEVICE_ID_INTEL_ICH9_8 0x2918 #define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340 #define PCI_DEVICE_ID_INTEL_82830_HB 0x3575 #define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577 diff --git a/trunk/include/linux/pm.h b/trunk/include/linux/pm.h index b78e0295adf4..09a309b7b5d2 100644 --- a/trunk/include/linux/pm.h +++ b/trunk/include/linux/pm.h @@ -246,15 +246,6 @@ static inline int call_platform_enable_wakeup(struct device *dev, int is_on) device_set_wakeup_enable(dev,val); \ } while(0) -/* - * Global Power Management flags - * Used to keep APM and ACPI from both being active - */ -extern unsigned int pm_flags; - -#define PM_APM 1 -#define PM_ACPI 2 - #endif /* __KERNEL__ */ #endif /* _LINUX_PM_H */ diff --git a/trunk/include/linux/pm_legacy.h b/trunk/include/linux/pm_legacy.h index 446f4f42b952..514729a44688 100644 --- a/trunk/include/linux/pm_legacy.h +++ b/trunk/include/linux/pm_legacy.h @@ -4,6 +4,10 @@ #ifdef CONFIG_PM_LEGACY +extern int pm_active; + +#define PM_IS_ACTIVE() (pm_active != 0) + /* * Register a device with power management */ @@ -17,6 +21,8 @@ int __deprecated pm_send_all(pm_request_t rqst, void *data); #else /* CONFIG_PM_LEGACY */ +#define PM_IS_ACTIVE() 0 + static inline struct pm_dev *pm_register(pm_dev_t type, unsigned long id, pm_callback callback) diff --git a/trunk/include/linux/pnp.h b/trunk/include/linux/pnp.h index 2a6d62c7d2d1..0a0426c2867d 100644 --- a/trunk/include/linux/pnp.h +++ b/trunk/include/linux/pnp.h @@ -13,7 +13,7 @@ #include #include -#define PNP_MAX_PORT 40 +#define PNP_MAX_PORT 24 #define PNP_MAX_MEM 12 #define PNP_MAX_IRQ 2 #define PNP_MAX_DMA 2 diff --git a/trunk/include/linux/scatterlist.h b/trunk/include/linux/scatterlist.h index e3ff21dbac53..416e000dfe81 100644 --- a/trunk/include/linux/scatterlist.h +++ b/trunk/include/linux/scatterlist.h @@ -191,8 +191,8 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents, /* * offset and length are unused for chain entry. Clear them. */ - prv[prv_nents - 1].offset = 0; - prv[prv_nents - 1].length = 0; + prv->offset = 0; + prv->length = 0; /* * Set lowest bit to indicate a link pointer, and make sure to clear diff --git a/trunk/include/linux/sched.h b/trunk/include/linux/sched.h index cc14656f8682..ac3d496fbd20 100644 --- a/trunk/include/linux/sched.h +++ b/trunk/include/linux/sched.h @@ -1255,6 +1255,13 @@ struct pid_namespace; * * set_task_vxid() : assigns a virtual id to a task; * + * task_ppid_nr_ns() : the parent's id as seen from the namespace specified. + * the result depends on the namespace and whether the + * task in question is the namespace's init. e.g. for the + * namespace's init this will return 0 when called from + * the namespace of this init, or appropriate id otherwise. + * + * * see also pid_nr() etc in include/linux/pid.h */ @@ -1310,6 +1317,12 @@ static inline pid_t task_session_vnr(struct task_struct *tsk) } +static inline pid_t task_ppid_nr_ns(struct task_struct *tsk, + struct pid_namespace *ns) +{ + return pid_nr_ns(task_pid(rcu_dereference(tsk->real_parent)), ns); +} + /** * pid_alive - check that a task structure is not stale * @p: Task structure to be checked. diff --git a/trunk/kernel/power/main.c b/trunk/kernel/power/main.c index f71c9504a5c5..3cdf95b1dc92 100644 --- a/trunk/kernel/power/main.c +++ b/trunk/kernel/power/main.c @@ -28,9 +28,6 @@ BLOCKING_NOTIFIER_HEAD(pm_chain_head); DEFINE_MUTEX(pm_mutex); -unsigned int pm_flags; -EXPORT_SYMBOL(pm_flags); - #ifdef CONFIG_SUSPEND /* This is just an arbitrary number */ diff --git a/trunk/kernel/power/pm.c b/trunk/kernel/power/pm.c index 60c73fa670d5..c50d15266c10 100644 --- a/trunk/kernel/power/pm.c +++ b/trunk/kernel/power/pm.c @@ -27,6 +27,8 @@ #include #include +int pm_active; + /* * Locking notes: * pm_devs_lock can be a semaphore providing pm ops are not called @@ -202,4 +204,6 @@ int pm_send_all(pm_request_t rqst, void *data) EXPORT_SYMBOL(pm_register); EXPORT_SYMBOL(pm_send_all); +EXPORT_SYMBOL(pm_active); + diff --git a/trunk/kernel/timer.c b/trunk/kernel/timer.c index 26671f4db07f..d4527dcef1af 100644 --- a/trunk/kernel/timer.c +++ b/trunk/kernel/timer.c @@ -978,7 +978,7 @@ asmlinkage long sys_getppid(void) int pid; rcu_read_lock(); - pid = task_tgid_nr_ns(current->real_parent, current->nsproxy->pid_ns); + pid = task_ppid_nr_ns(current, current->nsproxy->pid_ns); rcu_read_unlock(); return pid;