Commit 14f414f1 authored by Patrick Mochel's avatar Patrick Mochel

driver model: get correct pointer of interfaces from data

When adding interface data for an object, we were getting the pointer of 
the interface from data->kobj.subsys, when we should have just been getting
it from data->intf.
parent c3a72b42
...@@ -14,9 +14,6 @@ ...@@ -14,9 +14,6 @@
#define to_data(e) container_of(e,struct intf_data,kobj.entry) #define to_data(e) container_of(e,struct intf_data,kobj.entry)
#define intf_from_data(d) container_of(d->kobj.subsys,struct device_interface, subsys);
/** /**
* intf_dev_link - create sysfs symlink for interface. * intf_dev_link - create sysfs symlink for interface.
* @data: interface data descriptor. * @data: interface data descriptor.
...@@ -61,15 +58,18 @@ static void intf_dev_unlink(struct intf_data * data) ...@@ -61,15 +58,18 @@ static void intf_dev_unlink(struct intf_data * data)
int interface_add_data(struct intf_data * data) int interface_add_data(struct intf_data * data)
{ {
struct device_interface * intf = intf_from_data(data); struct device_interface * intf = data->intf;
data->intf_num = data->intf->devnum++; if (intf) {
data->kobj.subsys = &intf->subsys; data->intf_num = intf->devnum++;
kobject_register(&data->kobj); data->kobj.subsys = &intf->subsys;
kobject_register(&data->kobj);
list_add_tail(&data->dev_entry,&data->dev->intf_list); list_add_tail(&data->dev_entry,&data->dev->intf_list);
intf_dev_link(data); intf_dev_link(data);
return 0; return 0;
}
return -EINVAL;
} }
...@@ -121,9 +121,9 @@ static int add(struct device_interface * intf, struct device * dev) ...@@ -121,9 +121,9 @@ static int add(struct device_interface * intf, struct device * dev)
static void del(struct intf_data * data) static void del(struct intf_data * data)
{ {
struct device_interface * intf = intf_from_data(data); struct device_interface * intf = data->intf;
pr_debug(" -> %s ",data->intf->name); pr_debug(" -> %s ",intf->name);
interface_remove_data(data); interface_remove_data(data);
if (intf->remove_device) if (intf->remove_device)
intf->remove_device(data); intf->remove_device(data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment