Signed-off-by: Marek Belisko <marek.belisko@xxxxxxxxxxxxxxx> --- drivers/staging/ft1000/ft1000-usb/ft1000_proc.c | 58 ++++++++++++---------- 1 files changed, 32 insertions(+), 26 deletions(-) diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c b/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c index b87542a..a012bdd 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c @@ -30,28 +30,34 @@ #define FT1000_PROC_DIR "ft1000" -#define PUTM_TO_PAGE(len,page,args...) \ - len += snprintf(page+len, PAGE_SIZE - len, args) - -#define PUTX_TO_PAGE(len,page,message,size,var) \ - len += snprintf(page+len, PAGE_SIZE - len, message); \ - for (i = 0; i < (size - 1); i++) {\ - len += snprintf(page+len, PAGE_SIZE - len, "%02x:", var[i]); \ - } \ - len += snprintf(page+len, PAGE_SIZE - len, "%02x\n", var[i]) - -#define PUTD_TO_PAGE(len,page,message,size,var) \ - len += snprintf(page+len, PAGE_SIZE - len, message); \ - for (i = 0; i < (size - 1); i++) {\ - len += snprintf(page+len, PAGE_SIZE - len, "%d.", var[i]); \ - } \ - len += snprintf(page+len, PAGE_SIZE - len, "%d\n", var[i]) +#define PUTM_TO_PAGE(len, page, args...) \ + (len += snprintf(page+len, PAGE_SIZE - len, args)) + +#define PUTX_TO_PAGE(len, page, message, size, var) \ + do { \ + len += snprintf(page+len, PAGE_SIZE - len, message); \ + for (i = 0; i < (size - 1); i++) {\ + len += snprintf(page+len, PAGE_SIZE - len, "%02x:", \ + var[i]); \ + } \ + len += snprintf(page+len, PAGE_SIZE - len, "%02x\n", var[i]); \ + } while (0) + +#define PUTD_TO_PAGE(len, page, message, size, var) \ + do { \ + len += snprintf(page+len, PAGE_SIZE - len, message); \ + for (i = 0; i < (size - 1); i++) {\ + len += snprintf(page+len, PAGE_SIZE - len, "%d.", \ + var[i]); \ + } \ + len += snprintf(page+len, PAGE_SIZE - len, "%d\n", var[i]); \ + } while (0) #define FTNET_PROC init_net.proc_net -u16 ft1000_read_dpram16 (struct ft1000_device *ft1000dev, u16 indx, +u16 ft1000_read_dpram16(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer, u8 highlow); @@ -67,8 +73,8 @@ ft1000ReadProc(char *page, char **start, off_t off, int count, int *eof, struct ft1000_info *info; - char *status[] = { - "Idle (Disconnect)", + char *status[] = { + "Idle (Disconnect)", "Searching", "Active (Connected)", "Waiting for L2", @@ -146,24 +152,24 @@ ft1000ReadProc(char *page, char **start, off_t off, int count, int *eof, len = 0; PUTM_TO_PAGE(len, page, "Connection Time: %02ld:%02ld:%02ld\n", - ((delta / 3600) % 24), ((delta / 60) % 60), (delta % 60)); + ((delta / 3600) % 24), ((delta / 60) % 60), (delta % 60)); PUTM_TO_PAGE(len, page, "Connection Time[s]: %ld\n", delta); PUTM_TO_PAGE(len, page, "Asic ID: %s\n", - (info->AsicID) == - ELECTRABUZZ_ID ? "ELECTRABUZZ ASIC" : "MAGNEMITE ASIC"); + (info->AsicID) == + ELECTRABUZZ_ID ? "ELECTRABUZZ ASIC" : "MAGNEMITE ASIC"); PUTX_TO_PAGE(len, page, "SKU: ", SKUSZ, info->Sku); PUTX_TO_PAGE(len, page, "EUI64: ", EUISZ, info->eui64); PUTD_TO_PAGE(len, page, "DSP version number: ", DSPVERSZ, info->DspVer); PUTX_TO_PAGE(len, page, "Hardware Serial Number: ", HWSERNUMSZ, - info->HwSerNum); + info->HwSerNum); PUTX_TO_PAGE(len, page, "Caliberation Version: ", CALVERSZ, - info->RfCalVer); + info->RfCalVer); PUTD_TO_PAGE(len, page, "Caliberation Date: ", CALDATESZ, info->RfCalDate); PUTM_TO_PAGE(len, page, "Media State: %s\n", - (info->mediastate) ? "link" : "no link"); + (info->mediastate) ? "link" : "no link"); PUTM_TO_PAGE(len, page, "Connection Status: %s\n", - status[((info->ConStat) & 0x7)]); + status[((info->ConStat) & 0x7)]); PUTM_TO_PAGE(len, page, "RX packets: %ld\n", info->stats.rx_packets); PUTM_TO_PAGE(len, page, "TX packets: %ld\n", info->stats.tx_packets); PUTM_TO_PAGE(len, page, "RX bytes: %ld\n", info->stats.rx_bytes); -- 1.7.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel