diff options
author | Dan Williams <dcbw@redhat.com> | 2010-12-08 14:40:47 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-12-10 18:45:05 -0500 |
commit | d9ca676bcb26e1fdff9265a3e70f697cd381c889 (patch) | |
tree | 72ab0bf8cb22291eb4e1a57329bb8e1df2b7649f /net | |
parent | fb890ae7d615f4b4f5689144b6832230ab2046aa (diff) |
atm: correct sysfs 'device' link creation and parent relationships
The ATM subsystem was incorrectly creating the 'device' link for ATM
nodes in sysfs. This led to incorrect device/parent relationships
exposed by sysfs and udev. Instead of rolling the 'device' link by hand
in the generic ATM code, pass each ATM driver's bus device down to the
sysfs code and let sysfs do this stuff correctly.
Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/atm/atm_sysfs.c | 3 | ||||
-rw-r--r-- | net/atm/resources.c | 7 | ||||
-rw-r--r-- | net/atm/resources.h | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/net/atm/atm_sysfs.c b/net/atm/atm_sysfs.c index 799c631f0fed..f7fa67c78766 100644 --- a/net/atm/atm_sysfs.c +++ b/net/atm/atm_sysfs.c | |||
@@ -143,12 +143,13 @@ static struct class atm_class = { | |||
143 | .dev_uevent = atm_uevent, | 143 | .dev_uevent = atm_uevent, |
144 | }; | 144 | }; |
145 | 145 | ||
146 | int atm_register_sysfs(struct atm_dev *adev) | 146 | int atm_register_sysfs(struct atm_dev *adev, struct device *parent) |
147 | { | 147 | { |
148 | struct device *cdev = &adev->class_dev; | 148 | struct device *cdev = &adev->class_dev; |
149 | int i, j, err; | 149 | int i, j, err; |
150 | 150 | ||
151 | cdev->class = &atm_class; | 151 | cdev->class = &atm_class; |
152 | cdev->parent = parent; | ||
152 | dev_set_drvdata(cdev, adev); | 153 | dev_set_drvdata(cdev, adev); |
153 | 154 | ||
154 | dev_set_name(cdev, "%s%d", adev->type, adev->number); | 155 | dev_set_name(cdev, "%s%d", adev->type, adev->number); |
diff --git a/net/atm/resources.c b/net/atm/resources.c index d29e58261511..23f45ce6f351 100644 --- a/net/atm/resources.c +++ b/net/atm/resources.c | |||
@@ -74,8 +74,9 @@ struct atm_dev *atm_dev_lookup(int number) | |||
74 | } | 74 | } |
75 | EXPORT_SYMBOL(atm_dev_lookup); | 75 | EXPORT_SYMBOL(atm_dev_lookup); |
76 | 76 | ||
77 | struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops, | 77 | struct atm_dev *atm_dev_register(const char *type, struct device *parent, |
78 | int number, unsigned long *flags) | 78 | const struct atmdev_ops *ops, int number, |
79 | unsigned long *flags) | ||
79 | { | 80 | { |
80 | struct atm_dev *dev, *inuse; | 81 | struct atm_dev *dev, *inuse; |
81 | 82 | ||
@@ -115,7 +116,7 @@ struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops, | |||
115 | goto out_fail; | 116 | goto out_fail; |
116 | } | 117 | } |
117 | 118 | ||
118 | if (atm_register_sysfs(dev) < 0) { | 119 | if (atm_register_sysfs(dev, parent) < 0) { |
119 | pr_err("atm_register_sysfs failed for dev %s\n", type); | 120 | pr_err("atm_register_sysfs failed for dev %s\n", type); |
120 | atm_proc_dev_deregister(dev); | 121 | atm_proc_dev_deregister(dev); |
121 | goto out_fail; | 122 | goto out_fail; |
diff --git a/net/atm/resources.h b/net/atm/resources.h index 126fb1840dfb..521431e30507 100644 --- a/net/atm/resources.h +++ b/net/atm/resources.h | |||
@@ -42,6 +42,6 @@ static inline void atm_proc_dev_deregister(struct atm_dev *dev) | |||
42 | 42 | ||
43 | #endif /* CONFIG_PROC_FS */ | 43 | #endif /* CONFIG_PROC_FS */ |
44 | 44 | ||
45 | int atm_register_sysfs(struct atm_dev *adev); | 45 | int atm_register_sysfs(struct atm_dev *adev, struct device *parent); |
46 | void atm_unregister_sysfs(struct atm_dev *adev); | 46 | void atm_unregister_sysfs(struct atm_dev *adev); |
47 | #endif | 47 | #endif |