diff options
author | Philip J Kelleher <pjk1939@linux.vnet.ibm.com> | 2013-02-18 15:35:59 -0500 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2013-02-18 15:35:59 -0500 |
commit | c206c70924737db6836382c09ad2dacd04bb6204 (patch) | |
tree | 31a9ebc3e0998f19db1537d45617ad13363dcef5 | |
parent | ec8edc764efa51e5acf9193a8846a5a99399ceb8 (diff) |
block: IBM RamSan 70/80 driver fixes
This patch includes the following driver fixes for the
IBM RamSan 70/80 driver:
o Changed the creg_ctrl lock from a mutex to a spinlock.
o Added a count check for ioctl calls.
o Removed unnecessary casting of void pointers.
o Made every function static that needed to be.
o Added comments to explain things more thoroughly.
Signed-off-by: Philip J Kelleher <pjk1939@linux.vnet.ibm.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | drivers/block/rsxx/config.c | 4 | ||||
-rw-r--r-- | drivers/block/rsxx/core.c | 44 | ||||
-rw-r--r-- | drivers/block/rsxx/cregs.c | 59 | ||||
-rw-r--r-- | drivers/block/rsxx/dev.c | 2 | ||||
-rw-r--r-- | drivers/block/rsxx/dma.c | 10 | ||||
-rw-r--r-- | drivers/block/rsxx/rsxx.h | 2 | ||||
-rw-r--r-- | drivers/block/rsxx/rsxx_priv.h | 11 |
7 files changed, 69 insertions, 63 deletions
diff --git a/drivers/block/rsxx/config.c b/drivers/block/rsxx/config.c index c8829cd4db11..a295e7e9ee41 100644 --- a/drivers/block/rsxx/config.c +++ b/drivers/block/rsxx/config.c | |||
@@ -31,7 +31,7 @@ | |||
31 | 31 | ||
32 | static void initialize_config(void *config) | 32 | static void initialize_config(void *config) |
33 | { | 33 | { |
34 | struct rsxx_card_cfg *cfg = (struct rsxx_card_cfg *) config; | 34 | struct rsxx_card_cfg *cfg = config; |
35 | 35 | ||
36 | cfg->hdr.version = RSXX_CFG_VERSION; | 36 | cfg->hdr.version = RSXX_CFG_VERSION; |
37 | 37 | ||
@@ -97,7 +97,7 @@ static void config_data_cpu_to_le(struct rsxx_card_cfg *cfg) | |||
97 | 97 | ||
98 | 98 | ||
99 | /*----------------- Config Operations ------------------*/ | 99 | /*----------------- Config Operations ------------------*/ |
100 | int rsxx_save_config(struct rsxx_cardinfo *card) | 100 | static int rsxx_save_config(struct rsxx_cardinfo *card) |
101 | { | 101 | { |
102 | struct rsxx_card_cfg cfg; | 102 | struct rsxx_card_cfg cfg; |
103 | int st; | 103 | int st; |
diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c index 83dadbee0375..e5162487686a 100644 --- a/drivers/block/rsxx/core.c +++ b/drivers/block/rsxx/core.c | |||
@@ -102,9 +102,9 @@ void rsxx_disable_ier_and_isr(struct rsxx_cardinfo *card, | |||
102 | iowrite32(card->ier_mask, card->regmap + IER); | 102 | iowrite32(card->ier_mask, card->regmap + IER); |
103 | } | 103 | } |
104 | 104 | ||
105 | irqreturn_t rsxx_isr(int irq, void *pdata) | 105 | static irqreturn_t rsxx_isr(int irq, void *pdata) |
106 | { | 106 | { |
107 | struct rsxx_cardinfo *card = (struct rsxx_cardinfo *) pdata; | 107 | struct rsxx_cardinfo *card = pdata; |
108 | unsigned int isr; | 108 | unsigned int isr; |
109 | int handled = 0; | 109 | int handled = 0; |
110 | int reread_isr; | 110 | int reread_isr; |
@@ -161,6 +161,17 @@ irqreturn_t rsxx_isr(int irq, void *pdata) | |||
161 | } | 161 | } |
162 | 162 | ||
163 | /*----------------- Card Event Handler -------------------*/ | 163 | /*----------------- Card Event Handler -------------------*/ |
164 | static char *rsxx_card_state_to_str(unsigned int state) | ||
165 | { | ||
166 | static char *state_strings[] = { | ||
167 | "Unknown", "Shutdown", "Starting", "Formatting", | ||
168 | "Uninitialized", "Good", "Shutting Down", | ||
169 | "Fault", "Read Only Fault", "dStroying" | ||
170 | }; | ||
171 | |||
172 | return state_strings[ffs(state)]; | ||
173 | } | ||
174 | |||
164 | static void card_state_change(struct rsxx_cardinfo *card, | 175 | static void card_state_change(struct rsxx_cardinfo *card, |
165 | unsigned int new_state) | 176 | unsigned int new_state) |
166 | { | 177 | { |
@@ -251,18 +262,6 @@ static void card_event_handler(struct work_struct *work) | |||
251 | rsxx_read_hw_log(card); | 262 | rsxx_read_hw_log(card); |
252 | } | 263 | } |
253 | 264 | ||
254 | |||
255 | char *rsxx_card_state_to_str(unsigned int state) | ||
256 | { | ||
257 | static char *state_strings[] = { | ||
258 | "Unknown", "Shutdown", "Starting", "Formatting", | ||
259 | "Uninitialized", "Good", "Shutting Down", | ||
260 | "Fault", "Read Only Fault", "dStroying" | ||
261 | }; | ||
262 | |||
263 | return state_strings[ffs(state)]; | ||
264 | } | ||
265 | |||
266 | /*----------------- Card Operations -------------------*/ | 265 | /*----------------- Card Operations -------------------*/ |
267 | static int card_shutdown(struct rsxx_cardinfo *card) | 266 | static int card_shutdown(struct rsxx_cardinfo *card) |
268 | { | 267 | { |
@@ -323,7 +322,6 @@ static int rsxx_pci_probe(struct pci_dev *dev, | |||
323 | const struct pci_device_id *id) | 322 | const struct pci_device_id *id) |
324 | { | 323 | { |
325 | struct rsxx_cardinfo *card; | 324 | struct rsxx_cardinfo *card; |
326 | unsigned long flags; | ||
327 | int st; | 325 | int st; |
328 | 326 | ||
329 | dev_info(&dev->dev, "PCI-Flash SSD discovered\n"); | 327 | dev_info(&dev->dev, "PCI-Flash SSD discovered\n"); |
@@ -386,9 +384,9 @@ static int rsxx_pci_probe(struct pci_dev *dev, | |||
386 | spin_lock_init(&card->irq_lock); | 384 | spin_lock_init(&card->irq_lock); |
387 | card->halt = 0; | 385 | card->halt = 0; |
388 | 386 | ||
389 | spin_lock_irqsave(&card->irq_lock, flags); | 387 | spin_lock_irq(&card->irq_lock); |
390 | rsxx_disable_ier_and_isr(card, CR_INTR_ALL); | 388 | rsxx_disable_ier_and_isr(card, CR_INTR_ALL); |
391 | spin_unlock_irqrestore(&card->irq_lock, flags); | 389 | spin_unlock_irq(&card->irq_lock); |
392 | 390 | ||
393 | if (!force_legacy) { | 391 | if (!force_legacy) { |
394 | st = pci_enable_msi(dev); | 392 | st = pci_enable_msi(dev); |
@@ -408,9 +406,9 @@ static int rsxx_pci_probe(struct pci_dev *dev, | |||
408 | /************* Setup Processor Command Interface *************/ | 406 | /************* Setup Processor Command Interface *************/ |
409 | rsxx_creg_setup(card); | 407 | rsxx_creg_setup(card); |
410 | 408 | ||
411 | spin_lock_irqsave(&card->irq_lock, flags); | 409 | spin_lock_irq(&card->irq_lock); |
412 | rsxx_enable_ier_and_isr(card, CR_INTR_CREG); | 410 | rsxx_enable_ier_and_isr(card, CR_INTR_CREG); |
413 | spin_unlock_irqrestore(&card->irq_lock, flags); | 411 | spin_unlock_irq(&card->irq_lock); |
414 | 412 | ||
415 | st = rsxx_compatibility_check(card); | 413 | st = rsxx_compatibility_check(card); |
416 | if (st) { | 414 | if (st) { |
@@ -463,9 +461,9 @@ static int rsxx_pci_probe(struct pci_dev *dev, | |||
463 | * we can enable the event interrupt(it kicks off actions in | 461 | * we can enable the event interrupt(it kicks off actions in |
464 | * those layers so we couldn't enable it right away.) | 462 | * those layers so we couldn't enable it right away.) |
465 | */ | 463 | */ |
466 | spin_lock_irqsave(&card->irq_lock, flags); | 464 | spin_lock_irq(&card->irq_lock); |
467 | rsxx_enable_ier_and_isr(card, CR_INTR_EVENT); | 465 | rsxx_enable_ier_and_isr(card, CR_INTR_EVENT); |
468 | spin_unlock_irqrestore(&card->irq_lock, flags); | 466 | spin_unlock_irq(&card->irq_lock); |
469 | 467 | ||
470 | if (card->state == CARD_STATE_SHUTDOWN) { | 468 | if (card->state == CARD_STATE_SHUTDOWN) { |
471 | st = rsxx_issue_card_cmd(card, CARD_CMD_STARTUP); | 469 | st = rsxx_issue_card_cmd(card, CARD_CMD_STARTUP); |
@@ -487,9 +485,9 @@ failed_create_dev: | |||
487 | rsxx_dma_destroy(card); | 485 | rsxx_dma_destroy(card); |
488 | failed_dma_setup: | 486 | failed_dma_setup: |
489 | failed_compatiblity_check: | 487 | failed_compatiblity_check: |
490 | spin_lock_irqsave(&card->irq_lock, flags); | 488 | spin_lock_irq(&card->irq_lock); |
491 | rsxx_disable_ier_and_isr(card, CR_INTR_ALL); | 489 | rsxx_disable_ier_and_isr(card, CR_INTR_ALL); |
492 | spin_unlock_irqrestore(&card->irq_lock, flags); | 490 | spin_unlock_irq(&card->irq_lock); |
493 | free_irq(dev->irq, card); | 491 | free_irq(dev->irq, card); |
494 | if (!force_legacy) | 492 | if (!force_legacy) |
495 | pci_disable_msi(dev); | 493 | pci_disable_msi(dev); |
diff --git a/drivers/block/rsxx/cregs.c b/drivers/block/rsxx/cregs.c index a31fd727e804..80bbe639fccd 100644 --- a/drivers/block/rsxx/cregs.c +++ b/drivers/block/rsxx/cregs.c | |||
@@ -107,10 +107,10 @@ static struct creg_cmd *pop_active_cmd(struct rsxx_cardinfo *card) | |||
107 | * Spin lock is needed because this can be called in atomic/interrupt | 107 | * Spin lock is needed because this can be called in atomic/interrupt |
108 | * context. | 108 | * context. |
109 | */ | 109 | */ |
110 | spin_lock_bh(&card->creg_ctrl.pop_lock); | 110 | spin_lock_bh(&card->creg_ctrl.lock); |
111 | cmd = card->creg_ctrl.active_cmd; | 111 | cmd = card->creg_ctrl.active_cmd; |
112 | card->creg_ctrl.active_cmd = NULL; | 112 | card->creg_ctrl.active_cmd = NULL; |
113 | spin_unlock_bh(&card->creg_ctrl.pop_lock); | 113 | spin_unlock_bh(&card->creg_ctrl.lock); |
114 | 114 | ||
115 | return cmd; | 115 | return cmd; |
116 | } | 116 | } |
@@ -126,7 +126,11 @@ static void creg_issue_cmd(struct rsxx_cardinfo *card, struct creg_cmd *cmd) | |||
126 | cmd->buf, cmd->stream); | 126 | cmd->buf, cmd->stream); |
127 | } | 127 | } |
128 | 128 | ||
129 | /* Data copy must complete before initiating the command. */ | 129 | /* |
130 | * Data copy must complete before initiating the command. This is | ||
131 | * needed for weakly ordered processors (i.e. PowerPC), so that all | ||
132 | * neccessary registers are written before we kick the hardware. | ||
133 | */ | ||
130 | wmb(); | 134 | wmb(); |
131 | 135 | ||
132 | /* Setting the valid bit will kick off the command. */ | 136 | /* Setting the valid bit will kick off the command. */ |
@@ -192,11 +196,11 @@ static int creg_queue_cmd(struct rsxx_cardinfo *card, | |||
192 | cmd->cb_private = cb_private; | 196 | cmd->cb_private = cb_private; |
193 | cmd->status = 0; | 197 | cmd->status = 0; |
194 | 198 | ||
195 | mutex_lock(&card->creg_ctrl.lock); | 199 | spin_lock(&card->creg_ctrl.lock); |
196 | list_add_tail(&cmd->list, &card->creg_ctrl.queue); | 200 | list_add_tail(&cmd->list, &card->creg_ctrl.queue); |
197 | card->creg_ctrl.q_depth++; | 201 | card->creg_ctrl.q_depth++; |
198 | creg_kick_queue(card); | 202 | creg_kick_queue(card); |
199 | mutex_unlock(&card->creg_ctrl.lock); | 203 | spin_unlock(&card->creg_ctrl.lock); |
200 | 204 | ||
201 | return 0; | 205 | return 0; |
202 | } | 206 | } |
@@ -219,10 +223,11 @@ static void creg_cmd_timed_out(unsigned long data) | |||
219 | 223 | ||
220 | kmem_cache_free(creg_cmd_pool, cmd); | 224 | kmem_cache_free(creg_cmd_pool, cmd); |
221 | 225 | ||
222 | spin_lock(&card->creg_ctrl.pop_lock); | 226 | |
227 | spin_lock(&card->creg_ctrl.lock); | ||
223 | card->creg_ctrl.active = 0; | 228 | card->creg_ctrl.active = 0; |
224 | creg_kick_queue(card); | 229 | creg_kick_queue(card); |
225 | spin_unlock(&card->creg_ctrl.pop_lock); | 230 | spin_unlock(&card->creg_ctrl.lock); |
226 | } | 231 | } |
227 | 232 | ||
228 | 233 | ||
@@ -291,10 +296,10 @@ creg_done: | |||
291 | 296 | ||
292 | kmem_cache_free(creg_cmd_pool, cmd); | 297 | kmem_cache_free(creg_cmd_pool, cmd); |
293 | 298 | ||
294 | mutex_lock(&card->creg_ctrl.lock); | 299 | spin_lock(&card->creg_ctrl.lock); |
295 | card->creg_ctrl.active = 0; | 300 | card->creg_ctrl.active = 0; |
296 | creg_kick_queue(card); | 301 | creg_kick_queue(card); |
297 | mutex_unlock(&card->creg_ctrl.lock); | 302 | spin_unlock(&card->creg_ctrl.lock); |
298 | } | 303 | } |
299 | 304 | ||
300 | static void creg_reset(struct rsxx_cardinfo *card) | 305 | static void creg_reset(struct rsxx_cardinfo *card) |
@@ -303,6 +308,10 @@ static void creg_reset(struct rsxx_cardinfo *card) | |||
303 | struct creg_cmd *tmp; | 308 | struct creg_cmd *tmp; |
304 | unsigned long flags; | 309 | unsigned long flags; |
305 | 310 | ||
311 | /* | ||
312 | * mutex_trylock is used here because if reset_lock is taken then a | ||
313 | * reset is already happening. So, we can just go ahead and return. | ||
314 | */ | ||
306 | if (!mutex_trylock(&card->creg_ctrl.reset_lock)) | 315 | if (!mutex_trylock(&card->creg_ctrl.reset_lock)) |
307 | return; | 316 | return; |
308 | 317 | ||
@@ -315,7 +324,7 @@ static void creg_reset(struct rsxx_cardinfo *card) | |||
315 | "Resetting creg interface for recovery\n"); | 324 | "Resetting creg interface for recovery\n"); |
316 | 325 | ||
317 | /* Cancel outstanding commands */ | 326 | /* Cancel outstanding commands */ |
318 | mutex_lock(&card->creg_ctrl.lock); | 327 | spin_lock(&card->creg_ctrl.lock); |
319 | list_for_each_entry_safe(cmd, tmp, &card->creg_ctrl.queue, list) { | 328 | list_for_each_entry_safe(cmd, tmp, &card->creg_ctrl.queue, list) { |
320 | list_del(&cmd->list); | 329 | list_del(&cmd->list); |
321 | card->creg_ctrl.q_depth--; | 330 | card->creg_ctrl.q_depth--; |
@@ -336,7 +345,7 @@ static void creg_reset(struct rsxx_cardinfo *card) | |||
336 | 345 | ||
337 | card->creg_ctrl.active = 0; | 346 | card->creg_ctrl.active = 0; |
338 | } | 347 | } |
339 | mutex_unlock(&card->creg_ctrl.lock); | 348 | spin_unlock(&card->creg_ctrl.lock); |
340 | 349 | ||
341 | card->creg_ctrl.reset = 0; | 350 | card->creg_ctrl.reset = 0; |
342 | spin_lock_irqsave(&card->irq_lock, flags); | 351 | spin_lock_irqsave(&card->irq_lock, flags); |
@@ -359,7 +368,7 @@ static void creg_cmd_done_cb(struct rsxx_cardinfo *card, | |||
359 | { | 368 | { |
360 | struct creg_completion *cmd_completion; | 369 | struct creg_completion *cmd_completion; |
361 | 370 | ||
362 | cmd_completion = (struct creg_completion *)cmd->cb_private; | 371 | cmd_completion = cmd->cb_private; |
363 | BUG_ON(!cmd_completion); | 372 | BUG_ON(!cmd_completion); |
364 | 373 | ||
365 | cmd_completion->st = st; | 374 | cmd_completion->st = st; |
@@ -380,7 +389,6 @@ static int __issue_creg_rw(struct rsxx_cardinfo *card, | |||
380 | unsigned long timeout; | 389 | unsigned long timeout; |
381 | int st; | 390 | int st; |
382 | 391 | ||
383 | INIT_COMPLETION(cmd_done); | ||
384 | completion.cmd_done = &cmd_done; | 392 | completion.cmd_done = &cmd_done; |
385 | completion.st = 0; | 393 | completion.st = 0; |
386 | completion.creg_status = 0; | 394 | completion.creg_status = 0; |
@@ -390,8 +398,13 @@ static int __issue_creg_rw(struct rsxx_cardinfo *card, | |||
390 | if (st) | 398 | if (st) |
391 | return st; | 399 | return st; |
392 | 400 | ||
401 | /* | ||
402 | * This timeout is neccessary for unresponsive hardware. The additional | ||
403 | * 20 seconds to used to guarantee that each cregs requests has time to | ||
404 | * complete. | ||
405 | */ | ||
393 | timeout = msecs_to_jiffies((CREG_TIMEOUT_MSEC * | 406 | timeout = msecs_to_jiffies((CREG_TIMEOUT_MSEC * |
394 | card->creg_ctrl.q_depth) + 20000); | 407 | card->creg_ctrl.q_depth) + 20000); |
395 | 408 | ||
396 | /* | 409 | /* |
397 | * The creg interface is guaranteed to complete. It has a timeout | 410 | * The creg interface is guaranteed to complete. It has a timeout |
@@ -443,7 +456,7 @@ static int issue_creg_rw(struct rsxx_cardinfo *card, | |||
443 | if (st) | 456 | if (st) |
444 | return st; | 457 | return st; |
445 | 458 | ||
446 | data = (void *)((char *)data + xfer); | 459 | data = (char *)data + xfer; |
447 | addr += xfer; | 460 | addr += xfer; |
448 | size8 -= xfer; | 461 | size8 -= xfer; |
449 | } while (size8); | 462 | } while (size8); |
@@ -558,9 +571,9 @@ static void hw_log_msg(struct rsxx_cardinfo *card, const char *str, int len) | |||
558 | } | 571 | } |
559 | 572 | ||
560 | /* | 573 | /* |
561 | * The substrncpy() function copies to string(up to count bytes) point to by src | 574 | * The substrncpy function copies the src string (which includes the |
562 | * (including the terminating '\0' character) to dest. Returns the number of | 575 | * terminating '\0' character), up to the count into the dest pointer. |
563 | * bytes copied to dest. | 576 | * Returns the number of bytes copied to dest. |
564 | */ | 577 | */ |
565 | static int substrncpy(char *dest, const char *src, int count) | 578 | static int substrncpy(char *dest, const char *src, int count) |
566 | { | 579 | { |
@@ -657,6 +670,9 @@ int rsxx_reg_access(struct rsxx_cardinfo *card, | |||
657 | if (st) | 670 | if (st) |
658 | return -EFAULT; | 671 | return -EFAULT; |
659 | 672 | ||
673 | if (cmd.cnt > RSXX_MAX_REG_CNT) | ||
674 | return -EFAULT; | ||
675 | |||
660 | st = issue_reg_cmd(card, &cmd, read); | 676 | st = issue_reg_cmd(card, &cmd, read); |
661 | if (st) | 677 | if (st) |
662 | return st; | 678 | return st; |
@@ -682,8 +698,7 @@ int rsxx_creg_setup(struct rsxx_cardinfo *card) | |||
682 | INIT_WORK(&card->creg_ctrl.done_work, creg_cmd_done); | 698 | INIT_WORK(&card->creg_ctrl.done_work, creg_cmd_done); |
683 | mutex_init(&card->creg_ctrl.reset_lock); | 699 | mutex_init(&card->creg_ctrl.reset_lock); |
684 | INIT_LIST_HEAD(&card->creg_ctrl.queue); | 700 | INIT_LIST_HEAD(&card->creg_ctrl.queue); |
685 | mutex_init(&card->creg_ctrl.lock); | 701 | spin_lock_init(&card->creg_ctrl.lock); |
686 | spin_lock_init(&card->creg_ctrl.pop_lock); | ||
687 | setup_timer(&card->creg_ctrl.cmd_timer, creg_cmd_timed_out, | 702 | setup_timer(&card->creg_ctrl.cmd_timer, creg_cmd_timed_out, |
688 | (unsigned long) card); | 703 | (unsigned long) card); |
689 | 704 | ||
@@ -697,7 +712,7 @@ void rsxx_creg_destroy(struct rsxx_cardinfo *card) | |||
697 | int cnt = 0; | 712 | int cnt = 0; |
698 | 713 | ||
699 | /* Cancel outstanding commands */ | 714 | /* Cancel outstanding commands */ |
700 | mutex_lock(&card->creg_ctrl.lock); | 715 | spin_lock(&card->creg_ctrl.lock); |
701 | list_for_each_entry_safe(cmd, tmp, &card->creg_ctrl.queue, list) { | 716 | list_for_each_entry_safe(cmd, tmp, &card->creg_ctrl.queue, list) { |
702 | list_del(&cmd->list); | 717 | list_del(&cmd->list); |
703 | if (cmd->cb) | 718 | if (cmd->cb) |
@@ -722,7 +737,7 @@ void rsxx_creg_destroy(struct rsxx_cardinfo *card) | |||
722 | "Canceled active creg command\n"); | 737 | "Canceled active creg command\n"); |
723 | kmem_cache_free(creg_cmd_pool, cmd); | 738 | kmem_cache_free(creg_cmd_pool, cmd); |
724 | } | 739 | } |
725 | mutex_unlock(&card->creg_ctrl.lock); | 740 | spin_unlock(&card->creg_ctrl.lock); |
726 | 741 | ||
727 | cancel_work_sync(&card->creg_ctrl.done_work); | 742 | cancel_work_sync(&card->creg_ctrl.done_work); |
728 | } | 743 | } |
diff --git a/drivers/block/rsxx/dev.c b/drivers/block/rsxx/dev.c index 96df053e0ed4..4346d17d2949 100644 --- a/drivers/block/rsxx/dev.c +++ b/drivers/block/rsxx/dev.c | |||
@@ -149,7 +149,7 @@ static void bio_dma_done_cb(struct rsxx_cardinfo *card, | |||
149 | void *cb_data, | 149 | void *cb_data, |
150 | unsigned int error) | 150 | unsigned int error) |
151 | { | 151 | { |
152 | struct rsxx_bio_meta *meta = (struct rsxx_bio_meta *)cb_data; | 152 | struct rsxx_bio_meta *meta = cb_data; |
153 | 153 | ||
154 | if (error) | 154 | if (error) |
155 | atomic_set(&meta->error, 1); | 155 | atomic_set(&meta->error, 1); |
diff --git a/drivers/block/rsxx/dma.c b/drivers/block/rsxx/dma.c index 872f50358624..63176e67662f 100644 --- a/drivers/block/rsxx/dma.c +++ b/drivers/block/rsxx/dma.c | |||
@@ -102,7 +102,7 @@ struct dma_tracker_list { | |||
102 | 102 | ||
103 | 103 | ||
104 | /*----------------- Misc Utility Functions -------------------*/ | 104 | /*----------------- Misc Utility Functions -------------------*/ |
105 | unsigned int rsxx_addr8_to_laddr(u64 addr8, struct rsxx_cardinfo *card) | 105 | static unsigned int rsxx_addr8_to_laddr(u64 addr8, struct rsxx_cardinfo *card) |
106 | { | 106 | { |
107 | unsigned long long tgt_addr8; | 107 | unsigned long long tgt_addr8; |
108 | 108 | ||
@@ -113,7 +113,7 @@ unsigned int rsxx_addr8_to_laddr(u64 addr8, struct rsxx_cardinfo *card) | |||
113 | return tgt_addr8; | 113 | return tgt_addr8; |
114 | } | 114 | } |
115 | 115 | ||
116 | unsigned int rsxx_get_dma_tgt(struct rsxx_cardinfo *card, u64 addr8) | 116 | static unsigned int rsxx_get_dma_tgt(struct rsxx_cardinfo *card, u64 addr8) |
117 | { | 117 | { |
118 | unsigned int tgt; | 118 | unsigned int tgt; |
119 | 119 | ||
@@ -757,7 +757,7 @@ static int rsxx_dma_ctrl_init(struct pci_dev *dev, | |||
757 | INIT_LIST_HEAD(&ctrl->queue); | 757 | INIT_LIST_HEAD(&ctrl->queue); |
758 | 758 | ||
759 | setup_timer(&ctrl->activity_timer, dma_engine_stalled, | 759 | setup_timer(&ctrl->activity_timer, dma_engine_stalled, |
760 | (unsigned long)ctrl); | 760 | (unsigned long)ctrl); |
761 | 761 | ||
762 | ctrl->issue_wq = alloc_ordered_workqueue(DRIVER_NAME"_issue", 0); | 762 | ctrl->issue_wq = alloc_ordered_workqueue(DRIVER_NAME"_issue", 0); |
763 | if (!ctrl->issue_wq) | 763 | if (!ctrl->issue_wq) |
@@ -803,7 +803,7 @@ static int rsxx_dma_ctrl_init(struct pci_dev *dev, | |||
803 | return 0; | 803 | return 0; |
804 | } | 804 | } |
805 | 805 | ||
806 | int rsxx_dma_stripe_setup(struct rsxx_cardinfo *card, | 806 | static int rsxx_dma_stripe_setup(struct rsxx_cardinfo *card, |
807 | unsigned int stripe_size8) | 807 | unsigned int stripe_size8) |
808 | { | 808 | { |
809 | if (!is_power_of_2(stripe_size8)) { | 809 | if (!is_power_of_2(stripe_size8)) { |
@@ -834,7 +834,7 @@ int rsxx_dma_stripe_setup(struct rsxx_cardinfo *card, | |||
834 | return 0; | 834 | return 0; |
835 | } | 835 | } |
836 | 836 | ||
837 | int rsxx_dma_configure(struct rsxx_cardinfo *card) | 837 | static int rsxx_dma_configure(struct rsxx_cardinfo *card) |
838 | { | 838 | { |
839 | u32 intr_coal; | 839 | u32 intr_coal; |
840 | 840 | ||
diff --git a/drivers/block/rsxx/rsxx.h b/drivers/block/rsxx/rsxx.h index 9581e136a042..2e50b65902b7 100644 --- a/drivers/block/rsxx/rsxx.h +++ b/drivers/block/rsxx/rsxx.h | |||
@@ -35,6 +35,8 @@ struct rsxx_reg_access { | |||
35 | __u32 data[8]; | 35 | __u32 data[8]; |
36 | }; | 36 | }; |
37 | 37 | ||
38 | #define RSXX_MAX_REG_CNT (8 * (sizeof(__u32))) | ||
39 | |||
38 | #define RSXX_IOC_MAGIC 'r' | 40 | #define RSXX_IOC_MAGIC 'r' |
39 | 41 | ||
40 | #define RSXX_GETREG _IOWR(RSXX_IOC_MAGIC, 0x20, struct rsxx_reg_access) | 42 | #define RSXX_GETREG _IOWR(RSXX_IOC_MAGIC, 0x20, struct rsxx_reg_access) |
diff --git a/drivers/block/rsxx/rsxx_priv.h b/drivers/block/rsxx/rsxx_priv.h index 3887e496f54b..a1ac907d8f4c 100644 --- a/drivers/block/rsxx/rsxx_priv.h +++ b/drivers/block/rsxx/rsxx_priv.h | |||
@@ -127,7 +127,7 @@ struct rsxx_cardinfo { | |||
127 | 127 | ||
128 | /* Embedded CPU Communication */ | 128 | /* Embedded CPU Communication */ |
129 | struct { | 129 | struct { |
130 | struct mutex lock; | 130 | spinlock_t lock; |
131 | bool active; | 131 | bool active; |
132 | struct creg_cmd *active_cmd; | 132 | struct creg_cmd *active_cmd; |
133 | struct work_struct done_work; | 133 | struct work_struct done_work; |
@@ -141,7 +141,6 @@ struct rsxx_cardinfo { | |||
141 | } creg_stats; | 141 | } creg_stats; |
142 | struct timer_list cmd_timer; | 142 | struct timer_list cmd_timer; |
143 | struct mutex reset_lock; | 143 | struct mutex reset_lock; |
144 | spinlock_t pop_lock; | ||
145 | int reset; | 144 | int reset; |
146 | } creg_ctrl; | 145 | } creg_ctrl; |
147 | 146 | ||
@@ -336,7 +335,6 @@ static inline unsigned int CREG_DATA(int N) | |||
336 | 335 | ||
337 | /***** config.c *****/ | 336 | /***** config.c *****/ |
338 | int rsxx_load_config(struct rsxx_cardinfo *card); | 337 | int rsxx_load_config(struct rsxx_cardinfo *card); |
339 | int rsxx_save_config(struct rsxx_cardinfo *card); | ||
340 | 338 | ||
341 | /***** core.c *****/ | 339 | /***** core.c *****/ |
342 | void rsxx_enable_ier(struct rsxx_cardinfo *card, unsigned int intr); | 340 | void rsxx_enable_ier(struct rsxx_cardinfo *card, unsigned int intr); |
@@ -345,8 +343,6 @@ void rsxx_enable_ier_and_isr(struct rsxx_cardinfo *card, | |||
345 | unsigned int intr); | 343 | unsigned int intr); |
346 | void rsxx_disable_ier_and_isr(struct rsxx_cardinfo *card, | 344 | void rsxx_disable_ier_and_isr(struct rsxx_cardinfo *card, |
347 | unsigned int intr); | 345 | unsigned int intr); |
348 | char *rsxx_card_state_to_str(unsigned int state); | ||
349 | irqreturn_t rsxx_isr(int irq, void *pdata); | ||
350 | 346 | ||
351 | /***** dev.c *****/ | 347 | /***** dev.c *****/ |
352 | int rsxx_attach_dev(struct rsxx_cardinfo *card); | 348 | int rsxx_attach_dev(struct rsxx_cardinfo *card); |
@@ -364,16 +360,11 @@ int rsxx_dma_setup(struct rsxx_cardinfo *card); | |||
364 | void rsxx_dma_destroy(struct rsxx_cardinfo *card); | 360 | void rsxx_dma_destroy(struct rsxx_cardinfo *card); |
365 | int rsxx_dma_init(void); | 361 | int rsxx_dma_init(void); |
366 | void rsxx_dma_cleanup(void); | 362 | void rsxx_dma_cleanup(void); |
367 | int rsxx_dma_configure(struct rsxx_cardinfo *card); | ||
368 | int rsxx_dma_queue_bio(struct rsxx_cardinfo *card, | 363 | int rsxx_dma_queue_bio(struct rsxx_cardinfo *card, |
369 | struct bio *bio, | 364 | struct bio *bio, |
370 | atomic_t *n_dmas, | 365 | atomic_t *n_dmas, |
371 | rsxx_dma_cb cb, | 366 | rsxx_dma_cb cb, |
372 | void *cb_data); | 367 | void *cb_data); |
373 | int rsxx_dma_stripe_setup(struct rsxx_cardinfo *card, | ||
374 | unsigned int stripe_size8); | ||
375 | unsigned int rsxx_get_dma_tgt(struct rsxx_cardinfo *card, u64 addr8); | ||
376 | unsigned int rsxx_addr8_to_laddr(u64 addr8, struct rsxx_cardinfo *card); | ||
377 | 368 | ||
378 | /***** cregs.c *****/ | 369 | /***** cregs.c *****/ |
379 | int rsxx_creg_write(struct rsxx_cardinfo *card, u32 addr, | 370 | int rsxx_creg_write(struct rsxx_cardinfo *card, u32 addr, |