diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-02-18 05:55:10 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2008-03-26 00:19:58 -0400 |
commit | 1119d577ccfeb727e3f26f07e612d6f2a9c349e7 (patch) | |
tree | 74542b56b258e8cae2f7747ac519c9ba0acf3518 /drivers | |
parent | 57bb7e222804c68066e3e995dffbedda5b1ec1ea (diff) |
Use single_open instead of manual manipulations.
The code opening proc entry for each device makes the
same thing, as the single_open does, so remove the
unneeded code.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ibmveth.c | 42 |
1 files changed, 3 insertions, 39 deletions
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index 57772bebff56..bb31e09899fc 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c | |||
@@ -1259,26 +1259,7 @@ static void ibmveth_proc_unregister_driver(void) | |||
1259 | remove_proc_entry(IBMVETH_PROC_DIR, init_net.proc_net); | 1259 | remove_proc_entry(IBMVETH_PROC_DIR, init_net.proc_net); |
1260 | } | 1260 | } |
1261 | 1261 | ||
1262 | static void *ibmveth_seq_start(struct seq_file *seq, loff_t *pos) | 1262 | static int ibmveth_show(struct seq_file *seq, void *v) |
1263 | { | ||
1264 | if (*pos == 0) { | ||
1265 | return (void *)1; | ||
1266 | } else { | ||
1267 | return NULL; | ||
1268 | } | ||
1269 | } | ||
1270 | |||
1271 | static void *ibmveth_seq_next(struct seq_file *seq, void *v, loff_t *pos) | ||
1272 | { | ||
1273 | ++*pos; | ||
1274 | return NULL; | ||
1275 | } | ||
1276 | |||
1277 | static void ibmveth_seq_stop(struct seq_file *seq, void *v) | ||
1278 | { | ||
1279 | } | ||
1280 | |||
1281 | static int ibmveth_seq_show(struct seq_file *seq, void *v) | ||
1282 | { | 1263 | { |
1283 | struct ibmveth_adapter *adapter = seq->private; | 1264 | struct ibmveth_adapter *adapter = seq->private; |
1284 | char *current_mac = ((char*) &adapter->netdev->dev_addr); | 1265 | char *current_mac = ((char*) &adapter->netdev->dev_addr); |
@@ -1302,27 +1283,10 @@ static int ibmveth_seq_show(struct seq_file *seq, void *v) | |||
1302 | 1283 | ||
1303 | return 0; | 1284 | return 0; |
1304 | } | 1285 | } |
1305 | static struct seq_operations ibmveth_seq_ops = { | ||
1306 | .start = ibmveth_seq_start, | ||
1307 | .next = ibmveth_seq_next, | ||
1308 | .stop = ibmveth_seq_stop, | ||
1309 | .show = ibmveth_seq_show, | ||
1310 | }; | ||
1311 | 1286 | ||
1312 | static int ibmveth_proc_open(struct inode *inode, struct file *file) | 1287 | static int ibmveth_proc_open(struct inode *inode, struct file *file) |
1313 | { | 1288 | { |
1314 | struct seq_file *seq; | 1289 | return single_open(file, ibmveth_show, PDE(inode)->data); |
1315 | struct proc_dir_entry *proc; | ||
1316 | int rc; | ||
1317 | |||
1318 | rc = seq_open(file, &ibmveth_seq_ops); | ||
1319 | if (!rc) { | ||
1320 | /* recover the pointer buried in proc_dir_entry data */ | ||
1321 | seq = file->private_data; | ||
1322 | proc = PDE(inode); | ||
1323 | seq->private = proc->data; | ||
1324 | } | ||
1325 | return rc; | ||
1326 | } | 1290 | } |
1327 | 1291 | ||
1328 | static const struct file_operations ibmveth_proc_fops = { | 1292 | static const struct file_operations ibmveth_proc_fops = { |
@@ -1330,7 +1294,7 @@ static const struct file_operations ibmveth_proc_fops = { | |||
1330 | .open = ibmveth_proc_open, | 1294 | .open = ibmveth_proc_open, |
1331 | .read = seq_read, | 1295 | .read = seq_read, |
1332 | .llseek = seq_lseek, | 1296 | .llseek = seq_lseek, |
1333 | .release = seq_release, | 1297 | .release = single_release, |
1334 | }; | 1298 | }; |
1335 | 1299 | ||
1336 | static void ibmveth_proc_register_adapter(struct ibmveth_adapter *adapter) | 1300 | static void ibmveth_proc_register_adapter(struct ibmveth_adapter *adapter) |