summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/es2.c
diff options
context:
space:
mode:
authorAlex Elder <elder@linaro.org>2015-10-27 22:18:39 -0500
committerGreg Kroah-Hartman <gregkh@google.com>2015-11-02 10:38:36 -0800
commit8995a39d6d030b48633c9a2ed85d3244907acff0 (patch)
treeee6f30568b806f7cf621ea463346fe7c702432eb /drivers/staging/greybus/es2.c
parent1482b3e1a8ab924cca4dc7e2ac9f40c0e9ff37c9 (diff)
downloadop-kernel-dev-8995a39d6d030b48633c9a2ed85d3244907acff0.zip
op-kernel-dev-8995a39d6d030b48633c9a2ed85d3244907acff0.tar.gz
greybus: es2: move logging fifo into es2 struct
Continue moving the logging data structures into the es2 AP data structure rather than having it be a single global. This patch moves the fifo. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/es2.c')
-rw-r--r--drivers/staging/greybus/es2.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/staging/greybus/es2.c b/drivers/staging/greybus/es2.c
index a4b54d3..3de5ba19 100644
--- a/drivers/staging/greybus/es2.c
+++ b/drivers/staging/greybus/es2.c
@@ -31,7 +31,6 @@ MODULE_DEVICE_TABLE(usb, id_table);
#define APB1_LOG_SIZE SZ_16K
static struct dentry *apb1_log_dentry;
static struct dentry *apb1_log_enable_dentry;
-static DEFINE_KFIFO(apb1_log_fifo, char, APB1_LOG_SIZE);
/* Number of bulk in and bulk out couple */
#define NUM_BULKS 7
@@ -98,6 +97,7 @@ struct es2_cport_out {
* @cport_out_urb_lock: locks the @cport_out_urb_busy "list"
*
* @apb1_log_task: task pointer for logging thread
+ * @apb1_log_fifo: kernel FIFO to carry logged data
*/
struct es2_ap_dev {
struct usb_device *usb_dev;
@@ -114,6 +114,7 @@ struct es2_ap_dev {
int *cport_to_ep;
struct task_struct *apb1_log_task;
+ DECLARE_KFIFO(apb1_log_fifo, char, APB1_LOG_SIZE);
};
/**
@@ -629,7 +630,7 @@ static void apb1_log_get(struct es2_ap_dev *es2, char *buf)
APB1_LOG_MSG_SIZE,
ES2_TIMEOUT);
if (retval > 0)
- kfifo_in(&apb1_log_fifo, buf, retval);
+ kfifo_in(&es2->apb1_log_fifo, buf, retval);
} while (retval > 0);
}
@@ -655,6 +656,7 @@ static int apb1_log_poll(void *data)
static ssize_t apb1_log_read(struct file *f, char __user *buf,
size_t count, loff_t *ppos)
{
+ struct es2_ap_dev *es2 = f->f_inode->i_private;
ssize_t ret;
size_t copied;
char *tmp_buf;
@@ -666,7 +668,7 @@ static ssize_t apb1_log_read(struct file *f, char __user *buf,
if (!tmp_buf)
return -ENOMEM;
- copied = kfifo_out(&apb1_log_fifo, tmp_buf, count);
+ copied = kfifo_out(&es2->apb1_log_fifo, tmp_buf, count);
ret = simple_read_from_buffer(buf, count, ppos, tmp_buf, copied);
kfree(tmp_buf);
@@ -815,6 +817,7 @@ static int ap_probe(struct usb_interface *interface,
es2->usb_intf = interface;
es2->usb_dev = udev;
spin_lock_init(&es2->cport_out_urb_lock);
+ INIT_KFIFO(es2->apb1_log_fifo);
usb_set_intfdata(interface, es2);
es2->cport_to_ep = kcalloc(hd->num_cports, sizeof(*es2->cport_to_ep),
OpenPOWER on IntegriCloud