Commit 3c615e19 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block

* 'for-linus' of git://git.kernel.dk/linux-2.6-block:
  Cleanup umem driver: fix most checkpatch warnings, conform to kernel
  block: let elv_register() return void
  as-iosched: fix write batch start point
  as-iosched: fix incorrect comments
  block: use jiffies conversion functions in scsi_ioctl.c
parents 57680915 458cf5e9
...@@ -880,7 +880,7 @@ static void as_remove_queued_request(struct request_queue *q, ...@@ -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 * 1 otherwise. It is ratelimited so that we only perform the check once per
* `fifo_expire' interval. Otherwise a large number of expired requests * `fifo_expire' interval. Otherwise a large number of expired requests
* would create a hopeless seekstorm. * would create a hopeless seekstorm.
...@@ -1097,7 +1097,8 @@ dispatch_writes: ...@@ -1097,7 +1097,8 @@ dispatch_writes:
ad->batch_data_dir = REQ_ASYNC; ad->batch_data_dir = REQ_ASYNC;
ad->current_write_count = ad->write_batch_count; ad->current_write_count = ad->write_batch_count;
ad->write_batch_idled = 0; 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; goto dispatch_request;
} }
...@@ -1159,7 +1160,7 @@ static void as_add_request(struct request_queue *q, struct request *rq) ...@@ -1159,7 +1160,7 @@ static void as_add_request(struct request_queue *q, struct request *rq)
as_add_rq_rb(ad, 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]); rq_set_fifo_time(rq, jiffies + ad->fifo_expire[data_dir]);
list_add_tail(&rq->queuelist, &ad->fifo_list[data_dir]); list_add_tail(&rq->queuelist, &ad->fifo_list[data_dir]);
...@@ -1463,7 +1464,9 @@ static struct elevator_type iosched_as = { ...@@ -1463,7 +1464,9 @@ static struct elevator_type iosched_as = {
static int __init as_init(void) static int __init as_init(void)
{ {
return elv_register(&iosched_as); elv_register(&iosched_as);
return 0;
} }
static void __exit as_exit(void) static void __exit as_exit(void)
......
...@@ -2279,8 +2279,6 @@ static struct elevator_type iosched_cfq = { ...@@ -2279,8 +2279,6 @@ static struct elevator_type iosched_cfq = {
static int __init cfq_init(void) static int __init cfq_init(void)
{ {
int ret;
/* /*
* could be 0 on HZ < 1000 setups * could be 0 on HZ < 1000 setups
*/ */
...@@ -2292,11 +2290,9 @@ static int __init cfq_init(void) ...@@ -2292,11 +2290,9 @@ static int __init cfq_init(void)
if (cfq_slab_setup()) if (cfq_slab_setup())
return -ENOMEM; return -ENOMEM;
ret = elv_register(&iosched_cfq); elv_register(&iosched_cfq);
if (ret)
cfq_slab_kill();
return ret; return 0;
} }
static void __exit cfq_exit(void) static void __exit cfq_exit(void)
......
...@@ -467,7 +467,9 @@ static struct elevator_type iosched_deadline = { ...@@ -467,7 +467,9 @@ static struct elevator_type iosched_deadline = {
static int __init deadline_init(void) static int __init deadline_init(void)
{ {
return elv_register(&iosched_deadline); elv_register(&iosched_deadline);
return 0;
} }
static void __exit deadline_exit(void) static void __exit deadline_exit(void)
......
...@@ -960,7 +960,7 @@ void elv_unregister_queue(struct request_queue *q) ...@@ -960,7 +960,7 @@ void elv_unregister_queue(struct request_queue *q)
__elv_unregister_queue(q->elevator); __elv_unregister_queue(q->elevator);
} }
int elv_register(struct elevator_type *e) void elv_register(struct elevator_type *e)
{ {
char *def = ""; char *def = "";
...@@ -975,7 +975,6 @@ int elv_register(struct elevator_type *e) ...@@ -975,7 +975,6 @@ int elv_register(struct elevator_type *e)
def = " (default)"; def = " (default)";
printk(KERN_INFO "io scheduler %s registered%s\n", e->elevator_name, def); printk(KERN_INFO "io scheduler %s registered%s\n", e->elevator_name, def);
return 0;
} }
EXPORT_SYMBOL_GPL(elv_register); EXPORT_SYMBOL_GPL(elv_register);
......
...@@ -101,7 +101,9 @@ static struct elevator_type elevator_noop = { ...@@ -101,7 +101,9 @@ static struct elevator_type elevator_noop = {
static int __init noop_init(void) static int __init noop_init(void)
{ {
return elv_register(&elevator_noop); elv_register(&elevator_noop);
return 0;
} }
static void __exit noop_exit(void) static void __exit noop_exit(void)
......
...@@ -230,7 +230,7 @@ static int blk_fill_sghdr_rq(struct request_queue *q, struct request *rq, ...@@ -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_len = hdr->cmd_len;
rq->cmd_type = REQ_TYPE_BLOCK_PC; rq->cmd_type = REQ_TYPE_BLOCK_PC;
rq->timeout = (hdr->timeout * HZ) / 1000; rq->timeout = msecs_to_jiffies(hdr->timeout);
if (!rq->timeout) if (!rq->timeout)
rq->timeout = q->sg_timeout; rq->timeout = q->sg_timeout;
if (!rq->timeout) if (!rq->timeout)
...@@ -366,7 +366,7 @@ static int sg_io(struct file *file, struct request_queue *q, ...@@ -366,7 +366,7 @@ static int sg_io(struct file *file, struct request_queue *q,
*/ */
blk_execute_rq(q, bd_disk, rq, 0); 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); return blk_complete_sghdr_rq(rq, hdr, bio);
out: out:
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
* - set initialised bit then. * - 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/fs.h>
#include <linux/bio.h> #include <linux/bio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -143,17 +143,12 @@ static struct cardinfo cards[MM_MAXCARDS]; ...@@ -143,17 +143,12 @@ static struct cardinfo cards[MM_MAXCARDS];
static struct block_device_operations mm_fops; static struct block_device_operations mm_fops;
static struct timer_list battery_timer; static struct timer_list battery_timer;
static int num_cards = 0; static int num_cards;
static struct gendisk *mm_gendisk[MM_MAXCARDS]; static struct gendisk *mm_gendisk[MM_MAXCARDS];
static void check_batteries(struct cardinfo *card); static void check_batteries(struct cardinfo *card);
/*
-----------------------------------------------------------------------------------
-- get_userbit
-----------------------------------------------------------------------------------
*/
static int get_userbit(struct cardinfo *card, int bit) static int get_userbit(struct cardinfo *card, int bit)
{ {
unsigned char led; unsigned char led;
...@@ -161,11 +156,7 @@ static int get_userbit(struct cardinfo *card, int bit) ...@@ -161,11 +156,7 @@ static int get_userbit(struct cardinfo *card, int bit)
led = readb(card->csr_remap + MEMCTRLCMD_LEDCTRL); led = readb(card->csr_remap + MEMCTRLCMD_LEDCTRL);
return led & bit; return led & bit;
} }
/*
-----------------------------------------------------------------------------------
-- set_userbit
-----------------------------------------------------------------------------------
*/
static int set_userbit(struct cardinfo *card, int bit, unsigned char state) static int set_userbit(struct cardinfo *card, int bit, unsigned char state)
{ {
unsigned char led; unsigned char led;
...@@ -179,11 +170,7 @@ static int set_userbit(struct cardinfo *card, int bit, unsigned char state) ...@@ -179,11 +170,7 @@ static int set_userbit(struct cardinfo *card, int bit, unsigned char state)
return 0; return 0;
} }
/*
-----------------------------------------------------------------------------------
-- set_led
-----------------------------------------------------------------------------------
*/
/* /*
* NOTE: For the power LED, use the LED_POWER_* macros since they differ * 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) ...@@ -203,11 +190,6 @@ static void set_led(struct cardinfo *card, int shift, unsigned char state)
} }
#ifdef MM_DIAG #ifdef MM_DIAG
/*
-----------------------------------------------------------------------------------
-- dump_regs
-----------------------------------------------------------------------------------
*/
static void dump_regs(struct cardinfo *card) static void dump_regs(struct cardinfo *card)
{ {
unsigned char *p; unsigned char *p;
...@@ -224,32 +206,28 @@ static void dump_regs(struct cardinfo *card) ...@@ -224,32 +206,28 @@ static void dump_regs(struct cardinfo *card)
} }
} }
#endif #endif
/*
-----------------------------------------------------------------------------------
-- dump_dmastat
-----------------------------------------------------------------------------------
*/
static void dump_dmastat(struct cardinfo *card, unsigned int dmastat) static void dump_dmastat(struct cardinfo *card, unsigned int dmastat)
{ {
dev_printk(KERN_DEBUG, &card->dev->dev, "DMAstat - "); dev_printk(KERN_DEBUG, &card->dev->dev, "DMAstat - ");
if (dmastat & DMASCR_ANY_ERR) if (dmastat & DMASCR_ANY_ERR)
printk("ANY_ERR "); printk(KERN_CONT "ANY_ERR ");
if (dmastat & DMASCR_MBE_ERR) if (dmastat & DMASCR_MBE_ERR)
printk("MBE_ERR "); printk(KERN_CONT "MBE_ERR ");
if (dmastat & DMASCR_PARITY_ERR_REP) if (dmastat & DMASCR_PARITY_ERR_REP)
printk("PARITY_ERR_REP "); printk(KERN_CONT "PARITY_ERR_REP ");
if (dmastat & DMASCR_PARITY_ERR_DET) if (dmastat & DMASCR_PARITY_ERR_DET)
printk("PARITY_ERR_DET "); printk(KERN_CONT "PARITY_ERR_DET ");
if (dmastat & DMASCR_SYSTEM_ERR_SIG) if (dmastat & DMASCR_SYSTEM_ERR_SIG)
printk("SYSTEM_ERR_SIG "); printk(KERN_CONT "SYSTEM_ERR_SIG ");
if (dmastat & DMASCR_TARGET_ABT) if (dmastat & DMASCR_TARGET_ABT)
printk("TARGET_ABT "); printk(KERN_CONT "TARGET_ABT ");
if (dmastat & DMASCR_MASTER_ABT) if (dmastat & DMASCR_MASTER_ABT)
printk("MASTER_ABT "); printk(KERN_CONT "MASTER_ABT ");
if (dmastat & DMASCR_CHAIN_COMPLETE) if (dmastat & DMASCR_CHAIN_COMPLETE)
printk("CHAIN_COMPLETE "); printk(KERN_CONT "CHAIN_COMPLETE ");
if (dmastat & DMASCR_DMA_COMPLETE) if (dmastat & DMASCR_DMA_COMPLETE)
printk("DMA_COMPLETE "); printk(KERN_CONT "DMA_COMPLETE ");
printk("\n"); printk("\n");
} }
...@@ -286,7 +264,8 @@ static void mm_start_io(struct cardinfo *card) ...@@ -286,7 +264,8 @@ static void mm_start_io(struct cardinfo *card)
/* make the last descriptor end the chain */ /* make the last descriptor end the chain */
page = &card->mm_pages[card->Active]; 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 = &page->desc[page->cnt-1];
desc->control_bits |= cpu_to_le32(DMASCR_CHAIN_COMP_EN); desc->control_bits |= cpu_to_le32(DMASCR_CHAIN_COMP_EN);
...@@ -310,8 +289,8 @@ static void mm_start_io(struct cardinfo *card) ...@@ -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);
writel(0, card->csr_remap + DMA_SEMAPHORE_ADDR + 4); writel(0, card->csr_remap + DMA_SEMAPHORE_ADDR + 4);
offset = ((char*)desc) - ((char*)page->desc); offset = ((char *)desc) - ((char *)page->desc);
writel(cpu_to_le32((page->page_dma+offset)&0xffffffff), writel(cpu_to_le32((page->page_dma+offset) & 0xffffffff),
card->csr_remap + DMA_DESCRIPTOR_ADDR); card->csr_remap + DMA_DESCRIPTOR_ADDR);
/* Force the value to u64 before shifting otherwise >> 32 is undefined C /* Force the value to u64 before shifting otherwise >> 32 is undefined C
* and on some ports will do nothing ! */ * and on some ports will do nothing ! */
...@@ -352,7 +331,7 @@ static inline void reset_page(struct mm_page *page) ...@@ -352,7 +331,7 @@ static inline void reset_page(struct mm_page *page)
page->cnt = 0; page->cnt = 0;
page->headcnt = 0; page->headcnt = 0;
page->bio = NULL; page->bio = NULL;
page->biotail = & page->bio; page->biotail = &page->bio;
} }
static void mm_unplug_device(struct request_queue *q) static void mm_unplug_device(struct request_queue *q)
...@@ -408,7 +387,7 @@ static int add_bio(struct cardinfo *card) ...@@ -408,7 +387,7 @@ static int add_bio(struct cardinfo *card)
vec->bv_page, vec->bv_page,
vec->bv_offset, vec->bv_offset,
len, len,
(rw==READ) ? (rw == READ) ?
PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE); PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE);
p = &card->mm_pages[card->Ready]; p = &card->mm_pages[card->Ready];
...@@ -427,10 +406,10 @@ static int add_bio(struct cardinfo *card) ...@@ -427,10 +406,10 @@ static int add_bio(struct cardinfo *card)
desc->pci_addr = cpu_to_le64((u64)desc->data_dma_handle); desc->pci_addr = cpu_to_le64((u64)desc->data_dma_handle);
desc->local_addr = cpu_to_le64(card->current_sector << 9); desc->local_addr = cpu_to_le64(card->current_sector << 9);
desc->transfer_size = cpu_to_le32(len); 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->sem_addr = cpu_to_le64((u64)(p->page_dma+offset));
desc->zero1 = desc->zero2 = 0; 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->next_desc_addr = cpu_to_le64(p->page_dma+offset);
desc->control_bits = cpu_to_le32(DMASCR_GO|DMASCR_ERR_INT_EN| desc->control_bits = cpu_to_le32(DMASCR_GO|DMASCR_ERR_INT_EN|
DMASCR_PARITY_INT_EN| DMASCR_PARITY_INT_EN|
...@@ -455,11 +434,11 @@ static void process_page(unsigned long data) ...@@ -455,11 +434,11 @@ static void process_page(unsigned long data)
/* check if any of the requests in the page are DMA_COMPLETE, /* check if any of the requests in the page are DMA_COMPLETE,
* and deal with them appropriately. * and deal with them appropriately.
* If we find a descriptor without DMA_COMPLETE in the semaphore, then * 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 * dma must have hit an error on that descriptor, so use dma_status
* and assume that all following descriptors must be re-tried. * instead and assume that all following descriptors must be re-tried.
*/ */
struct mm_page *page; struct mm_page *page;
struct bio *return_bio=NULL; struct bio *return_bio = NULL;
struct cardinfo *card = (struct cardinfo *)data; struct cardinfo *card = (struct cardinfo *)data;
unsigned int dma_status = card->dma_status; unsigned int dma_status = card->dma_status;
...@@ -472,12 +451,12 @@ static void process_page(unsigned long data) ...@@ -472,12 +451,12 @@ static void process_page(unsigned long data)
struct bio *bio = page->bio; struct bio *bio = page->bio;
struct mm_dma_desc *desc = &page->desc[page->headcnt]; struct mm_dma_desc *desc = &page->desc[page->headcnt];
int control = le32_to_cpu(desc->sem_control_bits); int control = le32_to_cpu(desc->sem_control_bits);
int last=0; int last = 0;
int idx; int idx;
if (!(control & DMASCR_DMA_COMPLETE)) { if (!(control & DMASCR_DMA_COMPLETE)) {
control = dma_status; control = dma_status;
last=1; last = 1;
} }
page->headcnt++; page->headcnt++;
idx = page->idx; idx = page->idx;
...@@ -489,8 +468,8 @@ static void process_page(unsigned long data) ...@@ -489,8 +468,8 @@ static void process_page(unsigned long data)
} }
pci_unmap_page(card->dev, desc->data_dma_handle, pci_unmap_page(card->dev, desc->data_dma_handle,
bio_iovec_idx(bio,idx)->bv_len, bio_iovec_idx(bio, idx)->bv_len,
(control& DMASCR_TRANSFER_READ) ? (control & DMASCR_TRANSFER_READ) ?
PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE); PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE);
if (control & DMASCR_HARD_ERROR) { if (control & DMASCR_HARD_ERROR) {
/* error */ /* error */
...@@ -501,9 +480,10 @@ static void process_page(unsigned long data) ...@@ -501,9 +480,10 @@ static void process_page(unsigned long data)
le32_to_cpu(desc->transfer_size)); le32_to_cpu(desc->transfer_size));
dump_dmastat(card, control); dump_dmastat(card, control);
} else if (test_bit(BIO_RW, &bio->bi_rw) && } else if (test_bit(BIO_RW, &bio->bi_rw) &&
le32_to_cpu(desc->local_addr)>>9 == card->init_size) { le32_to_cpu(desc->local_addr) >> 9 ==
card->init_size += le32_to_cpu(desc->transfer_size)>>9; card->init_size) {
if (card->init_size>>1 >= card->mm_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, dev_printk(KERN_INFO, &card->dev->dev,
"memory now initialised\n"); "memory now initialised\n");
set_userbit(card, MEMORY_INITIALIZED, 1); set_userbit(card, MEMORY_INITIALIZED, 1);
...@@ -514,7 +494,8 @@ static void process_page(unsigned long data) ...@@ -514,7 +494,8 @@ static void process_page(unsigned long data)
return_bio = bio; return_bio = bio;
} }
if (last) break; if (last)
break;
} }
if (debug & DEBUG_LED_ON_TRANSFER) if (debug & DEBUG_LED_ON_TRANSFER)
...@@ -536,7 +517,7 @@ static void process_page(unsigned long data) ...@@ -536,7 +517,7 @@ static void process_page(unsigned long data)
out_unlock: out_unlock:
spin_unlock_bh(&card->lock); spin_unlock_bh(&card->lock);
while(return_bio) { while (return_bio) {
struct bio *bio = return_bio; struct bio *bio = return_bio;
return_bio = bio->bi_next; return_bio = bio->bi_next;
...@@ -545,11 +526,6 @@ static void process_page(unsigned long data) ...@@ -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) static int mm_make_request(struct request_queue *q, struct bio *bio)
{ {
struct cardinfo *card = q->queuedata; struct cardinfo *card = q->queuedata;
...@@ -566,11 +542,6 @@ static int mm_make_request(struct request_queue *q, struct bio *bio) ...@@ -566,11 +542,6 @@ static int mm_make_request(struct request_queue *q, struct bio *bio)
return 0; return 0;
} }
/*
-----------------------------------------------------------------------------------
-- mm_interrupt
-----------------------------------------------------------------------------------
*/
static irqreturn_t mm_interrupt(int irq, void *__card) static irqreturn_t mm_interrupt(int irq, void *__card)
{ {
struct cardinfo *card = (struct cardinfo *) __card; struct cardinfo *card = (struct cardinfo *) __card;
...@@ -584,15 +555,15 @@ HW_TRACE(0x30); ...@@ -584,15 +555,15 @@ HW_TRACE(0x30);
if (!(dma_status & (DMASCR_ERROR_MASK | DMASCR_CHAIN_COMPLETE))) { if (!(dma_status & (DMASCR_ERROR_MASK | DMASCR_CHAIN_COMPLETE))) {
/* interrupt wasn't for me ... */ /* interrupt wasn't for me ... */
return IRQ_NONE; return IRQ_NONE;
} }
/* clear COMPLETION interrupts */ /* clear COMPLETION interrupts */
if (card->flags & UM_FLAG_NO_BYTE_STATUS) if (card->flags & UM_FLAG_NO_BYTE_STATUS)
writel(cpu_to_le32(DMASCR_DMA_COMPLETE|DMASCR_CHAIN_COMPLETE), writel(cpu_to_le32(DMASCR_DMA_COMPLETE|DMASCR_CHAIN_COMPLETE),
card->csr_remap+ DMA_STATUS_CTRL); card->csr_remap + DMA_STATUS_CTRL);
else else
writeb((DMASCR_DMA_COMPLETE|DMASCR_CHAIN_COMPLETE) >> 16, 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 */ /* log errors and clear interrupt status */
if (dma_status & DMASCR_ANY_ERR) { if (dma_status & DMASCR_ANY_ERR) {
...@@ -602,9 +573,12 @@ HW_TRACE(0x30); ...@@ -602,9 +573,12 @@ HW_TRACE(0x30);
stat = readb(card->csr_remap + MEMCTRLCMD_ERRSTATUS); stat = readb(card->csr_remap + MEMCTRLCMD_ERRSTATUS);
data_log1 = le32_to_cpu(readl(card->csr_remap + ERROR_DATA_LOG)); data_log1 = le32_to_cpu(readl(card->csr_remap +
data_log2 = le32_to_cpu(readl(card->csr_remap + ERROR_DATA_LOG + 4)); ERROR_DATA_LOG));
addr_log1 = le32_to_cpu(readl(card->csr_remap + ERROR_ADDR_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); addr_log2 = readb(card->csr_remap + ERROR_ADDR_LOG + 4);
count = readb(card->csr_remap + ERROR_COUNT); count = readb(card->csr_remap + ERROR_COUNT);
...@@ -671,11 +645,7 @@ HW_TRACE(0x36); ...@@ -671,11 +645,7 @@ HW_TRACE(0x36);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
/*
-----------------------------------------------------------------------------------
-- set_fault_to_battery_status
-----------------------------------------------------------------------------------
*/
/* /*
* If both batteries are good, no LED * If both batteries are good, no LED
* If either battery has been warned, solid LED * If either battery has been warned, solid LED
...@@ -696,12 +666,6 @@ static void set_fault_to_battery_status(struct cardinfo *card) ...@@ -696,12 +666,6 @@ static void set_fault_to_battery_status(struct cardinfo *card)
static void init_battery_timer(void); static void init_battery_timer(void);
/*
-----------------------------------------------------------------------------------
-- check_battery
-----------------------------------------------------------------------------------
*/
static int check_battery(struct cardinfo *card, int battery, int status) static int check_battery(struct cardinfo *card, int battery, int status)
{ {
if (status != card->battery[battery].good) { if (status != card->battery[battery].good) {
...@@ -730,11 +694,7 @@ static int check_battery(struct cardinfo *card, int battery, int status) ...@@ -730,11 +694,7 @@ static int check_battery(struct cardinfo *card, int battery, int status)
return 0; return 0;
} }
/*
-----------------------------------------------------------------------------------
-- check_batteries
-----------------------------------------------------------------------------------
*/
static void check_batteries(struct cardinfo *card) static void check_batteries(struct cardinfo *card)
{ {
/* NOTE: this must *never* be called while the card /* NOTE: this must *never* be called while the card
...@@ -775,11 +735,7 @@ static void check_all_batteries(unsigned long ptr) ...@@ -775,11 +735,7 @@ static void check_all_batteries(unsigned long ptr)
init_battery_timer(); init_battery_timer();
} }
/*
-----------------------------------------------------------------------------------
-- init_battery_timer
-----------------------------------------------------------------------------------
*/
static void init_battery_timer(void) static void init_battery_timer(void)
{ {
init_timer(&battery_timer); init_timer(&battery_timer);
...@@ -787,20 +743,12 @@ static void init_battery_timer(void) ...@@ -787,20 +743,12 @@ static void init_battery_timer(void)
battery_timer.expires = jiffies + (HZ * 60); battery_timer.expires = jiffies + (HZ * 60);
add_timer(&battery_timer); add_timer(&battery_timer);
} }
/*
-----------------------------------------------------------------------------------
-- del_battery_timer
-----------------------------------------------------------------------------------
*/
static void del_battery_timer(void) static void del_battery_timer(void)
{ {
del_timer(&battery_timer); del_timer(&battery_timer);
} }
/*
-----------------------------------------------------------------------------------
-- mm_revalidate
-----------------------------------------------------------------------------------
*/
/* /*
* Note no locks taken out here. In a worst case scenario, we could drop * 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 * 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,33 +781,23 @@ static int mm_getgeo(struct block_device *bdev, struct hd_geometry *geo)
} }
/* /*
----------------------------------------------------------------------------------- * Future support for removable devices
-- mm_check_change */
-----------------------------------------------------------------------------------
Future support for removable devices
*/
static int mm_check_change(struct gendisk *disk) static int mm_check_change(struct gendisk *disk)
{ {
/* struct cardinfo *dev = disk->private_data; */ /* struct cardinfo *dev = disk->private_data; */
return 0; return 0;
} }
/*
-----------------------------------------------------------------------------------
-- mm_fops
-----------------------------------------------------------------------------------
*/
static struct block_device_operations mm_fops = { static struct block_device_operations mm_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.getgeo = mm_getgeo, .getgeo = mm_getgeo,
.revalidate_disk= mm_revalidate, .revalidate_disk = mm_revalidate,
.media_changed = mm_check_change, .media_changed = mm_check_change,
}; };
/*
----------------------------------------------------------------------------------- static int __devinit mm_pci_probe(struct pci_dev *dev,
-- mm_pci_probe 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; int ret = -ENODEV;
struct cardinfo *card = &cards[num_cards]; 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,7 +827,7 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
return -ENODEV; return -ENODEV;
dev_printk(KERN_INFO, &dev->dev, 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) && if (pci_set_dma_mask(dev, DMA_64BIT_MASK) &&
pci_set_dma_mask(dev, DMA_32BIT_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 ...@@ -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 0x%08lx -> 0x%p (0x%lx)\n",
csr_base, card->csr_remap, csr_len); csr_base, card->csr_remap, csr_len);
switch(card->dev->device) { switch (card->dev->device) {
case 0x5415: case 0x5415:
card->flags |= UM_FLAG_NO_BYTE_STATUS | UM_FLAG_NO_BATTREG; card->flags |= UM_FLAG_NO_BYTE_STATUS | UM_FLAG_NO_BATTREG;
magic_number = 0x59; magic_number = 0x59;
...@@ -929,7 +867,8 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i ...@@ -929,7 +867,8 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
break; break;
case 0x6155: 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; magic_number = 0x99;
break; break;
...@@ -945,11 +884,11 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i ...@@ -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, card->mm_pages[0].desc = pci_alloc_consistent(card->dev,
PAGE_SIZE*2, PAGE_SIZE * 2,
&card->mm_pages[0].page_dma); &card->mm_pages[0].page_dma);
card->mm_pages[1].desc = pci_alloc_consistent(card->dev, card->mm_pages[1].desc = pci_alloc_consistent(card->dev,
PAGE_SIZE*2, PAGE_SIZE * 2,
&card->mm_pages[1].page_dma); &card->mm_pages[1].page_dma);
if (card->mm_pages[0].desc == NULL || if (card->mm_pages[0].desc == NULL ||
card->mm_pages[1].desc == NULL) { card->mm_pages[1].desc == NULL) {
dev_printk(KERN_ERR, &card->dev->dev, "alloc failed\n"); 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,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, dev_printk(KERN_INFO, &card->dev->dev,
"Size %d KB, Battery 1 %s (%s), Battery 2 %s (%s)\n", "Size %d KB, Battery 1 %s (%s), Battery 2 %s (%s)\n",
card->mm_size, card->mm_size,
(batt_status & BATTERY_1_DISABLED ? "Disabled" : "Enabled"), batt_status & BATTERY_1_DISABLED ? "Disabled" : "Enabled",
card->battery[0].good ? "OK" : "FAILURE", 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"); card->battery[1].good ? "OK" : "FAILURE");
set_fault_to_battery_status(card); 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,18 +969,18 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
data = ~data; data = ~data;
data += 1; 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, dev_printk(KERN_ERR, &card->dev->dev,
"Unable to allocate IRQ\n"); "Unable to allocate IRQ\n");
ret = -ENODEV; ret = -ENODEV;
goto failed_req_irq; goto failed_req_irq;
} }
dev_printk(KERN_INFO, &card->dev->dev, dev_printk(KERN_INFO, &card->dev->dev,
"Window size %d bytes, IRQ %d\n", data, dev->irq); "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); pci_set_drvdata(dev, card);
...@@ -1060,7 +999,7 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i ...@@ -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)) { if (!get_userbit(card, MEMORY_INITIALIZED)) {
dev_printk(KERN_INFO, &card->dev->dev, 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; card->init_size = 0;
} else { } else {
dev_printk(KERN_INFO, &card->dev->dev, 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,11 +1030,7 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
return ret; return ret;
} }
/*
-----------------------------------------------------------------------------------
-- mm_pci_remove
-----------------------------------------------------------------------------------
*/
static void mm_pci_remove(struct pci_dev *dev) static void mm_pci_remove(struct pci_dev *dev)
{ {
struct cardinfo *card = pci_get_drvdata(dev); struct cardinfo *card = pci_get_drvdata(dev);
...@@ -1119,16 +1054,16 @@ static void mm_pci_remove(struct pci_dev *dev) ...@@ -1119,16 +1054,16 @@ static void mm_pci_remove(struct pci_dev *dev)
} }
static const struct pci_device_id mm_pci_ids[] = { 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_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_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_6155)},
{ {
.vendor = 0x8086, .vendor = 0x8086,
.device = 0xB555, .device = 0xB555,
.subvendor= 0x1332, .subvendor = 0x1332,
.subdevice= 0x5460, .subdevice = 0x5460,
.class = 0x050000, .class = 0x050000,
.class_mask= 0, .class_mask = 0,
}, { /* end: all zeroes */ } }, { /* end: all zeroes */ }
}; };
...@@ -1141,12 +1076,6 @@ static struct pci_driver mm_pci_driver = { ...@@ -1141,12 +1076,6 @@ static struct pci_driver mm_pci_driver = {
.remove = mm_pci_remove, .remove = mm_pci_remove,
}; };
/*
-----------------------------------------------------------------------------------
-- mm_init
-----------------------------------------------------------------------------------
*/
static int __init mm_init(void) static int __init mm_init(void)
{ {
int retval, i; int retval, i;
...@@ -1193,18 +1122,14 @@ out: ...@@ -1193,18 +1122,14 @@ out:
put_disk(mm_gendisk[i]); put_disk(mm_gendisk[i]);
return -ENOMEM; return -ENOMEM;
} }
/*
-----------------------------------------------------------------------------------
-- mm_cleanup
-----------------------------------------------------------------------------------
*/
static void __exit mm_cleanup(void) static void __exit mm_cleanup(void)
{ {
int i; int i;
del_battery_timer(); del_battery_timer();
for (i=0; i < num_cards ; i++) { for (i = 0; i < num_cards ; i++) {
del_gendisk(mm_gendisk[i]); del_gendisk(mm_gendisk[i]);
put_disk(mm_gendisk[i]); put_disk(mm_gendisk[i]);
} }
......
...@@ -119,7 +119,7 @@ extern void elv_put_request(struct request_queue *, struct request *); ...@@ -119,7 +119,7 @@ extern void elv_put_request(struct request_queue *, struct request *);
/* /*
* io scheduler registration * io scheduler registration
*/ */
extern int elv_register(struct elevator_type *); extern void elv_register(struct elevator_type *);
extern void elv_unregister(struct elevator_type *); extern void elv_unregister(struct elevator_type *);
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment