]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
greybus: core: re-use gb_module_find() in gb_remove_module()
authorViresh Kumar <viresh.kumar@linaro.org>
Fri, 14 Nov 2014 11:55:05 +0000 (17:25 +0530)
committerGreg Kroah-Hartman <greg@kroah.com>
Fri, 14 Nov 2014 21:49:04 +0000 (13:49 -0800)
Also fix print message.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/staging/greybus/core.c

index 4604649b5698dfd5709192bc9d00f0f41d6dee01..851a3021259f7e0ed5e440c3287056e168b46153 100644 (file)
@@ -162,19 +162,12 @@ err_module:
 
 void gb_remove_module(struct greybus_host_device *hd, u8 module_id)
 {
-       struct gb_module *gmod;
-       bool found = false;
-
-       list_for_each_entry(gmod, &hd->modules, links)
-               if (gmod->module_id == module_id) {
-                       found = true;
-                       break;
-               }
+       struct gb_module *gmod = gb_module_find(hd, module_id);
 
-       if (found)
+       if (gmod)
                gb_module_destroy(gmod);
        else
-               dev_err(hd->parent, "module id %d remove error\n", module_id);
+               dev_err(hd->parent, "module id %d not found\n", module_id);
 }
 
 static void gb_remove_modules(struct greybus_host_device *hd)