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
...@@ -68,7 +68,7 @@ static int proc_ide_read_imodel ...@@ -68,7 +68,7 @@ static int proc_ide_read_imodel
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,7 +280,7 @@ static int ide_read_setting(ide_drive_t *drive, ide_settings_t *setting) ...@@ -279,7 +280,7 @@ 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;
...@@ -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,
proc_ide_write_driver },
{ "identify", S_IFREG|S_IRUSR, proc_ide_read_identify, NULL }, { "identify", S_IFREG|S_IRUSR, proc_ide_read_identify, NULL },
{ "media", S_IFREG|S_IRUGO, proc_ide_read_media, NULL }, { "media", S_IFREG|S_IRUGO, proc_ide_read_media, NULL },
{ "model", S_IFREG|S_IRUGO, proc_ide_read_dmodel, NULL }, { "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 }, { "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