diff options
Diffstat (limited to 'drivers/net/pppoe.c')
-rw-r--r-- | drivers/net/pppoe.c | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c index 798b8cf5f9a6..074803a78fc6 100644 --- a/drivers/net/pppoe.c +++ b/drivers/net/pppoe.c | |||
@@ -1040,7 +1040,7 @@ out: | |||
1040 | static void *pppoe_seq_start(struct seq_file *seq, loff_t *pos) | 1040 | static void *pppoe_seq_start(struct seq_file *seq, loff_t *pos) |
1041 | __acquires(pn->hash_lock) | 1041 | __acquires(pn->hash_lock) |
1042 | { | 1042 | { |
1043 | struct pppoe_net *pn = pppoe_pernet(seq->private); | 1043 | struct pppoe_net *pn = pppoe_pernet(seq_file_net(seq)); |
1044 | loff_t l = *pos; | 1044 | loff_t l = *pos; |
1045 | 1045 | ||
1046 | read_lock_bh(&pn->hash_lock); | 1046 | read_lock_bh(&pn->hash_lock); |
@@ -1049,7 +1049,7 @@ static void *pppoe_seq_start(struct seq_file *seq, loff_t *pos) | |||
1049 | 1049 | ||
1050 | static void *pppoe_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 1050 | static void *pppoe_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
1051 | { | 1051 | { |
1052 | struct pppoe_net *pn = pppoe_pernet(seq->private); | 1052 | struct pppoe_net *pn = pppoe_pernet(seq_file_net(seq)); |
1053 | struct pppox_sock *po; | 1053 | struct pppox_sock *po; |
1054 | 1054 | ||
1055 | ++*pos; | 1055 | ++*pos; |
@@ -1077,7 +1077,7 @@ out: | |||
1077 | static void pppoe_seq_stop(struct seq_file *seq, void *v) | 1077 | static void pppoe_seq_stop(struct seq_file *seq, void *v) |
1078 | __releases(pn->hash_lock) | 1078 | __releases(pn->hash_lock) |
1079 | { | 1079 | { |
1080 | struct pppoe_net *pn = pppoe_pernet(seq->private); | 1080 | struct pppoe_net *pn = pppoe_pernet(seq_file_net(seq)); |
1081 | read_unlock_bh(&pn->hash_lock); | 1081 | read_unlock_bh(&pn->hash_lock); |
1082 | } | 1082 | } |
1083 | 1083 | ||
@@ -1090,30 +1090,8 @@ static const struct seq_operations pppoe_seq_ops = { | |||
1090 | 1090 | ||
1091 | static int pppoe_seq_open(struct inode *inode, struct file *file) | 1091 | static int pppoe_seq_open(struct inode *inode, struct file *file) |
1092 | { | 1092 | { |
1093 | struct seq_file *m; | 1093 | return seq_open_net(inode, file, &pppoe_seq_ops, |
1094 | struct net *net; | 1094 | sizeof(struct seq_net_private)); |
1095 | int err; | ||
1096 | |||
1097 | err = seq_open(file, &pppoe_seq_ops); | ||
1098 | if (err) | ||
1099 | return err; | ||
1100 | |||
1101 | m = file->private_data; | ||
1102 | net = maybe_get_net(PDE_NET(PDE(inode))); | ||
1103 | BUG_ON(!net); | ||
1104 | m->private = net; | ||
1105 | |||
1106 | return err; | ||
1107 | } | ||
1108 | |||
1109 | static int pppoe_seq_release(struct inode *inode, struct file *file) | ||
1110 | { | ||
1111 | struct seq_file *m; | ||
1112 | |||
1113 | m = file->private_data; | ||
1114 | put_net((struct net*)m->private); | ||
1115 | |||
1116 | return seq_release(inode, file); | ||
1117 | } | 1095 | } |
1118 | 1096 | ||
1119 | static const struct file_operations pppoe_seq_fops = { | 1097 | static const struct file_operations pppoe_seq_fops = { |
@@ -1121,7 +1099,7 @@ static const struct file_operations pppoe_seq_fops = { | |||
1121 | .open = pppoe_seq_open, | 1099 | .open = pppoe_seq_open, |
1122 | .read = seq_read, | 1100 | .read = seq_read, |
1123 | .llseek = seq_lseek, | 1101 | .llseek = seq_lseek, |
1124 | .release = pppoe_seq_release, | 1102 | .release = seq_release_net, |
1125 | }; | 1103 | }; |
1126 | 1104 | ||
1127 | #endif /* CONFIG_PROC_FS */ | 1105 | #endif /* CONFIG_PROC_FS */ |