* so that we don't have to every time we make them.
*/
if ((!driver->buffer_alloc) || (!driver->buffer_free) ||
- (!driver->submit_svc) ||
(!driver->submit_gbuf) ||
- (!driver->kill_gbuf)) {
+ (!driver->buffer_cancel) ||
+ (!driver->submit_svc)) {
pr_err("Must implement all greybus_host_driver callbacks!\n");
return NULL;
}
return retval;
}
-static void kill_gbuf(struct gbuf *gbuf)
+static void buffer_cancel(void *cookie)
{
- struct urb *urb = gbuf->hcd_data;
-
- if (!urb)
- return;
+ struct urb *urb = cookie;
+ /*
+ * We really should be defensive and track all outstanding
+ * (sent) buffers rather than trusting the cookie provided
+ * is valid. For the time being, this will do.
+ */
usb_kill_urb(urb);
}
.hd_priv_size = sizeof(struct es1_ap_dev),
.buffer_alloc = buffer_alloc,
.buffer_free = buffer_free,
- .submit_svc = submit_svc,
.submit_gbuf = submit_gbuf,
- .kill_gbuf = kill_gbuf,
+ .buffer_cancel = buffer_cancel,
+ .submit_svc = submit_svc,
};
/* Common function to report consistent warnings based on URB status */
void *(*buffer_alloc)(unsigned int size, gfp_t gfp_mask);
void (*buffer_free)(void *buffer);
+ int (*submit_gbuf)(struct gbuf *gbuf, gfp_t gfp_mask);
+ void (*buffer_cancel)(void *cookie);
int (*submit_svc)(struct svc_msg *svc_msg,
struct greybus_host_device *hd);
- int (*submit_gbuf)(struct gbuf *gbuf, gfp_t gfp_mask);
- void (*kill_gbuf)(struct gbuf *gbuf);
};
struct greybus_host_device {
if (gbuf->status != -EINPROGRESS)
return;
- gbuf->hd->driver->kill_gbuf(gbuf);
+ gbuf->hd->driver->buffer_cancel(gbuf->hcd_data);
}
+
/*
* An operations's response message has arrived. If no callback was
* supplied it was submitted for asynchronous completion, so we notify