greybus: core: make greybus_kill_gbuf not return a value
authorGreg Kroah-Hartman <greg@kroah.com>
Mon, 27 Oct 2014 06:01:06 +0000 (14:01 +0800)
committerGreg Kroah-Hartman <greg@kroah.com>
Mon, 27 Oct 2014 07:05:03 +0000 (15:05 +0800)
We can't do anything if killing a gbuf fails, so just make this function
"always" be successful.

At the same time, make the host controller function also be called
"kill_gbuf" to keep the terminology in sync.

Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Reviewed-by: Alex Elder <elder@linaro.org>
drivers/staging/greybus/core.c
drivers/staging/greybus/es1-ap-usb.c
drivers/staging/greybus/gbuf.c
drivers/staging/greybus/greybus.h
drivers/staging/greybus/operation.c

index 1436b3d..61fd690 100644 (file)
@@ -216,7 +216,7 @@ struct greybus_host_device *greybus_create_hd(struct greybus_host_driver *driver
            (!driver->free_gbuf_data) ||
            (!driver->submit_svc) ||
            (!driver->submit_gbuf) ||
-           (!driver->abort_gbuf)) {
+           (!driver->kill_gbuf)) {
                pr_err("Must implement all greybus_host_driver callbacks!\n");
                return NULL;
        }
index a207294..b8784b1 100644 (file)
@@ -234,15 +234,14 @@ static int submit_gbuf(struct gbuf *gbuf, gfp_t gfp_mask)
        return retval;
 }
 
-static int abort_gbuf(struct gbuf *gbuf)
+static void kill_gbuf(struct gbuf *gbuf)
 {
        struct urb *urb = gbuf->hcd_data;
 
        if (!urb)
-               return -EINVAL;
+               return;
 
        usb_kill_urb(urb);
-       return 0;
 }
 
 static struct greybus_host_driver es1_driver = {
@@ -251,7 +250,7 @@ static struct greybus_host_driver es1_driver = {
        .free_gbuf_data         = free_gbuf_data,
        .submit_svc             = submit_svc,
        .submit_gbuf            = submit_gbuf,
-       .abort_gbuf             = abort_gbuf,
+       .kill_gbuf              = kill_gbuf,
 };
 
 /* Common function to report consistent warnings based on URB status */
index 726a1f4..4f591aa 100644 (file)
@@ -104,14 +104,14 @@ int greybus_submit_gbuf(struct gbuf *gbuf, gfp_t gfp_mask)
        return hd->driver->submit_gbuf(gbuf, gfp_mask);
 }
 
-int greybus_kill_gbuf(struct gbuf *gbuf)
+void greybus_kill_gbuf(struct gbuf *gbuf)
 {
        struct greybus_host_device *hd = gbuf->connection->hd;
 
        if (gbuf->status != -EINPROGRESS)
-               return -EINVAL;
+               return;
 
-       return hd->driver->abort_gbuf(gbuf);
+       hd->driver->kill_gbuf(gbuf);
 }
 
 #define MAX_CPORTS     1024
index 8b6ea05..1e3f31d 100644 (file)
@@ -170,7 +170,7 @@ struct greybus_host_driver {
        int (*submit_svc)(struct svc_msg *svc_msg,
                            struct greybus_host_device *hd);
        int (*submit_gbuf)(struct gbuf *gbuf, gfp_t gfp_mask);
-       int (*abort_gbuf)(struct gbuf *gbuf);
+       void (*kill_gbuf)(struct gbuf *gbuf);
 };
 
 struct greybus_host_device {
@@ -203,7 +203,7 @@ struct gbuf *greybus_get_gbuf(struct gbuf *gbuf);
 #define greybus_put_gbuf       greybus_free_gbuf
 
 int greybus_submit_gbuf(struct gbuf *gbuf, gfp_t mem_flags);
-int greybus_kill_gbuf(struct gbuf *gbuf);
+void greybus_kill_gbuf(struct gbuf *gbuf);
 
 
 struct greybus_driver {
index c94e509..9b889b1 100644 (file)
@@ -175,7 +175,7 @@ int gb_operation_wait(struct gb_operation *operation)
        ret = wait_for_completion_interruptible(&operation->completion);
        /* If interrupted, cancel the in-flight buffer */
        if (ret < 0)
-               ret = greybus_kill_gbuf(operation->request);
+               greybus_kill_gbuf(operation->request);
        return ret;
 
 }
@@ -519,17 +519,10 @@ void gb_connection_operation_recv(struct gb_connection *connection,
  */
 void gb_operation_cancel(struct gb_operation *operation)
 {
-       int ret;
-
        operation->canceled = true;
-       ret = greybus_kill_gbuf(operation->request);
-       if (ret)
-               pr_warn("error %d killing request gbuf\n", ret);
-       if (operation->response) {
-               ret = greybus_kill_gbuf(operation->response);
-               if (ret)
-                       pr_warn("error %d killing response gbuf\n", ret);
-       }
+       greybus_kill_gbuf(operation->request);
+       if (operation->response)
+               greybus_kill_gbuf(operation->response);
 }
 
 int gb_operation_init(void)