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>
This commit is contained in:
committed by
David S. Miller
parent
fb890ae7d6
commit
d9ca676bcb
@@ -143,12 +143,13 @@ static struct class atm_class = {
|
||||
.dev_uevent = atm_uevent,
|
||||
};
|
||||
|
||||
int atm_register_sysfs(struct atm_dev *adev)
|
||||
int atm_register_sysfs(struct atm_dev *adev, struct device *parent)
|
||||
{
|
||||
struct device *cdev = &adev->class_dev;
|
||||
int i, j, err;
|
||||
|
||||
cdev->class = &atm_class;
|
||||
cdev->parent = parent;
|
||||
dev_set_drvdata(cdev, adev);
|
||||
|
||||
dev_set_name(cdev, "%s%d", adev->type, adev->number);
|
||||
|
@@ -74,8 +74,9 @@ struct atm_dev *atm_dev_lookup(int number)
|
||||
}
|
||||
EXPORT_SYMBOL(atm_dev_lookup);
|
||||
|
||||
struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops,
|
||||
int number, unsigned long *flags)
|
||||
struct atm_dev *atm_dev_register(const char *type, struct device *parent,
|
||||
const struct atmdev_ops *ops, int number,
|
||||
unsigned long *flags)
|
||||
{
|
||||
struct atm_dev *dev, *inuse;
|
||||
|
||||
@@ -115,7 +116,7 @@ struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops,
|
||||
goto out_fail;
|
||||
}
|
||||
|
||||
if (atm_register_sysfs(dev) < 0) {
|
||||
if (atm_register_sysfs(dev, parent) < 0) {
|
||||
pr_err("atm_register_sysfs failed for dev %s\n", type);
|
||||
atm_proc_dev_deregister(dev);
|
||||
goto out_fail;
|
||||
|
@@ -42,6 +42,6 @@ static inline void atm_proc_dev_deregister(struct atm_dev *dev)
|
||||
|
||||
#endif /* CONFIG_PROC_FS */
|
||||
|
||||
int atm_register_sysfs(struct atm_dev *adev);
|
||||
int atm_register_sysfs(struct atm_dev *adev, struct device *parent);
|
||||
void atm_unregister_sysfs(struct atm_dev *adev);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user