u8 *buffer;
if (size > ES1_GBUF_MSG_SIZE) {
- pr_err("guf was asked to be bigger than %d!\n",
+ pr_err("guf was asked to be bigger than %ld!\n",
ES1_GBUF_MSG_SIZE);
}
return urb;
}
-static int send_gbuf(struct gbuf *gbuf, struct greybus_host_device *hd,
- gfp_t gfp_mask)
+static int submit_gbuf(struct gbuf *gbuf, struct greybus_host_device *hd,
+ gfp_t gfp_mask)
{
struct es1_ap_dev *es1 = hd_to_es1(hd);
struct usb_device *udev = es1->usb_dev;
}
static struct greybus_host_driver es1_driver = {
- .hd_priv_size = sizeof(struct es1_ap_dev),
- .alloc_gbuf = alloc_gbuf,
- .free_gbuf = free_gbuf,
- .send_svc_msg = send_svc_msg,
- .send_gbuf = send_gbuf,
+ .hd_priv_size = sizeof(struct es1_ap_dev),
+ .alloc_gbuf = alloc_gbuf,
+ .free_gbuf = free_gbuf,
+ .send_svc_msg = send_svc_msg,
+ .submit_gbuf = submit_gbuf,
};
/* Callback for when we get a SVC message */
}
EXPORT_SYMBOL_GPL(greybus_get_gbuf);
-int greybus_submit_gbuf(struct gbuf *gbuf, gfp_t mem_flags)
+int greybus_submit_gbuf(struct gbuf *gbuf, gfp_t gfp_mask)
{
- // FIXME - implement
- return -ENOMEM;
+ return gbuf->gdev->hd->driver->submit_gbuf(gbuf, gbuf->gdev->hd, gfp_mask);
}
int greybus_kill_gbuf(struct gbuf *gbuf)
return -ENOMEM;
}
-/* Can be called in interrupt context, do the work and get out of here */
-void greybus_gbuf_finished(struct gbuf *gbuf)
-{
- // FIXME - implement
-}
-EXPORT_SYMBOL_GPL(greybus_gbuf_finished);
-
#define MAX_CPORTS 1024
struct gb_cport_handler {
gbuf_complete_t handler;
}
EXPORT_SYMBOL_GPL(greybus_cport_in_data);
+/* Can be called in interrupt context, do the work and get out of here */
+void greybus_gbuf_finished(struct gbuf *gbuf)
+{
+ struct cport_msg *cm;
+
+ /* Again with the slow allocate... */
+ cm = kmalloc(sizeof(*cm), GFP_ATOMIC);
+ cm->gbuf = gbuf;
+ INIT_WORK(&cm->event, cport_process_event);
+ queue_work(cport_workqueue, &cm->event);
+
+ // FIXME - implement
+}
+EXPORT_SYMBOL_GPL(greybus_gbuf_finished);
+
int gb_gbuf_init(void)
{
cport_workqueue = alloc_workqueue("greybus_gbuf", 0, 1);
int (*alloc_gbuf)(struct gbuf *gbuf, unsigned int size, gfp_t gfp_mask);
void (*free_gbuf)(struct gbuf *gbuf);
- int (*send_svc_msg)(struct svc_msg *svc_msg, struct greybus_host_device *hd);
- int (*send_gbuf)(struct gbuf *gbuf, struct greybus_host_device *hd,
- gfp_t gfp_mask);
+ int (*send_svc_msg)(struct svc_msg *svc_msg,
+ struct greybus_host_device *hd);
+ int (*submit_gbuf)(struct gbuf *gbuf, struct greybus_host_device *hd,
+ gfp_t gfp_mask);
};
struct greybus_host_device {