patch-2.4.0-test6 linux/drivers/char/radio-typhoon.c
Next file: linux/drivers/char/scan_keyb.c
Previous file: linux/drivers/char/planb.c
Back to the patch index
Back to the overall index
- Lines: 44
- Date:
Fri Aug 4 18:36:46 2000
- Orig file:
v2.4.0-test5/linux/drivers/char/radio-typhoon.c
- Orig date:
Tue Nov 23 22:42:20 1999
diff -u --recursive --new-file v2.4.0-test5/linux/drivers/char/radio-typhoon.c linux/drivers/char/radio-typhoon.c
@@ -300,32 +300,26 @@
static int typhoon_get_info(char *buf, char **start, off_t offset, int len)
{
+ char *out = buf;
+
#ifdef MODULE
#define MODULEPROCSTRING "Driver loaded as a module"
#else
#define MODULEPROCSTRING "Driver compiled into kernel"
#endif
- #define LIMIT (PAGE_SIZE - 80)
-
- len = 0;
- len += sprintf(buf + len, BANNER);
- if (len > LIMIT) return len;
- len += sprintf(buf + len, "Load type: " MODULEPROCSTRING "\n\n");
- if (len > LIMIT) return len;
- len += sprintf(buf + len, "frequency = %lu kHz\n",
+ /* output must be kept under PAGE_SIZE */
+ out += sprintf(out, BANNER);
+ out += sprintf(out, "Load type: " MODULEPROCSTRING "\n\n");
+ out += sprintf(out, "frequency = %lu kHz\n",
typhoon_unit.curfreq >> 4);
- if (len > LIMIT) return len;
- len += sprintf(buf + len, "volume = %d\n", typhoon_unit.curvol);
- if (len > LIMIT) return len;
- len += sprintf(buf + len, "mute = %s\n", typhoon_unit.muted ?
+ out += sprintf(out, "volume = %d\n", typhoon_unit.curvol);
+ out += sprintf(out, "mute = %s\n", typhoon_unit.muted ?
"on" : "off");
- if (len > LIMIT) return len;
- len += sprintf(buf + len, "iobase = 0x%x\n", typhoon_unit.iobase);
- if (len > LIMIT) return len;
- len += sprintf(buf + len, "mute frequency = %lu kHz\n",
+ out += sprintf(out, "iobase = 0x%x\n", typhoon_unit.iobase);
+ out += sprintf(out, "mute frequency = %lu kHz\n",
typhoon_unit.mutefreq >> 4);
- return len;
+ return out - buf;
}
#endif /* CONFIG_RADIO_TYPHOON_PROC_FS */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)