]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6
authorLinus Torvalds <torvalds@woody.linux-foundation.org>
Wed, 19 Dec 2007 22:29:23 +0000 (14:29 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Wed, 19 Dec 2007 22:29:23 +0000 (14:29 -0800)
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6:
  [IA64] Adjust CMCI mask on CPU hotplug
  [IA64] make flush_tlb_kernel_range() an inline function
  [IA64] Guard elfcorehdr_addr with #if CONFIG_PROC_FS
  [IA64] Fix Altix BTE error return status
  [IA64] Remove assembler warnings on head.S
  [IA64] Remove compiler warinings about uninitialized variable in irq_ia64.c
  [IA64] set_thread_area fails in IA32 chroot
  [IA64] print kernel release in OOPS to make kerneloops.org happy
  [IA64] Two trivial spelling fixes
  [IA64] Avoid unnecessary TLB flushes when allocating memory
  [IA64] ia32 nopage
  [IA64] signal: remove redundant code in setup_sigcontext()
  IA64: Slim down __clear_bit_unlock

42 files changed:
arch/x86/kernel/io_apic_32.c
arch/x86/kernel/io_apic_64.c
arch/x86/kernel/kprobes_32.c
arch/x86/kernel/kprobes_64.c
arch/x86/oprofile/op_model_athlon.c
block/as-iosched.c
block/cfq-iosched.c
block/deadline-iosched.c
block/elevator.c
block/noop-iosched.c
block/scsi_ioctl.c
drivers/ata/pata_hpt37x.c
drivers/block/umem.c
drivers/mmc/host/sdhci.c
drivers/mmc/host/sdhci.h
drivers/scsi/dpt_i2o.c
drivers/scsi/initio.c
drivers/scsi/st.c
drivers/scsi/sym53c8xx_2/sym_glue.c
drivers/scsi/sym53c8xx_2/sym_hipd.c
drivers/video/ps3fb.c
fs/xfs/linux-2.6/xfs_file.c
fs/xfs/xfs_dir2_block.c
fs/xfs/xfs_dir2_leaf.c
fs/xfs/xfs_dir2_sf.c
fs/xfs/xfs_inode.c
include/asm-x86/kprobes_32.h
include/asm-x86/kprobes_64.h
include/asm-x86/system_64.h
include/linux/elevator.h
include/linux/irq.h
include/linux/mmc/host.h
include/linux/pci_ids.h
kernel/irq/chip.c
kernel/rwsem.c
kernel/sched.c
kernel/sched_fair.c
kernel/sysctl.c
kernel/time/tick-broadcast.c
kernel/timer.c
lib/rwsem.c
mm/filemap.c

index 6cf27319a91c3938b457e6b2eb94e2f5d3c35464..c3a565bba106e5058d1465462b3656b0ee8e05a8 100644 (file)
@@ -1882,13 +1882,16 @@ __setup("no_timer_check", notimercheck);
 static int __init timer_irq_works(void)
 {
        unsigned long t1 = jiffies;
+       unsigned long flags;
 
        if (no_timer_check)
                return 1;
 
+       local_save_flags(flags);
        local_irq_enable();
        /* Let ten ticks pass... */
        mdelay((10 * 1000) / HZ);
+       local_irq_restore(flags);
 
        /*
         * Expect a few ticks at least, to be sure some possible
@@ -2167,6 +2170,9 @@ static inline void __init check_timer(void)
        int apic1, pin1, apic2, pin2;
        int vector;
        unsigned int ver;
+       unsigned long flags;
+
+       local_irq_save(flags);
 
        ver = apic_read(APIC_LVR);
        ver = GET_APIC_VERSION(ver);
@@ -2219,7 +2225,7 @@ static inline void __init check_timer(void)
                        }
                        if (disable_timer_pin_1 > 0)
                                clear_IO_APIC_pin(0, pin1);
-                       return;
+                       goto out;
                }
                clear_IO_APIC_pin(apic1, pin1);
                printk(KERN_ERR "..MP-BIOS bug: 8254 timer not connected to "
@@ -2242,7 +2248,7 @@ static inline void __init check_timer(void)
                        if (nmi_watchdog == NMI_IO_APIC) {
                                setup_nmi();
                        }
-                       return;
+                       goto out;
                }
                /*
                 * Cleanup, just in case ...
@@ -2266,7 +2272,7 @@ static inline void __init check_timer(void)
 
        if (timer_irq_works()) {
                printk(" works.\n");
-               return;
+               goto out;
        }
        apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | vector);
        printk(" failed.\n");
@@ -2282,11 +2288,13 @@ static inline void __init check_timer(void)
 
        if (timer_irq_works()) {
                printk(" works.\n");
-               return;
+               goto out;
        }
        printk(" failed :(.\n");
        panic("IO-APIC + timer doesn't work!  Boot with apic=debug and send a "
                "report.  Then try booting with the 'noapic' option");
+out:
+       local_irq_restore(flags);
 }
 
 /*
index 435a8c9b55f854bce24e145f20e5cc04ff7b1509..cbac1670c7c36ec4ee8c268618b4a8014859c2f3 100644 (file)
@@ -1281,10 +1281,13 @@ void disable_IO_APIC(void)
 static int __init timer_irq_works(void)
 {
        unsigned long t1 = jiffies;
+       unsigned long flags;
 
+       local_save_flags(flags);
        local_irq_enable();
        /* Let ten ticks pass... */
        mdelay((10 * 1000) / HZ);
+       local_irq_restore(flags);
 
        /*
         * Expect a few ticks at least, to be sure some possible
@@ -1655,6 +1658,9 @@ static inline void check_timer(void)
 {
        struct irq_cfg *cfg = irq_cfg + 0;
        int apic1, pin1, apic2, pin2;
+       unsigned long flags;
+
+       local_irq_save(flags);
 
        /*
         * get/set the timer IRQ vector:
@@ -1696,7 +1702,7 @@ static inline void check_timer(void)
                        }
                        if (disable_timer_pin_1 > 0)
                                clear_IO_APIC_pin(0, pin1);
-                       return;
+                       goto out;
                }
                clear_IO_APIC_pin(apic1, pin1);
                apic_printk(APIC_QUIET,KERN_ERR "..MP-BIOS bug: 8254 timer not "
@@ -1718,7 +1724,7 @@ static inline void check_timer(void)
                        if (nmi_watchdog == NMI_IO_APIC) {
                                setup_nmi();
                        }
-                       return;
+                       goto out;
                }
                /*
                 * Cleanup, just in case ...
@@ -1741,7 +1747,7 @@ static inline void check_timer(void)
 
        if (timer_irq_works()) {
                apic_printk(APIC_VERBOSE," works.\n");
-               return;
+               goto out;
        }
        apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | cfg->vector);
        apic_printk(APIC_VERBOSE," failed.\n");
@@ -1756,10 +1762,12 @@ static inline void check_timer(void)
 
        if (timer_irq_works()) {
                apic_printk(APIC_VERBOSE," works.\n");
-               return;
+               goto out;
        }
        apic_printk(APIC_VERBOSE," failed :(.\n");
        panic("IO-APIC + timer doesn't work! Try using the 'noapic' kernel parameter\n");
+out:
+       local_irq_restore(flags);
 }
 
 static int __init notimercheck(char *s)
index d87a523070d111d853cf8ca05a0d3dbad4bcf0cd..3a020f79f82b80195100adb8b431dc9502ed9780 100644 (file)
@@ -727,9 +727,7 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
 
        if ((addr > (u8 *) jprobe_return) && (addr < (u8 *) jprobe_return_end)) {
                if (&regs->esp != kcb->jprobe_saved_esp) {
-                       struct pt_regs *saved_regs =
-                           container_of(kcb->jprobe_saved_esp,
-                                           struct pt_regs, esp);
+                       struct pt_regs *saved_regs = &kcb->jprobe_saved_regs;
                        printk("current esp %p does not match saved esp %p\n",
                               &regs->esp, kcb->jprobe_saved_esp);
                        printk("Saved registers for jprobe %p\n", jp);
index 0c467644589c728e2a25ba10aaa17fc682a6bb6c..5df19a9f9239511536c2f994e1b35f539b723a63 100644 (file)
@@ -485,7 +485,6 @@ static void __kprobes resume_execution(struct kprobe *p,
                struct pt_regs *regs, struct kprobe_ctlblk *kcb)
 {
        unsigned long *tos = (unsigned long *)regs->rsp;
-       unsigned long next_rip = 0;
        unsigned long copy_rip = (unsigned long)p->ainsn.insn;
        unsigned long orig_rip = (unsigned long)p->addr;
        kprobe_opcode_t *insn = p->ainsn.insn;
@@ -494,46 +493,42 @@ static void __kprobes resume_execution(struct kprobe *p,
        if (*insn >= 0x40 && *insn <= 0x4f)
                insn++;
 
+       regs->eflags &= ~TF_MASK;
        switch (*insn) {
-       case 0x9c:              /* pushfl */
+       case 0x9c:      /* pushfl */
                *tos &= ~(TF_MASK | IF_MASK);
                *tos |= kcb->kprobe_old_rflags;
                break;
-       case 0xc3:              /* ret/lret */
-       case 0xcb:
-       case 0xc2:
+       case 0xc2:      /* iret/ret/lret */
+       case 0xc3:
        case 0xca:
-               regs->eflags &= ~TF_MASK;
-               /* rip is already adjusted, no more changes required*/
-               return;
-       case 0xe8:              /* call relative - Fix return addr */
+       case 0xcb:
+       case 0xcf:
+       case 0xea:      /* jmp absolute -- ip is correct */
+               /* ip is already adjusted, no more changes required */
+               goto no_change;
+       case 0xe8:      /* call relative - Fix return addr */
                *tos = orig_rip + (*tos - copy_rip);
                break;
        case 0xff:
                if ((insn[1] & 0x30) == 0x10) {
                        /* call absolute, indirect */
-                       /* Fix return addr; rip is correct. */
-                       next_rip = regs->rip;
+                       /* Fix return addr; ip is correct. */
                        *tos = orig_rip + (*tos - copy_rip);
+                       goto no_change;
                } else if (((insn[1] & 0x31) == 0x20) ||        /* jmp near, absolute indirect */
                           ((insn[1] & 0x31) == 0x21)) {        /* jmp far, absolute indirect */
-                       /* rip is correct. */
-                       next_rip = regs->rip;
+                       /* ip is correct. */
+                       goto no_change;
                }
-               break;
-       case 0xea:              /* jmp absolute -- rip is correct */
-               next_rip = regs->rip;
-               break;
        default:
                break;
        }
 
-       regs->eflags &= ~TF_MASK;
-       if (next_rip) {
-               regs->rip = next_rip;
-       } else {
-               regs->rip = orig_rip + (regs->rip - copy_rip);
-       }
+       regs->rip = orig_rip + (regs->rip - copy_rip);
+no_change:
+
+       return;
 }
 
 int __kprobes post_kprobe_handler(struct pt_regs *regs)
@@ -716,10 +711,8 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
        struct jprobe *jp = container_of(p, struct jprobe, kp);
 
        if ((addr > (u8 *) jprobe_return) && (addr < (u8 *) jprobe_return_end)) {
-               if ((long *)regs->rsp != kcb->jprobe_saved_rsp) {
-                       struct pt_regs *saved_regs =
-                           container_of(kcb->jprobe_saved_rsp,
-                                           struct pt_regs, rsp);
+               if ((unsigned long *)regs->rsp != kcb->jprobe_saved_rsp) {
+                       struct pt_regs *saved_regs = &kcb->jprobe_saved_regs;
                        printk("current rsp %p does not match saved rsp %p\n",
                               (long *)regs->rsp, kcb->jprobe_saved_rsp);
                        printk("Saved registers for jprobe %p\n", jp);
index 3057a19e4641be711836ed889ae8a48677de4cb7..c3ee43333f26a28ae714d4160d7d9755be69791a 100644 (file)
@@ -1,6 +1,6 @@
 /**
  * @file op_model_athlon.h
- * athlon / K7 model-specific MSR operations
+ * athlon / K7 / K8 / Family 10h model-specific MSR operations
  *
  * @remark Copyright 2002 OProfile authors
  * @remark Read the file COPYING
 #define CTRL_WRITE(l,h,msrs,c) do {wrmsr(msrs->controls[(c)].addr, (l), (h));} while (0)
 #define CTRL_SET_ACTIVE(n) (n |= (1<<22))
 #define CTRL_SET_INACTIVE(n) (n &= ~(1<<22))
-#define CTRL_CLEAR(x) (x &= (1<<21))
+#define CTRL_CLEAR_LO(x) (x &= (1<<21))
+#define CTRL_CLEAR_HI(x) (x &= 0xfffffcf0)
 #define CTRL_SET_ENABLE(val) (val |= 1<<20)
 #define CTRL_SET_USR(val,u) (val |= ((u & 1) << 16))
 #define CTRL_SET_KERN(val,k) (val |= ((k & 1) << 17))
 #define CTRL_SET_UM(val, m) (val |= (m << 8))
-#define CTRL_SET_EVENT(val, e) (val |= e)
+#define CTRL_SET_EVENT_LOW(val, e) (val |= (e & 0xff))
+#define CTRL_SET_EVENT_HIGH(val, e) (val |= ((e >> 8) & 0xf))
+#define CTRL_SET_HOST_ONLY(val, h) (val |= ((h & 1) << 9))
+#define CTRL_SET_GUEST_ONLY(val, h) (val |= ((h & 1) << 8))
 
 static unsigned long reset_value[NUM_COUNTERS];
  
@@ -70,7 +74,8 @@ static void athlon_setup_ctrs(struct op_msrs const * const msrs)
                if (unlikely(!CTRL_IS_RESERVED(msrs,i)))
                        continue;
                CTRL_READ(low, high, msrs, i);
-               CTRL_CLEAR(low);
+               CTRL_CLEAR_LO(low);
+               CTRL_CLEAR_HI(high);
                CTRL_WRITE(low, high, msrs, i);
        }
 
@@ -89,12 +94,17 @@ static void athlon_setup_ctrs(struct op_msrs const * const msrs)
                        CTR_WRITE(counter_config[i].count, msrs, i);
 
                        CTRL_READ(low, high, msrs, i);
-                       CTRL_CLEAR(low);
+                       CTRL_CLEAR_LO(low);
+                       CTRL_CLEAR_HI(high);
                        CTRL_SET_ENABLE(low);
                        CTRL_SET_USR(low, counter_config[i].user);
                        CTRL_SET_KERN(low, counter_config[i].kernel);
                        CTRL_SET_UM(low, counter_config[i].unit_mask);
-                       CTRL_SET_EVENT(low, counter_config[i].event);
+                       CTRL_SET_EVENT_LOW(low, counter_config[i].event);
+                       CTRL_SET_EVENT_HIGH(high, counter_config[i].event);
+                       CTRL_SET_HOST_ONLY(high, 0);
+                       CTRL_SET_GUEST_ONLY(high, 0);
+
                        CTRL_WRITE(low, high, msrs, i);
                } else {
                        reset_value[i] = 0;
index dc715a562e141161c40d9c1b0861bd412f5d5ec7..cb5e53b05c7c6baf6224f36a2c3dee8528c4e116 100644 (file)
@@ -880,7 +880,7 @@ static void as_remove_queued_request(struct request_queue *q,
 }
 
 /*
- * as_fifo_expired returns 0 if there are no expired reads on the fifo,
+ * as_fifo_expired returns 0 if there are no expired requests on the fifo,
  * 1 otherwise.  It is ratelimited so that we only perform the check once per
  * `fifo_expire' interval.  Otherwise a large number of expired requests
  * would create a hopeless seekstorm.
@@ -1097,7 +1097,8 @@ dispatch_writes:
                ad->batch_data_dir = REQ_ASYNC;
                ad->current_write_count = ad->write_batch_count;
                ad->write_batch_idled = 0;
-               rq = ad->next_rq[ad->batch_data_dir];
+               rq = rq_entry_fifo(ad->fifo_list[REQ_ASYNC].next);
+               ad->last_check_fifo[REQ_ASYNC] = jiffies;
                goto dispatch_request;
        }
 
@@ -1159,7 +1160,7 @@ static void as_add_request(struct request_queue *q, struct request *rq)
        as_add_rq_rb(ad, rq);
 
        /*
-        * set expire time (only used for reads) and add to fifo list
+        * set expire time and add to fifo list
         */
        rq_set_fifo_time(rq, jiffies + ad->fifo_expire[data_dir]);
        list_add_tail(&rq->queuelist, &ad->fifo_list[data_dir]);
@@ -1463,7 +1464,9 @@ static struct elevator_type iosched_as = {
 
 static int __init as_init(void)
 {
-       return elv_register(&iosched_as);
+       elv_register(&iosched_as);
+
+       return 0;
 }
 
 static void __exit as_exit(void)
index 0b4a47905575f2ee658d8a2f1e373aec71e935e5..13553e015d7203f244db2e411884c56cbee1bc26 100644 (file)
@@ -2279,8 +2279,6 @@ static struct elevator_type iosched_cfq = {
 
 static int __init cfq_init(void)
 {
-       int ret;
-
        /*
         * could be 0 on HZ < 1000 setups
         */
@@ -2292,11 +2290,9 @@ static int __init cfq_init(void)
        if (cfq_slab_setup())
                return -ENOMEM;
 
-       ret = elv_register(&iosched_cfq);
-       if (ret)
-               cfq_slab_kill();
+       elv_register(&iosched_cfq);
 
-       return ret;
+       return 0;
 }
 
 static void __exit cfq_exit(void)
index a054eef8dff63c19548f74e8d2b58db78e704822..342448c3d2ddf20432410b121ef3060859c998d3 100644 (file)
@@ -467,7 +467,9 @@ static struct elevator_type iosched_deadline = {
 
 static int __init deadline_init(void)
 {
-       return elv_register(&iosched_deadline);
+       elv_register(&iosched_deadline);
+
+       return 0;
 }
 
 static void __exit deadline_exit(void)
index 446aea2a3cfbd17e6ff8d15fc0b069785d196e7f..e452deb803957c1f71d71901ef669a630036363b 100644 (file)
@@ -960,7 +960,7 @@ void elv_unregister_queue(struct request_queue *q)
                __elv_unregister_queue(q->elevator);
 }
 
-int elv_register(struct elevator_type *e)
+void elv_register(struct elevator_type *e)
 {
        char *def = "";
 
@@ -975,7 +975,6 @@ int elv_register(struct elevator_type *e)
                                def = " (default)";
 
        printk(KERN_INFO "io scheduler %s registered%s\n", e->elevator_name, def);
-       return 0;
 }
 EXPORT_SYMBOL_GPL(elv_register);
 
index 7563d8aa39440bf1946849c745586cc1c7e9eb06..c23e029696508dde4161e1359acd882a6dc8a6de 100644 (file)
@@ -101,7 +101,9 @@ static struct elevator_type elevator_noop = {
 
 static int __init noop_init(void)
 {
-       return elv_register(&elevator_noop);
+       elv_register(&elevator_noop);
+
+       return 0;
 }
 
 static void __exit noop_exit(void)
index 91c73224f4c66f537761fe8c622e441ed5919d12..9675b34638d4824b566e9df643042239bbf04e05 100644 (file)
@@ -230,7 +230,7 @@ static int blk_fill_sghdr_rq(struct request_queue *q, struct request *rq,
        rq->cmd_len = hdr->cmd_len;
        rq->cmd_type = REQ_TYPE_BLOCK_PC;
 
-       rq->timeout = (hdr->timeout * HZ) / 1000;
+       rq->timeout = msecs_to_jiffies(hdr->timeout);
        if (!rq->timeout)
                rq->timeout = q->sg_timeout;
        if (!rq->timeout)
@@ -366,7 +366,7 @@ static int sg_io(struct file *file, struct request_queue *q,
         */
        blk_execute_rq(q, bd_disk, rq, 0);
 
-       hdr->duration = ((jiffies - start_time) * 1000) / HZ;
+       hdr->duration = jiffies_to_msecs(jiffies - start_time);
 
        return blk_complete_sghdr_rq(rq, hdr, bio);
 out:
index 46dc70e0dee7ee7d8add0e4541d28d64cc17f5ff..c79f066c2bc9ed796e35b1b6b3816d42d8c824ff 100644 (file)
@@ -375,7 +375,7 @@ static int hpt374_pre_reset(struct ata_link *link, unsigned long deadline)
        pci_write_config_word(pdev, mcrbase + 2, mcr3 | 0x8000);
        pci_read_config_byte(pdev, 0x5A, &ata66);
        /* Reset TCBLID/FCBLID to output */
-       pci_write_config_word(pdev, 0x52, mcr3);
+       pci_write_config_word(pdev, mcrbase + 2, mcr3);
 
        if (ata66 & (2 >> ap->port_no))
                ap->cbl = ATA_CBL_PATA40;
index 5f5095afb06b900b3b70a05837b19d866a9cdd8a..c24e1bdbad438785b0b68fca6aba5699331436b2 100644 (file)
@@ -34,7 +34,7 @@
  *                      - set initialised bit then.
  */
 
-//#define DEBUG /* uncomment if you want debugging info (pr_debug) */
+#undef DEBUG   /* #define DEBUG if you want debugging info (pr_debug) */
 #include <linux/fs.h>
 #include <linux/bio.h>
 #include <linux/kernel.h>
@@ -143,17 +143,12 @@ static struct cardinfo cards[MM_MAXCARDS];
 static struct block_device_operations mm_fops;
 static struct timer_list battery_timer;
 
-static int num_cards = 0;
+static int num_cards;
 
 static struct gendisk *mm_gendisk[MM_MAXCARDS];
 
 static void check_batteries(struct cardinfo *card);
 
-/*
------------------------------------------------------------------------------------
---                           get_userbit
------------------------------------------------------------------------------------
-*/
 static int get_userbit(struct cardinfo *card, int bit)
 {
        unsigned char led;
@@ -161,11 +156,7 @@ static int get_userbit(struct cardinfo *card, int bit)
        led = readb(card->csr_remap + MEMCTRLCMD_LEDCTRL);
        return led & bit;
 }
-/*
------------------------------------------------------------------------------------
---                            set_userbit
------------------------------------------------------------------------------------
-*/
+
 static int set_userbit(struct cardinfo *card, int bit, unsigned char state)
 {
        unsigned char led;
@@ -179,11 +170,7 @@ static int set_userbit(struct cardinfo *card, int bit, unsigned char state)
 
        return 0;
 }
-/*
------------------------------------------------------------------------------------
---                             set_led
------------------------------------------------------------------------------------
-*/
+
 /*
  * NOTE: For the power LED, use the LED_POWER_* macros since they differ
  */
@@ -203,11 +190,6 @@ static void set_led(struct cardinfo *card, int shift, unsigned char state)
 }
 
 #ifdef MM_DIAG
-/*
------------------------------------------------------------------------------------
---                              dump_regs
------------------------------------------------------------------------------------
-*/
 static void dump_regs(struct cardinfo *card)
 {
        unsigned char *p;
@@ -224,32 +206,28 @@ static void dump_regs(struct cardinfo *card)
        }
 }
 #endif
-/*
------------------------------------------------------------------------------------
---                            dump_dmastat
------------------------------------------------------------------------------------
-*/
+
 static void dump_dmastat(struct cardinfo *card, unsigned int dmastat)
 {
        dev_printk(KERN_DEBUG, &card->dev->dev, "DMAstat - ");
        if (dmastat & DMASCR_ANY_ERR)
-               printk("ANY_ERR ");
+               printk(KERN_CONT "ANY_ERR ");
        if (dmastat & DMASCR_MBE_ERR)
-               printk("MBE_ERR ");
+               printk(KERN_CONT "MBE_ERR ");
        if (dmastat & DMASCR_PARITY_ERR_REP)
-               printk("PARITY_ERR_REP ");
+               printk(KERN_CONT "PARITY_ERR_REP ");
        if (dmastat & DMASCR_PARITY_ERR_DET)
-               printk("PARITY_ERR_DET ");
+               printk(KERN_CONT "PARITY_ERR_DET ");
        if (dmastat & DMASCR_SYSTEM_ERR_SIG)
-               printk("SYSTEM_ERR_SIG ");
+               printk(KERN_CONT "SYSTEM_ERR_SIG ");
        if (dmastat & DMASCR_TARGET_ABT)
-               printk("TARGET_ABT ");
+               printk(KERN_CONT "TARGET_ABT ");
        if (dmastat & DMASCR_MASTER_ABT)
-               printk("MASTER_ABT ");
+               printk(KERN_CONT "MASTER_ABT ");
        if (dmastat & DMASCR_CHAIN_COMPLETE)
-               printk("CHAIN_COMPLETE ");
+               printk(KERN_CONT "CHAIN_COMPLETE ");
        if (dmastat & DMASCR_DMA_COMPLETE)
-               printk("DMA_COMPLETE ");
+               printk(KERN_CONT "DMA_COMPLETE ");
        printk("\n");
 }
 
@@ -286,7 +264,8 @@ static void mm_start_io(struct cardinfo *card)
 
        /* make the last descriptor end the chain */
        page = &card->mm_pages[card->Active];
-       pr_debug("start_io: %d %d->%d\n", card->Active, page->headcnt, page->cnt-1);
+       pr_debug("start_io: %d %d->%d\n",
+               card->Active, page->headcnt, page->cnt - 1);
        desc = &page->desc[page->cnt-1];
 
        desc->control_bits |= cpu_to_le32(DMASCR_CHAIN_COMP_EN);
@@ -310,8 +289,8 @@ static void mm_start_io(struct cardinfo *card)
        writel(0, card->csr_remap + DMA_SEMAPHORE_ADDR);
        writel(0, card->csr_remap + DMA_SEMAPHORE_ADDR + 4);
 
-       offset = ((char*)desc) - ((char*)page->desc);
-       writel(cpu_to_le32((page->page_dma+offset)&0xffffffff),
+       offset = ((char *)desc) - ((char *)page->desc);
+       writel(cpu_to_le32((page->page_dma+offset) & 0xffffffff),
               card->csr_remap + DMA_DESCRIPTOR_ADDR);
        /* Force the value to u64 before shifting otherwise >> 32 is undefined C
         * and on some ports will do nothing ! */
@@ -352,7 +331,7 @@ static inline void reset_page(struct mm_page *page)
        page->cnt = 0;
        page->headcnt = 0;
        page->bio = NULL;
-       page->biotail = & page->bio;
+       page->biotail = &page->bio;
 }
 
 static void mm_unplug_device(struct request_queue *q)
@@ -408,7 +387,7 @@ static int add_bio(struct cardinfo *card)
                                  vec->bv_page,
                                  vec->bv_offset,
                                  len,
-                                 (rw==READ) ?
+                                 (rw == READ) ?
                                  PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE);
 
        p = &card->mm_pages[card->Ready];
@@ -427,10 +406,10 @@ static int add_bio(struct cardinfo *card)
        desc->pci_addr = cpu_to_le64((u64)desc->data_dma_handle);
        desc->local_addr = cpu_to_le64(card->current_sector << 9);
        desc->transfer_size = cpu_to_le32(len);
-       offset = ( ((char*)&desc->sem_control_bits) - ((char*)p->desc));
+       offset = (((char *)&desc->sem_control_bits) - ((char *)p->desc));
        desc->sem_addr = cpu_to_le64((u64)(p->page_dma+offset));
        desc->zero1 = desc->zero2 = 0;
-       offset = ( ((char*)(desc+1)) - ((char*)p->desc));
+       offset = (((char *)(desc+1)) - ((char *)p->desc));
        desc->next_desc_addr = cpu_to_le64(p->page_dma+offset);
        desc->control_bits = cpu_to_le32(DMASCR_GO|DMASCR_ERR_INT_EN|
                                         DMASCR_PARITY_INT_EN|
@@ -455,11 +434,11 @@ static void process_page(unsigned long data)
        /* check if any of the requests in the page are DMA_COMPLETE,
         * and deal with them appropriately.
         * If we find a descriptor without DMA_COMPLETE in the semaphore, then
-        * dma must have hit an error on that descriptor, so use dma_status instead
-        * and assume that all following descriptors must be re-tried.
+        * dma must have hit an error on that descriptor, so use dma_status
+        * instead and assume that all following descriptors must be re-tried.
         */
        struct mm_page *page;
-       struct bio *return_bio=NULL;
+       struct bio *return_bio = NULL;
        struct cardinfo *card = (struct cardinfo *)data;
        unsigned int dma_status = card->dma_status;
 
@@ -472,12 +451,12 @@ static void process_page(unsigned long data)
                struct bio *bio = page->bio;
                struct mm_dma_desc *desc = &page->desc[page->headcnt];
                int control = le32_to_cpu(desc->sem_control_bits);
-               int last=0;
+               int last = 0;
                int idx;
 
                if (!(control & DMASCR_DMA_COMPLETE)) {
                        control = dma_status;
-                       last=1;
+                       last = 1;
                }
                page->headcnt++;
                idx = page->idx;
@@ -489,8 +468,8 @@ static void process_page(unsigned long data)
                }
 
                pci_unmap_page(card->dev, desc->data_dma_handle,
-                              bio_iovec_idx(bio,idx)->bv_len,
-                                (control& DMASCR_TRANSFER_READ) ?
+                              bio_iovec_idx(bio, idx)->bv_len,
+                                (control & DMASCR_TRANSFER_READ) ?
                                PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE);
                if (control & DMASCR_HARD_ERROR) {
                        /* error */
@@ -501,9 +480,10 @@ static void process_page(unsigned long data)
                                le32_to_cpu(desc->transfer_size));
                        dump_dmastat(card, control);
                } else if (test_bit(BIO_RW, &bio->bi_rw) &&
-                          le32_to_cpu(desc->local_addr)>>9 == card->init_size) {
-                       card->init_size += le32_to_cpu(desc->transfer_size)>>9;
-                       if (card->init_size>>1 >= card->mm_size) {
+                          le32_to_cpu(desc->local_addr) >> 9 ==
+                               card->init_size) {
+                       card->init_size += le32_to_cpu(desc->transfer_size) >> 9;
+                       if (card->init_size >> 1 >= card->mm_size) {
                                dev_printk(KERN_INFO, &card->dev->dev,
                                        "memory now initialised\n");
                                set_userbit(card, MEMORY_INITIALIZED, 1);
@@ -514,7 +494,8 @@ static void process_page(unsigned long data)
                        return_bio = bio;
                }
 
-               if (last) break;
+               if (last)
+                       break;
        }
 
        if (debug & DEBUG_LED_ON_TRANSFER)
@@ -536,7 +517,7 @@ static void process_page(unsigned long data)
  out_unlock:
        spin_unlock_bh(&card->lock);
 
-       while(return_bio) {
+       while (return_bio) {
                struct bio *bio = return_bio;
 
                return_bio = bio->bi_next;
@@ -545,11 +526,6 @@ static void process_page(unsigned long data)
        }
 }
 
-/*
------------------------------------------------------------------------------------
---                              mm_make_request
------------------------------------------------------------------------------------
-*/
 static int mm_make_request(struct request_queue *q, struct bio *bio)
 {
        struct cardinfo *card = q->queuedata;
@@ -566,11 +542,6 @@ static int mm_make_request(struct request_queue *q, struct bio *bio)
        return 0;
 }
 
-/*
------------------------------------------------------------------------------------
---                              mm_interrupt
------------------------------------------------------------------------------------
-*/
 static irqreturn_t mm_interrupt(int irq, void *__card)
 {
        struct cardinfo *card = (struct cardinfo *) __card;
@@ -584,15 +555,15 @@ HW_TRACE(0x30);
        if (!(dma_status & (DMASCR_ERROR_MASK | DMASCR_CHAIN_COMPLETE))) {
                /* interrupt wasn't for me ... */
                return IRQ_NONE;
-        }
+       }
 
        /* clear COMPLETION interrupts */
        if (card->flags & UM_FLAG_NO_BYTE_STATUS)
                writel(cpu_to_le32(DMASCR_DMA_COMPLETE|DMASCR_CHAIN_COMPLETE),
-                      card->csr_remap+ DMA_STATUS_CTRL);
+                      card->csr_remap + DMA_STATUS_CTRL);
        else
                writeb((DMASCR_DMA_COMPLETE|DMASCR_CHAIN_COMPLETE) >> 16,
-                      card->csr_remap+ DMA_STATUS_CTRL + 2);
+                      card->csr_remap + DMA_STATUS_CTRL + 2);
 
        /* log errors and clear interrupt status */
        if (dma_status & DMASCR_ANY_ERR) {
@@ -602,9 +573,12 @@ HW_TRACE(0x30);
 
                stat = readb(card->csr_remap + MEMCTRLCMD_ERRSTATUS);
 
-               data_log1 = le32_to_cpu(readl(card->csr_remap + ERROR_DATA_LOG));
-               data_log2 = le32_to_cpu(readl(card->csr_remap + ERROR_DATA_LOG + 4));
-               addr_log1 = le32_to_cpu(readl(card->csr_remap + ERROR_ADDR_LOG));
+               data_log1 = le32_to_cpu(readl(card->csr_remap +
+                                               ERROR_DATA_LOG));
+               data_log2 = le32_to_cpu(readl(card->csr_remap +
+                                               ERROR_DATA_LOG + 4));
+               addr_log1 = le32_to_cpu(readl(card->csr_remap +
+                                               ERROR_ADDR_LOG));
                addr_log2 = readb(card->csr_remap + ERROR_ADDR_LOG + 4);
 
                count = readb(card->csr_remap + ERROR_COUNT);
@@ -671,11 +645,7 @@ HW_TRACE(0x36);
 
        return IRQ_HANDLED;
 }
-/*
------------------------------------------------------------------------------------
---                         set_fault_to_battery_status
------------------------------------------------------------------------------------
-*/
+
 /*
  * If both batteries are good, no LED
  * If either battery has been warned, solid LED
@@ -696,12 +666,6 @@ static void set_fault_to_battery_status(struct cardinfo *card)
 
 static void init_battery_timer(void);
 
-
-/*
------------------------------------------------------------------------------------
---                            check_battery
------------------------------------------------------------------------------------
-*/
 static int check_battery(struct cardinfo *card, int battery, int status)
 {
        if (status != card->battery[battery].good) {
@@ -730,11 +694,7 @@ static int check_battery(struct cardinfo *card, int battery, int status)
 
        return 0;
 }
-/*
------------------------------------------------------------------------------------
---                              check_batteries
------------------------------------------------------------------------------------
-*/
+
 static void check_batteries(struct cardinfo *card)
 {
        /* NOTE: this must *never* be called while the card
@@ -775,11 +735,7 @@ static void check_all_batteries(unsigned long ptr)
 
        init_battery_timer();
 }
-/*
------------------------------------------------------------------------------------
---                            init_battery_timer
------------------------------------------------------------------------------------
-*/
+
 static void init_battery_timer(void)
 {
        init_timer(&battery_timer);
@@ -787,20 +743,12 @@ static void init_battery_timer(void)
        battery_timer.expires = jiffies + (HZ * 60);
        add_timer(&battery_timer);
 }
-/*
------------------------------------------------------------------------------------
---                              del_battery_timer
------------------------------------------------------------------------------------
-*/
+
 static void del_battery_timer(void)
 {
        del_timer(&battery_timer);
 }
-/*
------------------------------------------------------------------------------------
---                                mm_revalidate
------------------------------------------------------------------------------------
-*/
+
 /*
  * Note no locks taken out here.  In a worst case scenario, we could drop
  * a chunk of system memory.  But that should never happen, since validation
@@ -833,33 +781,23 @@ static int mm_getgeo(struct block_device *bdev, struct hd_geometry *geo)
 }
 
 /*
------------------------------------------------------------------------------------
---                                mm_check_change
------------------------------------------------------------------------------------
-  Future support for removable devices
-*/
+ * Future support for removable devices
+ */
 static int mm_check_change(struct gendisk *disk)
 {
 /*  struct cardinfo *dev = disk->private_data; */
        return 0;
 }
-/*
------------------------------------------------------------------------------------
---                             mm_fops
------------------------------------------------------------------------------------
-*/
+
 static struct block_device_operations mm_fops = {
        .owner          = THIS_MODULE,
        .getgeo         = mm_getgeo,
-       .revalidate_disk= mm_revalidate,
+       .revalidate_disk = mm_revalidate,
        .media_changed  = mm_check_change,
 };
-/*
------------------------------------------------------------------------------------
---                                mm_pci_probe
------------------------------------------------------------------------------------
-*/
-static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
+
+static int __devinit mm_pci_probe(struct pci_dev *dev,
+                               const struct pci_device_id *id)
 {
        int ret = -ENODEV;
        struct cardinfo *card = &cards[num_cards];
@@ -889,7 +827,7 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
                return -ENODEV;
 
        dev_printk(KERN_INFO, &dev->dev,
-               "Micro Memory(tm) controller found (PCI Mem Module (Battery Backup))\n");
+         "Micro Memory(tm) controller found (PCI Mem Module (Battery Backup))\n");
 
        if (pci_set_dma_mask(dev, DMA_64BIT_MASK) &&
            pci_set_dma_mask(dev, DMA_32BIT_MASK)) {
@@ -917,7 +855,7 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
                "CSR 0x%08lx -> 0x%p (0x%lx)\n",
               csr_base, card->csr_remap, csr_len);
 
-       switch(card->dev->device) {
+       switch (card->dev->device) {
        case 0x5415:
                card->flags |= UM_FLAG_NO_BYTE_STATUS | UM_FLAG_NO_BATTREG;
                magic_number = 0x59;
@@ -929,7 +867,8 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
                break;
 
        case 0x6155:
-               card->flags |= UM_FLAG_NO_BYTE_STATUS | UM_FLAG_NO_BATTREG | UM_FLAG_NO_BATT;
+               card->flags |= UM_FLAG_NO_BYTE_STATUS |
+                               UM_FLAG_NO_BATTREG | UM_FLAG_NO_BATT;
                magic_number = 0x99;
                break;
 
@@ -945,11 +884,11 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
        }
 
        card->mm_pages[0].desc = pci_alloc_consistent(card->dev,
-                                                     PAGE_SIZE*2,
-                                                     &card->mm_pages[0].page_dma);
+                                               PAGE_SIZE * 2,
+                                               &card->mm_pages[0].page_dma);
        card->mm_pages[1].desc = pci_alloc_consistent(card->dev,
-                                                     PAGE_SIZE*2,
-                                                     &card->mm_pages[1].page_dma);
+                                               PAGE_SIZE * 2,
+                                               &card->mm_pages[1].page_dma);
        if (card->mm_pages[0].desc == NULL ||
            card->mm_pages[1].desc == NULL) {
                dev_printk(KERN_ERR, &card->dev->dev, "alloc failed\n");
@@ -1013,9 +952,9 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
                dev_printk(KERN_INFO, &card->dev->dev,
                        "Size %d KB, Battery 1 %s (%s), Battery 2 %s (%s)\n",
                       card->mm_size,
-                      (batt_status & BATTERY_1_DISABLED ? "Disabled" : "Enabled"),
+                      batt_status & BATTERY_1_DISABLED ? "Disabled" : "Enabled",
                       card->battery[0].good ? "OK" : "FAILURE",
-                      (batt_status & BATTERY_2_DISABLED ? "Disabled" : "Enabled"),
+                      batt_status & BATTERY_2_DISABLED ? "Disabled" : "Enabled",
                       card->battery[1].good ? "OK" : "FAILURE");
 
                set_fault_to_battery_status(card);
@@ -1030,18 +969,18 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
        data = ~data;
        data += 1;
 
-       if (request_irq(dev->irq, mm_interrupt, IRQF_SHARED, DRIVER_NAME, card)) {
+       if (request_irq(dev->irq, mm_interrupt, IRQF_SHARED, DRIVER_NAME,
+                       card)) {
                dev_printk(KERN_ERR, &card->dev->dev,
                        "Unable to allocate IRQ\n");
                ret = -ENODEV;
-
                goto failed_req_irq;
        }
 
        dev_printk(KERN_INFO, &card->dev->dev,
                "Window size %d bytes, IRQ %d\n", data, dev->irq);
 
-        spin_lock_init(&card->lock);
+       spin_lock_init(&card->lock);
 
        pci_set_drvdata(dev, card);
 
@@ -1060,7 +999,7 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
 
        if (!get_userbit(card, MEMORY_INITIALIZED)) {
                dev_printk(KERN_INFO, &card->dev->dev,
-                       "memory NOT initialized. Consider over-writing whole device.\n");
+                 "memory NOT initialized. Consider over-writing whole device.\n");
                card->init_size = 0;
        } else {
                dev_printk(KERN_INFO, &card->dev->dev,
@@ -1091,11 +1030,7 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
 
        return ret;
 }
-/*
------------------------------------------------------------------------------------
---                              mm_pci_remove
------------------------------------------------------------------------------------
-*/
+
 static void mm_pci_remove(struct pci_dev *dev)
 {
        struct cardinfo *card = pci_get_drvdata(dev);
@@ -1119,16 +1054,16 @@ static void mm_pci_remove(struct pci_dev *dev)
 }
 
 static const struct pci_device_id mm_pci_ids[] = {
-    {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY,PCI_DEVICE_ID_MICRO_MEMORY_5415CN)},
-    {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY,PCI_DEVICE_ID_MICRO_MEMORY_5425CN)},
-    {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY,PCI_DEVICE_ID_MICRO_MEMORY_6155)},
+    {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY, PCI_DEVICE_ID_MICRO_MEMORY_5415CN)},
+    {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY, PCI_DEVICE_ID_MICRO_MEMORY_5425CN)},
+    {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY, PCI_DEVICE_ID_MICRO_MEMORY_6155)},
     {
        .vendor =       0x8086,
        .device =       0xB555,
-       .subvendor    0x1332,
-       .subdevice    0x5460,
-       .class  =       0x050000,
-       .class_mask   0,
+       .subvendor =    0x1332,
+       .subdevice =    0x5460,
+       .class        0x050000,
+       .class_mask =   0,
     }, { /* end: all zeroes */ }
 };
 
@@ -1141,12 +1076,6 @@ static struct pci_driver mm_pci_driver = {
        .remove         = mm_pci_remove,
 };
 
-/*
------------------------------------------------------------------------------------
---                               mm_init
------------------------------------------------------------------------------------
-*/
-
 static int __init mm_init(void)
 {
        int retval, i;
@@ -1193,18 +1122,14 @@ out:
                put_disk(mm_gendisk[i]);
        return -ENOMEM;
 }
-/*
------------------------------------------------------------------------------------
---                             mm_cleanup
------------------------------------------------------------------------------------
-*/
+
 static void __exit mm_cleanup(void)
 {
        int i;
 
        del_battery_timer();
 
-       for (i=0; i < num_cards ; i++) {
+       for (i = 0; i < num_cards ; i++) {
                del_gendisk(mm_gendisk[i]);
                put_disk(mm_gendisk[i]);
        }
index ff59d2e0475bfe620bb71dca843219bd76cf79f9..785bbdcf4a58212e4371fbdc024a1ef1919ffc88 100644 (file)
@@ -7,6 +7,10 @@
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or (at
  * your option) any later version.
+ *
+ * Thanks to the following companies for their support:
+ *
+ *     - JMicron (hardware and technical support)
  */
 
 #include <linux/delay.h>
 
 static unsigned int debug_quirks = 0;
 
+/*
+ * Different quirks to handle when the hardware deviates from a strict
+ * interpretation of the SDHCI specification.
+ */
+
+/* Controller doesn't honor resets unless we touch the clock register */
 #define SDHCI_QUIRK_CLOCK_BEFORE_RESET                 (1<<0)
+/* Controller has bad caps bits, but really supports DMA */
 #define SDHCI_QUIRK_FORCE_DMA                          (1<<1)
 /* Controller doesn't like some resets when there is no card inserted. */
 #define SDHCI_QUIRK_NO_CARD_NO_RESET                   (1<<2)
+/* Controller doesn't like clearing the power reg before a change */
 #define SDHCI_QUIRK_SINGLE_POWER_WRITE                 (1<<3)
+/* Controller has flaky internal state so reset it on each ios change */
 #define SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS              (1<<4)
+/* Controller has an unusable DMA engine */
 #define SDHCI_QUIRK_BROKEN_DMA                         (1<<5)
+/* Controller can only DMA from 32-bit aligned addresses */
+#define SDHCI_QUIRK_32BIT_DMA_ADDR                     (1<<6)
+/* Controller can only DMA chunk sizes that are a multiple of 32 bits */
+#define SDHCI_QUIRK_32BIT_DMA_SIZE                     (1<<7)
+/* Controller needs to be reset after each request to stay stable */
+#define SDHCI_QUIRK_RESET_AFTER_REQUEST                        (1<<8)
 
 static const struct pci_device_id pci_ids[] __devinitdata = {
        {
@@ -97,6 +117,16 @@ static const struct pci_device_id pci_ids[] __devinitdata = {
                                  SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS,
        },
 
+       {
+               .vendor         = PCI_VENDOR_ID_JMICRON,
+               .device         = PCI_DEVICE_ID_JMICRON_JMB38X_SD,
+               .subvendor      = PCI_ANY_ID,
+               .subdevice      = PCI_ANY_ID,
+               .driver_data    = SDHCI_QUIRK_32BIT_DMA_ADDR |
+                                 SDHCI_QUIRK_32BIT_DMA_SIZE |
+                                 SDHCI_QUIRK_RESET_AFTER_REQUEST,
+       },
+
        {       /* Generic SD host controller */
                PCI_DEVICE_CLASS((PCI_CLASS_SYSTEM_SDHCI << 8), 0xFFFF00)
        },
@@ -419,7 +449,29 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data)
 
        writeb(count, host->ioaddr + SDHCI_TIMEOUT_CONTROL);
 
-       if (host->flags & SDHCI_USE_DMA) {
+       if (host->flags & SDHCI_USE_DMA)
+               host->flags |= SDHCI_REQ_USE_DMA;
+
+       if (unlikely((host->flags & SDHCI_REQ_USE_DMA) &&
+               (host->chip->quirks & SDHCI_QUIRK_32BIT_DMA_SIZE) &&
+               ((data->blksz * data->blocks) & 0x3))) {
+               DBG("Reverting to PIO because of transfer size (%d)\n",
+                       data->blksz * data->blocks);
+               host->flags &= ~SDHCI_REQ_USE_DMA;
+       }
+
+       /*
+        * The assumption here being that alignment is the same after
+        * translation to device address space.
+        */
+       if (unlikely((host->flags & SDHCI_REQ_USE_DMA) &&
+               (host->chip->quirks & SDHCI_QUIRK_32BIT_DMA_ADDR) &&
+               (data->sg->offset & 0x3))) {
+               DBG("Reverting to PIO because of bad alignment\n");
+               host->flags &= ~SDHCI_REQ_USE_DMA;
+       }
+
+       if (host->flags & SDHCI_REQ_USE_DMA) {
                int count;
 
                count = pci_map_sg(host->chip->pdev, data->sg, data->sg_len,
@@ -456,7 +508,7 @@ static void sdhci_set_transfer_mode(struct sdhci_host *host,
                mode |= SDHCI_TRNS_MULTI;
        if (data->flags & MMC_DATA_READ)
                mode |= SDHCI_TRNS_READ;
-       if (host->flags & SDHCI_USE_DMA)
+       if (host->flags & SDHCI_REQ_USE_DMA)
                mode |= SDHCI_TRNS_DMA;
 
        writew(mode, host->ioaddr + SDHCI_TRANSFER_MODE);
@@ -472,7 +524,7 @@ static void sdhci_finish_data(struct sdhci_host *host)
        data = host->data;
        host->data = NULL;
 
-       if (host->flags & SDHCI_USE_DMA) {
+       if (host->flags & SDHCI_REQ_USE_DMA) {
                pci_unmap_sg(host->chip->pdev, data->sg, data->sg_len,
                        (data->flags & MMC_DATA_READ)?PCI_DMA_FROMDEVICE:PCI_DMA_TODEVICE);
        }
@@ -886,7 +938,8 @@ static void sdhci_tasklet_finish(unsigned long param)
         */
        if (mrq->cmd->error ||
                (mrq->data && (mrq->data->error ||
-               (mrq->data->stop && mrq->data->stop->error)))) {
+               (mrq->data->stop && mrq->data->stop->error))) ||
+               (host->chip->quirks & SDHCI_QUIRK_RESET_AFTER_REQUEST)) {
 
                /* Some controllers need this kick or reset won't work here */
                if (host->chip->quirks & SDHCI_QUIRK_CLOCK_BEFORE_RESET) {
@@ -1284,7 +1337,7 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot)
 
        version = readw(host->ioaddr + SDHCI_HOST_VERSION);
        version = (version & SDHCI_SPEC_VER_MASK) >> SDHCI_SPEC_VER_SHIFT;
-       if (version != 0) {
+       if (version > 1) {
                printk(KERN_ERR "%s: Unknown controller version (%d). "
                        "You may experience problems.\n", host->slot_descr,
                        version);
index 05195ea900f490e1884a72de5a3d4081e61f38b5..e4d77b038bfa5e9e12c976294c3dfecb5b86d156 100644 (file)
@@ -171,7 +171,8 @@ struct sdhci_host {
        spinlock_t              lock;           /* Mutex */
 
        int                     flags;          /* Host attributes */
-#define SDHCI_USE_DMA          (1<<0)
+#define SDHCI_USE_DMA          (1<<0)          /* Host is DMA capable */
+#define SDHCI_REQ_USE_DMA      (1<<1)          /* Use DMA for this req. */
 
        unsigned int            max_clk;        /* Max possible freq (MHz) */
        unsigned int            timeout_clk;    /* Timeout freq (KHz) */
index 70f48a1a6d588fe0dc11530fa7d3383bc5cc8e37..b31d1c95c9fbd4d1a16c04856e088a54411801d5 100644 (file)
@@ -906,8 +906,7 @@ static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev
        }
 
        pci_set_master(pDev);
-       if (pci_set_dma_mask(pDev, DMA_64BIT_MASK) &&
-           pci_set_dma_mask(pDev, DMA_32BIT_MASK))
+       if (pci_set_dma_mask(pDev, DMA_32BIT_MASK))
                return -EINVAL;
 
        base_addr0_phys = pci_resource_start(pDev,0);
index 4c4465d39a1dabfb21d2fb3f740b729c18086789..01bf0189367dc8ef3bf30ff1668bf8eac31c1c7f 100644 (file)
@@ -2616,6 +2616,7 @@ static void initio_build_scb(struct initio_host * host, struct scsi_ctrl_blk * c
                scsi_for_each_sg(cmnd, sglist, cblk->sglen, i) {
                        sg->data = cpu_to_le32((u32)sg_dma_address(sglist));
                        total_len += sg->len = cpu_to_le32((u32)sg_dma_len(sglist));
+                       ++sg;
                }
 
                cblk->buflen = (scsi_bufflen(cmnd) > total_len) ?
@@ -2867,6 +2868,7 @@ static int initio_probe_one(struct pci_dev *pdev,
        }
        host = (struct initio_host *)shost->hostdata;
        memset(host, 0, sizeof(struct initio_host));
+       host->addr = pci_resource_start(pdev, 0);
 
        if (!request_region(host->addr, 256, "i91u")) {
                printk(KERN_WARNING "initio: I/O port range 0x%x is busy.\n", host->addr);
index 98dfd6ea209c69cd42b54fcbad286ac83826d7c7..328c47c6aeb1928a720f901f43f2a25e01ebb52e 100644 (file)
@@ -3611,6 +3611,7 @@ static struct st_buffer *
 
        tb->dma = need_dma;
        tb->buffer_size = got;
+       sg_init_table(tb->sg, max_sg);
 
        return tb;
 }
index 0f74aba5b2378cc4be77412785842e6fb168b4dc..9e0908d1981a99f1fef86f3b6f4bf531e83366fa 100644 (file)
@@ -1243,7 +1243,7 @@ static void sym_free_resources(struct sym_hcb *np, struct pci_dev *pdev)
         *  Free O/S specific resources.
         */
        if (pdev->irq)
-               free_irq(pdev->irq, np);
+               free_irq(pdev->irq, np->s.host);
        if (np->s.ioaddr)
                pci_iounmap(pdev, np->s.ioaddr);
        if (np->s.ramaddr)
index 463f119f20e90c6ab46c6448be3ba4fa57c73f20..254bdaeb35ff69d970fffd76533e944fd60577b2 100644 (file)
@@ -2791,7 +2791,7 @@ irqreturn_t sym_interrupt(struct Scsi_Host *shost)
        istat = INB(np, nc_istat);
        if (istat & INTF) {
                OUTB(np, nc_istat, (istat & SIGP) | INTF | np->istat_sem);
-               istat = INB(np, nc_istat);              /* DUMMY READ */
+               istat |= INB(np, nc_istat);             /* DUMMY READ */
                if (DEBUG_FLAGS & DEBUG_TINY) printf ("F ");
                sym_wakeup_done(np);
        }
index 9c56c492a6939b6dda69fc454299dbb134771343..b3128903d67328fdcb5747de418e59b177fe2dc0 100644 (file)
@@ -51,7 +51,8 @@
 #define L1GPU_DISPLAY_SYNC_HSYNC               1
 #define L1GPU_DISPLAY_SYNC_VSYNC               2
 
-#define GPU_CMD_BUF_SIZE                       (64 * 1024)
+#define GPU_CMD_BUF_SIZE                       (2 * 1024 * 1024)
+#define GPU_FB_START                           (64 * 1024)
 #define GPU_IOIF                               (0x0d000000UL)
 #define GPU_ALIGN_UP(x)                                _ALIGN_UP((x), 64)
 #define GPU_MAX_LINE_LENGTH                    (65536 - 64)
@@ -406,6 +407,7 @@ static void ps3fb_sync_image(struct device *dev, u64 frame_offset,
        if (src_line_length != dst_line_length)
                line_length |= (u64)src_line_length << 32;
 
+       src_offset += GPU_FB_START;
        status = lv1_gpu_context_attribute(ps3fb.context_handle,
                                           L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT,
                                           dst_offset, GPU_IOIF + src_offset,
@@ -976,9 +978,8 @@ static int ps3fb_xdr_settings(u64 xdr_lpar, struct device *dev)
 
        status = lv1_gpu_context_attribute(ps3fb.context_handle,
                                           L1GPU_CONTEXT_ATTRIBUTE_FB_SETUP,
-                                          xdr_lpar + ps3fb.xdr_size,
-                                          GPU_CMD_BUF_SIZE,
-                                          GPU_IOIF + ps3fb.xdr_size, 0);
+                                          xdr_lpar, GPU_CMD_BUF_SIZE,
+                                          GPU_IOIF, 0);
        if (status) {
                dev_err(dev,
                        "%s: lv1_gpu_context_attribute FB_SETUP failed: %d\n",
@@ -1061,6 +1062,11 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev)
        struct task_struct *task;
        unsigned long max_ps3fb_size;
 
+       if (ps3fb_videomemory.size < GPU_CMD_BUF_SIZE) {
+               dev_err(&dev->core, "%s: Not enough video memory\n", __func__);
+               return -ENOMEM;
+       }
+
        status = ps3_open_hv_device(dev);
        if (status) {
                dev_err(&dev->core, "%s: ps3_open_hv_device failed\n",
@@ -1131,8 +1137,14 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev)
        /* Clear memory to prevent kernel info leakage into userspace */
        memset(ps3fb.xdr_ea, 0, ps3fb_videomemory.size);
 
-       /* The GPU command buffer is at the end of video memory */
-       ps3fb.xdr_size = ps3fb_videomemory.size - GPU_CMD_BUF_SIZE;
+       /*
+        * The GPU command buffer is at the start of video memory
+        * As we don't use the full command buffer, we can put the actual
+        * frame buffer at offset GPU_FB_START and save some precious XDR
+        * memory
+        */
+       ps3fb.xdr_ea += GPU_FB_START;
+       ps3fb.xdr_size = ps3fb_videomemory.size - GPU_FB_START;
 
        retval = ps3fb_xdr_settings(xdr_lpar, &dev->core);
        if (retval)
@@ -1200,7 +1212,7 @@ err_fb_dealloc:
 err_framebuffer_release:
        framebuffer_release(info);
 err_free_irq:
-       free_irq(ps3fb.irq_no, dev);
+       free_irq(ps3fb.irq_no, &dev->core);
        ps3_irq_plug_destroy(ps3fb.irq_no);
 err_iounmap_dinfo:
        iounmap((u8 __iomem *)ps3fb.dinfo);
@@ -1235,7 +1247,7 @@ static int ps3fb_shutdown(struct ps3_system_bus_device *dev)
                kthread_stop(task);
        }
        if (ps3fb.irq_no) {
-               free_irq(ps3fb.irq_no, dev);
+               free_irq(ps3fb.irq_no, &dev->core);
                ps3_irq_plug_destroy(ps3fb.irq_no);
        }
        iounmap((u8 __iomem *)ps3fb.dinfo);
index 54c564693d93d287fb030b6f44e945838b35b85f..e1fcef2eb9285a6f8f449b72deb1e925c540671d 100644 (file)
@@ -356,13 +356,13 @@ xfs_file_readdir(
 
                        reclen = sizeof(struct hack_dirent) + de->namlen;
                        size -= reclen;
-                       curr_offset = de->offset /* & 0x7fffffff */;
                        de = (struct hack_dirent *)((char *)de + reclen);
+                       curr_offset = de->offset /* & 0x7fffffff */;
                }
        }
 
  done:
-       if (!error) {
+       if (!error) {
                if (size == 0)
                        filp->f_pos = offset & 0x7fffffff;
                else if (de)
index c171767e242ad3b3d19c8c93ea4651f0e30146ea..a5f4f4fb88683df96b65d9f883abbec35a1d2f8d 100644 (file)
@@ -508,7 +508,7 @@ xfs_dir2_block_getdents(
                        continue;
 
                cook = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
-                                                   ptr - (char *)block);
+                                           (char *)dep - (char *)block);
                ino = be64_to_cpu(dep->inumber);
 #if XFS_BIG_INUMS
                ino += mp->m_inoadd;
@@ -519,9 +519,7 @@ xfs_dir2_block_getdents(
                 */
                if (filldir(dirent, dep->name, dep->namelen, cook,
                            ino, DT_UNKNOWN)) {
-                       *offset = xfs_dir2_db_off_to_dataptr(mp,
-                                       mp->m_dirdatablk,
-                                       (char *)dep - (char *)block);
+                       *offset = cook;
                        xfs_da_brelse(NULL, bp);
                        return 0;
                }
index e7c12fa1303ee06c2d2837e781083b61cd0f7944..0ca0020ba09f0cd6c927d45d786712d80a87c2a1 100644 (file)
@@ -1091,7 +1091,7 @@ xfs_dir2_leaf_getdents(
                 * Won't fit.  Return to caller.
                 */
                if (filldir(dirent, dep->name, dep->namelen,
-                           xfs_dir2_byte_to_dataptr(mp, curoff + length),
+                           xfs_dir2_byte_to_dataptr(mp, curoff),
                            ino, DT_UNKNOWN))
                        break;
 
index 182c70315ad175b20e1ec5192bec92d9604c5635..919d275a1cef41c70fcb8d204104cfc918669f7a 100644 (file)
@@ -752,7 +752,7 @@ xfs_dir2_sf_getdents(
 #if XFS_BIG_INUMS
                ino += mp->m_inoadd;
 #endif
-               if (filldir(dirent, ".", 1, dotdot_offset, ino, DT_DIR)) {
+               if (filldir(dirent, ".", 1, dot_offset, ino, DT_DIR)) {
                        *offset = dot_offset;
                        return 0;
                }
@@ -762,13 +762,11 @@ xfs_dir2_sf_getdents(
         * Put .. entry unless we're starting past it.
         */
        if (*offset <= dotdot_offset) {
-               off = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
-                                                 XFS_DIR2_DATA_FIRST_OFFSET);
                ino = xfs_dir2_sf_get_inumber(sfp, &sfp->hdr.parent);
 #if XFS_BIG_INUMS
                ino += mp->m_inoadd;
 #endif
-               if (filldir(dirent, "..", 2, off, ino, DT_DIR)) {
+               if (filldir(dirent, "..", 2, dotdot_offset, ino, DT_DIR)) {
                        *offset = dotdot_offset;
                        return 0;
                }
@@ -793,8 +791,7 @@ xfs_dir2_sf_getdents(
 #endif
 
                if (filldir(dirent, sfep->name, sfep->namelen,
-                           off + xfs_dir2_data_entsize(sfep->namelen),
-                           ino, DT_UNKNOWN)) {
+                                           off, ino, DT_UNKNOWN)) {
                        *offset = off;
                        return 0;
                }
index abf509a88915e95aae00dcebec502170b1280b38..344948082819d94b82c72c5967d14e83e140cc36 100644 (file)
@@ -1459,8 +1459,10 @@ xfs_itruncate_start(
        mp = ip->i_mount;
        vp = XFS_ITOV(ip);
 
-       vn_iowait(ip);  /* wait for the completion of any pending DIOs */
-       
+       /* wait for the completion of any pending DIOs */
+       if (new_size < ip->i_size)
+               vn_iowait(ip);
+
        /*
         * Call toss_pages or flushinval_pages to get rid of pages
         * overlapping the region being removed.  We have to use
index b772d5b386855cd4f3de9c52ab13f747f9257e25..9fe8f3bddfd563fc7e70cabd9e495411d241f349 100644 (file)
@@ -73,7 +73,7 @@ struct kprobe_ctlblk {
        unsigned long kprobe_status;
        unsigned long kprobe_old_eflags;
        unsigned long kprobe_saved_eflags;
-       long *jprobe_saved_esp;
+       unsigned long *jprobe_saved_esp;
        struct pt_regs jprobe_saved_regs;
        kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE];
        struct prev_kprobe prev_kprobe;
index 53f4d85073545641421291911acc3a319488868c..743d76218fc97d44c023d7885ce6b21fbc31d1b1 100644 (file)
@@ -66,7 +66,7 @@ struct kprobe_ctlblk {
        unsigned long kprobe_status;
        unsigned long kprobe_old_rflags;
        unsigned long kprobe_saved_rflags;
-       long *jprobe_saved_rsp;
+       unsigned long *jprobe_saved_rsp;
        struct pt_regs jprobe_saved_regs;
        kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE];
        struct prev_kprobe prev_kprobe;
index 4cb23848d4605c436730c353c17c60728af8f373..6e9e4841a2da25836a997f07941676a6c599459a 100644 (file)
@@ -7,6 +7,13 @@
 
 #ifdef __KERNEL__
 
+/* entries in ARCH_DLINFO: */
+#ifdef CONFIG_IA32_EMULATION
+# define AT_VECTOR_SIZE_ARCH 2
+#else
+# define AT_VECTOR_SIZE_ARCH 1
+#endif
+
 #define __SAVE(reg,offset) "movq %%" #reg ",(14-" #offset ")*8(%%rsp)\n\t"
 #define __RESTORE(reg,offset) "movq (14-" #offset ")*8(%%rsp),%%" #reg "\n\t"
 
index e8f42133a61676ae438ab0ca5ea860d47b221f81..639624b55fbe34914f7bd7eb7d80d3deab756cb4 100644 (file)
@@ -119,7 +119,7 @@ extern void elv_put_request(struct request_queue *, struct request *);
 /*
  * io scheduler registration
  */
-extern int elv_register(struct elevator_type *);
+extern void elv_register(struct elevator_type *);
 extern void elv_unregister(struct elevator_type *);
 
 /*
index efc88538b2bae91a854e9bf3fbffc4832c77d7e4..4669be08061799641263078c61297293f3643eb7 100644 (file)
@@ -339,6 +339,13 @@ extern void
 __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
                  const char *name);
 
+/* caller has locked the irq_desc and both params are valid */
+static inline void __set_irq_handler_unlocked(int irq,
+                                             irq_flow_handler_t handler)
+{
+       irq_desc[irq].handle_irq = handler;
+}
+
 /*
  * Set a highlevel flow handler for a given IRQ:
  */
index 125eee1407ff1c5ee34d2cce2984d0a6fc14c5f0..7ab962fa1d738ffd540e4a260bb6822830b802da 100644 (file)
@@ -118,10 +118,6 @@ struct mmc_host {
        unsigned int            removed:1;      /* host is being removed */
 #endif
 
-       unsigned int            mode;           /* current card mode of host */
-#define MMC_MODE_MMC           0
-#define MMC_MODE_SD            1
-
        struct mmc_card         *card;          /* device attached to this host */
 
        wait_queue_head_t       wq;
index 111aa10f11369deed862766a8cb7b27956099f87..023656d2f1da02202c30def116d4ff4fd1424237 100644 (file)
 #define PCI_DEVICE_ID_JMICRON_JMB365   0x2365
 #define PCI_DEVICE_ID_JMICRON_JMB366   0x2366
 #define PCI_DEVICE_ID_JMICRON_JMB368   0x2368
+#define PCI_DEVICE_ID_JMICRON_JMB38X_SD        0x2381
 
 #define PCI_VENDOR_ID_KORENIX          0x1982
 #define PCI_DEVICE_ID_KORENIX_JETCARDF0        0x1600
index 9b5dff6b3f6a2bcf3a0ae76625b48edeb4f4334b..44019ce30a14213991a73c61c852073d4d6c8112 100644 (file)
@@ -297,18 +297,13 @@ handle_simple_irq(unsigned int irq, struct irq_desc *desc)
 
        if (unlikely(desc->status & IRQ_INPROGRESS))
                goto out_unlock;
+       desc->status &= ~(IRQ_REPLAY | IRQ_WAITING);
        kstat_cpu(cpu).irqs[irq]++;
 
        action = desc->action;
-       if (unlikely(!action || (desc->status & IRQ_DISABLED))) {
-               if (desc->chip->mask)
-                       desc->chip->mask(irq);
-               desc->status &= ~(IRQ_REPLAY | IRQ_WAITING);
-               desc->status |= IRQ_PENDING;
+       if (unlikely(!action || (desc->status & IRQ_DISABLED)))
                goto out_unlock;
-       }
 
-       desc->status &= ~(IRQ_REPLAY | IRQ_WAITING | IRQ_PENDING);
        desc->status |= IRQ_INPROGRESS;
        spin_unlock(&desc->lock);
 
index 1ec620c03064d109a5f1de5f925f00ae07cd946a..cae050b05f5ef91b22547dc88e6b6abc39877018 100644 (file)
@@ -6,6 +6,7 @@
 
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/sched.h>
 #include <linux/module.h>
 #include <linux/rwsem.h>
 
@@ -15,7 +16,7 @@
 /*
  * lock for reading
  */
-void down_read(struct rw_semaphore *sem)
+void __sched down_read(struct rw_semaphore *sem)
 {
        might_sleep();
        rwsem_acquire_read(&sem->dep_map, 0, 0, _RET_IP_);
@@ -42,7 +43,7 @@ EXPORT_SYMBOL(down_read_trylock);
 /*
  * lock for writing
  */
-void down_write(struct rw_semaphore *sem)
+void __sched down_write(struct rw_semaphore *sem)
 {
        might_sleep();
        rwsem_acquire(&sem->dep_map, 0, 0, _RET_IP_);
index c6e551de795be75247f25634d5d27a70740f1948..3df84ea6aba91972ab78af7846392051422264b4 100644 (file)
@@ -508,10 +508,15 @@ EXPORT_SYMBOL_GPL(cpu_clock);
 # define finish_arch_switch(prev)      do { } while (0)
 #endif
 
+static inline int task_current(struct rq *rq, struct task_struct *p)
+{
+       return rq->curr == p;
+}
+
 #ifndef __ARCH_WANT_UNLOCKED_CTXSW
 static inline int task_running(struct rq *rq, struct task_struct *p)
 {
-       return rq->curr == p;
+       return task_current(rq, p);
 }
 
 static inline void prepare_lock_switch(struct rq *rq, struct task_struct *next)
@@ -540,7 +545,7 @@ static inline int task_running(struct rq *rq, struct task_struct *p)
 #ifdef CONFIG_SMP
        return p->oncpu;
 #else
-       return rq->curr == p;
+       return task_current(rq, p);
 #endif
 }
 
@@ -663,6 +668,7 @@ void sched_clock_idle_wakeup_event(u64 delta_ns)
        struct rq *rq = cpu_rq(smp_processor_id());
        u64 now = sched_clock();
 
+       touch_softlockup_watchdog();
        rq->idle_clock += delta_ns;
        /*
         * Override the previous timestamp and ignore all
@@ -3334,7 +3340,7 @@ unsigned long long task_sched_runtime(struct task_struct *p)
 
        rq = task_rq_lock(p, &flags);
        ns = p->se.sum_exec_runtime;
-       if (rq->curr == p) {
+       if (task_current(rq, p)) {
                update_rq_clock(rq);
                delta_exec = rq->clock - p->se.exec_start;
                if ((s64)delta_exec > 0)
@@ -4021,7 +4027,7 @@ void rt_mutex_setprio(struct task_struct *p, int prio)
 
        oldprio = p->prio;
        on_rq = p->se.on_rq;
-       running = task_running(rq, p);
+       running = task_current(rq, p);
        if (on_rq) {
                dequeue_task(rq, p, 0);
                if (running)
@@ -4332,7 +4338,7 @@ recheck:
        }
        update_rq_clock(rq);
        on_rq = p->se.on_rq;
-       running = task_running(rq, p);
+       running = task_current(rq, p);
        if (on_rq) {
                deactivate_task(rq, p, 0);
                if (running)
@@ -7101,7 +7107,7 @@ void sched_move_task(struct task_struct *tsk)
 
        update_rq_clock(rq);
 
-       running = task_running(rq, tsk);
+       running = task_current(rq, tsk);
        on_rq = tsk->se.on_rq;
 
        if (on_rq) {
index c33f0ceb3de9a64dc43538f7d9427c89a4b98eeb..da7c061e72062eacd6afee8a9870e9044ad0e2c5 100644 (file)
@@ -511,8 +511,7 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial)
 
        if (!initial) {
                /* sleeps upto a single latency don't count. */
-               if (sched_feat(NEW_FAIR_SLEEPERS) && entity_is_task(se) &&
-                               task_of(se)->policy != SCHED_BATCH)
+               if (sched_feat(NEW_FAIR_SLEEPERS) && entity_is_task(se))
                        vruntime -= sysctl_sched_latency;
 
                /* ensure we never gain time by being placed backwards. */
index 1135de7308723d43e8294d8fc492449dfd3699ee..c68f68dcc605052c9bcc81d1719b343acb482e5b 100644 (file)
@@ -225,10 +225,10 @@ static struct ctl_table root_table[] = {
 };
 
 #ifdef CONFIG_SCHED_DEBUG
-static unsigned long min_sched_granularity_ns = 100000;                /* 100 usecs */
-static unsigned long max_sched_granularity_ns = NSEC_PER_SEC;  /* 1 second */
-static unsigned long min_wakeup_granularity_ns;                        /* 0 usecs */
-static unsigned long max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
+static int min_sched_granularity_ns = 100000;          /* 100 usecs */
+static int max_sched_granularity_ns = NSEC_PER_SEC;    /* 1 second */
+static int min_wakeup_granularity_ns;                  /* 0 usecs */
+static int max_wakeup_granularity_ns = NSEC_PER_SEC;   /* 1 second */
 #endif
 
 static struct ctl_table kern_table[] = {
index aa82d7bf478a7adc8eb34700b3a5b540e672b28d..5b86698faa0b08cc1411331c71aaf0ce466ee106 100644 (file)
@@ -383,33 +383,6 @@ int tick_resume_broadcast_oneshot(struct clock_event_device *bc)
        return 0;
 }
 
-/*
- * Reprogram the broadcast device:
- *
- * Called with tick_broadcast_lock held and interrupts disabled.
- */
-static int tick_broadcast_reprogram(void)
-{
-       ktime_t expires = { .tv64 = KTIME_MAX };
-       struct tick_device *td;
-       int cpu;
-
-       /*
-        * Find the event which expires next:
-        */
-       for (cpu = first_cpu(tick_broadcast_oneshot_mask); cpu != NR_CPUS;
-            cpu = next_cpu(cpu, tick_broadcast_oneshot_mask)) {
-               td = &per_cpu(tick_cpu_device, cpu);
-               if (td->evtdev->next_event.tv64 < expires.tv64)
-                       expires = td->evtdev->next_event;
-       }
-
-       if (expires.tv64 == KTIME_MAX)
-               return 0;
-
-       return tick_broadcast_set_event(expires, 0);
-}
-
 /*
  * Handle oneshot mode broadcasting
  */
@@ -417,12 +390,13 @@ static void tick_handle_oneshot_broadcast(struct clock_event_device *dev)
 {
        struct tick_device *td;
        cpumask_t mask;
-       ktime_t now;
+       ktime_t now, next_event;
        int cpu;
 
        spin_lock(&tick_broadcast_lock);
 again:
        dev->next_event.tv64 = KTIME_MAX;
+       next_event.tv64 = KTIME_MAX;
        mask = CPU_MASK_NONE;
        now = ktime_get();
        /* Find all expired events */
@@ -431,19 +405,31 @@ again:
                td = &per_cpu(tick_cpu_device, cpu);
                if (td->evtdev->next_event.tv64 <= now.tv64)
                        cpu_set(cpu, mask);
+               else if (td->evtdev->next_event.tv64 < next_event.tv64)
+                       next_event.tv64 = td->evtdev->next_event.tv64;
        }
 
        /*
-        * Wakeup the cpus which have an expired event. The broadcast
-        * device is reprogrammed in the return from idle code.
+        * Wakeup the cpus which have an expired event.
+        */
+       tick_do_broadcast(mask);
+
+       /*
+        * Two reasons for reprogram:
+        *
+        * - The global event did not expire any CPU local
+        * events. This happens in dyntick mode, as the maximum PIT
+        * delta is quite small.
+        *
+        * - There are pending events on sleeping CPUs which were not
+        * in the event mask
         */
-       if (!tick_do_broadcast(mask)) {
+       if (next_event.tv64 != KTIME_MAX) {
                /*
-                * The global event did not expire any CPU local
-                * events. This happens in dyntick mode, as the
-                * maximum PIT delta is quite small.
+                * Rearm the broadcast device. If event expired,
+                * repeat the above
                 */
-               if (tick_broadcast_reprogram())
+               if (tick_broadcast_set_event(next_event, 0))
                        goto again;
        }
        spin_unlock(&tick_broadcast_lock);
index a05817c021d62c1f93819ee666f2fc5bdb735f6a..d4527dcef1af8b325115ad37adb1b034a199d7b3 100644 (file)
@@ -1219,11 +1219,11 @@ asmlinkage long sys_sysinfo(struct sysinfo __user *info)
  */
 static struct lock_class_key base_lock_keys[NR_CPUS];
 
-static int __devinit init_timers_cpu(int cpu)
+static int __cpuinit init_timers_cpu(int cpu)
 {
        int j;
        tvec_base_t *base;
-       static char __devinitdata tvec_base_done[NR_CPUS];
+       static char __cpuinitdata tvec_base_done[NR_CPUS];
 
        if (!tvec_base_done[cpu]) {
                static char boot_done;
index cdb4e3d0560733c2706a27ccd20681017da2e34a..7d02700a4b0e131ae0dfba2e6da6ecf75b6a8d2c 100644 (file)
@@ -146,7 +146,7 @@ __rwsem_do_wake(struct rw_semaphore *sem, int downgrading)
 /*
  * wait for a lock to be granted
  */
-static struct rw_semaphore *
+static struct rw_semaphore __sched *
 rwsem_down_failed_common(struct rw_semaphore *sem,
                        struct rwsem_waiter *waiter, signed long adjustment)
 {
index 188cf5fd3e8d4acedec4e74c05375238526506e5..f4d0cded0e10aa21b02707fcaf99c4cbcafa4f06 100644 (file)
@@ -124,6 +124,18 @@ void __remove_from_page_cache(struct page *page)
        mapping->nrpages--;
        __dec_zone_page_state(page, NR_FILE_PAGES);
        BUG_ON(page_mapped(page));
+
+       /*
+        * Some filesystems seem to re-dirty the page even after
+        * the VM has canceled the dirty bit (eg ext3 journaling).
+        *
+        * Fix it up by doing a final dirty accounting check after
+        * having removed the page entirely.
+        */
+       if (PageDirty(page) && mapping_cap_account_dirty(mapping)) {
+               dec_zone_page_state(page, NR_FILE_DIRTY);
+               dec_bdi_stat(mapping->backing_dev_info, BDI_RECLAIMABLE);
+       }
 }
 
 void remove_from_page_cache(struct page *page)