Loading drivers/platform/msm/ipa/ipa_v3/ipa_odl.c +48 −41 Original line number Original line Diff line number Diff line Loading @@ -14,6 +14,7 @@ #include "ipa_odl.h" #include "ipa_odl.h" #include <linux/msm_ipa.h> #include <linux/msm_ipa.h> #include <linux/sched/signal.h> #include <linux/sched/signal.h> #include <linux/poll.h> struct ipa_odl_context *ipa3_odl_ctx; struct ipa_odl_context *ipa3_odl_ctx; Loading Loading @@ -96,21 +97,23 @@ static ssize_t ipa_odl_ctl_fops_read(struct file *filp, char __user *buf, bool new_state = false; bool new_state = false; start = buf; start = buf; while (1) { wait_event_interruptible(odl_ctl_msg_wq, ipa3_odl_ctx->odl_ctl_msg_wq_flag == true); ipa3_odl_ctx->odl_ctl_msg_wq_flag = false; ipa3_odl_ctx->odl_ctl_msg_wq_flag = false; if (!ipa3_odl_ctx->odl_state.adpl_open && if (!ipa3_odl_ctx->odl_state.adpl_open && !ipa3_odl_ctx->odl_state.odl_disconnected) !ipa3_odl_ctx->odl_state.odl_disconnected) { break; IPADBG("Failed to send data odl pipe already disconnected\n"); ret = -EFAULT; goto send_failed; } if (ipa3_odl_ctx->odl_state.odl_ep_setup) if (ipa3_odl_ctx->odl_state.odl_ep_setup) new_state = true; new_state = true; else if (ipa3_odl_ctx->odl_state.odl_disconnected) else if (ipa3_odl_ctx->odl_state.odl_disconnected) new_state = false; new_state = false; else { else { ret = -EAGAIN; IPADBG("Failed to send data odl already running\n"); break; ret = -EFAULT; goto send_failed; } } if (old_state != new_state) { if (old_state != new_state) { Loading @@ -123,8 +126,9 @@ static ssize_t ipa_odl_ctl_fops_read(struct file *filp, char __user *buf, if (copy_to_user(buf, &data, if (copy_to_user(buf, &data, sizeof(data))) { sizeof(data))) { IPADBG("Cpoying data to user failed\n"); ret = -EFAULT; ret = -EFAULT; break; goto send_failed; } } buf += sizeof(data); buf += sizeof(data); Loading @@ -134,24 +138,26 @@ static ssize_t ipa_odl_ctl_fops_read(struct file *filp, char __user *buf, true; true; } } ret = -EAGAIN; if (filp->f_flags & O_NONBLOCK) break; ret = -EINTR; if (signal_pending(current)) break; if (start != buf) break; } if (start != buf && ret != -EFAULT) if (start != buf && ret != -EFAULT) ret = buf - start; ret = buf - start; send_failed: return ret; return ret; } } static unsigned int ipa_odl_ctl_fops_poll(struct file *file, poll_table *wait) { unsigned int mask = 0; poll_wait(file, &odl_ctl_msg_wq, wait); if (ipa3_odl_ctx->odl_ctl_msg_wq_flag == true) { IPADBG("Sending read mask to odl control pipe\n"); mask |= POLLIN | POLLRDNORM; } return mask; } static long ipa_odl_ctl_fops_ioctl(struct file *filp, unsigned int cmd, static long ipa_odl_ctl_fops_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) unsigned long arg) { { Loading Loading @@ -565,6 +571,7 @@ static const struct file_operations ipa_odl_ctl_fops = { .release = ipa_odl_ctl_fops_release, .release = ipa_odl_ctl_fops_release, .read = ipa_odl_ctl_fops_read, .read = ipa_odl_ctl_fops_read, .unlocked_ioctl = ipa_odl_ctl_fops_ioctl, .unlocked_ioctl = ipa_odl_ctl_fops_ioctl, .poll = ipa_odl_ctl_fops_poll, }; }; static const struct file_operations ipa_adpl_fops = { static const struct file_operations ipa_adpl_fops = { Loading Loading
drivers/platform/msm/ipa/ipa_v3/ipa_odl.c +48 −41 Original line number Original line Diff line number Diff line Loading @@ -14,6 +14,7 @@ #include "ipa_odl.h" #include "ipa_odl.h" #include <linux/msm_ipa.h> #include <linux/msm_ipa.h> #include <linux/sched/signal.h> #include <linux/sched/signal.h> #include <linux/poll.h> struct ipa_odl_context *ipa3_odl_ctx; struct ipa_odl_context *ipa3_odl_ctx; Loading Loading @@ -96,21 +97,23 @@ static ssize_t ipa_odl_ctl_fops_read(struct file *filp, char __user *buf, bool new_state = false; bool new_state = false; start = buf; start = buf; while (1) { wait_event_interruptible(odl_ctl_msg_wq, ipa3_odl_ctx->odl_ctl_msg_wq_flag == true); ipa3_odl_ctx->odl_ctl_msg_wq_flag = false; ipa3_odl_ctx->odl_ctl_msg_wq_flag = false; if (!ipa3_odl_ctx->odl_state.adpl_open && if (!ipa3_odl_ctx->odl_state.adpl_open && !ipa3_odl_ctx->odl_state.odl_disconnected) !ipa3_odl_ctx->odl_state.odl_disconnected) { break; IPADBG("Failed to send data odl pipe already disconnected\n"); ret = -EFAULT; goto send_failed; } if (ipa3_odl_ctx->odl_state.odl_ep_setup) if (ipa3_odl_ctx->odl_state.odl_ep_setup) new_state = true; new_state = true; else if (ipa3_odl_ctx->odl_state.odl_disconnected) else if (ipa3_odl_ctx->odl_state.odl_disconnected) new_state = false; new_state = false; else { else { ret = -EAGAIN; IPADBG("Failed to send data odl already running\n"); break; ret = -EFAULT; goto send_failed; } } if (old_state != new_state) { if (old_state != new_state) { Loading @@ -123,8 +126,9 @@ static ssize_t ipa_odl_ctl_fops_read(struct file *filp, char __user *buf, if (copy_to_user(buf, &data, if (copy_to_user(buf, &data, sizeof(data))) { sizeof(data))) { IPADBG("Cpoying data to user failed\n"); ret = -EFAULT; ret = -EFAULT; break; goto send_failed; } } buf += sizeof(data); buf += sizeof(data); Loading @@ -134,24 +138,26 @@ static ssize_t ipa_odl_ctl_fops_read(struct file *filp, char __user *buf, true; true; } } ret = -EAGAIN; if (filp->f_flags & O_NONBLOCK) break; ret = -EINTR; if (signal_pending(current)) break; if (start != buf) break; } if (start != buf && ret != -EFAULT) if (start != buf && ret != -EFAULT) ret = buf - start; ret = buf - start; send_failed: return ret; return ret; } } static unsigned int ipa_odl_ctl_fops_poll(struct file *file, poll_table *wait) { unsigned int mask = 0; poll_wait(file, &odl_ctl_msg_wq, wait); if (ipa3_odl_ctx->odl_ctl_msg_wq_flag == true) { IPADBG("Sending read mask to odl control pipe\n"); mask |= POLLIN | POLLRDNORM; } return mask; } static long ipa_odl_ctl_fops_ioctl(struct file *filp, unsigned int cmd, static long ipa_odl_ctl_fops_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) unsigned long arg) { { Loading Loading @@ -565,6 +571,7 @@ static const struct file_operations ipa_odl_ctl_fops = { .release = ipa_odl_ctl_fops_release, .release = ipa_odl_ctl_fops_release, .read = ipa_odl_ctl_fops_read, .read = ipa_odl_ctl_fops_read, .unlocked_ioctl = ipa_odl_ctl_fops_ioctl, .unlocked_ioctl = ipa_odl_ctl_fops_ioctl, .poll = ipa_odl_ctl_fops_poll, }; }; static const struct file_operations ipa_adpl_fops = { static const struct file_operations ipa_adpl_fops = { Loading