diff options
author | Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com> | 2008-04-26 11:36:40 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 11:36:40 -0400 |
commit | 441e92dae0b64b577ea5a88861e86805f69e13cf (patch) | |
tree | abf7c3aaee9534c06a89ca41d9459f459d4e0e8c /drivers | |
parent | f94e00847c9eda89c30b96c78d4b08e3fb0cf902 (diff) |
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: Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ide/ide-proc.c | 155 |
1 files changed, 75 insertions, 80 deletions
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c index edd7f186dc4d..5d3562b45039 100644 --- a/drivers/ide/ide-proc.c +++ b/drivers/ide/ide-proc.c | |||
@@ -47,28 +47,28 @@ static int proc_ide_read_imodel | |||
47 | const char *name; | 47 | const char *name; |
48 | 48 | ||
49 | switch (hwif->chipset) { | 49 | switch (hwif->chipset) { |
50 | case ide_generic: name = "generic"; break; | 50 | case ide_generic: name = "generic"; break; |
51 | case ide_pci: name = "pci"; break; | 51 | case ide_pci: name = "pci"; break; |
52 | case ide_cmd640: name = "cmd640"; break; | 52 | case ide_cmd640: name = "cmd640"; break; |
53 | case ide_dtc2278: name = "dtc2278"; break; | 53 | case ide_dtc2278: name = "dtc2278"; break; |
54 | case ide_ali14xx: name = "ali14xx"; break; | 54 | case ide_ali14xx: name = "ali14xx"; break; |
55 | case ide_qd65xx: name = "qd65xx"; break; | 55 | case ide_qd65xx: name = "qd65xx"; break; |
56 | case ide_umc8672: name = "umc8672"; break; | 56 | case ide_umc8672: name = "umc8672"; break; |
57 | case ide_ht6560b: name = "ht6560b"; break; | 57 | case ide_ht6560b: name = "ht6560b"; break; |
58 | case ide_rz1000: name = "rz1000"; break; | 58 | case ide_rz1000: name = "rz1000"; break; |
59 | case ide_trm290: name = "trm290"; break; | 59 | case ide_trm290: name = "trm290"; break; |
60 | case ide_cmd646: name = "cmd646"; break; | 60 | case ide_cmd646: name = "cmd646"; break; |
61 | case ide_cy82c693: name = "cy82c693"; break; | 61 | case ide_cy82c693: name = "cy82c693"; break; |
62 | case ide_4drives: name = "4drives"; break; | 62 | case ide_4drives: name = "4drives"; break; |
63 | case ide_pmac: name = "mac-io"; break; | 63 | case ide_pmac: name = "mac-io"; break; |
64 | case ide_au1xxx: name = "au1xxx"; break; | 64 | case ide_au1xxx: name = "au1xxx"; break; |
65 | case ide_palm3710: name = "palm3710"; break; | 65 | case ide_palm3710: name = "palm3710"; break; |
66 | case ide_etrax100: name = "etrax100"; break; | 66 | case ide_etrax100: name = "etrax100"; break; |
67 | case ide_acorn: name = "acorn"; break; | 67 | case ide_acorn: name = "acorn"; break; |
68 | default: name = "(unknown)"; break; | 68 | default: name = "(unknown)"; break; |
69 | } | 69 | } |
70 | len = sprintf(page, "%s\n", name); | 70 | len = sprintf(page, "%s\n", name); |
71 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); | 71 | PROC_IDE_READ_RETURN(page, start, off, count, eof, len); |
72 | } | 72 | } |
73 | 73 | ||
74 | static int proc_ide_read_mate | 74 | static int proc_ide_read_mate |
@@ -81,7 +81,7 @@ static int proc_ide_read_mate | |||
81 | len = sprintf(page, "%s\n", hwif->mate->name); | 81 | len = sprintf(page, "%s\n", hwif->mate->name); |
82 | else | 82 | else |
83 | len = sprintf(page, "(none)\n"); | 83 | len = sprintf(page, "(none)\n"); |
84 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); | 84 | PROC_IDE_READ_RETURN(page, start, off, count, eof, len); |
85 | } | 85 | } |
86 | 86 | ||
87 | static int proc_ide_read_channel | 87 | static int proc_ide_read_channel |
@@ -93,7 +93,7 @@ static int proc_ide_read_channel | |||
93 | page[0] = hwif->channel ? '1' : '0'; | 93 | page[0] = hwif->channel ? '1' : '0'; |
94 | page[1] = '\n'; | 94 | page[1] = '\n'; |
95 | len = 2; | 95 | len = 2; |
96 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); | 96 | PROC_IDE_READ_RETURN(page, start, off, count, eof, len); |
97 | } | 97 | } |
98 | 98 | ||
99 | static int proc_ide_read_identify | 99 | static int proc_ide_read_identify |
@@ -120,7 +120,7 @@ static int proc_ide_read_identify | |||
120 | len = out - page; | 120 | len = out - page; |
121 | } | 121 | } |
122 | } | 122 | } |
123 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); | 123 | PROC_IDE_READ_RETURN(page, start, off, count, eof, len); |
124 | } | 124 | } |
125 | 125 | ||
126 | /** | 126 | /** |
@@ -197,7 +197,7 @@ EXPORT_SYMBOL(ide_add_setting); | |||
197 | * The caller must hold the setting semaphore. | 197 | * The caller must hold the setting semaphore. |
198 | */ | 198 | */ |
199 | 199 | ||
200 | static void __ide_remove_setting (ide_drive_t *drive, char *name) | 200 | static void __ide_remove_setting(ide_drive_t *drive, char *name) |
201 | { | 201 | { |
202 | ide_settings_t **p, *setting; | 202 | ide_settings_t **p, *setting; |
203 | 203 | ||
@@ -205,7 +205,8 @@ static void __ide_remove_setting (ide_drive_t *drive, char *name) | |||
205 | 205 | ||
206 | while ((*p) && strcmp((*p)->name, name)) | 206 | while ((*p) && strcmp((*p)->name, name)) |
207 | p = &((*p)->next); | 207 | p = &((*p)->next); |
208 | if ((setting = (*p)) == NULL) | 208 | setting = (*p); |
209 | if (setting == NULL) | ||
209 | return; | 210 | return; |
210 | 211 | ||
211 | (*p) = setting->next; | 212 | (*p) = setting->next; |
@@ -223,7 +224,7 @@ static void __ide_remove_setting (ide_drive_t *drive, char *name) | |||
223 | * caller must hold ide_setting_mtx. | 224 | * caller must hold ide_setting_mtx. |
224 | */ | 225 | */ |
225 | 226 | ||
226 | static void auto_remove_settings (ide_drive_t *drive) | 227 | static void auto_remove_settings(ide_drive_t *drive) |
227 | { | 228 | { |
228 | ide_settings_t *setting; | 229 | ide_settings_t *setting; |
229 | repeat: | 230 | repeat: |
@@ -279,16 +280,16 @@ static int ide_read_setting(ide_drive_t *drive, ide_settings_t *setting) | |||
279 | 280 | ||
280 | if ((setting->rw & SETTING_READ)) { | 281 | if ((setting->rw & SETTING_READ)) { |
281 | spin_lock_irqsave(&ide_lock, flags); | 282 | spin_lock_irqsave(&ide_lock, flags); |
282 | switch(setting->data_type) { | 283 | switch (setting->data_type) { |
283 | case TYPE_BYTE: | 284 | case TYPE_BYTE: |
284 | val = *((u8 *) setting->data); | 285 | val = *((u8 *) setting->data); |
285 | break; | 286 | break; |
286 | case TYPE_SHORT: | 287 | case TYPE_SHORT: |
287 | val = *((u16 *) setting->data); | 288 | val = *((u16 *) setting->data); |
288 | break; | 289 | break; |
289 | case TYPE_INT: | 290 | case TYPE_INT: |
290 | val = *((u32 *) setting->data); | 291 | val = *((u32 *) setting->data); |
291 | break; | 292 | break; |
292 | } | 293 | } |
293 | spin_unlock_irqrestore(&ide_lock, flags); | 294 | spin_unlock_irqrestore(&ide_lock, flags); |
294 | } | 295 | } |
@@ -326,15 +327,15 @@ static int ide_write_setting(ide_drive_t *drive, ide_settings_t *setting, int va | |||
326 | if (ide_spin_wait_hwgroup(drive)) | 327 | if (ide_spin_wait_hwgroup(drive)) |
327 | return -EBUSY; | 328 | return -EBUSY; |
328 | switch (setting->data_type) { | 329 | switch (setting->data_type) { |
329 | case TYPE_BYTE: | 330 | case TYPE_BYTE: |
330 | *((u8 *) setting->data) = val; | 331 | *((u8 *) setting->data) = val; |
331 | break; | 332 | break; |
332 | case TYPE_SHORT: | 333 | case TYPE_SHORT: |
333 | *((u16 *) setting->data) = val; | 334 | *((u16 *) setting->data) = val; |
334 | break; | 335 | break; |
335 | case TYPE_INT: | 336 | case TYPE_INT: |
336 | *((u32 *) setting->data) = val; | 337 | *((u32 *) setting->data) = val; |
337 | break; | 338 | break; |
338 | } | 339 | } |
339 | spin_unlock_irq(&ide_lock); | 340 | spin_unlock_irq(&ide_lock); |
340 | return 0; | 341 | return 0; |
@@ -390,7 +391,7 @@ void ide_add_generic_settings (ide_drive_t *drive) | |||
390 | 391 | ||
391 | static void proc_ide_settings_warn(void) | 392 | static void proc_ide_settings_warn(void) |
392 | { | 393 | { |
393 | static int warned = 0; | 394 | static int warned; |
394 | 395 | ||
395 | if (warned) | 396 | if (warned) |
396 | return; | 397 | return; |
@@ -413,11 +414,12 @@ static int proc_ide_read_settings | |||
413 | mutex_lock(&ide_setting_mtx); | 414 | mutex_lock(&ide_setting_mtx); |
414 | out += sprintf(out, "name\t\t\tvalue\t\tmin\t\tmax\t\tmode\n"); | 415 | out += sprintf(out, "name\t\t\tvalue\t\tmin\t\tmax\t\tmode\n"); |
415 | out += sprintf(out, "----\t\t\t-----\t\t---\t\t---\t\t----\n"); | 416 | out += sprintf(out, "----\t\t\t-----\t\t---\t\t---\t\t----\n"); |
416 | while(setting) { | 417 | while (setting) { |
417 | mul_factor = setting->mul_factor; | 418 | mul_factor = setting->mul_factor; |
418 | div_factor = setting->div_factor; | 419 | div_factor = setting->div_factor; |
419 | out += sprintf(out, "%-24s", setting->name); | 420 | out += sprintf(out, "%-24s", setting->name); |
420 | if ((rc = ide_read_setting(drive, setting)) >= 0) | 421 | rc = ide_read_setting(drive, setting); |
422 | if (rc >= 0) | ||
421 | out += sprintf(out, "%-16d", rc * mul_factor / div_factor); | 423 | out += sprintf(out, "%-16d", rc * mul_factor / div_factor); |
422 | else | 424 | else |
423 | out += sprintf(out, "%-16s", "write-only"); | 425 | out += sprintf(out, "%-16s", "write-only"); |
@@ -431,7 +433,7 @@ static int proc_ide_read_settings | |||
431 | } | 433 | } |
432 | len = out - page; | 434 | len = out - page; |
433 | mutex_unlock(&ide_setting_mtx); | 435 | mutex_unlock(&ide_setting_mtx); |
434 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); | 436 | PROC_IDE_READ_RETURN(page, start, off, count, eof, len); |
435 | } | 437 | } |
436 | 438 | ||
437 | #define MAX_LEN 30 | 439 | #define MAX_LEN 30 |
@@ -512,8 +514,7 @@ static int proc_ide_write_settings(struct file *file, const char __user *buffer, | |||
512 | 514 | ||
513 | mutex_lock(&ide_setting_mtx); | 515 | mutex_lock(&ide_setting_mtx); |
514 | setting = ide_find_setting_by_name(drive, name); | 516 | setting = ide_find_setting_by_name(drive, name); |
515 | if (!setting) | 517 | if (!setting) { |
516 | { | ||
517 | mutex_unlock(&ide_setting_mtx); | 518 | mutex_unlock(&ide_setting_mtx); |
518 | goto parse_error; | 519 | goto parse_error; |
519 | } | 520 | } |
@@ -533,8 +534,8 @@ parse_error: | |||
533 | int proc_ide_read_capacity | 534 | int proc_ide_read_capacity |
534 | (char *page, char **start, off_t off, int count, int *eof, void *data) | 535 | (char *page, char **start, off_t off, int count, int *eof, void *data) |
535 | { | 536 | { |
536 | int len = sprintf(page,"%llu\n", (long long)0x7fffffff); | 537 | int len = sprintf(page, "%llu\n", (long long)0x7fffffff); |
537 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); | 538 | PROC_IDE_READ_RETURN(page, start, off, count, eof, len); |
538 | } | 539 | } |
539 | 540 | ||
540 | EXPORT_SYMBOL_GPL(proc_ide_read_capacity); | 541 | EXPORT_SYMBOL_GPL(proc_ide_read_capacity); |
@@ -546,13 +547,13 @@ int proc_ide_read_geometry | |||
546 | char *out = page; | 547 | char *out = page; |
547 | int len; | 548 | int len; |
548 | 549 | ||
549 | out += sprintf(out,"physical %d/%d/%d\n", | 550 | out += sprintf(out, "physical %d/%d/%d\n", |
550 | drive->cyl, drive->head, drive->sect); | 551 | drive->cyl, drive->head, drive->sect); |
551 | out += sprintf(out,"logical %d/%d/%d\n", | 552 | out += sprintf(out, "logical %d/%d/%d\n", |
552 | drive->bios_cyl, drive->bios_head, drive->bios_sect); | 553 | drive->bios_cyl, drive->bios_head, drive->bios_sect); |
553 | 554 | ||
554 | len = out - page; | 555 | len = out - page; |
555 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); | 556 | PROC_IDE_READ_RETURN(page, start, off, count, eof, len); |
556 | } | 557 | } |
557 | 558 | ||
558 | EXPORT_SYMBOL(proc_ide_read_geometry); | 559 | EXPORT_SYMBOL(proc_ide_read_geometry); |
@@ -566,7 +567,7 @@ static int proc_ide_read_dmodel | |||
566 | 567 | ||
567 | len = sprintf(page, "%.40s\n", | 568 | len = sprintf(page, "%.40s\n", |
568 | (id && id->model[0]) ? (char *)id->model : "(none)"); | 569 | (id && id->model[0]) ? (char *)id->model : "(none)"); |
569 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); | 570 | PROC_IDE_READ_RETURN(page, start, off, count, eof, len); |
570 | } | 571 | } |
571 | 572 | ||
572 | static int proc_ide_read_driver | 573 | static int proc_ide_read_driver |
@@ -583,7 +584,7 @@ static int proc_ide_read_driver | |||
583 | dev->driver->name, ide_drv->version); | 584 | dev->driver->name, ide_drv->version); |
584 | } else | 585 | } else |
585 | len = sprintf(page, "ide-default version 0.9.newide\n"); | 586 | len = sprintf(page, "ide-default version 0.9.newide\n"); |
586 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); | 587 | PROC_IDE_READ_RETURN(page, start, off, count, eof, len); |
587 | } | 588 | } |
588 | 589 | ||
589 | static int ide_replace_subdriver(ide_drive_t *drive, const char *driver) | 590 | static int ide_replace_subdriver(ide_drive_t *drive, const char *driver) |
@@ -639,30 +640,26 @@ static int proc_ide_read_media | |||
639 | int len; | 640 | int len; |
640 | 641 | ||
641 | switch (drive->media) { | 642 | switch (drive->media) { |
642 | case ide_disk: media = "disk\n"; | 643 | case ide_disk: media = "disk\n"; break; |
643 | break; | 644 | case ide_cdrom: media = "cdrom\n"; break; |
644 | case ide_cdrom: media = "cdrom\n"; | 645 | case ide_tape: media = "tape\n"; break; |
645 | break; | 646 | case ide_floppy: media = "floppy\n"; break; |
646 | case ide_tape: media = "tape\n"; | 647 | case ide_optical: media = "optical\n"; break; |
647 | break; | 648 | default: media = "UNKNOWN\n"; break; |
648 | case ide_floppy:media = "floppy\n"; | ||
649 | break; | ||
650 | case ide_optical:media = "optical\n"; | ||
651 | break; | ||
652 | default: media = "UNKNOWN\n"; | ||
653 | break; | ||
654 | } | 649 | } |
655 | strcpy(page,media); | 650 | strcpy(page, media); |
656 | len = strlen(media); | 651 | len = strlen(media); |
657 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); | 652 | PROC_IDE_READ_RETURN(page, start, off, count, eof, len); |
658 | } | 653 | } |
659 | 654 | ||
660 | static ide_proc_entry_t generic_drive_entries[] = { | 655 | static ide_proc_entry_t generic_drive_entries[] = { |
661 | { "driver", S_IFREG|S_IRUGO, proc_ide_read_driver, proc_ide_write_driver }, | 656 | { "driver", S_IFREG|S_IRUGO, proc_ide_read_driver, |
662 | { "identify", S_IFREG|S_IRUSR, proc_ide_read_identify, NULL }, | 657 | proc_ide_write_driver }, |
663 | { "media", S_IFREG|S_IRUGO, proc_ide_read_media, NULL }, | 658 | { "identify", S_IFREG|S_IRUSR, proc_ide_read_identify, NULL }, |
664 | { "model", S_IFREG|S_IRUGO, proc_ide_read_dmodel, NULL }, | 659 | { "media", S_IFREG|S_IRUGO, proc_ide_read_media, NULL }, |
665 | { "settings", S_IFREG|S_IRUSR|S_IWUSR,proc_ide_read_settings, proc_ide_write_settings }, | 660 | { "model", S_IFREG|S_IRUGO, proc_ide_read_dmodel, NULL }, |
661 | { "settings", S_IFREG|S_IRUSR|S_IWUSR, proc_ide_read_settings, | ||
662 | proc_ide_write_settings }, | ||
666 | { NULL, 0, NULL, NULL } | 663 | { NULL, 0, NULL, NULL } |
667 | }; | 664 | }; |
668 | 665 | ||
@@ -734,7 +731,6 @@ void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) | |||
734 | spin_unlock_irqrestore(&ide_lock, flags); | 731 | spin_unlock_irqrestore(&ide_lock, flags); |
735 | mutex_unlock(&ide_setting_mtx); | 732 | mutex_unlock(&ide_setting_mtx); |
736 | } | 733 | } |
737 | |||
738 | EXPORT_SYMBOL(ide_proc_unregister_driver); | 734 | EXPORT_SYMBOL(ide_proc_unregister_driver); |
739 | 735 | ||
740 | void ide_proc_port_register_devices(ide_hwif_t *hwif) | 736 | 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 | drive->proc = proc_mkdir(drive->name, parent); | 751 | drive->proc = proc_mkdir(drive->name, parent); |
756 | if (drive->proc) | 752 | if (drive->proc) |
757 | ide_add_proc_entries(drive->proc, generic_drive_entries, drive); | 753 | ide_add_proc_entries(drive->proc, generic_drive_entries, drive); |
758 | sprintf(name,"ide%d/%s", (drive->name[2]-'a')/2, drive->name); | 754 | sprintf(name, "ide%d/%s", (drive->name[2]-'a')/2, drive->name); |
759 | ent = proc_symlink(drive->name, proc_ide_root, name); | 755 | ent = proc_symlink(drive->name, proc_ide_root, name); |
760 | if (!ent) return; | 756 | if (!ent) return; |
761 | } | 757 | } |
@@ -795,7 +791,6 @@ void ide_pci_create_host_proc(const char *name, get_info_t *get_info) | |||
795 | { | 791 | { |
796 | create_proc_info_entry(name, 0, proc_ide_root, get_info); | 792 | create_proc_info_entry(name, 0, proc_ide_root, get_info); |
797 | } | 793 | } |
798 | |||
799 | EXPORT_SYMBOL_GPL(ide_pci_create_host_proc); | 794 | EXPORT_SYMBOL_GPL(ide_pci_create_host_proc); |
800 | #endif | 795 | #endif |
801 | 796 | ||