forked from Minki/linux
greybus: core: add bus id to uevents
Add the bus id to all greybus uevents. This is needed to identify devices that are being removed (e.g. at hot-unplug). Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
parent
1cacb456fd
commit
f0960d05f5
@ -77,7 +77,7 @@ static int greybus_module_match(struct device *dev, struct device_driver *drv)
|
|||||||
|
|
||||||
static int greybus_uevent(struct device *dev, struct kobj_uevent_env *env)
|
static int greybus_uevent(struct device *dev, struct kobj_uevent_env *env)
|
||||||
{
|
{
|
||||||
struct gb_host_device *hd = NULL;
|
struct gb_host_device *hd;
|
||||||
struct gb_interface *intf = NULL;
|
struct gb_interface *intf = NULL;
|
||||||
struct gb_bundle *bundle = NULL;
|
struct gb_bundle *bundle = NULL;
|
||||||
struct gb_svc *svc = NULL;
|
struct gb_svc *svc = NULL;
|
||||||
@ -86,16 +86,22 @@ static int greybus_uevent(struct device *dev, struct kobj_uevent_env *env)
|
|||||||
hd = to_gb_host_device(dev);
|
hd = to_gb_host_device(dev);
|
||||||
} else if (is_gb_interface(dev)) {
|
} else if (is_gb_interface(dev)) {
|
||||||
intf = to_gb_interface(dev);
|
intf = to_gb_interface(dev);
|
||||||
|
hd = intf->hd;
|
||||||
} else if (is_gb_bundle(dev)) {
|
} else if (is_gb_bundle(dev)) {
|
||||||
bundle = to_gb_bundle(dev);
|
bundle = to_gb_bundle(dev);
|
||||||
intf = bundle->intf;
|
intf = bundle->intf;
|
||||||
|
hd = intf->hd;
|
||||||
} else if (is_gb_svc(dev)) {
|
} else if (is_gb_svc(dev)) {
|
||||||
svc = to_gb_svc(dev);
|
svc = to_gb_svc(dev);
|
||||||
|
hd = svc->hd;
|
||||||
} else {
|
} else {
|
||||||
dev_WARN(dev, "uevent for unknown greybus device \"type\"!\n");
|
dev_WARN(dev, "uevent for unknown greybus device \"type\"!\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (add_uevent_var(env, "BUS=%u", hd->bus_id))
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
if (bundle) {
|
if (bundle) {
|
||||||
// FIXME
|
// FIXME
|
||||||
// add a uevent that can "load" a bundle type
|
// add a uevent that can "load" a bundle type
|
||||||
@ -104,10 +110,6 @@ static int greybus_uevent(struct device *dev, struct kobj_uevent_env *env)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME
|
|
||||||
// "just" a module, be vague here, nothing binds to a module except
|
|
||||||
// the greybus core, so there's not much, if anything, we need to
|
|
||||||
// advertise.
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -695,6 +695,7 @@ static int gb_svc_connection_init(struct gb_connection *connection)
|
|||||||
ida_init(&svc->device_id_map);
|
ida_init(&svc->device_id_map);
|
||||||
svc->state = GB_SVC_STATE_RESET;
|
svc->state = GB_SVC_STATE_RESET;
|
||||||
svc->connection = connection;
|
svc->connection = connection;
|
||||||
|
svc->hd = hd;
|
||||||
connection->private = svc;
|
connection->private = svc;
|
||||||
|
|
||||||
hd->svc = svc;
|
hd->svc = svc;
|
||||||
|
@ -19,6 +19,7 @@ enum gb_svc_state {
|
|||||||
struct gb_svc {
|
struct gb_svc {
|
||||||
struct device dev;
|
struct device dev;
|
||||||
|
|
||||||
|
struct gb_host_device *hd;
|
||||||
struct gb_connection *connection;
|
struct gb_connection *connection;
|
||||||
enum gb_svc_state state;
|
enum gb_svc_state state;
|
||||||
struct ida device_id_map;
|
struct ida device_id_map;
|
||||||
|
Loading…
Reference in New Issue
Block a user