greybus: gbuf: implement submission logic
This commit is contained in:
parent
29f000f434
commit
f036e05600
@ -96,7 +96,7 @@ static int alloc_gbuf(struct gbuf *gbuf, unsigned int size, gfp_t gfp_mask)
|
||||
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);
|
||||
}
|
||||
|
||||
@ -189,8 +189,8 @@ static struct urb *next_free_urb(struct es1_ap_dev *es1, gfp_t gfp_mask)
|
||||
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;
|
||||
@ -216,11 +216,11 @@ static int send_gbuf(struct gbuf *gbuf, struct greybus_host_device *hd,
|
||||
}
|
||||
|
||||
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 */
|
||||
|
@ -112,10 +112,9 @@ struct gbuf *greybus_get_gbuf(struct gbuf *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 -ENOMEM;
|
||||
return gbuf->gdev->hd->driver->submit_gbuf(gbuf, gbuf->gdev->hd, gfp_mask);
|
||||
}
|
||||
|
||||
int greybus_kill_gbuf(struct gbuf *gbuf)
|
||||
@ -124,13 +123,6 @@ 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;
|
||||
@ -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);
|
||||
|
||||
/* 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);
|
||||
|
@ -107,9 +107,10 @@ struct greybus_host_driver {
|
||||
|
||||
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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user