ide-disk: fix issues found by checkpatch.pl

There are no changes to the resulting drivers/ide/ide-disk.o binary file
(md5sum-s after and before the patch match).
Acked-by: NSergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
上级 799ee57a
...@@ -16,8 +16,6 @@ ...@@ -16,8 +16,6 @@
#define IDEDISK_VERSION "1.18" #define IDEDISK_VERSION "1.18"
//#define DEBUG
#include <linux/module.h> #include <linux/module.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/string.h> #include <linux/string.h>
...@@ -88,7 +86,7 @@ static void ide_disk_put(struct ide_disk_obj *idkp) ...@@ -88,7 +86,7 @@ static void ide_disk_put(struct ide_disk_obj *idkp)
* *
* It is called only once for each drive. * It is called only once for each drive.
*/ */
static int lba_capacity_is_ok (struct hd_driveid *id) static int lba_capacity_is_ok(struct hd_driveid *id)
{ {
unsigned long lba_sects, chs_sects, head, tail; unsigned long lba_sects, chs_sects, head, tail;
...@@ -176,7 +174,8 @@ static void ide_tf_set_cmd(ide_drive_t *drive, ide_task_t *task, u8 dma) ...@@ -176,7 +174,8 @@ static void ide_tf_set_cmd(ide_drive_t *drive, ide_task_t *task, u8 dma)
* __ide_do_rw_disk() issues READ and WRITE commands to a disk, * __ide_do_rw_disk() issues READ and WRITE commands to a disk,
* using LBA if supported, or CHS otherwise, to address sectors. * using LBA if supported, or CHS otherwise, to address sectors.
*/ */
static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, sector_t block) static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
sector_t block)
{ {
ide_hwif_t *hwif = HWIF(drive); ide_hwif_t *hwif = HWIF(drive);
unsigned int dma = drive->using_dma; unsigned int dma = drive->using_dma;
...@@ -228,7 +227,8 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, ...@@ -228,7 +227,8 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
tf->device = (block >> 8) & 0xf; tf->device = (block >> 8) & 0xf;
} }
} else { } else {
unsigned int sect,head,cyl,track; unsigned int sect, head, cyl, track;
track = (int)block / drive->sect; track = (int)block / drive->sect;
sect = (int)block % drive->sect + 1; sect = (int)block % drive->sect + 1;
head = track % drive->head; head = track % drive->head;
...@@ -271,7 +271,8 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, ...@@ -271,7 +271,8 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
* 1073741822 == 549756 MB or 48bit addressing fake drive * 1073741822 == 549756 MB or 48bit addressing fake drive
*/ */
static ide_startstop_t ide_do_rw_disk (ide_drive_t *drive, struct request *rq, sector_t block) static ide_startstop_t ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
sector_t block)
{ {
ide_hwif_t *hwif = HWIF(drive); ide_hwif_t *hwif = HWIF(drive);
...@@ -452,7 +453,7 @@ static void idedisk_check_hpa(ide_drive_t *drive) ...@@ -452,7 +453,7 @@ static void idedisk_check_hpa(ide_drive_t *drive)
* in above order (i.e., if value of higher priority is available, * in above order (i.e., if value of higher priority is available,
* reset will be ignored). * reset will be ignored).
*/ */
static void init_idedisk_capacity (ide_drive_t *drive) static void init_idedisk_capacity(ide_drive_t *drive)
{ {
struct hd_driveid *id = drive->id; struct hd_driveid *id = drive->id;
/* /*
...@@ -479,7 +480,7 @@ static void init_idedisk_capacity (ide_drive_t *drive) ...@@ -479,7 +480,7 @@ static void init_idedisk_capacity (ide_drive_t *drive)
} }
} }
static sector_t idedisk_capacity (ide_drive_t *drive) static sector_t idedisk_capacity(ide_drive_t *drive)
{ {
return drive->capacity64 - drive->sect0; return drive->capacity64 - drive->sect0;
} }
...@@ -524,10 +525,11 @@ static int proc_idedisk_read_cache ...@@ -524,10 +525,11 @@ static int proc_idedisk_read_cache
int len; int len;
if (drive->id_read) if (drive->id_read)
len = sprintf(out,"%i\n", drive->id->buf_size / 2); len = sprintf(out, "%i\n", drive->id->buf_size / 2);
else else
len = sprintf(out,"(none)\n"); len = sprintf(out, "(none)\n");
PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
} }
static int proc_idedisk_read_capacity static int proc_idedisk_read_capacity
...@@ -536,8 +538,9 @@ static int proc_idedisk_read_capacity ...@@ -536,8 +538,9 @@ static int proc_idedisk_read_capacity
ide_drive_t*drive = (ide_drive_t *)data; ide_drive_t*drive = (ide_drive_t *)data;
int len; int len;
len = sprintf(page,"%llu\n", (long long)idedisk_capacity(drive)); len = sprintf(page, "%llu\n", (long long)idedisk_capacity(drive));
PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
} }
static int proc_idedisk_read_smart(char *page, char **start, off_t off, static int proc_idedisk_read_smart(char *page, char **start, off_t off,
...@@ -551,12 +554,14 @@ static int proc_idedisk_read_smart(char *page, char **start, off_t off, ...@@ -551,12 +554,14 @@ static int proc_idedisk_read_smart(char *page, char **start, off_t off,
char *out = ((char *)val) + (SECTOR_WORDS * 4); char *out = ((char *)val) + (SECTOR_WORDS * 4);
page = out; page = out;
do { do {
out += sprintf(out, "%04x%c", le16_to_cpu(*val), (++i & 7) ? ' ' : '\n'); out += sprintf(out, "%04x%c", le16_to_cpu(*val),
(++i & 7) ? ' ' : '\n');
val += 1; val += 1;
} while (i < (SECTOR_WORDS * 2)); } while (i < (SECTOR_WORDS * 2));
len = out - page; len = out - page;
} }
PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
} }
static int proc_idedisk_read_sv static int proc_idedisk_read_sv
...@@ -620,12 +625,13 @@ static int set_multcount(ide_drive_t *drive, int arg) ...@@ -620,12 +625,13 @@ static int set_multcount(ide_drive_t *drive, int arg)
if (drive->special.b.set_multmode) if (drive->special.b.set_multmode)
return -EBUSY; return -EBUSY;
ide_init_drive_cmd (&rq); ide_init_drive_cmd(&rq);
rq.cmd_type = REQ_TYPE_ATA_TASKFILE; rq.cmd_type = REQ_TYPE_ATA_TASKFILE;
drive->mult_req = arg; drive->mult_req = arg;
drive->special.b.set_multmode = 1; drive->special.b.set_multmode = 1;
(void) ide_do_drive_cmd (drive, &rq, ide_wait); (void)ide_do_drive_cmd(drive, &rq, ide_wait);
return (drive->mult_count == arg) ? 0 : -EIO; return (drive->mult_count == arg) ? 0 : -EIO;
} }
...@@ -701,7 +707,7 @@ static int write_cache(ide_drive_t *drive, int arg) ...@@ -701,7 +707,7 @@ static int write_cache(ide_drive_t *drive, int arg)
return err; return err;
} }
static int do_idedisk_flushcache (ide_drive_t *drive) static int do_idedisk_flushcache(ide_drive_t *drive)
{ {
ide_task_t args; ide_task_t args;
...@@ -714,7 +720,7 @@ static int do_idedisk_flushcache (ide_drive_t *drive) ...@@ -714,7 +720,7 @@ static int do_idedisk_flushcache (ide_drive_t *drive)
return ide_no_data_taskfile(drive, &args); return ide_no_data_taskfile(drive, &args);
} }
static int set_acoustic (ide_drive_t *drive, int arg) static int set_acoustic(ide_drive_t *drive, int arg)
{ {
ide_task_t args; ide_task_t args;
...@@ -748,7 +754,7 @@ static int set_lba_addressing(ide_drive_t *drive, int arg) ...@@ -748,7 +754,7 @@ static int set_lba_addressing(ide_drive_t *drive, int arg)
return 0; return 0;
if (!idedisk_supports_lba48(drive->id)) if (!idedisk_supports_lba48(drive->id))
return -EIO; return -EIO;
drive->addressing = arg; drive->addressing = arg;
return 0; return 0;
} }
...@@ -758,23 +764,35 @@ static void idedisk_add_settings(ide_drive_t *drive) ...@@ -758,23 +764,35 @@ static void idedisk_add_settings(ide_drive_t *drive)
{ {
struct hd_driveid *id = drive->id; struct hd_driveid *id = drive->id;
ide_add_setting(drive, "bios_cyl", SETTING_RW, TYPE_INT, 0, 65535, 1, 1, &drive->bios_cyl, NULL); ide_add_setting(drive, "bios_cyl", SETTING_RW, TYPE_INT, 0, 65535, 1, 1,
ide_add_setting(drive, "bios_head", SETTING_RW, TYPE_BYTE, 0, 255, 1, 1, &drive->bios_head, NULL); &drive->bios_cyl, NULL);
ide_add_setting(drive, "bios_sect", SETTING_RW, TYPE_BYTE, 0, 63, 1, 1, &drive->bios_sect, NULL); ide_add_setting(drive, "bios_head", SETTING_RW, TYPE_BYTE, 0, 255, 1, 1,
ide_add_setting(drive, "address", SETTING_RW, TYPE_BYTE, 0, 2, 1, 1, &drive->addressing, set_lba_addressing); &drive->bios_head, NULL);
ide_add_setting(drive, "multcount", SETTING_RW, TYPE_BYTE, 0, id->max_multsect, 1, 1, &drive->mult_count, set_multcount); ide_add_setting(drive, "bios_sect", SETTING_RW, TYPE_BYTE, 0, 63, 1, 1,
ide_add_setting(drive, "nowerr", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, &drive->nowerr, set_nowerr); &drive->bios_sect, NULL);
ide_add_setting(drive, "lun", SETTING_RW, TYPE_INT, 0, 7, 1, 1, &drive->lun, NULL); ide_add_setting(drive, "address", SETTING_RW, TYPE_BYTE, 0, 2, 1, 1,
ide_add_setting(drive, "wcache", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, &drive->wcache, write_cache); &drive->addressing, set_lba_addressing);
ide_add_setting(drive, "acoustic", SETTING_RW, TYPE_BYTE, 0, 254, 1, 1, &drive->acoustic, set_acoustic); ide_add_setting(drive, "multcount", SETTING_RW, TYPE_BYTE, 0,
ide_add_setting(drive, "failures", SETTING_RW, TYPE_INT, 0, 65535, 1, 1, &drive->failures, NULL); id->max_multsect, 1, 1, &drive->mult_count,
ide_add_setting(drive, "max_failures", SETTING_RW, TYPE_INT, 0, 65535, 1, 1, &drive->max_failures, NULL); set_multcount);
ide_add_setting(drive, "nowerr", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1,
&drive->nowerr, set_nowerr);
ide_add_setting(drive, "lun", SETTING_RW, TYPE_INT, 0, 7, 1, 1,
&drive->lun, NULL);
ide_add_setting(drive, "wcache", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1,
&drive->wcache, write_cache);
ide_add_setting(drive, "acoustic", SETTING_RW, TYPE_BYTE, 0, 254, 1, 1,
&drive->acoustic, set_acoustic);
ide_add_setting(drive, "failures", SETTING_RW, TYPE_INT, 0, 65535, 1, 1,
&drive->failures, NULL);
ide_add_setting(drive, "max_failures", SETTING_RW, TYPE_INT, 0, 65535,
1, 1, &drive->max_failures, NULL);
} }
#else #else
static inline void idedisk_add_settings(ide_drive_t *drive) { ; } static inline void idedisk_add_settings(ide_drive_t *drive) { ; }
#endif #endif
static void idedisk_setup (ide_drive_t *drive) static void idedisk_setup(ide_drive_t *drive)
{ {
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
struct hd_driveid *id = drive->id; struct hd_driveid *id = drive->id;
...@@ -787,11 +805,10 @@ static void idedisk_setup (ide_drive_t *drive) ...@@ -787,11 +805,10 @@ static void idedisk_setup (ide_drive_t *drive)
if (drive->removable) { if (drive->removable) {
/* /*
* Removable disks (eg. SYQUEST); ignore 'WD' drives * Removable disks (eg. SYQUEST); ignore 'WD' drives
*/ */
if (id->model[0] != 'W' || id->model[1] != 'D') { if (id->model[0] != 'W' || id->model[1] != 'D')
drive->doorlocking = 1; drive->doorlocking = 1;
}
} }
(void)set_lba_addressing(drive, 1); (void)set_lba_addressing(drive, 1);
...@@ -805,10 +822,11 @@ static void idedisk_setup (ide_drive_t *drive) ...@@ -805,10 +822,11 @@ static void idedisk_setup (ide_drive_t *drive)
blk_queue_max_sectors(drive->queue, max_s); blk_queue_max_sectors(drive->queue, max_s);
} }
printk(KERN_INFO "%s: max request size: %dKiB\n", drive->name, drive->queue->max_sectors / 2); printk(KERN_INFO "%s: max request size: %dKiB\n", drive->name,
drive->queue->max_sectors / 2);
/* calculate drive capacity, and select LBA if possible */ /* calculate drive capacity, and select LBA if possible */
init_idedisk_capacity (drive); init_idedisk_capacity(drive);
/* limit drive capacity to 137GB if LBA48 cannot be used */ /* limit drive capacity to 137GB if LBA48 cannot be used */
if (drive->addressing == 0 && drive->capacity64 > 1ULL << 28) { if (drive->addressing == 0 && drive->capacity64 > 1ULL << 28) {
...@@ -821,9 +839,9 @@ static void idedisk_setup (ide_drive_t *drive) ...@@ -821,9 +839,9 @@ static void idedisk_setup (ide_drive_t *drive)
if ((hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) && drive->addressing) { if ((hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) && drive->addressing) {
if (drive->capacity64 > 1ULL << 28) { if (drive->capacity64 > 1ULL << 28) {
printk(KERN_INFO "%s: cannot use LBA48 DMA - PIO mode will" printk(KERN_INFO "%s: cannot use LBA48 DMA - PIO mode"
" be used for accessing sectors > %u\n", " will be used for accessing sectors "
drive->name, 1 << 28); "> %u\n", drive->name, 1 << 28);
} else } else
drive->addressing = 0; drive->addressing = 0;
} }
...@@ -832,7 +850,8 @@ static void idedisk_setup (ide_drive_t *drive) ...@@ -832,7 +850,8 @@ static void idedisk_setup (ide_drive_t *drive)
* if possible, give fdisk access to more of the drive, * if possible, give fdisk access to more of the drive,
* by correcting bios_cyls: * by correcting bios_cyls:
*/ */
capacity = idedisk_capacity (drive); capacity = idedisk_capacity(drive);
if (!drive->forced_geom) { if (!drive->forced_geom) {
if (idedisk_supports_lba48(drive->id)) { if (idedisk_supports_lba48(drive->id)) {
...@@ -988,7 +1007,8 @@ static int idedisk_open(struct inode *inode, struct file *filp) ...@@ -988,7 +1007,8 @@ static int idedisk_open(struct inode *inode, struct file *filp)
struct ide_disk_obj *idkp; struct ide_disk_obj *idkp;
ide_drive_t *drive; ide_drive_t *drive;
if (!(idkp = ide_disk_get(disk))) idkp = ide_disk_get(disk);
if (idkp == NULL)
return -ENXIO; return -ENXIO;
drive = idkp->drive; drive = idkp->drive;
...@@ -1110,13 +1130,13 @@ static int idedisk_revalidate_disk(struct gendisk *disk) ...@@ -1110,13 +1130,13 @@ static int idedisk_revalidate_disk(struct gendisk *disk)
} }
static struct block_device_operations idedisk_ops = { static struct block_device_operations idedisk_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = idedisk_open, .open = idedisk_open,
.release = idedisk_release, .release = idedisk_release,
.ioctl = idedisk_ioctl, .ioctl = idedisk_ioctl,
.getgeo = idedisk_getgeo, .getgeo = idedisk_getgeo,
.media_changed = idedisk_media_changed, .media_changed = idedisk_media_changed,
.revalidate_disk= idedisk_revalidate_disk .revalidate_disk = idedisk_revalidate_disk
}; };
MODULE_DESCRIPTION("ATA DISK Driver"); MODULE_DESCRIPTION("ATA DISK Driver");
...@@ -1179,7 +1199,7 @@ static int ide_disk_probe(ide_drive_t *drive) ...@@ -1179,7 +1199,7 @@ static int ide_disk_probe(ide_drive_t *drive)
return -ENODEV; return -ENODEV;
} }
static void __exit idedisk_exit (void) static void __exit idedisk_exit(void)
{ {
driver_unregister(&idedisk_driver.gen_driver); driver_unregister(&idedisk_driver.gen_driver);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册