From 85d47cff4ea2ab0d5380ba649ac4515d1a5bcf23 Mon Sep 17 00:00:00 2001 From: Marek Belisko Date: Thu, 9 Dec 2010 16:13:51 +0100 Subject: [PATCH] staging: ft1000: Coding style fix in ft1000ReadProc. Signed-off-by: Marek Belisko Signed-off-by: Greg Kroah-Hartman --- .../staging/ft1000/ft1000-usb/ft1000_proc.c | 216 +++++++++--------- 1 file changed, 106 insertions(+), 110 deletions(-) diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c b/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c index c3fca23d551c..773316fcecd7 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c @@ -43,126 +43,122 @@ u16 ft1000_read_dpram16 (struct ft1000_device *ft1000dev, u16 indx, static int -ft1000ReadProc (char *page, char **start, off_t off, int count, int *eof, +ft1000ReadProc(char *page, char **start, off_t off, int count, int *eof, void *data) { - struct net_device *dev; - int len; - int i; - unsigned short ledStat; - unsigned short conStat; + struct net_device *dev; + int len; + int i; + unsigned short ledStat; + unsigned short conStat; struct ft1000_info *info; - char *status[] = { "Idle (Disconnect)", "Searching", "Active (Connected)", - "Waiting for L2", "Sleep", "No Coverage", "", "" - }; - - char *signal[] = { "", "*", "**", "***", "****" }; - int strength; - int quality; - struct timeval tv; - time_t delta; - - dev = (struct net_device *) data; + char *status[] = { + "Idle (Disconnect)", + "Searching", + "Active (Connected)", + "Waiting for L2", + "Sleep", + "No Coverage", + "", + "", + }; + + char *signal[] = { "", "*", "**", "***", "****" }; + int strength; + int quality; + struct timeval tv; + time_t delta; + + dev = (struct net_device *) data; info = netdev_priv(dev); - if (off > 0) - { - *eof = 1; - return 0; - } + if (off > 0) { + *eof = 1; + return 0; + } - if (info->ProgConStat != 0xFF) - { - ft1000_read_dpram16 (info->pFt1000Dev, FT1000_MAG_DSP_LED, + if (info->ProgConStat != 0xFF) { + ft1000_read_dpram16(info->pFt1000Dev, FT1000_MAG_DSP_LED, (u8 *)&ledStat, FT1000_MAG_DSP_LED_INDX); - info->LedStat = ntohs (ledStat); - - ft1000_read_dpram16 (info->pFt1000Dev, FT1000_MAG_DSP_CON_STATE, - (u8 *)&conStat, FT1000_MAG_DSP_CON_STATE_INDX); - info->ConStat = ntohs (conStat); - do_gettimeofday (&tv); - delta = (tv.tv_sec - info->ConTm); - } - else - { - info->ConStat = 0xf; - delta = 0; - } - - - - i = (info->LedStat) & 0xf; - switch (i) - { - case 0x1: - strength = 1; - break; - case 0x3: - strength = 2; - break; - case 0x7: - strength = 3; - break; - case 0xf: - strength = 4; - break; - default: - strength = 0; - } - - i = (info->LedStat >> 8) & 0xf; - switch (i) - { - case 0x1: - quality = 1; - break; - case 0x3: - quality = 2; - break; - case 0x7: - quality = 3; - break; - case 0xf: - quality = 4; - break; - default: - quality = 0; - } - - - len = 0; - PUTM_TO_PAGE (len, page, "Connection Time: %02ld:%02ld:%02ld\n", - ((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"); - 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); - PUTX_TO_PAGE (len, page, "Caliberation Version: ", CALVERSZ, - 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"); - PUTM_TO_PAGE (len, page, "Connection Status: %s\n", - 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); - PUTM_TO_PAGE (len, page, "TX bytes: %ld\n", info->stats.tx_bytes); - PUTM_TO_PAGE (len, page, "Signal Strength: %s\n", signal[strength]); - PUTM_TO_PAGE (len, page, "Signal Quality: %s\n", signal[quality]); - - - - - return len; + info->LedStat = ntohs(ledStat); + + ft1000_read_dpram16(info->pFt1000Dev, FT1000_MAG_DSP_CON_STATE, + (u8 *)&conStat, FT1000_MAG_DSP_CON_STATE_INDX); + info->ConStat = ntohs(conStat); + do_gettimeofday(&tv); + delta = (tv.tv_sec - info->ConTm); + } else { + info->ConStat = 0xf; + delta = 0; + } + + i = (info->LedStat) & 0xf; + switch (i) { + case 0x1: + strength = 1; + break; + case 0x3: + strength = 2; + break; + case 0x7: + strength = 3; + break; + case 0xf: + strength = 4; + break; + default: + strength = 0; + } + + i = (info->LedStat >> 8) & 0xf; + switch (i) { + case 0x1: + quality = 1; + break; + case 0x3: + quality = 2; + break; + case 0x7: + quality = 3; + break; + case 0xf: + quality = 4; + break; + default: + quality = 0; + } + + len = 0; + PUTM_TO_PAGE(len, page, "Connection Time: %02ld:%02ld:%02ld\n", + ((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"); + 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); + PUTX_TO_PAGE(len, page, "Caliberation Version: ", CALVERSZ, + 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"); + PUTM_TO_PAGE(len, page, "Connection Status: %s\n", + 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); + PUTM_TO_PAGE(len, page, "TX bytes: %ld\n", info->stats.tx_bytes); + PUTM_TO_PAGE(len, page, "Signal Strength: %s\n", signal[strength]); + PUTM_TO_PAGE(len, page, "Signal Quality: %s\n", signal[quality]); + + return len; } static int -- 2.39.5