Commit f036e056 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

greybus: gbuf: implement submission logic

parent 29f000f4
...@@ -96,7 +96,7 @@ static int alloc_gbuf(struct gbuf *gbuf, unsigned int size, gfp_t gfp_mask) ...@@ -96,7 +96,7 @@ static int alloc_gbuf(struct gbuf *gbuf, unsigned int size, gfp_t gfp_mask)
u8 *buffer; u8 *buffer;
if (size > ES1_GBUF_MSG_SIZE) { 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); ES1_GBUF_MSG_SIZE);
} }
...@@ -189,8 +189,8 @@ static struct urb *next_free_urb(struct es1_ap_dev *es1, gfp_t gfp_mask) ...@@ -189,8 +189,8 @@ static struct urb *next_free_urb(struct es1_ap_dev *es1, gfp_t gfp_mask)
return urb; return urb;
} }
static int send_gbuf(struct gbuf *gbuf, struct greybus_host_device *hd, static int submit_gbuf(struct gbuf *gbuf, struct greybus_host_device *hd,
gfp_t gfp_mask) gfp_t gfp_mask)
{ {
struct es1_ap_dev *es1 = hd_to_es1(hd); struct es1_ap_dev *es1 = hd_to_es1(hd);
struct usb_device *udev = es1->usb_dev; struct usb_device *udev = es1->usb_dev;
...@@ -216,11 +216,11 @@ static int send_gbuf(struct gbuf *gbuf, struct greybus_host_device *hd, ...@@ -216,11 +216,11 @@ static int send_gbuf(struct gbuf *gbuf, struct greybus_host_device *hd,
} }
static struct greybus_host_driver es1_driver = { static struct greybus_host_driver es1_driver = {
.hd_priv_size = sizeof(struct es1_ap_dev), .hd_priv_size = sizeof(struct es1_ap_dev),
.alloc_gbuf = alloc_gbuf, .alloc_gbuf = alloc_gbuf,
.free_gbuf = free_gbuf, .free_gbuf = free_gbuf,
.send_svc_msg = send_svc_msg, .send_svc_msg = send_svc_msg,
.send_gbuf = send_gbuf, .submit_gbuf = submit_gbuf,
}; };
/* Callback for when we get a SVC message */ /* Callback for when we get a SVC message */
......
...@@ -112,10 +112,9 @@ struct gbuf *greybus_get_gbuf(struct gbuf *gbuf) ...@@ -112,10 +112,9 @@ struct gbuf *greybus_get_gbuf(struct gbuf *gbuf)
} }
EXPORT_SYMBOL_GPL(greybus_get_gbuf); 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 gbuf->gdev->hd->driver->submit_gbuf(gbuf, gbuf->gdev->hd, gfp_mask);
return -ENOMEM;
} }
int greybus_kill_gbuf(struct gbuf *gbuf) int greybus_kill_gbuf(struct gbuf *gbuf)
...@@ -124,13 +123,6 @@ int greybus_kill_gbuf(struct gbuf *gbuf) ...@@ -124,13 +123,6 @@ int greybus_kill_gbuf(struct gbuf *gbuf)
return -ENOMEM; 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 #define MAX_CPORTS 1024
struct gb_cport_handler { struct gb_cport_handler {
gbuf_complete_t handler; gbuf_complete_t handler;
...@@ -236,6 +228,21 @@ void greybus_cport_in_data(struct greybus_host_device *hd, int cport, u8 *data, ...@@ -236,6 +228,21 @@ void greybus_cport_in_data(struct greybus_host_device *hd, int cport, u8 *data,
} }
EXPORT_SYMBOL_GPL(greybus_cport_in_data); 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) int gb_gbuf_init(void)
{ {
cport_workqueue = alloc_workqueue("greybus_gbuf", 0, 1); cport_workqueue = alloc_workqueue("greybus_gbuf", 0, 1);
......
...@@ -107,9 +107,10 @@ struct greybus_host_driver { ...@@ -107,9 +107,10 @@ struct greybus_host_driver {
int (*alloc_gbuf)(struct gbuf *gbuf, unsigned int size, gfp_t gfp_mask); int (*alloc_gbuf)(struct gbuf *gbuf, unsigned int size, gfp_t gfp_mask);
void (*free_gbuf)(struct gbuf *gbuf); void (*free_gbuf)(struct gbuf *gbuf);
int (*send_svc_msg)(struct svc_msg *svc_msg, struct greybus_host_device *hd); int (*send_svc_msg)(struct svc_msg *svc_msg,
int (*send_gbuf)(struct gbuf *gbuf, struct greybus_host_device *hd, struct greybus_host_device *hd);
gfp_t gfp_mask); int (*submit_gbuf)(struct gbuf *gbuf, struct greybus_host_device *hd,
gfp_t gfp_mask);
}; };
struct greybus_host_device { struct greybus_host_device {
......
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