aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/as-iosched.c11
-rw-r--r--block/cfq-iosched.c8
-rw-r--r--block/deadline-iosched.c4
-rw-r--r--block/elevator.c3
-rw-r--r--block/noop-iosched.c4
-rw-r--r--block/scsi_ioctl.c4
-rw-r--r--drivers/block/umem.c237
-rw-r--r--drivers/mmc/host/sdhci.c63
-rw-r--r--drivers/mmc/host/sdhci.h3
-rw-r--r--fs/xfs/linux-2.6/xfs_file.c4
-rw-r--r--fs/xfs/xfs_dir2_block.c6
-rw-r--r--fs/xfs/xfs_dir2_leaf.c2
-rw-r--r--fs/xfs/xfs_dir2_sf.c9
-rw-r--r--fs/xfs/xfs_inode.c6
-rw-r--r--include/linux/elevator.h2
-rw-r--r--include/linux/mmc/host.h4
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--kernel/rwsem.c5
-rw-r--r--kernel/sched.c18
-rw-r--r--kernel/sched_fair.c3
-rw-r--r--kernel/sysctl.c8
-rw-r--r--lib/rwsem.c2
22 files changed, 194 insertions, 213 deletions
diff --git a/block/as-iosched.c b/block/as-iosched.c
index dc715a562e14..cb5e53b05c7c 100644
--- a/block/as-iosched.c
+++ b/block/as-iosched.c
@@ -880,7 +880,7 @@ static void as_remove_queued_request(struct request_queue *q,
880} 880}
881 881
882/* 882/*
883 * as_fifo_expired returns 0 if there are no expired reads on the fifo, 883 * as_fifo_expired returns 0 if there are no expired requests on the fifo,
884 * 1 otherwise. It is ratelimited so that we only perform the check once per 884 * 1 otherwise. It is ratelimited so that we only perform the check once per
885 * `fifo_expire' interval. Otherwise a large number of expired requests 885 * `fifo_expire' interval. Otherwise a large number of expired requests
886 * would create a hopeless seekstorm. 886 * would create a hopeless seekstorm.
@@ -1097,7 +1097,8 @@ dispatch_writes:
1097 ad->batch_data_dir = REQ_ASYNC; 1097 ad->batch_data_dir = REQ_ASYNC;
1098 ad->current_write_count = ad->write_batch_count; 1098 ad->current_write_count = ad->write_batch_count;
1099 ad->write_batch_idled = 0; 1099 ad->write_batch_idled = 0;
1100 rq = ad->next_rq[ad->batch_data_dir]; 1100 rq = rq_entry_fifo(ad->fifo_list[REQ_ASYNC].next);
1101 ad->last_check_fifo[REQ_ASYNC] = jiffies;
1101 goto dispatch_request; 1102 goto dispatch_request;
1102 } 1103 }
1103 1104
@@ -1159,7 +1160,7 @@ static void as_add_request(struct request_queue *q, struct request *rq)
1159 as_add_rq_rb(ad, rq); 1160 as_add_rq_rb(ad, rq);
1160 1161
1161 /* 1162 /*
1162 * set expire time (only used for reads) and add to fifo list 1163 * set expire time and add to fifo list
1163 */ 1164 */
1164 rq_set_fifo_time(rq, jiffies + ad->fifo_expire[data_dir]); 1165 rq_set_fifo_time(rq, jiffies + ad->fifo_expire[data_dir]);
1165 list_add_tail(&rq->queuelist, &ad->fifo_list[data_dir]); 1166 list_add_tail(&rq->queuelist, &ad->fifo_list[data_dir]);
@@ -1463,7 +1464,9 @@ static struct elevator_type iosched_as = {
1463 1464
1464static int __init as_init(void) 1465static int __init as_init(void)
1465{ 1466{
1466 return elv_register(&iosched_as); 1467 elv_register(&iosched_as);
1468
1469 return 0;
1467} 1470}
1468 1471
1469static void __exit as_exit(void) 1472static void __exit as_exit(void)
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 0b4a47905575..13553e015d72 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -2279,8 +2279,6 @@ static struct elevator_type iosched_cfq = {
2279 2279
2280static int __init cfq_init(void) 2280static int __init cfq_init(void)
2281{ 2281{
2282 int ret;
2283
2284 /* 2282 /*
2285 * could be 0 on HZ < 1000 setups 2283 * could be 0 on HZ < 1000 setups
2286 */ 2284 */
@@ -2292,11 +2290,9 @@ static int __init cfq_init(void)
2292 if (cfq_slab_setup()) 2290 if (cfq_slab_setup())
2293 return -ENOMEM; 2291 return -ENOMEM;
2294 2292
2295 ret = elv_register(&iosched_cfq); 2293 elv_register(&iosched_cfq);
2296 if (ret)
2297 cfq_slab_kill();
2298 2294
2299 return ret; 2295 return 0;
2300} 2296}
2301 2297
2302static void __exit cfq_exit(void) 2298static void __exit cfq_exit(void)
diff --git a/block/deadline-iosched.c b/block/deadline-iosched.c
index a054eef8dff6..342448c3d2dd 100644
--- a/block/deadline-iosched.c
+++ b/block/deadline-iosched.c
@@ -467,7 +467,9 @@ static struct elevator_type iosched_deadline = {
467 467
468static int __init deadline_init(void) 468static int __init deadline_init(void)
469{ 469{
470 return elv_register(&iosched_deadline); 470 elv_register(&iosched_deadline);
471
472 return 0;
471} 473}
472 474
473static void __exit deadline_exit(void) 475static void __exit deadline_exit(void)
diff --git a/block/elevator.c b/block/elevator.c
index 446aea2a3cfb..e452deb80395 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -960,7 +960,7 @@ void elv_unregister_queue(struct request_queue *q)
960 __elv_unregister_queue(q->elevator); 960 __elv_unregister_queue(q->elevator);
961} 961}
962 962
963int elv_register(struct elevator_type *e) 963void elv_register(struct elevator_type *e)
964{ 964{
965 char *def = ""; 965 char *def = "";
966 966
@@ -975,7 +975,6 @@ int elv_register(struct elevator_type *e)
975 def = " (default)"; 975 def = " (default)";
976 976
977 printk(KERN_INFO "io scheduler %s registered%s\n", e->elevator_name, def); 977 printk(KERN_INFO "io scheduler %s registered%s\n", e->elevator_name, def);
978 return 0;
979} 978}
980EXPORT_SYMBOL_GPL(elv_register); 979EXPORT_SYMBOL_GPL(elv_register);
981 980
diff --git a/block/noop-iosched.c b/block/noop-iosched.c
index 7563d8aa3944..c23e02969650 100644
--- a/block/noop-iosched.c
+++ b/block/noop-iosched.c
@@ -101,7 +101,9 @@ static struct elevator_type elevator_noop = {
101 101
102static int __init noop_init(void) 102static int __init noop_init(void)
103{ 103{
104 return elv_register(&elevator_noop); 104 elv_register(&elevator_noop);
105
106 return 0;
105} 107}
106 108
107static void __exit noop_exit(void) 109static void __exit noop_exit(void)
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index 91c73224f4c6..9675b34638d4 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -230,7 +230,7 @@ static int blk_fill_sghdr_rq(struct request_queue *q, struct request *rq,
230 rq->cmd_len = hdr->cmd_len; 230 rq->cmd_len = hdr->cmd_len;
231 rq->cmd_type = REQ_TYPE_BLOCK_PC; 231 rq->cmd_type = REQ_TYPE_BLOCK_PC;
232 232
233 rq->timeout = (hdr->timeout * HZ) / 1000; 233 rq->timeout = msecs_to_jiffies(hdr->timeout);
234 if (!rq->timeout) 234 if (!rq->timeout)
235 rq->timeout = q->sg_timeout; 235 rq->timeout = q->sg_timeout;
236 if (!rq->timeout) 236 if (!rq->timeout)
@@ -366,7 +366,7 @@ static int sg_io(struct file *file, struct request_queue *q,
366 */ 366 */
367 blk_execute_rq(q, bd_disk, rq, 0); 367 blk_execute_rq(q, bd_disk, rq, 0);
368 368
369 hdr->duration = ((jiffies - start_time) * 1000) / HZ; 369 hdr->duration = jiffies_to_msecs(jiffies - start_time);
370 370
371 return blk_complete_sghdr_rq(rq, hdr, bio); 371 return blk_complete_sghdr_rq(rq, hdr, bio);
372out: 372out:
diff --git a/drivers/block/umem.c b/drivers/block/umem.c
index 5f5095afb06b..c24e1bdbad43 100644
--- a/drivers/block/umem.c
+++ b/drivers/block/umem.c
@@ -34,7 +34,7 @@
34 * - set initialised bit then. 34 * - set initialised bit then.
35 */ 35 */
36 36
37//#define DEBUG /* uncomment if you want debugging info (pr_debug) */ 37#undef DEBUG /* #define DEBUG if you want debugging info (pr_debug) */
38#include <linux/fs.h> 38#include <linux/fs.h>
39#include <linux/bio.h> 39#include <linux/bio.h>
40#include <linux/kernel.h> 40#include <linux/kernel.h>
@@ -143,17 +143,12 @@ static struct cardinfo cards[MM_MAXCARDS];
143static struct block_device_operations mm_fops; 143static struct block_device_operations mm_fops;
144static struct timer_list battery_timer; 144static struct timer_list battery_timer;
145 145
146static int num_cards = 0; 146static int num_cards;
147 147
148static struct gendisk *mm_gendisk[MM_MAXCARDS]; 148static struct gendisk *mm_gendisk[MM_MAXCARDS];
149 149
150static void check_batteries(struct cardinfo *card); 150static void check_batteries(struct cardinfo *card);
151 151
152/*
153-----------------------------------------------------------------------------------
154-- get_userbit
155-----------------------------------------------------------------------------------
156*/
157static int get_userbit(struct cardinfo *card, int bit) 152static int get_userbit(struct cardinfo *card, int bit)
158{ 153{
159 unsigned char led; 154 unsigned char led;
@@ -161,11 +156,7 @@ static int get_userbit(struct cardinfo *card, int bit)
161 led = readb(card->csr_remap + MEMCTRLCMD_LEDCTRL); 156 led = readb(card->csr_remap + MEMCTRLCMD_LEDCTRL);
162 return led & bit; 157 return led & bit;
163} 158}
164/* 159
165-----------------------------------------------------------------------------------
166-- set_userbit
167-----------------------------------------------------------------------------------
168*/
169static int set_userbit(struct cardinfo *card, int bit, unsigned char state) 160static int set_userbit(struct cardinfo *card, int bit, unsigned char state)
170{ 161{
171 unsigned char led; 162 unsigned char led;
@@ -179,11 +170,7 @@ static int set_userbit(struct cardinfo *card, int bit, unsigned char state)
179 170
180 return 0; 171 return 0;
181} 172}
182/* 173
183-----------------------------------------------------------------------------------
184-- set_led
185-----------------------------------------------------------------------------------
186*/
187/* 174/*
188 * NOTE: For the power LED, use the LED_POWER_* macros since they differ 175 * NOTE: For the power LED, use the LED_POWER_* macros since they differ
189 */ 176 */
@@ -203,11 +190,6 @@ static void set_led(struct cardinfo *card, int shift, unsigned char state)
203} 190}
204 191
205#ifdef MM_DIAG 192#ifdef MM_DIAG
206/*
207-----------------------------------------------------------------------------------
208-- dump_regs
209-----------------------------------------------------------------------------------
210*/
211static void dump_regs(struct cardinfo *card) 193static void dump_regs(struct cardinfo *card)
212{ 194{
213 unsigned char *p; 195 unsigned char *p;
@@ -224,32 +206,28 @@ static void dump_regs(struct cardinfo *card)
224 } 206 }
225} 207}
226#endif 208#endif
227/* 209
228-----------------------------------------------------------------------------------
229-- dump_dmastat
230-----------------------------------------------------------------------------------
231*/
232static void dump_dmastat(struct cardinfo *card, unsigned int dmastat) 210static void dump_dmastat(struct cardinfo *card, unsigned int dmastat)
233{ 211{
234 dev_printk(KERN_DEBUG, &card->dev->dev, "DMAstat - "); 212 dev_printk(KERN_DEBUG, &card->dev->dev, "DMAstat - ");
235 if (dmastat & DMASCR_ANY_ERR) 213 if (dmastat & DMASCR_ANY_ERR)
236 printk("ANY_ERR "); 214 printk(KERN_CONT "ANY_ERR ");
237 if (dmastat & DMASCR_MBE_ERR) 215 if (dmastat & DMASCR_MBE_ERR)
238 printk("MBE_ERR "); 216 printk(KERN_CONT "MBE_ERR ");
239 if (dmastat & DMASCR_PARITY_ERR_REP) 217 if (dmastat & DMASCR_PARITY_ERR_REP)
240 printk("PARITY_ERR_REP "); 218 printk(KERN_CONT "PARITY_ERR_REP ");
241 if (dmastat & DMASCR_PARITY_ERR_DET) 219 if (dmastat & DMASCR_PARITY_ERR_DET)
242 printk("PARITY_ERR_DET "); 220 printk(KERN_CONT "PARITY_ERR_DET ");
243 if (dmastat & DMASCR_SYSTEM_ERR_SIG) 221 if (dmastat & DMASCR_SYSTEM_ERR_SIG)
244 printk("SYSTEM_ERR_SIG "); 222 printk(KERN_CONT "SYSTEM_ERR_SIG ");
245 if (dmastat & DMASCR_TARGET_ABT) 223 if (dmastat & DMASCR_TARGET_ABT)
246 printk("TARGET_ABT "); 224 printk(KERN_CONT "TARGET_ABT ");
247 if (dmastat & DMASCR_MASTER_ABT) 225 if (dmastat & DMASCR_MASTER_ABT)
248 printk("MASTER_ABT "); 226 printk(KERN_CONT "MASTER_ABT ");
249 if (dmastat & DMASCR_CHAIN_COMPLETE) 227 if (dmastat & DMASCR_CHAIN_COMPLETE)
250 printk("CHAIN_COMPLETE "); 228 printk(KERN_CONT "CHAIN_COMPLETE ");
251 if (dmastat & DMASCR_DMA_COMPLETE) 229 if (dmastat & DMASCR_DMA_COMPLETE)
252 printk("DMA_COMPLETE "); 230 printk(KERN_CONT "DMA_COMPLETE ");
253 printk("\n"); 231 printk("\n");
254} 232}
255 233
@@ -286,7 +264,8 @@ static void mm_start_io(struct cardinfo *card)
286 264
287 /* make the last descriptor end the chain */ 265 /* make the last descriptor end the chain */
288 page = &card->mm_pages[card->Active]; 266 page = &card->mm_pages[card->Active];
289 pr_debug("start_io: %d %d->%d\n", card->Active, page->headcnt, page->cnt-1); 267 pr_debug("start_io: %d %d->%d\n",
268 card->Active, page->headcnt, page->cnt - 1);
290 desc = &page->desc[page->cnt-1]; 269 desc = &page->desc[page->cnt-1];
291 270
292 desc->control_bits |= cpu_to_le32(DMASCR_CHAIN_COMP_EN); 271 desc->control_bits |= cpu_to_le32(DMASCR_CHAIN_COMP_EN);
@@ -310,8 +289,8 @@ static void mm_start_io(struct cardinfo *card)
310 writel(0, card->csr_remap + DMA_SEMAPHORE_ADDR); 289 writel(0, card->csr_remap + DMA_SEMAPHORE_ADDR);
311 writel(0, card->csr_remap + DMA_SEMAPHORE_ADDR + 4); 290 writel(0, card->csr_remap + DMA_SEMAPHORE_ADDR + 4);
312 291
313 offset = ((char*)desc) - ((char*)page->desc); 292 offset = ((char *)desc) - ((char *)page->desc);
314 writel(cpu_to_le32((page->page_dma+offset)&0xffffffff), 293 writel(cpu_to_le32((page->page_dma+offset) & 0xffffffff),
315 card->csr_remap + DMA_DESCRIPTOR_ADDR); 294 card->csr_remap + DMA_DESCRIPTOR_ADDR);
316 /* Force the value to u64 before shifting otherwise >> 32 is undefined C 295 /* Force the value to u64 before shifting otherwise >> 32 is undefined C
317 * and on some ports will do nothing ! */ 296 * and on some ports will do nothing ! */
@@ -352,7 +331,7 @@ static inline void reset_page(struct mm_page *page)
352 page->cnt = 0; 331 page->cnt = 0;
353 page->headcnt = 0; 332 page->headcnt = 0;
354 page->bio = NULL; 333 page->bio = NULL;
355 page->biotail = & page->bio; 334 page->biotail = &page->bio;
356} 335}
357 336
358static void mm_unplug_device(struct request_queue *q) 337static void mm_unplug_device(struct request_queue *q)
@@ -408,7 +387,7 @@ static int add_bio(struct cardinfo *card)
408 vec->bv_page, 387 vec->bv_page,
409 vec->bv_offset, 388 vec->bv_offset,
410 len, 389 len,
411 (rw==READ) ? 390 (rw == READ) ?
412 PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE); 391 PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE);
413 392
414 p = &card->mm_pages[card->Ready]; 393 p = &card->mm_pages[card->Ready];
@@ -427,10 +406,10 @@ static int add_bio(struct cardinfo *card)
427 desc->pci_addr = cpu_to_le64((u64)desc->data_dma_handle); 406 desc->pci_addr = cpu_to_le64((u64)desc->data_dma_handle);
428 desc->local_addr = cpu_to_le64(card->current_sector << 9); 407 desc->local_addr = cpu_to_le64(card->current_sector << 9);
429 desc->transfer_size = cpu_to_le32(len); 408 desc->transfer_size = cpu_to_le32(len);
430 offset = ( ((char*)&desc->sem_control_bits) - ((char*)p->desc)); 409 offset = (((char *)&desc->sem_control_bits) - ((char *)p->desc));
431 desc->sem_addr = cpu_to_le64((u64)(p->page_dma+offset)); 410 desc->sem_addr = cpu_to_le64((u64)(p->page_dma+offset));
432 desc->zero1 = desc->zero2 = 0; 411 desc->zero1 = desc->zero2 = 0;
433 offset = ( ((char*)(desc+1)) - ((char*)p->desc)); 412 offset = (((char *)(desc+1)) - ((char *)p->desc));
434 desc->next_desc_addr = cpu_to_le64(p->page_dma+offset); 413 desc->next_desc_addr = cpu_to_le64(p->page_dma+offset);
435 desc->control_bits = cpu_to_le32(DMASCR_GO|DMASCR_ERR_INT_EN| 414 desc->control_bits = cpu_to_le32(DMASCR_GO|DMASCR_ERR_INT_EN|
436 DMASCR_PARITY_INT_EN| 415 DMASCR_PARITY_INT_EN|
@@ -455,11 +434,11 @@ static void process_page(unsigned long data)
455 /* check if any of the requests in the page are DMA_COMPLETE, 434 /* check if any of the requests in the page are DMA_COMPLETE,
456 * and deal with them appropriately. 435 * and deal with them appropriately.
457 * If we find a descriptor without DMA_COMPLETE in the semaphore, then 436 * If we find a descriptor without DMA_COMPLETE in the semaphore, then
458 * dma must have hit an error on that descriptor, so use dma_status instead 437 * dma must have hit an error on that descriptor, so use dma_status
459 * and assume that all following descriptors must be re-tried. 438 * instead and assume that all following descriptors must be re-tried.
460 */ 439 */
461 struct mm_page *page; 440 struct mm_page *page;
462 struct bio *return_bio=NULL; 441 struct bio *return_bio = NULL;
463 struct cardinfo *card = (struct cardinfo *)data; 442 struct cardinfo *card = (struct cardinfo *)data;
464 unsigned int dma_status = card->dma_status; 443 unsigned int dma_status = card->dma_status;
465 444
@@ -472,12 +451,12 @@ static void process_page(unsigned long data)
472 struct bio *bio = page->bio; 451 struct bio *bio = page->bio;
473 struct mm_dma_desc *desc = &page->desc[page->headcnt]; 452 struct mm_dma_desc *desc = &page->desc[page->headcnt];
474 int control = le32_to_cpu(desc->sem_control_bits); 453 int control = le32_to_cpu(desc->sem_control_bits);
475 int last=0; 454 int last = 0;
476 int idx; 455 int idx;
477 456
478 if (!(control & DMASCR_DMA_COMPLETE)) { 457 if (!(control & DMASCR_DMA_COMPLETE)) {
479 control = dma_status; 458 control = dma_status;
480 last=1; 459 last = 1;
481 } 460 }
482 page->headcnt++; 461 page->headcnt++;
483 idx = page->idx; 462 idx = page->idx;
@@ -489,8 +468,8 @@ static void process_page(unsigned long data)
489 } 468 }
490 469
491 pci_unmap_page(card->dev, desc->data_dma_handle, 470 pci_unmap_page(card->dev, desc->data_dma_handle,
492 bio_iovec_idx(bio,idx)->bv_len, 471 bio_iovec_idx(bio, idx)->bv_len,
493 (control& DMASCR_TRANSFER_READ) ? 472 (control & DMASCR_TRANSFER_READ) ?
494 PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE); 473 PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE);
495 if (control & DMASCR_HARD_ERROR) { 474 if (control & DMASCR_HARD_ERROR) {
496 /* error */ 475 /* error */
@@ -501,9 +480,10 @@ static void process_page(unsigned long data)
501 le32_to_cpu(desc->transfer_size)); 480 le32_to_cpu(desc->transfer_size));
502 dump_dmastat(card, control); 481 dump_dmastat(card, control);
503 } else if (test_bit(BIO_RW, &bio->bi_rw) && 482 } else if (test_bit(BIO_RW, &bio->bi_rw) &&
504 le32_to_cpu(desc->local_addr)>>9 == card->init_size) { 483 le32_to_cpu(desc->local_addr) >> 9 ==
505 card->init_size += le32_to_cpu(desc->transfer_size)>>9; 484 card->init_size) {
506 if (card->init_size>>1 >= card->mm_size) { 485 card->init_size += le32_to_cpu(desc->transfer_size) >> 9;
486 if (card->init_size >> 1 >= card->mm_size) {
507 dev_printk(KERN_INFO, &card->dev->dev, 487 dev_printk(KERN_INFO, &card->dev->dev,
508 "memory now initialised\n"); 488 "memory now initialised\n");
509 set_userbit(card, MEMORY_INITIALIZED, 1); 489 set_userbit(card, MEMORY_INITIALIZED, 1);
@@ -514,7 +494,8 @@ static void process_page(unsigned long data)
514 return_bio = bio; 494 return_bio = bio;
515 } 495 }
516 496
517 if (last) break; 497 if (last)
498 break;
518 } 499 }
519 500
520 if (debug & DEBUG_LED_ON_TRANSFER) 501 if (debug & DEBUG_LED_ON_TRANSFER)
@@ -536,7 +517,7 @@ static void process_page(unsigned long data)
536 out_unlock: 517 out_unlock:
537 spin_unlock_bh(&card->lock); 518 spin_unlock_bh(&card->lock);
538 519
539 while(return_bio) { 520 while (return_bio) {
540 struct bio *bio = return_bio; 521 struct bio *bio = return_bio;
541 522
542 return_bio = bio->bi_next; 523 return_bio = bio->bi_next;
@@ -545,11 +526,6 @@ static void process_page(unsigned long data)
545 } 526 }
546} 527}
547 528
548/*
549-----------------------------------------------------------------------------------
550-- mm_make_request
551-----------------------------------------------------------------------------------
552*/
553static int mm_make_request(struct request_queue *q, struct bio *bio) 529static int mm_make_request(struct request_queue *q, struct bio *bio)
554{ 530{
555 struct cardinfo *card = q->queuedata; 531 struct cardinfo *card = q->queuedata;
@@ -566,11 +542,6 @@ static int mm_make_request(struct request_queue *q, struct bio *bio)
566 return 0; 542 return 0;
567} 543}
568 544
569/*
570-----------------------------------------------------------------------------------
571-- mm_interrupt
572-----------------------------------------------------------------------------------
573*/
574static irqreturn_t mm_interrupt(int irq, void *__card) 545static irqreturn_t mm_interrupt(int irq, void *__card)
575{ 546{
576 struct cardinfo *card = (struct cardinfo *) __card; 547 struct cardinfo *card = (struct cardinfo *) __card;
@@ -584,15 +555,15 @@ HW_TRACE(0x30);
584 if (!(dma_status & (DMASCR_ERROR_MASK | DMASCR_CHAIN_COMPLETE))) { 555 if (!(dma_status & (DMASCR_ERROR_MASK | DMASCR_CHAIN_COMPLETE))) {
585 /* interrupt wasn't for me ... */ 556 /* interrupt wasn't for me ... */
586 return IRQ_NONE; 557 return IRQ_NONE;
587 } 558 }
588 559
589 /* clear COMPLETION interrupts */ 560 /* clear COMPLETION interrupts */
590 if (card->flags & UM_FLAG_NO_BYTE_STATUS) 561 if (card->flags & UM_FLAG_NO_BYTE_STATUS)
591 writel(cpu_to_le32(DMASCR_DMA_COMPLETE|DMASCR_CHAIN_COMPLETE), 562 writel(cpu_to_le32(DMASCR_DMA_COMPLETE|DMASCR_CHAIN_COMPLETE),
592 card->csr_remap+ DMA_STATUS_CTRL); 563 card->csr_remap + DMA_STATUS_CTRL);
593 else 564 else
594 writeb((DMASCR_DMA_COMPLETE|DMASCR_CHAIN_COMPLETE) >> 16, 565 writeb((DMASCR_DMA_COMPLETE|DMASCR_CHAIN_COMPLETE) >> 16,
595 card->csr_remap+ DMA_STATUS_CTRL + 2); 566 card->csr_remap + DMA_STATUS_CTRL + 2);
596 567
597 /* log errors and clear interrupt status */ 568 /* log errors and clear interrupt status */
598 if (dma_status & DMASCR_ANY_ERR) { 569 if (dma_status & DMASCR_ANY_ERR) {
@@ -602,9 +573,12 @@ HW_TRACE(0x30);
602 573
603 stat = readb(card->csr_remap + MEMCTRLCMD_ERRSTATUS); 574 stat = readb(card->csr_remap + MEMCTRLCMD_ERRSTATUS);
604 575
605 data_log1 = le32_to_cpu(readl(card->csr_remap + ERROR_DATA_LOG)); 576 data_log1 = le32_to_cpu(readl(card->csr_remap +
606 data_log2 = le32_to_cpu(readl(card->csr_remap + ERROR_DATA_LOG + 4)); 577 ERROR_DATA_LOG));
607 addr_log1 = le32_to_cpu(readl(card->csr_remap + ERROR_ADDR_LOG)); 578 data_log2 = le32_to_cpu(readl(card->csr_remap +
579 ERROR_DATA_LOG + 4));
580 addr_log1 = le32_to_cpu(readl(card->csr_remap +
581 ERROR_ADDR_LOG));
608 addr_log2 = readb(card->csr_remap + ERROR_ADDR_LOG + 4); 582 addr_log2 = readb(card->csr_remap + ERROR_ADDR_LOG + 4);
609 583
610 count = readb(card->csr_remap + ERROR_COUNT); 584 count = readb(card->csr_remap + ERROR_COUNT);
@@ -671,11 +645,7 @@ HW_TRACE(0x36);
671 645
672 return IRQ_HANDLED; 646 return IRQ_HANDLED;
673} 647}
674/* 648
675-----------------------------------------------------------------------------------
676-- set_fault_to_battery_status
677-----------------------------------------------------------------------------------
678*/
679/* 649/*
680 * If both batteries are good, no LED 650 * If both batteries are good, no LED
681 * If either battery has been warned, solid LED 651 * If either battery has been warned, solid LED
@@ -696,12 +666,6 @@ static void set_fault_to_battery_status(struct cardinfo *card)
696 666
697static void init_battery_timer(void); 667static void init_battery_timer(void);
698 668
699
700/*
701-----------------------------------------------------------------------------------
702-- check_battery
703-----------------------------------------------------------------------------------
704*/
705static int check_battery(struct cardinfo *card, int battery, int status) 669static int check_battery(struct cardinfo *card, int battery, int status)
706{ 670{
707 if (status != card->battery[battery].good) { 671 if (status != card->battery[battery].good) {
@@ -730,11 +694,7 @@ static int check_battery(struct cardinfo *card, int battery, int status)
730 694
731 return 0; 695 return 0;
732} 696}
733/* 697
734-----------------------------------------------------------------------------------
735-- check_batteries
736-----------------------------------------------------------------------------------
737*/
738static void check_batteries(struct cardinfo *card) 698static void check_batteries(struct cardinfo *card)
739{ 699{
740 /* NOTE: this must *never* be called while the card 700 /* NOTE: this must *never* be called while the card
@@ -775,11 +735,7 @@ static void check_all_batteries(unsigned long ptr)
775 735
776 init_battery_timer(); 736 init_battery_timer();
777} 737}
778/* 738
779-----------------------------------------------------------------------------------
780-- init_battery_timer
781-----------------------------------------------------------------------------------
782*/
783static void init_battery_timer(void) 739static void init_battery_timer(void)
784{ 740{
785 init_timer(&battery_timer); 741 init_timer(&battery_timer);
@@ -787,20 +743,12 @@ static void init_battery_timer(void)
787 battery_timer.expires = jiffies + (HZ * 60); 743 battery_timer.expires = jiffies + (HZ * 60);
788 add_timer(&battery_timer); 744 add_timer(&battery_timer);
789} 745}
790/* 746
791-----------------------------------------------------------------------------------
792-- del_battery_timer
793-----------------------------------------------------------------------------------
794*/
795static void del_battery_timer(void) 747static void del_battery_timer(void)
796{ 748{
797 del_timer(&battery_timer); 749 del_timer(&battery_timer);
798} 750}
799/* 751
800-----------------------------------------------------------------------------------
801-- mm_revalidate
802-----------------------------------------------------------------------------------
803*/
804/* 752/*
805 * Note no locks taken out here. In a worst case scenario, we could drop 753 * Note no locks taken out here. In a worst case scenario, we could drop
806 * a chunk of system memory. But that should never happen, since validation 754 * 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)
833} 781}
834 782
835/* 783/*
836----------------------------------------------------------------------------------- 784 * Future support for removable devices
837-- mm_check_change 785 */
838-----------------------------------------------------------------------------------
839 Future support for removable devices
840*/
841static int mm_check_change(struct gendisk *disk) 786static int mm_check_change(struct gendisk *disk)
842{ 787{
843/* struct cardinfo *dev = disk->private_data; */ 788/* struct cardinfo *dev = disk->private_data; */
844 return 0; 789 return 0;
845} 790}
846/* 791
847-----------------------------------------------------------------------------------
848-- mm_fops
849-----------------------------------------------------------------------------------
850*/
851static struct block_device_operations mm_fops = { 792static struct block_device_operations mm_fops = {
852 .owner = THIS_MODULE, 793 .owner = THIS_MODULE,
853 .getgeo = mm_getgeo, 794 .getgeo = mm_getgeo,
854 .revalidate_disk= mm_revalidate, 795 .revalidate_disk = mm_revalidate,
855 .media_changed = mm_check_change, 796 .media_changed = mm_check_change,
856}; 797};
857/* 798
858----------------------------------------------------------------------------------- 799static int __devinit mm_pci_probe(struct pci_dev *dev,
859-- mm_pci_probe 800 const struct pci_device_id *id)
860-----------------------------------------------------------------------------------
861*/
862static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
863{ 801{
864 int ret = -ENODEV; 802 int ret = -ENODEV;
865 struct cardinfo *card = &cards[num_cards]; 803 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
889 return -ENODEV; 827 return -ENODEV;
890 828
891 dev_printk(KERN_INFO, &dev->dev, 829 dev_printk(KERN_INFO, &dev->dev,
892 "Micro Memory(tm) controller found (PCI Mem Module (Battery Backup))\n"); 830 "Micro Memory(tm) controller found (PCI Mem Module (Battery Backup))\n");
893 831
894 if (pci_set_dma_mask(dev, DMA_64BIT_MASK) && 832 if (pci_set_dma_mask(dev, DMA_64BIT_MASK) &&
895 pci_set_dma_mask(dev, DMA_32BIT_MASK)) { 833 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
917 "CSR 0x%08lx -> 0x%p (0x%lx)\n", 855 "CSR 0x%08lx -> 0x%p (0x%lx)\n",
918 csr_base, card->csr_remap, csr_len); 856 csr_base, card->csr_remap, csr_len);
919 857
920 switch(card->dev->device) { 858 switch (card->dev->device) {
921 case 0x5415: 859 case 0x5415:
922 card->flags |= UM_FLAG_NO_BYTE_STATUS | UM_FLAG_NO_BATTREG; 860 card->flags |= UM_FLAG_NO_BYTE_STATUS | UM_FLAG_NO_BATTREG;
923 magic_number = 0x59; 861 magic_number = 0x59;
@@ -929,7 +867,8 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
929 break; 867 break;
930 868
931 case 0x6155: 869 case 0x6155:
932 card->flags |= UM_FLAG_NO_BYTE_STATUS | UM_FLAG_NO_BATTREG | UM_FLAG_NO_BATT; 870 card->flags |= UM_FLAG_NO_BYTE_STATUS |
871 UM_FLAG_NO_BATTREG | UM_FLAG_NO_BATT;
933 magic_number = 0x99; 872 magic_number = 0x99;
934 break; 873 break;
935 874
@@ -945,11 +884,11 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
945 } 884 }
946 885
947 card->mm_pages[0].desc = pci_alloc_consistent(card->dev, 886 card->mm_pages[0].desc = pci_alloc_consistent(card->dev,
948 PAGE_SIZE*2, 887 PAGE_SIZE * 2,
949 &card->mm_pages[0].page_dma); 888 &card->mm_pages[0].page_dma);
950 card->mm_pages[1].desc = pci_alloc_consistent(card->dev, 889 card->mm_pages[1].desc = pci_alloc_consistent(card->dev,
951 PAGE_SIZE*2, 890 PAGE_SIZE * 2,
952 &card->mm_pages[1].page_dma); 891 &card->mm_pages[1].page_dma);
953 if (card->mm_pages[0].desc == NULL || 892 if (card->mm_pages[0].desc == NULL ||
954 card->mm_pages[1].desc == NULL) { 893 card->mm_pages[1].desc == NULL) {
955 dev_printk(KERN_ERR, &card->dev->dev, "alloc failed\n"); 894 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
1013 dev_printk(KERN_INFO, &card->dev->dev, 952 dev_printk(KERN_INFO, &card->dev->dev,
1014 "Size %d KB, Battery 1 %s (%s), Battery 2 %s (%s)\n", 953 "Size %d KB, Battery 1 %s (%s), Battery 2 %s (%s)\n",
1015 card->mm_size, 954 card->mm_size,
1016 (batt_status & BATTERY_1_DISABLED ? "Disabled" : "Enabled"), 955 batt_status & BATTERY_1_DISABLED ? "Disabled" : "Enabled",
1017 card->battery[0].good ? "OK" : "FAILURE", 956 card->battery[0].good ? "OK" : "FAILURE",
1018 (batt_status & BATTERY_2_DISABLED ? "Disabled" : "Enabled"), 957 batt_status & BATTERY_2_DISABLED ? "Disabled" : "Enabled",
1019 card->battery[1].good ? "OK" : "FAILURE"); 958 card->battery[1].good ? "OK" : "FAILURE");
1020 959
1021 set_fault_to_battery_status(card); 960 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
1030 data = ~data; 969 data = ~data;
1031 data += 1; 970 data += 1;
1032 971
1033 if (request_irq(dev->irq, mm_interrupt, IRQF_SHARED, DRIVER_NAME, card)) { 972 if (request_irq(dev->irq, mm_interrupt, IRQF_SHARED, DRIVER_NAME,
973 card)) {
1034 dev_printk(KERN_ERR, &card->dev->dev, 974 dev_printk(KERN_ERR, &card->dev->dev,
1035 "Unable to allocate IRQ\n"); 975 "Unable to allocate IRQ\n");
1036 ret = -ENODEV; 976 ret = -ENODEV;
1037
1038 goto failed_req_irq; 977 goto failed_req_irq;
1039 } 978 }
1040 979
1041 dev_printk(KERN_INFO, &card->dev->dev, 980 dev_printk(KERN_INFO, &card->dev->dev,
1042 "Window size %d bytes, IRQ %d\n", data, dev->irq); 981 "Window size %d bytes, IRQ %d\n", data, dev->irq);
1043 982
1044 spin_lock_init(&card->lock); 983 spin_lock_init(&card->lock);
1045 984
1046 pci_set_drvdata(dev, card); 985 pci_set_drvdata(dev, card);
1047 986
@@ -1060,7 +999,7 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
1060 999
1061 if (!get_userbit(card, MEMORY_INITIALIZED)) { 1000 if (!get_userbit(card, MEMORY_INITIALIZED)) {
1062 dev_printk(KERN_INFO, &card->dev->dev, 1001 dev_printk(KERN_INFO, &card->dev->dev,
1063 "memory NOT initialized. Consider over-writing whole device.\n"); 1002 "memory NOT initialized. Consider over-writing whole device.\n");
1064 card->init_size = 0; 1003 card->init_size = 0;
1065 } else { 1004 } else {
1066 dev_printk(KERN_INFO, &card->dev->dev, 1005 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
1091 1030
1092 return ret; 1031 return ret;
1093} 1032}
1094/* 1033
1095-----------------------------------------------------------------------------------
1096-- mm_pci_remove
1097-----------------------------------------------------------------------------------
1098*/
1099static void mm_pci_remove(struct pci_dev *dev) 1034static void mm_pci_remove(struct pci_dev *dev)
1100{ 1035{
1101 struct cardinfo *card = pci_get_drvdata(dev); 1036 struct cardinfo *card = pci_get_drvdata(dev);
@@ -1119,16 +1054,16 @@ static void mm_pci_remove(struct pci_dev *dev)
1119} 1054}
1120 1055
1121static const struct pci_device_id mm_pci_ids[] = { 1056static const struct pci_device_id mm_pci_ids[] = {
1122 {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY,PCI_DEVICE_ID_MICRO_MEMORY_5415CN)}, 1057 {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY, PCI_DEVICE_ID_MICRO_MEMORY_5415CN)},
1123 {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY,PCI_DEVICE_ID_MICRO_MEMORY_5425CN)}, 1058 {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY, PCI_DEVICE_ID_MICRO_MEMORY_5425CN)},
1124 {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY,PCI_DEVICE_ID_MICRO_MEMORY_6155)}, 1059 {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY, PCI_DEVICE_ID_MICRO_MEMORY_6155)},
1125 { 1060 {
1126 .vendor = 0x8086, 1061 .vendor = 0x8086,
1127 .device = 0xB555, 1062 .device = 0xB555,
1128 .subvendor= 0x1332, 1063 .subvendor = 0x1332,
1129 .subdevice= 0x5460, 1064 .subdevice = 0x5460,
1130 .class = 0x050000, 1065 .class = 0x050000,
1131 .class_mask= 0, 1066 .class_mask = 0,
1132 }, { /* end: all zeroes */ } 1067 }, { /* end: all zeroes */ }
1133}; 1068};
1134 1069
@@ -1141,12 +1076,6 @@ static struct pci_driver mm_pci_driver = {
1141 .remove = mm_pci_remove, 1076 .remove = mm_pci_remove,
1142}; 1077};
1143 1078
1144/*
1145-----------------------------------------------------------------------------------
1146-- mm_init
1147-----------------------------------------------------------------------------------
1148*/
1149
1150static int __init mm_init(void) 1079static int __init mm_init(void)
1151{ 1080{
1152 int retval, i; 1081 int retval, i;
@@ -1193,18 +1122,14 @@ out:
1193 put_disk(mm_gendisk[i]); 1122 put_disk(mm_gendisk[i]);
1194 return -ENOMEM; 1123 return -ENOMEM;
1195} 1124}
1196/* 1125
1197-----------------------------------------------------------------------------------
1198-- mm_cleanup
1199-----------------------------------------------------------------------------------
1200*/
1201static void __exit mm_cleanup(void) 1126static void __exit mm_cleanup(void)
1202{ 1127{
1203 int i; 1128 int i;
1204 1129
1205 del_battery_timer(); 1130 del_battery_timer();
1206 1131
1207 for (i=0; i < num_cards ; i++) { 1132 for (i = 0; i < num_cards ; i++) {
1208 del_gendisk(mm_gendisk[i]); 1133 del_gendisk(mm_gendisk[i]);
1209 put_disk(mm_gendisk[i]); 1134 put_disk(mm_gendisk[i]);
1210 } 1135 }
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index ff59d2e0475b..785bbdcf4a58 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -7,6 +7,10 @@
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at 8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version. 9 * your option) any later version.
10 *
11 * Thanks to the following companies for their support:
12 *
13 * - JMicron (hardware and technical support)
10 */ 14 */
11 15
12#include <linux/delay.h> 16#include <linux/delay.h>
@@ -26,13 +30,29 @@
26 30
27static unsigned int debug_quirks = 0; 31static unsigned int debug_quirks = 0;
28 32
33/*
34 * Different quirks to handle when the hardware deviates from a strict
35 * interpretation of the SDHCI specification.
36 */
37
38/* Controller doesn't honor resets unless we touch the clock register */
29#define SDHCI_QUIRK_CLOCK_BEFORE_RESET (1<<0) 39#define SDHCI_QUIRK_CLOCK_BEFORE_RESET (1<<0)
40/* Controller has bad caps bits, but really supports DMA */
30#define SDHCI_QUIRK_FORCE_DMA (1<<1) 41#define SDHCI_QUIRK_FORCE_DMA (1<<1)
31/* Controller doesn't like some resets when there is no card inserted. */ 42/* Controller doesn't like some resets when there is no card inserted. */
32#define SDHCI_QUIRK_NO_CARD_NO_RESET (1<<2) 43#define SDHCI_QUIRK_NO_CARD_NO_RESET (1<<2)
44/* Controller doesn't like clearing the power reg before a change */
33#define SDHCI_QUIRK_SINGLE_POWER_WRITE (1<<3) 45#define SDHCI_QUIRK_SINGLE_POWER_WRITE (1<<3)
46/* Controller has flaky internal state so reset it on each ios change */
34#define SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS (1<<4) 47#define SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS (1<<4)
48/* Controller has an unusable DMA engine */
35#define SDHCI_QUIRK_BROKEN_DMA (1<<5) 49#define SDHCI_QUIRK_BROKEN_DMA (1<<5)
50/* Controller can only DMA from 32-bit aligned addresses */
51#define SDHCI_QUIRK_32BIT_DMA_ADDR (1<<6)
52/* Controller can only DMA chunk sizes that are a multiple of 32 bits */
53#define SDHCI_QUIRK_32BIT_DMA_SIZE (1<<7)
54/* Controller needs to be reset after each request to stay stable */
55#define SDHCI_QUIRK_RESET_AFTER_REQUEST (1<<8)
36 56
37static const struct pci_device_id pci_ids[] __devinitdata = { 57static const struct pci_device_id pci_ids[] __devinitdata = {
38 { 58 {
@@ -97,6 +117,16 @@ static const struct pci_device_id pci_ids[] __devinitdata = {
97 SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS, 117 SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS,
98 }, 118 },
99 119
120 {
121 .vendor = PCI_VENDOR_ID_JMICRON,
122 .device = PCI_DEVICE_ID_JMICRON_JMB38X_SD,
123 .subvendor = PCI_ANY_ID,
124 .subdevice = PCI_ANY_ID,
125 .driver_data = SDHCI_QUIRK_32BIT_DMA_ADDR |
126 SDHCI_QUIRK_32BIT_DMA_SIZE |
127 SDHCI_QUIRK_RESET_AFTER_REQUEST,
128 },
129
100 { /* Generic SD host controller */ 130 { /* Generic SD host controller */
101 PCI_DEVICE_CLASS((PCI_CLASS_SYSTEM_SDHCI << 8), 0xFFFF00) 131 PCI_DEVICE_CLASS((PCI_CLASS_SYSTEM_SDHCI << 8), 0xFFFF00)
102 }, 132 },
@@ -419,7 +449,29 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data)
419 449
420 writeb(count, host->ioaddr + SDHCI_TIMEOUT_CONTROL); 450 writeb(count, host->ioaddr + SDHCI_TIMEOUT_CONTROL);
421 451
422 if (host->flags & SDHCI_USE_DMA) { 452 if (host->flags & SDHCI_USE_DMA)
453 host->flags |= SDHCI_REQ_USE_DMA;
454
455 if (unlikely((host->flags & SDHCI_REQ_USE_DMA) &&
456 (host->chip->quirks & SDHCI_QUIRK_32BIT_DMA_SIZE) &&
457 ((data->blksz * data->blocks) & 0x3))) {
458 DBG("Reverting to PIO because of transfer size (%d)\n",
459 data->blksz * data->blocks);
460 host->flags &= ~SDHCI_REQ_USE_DMA;
461 }
462
463 /*
464 * The assumption here being that alignment is the same after
465 * translation to device address space.
466 */
467 if (unlikely((host->flags & SDHCI_REQ_USE_DMA) &&
468 (host->chip->quirks & SDHCI_QUIRK_32BIT_DMA_ADDR) &&
469 (data->sg->offset & 0x3))) {
470 DBG("Reverting to PIO because of bad alignment\n");
471 host->flags &= ~SDHCI_REQ_USE_DMA;
472 }
473
474 if (host->flags & SDHCI_REQ_USE_DMA) {
423 int count; 475 int count;
424 476
425 count = pci_map_sg(host->chip->pdev, data->sg, data->sg_len, 477 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,
456 mode |= SDHCI_TRNS_MULTI; 508 mode |= SDHCI_TRNS_MULTI;
457 if (data->flags & MMC_DATA_READ) 509 if (data->flags & MMC_DATA_READ)
458 mode |= SDHCI_TRNS_READ; 510 mode |= SDHCI_TRNS_READ;
459 if (host->flags & SDHCI_USE_DMA) 511 if (host->flags & SDHCI_REQ_USE_DMA)
460 mode |= SDHCI_TRNS_DMA; 512 mode |= SDHCI_TRNS_DMA;
461 513
462 writew(mode, host->ioaddr + SDHCI_TRANSFER_MODE); 514 writew(mode, host->ioaddr + SDHCI_TRANSFER_MODE);
@@ -472,7 +524,7 @@ static void sdhci_finish_data(struct sdhci_host *host)
472 data = host->data; 524 data = host->data;
473 host->data = NULL; 525 host->data = NULL;
474 526
475 if (host->flags & SDHCI_USE_DMA) { 527 if (host->flags & SDHCI_REQ_USE_DMA) {
476 pci_unmap_sg(host->chip->pdev, data->sg, data->sg_len, 528 pci_unmap_sg(host->chip->pdev, data->sg, data->sg_len,
477 (data->flags & MMC_DATA_READ)?PCI_DMA_FROMDEVICE:PCI_DMA_TODEVICE); 529 (data->flags & MMC_DATA_READ)?PCI_DMA_FROMDEVICE:PCI_DMA_TODEVICE);
478 } 530 }
@@ -886,7 +938,8 @@ static void sdhci_tasklet_finish(unsigned long param)
886 */ 938 */
887 if (mrq->cmd->error || 939 if (mrq->cmd->error ||
888 (mrq->data && (mrq->data->error || 940 (mrq->data && (mrq->data->error ||
889 (mrq->data->stop && mrq->data->stop->error)))) { 941 (mrq->data->stop && mrq->data->stop->error))) ||
942 (host->chip->quirks & SDHCI_QUIRK_RESET_AFTER_REQUEST)) {
890 943
891 /* Some controllers need this kick or reset won't work here */ 944 /* Some controllers need this kick or reset won't work here */
892 if (host->chip->quirks & SDHCI_QUIRK_CLOCK_BEFORE_RESET) { 945 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)
1284 1337
1285 version = readw(host->ioaddr + SDHCI_HOST_VERSION); 1338 version = readw(host->ioaddr + SDHCI_HOST_VERSION);
1286 version = (version & SDHCI_SPEC_VER_MASK) >> SDHCI_SPEC_VER_SHIFT; 1339 version = (version & SDHCI_SPEC_VER_MASK) >> SDHCI_SPEC_VER_SHIFT;
1287 if (version != 0) { 1340 if (version > 1) {
1288 printk(KERN_ERR "%s: Unknown controller version (%d). " 1341 printk(KERN_ERR "%s: Unknown controller version (%d). "
1289 "You may experience problems.\n", host->slot_descr, 1342 "You may experience problems.\n", host->slot_descr,
1290 version); 1343 version);
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 05195ea900f4..e4d77b038bfa 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -171,7 +171,8 @@ struct sdhci_host {
171 spinlock_t lock; /* Mutex */ 171 spinlock_t lock; /* Mutex */
172 172
173 int flags; /* Host attributes */ 173 int flags; /* Host attributes */
174#define SDHCI_USE_DMA (1<<0) 174#define SDHCI_USE_DMA (1<<0) /* Host is DMA capable */
175#define SDHCI_REQ_USE_DMA (1<<1) /* Use DMA for this req. */
175 176
176 unsigned int max_clk; /* Max possible freq (MHz) */ 177 unsigned int max_clk; /* Max possible freq (MHz) */
177 unsigned int timeout_clk; /* Timeout freq (KHz) */ 178 unsigned int timeout_clk; /* Timeout freq (KHz) */
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c
index 54c564693d93..e1fcef2eb928 100644
--- a/fs/xfs/linux-2.6/xfs_file.c
+++ b/fs/xfs/linux-2.6/xfs_file.c
@@ -356,13 +356,13 @@ xfs_file_readdir(
356 356
357 reclen = sizeof(struct hack_dirent) + de->namlen; 357 reclen = sizeof(struct hack_dirent) + de->namlen;
358 size -= reclen; 358 size -= reclen;
359 curr_offset = de->offset /* & 0x7fffffff */;
360 de = (struct hack_dirent *)((char *)de + reclen); 359 de = (struct hack_dirent *)((char *)de + reclen);
360 curr_offset = de->offset /* & 0x7fffffff */;
361 } 361 }
362 } 362 }
363 363
364 done: 364 done:
365 if (!error) { 365 if (!error) {
366 if (size == 0) 366 if (size == 0)
367 filp->f_pos = offset & 0x7fffffff; 367 filp->f_pos = offset & 0x7fffffff;
368 else if (de) 368 else if (de)
diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c
index c171767e242a..a5f4f4fb8868 100644
--- a/fs/xfs/xfs_dir2_block.c
+++ b/fs/xfs/xfs_dir2_block.c
@@ -508,7 +508,7 @@ xfs_dir2_block_getdents(
508 continue; 508 continue;
509 509
510 cook = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk, 510 cook = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
511 ptr - (char *)block); 511 (char *)dep - (char *)block);
512 ino = be64_to_cpu(dep->inumber); 512 ino = be64_to_cpu(dep->inumber);
513#if XFS_BIG_INUMS 513#if XFS_BIG_INUMS
514 ino += mp->m_inoadd; 514 ino += mp->m_inoadd;
@@ -519,9 +519,7 @@ xfs_dir2_block_getdents(
519 */ 519 */
520 if (filldir(dirent, dep->name, dep->namelen, cook, 520 if (filldir(dirent, dep->name, dep->namelen, cook,
521 ino, DT_UNKNOWN)) { 521 ino, DT_UNKNOWN)) {
522 *offset = xfs_dir2_db_off_to_dataptr(mp, 522 *offset = cook;
523 mp->m_dirdatablk,
524 (char *)dep - (char *)block);
525 xfs_da_brelse(NULL, bp); 523 xfs_da_brelse(NULL, bp);
526 return 0; 524 return 0;
527 } 525 }
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c
index e7c12fa1303e..0ca0020ba09f 100644
--- a/fs/xfs/xfs_dir2_leaf.c
+++ b/fs/xfs/xfs_dir2_leaf.c
@@ -1091,7 +1091,7 @@ xfs_dir2_leaf_getdents(
1091 * Won't fit. Return to caller. 1091 * Won't fit. Return to caller.
1092 */ 1092 */
1093 if (filldir(dirent, dep->name, dep->namelen, 1093 if (filldir(dirent, dep->name, dep->namelen,
1094 xfs_dir2_byte_to_dataptr(mp, curoff + length), 1094 xfs_dir2_byte_to_dataptr(mp, curoff),
1095 ino, DT_UNKNOWN)) 1095 ino, DT_UNKNOWN))
1096 break; 1096 break;
1097 1097
diff --git a/fs/xfs/xfs_dir2_sf.c b/fs/xfs/xfs_dir2_sf.c
index 182c70315ad1..919d275a1cef 100644
--- a/fs/xfs/xfs_dir2_sf.c
+++ b/fs/xfs/xfs_dir2_sf.c
@@ -752,7 +752,7 @@ xfs_dir2_sf_getdents(
752#if XFS_BIG_INUMS 752#if XFS_BIG_INUMS
753 ino += mp->m_inoadd; 753 ino += mp->m_inoadd;
754#endif 754#endif
755 if (filldir(dirent, ".", 1, dotdot_offset, ino, DT_DIR)) { 755 if (filldir(dirent, ".", 1, dot_offset, ino, DT_DIR)) {
756 *offset = dot_offset; 756 *offset = dot_offset;
757 return 0; 757 return 0;
758 } 758 }
@@ -762,13 +762,11 @@ xfs_dir2_sf_getdents(
762 * Put .. entry unless we're starting past it. 762 * Put .. entry unless we're starting past it.
763 */ 763 */
764 if (*offset <= dotdot_offset) { 764 if (*offset <= dotdot_offset) {
765 off = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
766 XFS_DIR2_DATA_FIRST_OFFSET);
767 ino = xfs_dir2_sf_get_inumber(sfp, &sfp->hdr.parent); 765 ino = xfs_dir2_sf_get_inumber(sfp, &sfp->hdr.parent);
768#if XFS_BIG_INUMS 766#if XFS_BIG_INUMS
769 ino += mp->m_inoadd; 767 ino += mp->m_inoadd;
770#endif 768#endif
771 if (filldir(dirent, "..", 2, off, ino, DT_DIR)) { 769 if (filldir(dirent, "..", 2, dotdot_offset, ino, DT_DIR)) {
772 *offset = dotdot_offset; 770 *offset = dotdot_offset;
773 return 0; 771 return 0;
774 } 772 }
@@ -793,8 +791,7 @@ xfs_dir2_sf_getdents(
793#endif 791#endif
794 792
795 if (filldir(dirent, sfep->name, sfep->namelen, 793 if (filldir(dirent, sfep->name, sfep->namelen,
796 off + xfs_dir2_data_entsize(sfep->namelen), 794 off, ino, DT_UNKNOWN)) {
797 ino, DT_UNKNOWN)) {
798 *offset = off; 795 *offset = off;
799 return 0; 796 return 0;
800 } 797 }
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index abf509a88915..344948082819 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1459,8 +1459,10 @@ xfs_itruncate_start(
1459 mp = ip->i_mount; 1459 mp = ip->i_mount;
1460 vp = XFS_ITOV(ip); 1460 vp = XFS_ITOV(ip);
1461 1461
1462 vn_iowait(ip); /* wait for the completion of any pending DIOs */ 1462 /* wait for the completion of any pending DIOs */
1463 1463 if (new_size < ip->i_size)
1464 vn_iowait(ip);
1465
1464 /* 1466 /*
1465 * Call toss_pages or flushinval_pages to get rid of pages 1467 * Call toss_pages or flushinval_pages to get rid of pages
1466 * overlapping the region being removed. We have to use 1468 * overlapping the region being removed. We have to use
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index e8f42133a616..639624b55fbe 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -119,7 +119,7 @@ extern void elv_put_request(struct request_queue *, struct request *);
119/* 119/*
120 * io scheduler registration 120 * io scheduler registration
121 */ 121 */
122extern int elv_register(struct elevator_type *); 122extern void elv_register(struct elevator_type *);
123extern void elv_unregister(struct elevator_type *); 123extern void elv_unregister(struct elevator_type *);
124 124
125/* 125/*
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 125eee1407ff..7ab962fa1d73 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -118,10 +118,6 @@ struct mmc_host {
118 unsigned int removed:1; /* host is being removed */ 118 unsigned int removed:1; /* host is being removed */
119#endif 119#endif
120 120
121 unsigned int mode; /* current card mode of host */
122#define MMC_MODE_MMC 0
123#define MMC_MODE_SD 1
124
125 struct mmc_card *card; /* device attached to this host */ 121 struct mmc_card *card; /* device attached to this host */
126 122
127 wait_queue_head_t wq; 123 wait_queue_head_t wq;
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 111aa10f1136..023656d2f1da 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2148,6 +2148,7 @@
2148#define PCI_DEVICE_ID_JMICRON_JMB365 0x2365 2148#define PCI_DEVICE_ID_JMICRON_JMB365 0x2365
2149#define PCI_DEVICE_ID_JMICRON_JMB366 0x2366 2149#define PCI_DEVICE_ID_JMICRON_JMB366 0x2366
2150#define PCI_DEVICE_ID_JMICRON_JMB368 0x2368 2150#define PCI_DEVICE_ID_JMICRON_JMB368 0x2368
2151#define PCI_DEVICE_ID_JMICRON_JMB38X_SD 0x2381
2151 2152
2152#define PCI_VENDOR_ID_KORENIX 0x1982 2153#define PCI_VENDOR_ID_KORENIX 0x1982
2153#define PCI_DEVICE_ID_KORENIX_JETCARDF0 0x1600 2154#define PCI_DEVICE_ID_KORENIX_JETCARDF0 0x1600
diff --git a/kernel/rwsem.c b/kernel/rwsem.c
index 1ec620c03064..cae050b05f5e 100644
--- a/kernel/rwsem.c
+++ b/kernel/rwsem.c
@@ -6,6 +6,7 @@
6 6
7#include <linux/types.h> 7#include <linux/types.h>
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/sched.h>
9#include <linux/module.h> 10#include <linux/module.h>
10#include <linux/rwsem.h> 11#include <linux/rwsem.h>
11 12
@@ -15,7 +16,7 @@
15/* 16/*
16 * lock for reading 17 * lock for reading
17 */ 18 */
18void down_read(struct rw_semaphore *sem) 19void __sched down_read(struct rw_semaphore *sem)
19{ 20{
20 might_sleep(); 21 might_sleep();
21 rwsem_acquire_read(&sem->dep_map, 0, 0, _RET_IP_); 22 rwsem_acquire_read(&sem->dep_map, 0, 0, _RET_IP_);
@@ -42,7 +43,7 @@ EXPORT_SYMBOL(down_read_trylock);
42/* 43/*
43 * lock for writing 44 * lock for writing
44 */ 45 */
45void down_write(struct rw_semaphore *sem) 46void __sched down_write(struct rw_semaphore *sem)
46{ 47{
47 might_sleep(); 48 might_sleep();
48 rwsem_acquire(&sem->dep_map, 0, 0, _RET_IP_); 49 rwsem_acquire(&sem->dep_map, 0, 0, _RET_IP_);
diff --git a/kernel/sched.c b/kernel/sched.c
index c6e551de795b..3df84ea6aba9 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -508,10 +508,15 @@ EXPORT_SYMBOL_GPL(cpu_clock);
508# define finish_arch_switch(prev) do { } while (0) 508# define finish_arch_switch(prev) do { } while (0)
509#endif 509#endif
510 510
511static inline int task_current(struct rq *rq, struct task_struct *p)
512{
513 return rq->curr == p;
514}
515
511#ifndef __ARCH_WANT_UNLOCKED_CTXSW 516#ifndef __ARCH_WANT_UNLOCKED_CTXSW
512static inline int task_running(struct rq *rq, struct task_struct *p) 517static inline int task_running(struct rq *rq, struct task_struct *p)
513{ 518{
514 return rq->curr == p; 519 return task_current(rq, p);
515} 520}
516 521
517static inline void prepare_lock_switch(struct rq *rq, struct task_struct *next) 522static 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)
540#ifdef CONFIG_SMP 545#ifdef CONFIG_SMP
541 return p->oncpu; 546 return p->oncpu;
542#else 547#else
543 return rq->curr == p; 548 return task_current(rq, p);
544#endif 549#endif
545} 550}
546 551
@@ -663,6 +668,7 @@ void sched_clock_idle_wakeup_event(u64 delta_ns)
663 struct rq *rq = cpu_rq(smp_processor_id()); 668 struct rq *rq = cpu_rq(smp_processor_id());
664 u64 now = sched_clock(); 669 u64 now = sched_clock();
665 670
671 touch_softlockup_watchdog();
666 rq->idle_clock += delta_ns; 672 rq->idle_clock += delta_ns;
667 /* 673 /*
668 * Override the previous timestamp and ignore all 674 * Override the previous timestamp and ignore all
@@ -3334,7 +3340,7 @@ unsigned long long task_sched_runtime(struct task_struct *p)
3334 3340
3335 rq = task_rq_lock(p, &flags); 3341 rq = task_rq_lock(p, &flags);
3336 ns = p->se.sum_exec_runtime; 3342 ns = p->se.sum_exec_runtime;
3337 if (rq->curr == p) { 3343 if (task_current(rq, p)) {
3338 update_rq_clock(rq); 3344 update_rq_clock(rq);
3339 delta_exec = rq->clock - p->se.exec_start; 3345 delta_exec = rq->clock - p->se.exec_start;
3340 if ((s64)delta_exec > 0) 3346 if ((s64)delta_exec > 0)
@@ -4021,7 +4027,7 @@ void rt_mutex_setprio(struct task_struct *p, int prio)
4021 4027
4022 oldprio = p->prio; 4028 oldprio = p->prio;
4023 on_rq = p->se.on_rq; 4029 on_rq = p->se.on_rq;
4024 running = task_running(rq, p); 4030 running = task_current(rq, p);
4025 if (on_rq) { 4031 if (on_rq) {
4026 dequeue_task(rq, p, 0); 4032 dequeue_task(rq, p, 0);
4027 if (running) 4033 if (running)
@@ -4332,7 +4338,7 @@ recheck:
4332 } 4338 }
4333 update_rq_clock(rq); 4339 update_rq_clock(rq);
4334 on_rq = p->se.on_rq; 4340 on_rq = p->se.on_rq;
4335 running = task_running(rq, p); 4341 running = task_current(rq, p);
4336 if (on_rq) { 4342 if (on_rq) {
4337 deactivate_task(rq, p, 0); 4343 deactivate_task(rq, p, 0);
4338 if (running) 4344 if (running)
@@ -7101,7 +7107,7 @@ void sched_move_task(struct task_struct *tsk)
7101 7107
7102 update_rq_clock(rq); 7108 update_rq_clock(rq);
7103 7109
7104 running = task_running(rq, tsk); 7110 running = task_current(rq, tsk);
7105 on_rq = tsk->se.on_rq; 7111 on_rq = tsk->se.on_rq;
7106 7112
7107 if (on_rq) { 7113 if (on_rq) {
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index c33f0ceb3de9..da7c061e7206 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -511,8 +511,7 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial)
511 511
512 if (!initial) { 512 if (!initial) {
513 /* sleeps upto a single latency don't count. */ 513 /* sleeps upto a single latency don't count. */
514 if (sched_feat(NEW_FAIR_SLEEPERS) && entity_is_task(se) && 514 if (sched_feat(NEW_FAIR_SLEEPERS) && entity_is_task(se))
515 task_of(se)->policy != SCHED_BATCH)
516 vruntime -= sysctl_sched_latency; 515 vruntime -= sysctl_sched_latency;
517 516
518 /* ensure we never gain time by being placed backwards. */ 517 /* ensure we never gain time by being placed backwards. */
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 1135de730872..c68f68dcc605 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -225,10 +225,10 @@ static struct ctl_table root_table[] = {
225}; 225};
226 226
227#ifdef CONFIG_SCHED_DEBUG 227#ifdef CONFIG_SCHED_DEBUG
228static unsigned long min_sched_granularity_ns = 100000; /* 100 usecs */ 228static int min_sched_granularity_ns = 100000; /* 100 usecs */
229static unsigned long max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */ 229static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
230static unsigned long min_wakeup_granularity_ns; /* 0 usecs */ 230static int min_wakeup_granularity_ns; /* 0 usecs */
231static unsigned long max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */ 231static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
232#endif 232#endif
233 233
234static struct ctl_table kern_table[] = { 234static struct ctl_table kern_table[] = {
diff --git a/lib/rwsem.c b/lib/rwsem.c
index cdb4e3d05607..7d02700a4b0e 100644
--- a/lib/rwsem.c
+++ b/lib/rwsem.c
@@ -146,7 +146,7 @@ __rwsem_do_wake(struct rw_semaphore *sem, int downgrading)
146/* 146/*
147 * wait for a lock to be granted 147 * wait for a lock to be granted
148 */ 148 */
149static struct rw_semaphore * 149static struct rw_semaphore __sched *
150rwsem_down_failed_common(struct rw_semaphore *sem, 150rwsem_down_failed_common(struct rw_semaphore *sem,
151 struct rwsem_waiter *waiter, signed long adjustment) 151 struct rwsem_waiter *waiter, signed long adjustment)
152{ 152{