[PATCH] s390: remove redundant and useless code in qeth

[patch 3/3] s390: remove redundant and useless code in qeth

From: Frank Pavlic <pavlic@de.ibm.com>
- remove redundant and useless code in qeth for
procfs operations.
- update Revision numbers
Signed-off-by: Frank Pavlic <pavlic@de.ibm.com>

diffstat:
qeth_main.c | 6 -
qeth_mpc.c | 2
qeth_mpc.h | 2
qeth_proc.c | 250 ++++++------------------------------------------------------
qeth_sys.c | 4
qeth_tso.h | 4
6 files changed, 38 insertions(+), 230 deletions(-)
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>

authored by Frank Pavlic and committed by Jeff Garzik 3df3cc6d 4965e97f

+38 -230
+3 -3
drivers/s390/net/qeth_main.c
··· 1 1 /* 2 2 * 3 - * linux/drivers/s390/net/qeth_main.c ($Revision: 1.246 $) 3 + * linux/drivers/s390/net/qeth_main.c ($Revision: 1.251 $) 4 4 * 5 5 * Linux on zSeries OSA Express and HiperSockets support 6 6 * ··· 12 12 * Frank Pavlic (fpavlic@de.ibm.com) and 13 13 * Thomas Spatzier <tspat@de.ibm.com> 14 14 * 15 - * $Revision: 1.242 $ $Date: 2005/05/04 20:19:18 $ 15 + * $Revision: 1.251 $ $Date: 2005/05/04 20:19:18 $ 16 16 * 17 17 * This program is free software; you can redistribute it and/or modify 18 18 * it under the terms of the GNU General Public License as published by ··· 72 72 #include "qeth_eddp.h" 73 73 #include "qeth_tso.h" 74 74 75 - #define VERSION_QETH_C "$Revision: 1.246 $" 75 + #define VERSION_QETH_C "$Revision: 1.251 $" 76 76 static const char *version = "qeth S/390 OSA-Express driver"; 77 77 78 78 /**
+1 -1
drivers/s390/net/qeth_mpc.c
··· 11 11 #include <asm/cio.h> 12 12 #include "qeth_mpc.h" 13 13 14 - const char *VERSION_QETH_MPC_C = "$Revision: 1.12 $"; 14 + const char *VERSION_QETH_MPC_C = "$Revision: 1.13 $"; 15 15 16 16 unsigned char IDX_ACTIVATE_READ[]={ 17 17 0x00,0x00,0x80,0x00, 0x00,0x00,0x00,0x00,
+1 -1
drivers/s390/net/qeth_mpc.h
··· 14 14 15 15 #include <asm/qeth.h> 16 16 17 - #define VERSION_QETH_MPC_H "$Revision: 1.44 $" 17 + #define VERSION_QETH_MPC_H "$Revision: 1.46 $" 18 18 19 19 extern const char *VERSION_QETH_MPC_C; 20 20
+29 -221
drivers/s390/net/qeth_proc.c
··· 1 1 /* 2 2 * 3 - * linux/drivers/s390/net/qeth_fs.c ($Revision: 1.13 $) 3 + * linux/drivers/s390/net/qeth_fs.c ($Revision: 1.16 $) 4 4 * 5 5 * Linux on zSeries OSA Express and HiperSockets support 6 6 * This file contains code related to procfs. ··· 21 21 #include "qeth_mpc.h" 22 22 #include "qeth_fs.h" 23 23 24 - const char *VERSION_QETH_PROC_C = "$Revision: 1.13 $"; 24 + const char *VERSION_QETH_PROC_C = "$Revision: 1.16 $"; 25 25 26 26 /***** /proc/qeth *****/ 27 27 #define QETH_PROCFILE_NAME "qeth" ··· 30 30 static int 31 31 qeth_procfile_seq_match(struct device *dev, void *data) 32 32 { 33 - return 1; 33 + return(dev ? 1 : 0); 34 34 } 35 35 36 36 static void * 37 37 qeth_procfile_seq_start(struct seq_file *s, loff_t *offset) 38 38 { 39 - struct device *dev; 40 - loff_t nr; 41 - 39 + struct device *dev = NULL; 40 + loff_t nr = 0; 41 + 42 42 down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); 43 - 44 - nr = *offset; 45 - if (nr == 0) 43 + if (*offset == 0) 46 44 return SEQ_START_TOKEN; 47 - 48 - dev = driver_find_device(&qeth_ccwgroup_driver.driver, NULL, 49 - NULL, qeth_procfile_seq_match); 50 - 51 - /* get card at pos *offset */ 52 - nr = *offset; 53 - while (nr-- > 1 && dev) 45 + while (1) { 54 46 dev = driver_find_device(&qeth_ccwgroup_driver.driver, dev, 55 47 NULL, qeth_procfile_seq_match); 56 - return (void *) dev; 48 + if (++nr == *offset) 49 + break; 50 + put_device(dev); 51 + } 52 + return dev; 57 53 } 58 54 59 55 static void ··· 62 66 qeth_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) 63 67 { 64 68 struct device *prev, *next; 65 - 66 - if (it == SEQ_START_TOKEN) { 67 - next = driver_find_device(&qeth_ccwgroup_driver.driver, 68 - NULL, NULL, qeth_procfile_seq_match); 69 - if (next) 70 - (*offset)++; 71 - return (void *) next; 72 - } 73 - prev = (struct device *) it; 69 + 70 + if (it == SEQ_START_TOKEN) 71 + prev = NULL; 72 + else 73 + prev = (struct device *) it; 74 74 next = driver_find_device(&qeth_ccwgroup_driver.driver, 75 75 prev, NULL, qeth_procfile_seq_match); 76 - if (next) 77 - (*offset)++; 76 + (*offset)++; 78 77 return (void *) next; 79 78 } 80 79 ··· 78 87 { 79 88 int routing_type = 0; 80 89 81 - if (ipv == 4){ 90 + if (ipv == 4) { 82 91 routing_type = card->options.route4.type; 83 92 } else { 84 93 #ifdef CONFIG_QETH_IPV6 ··· 145 154 card->qdio.in_buf_pool.buf_count); 146 155 else 147 156 seq_printf(s, " +++ LAN OFFLINE +++\n"); 157 + put_device(device); 148 158 } 149 159 return 0; 150 160 } ··· 176 184 static struct proc_dir_entry *qeth_perf_procfile; 177 185 178 186 #ifdef CONFIG_QETH_PERF_STATS 179 - 180 - static void * 181 - qeth_perf_procfile_seq_start(struct seq_file *s, loff_t *offset) 182 - { 183 - struct device *dev = NULL; 184 - int nr; 185 - 186 - down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); 187 - /* get card at pos *offset */ 188 - dev = driver_find_device(&qeth_ccwgroup_driver.driver, NULL, NULL, 189 - qeth_procfile_seq_match); 190 - 191 - /* get card at pos *offset */ 192 - nr = *offset; 193 - while (nr-- > 1 && dev) 194 - dev = driver_find_device(&qeth_ccwgroup_driver.driver, dev, 195 - NULL, qeth_procfile_seq_match); 196 - return (void *) dev; 197 - } 198 - 199 - static void 200 - qeth_perf_procfile_seq_stop(struct seq_file *s, void* it) 201 - { 202 - up_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); 203 - } 204 - 205 - static void * 206 - qeth_perf_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) 207 - { 208 - struct device *prev, *next; 209 - 210 - prev = (struct device *) it; 211 - next = driver_find_device(&qeth_ccwgroup_driver.driver, prev, 212 - NULL, qeth_procfile_seq_match); 213 - if (next) 214 - (*offset)++; 215 - return (void *) next; 216 - } 217 - 218 187 static int 219 188 qeth_perf_procfile_seq_show(struct seq_file *s, void *it) 220 189 { 221 190 struct device *device; 222 191 struct qeth_card *card; 192 + 193 + 194 + if (it == SEQ_START_TOKEN) 195 + return 0; 223 196 224 197 device = (struct device *) it; 225 198 card = device->driver_data; ··· 252 295 card->perf_stats.outbound_do_qdio_time, 253 296 card->perf_stats.outbound_do_qdio_cnt 254 297 ); 298 + put_device(device); 255 299 return 0; 256 300 } 257 301 258 302 static struct seq_operations qeth_perf_procfile_seq_ops = { 259 - .start = qeth_perf_procfile_seq_start, 260 - .stop = qeth_perf_procfile_seq_stop, 261 - .next = qeth_perf_procfile_seq_next, 303 + .start = qeth_procfile_seq_start, 304 + .stop = qeth_procfile_seq_stop, 305 + .next = qeth_procfile_seq_next, 262 306 .show = qeth_perf_procfile_seq_show, 263 307 }; 264 308 ··· 282 324 #define qeth_perf_procfile_created 1 283 325 #endif /* CONFIG_QETH_PERF_STATS */ 284 326 285 - /***** /proc/qeth_ipa_takeover *****/ 286 - #define QETH_IPATO_PROCFILE_NAME "qeth_ipa_takeover" 287 - static struct proc_dir_entry *qeth_ipato_procfile; 288 - 289 - static void * 290 - qeth_ipato_procfile_seq_start(struct seq_file *s, loff_t *offset) 291 - { 292 - struct device *dev; 293 - loff_t nr; 294 - 295 - down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); 296 - /* TODO: finish this */ 297 - /* 298 - * maybe SEQ_SATRT_TOKEN can be returned for offset 0 299 - * output driver settings then; 300 - * else output setting for respective card 301 - */ 302 - 303 - dev = driver_find_device(&qeth_ccwgroup_driver.driver, NULL, NULL, 304 - qeth_procfile_seq_match); 305 - 306 - /* get card at pos *offset */ 307 - nr = *offset; 308 - while (nr-- > 1 && dev) 309 - dev = driver_find_device(&qeth_ccwgroup_driver.driver, dev, 310 - NULL, qeth_procfile_seq_match); 311 - return (void *) dev; 312 - } 313 - 314 - static void 315 - qeth_ipato_procfile_seq_stop(struct seq_file *s, void* it) 316 - { 317 - up_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); 318 - } 319 - 320 - static void * 321 - qeth_ipato_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) 322 - { 323 - struct device *prev, *next; 324 - 325 - prev = (struct device *) it; 326 - next = driver_find_device(&qeth_ccwgroup_driver.driver, prev, 327 - NULL, qeth_procfile_seq_match); 328 - if (next) 329 - (*offset)++; 330 - return (void *) next; 331 - } 332 - 333 - static int 334 - qeth_ipato_procfile_seq_show(struct seq_file *s, void *it) 335 - { 336 - struct device *device; 337 - struct qeth_card *card; 338 - 339 - /* TODO: finish this */ 340 - /* 341 - * maybe SEQ_SATRT_TOKEN can be returned for offset 0 342 - * output driver settings then; 343 - * else output setting for respective card 344 - */ 345 - device = (struct device *) it; 346 - card = device->driver_data; 347 - 348 - return 0; 349 - } 350 - 351 - static struct seq_operations qeth_ipato_procfile_seq_ops = { 352 - .start = qeth_ipato_procfile_seq_start, 353 - .stop = qeth_ipato_procfile_seq_stop, 354 - .next = qeth_ipato_procfile_seq_next, 355 - .show = qeth_ipato_procfile_seq_show, 356 - }; 357 - 358 - static int 359 - qeth_ipato_procfile_open(struct inode *inode, struct file *file) 360 - { 361 - return seq_open(file, &qeth_ipato_procfile_seq_ops); 362 - } 363 - 364 - static struct file_operations qeth_ipato_procfile_fops = { 365 - .owner = THIS_MODULE, 366 - .open = qeth_ipato_procfile_open, 367 - .read = seq_read, 368 - .llseek = seq_lseek, 369 - .release = seq_release, 370 - }; 371 - 372 327 int __init 373 328 qeth_create_procfs_entries(void) 374 329 { ··· 297 426 qeth_perf_procfile->proc_fops = &qeth_perf_procfile_fops; 298 427 #endif /* CONFIG_QETH_PERF_STATS */ 299 428 300 - qeth_ipato_procfile = create_proc_entry(QETH_IPATO_PROCFILE_NAME, 301 - S_IFREG | 0444, NULL); 302 - if (qeth_ipato_procfile) 303 - qeth_ipato_procfile->proc_fops = &qeth_ipato_procfile_fops; 304 - 305 429 if (qeth_procfile && 306 - qeth_ipato_procfile && 307 430 qeth_perf_procfile_created) 308 431 return 0; 309 432 else ··· 311 446 remove_proc_entry(QETH_PROCFILE_NAME, NULL); 312 447 if (qeth_perf_procfile) 313 448 remove_proc_entry(QETH_PERF_PROCFILE_NAME, NULL); 314 - if (qeth_ipato_procfile) 315 - remove_proc_entry(QETH_IPATO_PROCFILE_NAME, NULL); 316 449 } 317 450 318 - 319 - /* ONLY FOR DEVELOPMENT! -> make it as module */ 320 - /* 321 - static void 322 - qeth_create_sysfs_entries(void) 323 - { 324 - struct device *dev; 325 - 326 - down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); 327 - 328 - list_for_each_entry(dev, &qeth_ccwgroup_driver.driver.devices, 329 - driver_list) 330 - qeth_create_device_attributes(dev); 331 - 332 - up_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); 333 - } 334 - 335 - static void 336 - qeth_remove_sysfs_entries(void) 337 - { 338 - struct device *dev; 339 - 340 - down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); 341 - 342 - list_for_each_entry(dev, &qeth_ccwgroup_driver.driver.devices, 343 - driver_list) 344 - qeth_remove_device_attributes(dev); 345 - 346 - up_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); 347 - } 348 - 349 - static int __init 350 - qeth_fs_init(void) 351 - { 352 - printk(KERN_INFO "qeth_fs_init\n"); 353 - qeth_create_procfs_entries(); 354 - qeth_create_sysfs_entries(); 355 - 356 - return 0; 357 - } 358 - 359 - static void __exit 360 - qeth_fs_exit(void) 361 - { 362 - printk(KERN_INFO "qeth_fs_exit\n"); 363 - qeth_remove_procfs_entries(); 364 - qeth_remove_sysfs_entries(); 365 - } 366 - 367 - 368 - module_init(qeth_fs_init); 369 - module_exit(qeth_fs_exit); 370 - 371 - MODULE_LICENSE("GPL"); 372 - */
+2 -2
drivers/s390/net/qeth_sys.c
··· 1 1 /* 2 2 * 3 - * linux/drivers/s390/net/qeth_sys.c ($Revision: 1.59 $) 3 + * linux/drivers/s390/net/qeth_sys.c ($Revision: 1.60 $) 4 4 * 5 5 * Linux on zSeries OSA Express and HiperSockets support 6 6 * This file contains code related to sysfs. ··· 20 20 #include "qeth_mpc.h" 21 21 #include "qeth_fs.h" 22 22 23 - const char *VERSION_QETH_SYS_C = "$Revision: 1.59 $"; 23 + const char *VERSION_QETH_SYS_C = "$Revision: 1.60 $"; 24 24 25 25 /*****************************************************************************/ 26 26 /* */
+2 -2
drivers/s390/net/qeth_tso.h
··· 1 1 /* 2 - * linux/drivers/s390/net/qeth_tso.h ($Revision: 1.7 $) 2 + * linux/drivers/s390/net/qeth_tso.h ($Revision: 1.8 $) 3 3 * 4 4 * Header file for qeth TCP Segmentation Offload support. 5 5 * ··· 7 7 * 8 8 * Author(s): Frank Pavlic <fpavlic@de.ibm.com> 9 9 * 10 - * $Revision: 1.7 $ $Date: 2005/05/04 20:19:18 $ 10 + * $Revision: 1.8 $ $Date: 2005/05/04 20:19:18 $ 11 11 * 12 12 */ 13 13 #ifndef __QETH_TSO_H__