aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-taskfile.c
diff options
context:
space:
mode:
authorJaswinder Singh Rajput <jaswinderrajput@gmail.com>2009-08-02 23:17:34 -0400
committerDavid S. Miller <davem@davemloft.net>2009-08-07 13:42:59 -0400
commit2d5abcedeb41f4af9582c60cef70749c3ab90a3b (patch)
tree6adc51ab246ed6a9958ee6dd978f174868f4a164 /drivers/ide/ide-taskfile.c
parent72db37b2c9c5b71e49068f5fac6433a6c36498a5 (diff)
ide: ide-taskfile.c fix style problems
Fix trivial style problems: WARNING: Use #include <linux/uaccess.h> instead of <asm/uaccess.h> WARNING: space prohibited between function name and open parenthesis '(' WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable ERROR: do not use C99 // comments X 2 ERROR: trailing statements should be on next line ERROR: trailing whitespace ERROR: switch and case should be at the same indent WARNING: line over 80 characters total: 5 errors, 4 warnings Also removed dead code Also used pr_err() to avoid line breaks Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com> Acked-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/ide/ide-taskfile.c')
-rw-r--r--drivers/ide/ide-taskfile.c109
1 files changed, 51 insertions, 58 deletions
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 3a5224cbd0f2..50336d51eebc 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -19,8 +19,8 @@
19#include <linux/hdreg.h> 19#include <linux/hdreg.h>
20#include <linux/ide.h> 20#include <linux/ide.h>
21#include <linux/scatterlist.h> 21#include <linux/scatterlist.h>
22#include <linux/uaccess.h>
22 23
23#include <asm/uaccess.h>
24#include <asm/io.h> 24#include <asm/io.h>
25 25
26void ide_tf_readback(ide_drive_t *drive, struct ide_cmd *cmd) 26void ide_tf_readback(ide_drive_t *drive, struct ide_cmd *cmd)
@@ -53,7 +53,7 @@ void ide_tf_dump(const char *s, struct ide_cmd *cmd)
53#endif 53#endif
54} 54}
55 55
56int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf) 56int taskfile_lib_get_identify(ide_drive_t *drive, u8 *buf)
57{ 57{
58 struct ide_cmd cmd; 58 struct ide_cmd cmd;
59 59
@@ -86,7 +86,7 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd)
86 if (orig_cmd->protocol == ATA_PROT_PIO && 86 if (orig_cmd->protocol == ATA_PROT_PIO &&
87 (orig_cmd->tf_flags & IDE_TFLAG_MULTI_PIO) && 87 (orig_cmd->tf_flags & IDE_TFLAG_MULTI_PIO) &&
88 drive->mult_count == 0) { 88 drive->mult_count == 0) {
89 printk(KERN_ERR "%s: multimode not set!\n", drive->name); 89 pr_err("%s: multimode not set!\n", drive->name);
90 return ide_stopped; 90 return ide_stopped;
91 } 91 }
92 92
@@ -214,7 +214,7 @@ static u8 wait_drive_not_busy(ide_drive_t *drive)
214 } 214 }
215 215
216 if (stat & ATA_BUSY) 216 if (stat & ATA_BUSY)
217 printk(KERN_ERR "%s: drive still BUSY!\n", drive->name); 217 pr_err("%s: drive still BUSY!\n", drive->name);
218 218
219 return stat; 219 return stat;
220} 220}
@@ -400,8 +400,7 @@ static ide_startstop_t pre_task_out_intr(ide_drive_t *drive,
400 400
401 if (ide_wait_stat(&startstop, drive, ATA_DRQ, 401 if (ide_wait_stat(&startstop, drive, ATA_DRQ,
402 drive->bad_wstat, WAIT_DRQ)) { 402 drive->bad_wstat, WAIT_DRQ)) {
403 printk(KERN_ERR "%s: no DRQ after issuing %sWRITE%s\n", 403 pr_err("%s: no DRQ after issuing %sWRITE%s\n", drive->name,
404 drive->name,
405 (cmd->tf_flags & IDE_TFLAG_MULTI_PIO) ? "MULT" : "", 404 (cmd->tf_flags & IDE_TFLAG_MULTI_PIO) ? "MULT" : "",
406 (drive->dev_flags & IDE_DFLAG_LBA48) ? "_EXT" : ""); 405 (drive->dev_flags & IDE_DFLAG_LBA48) ? "_EXT" : "");
407 return startstop; 406 return startstop;
@@ -451,7 +450,6 @@ put_req:
451 blk_put_request(rq); 450 blk_put_request(rq);
452 return error; 451 return error;
453} 452}
454
455EXPORT_SYMBOL(ide_raw_taskfile); 453EXPORT_SYMBOL(ide_raw_taskfile);
456 454
457int ide_no_data_taskfile(ide_drive_t *drive, struct ide_cmd *cmd) 455int ide_no_data_taskfile(ide_drive_t *drive, struct ide_cmd *cmd)
@@ -477,10 +475,9 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg)
477 u16 nsect = 0; 475 u16 nsect = 0;
478 char __user *buf = (char __user *)arg; 476 char __user *buf = (char __user *)arg;
479 477
480// printk("IDE Taskfile ...\n");
481
482 req_task = kzalloc(tasksize, GFP_KERNEL); 478 req_task = kzalloc(tasksize, GFP_KERNEL);
483 if (req_task == NULL) return -ENOMEM; 479 if (req_task == NULL)
480 return -ENOMEM;
484 if (copy_from_user(req_task, buf, tasksize)) { 481 if (copy_from_user(req_task, buf, tasksize)) {
485 kfree(req_task); 482 kfree(req_task);
486 return -EFAULT; 483 return -EFAULT;
@@ -488,7 +485,7 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg)
488 485
489 taskout = req_task->out_size; 486 taskout = req_task->out_size;
490 taskin = req_task->in_size; 487 taskin = req_task->in_size;
491 488
492 if (taskin > 65536 || taskout > 65536) { 489 if (taskin > 65536 || taskout > 65536) {
493 err = -EINVAL; 490 err = -EINVAL;
494 goto abort; 491 goto abort;
@@ -578,51 +575,49 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg)
578 cmd.protocol = ATA_PROT_DMA; 575 cmd.protocol = ATA_PROT_DMA;
579 576
580 switch (req_task->data_phase) { 577 switch (req_task->data_phase) {
581 case TASKFILE_MULTI_OUT: 578 case TASKFILE_MULTI_OUT:
582 if (!drive->mult_count) { 579 if (!drive->mult_count) {
583 /* (hs): give up if multcount is not set */ 580 /* (hs): give up if multcount is not set */
584 printk(KERN_ERR "%s: %s Multimode Write " \ 581 pr_err("%s: %s Multimode Write multcount is not set\n",
585 "multcount is not set\n", 582 drive->name, __func__);
586 drive->name, __func__); 583 err = -EPERM;
587 err = -EPERM; 584 goto abort;
588 goto abort; 585 }
589 } 586 cmd.tf_flags |= IDE_TFLAG_MULTI_PIO;
590 cmd.tf_flags |= IDE_TFLAG_MULTI_PIO; 587 /* fall through */
591 /* fall through */ 588 case TASKFILE_OUT:
592 case TASKFILE_OUT: 589 cmd.protocol = ATA_PROT_PIO;
593 cmd.protocol = ATA_PROT_PIO; 590 /* fall through */
594 /* fall through */ 591 case TASKFILE_OUT_DMAQ:
595 case TASKFILE_OUT_DMAQ: 592 case TASKFILE_OUT_DMA:
596 case TASKFILE_OUT_DMA: 593 cmd.tf_flags |= IDE_TFLAG_WRITE;
597 cmd.tf_flags |= IDE_TFLAG_WRITE; 594 nsect = taskout / SECTOR_SIZE;
598 nsect = taskout / SECTOR_SIZE; 595 data_buf = outbuf;
599 data_buf = outbuf; 596 break;
600 break; 597 case TASKFILE_MULTI_IN:
601 case TASKFILE_MULTI_IN: 598 if (!drive->mult_count) {
602 if (!drive->mult_count) { 599 /* (hs): give up if multcount is not set */
603 /* (hs): give up if multcount is not set */ 600 pr_err("%s: %s Multimode Read multcount is not set\n",
604 printk(KERN_ERR "%s: %s Multimode Read failure " \ 601 drive->name, __func__);
605 "multcount is not set\n", 602 err = -EPERM;
606 drive->name, __func__);
607 err = -EPERM;
608 goto abort;
609 }
610 cmd.tf_flags |= IDE_TFLAG_MULTI_PIO;
611 /* fall through */
612 case TASKFILE_IN:
613 cmd.protocol = ATA_PROT_PIO;
614 /* fall through */
615 case TASKFILE_IN_DMAQ:
616 case TASKFILE_IN_DMA:
617 nsect = taskin / SECTOR_SIZE;
618 data_buf = inbuf;
619 break;
620 case TASKFILE_NO_DATA:
621 cmd.protocol = ATA_PROT_NODATA;
622 break;
623 default:
624 err = -EFAULT;
625 goto abort; 603 goto abort;
604 }
605 cmd.tf_flags |= IDE_TFLAG_MULTI_PIO;
606 /* fall through */
607 case TASKFILE_IN:
608 cmd.protocol = ATA_PROT_PIO;
609 /* fall through */
610 case TASKFILE_IN_DMAQ:
611 case TASKFILE_IN_DMA:
612 nsect = taskin / SECTOR_SIZE;
613 data_buf = inbuf;
614 break;
615 case TASKFILE_NO_DATA:
616 cmd.protocol = ATA_PROT_NODATA;
617 break;
618 default:
619 err = -EFAULT;
620 goto abort;
626 } 621 }
627 622
628 if (req_task->req_cmd == IDE_DRIVE_TASK_NO_DATA) 623 if (req_task->req_cmd == IDE_DRIVE_TASK_NO_DATA)
@@ -631,7 +626,7 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg)
631 nsect = (cmd.hob.nsect << 8) | cmd.tf.nsect; 626 nsect = (cmd.hob.nsect << 8) | cmd.tf.nsect;
632 627
633 if (!nsect) { 628 if (!nsect) {
634 printk(KERN_ERR "%s: in/out command without data\n", 629 pr_err("%s: in/out command without data\n",
635 drive->name); 630 drive->name);
636 err = -EFAULT; 631 err = -EFAULT;
637 goto abort; 632 goto abort;
@@ -673,8 +668,6 @@ abort:
673 kfree(outbuf); 668 kfree(outbuf);
674 kfree(inbuf); 669 kfree(inbuf);
675 670
676// printk("IDE Taskfile ioctl ended. rc = %i\n", err);
677
678 return err; 671 return err;
679} 672}
680#endif 673#endif