Commit 4afbba07 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

greybus: core: make greybus_kill_gbuf not return a value

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: default avatarGreg Kroah-Hartman <greg@kroah.com>
Reviewed-by: default avatarAlex Elder <elder@linaro.org>
parent 724b619d
......@@ -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;
}
......
......@@ -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 */
......
......@@ -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
......
......@@ -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 {
......
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment