Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: ft1000: remove procfs entries

This patch started as a fix to some checkpatch complaints in ft1000
procfs code but Greg suggested to remove the procfs entries altogether:

http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2014-July/055594.html

Signed-off-by: Nicolas Thery <nthery@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Nicolas Thery and committed by
Greg Kroah-Hartman
6b5886f8 e6be8e63

+2 -474
+1 -2
drivers/staging/ft1000/ft1000-pcmcia/Makefile
··· 1 1 obj-$(CONFIG_FT1000_PCMCIA) = ft1000_pcmcia.o 2 - ft1000_pcmcia-y := ft1000_hw.o ft1000_dnld.o ft1000_proc.o ft1000_cs.o 3 - 2 + ft1000_pcmcia-y := ft1000_hw.o ft1000_dnld.o ft1000_cs.o
-2
drivers/staging/ft1000/ft1000-pcmcia/ft1000.h
··· 47 47 extern void stop_ft1000_card(struct net_device *dev); 48 48 extern int card_download(struct net_device *dev, const u8 *pFileStart, 49 49 size_t FileLength); 50 - extern void ft1000InitProc(struct net_device *dev); 51 - extern void ft1000CleanupProc(struct net_device *dev); 52 50 53 51 extern u16 ft1000_read_dpram(struct net_device *dev, int offset); 54 52 extern void card_bootload(struct net_device *dev);
-4
drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
··· 19 19 20 20 #include <linux/kernel.h> 21 21 #include <linux/module.h> 22 - #include <linux/proc_fs.h> 23 - 24 22 #include <linux/sched.h> 25 23 #include <linux/ptrace.h> 26 24 #include <linux/slab.h> ··· 2100 2102 release_region(dev->base_addr,256); 2101 2103 release_firmware(fw_entry); 2102 2104 flarion_ft1000_cnt--; 2103 - ft1000CleanupProc(dev); 2104 2105 2105 2106 } 2106 2107 ··· 2244 2247 2245 2248 ft1000_enable_interrupts(dev); 2246 2249 2247 - ft1000InitProc(dev); 2248 2250 ft1000_card_present = 1; 2249 2251 dev->ethtool_ops = &ops; 2250 2252 printk(KERN_INFO "ft1000: %s: addr 0x%04lx irq %d, MAC addr %pM\n",
-211
drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c
··· 1 - /*--------------------------------------------------------------------------- 2 - FT1000 driver for Flarion Flash OFDM NIC Device 3 - 4 - Copyright (C) 2006 Patrik Ostrihon, All rights reserved. 5 - Copyright (C) 2006 ProWeb Consulting, a.s, All rights reserved. 6 - 7 - This program is free software; you can redistribute it and/or modify it 8 - under the terms of the GNU General Public License as published by the Free 9 - Software Foundation; either version 2 of the License, or (at your option) any 10 - later version. This program is distributed in the hope that it will be useful, 11 - but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 - more details. You should have received a copy of the GNU General Public 14 - License along with this program; if not, write to the 15 - Free Software Foundation, Inc., 59 Temple Place - 16 - Suite 330, Boston, MA 02111-1307, USA. 17 - -----------------------------------------------------------------------------*/ 18 - 19 - #include <linux/module.h> 20 - #include <linux/kernel.h> 21 - #include <linux/proc_fs.h> 22 - #include <linux/seq_file.h> 23 - #include <linux/string.h> 24 - #include <linux/vmalloc.h> 25 - #include <linux/netdevice.h> 26 - #include <asm/io.h> 27 - #include <asm/uaccess.h> 28 - #include "ft1000.h" 29 - 30 - #define FT1000_PROC "ft1000" 31 - #define MAX_FILE_LEN 255 32 - 33 - #define seq_putx(m, message, size, var) \ 34 - seq_printf(m, message); \ 35 - for (i = 0; i < (size - 1); i++) { \ 36 - seq_printf(m, "%02x:", var[i]); \ 37 - } \ 38 - seq_printf(m, "%02x\n", var[i]) 39 - 40 - #define seq_putd(m, message, size, var) \ 41 - seq_printf(m, message); \ 42 - for (i = 0; i < (size - 1); i++) { \ 43 - seq_printf(m, "%d.", var[i]); \ 44 - } \ 45 - seq_printf(m, "%d\n", var[i]) 46 - 47 - static int ft1000ReadProc(struct seq_file *m, void *v) 48 - { 49 - static const char *status[] = { 50 - "Idle (Disconnect)", "Searching", "Active (Connected)", 51 - "Waiting for L2", "Sleep", "No Coverage", "", "" 52 - }; 53 - static const char *signal[] = { "", "*", "**", "***", "****" }; 54 - 55 - struct net_device *dev = m->private; 56 - struct ft1000_info *info = netdev_priv(dev); 57 - int i; 58 - int strength; 59 - int quality; 60 - struct timeval tv; 61 - time_t delta; 62 - 63 - if (info->AsicID == ELECTRABUZZ_ID) { 64 - if (info->ProgConStat != 0xFF) { 65 - info->LedStat = 66 - ft1000_read_dpram(dev, FT1000_DSP_LED); 67 - info->ConStat = 68 - ft1000_read_dpram(dev, FT1000_DSP_CON_STATE); 69 - } else { 70 - info->ConStat = 0xf; 71 - } 72 - } else { 73 - if (info->ProgConStat != 0xFF) { 74 - info->LedStat = 75 - ntohs(ft1000_read_dpram_mag_16( 76 - dev, FT1000_MAG_DSP_LED, 77 - FT1000_MAG_DSP_LED_INDX)); 78 - info->ConStat = 79 - ntohs(ft1000_read_dpram_mag_16( 80 - dev, FT1000_MAG_DSP_CON_STATE, 81 - FT1000_MAG_DSP_CON_STATE_INDX)); 82 - } else { 83 - info->ConStat = 0xf; 84 - } 85 - } 86 - 87 - i = (info->LedStat) & 0xf; 88 - switch (i) { 89 - case 0x1: 90 - strength = 1; 91 - break; 92 - case 0x3: 93 - strength = 2; 94 - break; 95 - case 0x7: 96 - strength = 3; 97 - break; 98 - case 0xf: 99 - strength = 4; 100 - break; 101 - default: 102 - strength = 0; 103 - } 104 - 105 - i = (info->LedStat >> 8) & 0xf; 106 - switch (i) { 107 - case 0x1: 108 - quality = 1; 109 - break; 110 - case 0x3: 111 - quality = 2; 112 - break; 113 - case 0x7: 114 - quality = 3; 115 - break; 116 - case 0xf: 117 - quality = 4; 118 - break; 119 - default: 120 - quality = 0; 121 - } 122 - 123 - do_gettimeofday(&tv); 124 - delta = tv.tv_sec - info->ConTm; 125 - seq_printf(m, "Connection Time: %02ld:%02ld:%02ld\n", 126 - ((delta / 3600) % 24), ((delta / 60) % 60), (delta % 60)); 127 - seq_printf(m, "Connection Time[s]: %ld\n", delta); 128 - seq_printf(m, "Asic ID: %s\n", 129 - info->AsicID == 130 - ELECTRABUZZ_ID ? "ELECTRABUZZ ASIC" : "MAGNEMITE ASIC"); 131 - seq_putx(m, "SKU: ", SKUSZ, info->Sku); 132 - seq_putx(m, "EUI64: ", EUISZ, info->eui64); 133 - seq_putd(m, "DSP version number: ", DSPVERSZ, info->DspVer); 134 - seq_putx(m, "Hardware Serial Number: ", HWSERNUMSZ, info->HwSerNum); 135 - seq_putx(m, "Caliberation Version: ", CALVERSZ, info->RfCalVer); 136 - seq_putd(m, "Caliberation Date: ", CALDATESZ, info->RfCalDate); 137 - seq_printf(m, "Media State: %s\n", 138 - (info->mediastate) ? "link" : "no link"); 139 - seq_printf(m, "Connection Status: %s\n", status[info->ConStat & 0x7]); 140 - seq_printf(m, "RX packets: %ld\n", info->stats.rx_packets); 141 - seq_printf(m, "TX packets: %ld\n", info->stats.tx_packets); 142 - seq_printf(m, "RX bytes: %ld\n", info->stats.rx_bytes); 143 - seq_printf(m, "TX bytes: %ld\n", info->stats.tx_bytes); 144 - seq_printf(m, "Signal Strength: %s\n", signal[strength]); 145 - seq_printf(m, "Signal Quality: %s\n", signal[quality]); 146 - return 0; 147 - } 148 - 149 - /* 150 - * seq_file wrappers for procfile show routines. 151 - */ 152 - static int ft1000_proc_open(struct inode *inode, struct file *file) 153 - { 154 - return single_open(file, ft1000ReadProc, PDE_DATA(inode)); 155 - } 156 - 157 - static const struct file_operations ft1000_proc_fops = { 158 - .open = ft1000_proc_open, 159 - .read = seq_read, 160 - .llseek = seq_lseek, 161 - .release = single_release, 162 - }; 163 - 164 - static int ft1000NotifyProc(struct notifier_block *this, unsigned long event, 165 - void *ptr) 166 - { 167 - struct net_device *dev = netdev_notifier_info_to_dev(ptr); 168 - struct ft1000_info *info; 169 - 170 - info = netdev_priv(dev); 171 - 172 - switch (event) { 173 - case NETDEV_CHANGENAME: 174 - remove_proc_entry(info->netdevname, info->ft1000_proc_dir); 175 - proc_create_data(dev->name, 0644, info->ft1000_proc_dir, 176 - &ft1000_proc_fops, dev); 177 - snprintf(info->netdevname, IFNAMSIZ, "%s", dev->name); 178 - break; 179 - } 180 - return NOTIFY_DONE; 181 - } 182 - 183 - static struct notifier_block ft1000_netdev_notifier = { 184 - .notifier_call = ft1000NotifyProc 185 - }; 186 - 187 - void ft1000InitProc(struct net_device *dev) 188 - { 189 - struct ft1000_info *info; 190 - 191 - info = netdev_priv(dev); 192 - 193 - info->ft1000_proc_dir = proc_mkdir(FT1000_PROC, init_net.proc_net); 194 - 195 - proc_create_data(dev->name, 0644, info->ft1000_proc_dir, 196 - &ft1000_proc_fops, dev); 197 - 198 - snprintf(info->netdevname, IFNAMSIZ, "%s", dev->name); 199 - register_netdevice_notifier(&ft1000_netdev_notifier); 200 - } 201 - 202 - void ft1000CleanupProc(struct net_device *dev) 203 - { 204 - struct ft1000_info *info; 205 - 206 - info = netdev_priv(dev); 207 - 208 - remove_proc_entry(dev->name, info->ft1000_proc_dir); 209 - remove_proc_entry(FT1000_PROC, init_net.proc_net); 210 - unregister_netdevice_notifier(&ft1000_netdev_notifier); 211 - }
+1 -1
drivers/staging/ft1000/ft1000-usb/Makefile
··· 1 1 obj-$(CONFIG_FT1000_USB) += ft1000.o 2 2 3 - ft1000-y := ft1000_debug.o ft1000_download.o ft1000_hw.o ft1000_proc.o ft1000_usb.o 3 + ft1000-y := ft1000_debug.o ft1000_download.o ft1000_hw.o ft1000_usb.o
-241
drivers/staging/ft1000/ft1000-usb/ft1000_proc.c
··· 1 - /* 2 - * ft1000_proc.c - ft1000 proc interface 3 - * 4 - * Copyright (C) 2009-2010 Quintec 5 - * (C) 2010 Open-nandra 6 - * <marek.belisko@open-nandra.com> 7 - * 8 - * This file is subject to the terms and conditions of the GNU General 9 - * Public License. See the file "COPYING" in the main directory of this 10 - * archive for more details. 11 - * 12 - * This program is distributed in the hope that it will be useful, 13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 - * GNU General Public License for more details. 16 - * 17 - * You should have received a copy of the GNU General Public License 18 - * along with this program; if not, write to the Free Software 19 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 - */ 21 - 22 - #include <linux/module.h> 23 - #include <linux/kernel.h> 24 - #include <linux/proc_fs.h> 25 - #include <linux/seq_file.h> 26 - #include <linux/netdevice.h> 27 - 28 - 29 - #include "ft1000_usb.h" 30 - 31 - #define FT1000_PROC_DIR "ft1000" 32 - 33 - 34 - #define seq_putx(m, message, size, var) \ 35 - do { \ 36 - seq_printf(m, message); \ 37 - for (i = 0; i < (size - 1); i++) \ 38 - seq_printf(m, "%02x:", var[i]); \ 39 - seq_printf(m, "%02x\n", var[i]); \ 40 - } while (0) 41 - 42 - #define seq_putd(m, message, size, var) \ 43 - do { \ 44 - seq_printf(m, message); \ 45 - for (i = 0; i < (size - 1); i++) \ 46 - seq_printf(m, "%d.", var[i]); \ 47 - seq_printf(m, "%d\n", var[i]); \ 48 - } while (0) 49 - 50 - #define FTNET_PROC init_net.proc_net 51 - 52 - 53 - int ft1000_read_dpram16(struct ft1000_usb *ft1000dev, u16 indx, 54 - u8 *buffer, u8 highlow); 55 - 56 - 57 - static int ft1000ReadProc(struct seq_file *m, void *v) 58 - { 59 - static const char *status[] = { 60 - "Idle (Disconnect)", 61 - "Searching", 62 - "Active (Connected)", 63 - "Waiting for L2", 64 - "Sleep", 65 - "No Coverage", 66 - "", 67 - "", 68 - }; 69 - static const char *signal[] = { "", "*", "**", "***", "****" }; 70 - 71 - struct net_device *dev = m->private; 72 - struct ft1000_info *info = netdev_priv(dev); 73 - int i; 74 - unsigned short ledStat; 75 - unsigned short conStat; 76 - int strength; 77 - int quality; 78 - struct timeval tv; 79 - time_t delta; 80 - 81 - if (info->ProgConStat != 0xFF) { 82 - ft1000_read_dpram16(info->priv, FT1000_MAG_DSP_LED, 83 - (u8 *)&ledStat, FT1000_MAG_DSP_LED_INDX); 84 - info->LedStat = ntohs(ledStat); 85 - 86 - ft1000_read_dpram16(info->priv, FT1000_MAG_DSP_CON_STATE, 87 - (u8 *)&conStat, FT1000_MAG_DSP_CON_STATE_INDX); 88 - info->ConStat = ntohs(conStat); 89 - do_gettimeofday(&tv); 90 - delta = (tv.tv_sec - info->ConTm); 91 - } else { 92 - info->ConStat = 0xf; 93 - delta = 0; 94 - } 95 - 96 - i = (info->LedStat) & 0xf; 97 - switch (i) { 98 - case 0x1: 99 - strength = 1; 100 - break; 101 - case 0x3: 102 - strength = 2; 103 - break; 104 - case 0x7: 105 - strength = 3; 106 - break; 107 - case 0xf: 108 - strength = 4; 109 - break; 110 - default: 111 - strength = 0; 112 - } 113 - 114 - i = (info->LedStat >> 8) & 0xf; 115 - switch (i) { 116 - case 0x1: 117 - quality = 1; 118 - break; 119 - case 0x3: 120 - quality = 2; 121 - break; 122 - case 0x7: 123 - quality = 3; 124 - break; 125 - case 0xf: 126 - quality = 4; 127 - break; 128 - default: 129 - quality = 0; 130 - } 131 - 132 - seq_printf(m, "Connection Time: %02ld:%02ld:%02ld\n", 133 - ((delta / 3600) % 24), ((delta / 60) % 60), (delta % 60)); 134 - seq_printf(m, "Connection Time[s]: %ld\n", delta); 135 - seq_printf(m, "Asic ID: %s\n", 136 - (info->AsicID) == ELECTRABUZZ_ID ? "ELECTRABUZZ ASIC" : "MAGNEMITE ASIC"); 137 - seq_putx(m, "SKU: ", SKUSZ, info->Sku); 138 - seq_putx(m, "EUI64: ", EUISZ, info->eui64); 139 - seq_putd(m, "DSP version number: ", DSPVERSZ, info->DspVer); 140 - seq_putx(m, "Hardware Serial Number: ", HWSERNUMSZ, info->HwSerNum); 141 - seq_putx(m, "Caliberation Version: ", CALVERSZ, info->RfCalVer); 142 - seq_putd(m, "Caliberation Date: ", CALDATESZ, info->RfCalDate); 143 - seq_printf(m, "Media State: %s\n", (info->mediastate) ? "link" : "no link"); 144 - seq_printf(m, "Connection Status: %s\n", status[info->ConStat & 0x7]); 145 - seq_printf(m, "RX packets: %ld\n", info->stats.rx_packets); 146 - seq_printf(m, "TX packets: %ld\n", info->stats.tx_packets); 147 - seq_printf(m, "RX bytes: %ld\n", info->stats.rx_bytes); 148 - seq_printf(m, "TX bytes: %ld\n", info->stats.tx_bytes); 149 - seq_printf(m, "Signal Strength: %s\n", signal[strength]); 150 - seq_printf(m, "Signal Quality: %s\n", signal[quality]); 151 - return 0; 152 - } 153 - 154 - /* 155 - * seq_file wrappers for procfile show routines. 156 - */ 157 - static int ft1000_proc_open(struct inode *inode, struct file *file) 158 - { 159 - return single_open(file, ft1000ReadProc, PDE_DATA(inode)); 160 - } 161 - 162 - static const struct file_operations ft1000_proc_fops = { 163 - .open = ft1000_proc_open, 164 - .read = seq_read, 165 - .llseek = seq_lseek, 166 - .release = single_release, 167 - }; 168 - 169 - static int 170 - ft1000NotifyProc(struct notifier_block *this, unsigned long event, void *ptr) 171 - { 172 - struct net_device *dev = netdev_notifier_info_to_dev(ptr); 173 - struct ft1000_info *info; 174 - struct proc_dir_entry *ft1000_proc_file; 175 - 176 - info = netdev_priv(dev); 177 - 178 - switch (event) { 179 - case NETDEV_CHANGENAME: 180 - remove_proc_entry(info->netdevname, info->ft1000_proc_dir); 181 - ft1000_proc_file = 182 - proc_create_data(dev->name, 0644, info->ft1000_proc_dir, 183 - &ft1000_proc_fops, dev); 184 - snprintf(info->netdevname, IFNAMSIZ, "%s", dev->name); 185 - break; 186 - } 187 - 188 - return NOTIFY_DONE; 189 - } 190 - 191 - static struct notifier_block ft1000_netdev_notifier = { 192 - .notifier_call = ft1000NotifyProc, 193 - }; 194 - 195 - 196 - int ft1000_init_proc(struct net_device *dev) 197 - { 198 - struct ft1000_info *info; 199 - struct proc_dir_entry *ft1000_proc_file; 200 - int ret = -EINVAL; 201 - 202 - info = netdev_priv(dev); 203 - 204 - info->ft1000_proc_dir = proc_mkdir(FT1000_PROC_DIR, FTNET_PROC); 205 - if (info->ft1000_proc_dir == NULL) { 206 - netdev_warn(dev, "Unable to create %s dir.\n", 207 - FT1000_PROC_DIR); 208 - goto fail; 209 - } 210 - 211 - ft1000_proc_file = 212 - proc_create_data(dev->name, 0644, info->ft1000_proc_dir, 213 - &ft1000_proc_fops, dev); 214 - 215 - if (!ft1000_proc_file) { 216 - netdev_warn(dev, "Unable to create /proc entry.\n"); 217 - goto fail_entry; 218 - } 219 - 220 - snprintf(info->netdevname, IFNAMSIZ, "%s", dev->name); 221 - 222 - ret = register_netdevice_notifier(&ft1000_netdev_notifier); 223 - if (ret) 224 - goto fail_notif; 225 - 226 - return 0; 227 - 228 - fail_notif: 229 - remove_proc_entry(info->netdevname, info->ft1000_proc_dir); 230 - fail_entry: 231 - remove_proc_entry(FT1000_PROC_DIR, FTNET_PROC); 232 - fail: 233 - return ret; 234 - } 235 - 236 - void ft1000_cleanup_proc(struct ft1000_info *info) 237 - { 238 - remove_proc_entry(info->netdevname, info->ft1000_proc_dir); 239 - remove_proc_entry(FT1000_PROC_DIR, FTNET_PROC); 240 - unregister_netdevice_notifier(&ft1000_netdev_notifier); 241 - }
-8
drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
··· 196 196 if (ret) 197 197 goto err_thread; 198 198 199 - ret = ft1000_init_proc(ft1000dev->net); 200 - if (ret) 201 - goto err_proc; 202 - 203 199 ft1000dev->NetDevRegDone = 1; 204 200 205 201 return 0; 206 202 207 - err_proc: 208 - unregister_netdev(ft1000dev->net); 209 - free_netdev(ft1000dev->net); 210 203 err_thread: 211 204 kthread_stop(ft1000dev->pPollThread); 212 205 err_load: ··· 223 230 224 231 if (pft1000info) { 225 232 ft1000dev = pft1000info->priv; 226 - ft1000_cleanup_proc(pft1000info); 227 233 if (ft1000dev->pPollThread) 228 234 kthread_stop(ft1000dev->pPollThread); 229 235
-3
drivers/staging/ft1000/ft1000-usb/ft1000_usb.h
··· 149 149 struct usb_interface *intf); 150 150 int ft1000_poll(void *dev_id); 151 151 152 - int ft1000_init_proc(struct net_device *dev); 153 - void ft1000_cleanup_proc(struct ft1000_info *info); 154 - 155 152 #endif /* _FT1000_USB_H_ */
-2
drivers/staging/ft1000/ft1000.h
··· 363 363 u16 Rec[MAX_DSP_SESS_REC]; 364 364 u32 MagRec[MAX_DSP_SESS_REC/2]; 365 365 } DSPSess; 366 - struct proc_dir_entry *ft1000_proc_dir; 367 - char netdevname[IFNAMSIZ]; 368 366 };