Commit 4ab9b3c2 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

greybus: interface: s/gb_interface_block/gb_interface/g



Rename struct gb_interface_block to struct gb_interface

Lots of renaming, and variable renames as well (gb_ib->intf), but all
should be sane with regards to the new naming scheme we are using.

Reviewed-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent a93938a2
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -124,7 +124,7 @@ static void svc_handshake(struct svc_function_handshake *handshake,
static void svc_management(struct svc_function_unipro_management *management,
			   int payload_length, struct greybus_host_device *hd)
{
	struct gb_interface_block *gb_ib;
	struct gb_interface *intf;
	int ret;

	if (payload_length != sizeof(*management)) {
@@ -139,18 +139,18 @@ static void svc_management(struct svc_function_unipro_management *management,
		hd->device_id = management->ap_id.device_id;
		break;
	case SVC_MANAGEMENT_LINK_UP:
		gb_ib = gb_ib_find(hd, management->link_up.module_id);
		if (!gb_ib) {
		intf = gb_interface_find(hd, management->link_up.module_id);
		if (!intf) {
			dev_err(hd->parent, "Module ID %d not found\n",
				management->link_up.module_id);
			return;
		}
		ret = gb_bundle_init(gb_ib,
		ret = gb_bundle_init(intf,
				management->link_up.interface_id,
				management->link_up.device_id);
		if (ret)
			dev_err(hd->parent, "error %d initializing "
				"interface block %hhu bundle %hhu\n",
			dev_err(hd->parent,
				"error %d initializing interface %hhu bundle %hhu\n",
				ret, management->link_up.module_id,
				management->link_up.interface_id);
		break;
+1 −1
Original line number Diff line number Diff line
@@ -341,7 +341,7 @@ static int gb_battery_connection_init(struct gb_connection *connection)
	b->num_properties	= ARRAY_SIZE(battery_props),
	b->get_property		= get_property,

	retval = power_supply_register(&connection->bundle->gb_ib->dev, b);
	retval = power_supply_register(&connection->bundle->intf->dev, b);
	if (retval) {
		kfree(gb);
		return retval;
+16 −17
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ static DEFINE_SPINLOCK(gb_bundles_lock);
 * bundle.  Returns a pointer to the new bundle or a null
 * pointer if a failure occurs due to memory exhaustion.
 */
struct gb_bundle *gb_bundle_create(struct gb_interface_block *gb_ib, u8 interface_id)
struct gb_bundle *gb_bundle_create(struct gb_interface *intf, u8 interface_id)
{
	struct gb_bundle *bundle;
	int retval;
@@ -59,19 +59,19 @@ struct gb_bundle *gb_bundle_create(struct gb_interface_block *gb_ib, u8 interfac
	if (!bundle)
		return NULL;

	bundle->gb_ib = gb_ib;
	bundle->intf = intf;
	bundle->id = interface_id;
	bundle->device_id = 0xff;	/* Invalid device id to start with */
	INIT_LIST_HEAD(&bundle->connections);

	/* Build up the bundle device structures and register it with the
	 * driver core */
	bundle->dev.parent = &gb_ib->dev;
	bundle->dev.parent = &intf->dev;
	bundle->dev.bus = &greybus_bus_type;
	bundle->dev.type = &greybus_bundle_type;
	bundle->dev.groups = bundle_groups;
	device_initialize(&bundle->dev);
	dev_set_name(&bundle->dev, "%d:%d", gb_ib->module_id, interface_id);
	dev_set_name(&bundle->dev, "%d:%d", intf->module_id, interface_id);

	retval = device_add(&bundle->dev);
	if (retval) {
@@ -83,7 +83,7 @@ struct gb_bundle *gb_bundle_create(struct gb_interface_block *gb_ib, u8 interfac
	}

	spin_lock_irq(&gb_bundles_lock);
	list_add_tail(&bundle->links, &gb_ib->bundles);
	list_add_tail(&bundle->links, &intf->bundles);
	spin_unlock_irq(&gb_bundles_lock);

	return bundle;
@@ -92,16 +92,16 @@ struct gb_bundle *gb_bundle_create(struct gb_interface_block *gb_ib, u8 interfac
/*
 * Tear down a previously set up bundle.
 */
void gb_bundle_destroy(struct gb_interface_block *gb_ib)
void gb_bundle_destroy(struct gb_interface *intf)
{
	struct gb_bundle *bundle;
	struct gb_bundle *temp;

	if (WARN_ON(!gb_ib))
	if (WARN_ON(!intf))
		return;

	spin_lock_irq(&gb_bundles_lock);
	list_for_each_entry_safe(bundle, temp, &gb_ib->bundles, links) {
	list_for_each_entry_safe(bundle, temp, &intf->bundles, links) {
		list_del(&bundle->links);
		gb_bundle_connections_exit(bundle);
		device_del(&bundle->dev);
@@ -109,28 +109,27 @@ void gb_bundle_destroy(struct gb_interface_block *gb_ib)
	spin_unlock_irq(&gb_bundles_lock);
}

int gb_bundle_init(struct gb_interface_block *gb_ib, u8 bundle_id, u8 device_id)
int gb_bundle_init(struct gb_interface *intf, u8 bundle_id, u8 device_id)
{
	struct gb_bundle *bundle;
	int ret;

	bundle = gb_bundle_find(gb_ib, bundle_id);
	bundle = gb_bundle_find(intf, bundle_id);
	if (!bundle) {
		dev_err(gb_ib->hd->parent, "bundle %hhu not found\n",
			bundle_id);
		dev_err(intf->hd->parent, "bundle %hhu not found\n", bundle_id);
		return -ENOENT;
	}
	bundle->device_id = device_id;

	ret = svc_set_route_send(bundle, gb_ib->hd);
	ret = svc_set_route_send(bundle, intf->hd);
	if (ret) {
		dev_err(gb_ib->hd->parent, "failed to set route (%d)\n", ret);
		dev_err(intf->hd->parent, "failed to set route (%d)\n", ret);
		return ret;
	}

	ret = gb_bundle_connections_init(bundle);
	if (ret) {
		dev_err(gb_ib->hd->parent, "interface bundle init error %d\n",
		dev_err(intf->hd->parent, "interface bundle init error %d\n",
			ret);
		/* XXX clear route */
		return ret;
@@ -139,12 +138,12 @@ int gb_bundle_init(struct gb_interface_block *gb_ib, u8 bundle_id, u8 device_id)
	return 0;
}

struct gb_bundle *gb_bundle_find(struct gb_interface_block *gb_ib, u8 bundle_id)
struct gb_bundle *gb_bundle_find(struct gb_interface *intf, u8 bundle_id)
{
	struct gb_bundle *bundle;

	spin_lock_irq(&gb_bundles_lock);
	list_for_each_entry(bundle, &gb_ib->bundles, links)
	list_for_each_entry(bundle, &intf->bundles, links)
		if (bundle->id == bundle_id) {
			spin_unlock_irq(&gb_bundles_lock);
			return bundle;
+5 −5
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
/* Greybus "public" definitions" */
struct gb_bundle {
	struct device		dev;
	struct gb_interface_block	*gb_ib;
	struct gb_interface	*intf;
	u8			id;
	u8			device_id;
	struct list_head	connections;
@@ -25,10 +25,10 @@ struct gb_bundle {
#define to_gb_bundle(d) container_of(d, struct gb_bundle, dev)

/* Greybus "private" definitions" */
struct gb_bundle *gb_bundle_create(struct gb_interface_block *gb_ib, u8 module_id);
void gb_bundle_destroy(struct gb_interface_block *gb_ib);
int gb_bundle_init(struct gb_interface_block *gb_ib, u8 module_id, u8 device_id);
struct gb_bundle *gb_bundle_create(struct gb_interface *intf, u8 module_id);
void gb_bundle_destroy(struct gb_interface *intf);
int gb_bundle_init(struct gb_interface *intf, u8 module_id, u8 device_id);

struct gb_bundle *gb_bundle_find(struct gb_interface_block *gb_ib, u8 bundle_id);
struct gb_bundle *gb_bundle_find(struct gb_interface *intf, u8 bundle_id);

#endif /* __BUNDLE_H */
+2 −2
Original line number Diff line number Diff line
@@ -156,7 +156,7 @@ struct gb_connection *gb_connection_create(struct gb_bundle *bundle,
		return NULL;
	}

	hd = bundle->gb_ib->hd;
	hd = bundle->intf->hd;
	connection->hd = hd;
	if (!gb_connection_hd_cport_id_alloc(connection)) {
		gb_protocol_put(connection->protocol);
@@ -237,7 +237,7 @@ void gb_connection_err(struct gb_connection *connection, const char *fmt, ...)
	vaf.va = &args;

	pr_err("greybus: [%hhu:%hhu:%hu]: %pV\n",
		connection->bundle->gb_ib->module_id,
		connection->bundle->intf->module_id,
		connection->bundle->id,
		connection->bundle_cport_id, &vaf);

Loading