diff options
author | Alex Elder <elder@linaro.org> | 2015-10-27 22:18:38 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2015-11-02 10:38:36 -0800 |
commit | 1482b3e1a8ab924cca4dc7e2ac9f40c0e9ff37c9 (patch) | |
tree | 9851f89d92b708b7c42d57217485b29a84b22ec2 /drivers/staging/greybus/es2.c | |
parent | 4b1d82047ebbb108e9961fffd51f8ccd54459221 (diff) | |
download | op-kernel-dev-1482b3e1a8ab924cca4dc7e2ac9f40c0e9ff37c9.zip op-kernel-dev-1482b3e1a8ab924cca4dc7e2ac9f40c0e9ff37c9.tar.gz |
greybus: es2: move APB log task into the es2_ap_dev struct
If an APB has a logging task it is associated with that APB. Move
the task pointer into the es2_ap_dev structure rather than having it
be a single global.
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.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/staging/greybus/es2.c b/drivers/staging/greybus/es2.c index e51516f..a4b54d3 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 struct task_struct *apb1_log_task; static DEFINE_KFIFO(apb1_log_fifo, char, APB1_LOG_SIZE); /* Number of bulk in and bulk out couple */ @@ -97,6 +96,8 @@ struct es2_cport_out { * @cport_out_urb_cancelled: array of flags indicating whether the * corresponding @cport_out_urb is being cancelled * @cport_out_urb_lock: locks the @cport_out_urb_busy "list" + * + * @apb1_log_task: task pointer for logging thread */ struct es2_ap_dev { struct usb_device *usb_dev; @@ -111,6 +112,8 @@ struct es2_ap_dev { spinlock_t cport_out_urb_lock; int *cport_to_ep; + + struct task_struct *apb1_log_task; }; /** @@ -677,12 +680,12 @@ static const struct file_operations apb1_log_fops = { static void usb_log_enable(struct es2_ap_dev *es2) { - if (!IS_ERR_OR_NULL(apb1_log_task)) + if (!IS_ERR_OR_NULL(es2->apb1_log_task)) return; /* get log from APB1 */ - apb1_log_task = kthread_run(apb1_log_poll, es2, "apb1_log"); - if (IS_ERR(apb1_log_task)) + es2->apb1_log_task = kthread_run(apb1_log_poll, es2, "apb1_log"); + if (IS_ERR(es2->apb1_log_task)) return; apb1_log_dentry = debugfs_create_file("apb1_log", S_IRUGO, gb_debugfs_get(), NULL, @@ -691,20 +694,21 @@ static void usb_log_enable(struct es2_ap_dev *es2) static void usb_log_disable(struct es2_ap_dev *es2) { - if (IS_ERR_OR_NULL(apb1_log_task)) + if (IS_ERR_OR_NULL(es2->apb1_log_task)) return; debugfs_remove(apb1_log_dentry); apb1_log_dentry = NULL; - kthread_stop(apb1_log_task); - apb1_log_task = NULL; + kthread_stop(es2->apb1_log_task); + es2->apb1_log_task = NULL; } static ssize_t apb1_log_enable_read(struct file *f, char __user *buf, size_t count, loff_t *ppos) { - int enable = !IS_ERR_OR_NULL(apb1_log_task); + struct es2_ap_dev *es2 = f->f_inode->i_private; + int enable = !IS_ERR_OR_NULL(es2->apb1_log_task); char tmp_buf[3]; sprintf(tmp_buf, "%d\n", enable); @@ -716,7 +720,7 @@ static ssize_t apb1_log_enable_write(struct file *f, const char __user *buf, { int enable; ssize_t retval; - struct es2_ap_dev *es2 = (struct es2_ap_dev *)f->f_inode->i_private; + struct es2_ap_dev *es2 = f->f_inode->i_private; retval = kstrtoint_from_user(buf, count, 10, &enable); if (retval) |