summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorVinayak Pane <vpane@nvidia.com>2014-02-14 18:48:07 -0800
committerPeter Kim <pekim@nvidia.com>2014-06-12 21:52:16 -0700
commitf989de509c5c92d9d6f1b60ab44877f8b4f4a8fb (patch)
tree4585d2e83b6becea3dcbdc4c13e7e24b6a4a737b /drivers
parent9f19268f389d16846713471dd5914bd269e1002c (diff)
staging: ozwpan: Update to latest drop
Update to driver version 10.00.01.02.05 Bug 1459299 Bug 1466757 Change-Id: I73dcbb97093179c4a69b9e5cbfc4d10a16e228ec Signed-off-by: Vinayak Pane <vpane@nvidia.com> Reviewed-on: http://git-master/r/368040 (cherry picked from commit aaa4d5c3e5e21b3a220b3103b72eee6fda0203b3) Reviewed-on: http://git-master/r/401204 Signed-off-by: Kenneth Kwak <kkwak@nvidia.com> Reviewed-on: http://git-master/r/417514 Reviewed-by: Peter Kim <pekim@nvidia.com> Tested-by: Peter Kim <pekim@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/ozwpan/ozcdev.c39
-rw-r--r--drivers/staging/ozwpan/ozmain.c2
-rw-r--r--drivers/staging/ozwpan/ozpd.c9
-rw-r--r--drivers/staging/ozwpan/ozpd.h8
-rw-r--r--drivers/staging/ozwpan/ozproto.c33
5 files changed, 77 insertions, 14 deletions
diff --git a/drivers/staging/ozwpan/ozcdev.c b/drivers/staging/ozwpan/ozcdev.c
index 9785eaa86b94..7e4559bfe377 100644
--- a/drivers/staging/ozwpan/ozcdev.c
+++ b/drivers/staging/ozwpan/ozcdev.c
@@ -99,11 +99,16 @@ int oz_cdev_open(struct inode *inode, struct file *filp)
{
struct oz_cdev *dev;
- if (!atomic_add_unless(&g_cdev.ref_count, 1, 1))
+ if (!atomic_add_unless(&g_cdev.ref_count, 1, 1)) {
+ oz_trace_msg(O, "OPEN %08X EBUSY\n",
+ (unsigned int)((uintptr_t)filp));
return -EBUSY;
+ }
dev = container_of(inode->i_cdev, struct oz_cdev, cdev);
filp->private_data = dev;
+
+ oz_trace_msg(O, "OPEN %08X OK\n", (unsigned int)((uintptr_t)filp));
return 0;
}
/*------------------------------------------------------------------------------
@@ -112,6 +117,7 @@ int oz_cdev_open(struct inode *inode, struct file *filp)
int oz_cdev_release(struct inode *inode, struct file *filp)
{
atomic_dec(&g_cdev.ref_count);
+ oz_trace_msg(O, "CLOSE %08X\n", (unsigned int)((uintptr_t)filp));
return 0;
}
/*------------------------------------------------------------------------------
@@ -126,14 +132,20 @@ ssize_t oz_cdev_read(struct file *filp, char __user *buf, size_t count,
struct oz_pd *pd;
struct oz_serial_ctx *ctx;
+ oz_trace_msg(O, "READ I %X %04X\n",
+ (unsigned int)((uintptr_t)filp), (int)count);
+
spin_lock_bh(&g_cdev.lock);
pd = g_cdev.active_pd;
if (pd)
oz_pd_get(pd);
is_tftp = (g_cdev.mode & OZ_MODE_TFTP) ? 1 : 0;
spin_unlock_bh(&g_cdev.lock);
- if (pd == NULL)
+ if (pd == NULL) {
+ oz_trace_msg(O, "READ O %X %04X\n",
+ (unsigned int)((uintptr_t)filp), (unsigned int)(-1));
return -1;
+ }
ctx = oz_cdev_claim_ctx(pd);
if (ctx == NULL)
goto out2;
@@ -221,6 +233,8 @@ out1:
oz_cdev_release_ctx(ctx);
out2:
oz_pd_put(pd);
+ oz_trace_msg(O, "READ O %08X %04X\n",
+ (unsigned int)((uintptr_t)filp), (unsigned int)(count));
return count;
}
/*------------------------------------------------------------------------------
@@ -237,16 +251,19 @@ ssize_t oz_cdev_write(struct file *filp, const char __user *buf, size_t count,
struct oz_app_hdr *app_hdr;
struct oz_serial_ctx *ctx;
- if (count > sizeof(ei->data) - sizeof(*elt) - sizeof(*app_hdr))
- return -EINVAL;
+ oz_trace_msg(O, "WRITE I %08X %04X\n",
+ (unsigned int)((uintptr_t)filp), (int)count);
spin_lock_bh(&g_cdev.lock);
pd = g_cdev.active_pd;
if (pd)
oz_pd_get(pd);
spin_unlock_bh(&g_cdev.lock);
- if (pd == NULL)
+ if (pd == NULL) {
+ oz_trace_msg(O, "WRITE O %08X %04X\n",
+ (unsigned int)((uintptr_t)filp), (unsigned int)count);
return -1;
+ }
if (!(pd->state & OZ_PD_S_CONNECTED))
return -ENXIO;
eb = &pd->elt_buff;
@@ -301,6 +318,8 @@ out:
spin_unlock_bh(&eb->lock);
}
oz_pd_put(pd);
+ oz_trace_msg(O, "WRITE O %08X %04X\n",
+ (unsigned int)((uintptr_t)filp), (unsigned int)count);
return count;
}
/*------------------------------------------------------------------------------
@@ -317,11 +336,14 @@ int oz_set_active_pd(const u8 *addr)
spin_lock_bh(&g_cdev.lock);
if (memcmp(g_cdev.active_addr, addr, ETH_ALEN) == 0) {
spin_unlock_bh(&g_cdev.lock);
+ oz_pd_put(pd);
return rc;
}
memcpy(g_cdev.active_addr, addr, ETH_ALEN);
old_pd = g_cdev.active_pd;
g_cdev.active_pd = pd;
+ oz_trace_msg(O, "Active PD:%08x\n",
+ (unsigned int)((uintptr_t)pd));
spin_unlock_bh(&g_cdev.lock);
/*Reset buffer pointers if new device is selected*/
@@ -345,6 +367,7 @@ int oz_set_active_pd(const u8 *addr)
g_cdev.active_pd = NULL;
memset(g_cdev.active_addr, 0,
sizeof(g_cdev.active_addr));
+ oz_trace_msg(O, "Active PD:00000000\n");
spin_unlock_bh(&g_cdev.lock);
if (pd)
oz_pd_put(pd);
@@ -469,6 +492,9 @@ unsigned int oz_cdev_poll(struct file *filp, poll_table *wait)
{
unsigned int ret = 0;
struct oz_cdev *dev = filp->private_data;
+
+ oz_trace_msg(O, "POLL I %08X\n", (unsigned int)((uintptr_t)filp));
+
spin_lock_bh(&dev->lock);
if (dev->active_pd) {
struct oz_serial_ctx *ctx = oz_cdev_claim_ctx(dev->active_pd);
@@ -488,6 +514,9 @@ unsigned int oz_cdev_poll(struct file *filp, poll_table *wait)
if (wait)
poll_wait(filp, &dev->rdq, wait);
+
+ oz_trace_msg(O, "POLL O %08X %08X\n",
+ (unsigned int)((uintptr_t)filp), ret);
return ret;
}
/*------------------------------------------------------------------------------
diff --git a/drivers/staging/ozwpan/ozmain.c b/drivers/staging/ozwpan/ozmain.c
index 8bb7d67da4b6..4287f1067208 100644
--- a/drivers/staging/ozwpan/ozmain.c
+++ b/drivers/staging/ozwpan/ozmain.c
@@ -51,6 +51,6 @@ module_exit(ozwpan_exit);
MODULE_AUTHOR("Chris Kelly");
MODULE_DESCRIPTION("Ozmo Devices USB over WiFi hcd driver");
-MODULE_VERSION("1.2.3-rc10");
+MODULE_VERSION("10.00.01.02.05");
MODULE_LICENSE("GPL");
diff --git a/drivers/staging/ozwpan/ozpd.c b/drivers/staging/ozwpan/ozpd.c
index a99d0b49b45f..ad4acb59e8d9 100644
--- a/drivers/staging/ozwpan/ozpd.c
+++ b/drivers/staging/ozwpan/ozpd.c
@@ -208,7 +208,7 @@ static void oz_pd_free(struct work_struct *work)
struct oz_isoc_stream *st;
struct oz_farewell *fwell;
pd = container_of(work, struct oz_pd, workitem);
- oz_trace("Destroying PD\n");
+ oz_trace_msg(M, "Destroying PD:%p\n", pd);
tasklet_kill(&pd->heartbeat_tasklet);
tasklet_kill(&pd->timeout_tasklet);
/* Delete any streams.
@@ -245,8 +245,10 @@ static void oz_pd_free(struct work_struct *work)
pd->tx_pool = e->next;
kfree(container_of(e, struct oz_tx_frame, link));
}
- if (pd->net_dev)
+ if (pd->net_dev) {
+ oz_trace_msg(M, "dev_put(%p)\n", pd->net_dev);
dev_put(pd->net_dev);
+ }
kfree(pd);
}
@@ -347,7 +349,7 @@ void oz_pd_heartbeat(struct oz_pd *pd, u16 apps)
void oz_pd_stop(struct oz_pd *pd)
{
u16 stop_apps = 0;
- oz_trace("%s: State = 0x%x\n", __func__, pd->state);
+ oz_trace_msg(M, "oz_pd_stop() State = 0x%x\n", pd->state);
oz_polling_lock_bh();
oz_pd_indicate_farewells(pd);
stop_apps = pd->total_apps;
@@ -362,6 +364,7 @@ void oz_pd_stop(struct oz_pd *pd)
oz_polling_unlock_bh();
+ oz_trace_msg(M, "pd ref count = %d\n", atomic_read(&pd->ref_count));
oz_pd_put(pd);
}
/*------------------------------------------------------------------------------
diff --git a/drivers/staging/ozwpan/ozpd.h b/drivers/staging/ozwpan/ozpd.h
index d75f0afa20ed..a4270fe69ee5 100644
--- a/drivers/staging/ozwpan/ozpd.h
+++ b/drivers/staging/ozwpan/ozpd.h
@@ -22,6 +22,13 @@
#define OZ_TIMER_HEARTBEAT 2
#define OZ_TIMER_STOP 3
+
+/* Tasklet Scheduled flag.
+ */
+#define OZ_TASKLET_SCHED_TIMEOUT 0
+#define OZ_TASKLET_SCHED_HEARTBEAT 1
+
+
#define ETH_STRING_LEN 17
/* Data structure that hold information on a frame for transmisson. This is
* built when the frame is first transmitted and is used to rebuild the frame
@@ -100,6 +107,7 @@ struct oz_pd {
u8 timeout_type;
struct tasklet_struct heartbeat_tasklet;
struct tasklet_struct timeout_tasklet;
+ unsigned long tasklet_sched;
struct work_struct workitem;
u8 up_audio_buf;
};
diff --git a/drivers/staging/ozwpan/ozproto.c b/drivers/staging/ozwpan/ozproto.c
index cbb1335f3ce1..f0ac43283588 100644
--- a/drivers/staging/ozwpan/ozproto.c
+++ b/drivers/staging/ozwpan/ozproto.c
@@ -192,6 +192,7 @@ static struct oz_pd *oz_connect_req(struct oz_pd *cur_pd, struct oz_elt *elt,
}
if (pd->net_dev != net_dev) {
old_net_dev = pd->net_dev;
+ oz_trace_msg(M, "dev_hold(%p)\n", net_dev);
dev_hold(net_dev);
pd->net_dev = net_dev;
}
@@ -280,8 +281,10 @@ done:
oz_pd_put(pd);
pd = NULL;
}
- if (old_net_dev)
+ if (old_net_dev) {
+ oz_trace_msg(M, "dev_put(%p)", old_net_dev);
dev_put(old_net_dev);
+ }
if (free_pd)
oz_pd_destroy(free_pd);
return pd;
@@ -456,8 +459,10 @@ void oz_protocol_term(void)
list_del(&b->link);
spin_unlock_bh(&g_binding_lock);
dev_remove_pack(&b->ptype);
- if (b->ptype.dev)
+ if (b->ptype.dev) {
+ oz_trace_msg(M, "dev_put(%p)\n", b->ptype.dev);
dev_put(b->ptype.dev);
+ }
kfree(b);
spin_lock_bh(&g_binding_lock);
}
@@ -492,7 +497,7 @@ void oz_pd_heartbeat_handler(unsigned long data)
spin_unlock_bh(&g_polling_lock);
if (apps)
oz_pd_heartbeat(pd, apps);
-
+ clear_bit(OZ_TASKLET_SCHED_HEARTBEAT, &pd->tasklet_sched);
oz_pd_put(pd);
}
/*------------------------------------------------------------------------------
@@ -516,6 +521,7 @@ void oz_pd_timeout_handler(unsigned long data)
oz_pd_stop(pd);
break;
}
+ clear_bit(OZ_TASKLET_SCHED_TIMEOUT, &pd->tasklet_sched);
oz_pd_put(pd);
}
/*------------------------------------------------------------------------------
@@ -529,7 +535,15 @@ enum hrtimer_restart oz_pd_heartbeat_event(struct hrtimer *timer)
hrtimer_forward(timer,
hrtimer_get_expires(timer), pd->pulse_period);
oz_pd_get(pd);
- tasklet_schedule(&pd->heartbeat_tasklet);
+ if (!test_and_set_bit(OZ_TASKLET_SCHED_HEARTBEAT, &pd->tasklet_sched)) {
+ /* schedule tasklet! */
+ tasklet_schedule(&pd->heartbeat_tasklet);
+ } else {
+ /* oz_pd_heartbeat_handler is already scheduled or running.
+ * decrement pd counter.
+ */
+ oz_pd_put(pd);
+ }
return HRTIMER_RESTART;
}
/*------------------------------------------------------------------------------
@@ -541,7 +555,15 @@ enum hrtimer_restart oz_pd_timeout_event(struct hrtimer *timer)
pd = container_of(timer, struct oz_pd, timeout);
oz_pd_get(pd);
- tasklet_schedule(&pd->timeout_tasklet);
+ if (!test_and_set_bit(OZ_TASKLET_SCHED_TIMEOUT, &pd->tasklet_sched)) {
+ /* Schedule tasklet! */
+ tasklet_schedule(&pd->timeout_tasklet);
+ } else {
+ /* oz_pd_timeout_handler is already scheduled or running.
+ * decrement pd counter.
+ */
+ oz_pd_put(pd);
+ }
return HRTIMER_NORESTART;
}
/*------------------------------------------------------------------------------
@@ -741,6 +763,7 @@ void oz_binding_remove(const char *net_dev)
if (found) {
dev_remove_pack(&binding->ptype);
if (binding->ptype.dev) {
+ oz_trace_msg(M, "dev_put(%s)\n", binding->name);
dev_put(binding->ptype.dev);
pd_stop_all_for_device(binding->ptype.dev);
}