summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/manifest.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@hovoldconsulting.com>2015-11-25 15:59:25 +0100
committerGreg Kroah-Hartman <gregkh@google.com>2015-11-25 15:39:16 -0800
commitf2152eb33dec35703176e792da2769e88e5a81d3 (patch)
tree476e63b19bbe4222ff89aef2ed5f74b87ddc596c /drivers/staging/greybus/manifest.c
parente1442f6910da337a879e44f32909844986714a4b (diff)
downloadlinux-f2152eb33dec35703176e792da2769e88e5a81d3.tar.bz2
greybus: manifest: refactor cport-descriptor release
Add helper function to release cport-descriptors with a given bundle id. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/manifest.c')
-rw-r--r--drivers/staging/greybus/manifest.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/drivers/staging/greybus/manifest.c b/drivers/staging/greybus/manifest.c
index 9252bf46bcc4..4fdb98d19eb8 100644
--- a/drivers/staging/greybus/manifest.c
+++ b/drivers/staging/greybus/manifest.c
@@ -60,6 +60,22 @@ static void release_manifest_descriptors(struct gb_interface *intf)
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)
{
struct manifest_desc *descriptor;
@@ -275,14 +291,7 @@ exit:
* Free all cports for this bundle to avoid 'excess descriptors'
* warnings.
*/
- list_for_each_entry_safe(desc, next, &intf->manifest_descs, links) {
- 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);
- }
+ release_cport_descriptors(&intf->manifest_descs, bundle_id);
return 0; /* Error; count should also be 0 */
}