Skip to content

Commit 2d5abce

Browse files
jaswinderrajputdavem330
authored andcommitted
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>
1 parent 72db37b commit 2d5abce

1 file changed

Lines changed: 51 additions & 58 deletions

File tree

‎drivers/ide/ide-taskfile.c‎

Lines changed: 51 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
#include <linux/hdreg.h>
2020
#include <linux/ide.h>
2121
#include <linux/scatterlist.h>
22+
#include <linux/uaccess.h>
2223

23-
#include <asm/uaccess.h>
2424
#include <asm/io.h>
2525

2626
void 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)
5353
#endif
5454
}
5555

56-
int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf)
56+
int taskfile_lib_get_identify(ide_drive_t *drive, u8 *buf)
5757
{
5858
struct ide_cmd cmd;
5959

@@ -86,7 +86,7 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd)
8686
if (orig_cmd->protocol == ATA_PROT_PIO &&
8787
(orig_cmd->tf_flags & IDE_TFLAG_MULTI_PIO) &&
8888
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);
9090
return ide_stopped;
9191
}
9292

@@ -214,7 +214,7 @@ static u8 wait_drive_not_busy(ide_drive_t *drive)
214214
}
215215

216216
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);
218218

219219
return stat;
220220
}
@@ -400,8 +400,7 @@ static ide_startstop_t pre_task_out_intr(ide_drive_t *drive,
400400

401401
if (ide_wait_stat(&startstop, drive, ATA_DRQ,
402402
drive->bad_wstat, WAIT_DRQ)) {
403-
printk(KERN_ERR "%s: no DRQ after issuing %sWRITE%s\n",
404-
drive->name,
403+
pr_err("%s: no DRQ after issuing %sWRITE%s\n", drive->name,
405404
(cmd->tf_flags & IDE_TFLAG_MULTI_PIO) ? "MULT" : "",
406405
(drive->dev_flags & IDE_DFLAG_LBA48) ? "_EXT" : "");
407406
return startstop;
@@ -451,7 +450,6 @@ int ide_raw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd, u8 *buf,
451450
blk_put_request(rq);
452451
return error;
453452
}
454-
455453
EXPORT_SYMBOL(ide_raw_taskfile);
456454

457455
int ide_no_data_taskfile(ide_drive_t *drive, struct ide_cmd *cmd)
@@ -477,18 +475,17 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg)
477475
u16 nsect = 0;
478476
char __user *buf = (char __user *)arg;
479477

480-
// printk("IDE Taskfile ...\n");
481-
482478
req_task = kzalloc(tasksize, GFP_KERNEL);
483-
if (req_task == NULL) return -ENOMEM;
479+
if (req_task == NULL)
480+
return -ENOMEM;
484481
if (copy_from_user(req_task, buf, tasksize)) {
485482
kfree(req_task);
486483
return -EFAULT;
487484
}
488485

489486
taskout = req_task->out_size;
490487
taskin = req_task->in_size;
491-
488+
492489
if (taskin > 65536 || taskout > 65536) {
493490
err = -EINVAL;
494491
goto abort;
@@ -578,51 +575,49 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg)
578575
cmd.protocol = ATA_PROT_DMA;
579576

580577
switch (req_task->data_phase) {
581-
case TASKFILE_MULTI_OUT:
582-
if (!drive->mult_count) {
583-
/* (hs): give up if multcount is not set */
584-
printk(KERN_ERR "%s: %s Multimode Write " \
585-
"multcount is not set\n",
586-
drive->name, __func__);
587-
err = -EPERM;
588-
goto abort;
589-
}
590-
cmd.tf_flags |= IDE_TFLAG_MULTI_PIO;
591-
/* fall through */
592-
case TASKFILE_OUT:
593-
cmd.protocol = ATA_PROT_PIO;
594-
/* fall through */
595-
case TASKFILE_OUT_DMAQ:
596-
case TASKFILE_OUT_DMA:
597-
cmd.tf_flags |= IDE_TFLAG_WRITE;
598-
nsect = taskout / SECTOR_SIZE;
599-
data_buf = outbuf;
600-
break;
601-
case TASKFILE_MULTI_IN:
602-
if (!drive->mult_count) {
603-
/* (hs): give up if multcount is not set */
604-
printk(KERN_ERR "%s: %s Multimode Read failure " \
605-
"multcount is not set\n",
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;
578+
case TASKFILE_MULTI_OUT:
579+
if (!drive->mult_count) {
580+
/* (hs): give up if multcount is not set */
581+
pr_err("%s: %s Multimode Write multcount is not set\n",
582+
drive->name, __func__);
583+
err = -EPERM;
584+
goto abort;
585+
}
586+
cmd.tf_flags |= IDE_TFLAG_MULTI_PIO;
587+
/* fall through */
588+
case TASKFILE_OUT:
589+
cmd.protocol = ATA_PROT_PIO;
590+
/* fall through */
591+
case TASKFILE_OUT_DMAQ:
592+
case TASKFILE_OUT_DMA:
593+
cmd.tf_flags |= IDE_TFLAG_WRITE;
594+
nsect = taskout / SECTOR_SIZE;
595+
data_buf = outbuf;
596+
break;
597+
case TASKFILE_MULTI_IN:
598+
if (!drive->mult_count) {
599+
/* (hs): give up if multcount is not set */
600+
pr_err("%s: %s Multimode Read multcount is not set\n",
601+
drive->name, __func__);
602+
err = -EPERM;
625603
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;
626621
}
627622

628623
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)
631626
nsect = (cmd.hob.nsect << 8) | cmd.tf.nsect;
632627

633628
if (!nsect) {
634-
printk(KERN_ERR "%s: in/out command without data\n",
629+
pr_err("%s: in/out command without data\n",
635630
drive->name);
636631
err = -EFAULT;
637632
goto abort;
@@ -673,8 +668,6 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg)
673668
kfree(outbuf);
674669
kfree(inbuf);
675670

676-
// printk("IDE Taskfile ioctl ended. rc = %i\n", err);
677-
678671
return err;
679672
}
680673
#endif

0 commit comments

Comments
 (0)