aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/nvram.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@nuerscht.ch>2006-01-09 23:54:02 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-10 11:01:56 -0500
commitfe971071a89c5c5184fc9f3482c7a8e997cf0520 (patch)
tree74a29e80d5636255f33c750482497a32d8d3491f /drivers/char/nvram.c
parent3c6bee1d4037a5c569f30d40bd852a57ba250912 (diff)
[PATCH] drivers/char: Use ARRAY_SIZE macro
Use ARRAY_SIZE macro instead of sizeof(x)/sizeof(x[0]) and remove duplicates of ARRAY_SIZE. Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/nvram.c')
-rw-r--r--drivers/char/nvram.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c
index 1af733d07321..3556ccd77570 100644
--- a/drivers/char/nvram.c
+++ b/drivers/char/nvram.c
@@ -557,13 +557,13 @@ pc_proc_infos(unsigned char *nvram, char *buffer, int *len,
557 (nvram[6] & 1) ? (nvram[6] >> 6) + 1 : 0); 557 (nvram[6] & 1) ? (nvram[6] >> 6) + 1 : 0);
558 PRINT_PROC("Floppy 0 type : "); 558 PRINT_PROC("Floppy 0 type : ");
559 type = nvram[2] >> 4; 559 type = nvram[2] >> 4;
560 if (type < sizeof (floppy_types) / sizeof (*floppy_types)) 560 if (type < ARRAY_SIZE(floppy_types))
561 PRINT_PROC("%s\n", floppy_types[type]); 561 PRINT_PROC("%s\n", floppy_types[type]);
562 else 562 else
563 PRINT_PROC("%d (unknown)\n", type); 563 PRINT_PROC("%d (unknown)\n", type);
564 PRINT_PROC("Floppy 1 type : "); 564 PRINT_PROC("Floppy 1 type : ");
565 type = nvram[2] & 0x0f; 565 type = nvram[2] & 0x0f;
566 if (type < sizeof (floppy_types) / sizeof (*floppy_types)) 566 if (type < ARRAY_SIZE(floppy_types))
567 PRINT_PROC("%s\n", floppy_types[type]); 567 PRINT_PROC("%s\n", floppy_types[type]);
568 else 568 else
569 PRINT_PROC("%d (unknown)\n", type); 569 PRINT_PROC("%d (unknown)\n", type);
@@ -843,8 +843,6 @@ static char *colors[] = {
843 "2", "4", "16", "256", "65536", "??", "??", "??" 843 "2", "4", "16", "256", "65536", "??", "??", "??"
844}; 844};
845 845
846#define fieldsize(a) (sizeof(a)/sizeof(*a))
847
848static int 846static int
849atari_proc_infos(unsigned char *nvram, char *buffer, int *len, 847atari_proc_infos(unsigned char *nvram, char *buffer, int *len,
850 off_t *begin, off_t offset, int size) 848 off_t *begin, off_t offset, int size)
@@ -856,7 +854,7 @@ atari_proc_infos(unsigned char *nvram, char *buffer, int *len,
856 PRINT_PROC("Checksum status : %svalid\n", checksum ? "" : "not "); 854 PRINT_PROC("Checksum status : %svalid\n", checksum ? "" : "not ");
857 855
858 PRINT_PROC("Boot preference : "); 856 PRINT_PROC("Boot preference : ");
859 for (i = fieldsize(boot_prefs) - 1; i >= 0; --i) { 857 for (i = ARRAY_SIZE(boot_prefs) - 1; i >= 0; --i) {
860 if (nvram[1] == boot_prefs[i].val) { 858 if (nvram[1] == boot_prefs[i].val) {
861 PRINT_PROC("%s\n", boot_prefs[i].name); 859 PRINT_PROC("%s\n", boot_prefs[i].name);
862 break; 860 break;
@@ -878,12 +876,12 @@ atari_proc_infos(unsigned char *nvram, char *buffer, int *len,
878 return 1; 876 return 1;
879 877
880 PRINT_PROC("OS language : "); 878 PRINT_PROC("OS language : ");
881 if (nvram[6] < fieldsize(languages)) 879 if (nvram[6] < ARRAY_SIZE(languages))
882 PRINT_PROC("%s\n", languages[nvram[6]]); 880 PRINT_PROC("%s\n", languages[nvram[6]]);
883 else 881 else
884 PRINT_PROC("%u (undefined)\n", nvram[6]); 882 PRINT_PROC("%u (undefined)\n", nvram[6]);
885 PRINT_PROC("Keyboard language: "); 883 PRINT_PROC("Keyboard language: ");
886 if (nvram[7] < fieldsize(languages)) 884 if (nvram[7] < ARRAY_SIZE(languages))
887 PRINT_PROC("%s\n", languages[nvram[7]]); 885 PRINT_PROC("%s\n", languages[nvram[7]]);
888 else 886 else
889 PRINT_PROC("%u (undefined)\n", nvram[7]); 887 PRINT_PROC("%u (undefined)\n", nvram[7]);