diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-21 12:11:44 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-21 12:11:44 -0800 |
commit | b5c78e04dd061b776978dad61dd85357081147b0 (patch) | |
tree | 2416b2dc61c452c3aeb2a32bcedf15e6257be638 /drivers/staging/ozwpan | |
parent | 06991c28f37ad68e5c03777f5c3b679b56e3dac1 (diff) | |
parent | 951348b377385475aa256c27e1c9e2564c9ec160 (diff) | |
download | linux-b5c78e04dd061b776978dad61dd85357081147b0.tar.bz2 |
Merge tag 'staging-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging tree update from Greg Kroah-Hartman:
"Here's the big staging tree merge for 3.9-rc1
Lots of cleanups and updates for drivers all through the staging tree.
We are pretty much "code neutral" here, adding just about as many
lines as we removed.
All of these have been in linux-next for a while."
* tag 'staging-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (804 commits)
staging: comedi: vmk80xx: wait for URBs to complete
staging: comedi: drivers: addi-data: hwdrv_apci3200.c: Add a missing semicolon
staging: et131x: Update TODO list
staging: et131x: Remove assignment of skb->dev
staging: wlan-ng: hfa384x.h: fix for error reported by smatch
staging/zache checkpatch ERROR: spaces prohibited around that
staging/ozwpan: Mark read only parameters and structs as const
staging/ozwpan: Remove empty and unused function oz_cdev_heartbeat
staging/ozwpan: Mark local functions as static (fix sparse warnings)
staging/ozwpan: Add missing header includes
staging/usbip: Mark local functions as static (fix sparse warnings)
staging/xgifb: Remove duplicated code in loops.
staging/xgifb: Consolidate return paths
staging/xgifb: Remove code without effect
staging/xgifb: Remove unnecessary casts
staging/xgifb: Consolidate if/else if with identical code branches
staging: vt6656: replaced custom TRUE definition with true
staging: vt6656: replaced custom FALSE definition with false
staging: vt6656: replace custom BOOL definition with bool
staging/rtl8187se: Mark functions as static to silence sparse
...
Diffstat (limited to 'drivers/staging/ozwpan')
-rw-r--r-- | drivers/staging/ozwpan/TODO | 3 | ||||
-rw-r--r-- | drivers/staging/ozwpan/ozcdev.c | 52 | ||||
-rw-r--r-- | drivers/staging/ozwpan/ozcdev.h | 1 | ||||
-rw-r--r-- | drivers/staging/ozwpan/ozeltbuf.c | 18 | ||||
-rw-r--r-- | drivers/staging/ozwpan/ozevent.c | 8 | ||||
-rw-r--r-- | drivers/staging/ozwpan/ozhcd.c | 152 | ||||
-rw-r--r-- | drivers/staging/ozwpan/ozmain.c | 2 | ||||
-rw-r--r-- | drivers/staging/ozwpan/ozpd.c | 88 | ||||
-rw-r--r-- | drivers/staging/ozwpan/ozpd.h | 4 | ||||
-rw-r--r-- | drivers/staging/ozwpan/ozproto.c | 84 | ||||
-rw-r--r-- | drivers/staging/ozwpan/ozproto.h | 2 | ||||
-rw-r--r-- | drivers/staging/ozwpan/ozusbif.h | 8 | ||||
-rw-r--r-- | drivers/staging/ozwpan/ozusbsvc.c | 22 | ||||
-rw-r--r-- | drivers/staging/ozwpan/ozusbsvc1.c | 26 |
14 files changed, 234 insertions, 236 deletions
diff --git a/drivers/staging/ozwpan/TODO b/drivers/staging/ozwpan/TODO index b5db2456bffa..b4febd79a68d 100644 --- a/drivers/staging/ozwpan/TODO +++ b/drivers/staging/ozwpan/TODO @@ -10,6 +10,5 @@ TODO: - testing with as many devices as possible. Please send any patches for this driver to -Rupesh Gujare <rgujare@ozmodevices.com> -Chris Kelly <ckelly@ozmodevices.com> +Rupesh Gujare <rupesh.gujare@atmel.com> and Greg Kroah-Hartman <gregkh@linuxfoundation.org>. diff --git a/drivers/staging/ozwpan/ozcdev.c b/drivers/staging/ozwpan/ozcdev.c index 64913aeb0bac..ba15aeb70672 100644 --- a/drivers/staging/ozwpan/ozcdev.c +++ b/drivers/staging/ozwpan/ozcdev.c @@ -19,6 +19,7 @@ #include "ozpd.h" #include "ozproto.h" #include "ozevent.h" +#include "ozcdev.h" /*------------------------------------------------------------------------------ */ #define OZ_RD_BUF_SZ 256 @@ -43,7 +44,7 @@ struct oz_serial_ctx { /*------------------------------------------------------------------------------ */ static struct oz_cdev g_cdev; -struct class *g_oz_class; +static struct class *g_oz_class; /*------------------------------------------------------------------------------ * Context: process and softirq */ @@ -70,7 +71,7 @@ static void oz_cdev_release_ctx(struct oz_serial_ctx *ctx) /*------------------------------------------------------------------------------ * Context: process */ -int oz_cdev_open(struct inode *inode, struct file *filp) +static int oz_cdev_open(struct inode *inode, struct file *filp) { struct oz_cdev *dev; oz_trace("oz_cdev_open()\n"); @@ -82,7 +83,7 @@ int oz_cdev_open(struct inode *inode, struct file *filp) /*------------------------------------------------------------------------------ * Context: process */ -int oz_cdev_release(struct inode *inode, struct file *filp) +static int oz_cdev_release(struct inode *inode, struct file *filp) { oz_trace("oz_cdev_release()\n"); return 0; @@ -90,14 +91,14 @@ int oz_cdev_release(struct inode *inode, struct file *filp) /*------------------------------------------------------------------------------ * Context: process */ -ssize_t oz_cdev_read(struct file *filp, char __user *buf, size_t count, +static ssize_t oz_cdev_read(struct file *filp, char __user *buf, size_t count, loff_t *fpos) { int n; int ix; struct oz_pd *pd; - struct oz_serial_ctx *ctx = 0; + struct oz_serial_ctx *ctx; spin_lock_bh(&g_cdev.lock); pd = g_cdev.active_pd; @@ -142,12 +143,12 @@ out2: /*------------------------------------------------------------------------------ * Context: process */ -ssize_t oz_cdev_write(struct file *filp, const char __user *buf, size_t count, - loff_t *fpos) +static ssize_t oz_cdev_write(struct file *filp, const char __user *buf, + size_t count, loff_t *fpos) { struct oz_pd *pd; struct oz_elt_buf *eb; - struct oz_elt_info *ei = 0; + struct oz_elt_info *ei; struct oz_elt *elt; struct oz_app_hdr *app_hdr; struct oz_serial_ctx *ctx; @@ -182,7 +183,7 @@ ssize_t oz_cdev_write(struct file *filp, const char __user *buf, size_t count, ctx->tx_seq_num = 1; spin_lock(&eb->lock); if (oz_queue_elt_info(eb, 0, 0, ei) == 0) - ei = 0; + ei = NULL; spin_unlock(&eb->lock); } spin_unlock_bh(&pd->app_lock[OZ_APPID_USB-1]); @@ -199,7 +200,7 @@ out: /*------------------------------------------------------------------------------ * Context: process */ -static int oz_set_active_pd(u8 *addr) +static int oz_set_active_pd(const u8 *addr) { int rc = 0; struct oz_pd *pd; @@ -217,7 +218,7 @@ static int oz_set_active_pd(u8 *addr) if (is_zero_ether_addr(addr)) { spin_lock_bh(&g_cdev.lock); pd = g_cdev.active_pd; - g_cdev.active_pd = 0; + g_cdev.active_pd = NULL; memset(g_cdev.active_addr, 0, sizeof(g_cdev.active_addr)); spin_unlock_bh(&g_cdev.lock); @@ -232,7 +233,8 @@ static int oz_set_active_pd(u8 *addr) /*------------------------------------------------------------------------------ * Context: process */ -long oz_cdev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) +static long oz_cdev_ioctl(struct file *filp, unsigned int cmd, + unsigned long arg) { int rc = 0; if (_IOC_TYPE(cmd) != OZ_IOCTL_MAGIC) @@ -296,7 +298,7 @@ long oz_cdev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) /*------------------------------------------------------------------------------ * Context: process */ -unsigned int oz_cdev_poll(struct file *filp, poll_table *wait) +static unsigned int oz_cdev_poll(struct file *filp, poll_table *wait) { unsigned int ret = 0; struct oz_cdev *dev = filp->private_data; @@ -317,7 +319,7 @@ unsigned int oz_cdev_poll(struct file *filp, poll_table *wait) } /*------------------------------------------------------------------------------ */ -const struct file_operations oz_fops = { +static const struct file_operations oz_fops = { .owner = THIS_MODULE, .open = oz_cdev_open, .release = oz_cdev_release, @@ -385,7 +387,7 @@ int oz_cdev_deregister(void) */ int oz_cdev_init(void) { - oz_event_log(OZ_EVT_SERVICE, 1, OZ_APPID_SERIAL, 0, 0); + oz_event_log(OZ_EVT_SERVICE, 1, OZ_APPID_SERIAL, NULL, 0); oz_app_enable(OZ_APPID_SERIAL, 1); return 0; } @@ -394,7 +396,7 @@ int oz_cdev_init(void) */ void oz_cdev_term(void) { - oz_event_log(OZ_EVT_SERVICE, 2, OZ_APPID_SERIAL, 0, 0); + oz_event_log(OZ_EVT_SERVICE, 2, OZ_APPID_SERIAL, NULL, 0); oz_app_enable(OZ_APPID_SERIAL, 0); } /*------------------------------------------------------------------------------ @@ -403,8 +405,8 @@ void oz_cdev_term(void) int oz_cdev_start(struct oz_pd *pd, int resume) { struct oz_serial_ctx *ctx; - struct oz_serial_ctx *old_ctx = 0; - oz_event_log(OZ_EVT_SERVICE, 3, OZ_APPID_SERIAL, 0, resume); + struct oz_serial_ctx *old_ctx; + oz_event_log(OZ_EVT_SERVICE, 3, OZ_APPID_SERIAL, NULL, resume); if (resume) { oz_trace("Serial service resumed.\n"); return 0; @@ -440,22 +442,22 @@ int oz_cdev_start(struct oz_pd *pd, int resume) void oz_cdev_stop(struct oz_pd *pd, int pause) { struct oz_serial_ctx *ctx; - oz_event_log(OZ_EVT_SERVICE, 4, OZ_APPID_SERIAL, 0, pause); + oz_event_log(OZ_EVT_SERVICE, 4, OZ_APPID_SERIAL, NULL, pause); if (pause) { oz_trace("Serial service paused.\n"); return; } spin_lock_bh(&pd->app_lock[OZ_APPID_SERIAL-1]); ctx = (struct oz_serial_ctx *)pd->app_ctx[OZ_APPID_SERIAL-1]; - pd->app_ctx[OZ_APPID_SERIAL-1] = 0; + pd->app_ctx[OZ_APPID_SERIAL-1] = NULL; spin_unlock_bh(&pd->app_lock[OZ_APPID_SERIAL-1]); if (ctx) oz_cdev_release_ctx(ctx); spin_lock(&g_cdev.lock); if (pd == g_cdev.active_pd) - g_cdev.active_pd = 0; + g_cdev.active_pd = NULL; else - pd = 0; + pd = NULL; spin_unlock(&g_cdev.lock); if (pd) { oz_pd_put(pd); @@ -523,9 +525,3 @@ void oz_cdev_rx(struct oz_pd *pd, struct oz_elt *elt) out: oz_cdev_release_ctx(ctx); } -/*------------------------------------------------------------------------------ - * Context: softirq - */ -void oz_cdev_heartbeat(struct oz_pd *pd) -{ -} diff --git a/drivers/staging/ozwpan/ozcdev.h b/drivers/staging/ozwpan/ozcdev.h index 698014bb8d72..dd11935a093f 100644 --- a/drivers/staging/ozwpan/ozcdev.h +++ b/drivers/staging/ozwpan/ozcdev.h @@ -13,6 +13,5 @@ void oz_cdev_term(void); int oz_cdev_start(struct oz_pd *pd, int resume); void oz_cdev_stop(struct oz_pd *pd, int pause); void oz_cdev_rx(struct oz_pd *pd, struct oz_elt *elt); -void oz_cdev_heartbeat(struct oz_pd *pd); #endif /* _OZCDEV_H */ diff --git a/drivers/staging/ozwpan/ozeltbuf.c b/drivers/staging/ozwpan/ozeltbuf.c index 988f522475d9..ac90fc7f5441 100644 --- a/drivers/staging/ozwpan/ozeltbuf.c +++ b/drivers/staging/ozwpan/ozeltbuf.c @@ -64,7 +64,7 @@ void oz_elt_buf_term(struct oz_elt_buf *buf) */ struct oz_elt_info *oz_elt_info_alloc(struct oz_elt_buf *buf) { - struct oz_elt_info *ei = 0; + struct oz_elt_info *ei = NULL; spin_lock_bh(&buf->lock); if (buf->free_elts && buf->elt_pool) { ei = container_of(buf->elt_pool, struct oz_elt_info, link); @@ -82,9 +82,9 @@ struct oz_elt_info *oz_elt_info_alloc(struct oz_elt_buf *buf) if (ei) { ei->flags = 0; ei->app_id = 0; - ei->callback = 0; + ei->callback = NULL; ei->context = 0; - ei->stream = 0; + ei->stream = NULL; ei->magic = OZ_ELT_INFO_MAGIC_USED; INIT_LIST_HEAD(&ei->link); INIT_LIST_HEAD(&ei->link_order); @@ -135,7 +135,7 @@ int oz_elt_stream_create(struct oz_elt_buf *buf, u8 id, int max_buf_count) oz_trace("oz_elt_stream_create(0x%x)\n", id); st = kzalloc(sizeof(struct oz_elt_stream), GFP_ATOMIC | __GFP_ZERO); - if (st == 0) + if (st == NULL) return -ENOMEM; atomic_set(&st->ref_count, 1); st->id = id; @@ -151,7 +151,7 @@ int oz_elt_stream_create(struct oz_elt_buf *buf, u8 id, int max_buf_count) int oz_elt_stream_delete(struct oz_elt_buf *buf, u8 id) { struct list_head *e; - struct oz_elt_stream *st; + struct oz_elt_stream *st = NULL; oz_trace("oz_elt_stream_delete(0x%x)\n", id); spin_lock_bh(&buf->lock); e = buf->stream_list.next; @@ -161,7 +161,7 @@ int oz_elt_stream_delete(struct oz_elt_buf *buf, u8 id) list_del(e); break; } - st = 0; + st = NULL; } if (!st) { spin_unlock_bh(&buf->lock); @@ -208,7 +208,7 @@ void oz_elt_stream_put(struct oz_elt_stream *st) int oz_queue_elt_info(struct oz_elt_buf *buf, u8 isoc, u8 id, struct oz_elt_info *ei) { - struct oz_elt_stream *st = 0; + struct oz_elt_stream *st = NULL; struct list_head *e; if (id) { list_for_each(e, &buf->stream_list) { @@ -297,7 +297,7 @@ int oz_select_elts_for_tx(struct oz_elt_buf *buf, u8 isoc, unsigned *len, "Stream down: %d %d\n", ei->stream->buf_count, ei->length); oz_elt_stream_put(ei->stream); - ei->stream = 0; + ei->stream = NULL; } INIT_LIST_HEAD(&ei->link_order); list_add_tail(&ei->link, list); @@ -319,7 +319,7 @@ int oz_are_elts_available(struct oz_elt_buf *buf) */ void oz_trim_elt_pool(struct oz_elt_buf *buf) { - struct list_head *free = 0; + struct list_head *free = NULL; struct list_head *e; spin_lock_bh(&buf->lock); while (buf->free_elts > buf->max_free_elts) { diff --git a/drivers/staging/ozwpan/ozevent.c b/drivers/staging/ozwpan/ozevent.c index 50578ba0061c..77e86753610d 100644 --- a/drivers/staging/ozwpan/ozevent.c +++ b/drivers/staging/ozwpan/ozevent.c @@ -92,7 +92,7 @@ static void oz_events_clear(struct oz_evtdev *dev) /*------------------------------------------------------------------------------ * Context: process */ -int oz_events_open(struct inode *inode, struct file *filp) +static int oz_events_open(struct inode *inode, struct file *filp) { oz_trace("oz_evt_open()\n"); oz_trace("Open flags: 0x%x\n", filp->f_flags); @@ -107,7 +107,7 @@ int oz_events_open(struct inode *inode, struct file *filp) /*------------------------------------------------------------------------------ * Context: process */ -int oz_events_release(struct inode *inode, struct file *filp) +static int oz_events_release(struct inode *inode, struct file *filp) { oz_events_clear(&g_evtdev); atomic_dec(&g_evtdev.users); @@ -118,7 +118,7 @@ int oz_events_release(struct inode *inode, struct file *filp) /*------------------------------------------------------------------------------ * Context: process */ -ssize_t oz_events_read(struct file *filp, char __user *buf, size_t count, +static ssize_t oz_events_read(struct file *filp, char __user *buf, size_t count, loff_t *fpos) { struct oz_evtdev *dev = &g_evtdev; @@ -157,7 +157,7 @@ out: } /*------------------------------------------------------------------------------ */ -const struct file_operations oz_events_fops = { +static const struct file_operations oz_events_fops = { .owner = THIS_MODULE, .open = oz_events_open, .release = oz_events_release, diff --git a/drivers/staging/ozwpan/ozhcd.c b/drivers/staging/ozwpan/ozhcd.c index b2d77df2a526..8ac26f584fd4 100644 --- a/drivers/staging/ozwpan/ozhcd.c +++ b/drivers/staging/ozwpan/ozhcd.c @@ -36,6 +36,7 @@ #include "oztrace.h" #include "ozurbparanoia.h" #include "ozevent.h" +#include "ozhcd.h" /*------------------------------------------------------------------------------ * Number of units of buffering to capture for an isochronous IN endpoint before * allowing data to be indicated up. @@ -248,7 +249,7 @@ static int oz_get_port_from_addr(struct oz_hcd *ozhcd, u8 bus_addr) */ static struct oz_urb_link *oz_alloc_urb_link(void) { - struct oz_urb_link *urbl = 0; + struct oz_urb_link *urbl = NULL; unsigned long irq_state; spin_lock_irqsave(&g_link_lock, irq_state); if (g_link_pool) { @@ -257,7 +258,7 @@ static struct oz_urb_link *oz_alloc_urb_link(void) --g_link_pool_size; } spin_unlock_irqrestore(&g_link_lock, irq_state); - if (urbl == 0) + if (urbl == NULL) urbl = kmalloc(sizeof(struct oz_urb_link), GFP_ATOMIC); return urbl; } @@ -274,7 +275,7 @@ static void oz_free_urb_link(struct oz_urb_link *urbl) if (g_link_pool_size < OZ_MAX_LINK_POOL_SIZE) { urbl->link.next = g_link_pool; g_link_pool = &urbl->link; - urbl = 0; + urbl = NULL; g_link_pool_size++; } spin_unlock_irqrestore(&g_link_lock, irq_state); @@ -291,7 +292,7 @@ static void oz_empty_link_pool(void) unsigned long irq_state; spin_lock_irqsave(&g_link_lock, irq_state); e = g_link_pool; - g_link_pool = 0; + g_link_pool = NULL; g_link_pool_size = 0; spin_unlock_irqrestore(&g_link_lock, irq_state); while (e) { @@ -326,7 +327,7 @@ static struct oz_endpoint *oz_ep_alloc(gfp_t mem_flags, int buffer_size) * disabled. * Context: softirq or process */ -struct oz_urb_link *oz_uncancel_urb(struct oz_hcd *ozhcd, struct urb *urb) +static struct oz_urb_link *oz_uncancel_urb(struct oz_hcd *ozhcd, struct urb *urb) { struct oz_urb_link *urbl; struct list_head *e; @@ -337,7 +338,7 @@ struct oz_urb_link *oz_uncancel_urb(struct oz_hcd *ozhcd, struct urb *urb) return urbl; } } - return 0; + return NULL; } /*------------------------------------------------------------------------------ * This is called when we have finished processing an urb. It unlinks it from @@ -349,13 +350,13 @@ static void oz_complete_urb(struct usb_hcd *hcd, struct urb *urb, { struct oz_hcd *ozhcd = oz_hcd_private(hcd); unsigned long irq_state; - struct oz_urb_link *cancel_urbl = 0; + struct oz_urb_link *cancel_urbl = NULL; spin_lock_irqsave(&g_tasklet_lock, irq_state); usb_hcd_unlink_urb_from_ep(hcd, urb); /* Clear hcpriv which will prevent it being put in the cancel list * in the event that an attempt is made to cancel it. */ - urb->hcpriv = 0; + urb->hcpriv = NULL; /* Walk the cancel list in case the urb is already sitting there. * Since we process the cancel list in a tasklet rather than in * the dequeue function this could happen. @@ -416,7 +417,8 @@ static void oz_ep_free(struct oz_port *port, struct oz_endpoint *ep) /*------------------------------------------------------------------------------ * Context: softirq */ -void oz_complete_buffered_urb(struct oz_port *port, struct oz_endpoint *ep, +static void oz_complete_buffered_urb(struct oz_port *port, + struct oz_endpoint *ep, struct urb *urb) { u8 data_len, available_space, copy_len; @@ -507,7 +509,7 @@ static int oz_enqueue_ep_urb(struct oz_port *port, u8 ep_addr, int in_dir, ep->last_jiffies = jiffies; ep->credit = 0; oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num, - 0, 0, ep->credit); + 0, NULL, ep->credit); } } else { err = -EPIPE; @@ -525,7 +527,7 @@ static int oz_enqueue_ep_urb(struct oz_port *port, u8 ep_addr, int in_dir, static int oz_dequeue_ep_urb(struct oz_port *port, u8 ep_addr, int in_dir, struct urb *urb) { - struct oz_urb_link *urbl = 0; + struct oz_urb_link *urbl = NULL; struct oz_endpoint *ep; spin_lock_bh(&port->ozhcd->hcd_lock); if (in_dir) @@ -540,7 +542,7 @@ static int oz_dequeue_ep_urb(struct oz_port *port, u8 ep_addr, int in_dir, list_del_init(e); break; } - urbl = 0; + urbl = NULL; } } spin_unlock_bh(&port->ozhcd->hcd_lock); @@ -556,8 +558,8 @@ static struct urb *oz_find_urb_by_id(struct oz_port *port, int ep_ix, u8 req_id) { struct oz_hcd *ozhcd = port->ozhcd; - struct urb *urb = 0; - struct oz_urb_link *urbl = 0; + struct urb *urb = NULL; + struct oz_urb_link *urbl = NULL; struct oz_endpoint *ep; spin_lock_bh(&ozhcd->hcd_lock); @@ -630,13 +632,13 @@ static inline void oz_hcd_put(struct oz_hcd *ozhcd) void *oz_hcd_pd_arrived(void *hpd) { int i; - void *hport = 0; - struct oz_hcd *ozhcd = 0; + void *hport = NULL; + struct oz_hcd *ozhcd = NULL; struct oz_endpoint *ep; oz_trace("oz_hcd_pd_arrived()\n"); ozhcd = oz_hcd_claim(); - if (ozhcd == 0) - return 0; + if (ozhcd == NULL) + return NULL; /* Allocate an endpoint object in advance (before holding hcd lock) to * use for out endpoint 0. */ @@ -663,7 +665,7 @@ void *oz_hcd_pd_arrived(void *hpd) /* Attach out endpoint 0. */ ozhcd->ports[i].out_ep[0] = ep; - ep = 0; + ep = NULL; hport = &ozhcd->ports[i]; spin_unlock_bh(&ozhcd->hcd_lock); if (ozhcd->flags & OZ_HDC_F_SUSPENDED) { @@ -676,7 +678,7 @@ void *oz_hcd_pd_arrived(void *hpd) } out: if (ep) /* ep is non-null if not used. */ - oz_ep_free(0, ep); + oz_ep_free(NULL, ep); oz_hcd_put(ozhcd); return hport; } @@ -691,15 +693,15 @@ void oz_hcd_pd_departed(void *hport) struct oz_port *port = (struct oz_port *)hport; struct oz_hcd *ozhcd; void *hpd; - struct oz_endpoint *ep = 0; + struct oz_endpoint *ep = NULL; oz_trace("oz_hcd_pd_departed()\n"); - if (port == 0) { + if (port == NULL) { oz_trace("oz_hcd_pd_departed() port = 0\n"); return; } ozhcd = port->ozhcd; - if (ozhcd == 0) + if (ozhcd == NULL) return; /* Check if this is the connection port - if so clear it. */ @@ -717,7 +719,7 @@ void oz_hcd_pd_departed(void *hport) oz_clean_endpoints_for_config(ozhcd->hcd, port); spin_lock_bh(&port->port_lock); hpd = port->hpd; - port->hpd = 0; + port->hpd = NULL; port->bus_addr = 0xff; port->flags &= ~(OZ_PORT_F_PRESENT | OZ_PORT_F_DYING); port->flags |= OZ_PORT_F_CHANGED; @@ -728,7 +730,7 @@ void oz_hcd_pd_departed(void *hport) */ if (port->out_ep[0]) { ep = port->out_ep[0]; - port->out_ep[0] = 0; + port->out_ep[0] = NULL; } spin_unlock_bh(&port->port_lock); if (ep) @@ -757,14 +759,14 @@ void oz_hcd_pd_reset(void *hpd, void *hport) /*------------------------------------------------------------------------------ * Context: softirq */ -void oz_hcd_get_desc_cnf(void *hport, u8 req_id, int status, u8 *desc, +void oz_hcd_get_desc_cnf(void *hport, u8 req_id, int status, const u8 *desc, int length, int offset, int total_size) { struct oz_port *port = (struct oz_port *)hport; struct urb *urb; int err = 0; - oz_event_log(OZ_EVT_CTRL_CNF, 0, req_id, 0, status); + oz_event_log(OZ_EVT_CTRL_CNF, 0, req_id, NULL, status); oz_trace("oz_hcd_get_desc_cnf length = %d offs = %d tot_size = %d\n", length, offset, total_size); urb = oz_find_urb_by_id(port, 0, req_id); @@ -893,7 +895,7 @@ static void oz_hcd_complete_set_interface(struct oz_port *port, struct urb *urb, /*------------------------------------------------------------------------------ * Context: softirq */ -void oz_hcd_control_cnf(void *hport, u8 req_id, u8 rcode, u8 *data, +void oz_hcd_control_cnf(void *hport, u8 req_id, u8 rcode, const u8 *data, int data_len) { struct oz_port *port = (struct oz_port *)hport; @@ -903,7 +905,7 @@ void oz_hcd_control_cnf(void *hport, u8 req_id, u8 rcode, u8 *data, unsigned windex; unsigned wvalue; - oz_event_log(OZ_EVT_CTRL_CNF, 0, req_id, 0, rcode); + oz_event_log(OZ_EVT_CTRL_CNF, 0, req_id, NULL, rcode); oz_trace("oz_hcd_control_cnf rcode=%u len=%d\n", rcode, data_len); urb = oz_find_urb_by_id(port, 0, req_id); if (!urb) { @@ -946,7 +948,8 @@ void oz_hcd_control_cnf(void *hport, u8 req_id, u8 rcode, u8 *data, /*------------------------------------------------------------------------------ * Context: softirq-serialized */ -static int oz_hcd_buffer_data(struct oz_endpoint *ep, u8 *data, int data_len) +static int oz_hcd_buffer_data(struct oz_endpoint *ep, const u8 *data, + int data_len) { int space; int copy_len; @@ -981,14 +984,14 @@ static int oz_hcd_buffer_data(struct oz_endpoint *ep, u8 *data, int data_len) /*------------------------------------------------------------------------------ * Context: softirq-serialized */ -void oz_hcd_data_ind(void *hport, u8 endpoint, u8 *data, int data_len) +void oz_hcd_data_ind(void *hport, u8 endpoint, const u8 *data, int data_len) { struct oz_port *port = (struct oz_port *)hport; struct oz_endpoint *ep; struct oz_hcd *ozhcd = port->ozhcd; spin_lock_bh(&ozhcd->hcd_lock); ep = port->in_ep[endpoint & USB_ENDPOINT_NUMBER_MASK]; - if (ep == 0) + if (ep == NULL) goto done; switch (ep->attrib & USB_ENDPOINT_XFERTYPE_MASK) { case USB_ENDPOINT_XFER_INT: @@ -1056,7 +1059,8 @@ int oz_hcd_heartbeat(void *hport) ep->credit += jiffies_to_msecs(now - ep->last_jiffies); if (ep->credit > ep->credit_ceiling) ep->credit = ep->credit_ceiling; - oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num, 0, 0, ep->credit); + oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num, 0, NULL, + ep->credit); ep->last_jiffies = now; while (ep->credit && !list_empty(&ep->urb_list)) { urbl = list_first_entry(&ep->urb_list, @@ -1065,8 +1069,8 @@ int oz_hcd_heartbeat(void *hport) if ((ep->credit + 1) < urb->number_of_packets) break; ep->credit -= urb->number_of_packets; - oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num, 0, 0, - ep->credit); + oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num, 0, NULL, + ep->credit); list_move_tail(&urbl->link, &xfr_list); } } @@ -1091,22 +1095,22 @@ int oz_hcd_heartbeat(void *hport) list_for_each(e, &port->isoc_in_ep) { struct oz_endpoint *ep = ep_from_link(e); if (ep->flags & OZ_F_EP_BUFFERING) { - if (ep->buffered_units * OZ_IN_BUFFERING_UNITS) { + if (ep->buffered_units >= OZ_IN_BUFFERING_UNITS) { ep->flags &= ~OZ_F_EP_BUFFERING; ep->credit = 0; oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num | USB_DIR_IN, - 0, 0, ep->credit); + 0, NULL, ep->credit); ep->last_jiffies = now; ep->start_frame = 0; oz_event_log(OZ_EVT_EP_BUFFERING, - ep->ep_num | USB_DIR_IN, 0, 0, 0); + ep->ep_num | USB_DIR_IN, 0, NULL, 0); } continue; } ep->credit += jiffies_to_msecs(now - ep->last_jiffies); oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num | USB_DIR_IN, - 0, 0, ep->credit); + 0, NULL, ep->credit); ep->last_jiffies = now; while (!list_empty(&ep->urb_list)) { struct oz_urb_link *urbl = @@ -1151,7 +1155,7 @@ int oz_hcd_heartbeat(void *hport) list_move_tail(&urbl->link, &xfr_list); ep->credit -= urb->number_of_packets; oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num | USB_DIR_IN, - 0, 0, ep->credit); + 0, NULL, ep->credit); } } if (!list_empty(&port->isoc_out_ep) || !list_empty(&port->isoc_in_ep)) @@ -1244,7 +1248,7 @@ static int oz_build_endpoints_for_interface(struct usb_hcd *hcd, if (ep_addr & USB_ENDPOINT_DIR_MASK) { ep->flags |= OZ_F_EP_BUFFERING; oz_event_log(OZ_EVT_EP_BUFFERING, - ep->ep_num | USB_DIR_IN, 1, 0, 0); + ep->ep_num | USB_DIR_IN, 1, NULL, 0); } else { ep->flags |= OZ_F_EP_HAVE_STREAM; if (oz_usb_stream_create(port->hpd, ep_num)) @@ -1300,7 +1304,7 @@ static void oz_clean_endpoints_for_interface(struct usb_hcd *hcd, */ if ((mask & (1<<i)) && port->out_ep[i]) { e = &port->out_ep[i]->link; - port->out_ep[i] = 0; + port->out_ep[i] = NULL; /* Remove from isoc list if present. */ list_move_tail(e, &ep_list); @@ -1309,7 +1313,7 @@ static void oz_clean_endpoints_for_interface(struct usb_hcd *hcd, */ if ((mask & (1<<(i+OZ_NB_ENDPOINTS))) && port->in_ep[i]) { e = &port->in_ep[i]->link; - port->in_ep[i] = 0; + port->in_ep[i] = NULL; list_move_tail(e, &ep_list); } } @@ -1370,7 +1374,7 @@ static void oz_clean_endpoints_for_config(struct usb_hcd *hcd, if (port->iface) { oz_trace("Freeing interfaces object.\n"); kfree(port->iface); - port->iface = 0; + port->iface = NULL; } port->num_iface = 0; spin_unlock_bh(&ozhcd->hcd_lock); @@ -1380,7 +1384,7 @@ static void oz_clean_endpoints_for_config(struct usb_hcd *hcd, */ static void *oz_claim_hpd(struct oz_port *port) { - void *hpd = 0; + void *hpd = NULL; struct oz_hcd *ozhcd = port->ozhcd; spin_lock_bh(&ozhcd->hcd_lock); hpd = port->hpd; @@ -1399,13 +1403,13 @@ static void oz_process_ep0_urb(struct oz_hcd *ozhcd, struct urb *urb, unsigned windex; unsigned wvalue; unsigned wlength; - void *hpd = 0; + void *hpd = NULL; u8 req_id; int rc = 0; unsigned complete = 0; int port_ix = -1; - struct oz_port *port = 0; + struct oz_port *port = NULL; oz_trace2(OZ_TRACE_URB, "%lu: oz_process_ep0_urb(%p)\n", jiffies, urb); port_ix = oz_get_port_from_addr(ozhcd, urb->dev->devnum); @@ -1437,7 +1441,7 @@ static void oz_process_ep0_urb(struct oz_hcd *ozhcd, struct urb *urb, req_id = port->next_req_id++; hpd = oz_claim_hpd(port); - if (hpd == 0) { + if (hpd == NULL) { oz_trace("Cannot claim port\n"); rc = -EPIPE; goto out; @@ -1452,7 +1456,7 @@ static void oz_process_ep0_urb(struct oz_hcd *ozhcd, struct urb *urb, break; case USB_REQ_SET_ADDRESS: oz_event_log(OZ_EVT_CTRL_LOCAL, setup->bRequest, - 0, 0, setup->bRequestType); + 0, NULL, setup->bRequestType); oz_trace("USB_REQ_SET_ADDRESS - req\n"); oz_trace("Port %d address is 0x%x\n", ozhcd->conn_port, (u8)le16_to_cpu(setup->wValue)); @@ -1473,8 +1477,8 @@ static void oz_process_ep0_urb(struct oz_hcd *ozhcd, struct urb *urb, /* We short circuit this case and reply directly since * we have the selected configuration number cached. */ - oz_event_log(OZ_EVT_CTRL_LOCAL, setup->bRequest, 0, 0, - setup->bRequestType); + oz_event_log(OZ_EVT_CTRL_LOCAL, setup->bRequest, 0, + NULL, setup->bRequestType); oz_trace("USB_REQ_GET_CONFIGURATION - reply now\n"); if (urb->transfer_buffer_length >= 1) { urb->actual_length = 1; @@ -1489,8 +1493,8 @@ static void oz_process_ep0_urb(struct oz_hcd *ozhcd, struct urb *urb, /* We short circuit this case and reply directly since * we have the selected interface alternative cached. */ - oz_event_log(OZ_EVT_CTRL_LOCAL, setup->bRequest, 0, 0, - setup->bRequestType); + oz_event_log(OZ_EVT_CTRL_LOCAL, setup->bRequest, 0, + NULL, setup->bRequestType); oz_trace("USB_REQ_GET_INTERFACE - reply now\n"); if (urb->transfer_buffer_length >= 1) { urb->actual_length = 1; @@ -1583,7 +1587,7 @@ static void oz_urb_process_tasklet(unsigned long unused) struct urb *urb; struct oz_hcd *ozhcd = oz_hcd_claim(); int rc = 0; - if (ozhcd == 0) + if (ozhcd == NULL) return; /* This is called from a tasklet so is in softirq context but the urb * list is filled from any context so we need to lock @@ -1617,17 +1621,17 @@ static void oz_urb_process_tasklet(unsigned long unused) */ static void oz_urb_cancel(struct oz_port *port, u8 ep_num, struct urb *urb) { - struct oz_urb_link *urbl = 0; + struct oz_urb_link *urbl = NULL; struct list_head *e; struct oz_hcd *ozhcd; unsigned long irq_state; u8 ix; - if (port == 0) { + if (port == NULL) { oz_trace("ERRORERROR: oz_urb_cancel(%p) port is null\n", urb); return; } ozhcd = port->ozhcd; - if (ozhcd == 0) { + if (ozhcd == NULL) { oz_trace("ERRORERROR: oz_urb_cancel(%p) ozhcd is null\n", urb); return; } @@ -1644,7 +1648,7 @@ static void oz_urb_cancel(struct oz_port *port, u8 ep_num, struct urb *urb) } } spin_unlock_irqrestore(&g_tasklet_lock, irq_state); - urbl = 0; + urbl = NULL; /* Look in the orphanage. */ @@ -1658,7 +1662,7 @@ static void oz_urb_cancel(struct oz_port *port, u8 ep_num, struct urb *urb) } } ix = (ep_num & 0xf); - urbl = 0; + urbl = NULL; if ((ep_num & USB_DIR_IN) && ix) urbl = oz_remove_urb(port->in_ep[ix], urb); else @@ -1680,7 +1684,7 @@ static void oz_urb_cancel_tasklet(unsigned long unused) unsigned long irq_state; struct urb *urb; struct oz_hcd *ozhcd = oz_hcd_claim(); - if (ozhcd == 0) + if (ozhcd == NULL) return; spin_lock_irqsave(&g_tasklet_lock, irq_state); while (!list_empty(&ozhcd->urb_cancel_list)) { @@ -1772,7 +1776,7 @@ static int oz_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, jiffies, urb); oz_event_log(OZ_EVT_URB_SUBMIT, oz_get_irq_ctx(), (u16)urb->number_of_packets, urb, urb->pipe); - if (unlikely(ozhcd == 0)) { + if (unlikely(ozhcd == NULL)) { oz_trace2(OZ_TRACE_URB, "%lu: Refused urb(%p) not ozhcd.\n", jiffies, urb); return -EPIPE; @@ -1786,7 +1790,7 @@ static int oz_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, if (port_ix < 0) return -EPIPE; port = &ozhcd->ports[port_ix]; - if (port == 0) + if (port == NULL) return -EPIPE; if ((port->flags & OZ_PORT_F_PRESENT) == 0) { oz_trace("Refusing URB port_ix = %d devnum = %d\n", @@ -1797,7 +1801,7 @@ static int oz_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, /* Put request in queue for processing by tasklet. */ urbl = oz_alloc_urb_link(); - if (unlikely(urbl == 0)) + if (unlikely(urbl == NULL)) return -ENOMEM; urbl->urb = urb; spin_lock_irqsave(&g_tasklet_lock, irq_state); @@ -1819,10 +1823,10 @@ static int oz_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, static struct oz_urb_link *oz_remove_urb(struct oz_endpoint *ep, struct urb *urb) { - struct oz_urb_link *urbl = 0; + struct oz_urb_link *urbl = NULL; struct list_head *e; - if (unlikely(ep == 0)) - return 0; + if (unlikely(ep == NULL)) + return NULL; list_for_each(e, &ep->urb_list) { urbl = container_of(e, struct oz_urb_link, link); if (urbl->urb == urb) { @@ -1834,12 +1838,12 @@ static struct oz_urb_link *oz_remove_urb(struct oz_endpoint *ep, oz_event_log(OZ_EVT_EP_CREDIT, usb_pipein(urb->pipe) ? (ep->ep_num | USB_DIR_IN) : ep->ep_num, - 0, 0, ep->credit); + 0, NULL, ep->credit); } return urbl; } } - return 0; + return NULL; } /*------------------------------------------------------------------------------ * Called to dequeue a previously submitted urb for the device. @@ -1848,12 +1852,12 @@ static struct oz_urb_link *oz_remove_urb(struct oz_endpoint *ep, static int oz_hcd_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) { struct oz_hcd *ozhcd = oz_hcd_private(hcd); - struct oz_urb_link *urbl = 0; + struct oz_urb_link *urbl = NULL; int rc; unsigned long irq_state; oz_trace2(OZ_TRACE_URB, "%lu: oz_hcd_urb_dequeue(%p)\n", jiffies, urb); urbl = oz_alloc_urb_link(); - if (unlikely(urbl == 0)) + if (unlikely(urbl == NULL)) return -ENOMEM; spin_lock_irqsave(&g_tasklet_lock, irq_state); /* The following function checks the urb is still in the queue @@ -2193,7 +2197,7 @@ static int oz_plat_probe(struct platform_device *dev) struct oz_hcd *ozhcd; oz_trace("oz_plat_probe()\n"); hcd = usb_create_hcd(&g_oz_hc_drv, &dev->dev, dev_name(&dev->dev)); - if (hcd == 0) { + if (hcd == NULL) { oz_trace("Failed to created hcd object OK\n"); return -ENOMEM; } @@ -2232,12 +2236,12 @@ static int oz_plat_remove(struct platform_device *dev) struct usb_hcd *hcd = platform_get_drvdata(dev); struct oz_hcd *ozhcd; oz_trace("oz_plat_remove()\n"); - if (hcd == 0) + if (hcd == NULL) return -1; ozhcd = oz_hcd_private(hcd); spin_lock_bh(&g_hcdlock); if (ozhcd == g_ozhcd) - g_ozhcd = 0; + g_ozhcd = NULL; spin_unlock_bh(&g_hcdlock); oz_trace("Clearing orphanage\n"); oz_hcd_clear_orphanage(ozhcd, -EPIPE); @@ -2278,7 +2282,7 @@ int oz_hcd_init(void) if (err) goto error; g_plat_dev = platform_device_alloc(OZ_PLAT_DEV_NAME, -1); - if (g_plat_dev == 0) { + if (g_plat_dev == NULL) { err = -ENOMEM; goto error1; } diff --git a/drivers/staging/ozwpan/ozmain.c b/drivers/staging/ozwpan/ozmain.c index ef6c5ab753ee..57a0cbd58551 100644 --- a/drivers/staging/ozwpan/ozmain.c +++ b/drivers/staging/ozwpan/ozmain.c @@ -22,7 +22,7 @@ * bind to nothing. '*' means bind to all netcards - this includes non-802.11 * netcards. Bindings can be added later using an IOCTL. */ -char *g_net_dev = ""; +static char *g_net_dev = ""; /*------------------------------------------------------------------------------ * Context: process */ diff --git a/drivers/staging/ozwpan/ozpd.c b/drivers/staging/ozwpan/ozpd.c index 118a4db74dec..f8b9da080c4b 100644 --- a/drivers/staging/ozwpan/ozpd.c +++ b/drivers/staging/ozwpan/ozpd.c @@ -46,7 +46,7 @@ static void oz_def_app_rx(struct oz_pd *pd, struct oz_elt *elt); static atomic_t g_submitted_isoc = ATOMIC_INIT(0); /* Application handler functions. */ -static struct oz_app_if g_app_if[OZ_APPID_MAX] = { +static const struct oz_app_if g_app_if[OZ_APPID_MAX] = { {oz_usb_init, oz_usb_term, oz_usb_start, @@ -61,8 +61,8 @@ static struct oz_app_if g_app_if[OZ_APPID_MAX] = { oz_def_app_start, oz_def_app_stop, oz_def_app_rx, - 0, - 0, + NULL, + NULL, OZ_APPID_UNUSED1}, {oz_def_app_init, @@ -70,8 +70,8 @@ static struct oz_app_if g_app_if[OZ_APPID_MAX] = { oz_def_app_start, oz_def_app_stop, oz_def_app_rx, - 0, - 0, + NULL, + NULL, OZ_APPID_UNUSED2}, {oz_cdev_init, @@ -79,8 +79,8 @@ static struct oz_app_if g_app_if[OZ_APPID_MAX] = { oz_cdev_start, oz_cdev_stop, oz_cdev_rx, - 0, - 0, + NULL, + NULL, OZ_APPID_SERIAL}, }; /*------------------------------------------------------------------------------ @@ -121,7 +121,7 @@ static void oz_def_app_rx(struct oz_pd *pd, struct oz_elt *elt) void oz_pd_set_state(struct oz_pd *pd, unsigned state) { pd->state = state; - oz_event_log(OZ_EVT_PD_STATE, 0, 0, 0, state); + oz_event_log(OZ_EVT_PD_STATE, 0, 0, NULL, state); #ifdef WANT_TRACE switch (state) { case OZ_PD_S_IDLE: @@ -157,7 +157,7 @@ void oz_pd_put(struct oz_pd *pd) /*------------------------------------------------------------------------------ * Context: softirq-serialized */ -struct oz_pd *oz_pd_alloc(u8 *mac_addr) +struct oz_pd *oz_pd_alloc(const u8 *mac_addr) { struct oz_pd *pd = kzalloc(sizeof(struct oz_pd), GFP_ATOMIC); if (pd) { @@ -171,7 +171,7 @@ struct oz_pd *oz_pd_alloc(u8 *mac_addr) memcpy(pd->mac_addr, mac_addr, ETH_ALEN); if (0 != oz_elt_buf_init(&pd->elt_buff)) { kfree(pd); - pd = 0; + pd = NULL; } spin_lock_init(&pd->tx_frame_lock); INIT_LIST_HEAD(&pd->tx_queue); @@ -235,7 +235,7 @@ void oz_pd_destroy(struct oz_pd *pd) */ int oz_services_start(struct oz_pd *pd, u16 apps, int resume) { - struct oz_app_if *ai; + const struct oz_app_if *ai; int rc = 0; oz_trace("oz_services_start(0x%x) resume(%d)\n", apps, resume); for (ai = g_app_if; ai < &g_app_if[OZ_APPID_MAX]; ai++) { @@ -260,7 +260,7 @@ int oz_services_start(struct oz_pd *pd, u16 apps, int resume) */ void oz_services_stop(struct oz_pd *pd, u16 apps, int pause) { - struct oz_app_if *ai; + const struct oz_app_if *ai; oz_trace("oz_stop_services(0x%x) pause(%d)\n", apps, pause); for (ai = g_app_if; ai < &g_app_if[OZ_APPID_MAX]; ai++) { if (apps & (1<<ai->app_id)) { @@ -281,7 +281,7 @@ void oz_services_stop(struct oz_pd *pd, u16 apps, int pause) */ void oz_pd_heartbeat(struct oz_pd *pd, u16 apps) { - struct oz_app_if *ai; + const struct oz_app_if *ai; int more = 0; for (ai = g_app_if; ai < &g_app_if[OZ_APPID_MAX]; ai++) { if (ai->heartbeat && (apps & (1<<ai->app_id))) { @@ -355,7 +355,7 @@ int oz_pd_sleep(struct oz_pd *pd) */ static struct oz_tx_frame *oz_tx_frame_alloc(struct oz_pd *pd) { - struct oz_tx_frame *f = 0; + struct oz_tx_frame *f = NULL; spin_lock_bh(&pd->tx_frame_lock); if (pd->tx_pool) { f = container_of(pd->tx_pool, struct oz_tx_frame, link); @@ -363,7 +363,7 @@ static struct oz_tx_frame *oz_tx_frame_alloc(struct oz_pd *pd) pd->tx_pool_count--; } spin_unlock_bh(&pd->tx_frame_lock); - if (f == 0) + if (f == NULL) f = kmalloc(sizeof(struct oz_tx_frame), GFP_ATOMIC); if (f) { f->total_size = sizeof(struct oz_hdr); @@ -399,7 +399,7 @@ static void oz_tx_frame_free(struct oz_pd *pd, struct oz_tx_frame *f) f->link.next = pd->tx_pool; pd->tx_pool = &f->link; pd->tx_pool_count++; - f = 0; + f = NULL; } spin_unlock_bh(&pd->tx_frame_lock); kfree(f); @@ -407,7 +407,7 @@ static void oz_tx_frame_free(struct oz_pd *pd, struct oz_tx_frame *f) /*------------------------------------------------------------------------------ * Context: softirq-serialized */ -void oz_set_more_bit(struct sk_buff *skb) +static void oz_set_more_bit(struct sk_buff *skb) { struct oz_hdr *oz_hdr = (struct oz_hdr *)skb_network_header(skb); oz_hdr->control |= OZ_F_MORE_DATA; @@ -415,7 +415,7 @@ void oz_set_more_bit(struct sk_buff *skb) /*------------------------------------------------------------------------------ * Context: softirq-serialized */ -void oz_set_last_pkt_nb(struct oz_pd *pd, struct sk_buff *skb) +static void oz_set_last_pkt_nb(struct oz_pd *pd, struct sk_buff *skb) { struct oz_hdr *oz_hdr = (struct oz_hdr *)skb_network_header(skb); oz_hdr->last_pkt_num = pd->trigger_pkt_num & OZ_LAST_PN_MASK; @@ -433,7 +433,7 @@ int oz_prepare_frame(struct oz_pd *pd, int empty) if (!empty && !oz_are_elts_available(&pd->elt_buff)) return -1; f = oz_tx_frame_alloc(pd); - if (f == 0) + if (f == NULL) return -1; f->skb = NULL; f->hdr.control = @@ -455,7 +455,7 @@ int oz_prepare_frame(struct oz_pd *pd, int empty) */ static struct sk_buff *oz_build_frame(struct oz_pd *pd, struct oz_tx_frame *f) { - struct sk_buff *skb = 0; + struct sk_buff *skb; struct net_device *dev = pd->net_dev; struct oz_hdr *oz_hdr; struct oz_elt *elt; @@ -464,8 +464,8 @@ static struct sk_buff *oz_build_frame(struct oz_pd *pd, struct oz_tx_frame *f) * as the space we need. */ skb = alloc_skb(f->total_size + OZ_ALLOCATED_SPACE(dev), GFP_ATOMIC); - if (skb == 0) - return 0; + if (skb == NULL) + return NULL; /* Reserve the head room for lower layers. */ skb_reserve(skb, LL_RESERVED_SPACE(dev)); @@ -492,7 +492,7 @@ static struct sk_buff *oz_build_frame(struct oz_pd *pd, struct oz_tx_frame *f) return skb; fail: kfree_skb(skb); - return 0; + return NULL; } /*------------------------------------------------------------------------------ * Context: softirq or process @@ -544,7 +544,7 @@ static int oz_send_next_queued_frame(struct oz_pd *pd, int more_data) if (dev_queue_xmit(skb) < 0) { oz_trace2(OZ_TRACE_TX_FRAMES, "Dropping ISOC Frame\n"); - oz_event_log(OZ_EVT_TX_ISOC_DROP, 0, 0, 0, 0); + oz_event_log(OZ_EVT_TX_ISOC_DROP, 0, 0, NULL, 0); return -1; } atomic_inc(&g_submitted_isoc); @@ -555,7 +555,7 @@ static int oz_send_next_queued_frame(struct oz_pd *pd, int more_data) } else { kfree_skb(skb); oz_trace2(OZ_TRACE_TX_FRAMES, "Dropping ISOC Frame>\n"); - oz_event_log(OZ_EVT_TX_ISOC_DROP, 0, 0, 0, 0); + oz_event_log(OZ_EVT_TX_ISOC_DROP, 0, 0, NULL, 0); return -1; } } @@ -570,7 +570,7 @@ static int oz_send_next_queued_frame(struct oz_pd *pd, int more_data) oz_event_log(OZ_EVT_TX_FRAME, 0, (((u16)f->hdr.control)<<8)|f->hdr.last_pkt_num, - 0, f->hdr.pkt_num); + NULL, f->hdr.pkt_num); if (dev_queue_xmit(skb) < 0) return -1; @@ -620,7 +620,7 @@ out: oz_prepare_frame(pd, 1); */ static int oz_send_isoc_frame(struct oz_pd *pd) { - struct sk_buff *skb = 0; + struct sk_buff *skb; struct net_device *dev = pd->net_dev; struct oz_hdr *oz_hdr; struct oz_elt *elt; @@ -634,7 +634,7 @@ static int oz_send_isoc_frame(struct oz_pd *pd) if (list.next == &list) return 0; skb = alloc_skb(total_size + OZ_ALLOCATED_SPACE(dev), GFP_ATOMIC); - if (skb == 0) { + if (skb == NULL) { oz_trace("Cannot alloc skb\n"); oz_elt_info_free_chain(&pd->elt_buff, &list); return -1; @@ -659,7 +659,7 @@ static int oz_send_isoc_frame(struct oz_pd *pd) memcpy(elt, ei->data, ei->length); elt = oz_next_elt(elt); } - oz_event_log(OZ_EVT_TX_ISOC, 0, 0, 0, 0); + oz_event_log(OZ_EVT_TX_ISOC, 0, 0, NULL, 0); dev_queue_xmit(skb); oz_elt_info_free_chain(&pd->elt_buff, &list); return 0; @@ -671,8 +671,8 @@ void oz_retire_tx_frames(struct oz_pd *pd, u8 lpn) { struct list_head *e; struct oz_tx_frame *f; - struct list_head *first = 0; - struct list_head *last = 0; + struct list_head *first = NULL; + struct list_head *last = NULL; u8 diff; u32 pkt_num; @@ -686,7 +686,7 @@ void oz_retire_tx_frames(struct oz_pd *pd, u8 lpn) break; oz_trace2(OZ_TRACE_TX_FRAMES, "Releasing pkt_num= %u, nb= %d\n", pkt_num, pd->nb_queued_frames); - if (first == 0) + if (first == NULL) first = e; last = e; e = e->next; @@ -695,7 +695,7 @@ void oz_retire_tx_frames(struct oz_pd *pd, u8 lpn) if (first) { last->next->prev = &pd->tx_queue; pd->tx_queue.next = last->next; - last->next = 0; + last->next = NULL; } pd->last_sent_frame = &pd->tx_queue; spin_unlock(&pd->tx_frame_lock); @@ -718,7 +718,7 @@ static struct oz_isoc_stream *pd_stream_find(struct oz_pd *pd, u8 ep_num) if (st->ep_num == ep_num) return st; } - return 0; + return NULL; } /*------------------------------------------------------------------------------ * Context: softirq @@ -733,7 +733,7 @@ int oz_isoc_stream_create(struct oz_pd *pd, u8 ep_num) spin_lock_bh(&pd->stream_lock); if (!pd_stream_find(pd, ep_num)) { list_add(&st->link, &pd->stream_list); - st = 0; + st = NULL; } spin_unlock_bh(&pd->stream_lock); kfree(st); @@ -774,19 +774,19 @@ static void oz_isoc_destructor(struct sk_buff *skb) /*------------------------------------------------------------------------------ * Context: softirq */ -int oz_send_isoc_unit(struct oz_pd *pd, u8 ep_num, u8 *data, int len) +int oz_send_isoc_unit(struct oz_pd *pd, u8 ep_num, const u8 *data, int len) { struct net_device *dev = pd->net_dev; struct oz_isoc_stream *st; u8 nb_units = 0; - struct sk_buff *skb = 0; - struct oz_hdr *oz_hdr = 0; + struct sk_buff *skb = NULL; + struct oz_hdr *oz_hdr = NULL; int size = 0; spin_lock_bh(&pd->stream_lock); st = pd_stream_find(pd, ep_num); if (st) { skb = st->skb; - st->skb = 0; + st->skb = NULL; nb_units = st->nb_units; st->nb_units = 0; oz_hdr = st->oz_hdr; @@ -799,7 +799,7 @@ int oz_send_isoc_unit(struct oz_pd *pd, u8 ep_num, u8 *data, int len) /* Allocate enough space for max size frame. */ skb = alloc_skb(pd->max_tx_size + OZ_ALLOCATED_SPACE(dev), GFP_ATOMIC); - if (skb == 0) + if (skb == NULL) return 0; /* Reserve the head room for lower layers. */ skb_reserve(skb, LL_RESERVED_SPACE(dev)); @@ -874,13 +874,13 @@ int oz_send_isoc_unit(struct oz_pd *pd, u8 ep_num, u8 *data, int len) oz_event_log(OZ_EVT_TX_ISOC, nb_units, iso.frame_number, skb, atomic_read(&g_submitted_isoc)); if (dev_queue_xmit(skb) < 0) { - oz_event_log(OZ_EVT_TX_ISOC_DROP, 0, 0, 0, 0); + oz_event_log(OZ_EVT_TX_ISOC_DROP, 0, 0, NULL, 0); return -1; } else return 0; } -out: oz_event_log(OZ_EVT_TX_ISOC_DROP, 0, 0, 0, 0); +out: oz_event_log(OZ_EVT_TX_ISOC_DROP, 0, 0, NULL, 0); kfree_skb(skb); return -1; @@ -913,7 +913,7 @@ void oz_apps_term(void) */ void oz_handle_app_elt(struct oz_pd *pd, u8 app_id, struct oz_elt *elt) { - struct oz_app_if *ai; + const struct oz_app_if *ai; if (app_id == 0 || app_id > OZ_APPID_MAX) return; ai = &g_app_if[app_id-1]; @@ -925,7 +925,7 @@ void oz_handle_app_elt(struct oz_pd *pd, u8 app_id, struct oz_elt *elt) void oz_pd_indicate_farewells(struct oz_pd *pd) { struct oz_farewell *f; - struct oz_app_if *ai = &g_app_if[OZ_APPID_USB-1]; + const struct oz_app_if *ai = &g_app_if[OZ_APPID_USB-1]; while (1) { oz_polling_lock_bh(); if (list_empty(&pd->farewell_list)) { diff --git a/drivers/staging/ozwpan/ozpd.h b/drivers/staging/ozwpan/ozpd.h index d35b0ea44f67..fbf47cbab8a9 100644 --- a/drivers/staging/ozwpan/ozpd.h +++ b/drivers/staging/ozwpan/ozpd.h @@ -99,7 +99,7 @@ struct oz_pd { #define OZ_MAX_QUEUED_FRAMES 4 -struct oz_pd *oz_pd_alloc(u8 *mac_addr); +struct oz_pd *oz_pd_alloc(const u8 *mac_addr); void oz_pd_destroy(struct oz_pd *pd); void oz_pd_get(struct oz_pd *pd); void oz_pd_put(struct oz_pd *pd); @@ -115,7 +115,7 @@ void oz_send_queued_frames(struct oz_pd *pd, int backlog); void oz_retire_tx_frames(struct oz_pd *pd, u8 lpn); int oz_isoc_stream_create(struct oz_pd *pd, u8 ep_num); int oz_isoc_stream_delete(struct oz_pd *pd, u8 ep_num); -int oz_send_isoc_unit(struct oz_pd *pd, u8 ep_num, u8 *data, int len); +int oz_send_isoc_unit(struct oz_pd *pd, u8 ep_num, const u8 *data, int len); void oz_handle_app_elt(struct oz_pd *pd, u8 app_id, struct oz_elt *elt); void oz_apps_init(void); void oz_apps_term(void); diff --git a/drivers/staging/ozwpan/ozproto.c b/drivers/staging/ozwpan/ozproto.c index e00a53915daa..3badf1537adb 100644 --- a/drivers/staging/ozwpan/ozproto.c +++ b/drivers/staging/ozwpan/ozproto.c @@ -98,7 +98,7 @@ static void oz_send_conn_rsp(struct oz_pd *pd, u8 status) int sz = sizeof(struct oz_hdr) + sizeof(struct oz_elt) + sizeof(struct oz_elt_connect_rsp); skb = alloc_skb(sz + OZ_ALLOCATED_SPACE(dev), GFP_ATOMIC); - if (skb == 0) + if (skb == NULL) return; skb_reserve(skb, LL_RESERVED_SPACE(dev)); skb_reset_network_header(skb); @@ -116,7 +116,7 @@ static void oz_send_conn_rsp(struct oz_pd *pd, u8 status) oz_hdr->control = (OZ_PROTOCOL_VERSION<<OZ_VERSION_SHIFT); oz_hdr->last_pkt_num = 0; put_unaligned(0, &oz_hdr->pkt_num); - oz_event_log(OZ_EVT_CONNECT_RSP, 0, 0, 0, 0); + oz_event_log(OZ_EVT_CONNECT_RSP, 0, 0, NULL, 0); elt->type = OZ_ELT_CONNECT_RSP; elt->length = sizeof(struct oz_elt_connect_rsp); memset(body, 0, sizeof(struct oz_elt_connect_rsp)); @@ -171,7 +171,7 @@ static void pd_set_presleep(struct oz_pd *pd, u8 presleep) * Context: softirq-serialized */ static struct oz_pd *oz_connect_req(struct oz_pd *cur_pd, struct oz_elt *elt, - u8 *pd_addr, struct net_device *net_dev) + const u8 *pd_addr, struct net_device *net_dev) { struct oz_pd *pd; struct oz_elt_connect_req *body = @@ -179,17 +179,17 @@ static struct oz_pd *oz_connect_req(struct oz_pd *cur_pd, struct oz_elt *elt, u8 rsp_status = OZ_STATUS_SUCCESS; u8 stop_needed = 0; u16 new_apps = g_apps; - struct net_device *old_net_dev = 0; - struct oz_pd *free_pd = 0; + struct net_device *old_net_dev = NULL; + struct oz_pd *free_pd = NULL; if (cur_pd) { pd = cur_pd; spin_lock_bh(&g_polling_lock); } else { - struct oz_pd *pd2 = 0; + struct oz_pd *pd2 = NULL; struct list_head *e; pd = oz_pd_alloc(pd_addr); - if (pd == 0) - return 0; + if (pd == NULL) + return NULL; pd->last_rx_time_j = jiffies; spin_lock_bh(&g_polling_lock); list_for_each(e, &g_pd_list) { @@ -203,9 +203,9 @@ static struct oz_pd *oz_connect_req(struct oz_pd *cur_pd, struct oz_elt *elt, if (pd != pd2) list_add_tail(&pd->link, &g_pd_list); } - if (pd == 0) { + if (pd == NULL) { spin_unlock_bh(&g_polling_lock); - return 0; + return NULL; } if (pd->net_dev != net_dev) { old_net_dev = pd->net_dev; @@ -294,7 +294,7 @@ done: if (stop_needed) oz_pd_stop(pd); oz_pd_put(pd); - pd = 0; + pd = NULL; } if (old_net_dev) dev_put(old_net_dev); @@ -306,7 +306,7 @@ done: * Context: softirq-serialized */ static void oz_add_farewell(struct oz_pd *pd, u8 ep_num, u8 index, - u8 *report, u8 len) + const u8 *report, u8 len) { struct oz_farewell *f; struct oz_farewell *f2; @@ -340,14 +340,14 @@ static void oz_rx_frame(struct sk_buff *skb) u8 *src_addr; struct oz_elt *elt; int length; - struct oz_pd *pd = 0; + struct oz_pd *pd = NULL; struct oz_hdr *oz_hdr = (struct oz_hdr *)skb_network_header(skb); int dup = 0; u32 pkt_num; oz_event_log(OZ_EVT_RX_PROCESS, 0, (((u16)oz_hdr->control)<<8)|oz_hdr->last_pkt_num, - 0, oz_hdr->pkt_num); + NULL, oz_hdr->pkt_num); oz_trace2(OZ_TRACE_RX_FRAMES, "RX frame PN=0x%x LPN=0x%x control=0x%x\n", oz_hdr->pkt_num, oz_hdr->last_pkt_num, oz_hdr->control); @@ -402,7 +402,7 @@ static void oz_rx_frame(struct sk_buff *skb) break; switch (elt->type) { case OZ_ELT_CONNECT_REQ: - oz_event_log(OZ_EVT_CONNECT_REQ, 0, 0, 0, 0); + oz_event_log(OZ_EVT_CONNECT_REQ, 0, 0, NULL, 0); oz_trace("RX: OZ_ELT_CONNECT_REQ\n"); pd = oz_connect_req(pd, elt, src_addr, skb->dev); break; @@ -456,7 +456,7 @@ done: */ void oz_protocol_term(void) { - struct list_head *chain = 0; + struct list_head *chain; del_timer_sync(&g_timer); /* Walk the list of bindings and remove each one. */ @@ -487,7 +487,7 @@ void oz_protocol_term(void) spin_lock_bh(&g_polling_lock); } chain = g_timer_pool; - g_timer_pool = 0; + g_timer_pool = NULL; spin_unlock_bh(&g_polling_lock); while (chain) { struct oz_timer *t = container_of(chain, struct oz_timer, link); @@ -534,25 +534,25 @@ static void oz_protocol_timer(unsigned long arg) /* This happens if we remove the current timer but can't stop * the timer from firing. In this case just get out. */ - oz_event_log(OZ_EVT_TIMER, 0, 0, 0, 0); + oz_event_log(OZ_EVT_TIMER, 0, 0, NULL, 0); spin_unlock_bh(&g_polling_lock); return; } g_timer_state = OZ_TIMER_IN_HANDLER; t = g_cur_timer; - g_cur_timer = 0; + g_cur_timer = NULL; list_del(&t->link); spin_unlock_bh(&g_polling_lock); do { pd = t->pd; - oz_event_log(OZ_EVT_TIMER, 0, t->type, 0, 0); + oz_event_log(OZ_EVT_TIMER, 0, t->type, NULL, 0); oz_pd_handle_timer(pd, t->type); spin_lock_bh(&g_polling_lock); if (g_timer_pool_count < OZ_MAX_TIMER_POOL_SIZE) { t->link.next = g_timer_pool; g_timer_pool = &t->link; g_timer_pool_count++; - t = 0; + t = NULL; } if (!list_empty(&g_timer_list)) { t2 = container_of(g_timer_list.next, @@ -560,9 +560,9 @@ static void oz_protocol_timer(unsigned long arg) if (time_before_eq(t2->due_time, jiffies)) list_del(&t2->link); else - t2 = 0; + t2 = NULL; } else { - t2 = 0; + t2 = NULL; } spin_unlock_bh(&g_polling_lock); oz_pd_put(pd); @@ -583,12 +583,12 @@ static void oz_protocol_timer_start(void) container_of(g_timer_list.next, struct oz_timer, link); if (g_timer_state == OZ_TIMER_SET) { oz_event_log(OZ_EVT_TIMER_CTRL, 3, - (u16)g_cur_timer->type, 0, + (u16)g_cur_timer->type, NULL, (unsigned)g_cur_timer->due_time); mod_timer(&g_timer, g_cur_timer->due_time); } else { oz_event_log(OZ_EVT_TIMER_CTRL, 4, - (u16)g_cur_timer->type, 0, + (u16)g_cur_timer->type, NULL, (unsigned)g_cur_timer->due_time); g_timer.expires = g_cur_timer->due_time; g_timer.function = oz_protocol_timer; @@ -608,9 +608,9 @@ void oz_timer_add(struct oz_pd *pd, int type, unsigned long due_time, int remove) { struct list_head *e; - struct oz_timer *t = 0; + struct oz_timer *t = NULL; int restart_needed = 0; - oz_event_log(OZ_EVT_TIMER_CTRL, 1, (u16)type, 0, (unsigned)due_time); + oz_event_log(OZ_EVT_TIMER_CTRL, 1, (u16)type, NULL, (unsigned)due_time); spin_lock(&g_polling_lock); if (remove) { list_for_each(e, &g_timer_list) { @@ -618,12 +618,12 @@ void oz_timer_add(struct oz_pd *pd, int type, unsigned long due_time, if ((t->pd == pd) && (t->type == type)) { if (g_cur_timer == t) { restart_needed = 1; - g_cur_timer = 0; + g_cur_timer = NULL; } list_del(e); break; } - t = 0; + t = NULL; } } if (!t) { @@ -647,7 +647,7 @@ void oz_timer_add(struct oz_pd *pd, int type, unsigned long due_time, t2 = container_of(e, struct oz_timer, link); if (time_before(due_time, t2->due_time)) { if (t2 == g_cur_timer) { - g_cur_timer = 0; + g_cur_timer = NULL; restart_needed = 1; } break; @@ -668,18 +668,18 @@ void oz_timer_add(struct oz_pd *pd, int type, unsigned long due_time, */ void oz_timer_delete(struct oz_pd *pd, int type) { - struct list_head *chain = 0; + struct list_head *chain = NULL; struct oz_timer *t; struct oz_timer *n; int restart_needed = 0; int release = 0; - oz_event_log(OZ_EVT_TIMER_CTRL, 2, (u16)type, 0, 0); + oz_event_log(OZ_EVT_TIMER_CTRL, 2, (u16)type, NULL, 0); spin_lock(&g_polling_lock); list_for_each_entry_safe(t, n, &g_timer_list, link) { if ((t->pd == pd) && ((type == 0) || (t->type == type))) { if (g_cur_timer == t) { restart_needed = 1; - g_cur_timer = 0; + g_cur_timer = NULL; del_timer(&g_timer); } list_del(&t->link); @@ -734,7 +734,7 @@ void oz_pd_request_heartbeat(struct oz_pd *pd) /*------------------------------------------------------------------------------ * Context: softirq or process */ -struct oz_pd *oz_pd_find(u8 *mac_addr) +struct oz_pd *oz_pd_find(const u8 *mac_addr) { struct oz_pd *pd; struct list_head *e; @@ -748,7 +748,7 @@ struct oz_pd *oz_pd_find(u8 *mac_addr) } } spin_unlock_bh(&g_polling_lock); - return 0; + return NULL; } /*------------------------------------------------------------------------------ * Context: process @@ -770,9 +770,9 @@ void oz_app_enable(int app_id, int enable) static int oz_pkt_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) { - oz_event_log(OZ_EVT_RX_FRAME, 0, 0, 0, 0); + oz_event_log(OZ_EVT_RX_FRAME, 0, 0, NULL, 0); skb = skb_share_check(skb, GFP_ATOMIC); - if (skb == 0) + if (skb == NULL) return 0; spin_lock_bh(&g_rx_queue.lock); if (g_processing_rx) { @@ -815,14 +815,14 @@ void oz_binding_add(char *net_dev) oz_trace("Adding binding: %s\n", net_dev); binding->ptype.dev = dev_get_by_name(&init_net, net_dev); - if (binding->ptype.dev == 0) { + if (binding->ptype.dev == NULL) { oz_trace("Netdev %s not found\n", net_dev); kfree(binding); - binding = 0; + binding = NULL; } } else { oz_trace("Binding to all netcards\n"); - binding->ptype.dev = 0; + binding->ptype.dev = NULL; } if (binding) { dev_add_pack(&binding->ptype); @@ -876,7 +876,7 @@ static void pd_stop_all_for_device(struct net_device *net_dev) */ void oz_binding_remove(char *net_dev) { - struct oz_binding *binding = 0; + struct oz_binding *binding; struct oz_binding **link; oz_trace("Removing binding: %s\n", net_dev); spin_lock_bh(&g_binding_lock); @@ -923,7 +923,7 @@ int oz_protocol_init(char *devs) { skb_queue_head_init(&g_rx_queue); if (devs && (devs[0] == '*')) { - oz_binding_add(0); + oz_binding_add(NULL); } else { char d[32]; while (*devs) { diff --git a/drivers/staging/ozwpan/ozproto.h b/drivers/staging/ozwpan/ozproto.h index 755a08d0e1ca..93bb4c0172e0 100644 --- a/drivers/staging/ozwpan/ozproto.h +++ b/drivers/staging/ozwpan/ozproto.h @@ -62,7 +62,7 @@ int oz_protocol_init(char *devs); void oz_protocol_term(void); int oz_get_pd_list(struct oz_mac_addr *addr, int max_count); void oz_app_enable(int app_id, int enable); -struct oz_pd *oz_pd_find(u8 *mac_addr); +struct oz_pd *oz_pd_find(const u8 *mac_addr); void oz_binding_add(char *net_dev); void oz_binding_remove(char *net_dev); void oz_timer_add(struct oz_pd *pd, int type, unsigned long due_time, diff --git a/drivers/staging/ozwpan/ozusbif.h b/drivers/staging/ozwpan/ozusbif.h index 3acf5980d7cc..8531438d7586 100644 --- a/drivers/staging/ozwpan/ozusbif.h +++ b/drivers/staging/ozwpan/ozusbif.h @@ -21,7 +21,7 @@ int oz_usb_stream_delete(void *hpd, u8 ep_num); /* Request functions. */ int oz_usb_control_req(void *hpd, u8 req_id, struct usb_ctrlrequest *setup, - u8 *data, int data_len); + const u8 *data, int data_len); int oz_usb_get_desc_req(void *hpd, u8 req_id, u8 req_type, u8 desc_type, u8 index, u16 windex, int offset, int len); int oz_usb_send_isoc(void *hpd, u8 ep_num, struct urb *urb); @@ -30,13 +30,13 @@ void oz_usb_request_heartbeat(void *hpd); /* Confirmation functions. */ void oz_hcd_get_desc_cnf(void *hport, u8 req_id, int status, - u8 *desc, int length, int offset, int total_size); + const u8 *desc, int length, int offset, int total_size); void oz_hcd_control_cnf(void *hport, u8 req_id, u8 rcode, - u8 *data, int data_len); + const u8 *data, int data_len); /* Indication functions. */ -void oz_hcd_data_ind(void *hport, u8 endpoint, u8 *data, int data_len); +void oz_hcd_data_ind(void *hport, u8 endpoint, const u8 *data, int data_len); int oz_hcd_heartbeat(void *hport); diff --git a/drivers/staging/ozwpan/ozusbsvc.c b/drivers/staging/ozwpan/ozusbsvc.c index 8fa7f256ad8c..543a9415975c 100644 --- a/drivers/staging/ozwpan/ozusbsvc.c +++ b/drivers/staging/ozwpan/ozusbsvc.c @@ -34,7 +34,7 @@ */ int oz_usb_init(void) { - oz_event_log(OZ_EVT_SERVICE, 1, OZ_APPID_USB, 0, 0); + oz_event_log(OZ_EVT_SERVICE, 1, OZ_APPID_USB, NULL, 0); return oz_hcd_init(); } /*------------------------------------------------------------------------------ @@ -43,7 +43,7 @@ int oz_usb_init(void) */ void oz_usb_term(void) { - oz_event_log(OZ_EVT_SERVICE, 2, OZ_APPID_USB, 0, 0); + oz_event_log(OZ_EVT_SERVICE, 2, OZ_APPID_USB, NULL, 0); oz_hcd_term(); } /*------------------------------------------------------------------------------ @@ -54,8 +54,8 @@ int oz_usb_start(struct oz_pd *pd, int resume) { int rc = 0; struct oz_usb_ctx *usb_ctx; - struct oz_usb_ctx *old_ctx = 0; - oz_event_log(OZ_EVT_SERVICE, 3, OZ_APPID_USB, 0, resume); + struct oz_usb_ctx *old_ctx; + oz_event_log(OZ_EVT_SERVICE, 3, OZ_APPID_USB, NULL, resume); if (resume) { oz_trace("USB service resumed.\n"); return 0; @@ -65,7 +65,7 @@ int oz_usb_start(struct oz_pd *pd, int resume) * has a USB context then we will destroy it. */ usb_ctx = kzalloc(sizeof(struct oz_usb_ctx), GFP_ATOMIC); - if (usb_ctx == 0) + if (usb_ctx == NULL) return -ENOMEM; atomic_set(&usb_ctx->ref_count, 1); usb_ctx->pd = pd; @@ -76,7 +76,7 @@ int oz_usb_start(struct oz_pd *pd, int resume) */ spin_lock_bh(&pd->app_lock[OZ_APPID_USB-1]); old_ctx = pd->app_ctx[OZ_APPID_USB-1]; - if (old_ctx == 0) + if (old_ctx == NULL) pd->app_ctx[OZ_APPID_USB-1] = usb_ctx; oz_usb_get(pd->app_ctx[OZ_APPID_USB-1]); spin_unlock_bh(&pd->app_lock[OZ_APPID_USB-1]); @@ -98,10 +98,10 @@ int oz_usb_start(struct oz_pd *pd, int resume) oz_hcd_pd_reset(usb_ctx, usb_ctx->hport); } else { usb_ctx->hport = oz_hcd_pd_arrived(usb_ctx); - if (usb_ctx->hport == 0) { + if (usb_ctx->hport == NULL) { oz_trace("USB hub returned null port.\n"); spin_lock_bh(&pd->app_lock[OZ_APPID_USB-1]); - pd->app_ctx[OZ_APPID_USB-1] = 0; + pd->app_ctx[OZ_APPID_USB-1] = NULL; spin_unlock_bh(&pd->app_lock[OZ_APPID_USB-1]); oz_usb_put(usb_ctx); rc = -1; @@ -117,14 +117,14 @@ int oz_usb_start(struct oz_pd *pd, int resume) void oz_usb_stop(struct oz_pd *pd, int pause) { struct oz_usb_ctx *usb_ctx; - oz_event_log(OZ_EVT_SERVICE, 4, OZ_APPID_USB, 0, pause); + oz_event_log(OZ_EVT_SERVICE, 4, OZ_APPID_USB, NULL, pause); if (pause) { oz_trace("USB service paused.\n"); return; } spin_lock_bh(&pd->app_lock[OZ_APPID_USB-1]); usb_ctx = (struct oz_usb_ctx *)pd->app_ctx[OZ_APPID_USB-1]; - pd->app_ctx[OZ_APPID_USB-1] = 0; + pd->app_ctx[OZ_APPID_USB-1] = NULL; spin_unlock_bh(&pd->app_lock[OZ_APPID_USB-1]); if (usb_ctx) { unsigned long tout = jiffies + HZ; @@ -182,7 +182,7 @@ int oz_usb_heartbeat(struct oz_pd *pd) if (usb_ctx) oz_usb_get(usb_ctx); spin_unlock_bh(&pd->app_lock[OZ_APPID_USB-1]); - if (usb_ctx == 0) + if (usb_ctx == NULL) return rc; if (usb_ctx->stopped) goto done; diff --git a/drivers/staging/ozwpan/ozusbsvc1.c b/drivers/staging/ozwpan/ozusbsvc1.c index 66bd576bb5e9..4e4b650fee3f 100644 --- a/drivers/staging/ozwpan/ozusbsvc1.c +++ b/drivers/staging/ozwpan/ozusbsvc1.c @@ -71,7 +71,7 @@ int oz_usb_get_desc_req(void *hpd, u8 req_id, u8 req_type, u8 desc_type, oz_trace(" len = 0x%x\n", len); if (len > 200) len = 200; - if (ei == 0) + if (ei == NULL) return -1; elt = (struct oz_elt *)ei->data; elt->length = sizeof(struct oz_get_desc_req); @@ -97,7 +97,7 @@ static int oz_usb_set_config_req(void *hpd, u8 req_id, u8 index) struct oz_elt_buf *eb = &pd->elt_buff; struct oz_elt_info *ei = oz_elt_info_alloc(&pd->elt_buff); struct oz_set_config_req *body; - if (ei == 0) + if (ei == NULL) return -1; elt = (struct oz_elt *)ei->data; elt->length = sizeof(struct oz_set_config_req); @@ -118,7 +118,7 @@ static int oz_usb_set_interface_req(void *hpd, u8 req_id, u8 index, u8 alt) struct oz_elt_buf *eb = &pd->elt_buff; struct oz_elt_info *ei = oz_elt_info_alloc(&pd->elt_buff); struct oz_set_interface_req *body; - if (ei == 0) + if (ei == NULL) return -1; elt = (struct oz_elt *)ei->data; elt->length = sizeof(struct oz_set_interface_req); @@ -141,7 +141,7 @@ static int oz_usb_set_clear_feature_req(void *hpd, u8 req_id, u8 type, struct oz_elt_buf *eb = &pd->elt_buff; struct oz_elt_info *ei = oz_elt_info_alloc(&pd->elt_buff); struct oz_feature_req *body; - if (ei == 0) + if (ei == NULL) return -1; elt = (struct oz_elt *)ei->data; elt->length = sizeof(struct oz_feature_req); @@ -157,7 +157,7 @@ static int oz_usb_set_clear_feature_req(void *hpd, u8 req_id, u8 type, * Context: tasklet */ static int oz_usb_vendor_class_req(void *hpd, u8 req_id, u8 req_type, - u8 request, __le16 value, __le16 index, u8 *data, int data_len) + u8 request, __le16 value, __le16 index, const u8 *data, int data_len) { struct oz_usb_ctx *usb_ctx = (struct oz_usb_ctx *)hpd; struct oz_pd *pd = usb_ctx->pd; @@ -165,7 +165,7 @@ static int oz_usb_vendor_class_req(void *hpd, u8 req_id, u8 req_type, struct oz_elt_buf *eb = &pd->elt_buff; struct oz_elt_info *ei = oz_elt_info_alloc(&pd->elt_buff); struct oz_vendor_class_req *body; - if (ei == 0) + if (ei == NULL) return -1; elt = (struct oz_elt *)ei->data; elt->length = sizeof(struct oz_vendor_class_req) - 1 + data_len; @@ -184,7 +184,7 @@ static int oz_usb_vendor_class_req(void *hpd, u8 req_id, u8 req_type, * Context: tasklet */ int oz_usb_control_req(void *hpd, u8 req_id, struct usb_ctrlrequest *setup, - u8 *data, int data_len) + const u8 *data, int data_len) { unsigned wvalue = le16_to_cpu(setup->wValue); unsigned windex = le16_to_cpu(setup->wIndex); @@ -264,7 +264,7 @@ int oz_usb_send_isoc(void *hpd, u8 ep_num, struct urb *urb) int unit_count; int unit_size; int rem; - if (ei == 0) + if (ei == NULL) return -1; rem = MAX_ISOC_FIXED_DATA; elt = (struct oz_elt *)ei->data; @@ -305,7 +305,7 @@ int oz_usb_send_isoc(void *hpd, u8 ep_num, struct urb *urb) /*------------------------------------------------------------------------------ * Context: softirq-serialized */ -void oz_usb_handle_ep_data(struct oz_usb_ctx *usb_ctx, +static void oz_usb_handle_ep_data(struct oz_usb_ctx *usb_ctx, struct oz_usb_hdr *usb_hdr, int len) { struct oz_data *data_hdr = (struct oz_data *)usb_hdr; @@ -359,7 +359,7 @@ void oz_usb_rx(struct oz_pd *pd, struct oz_elt *elt) if (usb_ctx) oz_usb_get(usb_ctx); spin_unlock_bh(&pd->app_lock[OZ_APPID_USB-1]); - if (usb_ctx == 0) + if (usb_ctx == NULL) return; /* Context has gone so nothing to do. */ if (usb_ctx->stopped) goto done; @@ -391,14 +391,14 @@ void oz_usb_rx(struct oz_pd *pd, struct oz_elt *elt) struct oz_set_config_rsp *body = (struct oz_set_config_rsp *)usb_hdr; oz_hcd_control_cnf(usb_ctx->hport, body->req_id, - body->rcode, 0, 0); + body->rcode, NULL, 0); } break; case OZ_SET_INTERFACE_RSP: { struct oz_set_interface_rsp *body = (struct oz_set_interface_rsp *)usb_hdr; oz_hcd_control_cnf(usb_ctx->hport, - body->req_id, body->rcode, 0, 0); + body->req_id, body->rcode, NULL, 0); } break; case OZ_VENDOR_CLASS_RSP: { @@ -427,7 +427,7 @@ void oz_usb_farewell(struct oz_pd *pd, u8 ep_num, u8 *data, u8 len) if (usb_ctx) oz_usb_get(usb_ctx); spin_unlock_bh(&pd->app_lock[OZ_APPID_USB-1]); - if (usb_ctx == 0) + if (usb_ctx == NULL) return; /* Context has gone so nothing to do. */ if (!usb_ctx->stopped) { oz_trace("Farewell indicated ep = 0x%x\n", ep_num); |