mirror of https://gitee.com/openkylin/linux.git
greybus: interface: kill gb_create_bundle_connection
Kill gb_create_bundle_connection, which was only used to create the control bundle and connection, and replace it with a specialised static helper. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
parent
66069fb06c
commit
e4048006fd
|
@ -71,40 +71,27 @@ struct device_type greybus_interface_type = {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create kernel structures corresponding to a bundle and connection for
|
* Create kernel structures corresponding to a bundle and connection for
|
||||||
* managing control/svc CPort.
|
* managing control CPort.
|
||||||
*/
|
*/
|
||||||
int gb_create_bundle_connection(struct gb_interface *intf, u8 class)
|
static int
|
||||||
|
gb_interface_create_control_bundle_connection(struct gb_interface *intf)
|
||||||
{
|
{
|
||||||
struct gb_bundle *bundle;
|
struct gb_bundle *bundle;
|
||||||
u32 ida_start, ida_end;
|
struct gb_connection *connection;
|
||||||
u8 bundle_id, protocol_id;
|
|
||||||
u16 cport_id;
|
|
||||||
|
|
||||||
if (class == GREYBUS_CLASS_CONTROL) {
|
bundle = gb_bundle_create(intf, GB_CONTROL_BUNDLE_ID,
|
||||||
protocol_id = GREYBUS_PROTOCOL_CONTROL;
|
GREYBUS_CLASS_CONTROL);
|
||||||
bundle_id = GB_CONTROL_BUNDLE_ID;
|
if (!bundle) {
|
||||||
cport_id = GB_CONTROL_CPORT_ID;
|
dev_err(&intf->dev, "failed to create control bundle\n");
|
||||||
ida_start = 0;
|
return -ENOMEM;
|
||||||
ida_end = intf->hd->num_cports - 1;
|
|
||||||
} else if (class == GREYBUS_CLASS_SVC) {
|
|
||||||
protocol_id = GREYBUS_PROTOCOL_SVC;
|
|
||||||
bundle_id = GB_SVC_BUNDLE_ID;
|
|
||||||
cport_id = GB_SVC_CPORT_ID;
|
|
||||||
ida_start = GB_SVC_CPORT_ID;
|
|
||||||
ida_end = GB_SVC_CPORT_ID + 1;
|
|
||||||
} else {
|
|
||||||
WARN_ON(1);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bundle = gb_bundle_create(intf, bundle_id, class);
|
connection = gb_connection_create(bundle, GB_CONTROL_CPORT_ID,
|
||||||
if (!bundle)
|
GREYBUS_PROTOCOL_CONTROL);
|
||||||
return -EINVAL;
|
if (!connection) {
|
||||||
|
dev_err(&intf->dev, "failed to create control connection\n");
|
||||||
if (!gb_connection_create_range(bundle->intf->hd, bundle,
|
return -ENOMEM;
|
||||||
cport_id, protocol_id, ida_start,
|
}
|
||||||
ida_end))
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -208,11 +195,9 @@ int gb_interface_init(struct gb_interface *intf, u8 device_id)
|
||||||
intf->device_id = device_id;
|
intf->device_id = device_id;
|
||||||
|
|
||||||
/* Establish control CPort connection */
|
/* Establish control CPort connection */
|
||||||
ret = gb_create_bundle_connection(intf, GREYBUS_CLASS_CONTROL);
|
ret = gb_interface_create_control_bundle_connection(intf);
|
||||||
if (ret) {
|
if (ret)
|
||||||
dev_err(&intf->dev, "Failed to create control CPort connection (%d)\n", ret);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
|
|
||||||
/* Get manifest size using control protocol on CPort */
|
/* Get manifest size using control protocol on CPort */
|
||||||
size = gb_control_get_manifest_size_operation(intf);
|
size = gb_control_get_manifest_size_operation(intf);
|
||||||
|
|
|
@ -61,5 +61,4 @@ int gb_interface_init(struct gb_interface *intf, u8 device_id);
|
||||||
void gb_interface_remove(struct gb_interface *intf);
|
void gb_interface_remove(struct gb_interface *intf);
|
||||||
void gb_interfaces_remove(struct gb_host_device *hd);
|
void gb_interfaces_remove(struct gb_host_device *hd);
|
||||||
|
|
||||||
int gb_create_bundle_connection(struct gb_interface *intf, u8 class);
|
|
||||||
#endif /* __INTERFACE_H */
|
#endif /* __INTERFACE_H */
|
||||||
|
|
Loading…
Reference in New Issue