Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f2152eb3 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman
Browse files

greybus: manifest: refactor cport-descriptor release



Add helper function to release cport-descriptors with a given bundle id.

Signed-off-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent e1442f69
Loading
Loading
Loading
Loading
+17 −8
Original line number Original line Diff line number Diff line
@@ -60,6 +60,22 @@ static void release_manifest_descriptors(struct gb_interface *intf)
		release_manifest_descriptor(descriptor);
		release_manifest_descriptor(descriptor);
}
}


static void release_cport_descriptors(struct list_head *head, u8 bundle_id)
{
	struct manifest_desc *desc, *tmp;
	struct greybus_descriptor_cport *desc_cport;

	list_for_each_entry_safe(desc, tmp, head, links) {
		desc_cport = desc->data;

		if (desc->type != GREYBUS_TYPE_CPORT)
			continue;

		if (desc_cport->bundle == bundle_id)
			release_manifest_descriptor(desc);
	}
}

static struct manifest_desc *get_next_bundle_desc(struct gb_interface *intf)
static struct manifest_desc *get_next_bundle_desc(struct gb_interface *intf)
{
{
	struct manifest_desc *descriptor;
	struct manifest_desc *descriptor;
@@ -275,14 +291,7 @@ static u32 gb_manifest_parse_cports(struct gb_bundle *bundle)
	 * Free all cports for this bundle to avoid 'excess descriptors'
	 * Free all cports for this bundle to avoid 'excess descriptors'
	 * warnings.
	 * warnings.
	 */
	 */
	list_for_each_entry_safe(desc, next, &intf->manifest_descs, links) {
	release_cport_descriptors(&intf->manifest_descs, bundle_id);
		struct greybus_descriptor_cport *desc_cport = desc->data;

		if (desc->type != GREYBUS_TYPE_CPORT)
			continue;
		if (desc_cport->bundle == bundle_id)
			release_manifest_descriptor(desc);
	}


	return 0;	/* Error; count should also be 0 */
	return 0;	/* Error; count should also be 0 */
}
}