Commit 441e92da authored by Paolo Ciarrocchi's avatar Paolo Ciarrocchi Committed by Bartlomiej Zolnierkiewicz

IDE: Coding Style fixes to drivers/ide/ide-proc.c

Lot of errors and warnings removed.
Compile tested.

[bart: minor fixes, md5sum checked]
Signed-off-by: default avatarPaolo Ciarrocchi <paolo.ciarrocchi@gmail.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent f94e0084
...@@ -47,28 +47,28 @@ static int proc_ide_read_imodel ...@@ -47,28 +47,28 @@ static int proc_ide_read_imodel
const char *name; const char *name;
switch (hwif->chipset) { switch (hwif->chipset) {
case ide_generic: name = "generic"; break; case ide_generic: name = "generic"; break;
case ide_pci: name = "pci"; break; case ide_pci: name = "pci"; break;
case ide_cmd640: name = "cmd640"; break; case ide_cmd640: name = "cmd640"; break;
case ide_dtc2278: name = "dtc2278"; break; case ide_dtc2278: name = "dtc2278"; break;
case ide_ali14xx: name = "ali14xx"; break; case ide_ali14xx: name = "ali14xx"; break;
case ide_qd65xx: name = "qd65xx"; break; case ide_qd65xx: name = "qd65xx"; break;
case ide_umc8672: name = "umc8672"; break; case ide_umc8672: name = "umc8672"; break;
case ide_ht6560b: name = "ht6560b"; break; case ide_ht6560b: name = "ht6560b"; break;
case ide_rz1000: name = "rz1000"; break; case ide_rz1000: name = "rz1000"; break;
case ide_trm290: name = "trm290"; break; case ide_trm290: name = "trm290"; break;
case ide_cmd646: name = "cmd646"; break; case ide_cmd646: name = "cmd646"; break;
case ide_cy82c693: name = "cy82c693"; break; case ide_cy82c693: name = "cy82c693"; break;
case ide_4drives: name = "4drives"; break; case ide_4drives: name = "4drives"; break;
case ide_pmac: name = "mac-io"; break; case ide_pmac: name = "mac-io"; break;
case ide_au1xxx: name = "au1xxx"; break; case ide_au1xxx: name = "au1xxx"; break;
case ide_palm3710: name = "palm3710"; break; case ide_palm3710: name = "palm3710"; break;
case ide_etrax100: name = "etrax100"; break; case ide_etrax100: name = "etrax100"; break;
case ide_acorn: name = "acorn"; break; case ide_acorn: name = "acorn"; break;
default: name = "(unknown)"; break; default: name = "(unknown)"; break;
} }
len = sprintf(page, "%s\n", name); len = sprintf(page, "%s\n", name);
PROC_IDE_READ_RETURN(page,start,off,count,eof,len); PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
} }
static int proc_ide_read_mate static int proc_ide_read_mate
...@@ -81,7 +81,7 @@ static int proc_ide_read_mate ...@@ -81,7 +81,7 @@ static int proc_ide_read_mate
len = sprintf(page, "%s\n", hwif->mate->name); len = sprintf(page, "%s\n", hwif->mate->name);
else else
len = sprintf(page, "(none)\n"); len = sprintf(page, "(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_ide_read_channel static int proc_ide_read_channel
...@@ -93,7 +93,7 @@ static int proc_ide_read_channel ...@@ -93,7 +93,7 @@ static int proc_ide_read_channel
page[0] = hwif->channel ? '1' : '0'; page[0] = hwif->channel ? '1' : '0';
page[1] = '\n'; page[1] = '\n';
len = 2; len = 2;
PROC_IDE_READ_RETURN(page,start,off,count,eof,len); PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
} }
static int proc_ide_read_identify static int proc_ide_read_identify
...@@ -120,7 +120,7 @@ static int proc_ide_read_identify ...@@ -120,7 +120,7 @@ static int proc_ide_read_identify
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);
} }
/** /**
...@@ -197,7 +197,7 @@ EXPORT_SYMBOL(ide_add_setting); ...@@ -197,7 +197,7 @@ EXPORT_SYMBOL(ide_add_setting);
* The caller must hold the setting semaphore. * The caller must hold the setting semaphore.
*/ */
static void __ide_remove_setting (ide_drive_t *drive, char *name) static void __ide_remove_setting(ide_drive_t *drive, char *name)
{ {
ide_settings_t **p, *setting; ide_settings_t **p, *setting;
...@@ -205,7 +205,8 @@ static void __ide_remove_setting (ide_drive_t *drive, char *name) ...@@ -205,7 +205,8 @@ static void __ide_remove_setting (ide_drive_t *drive, char *name)
while ((*p) && strcmp((*p)->name, name)) while ((*p) && strcmp((*p)->name, name))
p = &((*p)->next); p = &((*p)->next);
if ((setting = (*p)) == NULL) setting = (*p);
if (setting == NULL)
return; return;
(*p) = setting->next; (*p) = setting->next;
...@@ -223,7 +224,7 @@ static void __ide_remove_setting (ide_drive_t *drive, char *name) ...@@ -223,7 +224,7 @@ static void __ide_remove_setting (ide_drive_t *drive, char *name)
* caller must hold ide_setting_mtx. * caller must hold ide_setting_mtx.
*/ */
static void auto_remove_settings (ide_drive_t *drive) static void auto_remove_settings(ide_drive_t *drive)
{ {
ide_settings_t *setting; ide_settings_t *setting;
repeat: repeat:
...@@ -279,16 +280,16 @@ static int ide_read_setting(ide_drive_t *drive, ide_settings_t *setting) ...@@ -279,16 +280,16 @@ static int ide_read_setting(ide_drive_t *drive, ide_settings_t *setting)
if ((setting->rw & SETTING_READ)) { if ((setting->rw & SETTING_READ)) {
spin_lock_irqsave(&ide_lock, flags); spin_lock_irqsave(&ide_lock, flags);
switch(setting->data_type) { switch (setting->data_type) {
case TYPE_BYTE: case TYPE_BYTE:
val = *((u8 *) setting->data); val = *((u8 *) setting->data);
break; break;
case TYPE_SHORT: case TYPE_SHORT:
val = *((u16 *) setting->data); val = *((u16 *) setting->data);
break; break;
case TYPE_INT: case TYPE_INT:
val = *((u32 *) setting->data); val = *((u32 *) setting->data);
break; break;
} }
spin_unlock_irqrestore(&ide_lock, flags); spin_unlock_irqrestore(&ide_lock, flags);
} }
...@@ -326,15 +327,15 @@ static int ide_write_setting(ide_drive_t *drive, ide_settings_t *setting, int va ...@@ -326,15 +327,15 @@ static int ide_write_setting(ide_drive_t *drive, ide_settings_t *setting, int va
if (ide_spin_wait_hwgroup(drive)) if (ide_spin_wait_hwgroup(drive))
return -EBUSY; return -EBUSY;
switch (setting->data_type) { switch (setting->data_type) {
case TYPE_BYTE: case TYPE_BYTE:
*((u8 *) setting->data) = val; *((u8 *) setting->data) = val;
break; break;
case TYPE_SHORT: case TYPE_SHORT:
*((u16 *) setting->data) = val; *((u16 *) setting->data) = val;
break; break;
case TYPE_INT: case TYPE_INT:
*((u32 *) setting->data) = val; *((u32 *) setting->data) = val;
break; break;
} }
spin_unlock_irq(&ide_lock); spin_unlock_irq(&ide_lock);
return 0; return 0;
...@@ -390,7 +391,7 @@ void ide_add_generic_settings (ide_drive_t *drive) ...@@ -390,7 +391,7 @@ void ide_add_generic_settings (ide_drive_t *drive)
static void proc_ide_settings_warn(void) static void proc_ide_settings_warn(void)
{ {
static int warned = 0; static int warned;
if (warned) if (warned)
return; return;
...@@ -413,11 +414,12 @@ static int proc_ide_read_settings ...@@ -413,11 +414,12 @@ static int proc_ide_read_settings
mutex_lock(&ide_setting_mtx); mutex_lock(&ide_setting_mtx);
out += sprintf(out, "name\t\t\tvalue\t\tmin\t\tmax\t\tmode\n"); out += sprintf(out, "name\t\t\tvalue\t\tmin\t\tmax\t\tmode\n");
out += sprintf(out, "----\t\t\t-----\t\t---\t\t---\t\t----\n"); out += sprintf(out, "----\t\t\t-----\t\t---\t\t---\t\t----\n");
while(setting) { while (setting) {
mul_factor = setting->mul_factor; mul_factor = setting->mul_factor;
div_factor = setting->div_factor; div_factor = setting->div_factor;
out += sprintf(out, "%-24s", setting->name); out += sprintf(out, "%-24s", setting->name);
if ((rc = ide_read_setting(drive, setting)) >= 0) rc = ide_read_setting(drive, setting);
if (rc >= 0)
out += sprintf(out, "%-16d", rc * mul_factor / div_factor); out += sprintf(out, "%-16d", rc * mul_factor / div_factor);
else else
out += sprintf(out, "%-16s", "write-only"); out += sprintf(out, "%-16s", "write-only");
...@@ -431,7 +433,7 @@ static int proc_ide_read_settings ...@@ -431,7 +433,7 @@ static int proc_ide_read_settings
} }
len = out - page; len = out - page;
mutex_unlock(&ide_setting_mtx); mutex_unlock(&ide_setting_mtx);
PROC_IDE_READ_RETURN(page,start,off,count,eof,len); PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
} }
#define MAX_LEN 30 #define MAX_LEN 30
...@@ -512,8 +514,7 @@ static int proc_ide_write_settings(struct file *file, const char __user *buffer, ...@@ -512,8 +514,7 @@ static int proc_ide_write_settings(struct file *file, const char __user *buffer,
mutex_lock(&ide_setting_mtx); mutex_lock(&ide_setting_mtx);
setting = ide_find_setting_by_name(drive, name); setting = ide_find_setting_by_name(drive, name);
if (!setting) if (!setting) {
{
mutex_unlock(&ide_setting_mtx); mutex_unlock(&ide_setting_mtx);
goto parse_error; goto parse_error;
} }
...@@ -533,8 +534,8 @@ parse_error: ...@@ -533,8 +534,8 @@ parse_error:
int proc_ide_read_capacity int proc_ide_read_capacity
(char *page, char **start, off_t off, int count, int *eof, void *data) (char *page, char **start, off_t off, int count, int *eof, void *data)
{ {
int len = sprintf(page,"%llu\n", (long long)0x7fffffff); int len = sprintf(page, "%llu\n", (long long)0x7fffffff);
PROC_IDE_READ_RETURN(page,start,off,count,eof,len); PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
} }
EXPORT_SYMBOL_GPL(proc_ide_read_capacity); EXPORT_SYMBOL_GPL(proc_ide_read_capacity);
...@@ -546,13 +547,13 @@ int proc_ide_read_geometry ...@@ -546,13 +547,13 @@ int proc_ide_read_geometry
char *out = page; char *out = page;
int len; int len;
out += sprintf(out,"physical %d/%d/%d\n", out += sprintf(out, "physical %d/%d/%d\n",
drive->cyl, drive->head, drive->sect); drive->cyl, drive->head, drive->sect);
out += sprintf(out,"logical %d/%d/%d\n", out += sprintf(out, "logical %d/%d/%d\n",
drive->bios_cyl, drive->bios_head, drive->bios_sect); drive->bios_cyl, drive->bios_head, drive->bios_sect);
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);
} }
EXPORT_SYMBOL(proc_ide_read_geometry); EXPORT_SYMBOL(proc_ide_read_geometry);
...@@ -566,7 +567,7 @@ static int proc_ide_read_dmodel ...@@ -566,7 +567,7 @@ static int proc_ide_read_dmodel
len = sprintf(page, "%.40s\n", len = sprintf(page, "%.40s\n",
(id && id->model[0]) ? (char *)id->model : "(none)"); (id && id->model[0]) ? (char *)id->model : "(none)");
PROC_IDE_READ_RETURN(page,start,off,count,eof,len); PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
} }
static int proc_ide_read_driver static int proc_ide_read_driver
...@@ -583,7 +584,7 @@ static int proc_ide_read_driver ...@@ -583,7 +584,7 @@ static int proc_ide_read_driver
dev->driver->name, ide_drv->version); dev->driver->name, ide_drv->version);
} else } else
len = sprintf(page, "ide-default version 0.9.newide\n"); len = sprintf(page, "ide-default version 0.9.newide\n");
PROC_IDE_READ_RETURN(page,start,off,count,eof,len); PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
} }
static int ide_replace_subdriver(ide_drive_t *drive, const char *driver) static int ide_replace_subdriver(ide_drive_t *drive, const char *driver)
...@@ -639,30 +640,26 @@ static int proc_ide_read_media ...@@ -639,30 +640,26 @@ static int proc_ide_read_media
int len; int len;
switch (drive->media) { switch (drive->media) {
case ide_disk: media = "disk\n"; case ide_disk: media = "disk\n"; break;
break; case ide_cdrom: media = "cdrom\n"; break;
case ide_cdrom: media = "cdrom\n"; case ide_tape: media = "tape\n"; break;
break; case ide_floppy: media = "floppy\n"; break;
case ide_tape: media = "tape\n"; case ide_optical: media = "optical\n"; break;
break; default: media = "UNKNOWN\n"; break;
case ide_floppy:media = "floppy\n";
break;
case ide_optical:media = "optical\n";
break;
default: media = "UNKNOWN\n";
break;
} }
strcpy(page,media); strcpy(page, media);
len = strlen(media); len = strlen(media);
PROC_IDE_READ_RETURN(page,start,off,count,eof,len); PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
} }
static ide_proc_entry_t generic_drive_entries[] = { static ide_proc_entry_t generic_drive_entries[] = {
{ "driver", S_IFREG|S_IRUGO, proc_ide_read_driver, proc_ide_write_driver }, { "driver", S_IFREG|S_IRUGO, proc_ide_read_driver,
{ "identify", S_IFREG|S_IRUSR, proc_ide_read_identify, NULL }, proc_ide_write_driver },
{ "media", S_IFREG|S_IRUGO, proc_ide_read_media, NULL }, { "identify", S_IFREG|S_IRUSR, proc_ide_read_identify, NULL },
{ "model", S_IFREG|S_IRUGO, proc_ide_read_dmodel, NULL }, { "media", S_IFREG|S_IRUGO, proc_ide_read_media, NULL },
{ "settings", S_IFREG|S_IRUSR|S_IWUSR,proc_ide_read_settings, proc_ide_write_settings }, { "model", S_IFREG|S_IRUGO, proc_ide_read_dmodel, NULL },
{ "settings", S_IFREG|S_IRUSR|S_IWUSR, proc_ide_read_settings,
proc_ide_write_settings },
{ NULL, 0, NULL, NULL } { NULL, 0, NULL, NULL }
}; };
...@@ -734,7 +731,6 @@ void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) ...@@ -734,7 +731,6 @@ void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver)
spin_unlock_irqrestore(&ide_lock, flags); spin_unlock_irqrestore(&ide_lock, flags);
mutex_unlock(&ide_setting_mtx); mutex_unlock(&ide_setting_mtx);
} }
EXPORT_SYMBOL(ide_proc_unregister_driver); EXPORT_SYMBOL(ide_proc_unregister_driver);
void ide_proc_port_register_devices(ide_hwif_t *hwif) void ide_proc_port_register_devices(ide_hwif_t *hwif)
...@@ -755,7 +751,7 @@ void ide_proc_port_register_devices(ide_hwif_t *hwif) ...@@ -755,7 +751,7 @@ void ide_proc_port_register_devices(ide_hwif_t *hwif)
drive->proc = proc_mkdir(drive->name, parent); drive->proc = proc_mkdir(drive->name, parent);
if (drive->proc) if (drive->proc)
ide_add_proc_entries(drive->proc, generic_drive_entries, drive); ide_add_proc_entries(drive->proc, generic_drive_entries, drive);
sprintf(name,"ide%d/%s", (drive->name[2]-'a')/2, drive->name); sprintf(name, "ide%d/%s", (drive->name[2]-'a')/2, drive->name);
ent = proc_symlink(drive->name, proc_ide_root, name); ent = proc_symlink(drive->name, proc_ide_root, name);
if (!ent) return; if (!ent) return;
} }
...@@ -795,7 +791,6 @@ void ide_pci_create_host_proc(const char *name, get_info_t *get_info) ...@@ -795,7 +791,6 @@ void ide_pci_create_host_proc(const char *name, get_info_t *get_info)
{ {
create_proc_info_entry(name, 0, proc_ide_root, get_info); create_proc_info_entry(name, 0, proc_ide_root, get_info);
} }
EXPORT_SYMBOL_GPL(ide_pci_create_host_proc); EXPORT_SYMBOL_GPL(ide_pci_create_host_proc);
#endif #endif
......
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