Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 89822
b: refs/heads/master
c: 9a8c09e
h: refs/heads/master
v: v3
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Feb 29, 2008
1 parent 4fb0508 commit 98d1602
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 53 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 45af1754bc09926b5e062bda24f789d7b320939f
refs/heads/master: 9a8c09e73bf6c8b1720b1172cdcabb14fc823cf8
29 changes: 2 additions & 27 deletions trunk/net/atm/lec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1169,40 +1169,15 @@ static const struct seq_operations lec_seq_ops = {

static int lec_seq_open(struct inode *inode, struct file *file)
{
struct lec_state *state;
struct seq_file *seq;
int rc = -EAGAIN;

state = kmalloc(sizeof(*state), GFP_KERNEL);
if (!state) {
rc = -ENOMEM;
goto out;
}

rc = seq_open(file, &lec_seq_ops);
if (rc)
goto out_kfree;
seq = file->private_data;
seq->private = state;
out:
return rc;

out_kfree:
kfree(state);
goto out;
}

static int lec_seq_release(struct inode *inode, struct file *file)
{
return seq_release_private(inode, file);
return seq_open_private(file, &lec_seq_ops, sizeof(struct lec_state));
}

static const struct file_operations lec_seq_fops = {
.owner = THIS_MODULE,
.open = lec_seq_open,
.read = seq_read,
.llseek = seq_lseek,
.release = lec_seq_release,
.release = seq_release_private,
};
#endif

Expand Down
32 changes: 7 additions & 25 deletions trunk/net/atm/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,31 +114,13 @@ static int __vcc_seq_open(struct inode *inode, struct file *file,
int family, const struct seq_operations *ops)
{
struct vcc_state *state;
struct seq_file *seq;
int rc = -ENOMEM;

state = kmalloc(sizeof(*state), GFP_KERNEL);
if (!state)
goto out;

rc = seq_open(file, ops);
if (rc)
goto out_kfree;
state = __seq_open_private(file, ops, sizeof(*state));
if (state == NULL)
return -ENOMEM;

state->family = family;

seq = file->private_data;
seq->private = state;
out:
return rc;
out_kfree:
kfree(state);
goto out;
}

static int vcc_seq_release(struct inode *inode, struct file *file)
{
return seq_release_private(inode, file);
return 0;
}

static void *vcc_seq_start(struct seq_file *seq, loff_t *pos)
Expand Down Expand Up @@ -314,7 +296,7 @@ static const struct file_operations pvc_seq_fops = {
.open = pvc_seq_open,
.read = seq_read,
.llseek = seq_lseek,
.release = vcc_seq_release,
.release = seq_release_private,
};

static int vcc_seq_show(struct seq_file *seq, void *v)
Expand Down Expand Up @@ -348,7 +330,7 @@ static const struct file_operations vcc_seq_fops = {
.open = vcc_seq_open,
.read = seq_read,
.llseek = seq_lseek,
.release = vcc_seq_release,
.release = seq_release_private,
};

static int svc_seq_show(struct seq_file *seq, void *v)
Expand Down Expand Up @@ -383,7 +365,7 @@ static const struct file_operations svc_seq_fops = {
.open = svc_seq_open,
.read = seq_read,
.llseek = seq_lseek,
.release = vcc_seq_release,
.release = seq_release_private,
};

static ssize_t proc_dev_atm_read(struct file *file, char __user *buf,
Expand Down

0 comments on commit 98d1602

Please sign in to comment.