Commit a5439521 authored by Mika Kukkonen's avatar Mika Kukkonen Committed by Linus Torvalds

[PATCH] sparse: NULL vs 0 - drivers/usb

parent 2b61d5c1
......@@ -851,7 +851,7 @@ static int usblp_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
struct usb_device *dev = interface_to_usbdev (intf);
struct usblp *usblp = 0;
struct usblp *usblp = NULL;
int protocol;
int retval;
......@@ -1019,7 +1019,7 @@ static int usblp_select_alts(struct usblp *usblp)
continue;
/* Look for bulk OUT and IN endpoints. */
epwrite = epread = 0;
epwrite = epread = NULL;
for (e = 0; e < ifd->desc.bNumEndpoints; e++) {
epd = &ifd->endpoint[e].desc;
......
......@@ -94,7 +94,7 @@ void hcd_buffer_destroy (struct usb_hcd *hcd)
struct dma_pool *pool = hcd->pool [i];
if (pool) {
dma_pool_destroy (pool);
hcd->pool [i] = 0;
hcd->pool[i] = NULL;
}
}
}
......
......@@ -414,7 +414,7 @@ void usb_destroy_configuration(struct usb_device *dev)
kfree(dev->rawdescriptors[i]);
kfree(dev->rawdescriptors);
dev->rawdescriptors = 0;
dev->rawdescriptors = NULL;
}
for (c = 0; c < dev->descriptor.bNumConfigurations; c++) {
......@@ -426,7 +426,7 @@ void usb_destroy_configuration(struct usb_device *dev)
}
}
kfree(dev->config);
dev->config = 0;
dev->config = NULL;
}
......
......@@ -1090,10 +1090,10 @@ static int proc_ioctl (struct dev_state *ps, void __user *arg)
{
struct usbdevfs_ioctl ctrl;
int size;
void *buf = 0;
void *buf = NULL;
int retval = 0;
struct usb_interface *intf = 0;
struct usb_driver *driver = 0;
struct usb_interface *intf = NULL;
struct usb_driver *driver = NULL;
/* get input parameters and alloc buffer */
if (copy_from_user(&ctrl, arg, sizeof (ctrl)))
......
......@@ -247,7 +247,7 @@ void usb_hcd_pci_remove (struct pci_dev *dev)
hcd->driver->stop (hcd);
hcd_buffer_destroy (hcd);
hcd->state = USB_STATE_HALT;
pci_set_drvdata (dev, 0);
pci_set_drvdata(dev, NULL);
free_irq (hcd->irq, hcd);
if (hcd->driver->flags & HCD_MEMORY) {
......
......@@ -326,7 +326,7 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
{
struct usb_ctrlrequest *cmd;
u16 typeReq, wValue, wIndex, wLength;
const u8 *bufp = 0;
const u8 *bufp = NULL;
u8 *ubuf = urb->transfer_buffer;
int len = 0;
int patch_wakeup = 0;
......@@ -536,7 +536,7 @@ static void rh_report_status (unsigned long ptr)
hcd->rh_timer.data = 0;
urb->actual_length = length;
urb->status = 0;
urb->hcpriv = 0;
urb->hcpriv = NULL;
} else
mod_timer (&hcd->rh_timer, jiffies + HZ/4);
spin_unlock (&hcd_data_lock);
......@@ -578,7 +578,7 @@ void usb_rh_status_dequeue (struct usb_hcd *hcd, struct urb *urb)
hcd->rh_timer.data = 0;
local_irq_save (flags);
urb->hcpriv = 0;
urb->hcpriv = NULL;
usb_hcd_giveback_urb (hcd, urb, NULL);
local_irq_restore (flags);
}
......@@ -1207,8 +1207,8 @@ static void unlink_complete (struct urb *urb, struct pt_regs *regs)
static int hcd_unlink_urb (struct urb *urb)
{
struct hcd_dev *dev;
struct usb_hcd *hcd = 0;
struct device *sys = 0;
struct usb_hcd *hcd = NULL;
struct device *sys = NULL;
unsigned long flags;
struct completion_splice splice;
struct list_head *tmp;
......
......@@ -288,9 +288,9 @@ static void hub_irq(struct urb *urb, struct pt_regs *regs)
static inline int
hub_clear_tt_buffer (struct usb_device *hdev, u16 devinfo, u16 tt)
{
return usb_control_msg (hdev, usb_rcvctrlpipe (hdev, 0),
HUB_CLEAR_TT_BUFFER, USB_RT_PORT,
devinfo, tt, 0, 0, HZ);
return usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0),
HUB_CLEAR_TT_BUFFER, USB_RT_PORT, devinfo,
tt, NULL, 0, HZ);
}
/*
......
......@@ -91,8 +91,8 @@ int usb_internal_control_msg(struct usb_device *usb_dev, unsigned int pipe,
if (!urb)
return -ENOMEM;
usb_fill_control_urb(urb, usb_dev, pipe, (unsigned char*)cmd, data, len,
usb_api_blocking_completion, 0);
usb_fill_control_urb(urb, usb_dev, pipe, (unsigned char *)cmd, data,
len, usb_api_blocking_completion, NULL);
retv = usb_start_wait_urb(urb, timeout, &length);
if (retv < 0)
......@@ -190,7 +190,7 @@ int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe,
return -ENOMEM;
usb_fill_bulk_urb(urb, usb_dev, pipe, data, len,
usb_api_blocking_completion, 0);
usb_api_blocking_completion, NULL);
return usb_start_wait_urb(urb,timeout,actual_length);
}
......@@ -203,11 +203,11 @@ static void sg_clean (struct usb_sg_request *io)
while (io->entries--)
usb_free_urb (io->urbs [io->entries]);
kfree (io->urbs);
io->urbs = 0;
io->urbs = NULL;
}
if (io->dev->dev.dma_mask != 0)
usb_buffer_unmap_sg (io->dev, io->pipe, io->sg, io->nents);
io->dev = 0;
io->dev = NULL;
}
static void sg_complete (struct urb *urb, struct pt_regs *regs)
......@@ -260,7 +260,7 @@ static void sg_complete (struct urb *urb, struct pt_regs *regs)
found = 1;
}
}
urb->dev = 0;
urb->dev = NULL;
/* on the last completion, signal usb_sg_wait() */
io->bytes += urb->actual_length;
......@@ -356,7 +356,7 @@ int usb_sg_init (
goto nomem;
}
io->urbs [i]->dev = 0;
io->urbs [i]->dev = NULL;
io->urbs [i]->pipe = pipe;
io->urbs [i]->interval = period;
io->urbs [i]->transfer_flags = urb_flags;
......@@ -459,7 +459,7 @@ void usb_sg_wait (struct usb_sg_request *io)
case -ENXIO: // hc didn't queue this one
case -EAGAIN:
case -ENOMEM:
io->urbs [i]->dev = 0;
io->urbs[i]->dev = NULL;
retval = 0;
i--;
yield ();
......@@ -485,7 +485,7 @@ void usb_sg_wait (struct usb_sg_request *io)
complete (&io->complete);
spin_unlock_irq (&io->lock);
io->urbs [i]->dev = 0;
io->urbs[i]->dev = NULL;
io->urbs [i]->status = retval;
dev_dbg (&io->dev->dev, "%s, submit --> %d\n",
__FUNCTION__, retval);
......@@ -838,7 +838,7 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
put_device (&dev->actconfig->interface[i]->dev);
dev->actconfig->interface[i] = NULL;
}
dev->actconfig = 0;
dev->actconfig = NULL;
if (dev->state == USB_STATE_CONFIGURED)
usb_set_device_state(dev, USB_STATE_ADDRESS);
}
......
......@@ -649,7 +649,7 @@ static int usb_hotplug (struct device *dev, char **envp, int num_envp,
scratch += length;
}
envp [i++] = 0;
envp[i++] = NULL;
return 0;
}
......@@ -975,7 +975,7 @@ void *usb_buffer_alloc (
)
{
if (!dev || !dev->bus || !dev->bus->op || !dev->bus->op->buffer_alloc)
return 0;
return NULL;
return dev->bus->op->buffer_alloc (dev->bus, size, mem_flags, dma);
}
......@@ -1027,7 +1027,7 @@ struct urb *usb_buffer_map (struct urb *urb)
|| !urb->dev
|| !(bus = urb->dev->bus)
|| !(controller = bus->controller))
return 0;
return NULL;
if (controller->dma_mask) {
urb->transfer_dma = dma_map_single (controller,
......
......@@ -415,7 +415,7 @@ static int ehci_start (struct usb_hcd *hcd)
else // N microframes cached
ehci->i_thresh = 2 + HCC_ISOC_THRES (hcc_params);
ehci->reclaim = 0;
ehci->reclaim = NULL;
ehci->next_uframe = -1;
/* controller state: unknown --> reset */
......@@ -462,7 +462,7 @@ static int ehci_start (struct usb_hcd *hcd)
* its dummy is used in hw_alt_next of many tds, to prevent the qh
* from automatically advancing to the next td after short reads.
*/
ehci->async->qh_next.qh = 0;
ehci->async->qh_next.qh = NULL;
ehci->async->hw_next = QH_NEXT (ehci->async->qh_dma);
ehci->async->hw_info1 = cpu_to_le32 (QH_HEAD);
ehci->async->hw_token = cpu_to_le32 (QTD_STS_HALT);
......@@ -985,7 +985,7 @@ ehci_endpoint_disable (struct usb_hcd *hcd, struct hcd_dev *dev, int ep)
list_empty (&qh->qtd_list) ? "" : "(has tds)");
break;
}
dev->ep [epnum] = 0;
dev->ep[epnum] = NULL;
done:
spin_unlock_irqrestore (&ehci->lock, flags);
return;
......
......@@ -71,7 +71,7 @@ static int ehci_hub_suspend (struct usb_hcd *hcd)
writel (ehci->command & ~CMD_RUN, &ehci->regs->command);
if (ehci->reclaim)
ehci->reclaim_ready = 1;
ehci_work (ehci, 0);
ehci_work(ehci, NULL);
(void) handshake (&ehci->regs->status, STS_HALT, STS_HALT, 2000);
root->dev.power.power_state = 3;
......
......@@ -47,7 +47,7 @@ static struct usb_hcd *ehci_hcd_alloc (void)
ehci->hcd.product_desc = "EHCI Host Controller";
return &ehci->hcd;
}
return 0;
return NULL;
}
static void ehci_hcd_free (struct usb_hcd *hcd)
......@@ -125,7 +125,7 @@ static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, int flags)
if (qh->dummy == 0) {
ehci_dbg (ehci, "no dummy td\n");
dma_pool_free (ehci->qh_pool, qh, qh->qh_dma);
qh = 0;
qh = NULL;
}
return qh;
}
......@@ -153,36 +153,36 @@ static void ehci_mem_cleanup (struct ehci_hcd *ehci)
{
if (ehci->async)
qh_put (ehci->async);
ehci->async = 0;
ehci->async = NULL;
/* DMA consistent memory and pools */
if (ehci->qtd_pool)
dma_pool_destroy (ehci->qtd_pool);
ehci->qtd_pool = 0;
ehci->qtd_pool = NULL;
if (ehci->qh_pool) {
dma_pool_destroy (ehci->qh_pool);
ehci->qh_pool = 0;
ehci->qh_pool = NULL;
}
if (ehci->itd_pool)
dma_pool_destroy (ehci->itd_pool);
ehci->itd_pool = 0;
ehci->itd_pool = NULL;
if (ehci->sitd_pool)
dma_pool_destroy (ehci->sitd_pool);
ehci->sitd_pool = 0;
ehci->sitd_pool = NULL;
if (ehci->periodic)
dma_free_coherent (ehci->hcd.self.controller,
ehci->periodic_size * sizeof (u32),
ehci->periodic, ehci->periodic_dma);
ehci->periodic = 0;
ehci->periodic = NULL;
/* shadow periodic table */
if (ehci->pshadow)
kfree (ehci->pshadow);
ehci->pshadow = 0;
ehci->pshadow = NULL;
}
/* remember to add cleanup code (above) if you add anything here */
......
......@@ -197,7 +197,7 @@ ehci_urb_done (struct ehci_hcd *ehci, struct urb *urb, struct pt_regs *regs)
}
spin_lock (&urb->lock);
urb->hcpriv = 0;
urb->hcpriv = NULL;
switch (urb->status) {
case -EINPROGRESS: /* success */
urb->status = 0;
......@@ -242,7 +242,7 @@ ehci_urb_done (struct ehci_hcd *ehci, struct urb *urb, struct pt_regs *regs)
static unsigned
qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh, struct pt_regs *regs)
{
struct ehci_qtd *last = 0, *end = qh->dummy;
struct ehci_qtd *last = NULL, *end = qh->dummy;
struct list_head *entry, *tmp;
int stopped;
unsigned count = 0;
......@@ -282,7 +282,7 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh, struct pt_regs *regs)
count++;
}
ehci_qtd_free (ehci, last);
last = 0;
last = NULL;
}
/* ignore urbs submitted during completions we reported */
......@@ -383,7 +383,7 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh, struct pt_regs *regs)
struct ehci_qtd, qtd_list);
/* first qtd may already be partially processed */
if (cpu_to_le32 (end->qtd_dma) == qh->hw_current)
end = 0;
end = NULL;
}
if (end)
qh_update (ehci, qh, end);
......@@ -440,7 +440,7 @@ qh_urb_transaction (
*/
qtd = ehci_qtd_alloc (ehci, flags);
if (unlikely (!qtd))
return 0;
return NULL;
list_add_tail (&qtd->qtd_list, head);
qtd->urb = urb;
......@@ -555,7 +555,7 @@ qh_urb_transaction (
cleanup:
qtd_list_free (ehci, urb, head);
return 0;
return NULL;
}
/*-------------------------------------------------------------------------*/
......@@ -709,7 +709,7 @@ qh_make (
dbg ("bogus dev %p speed %d", urb->dev, urb->dev->speed);
done:
qh_put (qh);
return 0;
return NULL;
}
/* NOTE: if (PIPE_INTERRUPT) { scheduler sets s-mask } */
......@@ -780,19 +780,19 @@ static struct ehci_qh *qh_append_tds (
void **ptr
)
{
struct ehci_qh *qh = 0;
struct ehci_qh *qh = NULL;
qh = (struct ehci_qh *) *ptr;
if (unlikely (qh == 0)) {
if (unlikely (qh == NULL)) {
/* can't sleep here, we have ehci->lock... */
qh = qh_make (ehci, urb, GFP_ATOMIC);
*ptr = qh;
}
if (likely (qh != 0)) {
if (likely (qh != NULL)) {
struct ehci_qtd *qtd;
if (unlikely (list_empty (qtd_list)))
qtd = 0;
qtd = NULL;
else
qtd = list_entry (qtd_list->next, struct ehci_qtd,
qtd_list);
......@@ -900,7 +900,7 @@ submit_async (
struct hcd_dev *dev;
int epnum;
unsigned long flags;
struct ehci_qh *qh = 0;
struct ehci_qh *qh = NULL;
qtd = list_entry (qtd_list->next, struct ehci_qtd, qtd_list);
dev = (struct hcd_dev *)urb->dev->hcpriv;
......@@ -950,14 +950,14 @@ static void end_unlink_async (struct ehci_hcd *ehci, struct pt_regs *regs)
// qh->hw_next = cpu_to_le32 (qh->qh_dma);
qh->qh_state = QH_STATE_IDLE;
qh->qh_next.qh = 0;
qh->qh_next.qh = NULL;
qh_put (qh); // refcount from reclaim
/* other unlink(s) may be pending (in QH_STATE_UNLINK_WAIT) */
next = qh->reclaim;
ehci->reclaim = next;
ehci->reclaim_ready = 0;
qh->reclaim = 0;
qh->reclaim = NULL;
qh_completions (ehci, qh, regs);
......@@ -976,7 +976,7 @@ static void end_unlink_async (struct ehci_hcd *ehci, struct pt_regs *regs)
}
if (next) {
ehci->reclaim = 0;
ehci->reclaim = NULL;
start_unlink_async (ehci, next);
}
}
......
......@@ -89,7 +89,7 @@ static int periodic_unlink (struct ehci_hcd *ehci, unsigned frame, void *ptr)
/* unlink from shadow list; HCD won't see old structure again */
*prev_p = *next_p;
next_p->ptr = 0;
next_p->ptr = NULL;
return 1;
}
......@@ -317,7 +317,7 @@ static void intr_deschedule (
} while (frame < ehci->periodic_size);
qh->qh_state = QH_STATE_UNLINK;
qh->qh_next.ptr = 0;
qh->qh_next.ptr = NULL;
ehci->periodic_sched--;
/* maybe turn off periodic schedule */
......@@ -718,7 +718,7 @@ iso_stream_put(struct ehci_hcd *ehci, struct ehci_iso_stream *stream)
is_in = (stream->bEndpointAddress & USB_DIR_IN) ? 0x10 : 0;
stream->bEndpointAddress &= 0x0f;
dev->ep [is_in + stream->bEndpointAddress] = 0;
dev->ep[is_in + stream->bEndpointAddress] = NULL;
if (stream->rescheduled) {
ehci_info (ehci, "ep%d%s-iso rescheduled "
......@@ -772,7 +772,7 @@ iso_stream_find (struct ehci_hcd *ehci, struct urb *urb)
ehci_dbg (ehci, "dev %s ep%d%s, not iso??\n",
urb->dev->devpath, epnum & 0x0f,
(epnum & 0x10) ? "in" : "out");
stream = 0;
stream = NULL;
}
/* caller guarantees an eventual matching iso_stream_put */
......@@ -896,7 +896,7 @@ itd_urb_transaction (
list_del (&itd->itd_list);
itd_dma = itd->itd_dma;
} else
itd = 0;
itd = NULL;
if (!itd) {
spin_unlock_irqrestore (&ehci->lock, flags);
......@@ -1116,7 +1116,7 @@ iso_stream_schedule (
fail:
iso_sched_free (stream, sched);
urb->hcpriv = 0;
urb->hcpriv = NULL;
return status;
ready:
......@@ -1215,8 +1215,8 @@ itd_link_urb (
hcd_to_bus (&ehci->hcd)->bandwidth_isoc_reqs++;
/* fill iTDs uframe by uframe */
for (packet = 0, itd = 0; packet < urb->number_of_packets; ) {
if (itd == 0) {
for (packet = 0, itd = NULL; packet < urb->number_of_packets; ) {
if (itd == NULL) {
/* ASSERT: we have all necessary itds */
// BUG_ON (list_empty (&iso_sched->td_list));
......@@ -1247,14 +1247,14 @@ itd_link_urb (
if (((next_uframe >> 3) != frame)
|| packet == urb->number_of_packets) {
itd_link (ehci, frame % ehci->periodic_size, itd);
itd = 0;
itd = NULL;
}
}
stream->next_uframe = next_uframe;
/* don't need that schedule data any more */
iso_sched_free (stream, iso_sched);
urb->hcpriv = 0;
urb->hcpriv = NULL;
timer_action (ehci, TIMER_IO_WATCHDOG);
if (unlikely (!ehci->periodic_sched++))
......@@ -1311,8 +1311,8 @@ itd_complete (
}
usb_put_urb (urb);
itd->urb = 0;
itd->stream = 0;
itd->urb = NULL;
itd->stream = NULL;
list_move (&itd->itd_list, &stream->free_list);
iso_stream_put (ehci, stream);
......@@ -1328,7 +1328,7 @@ itd_complete (
/* give urb back to the driver ... can be out-of-order */
dev = usb_get_dev (urb->dev);
ehci_urb_done (ehci, urb, regs);
urb = 0;
urb = NULL;
/* defer stopping schedule; completion can submit */
ehci->periodic_sched--;
......@@ -1903,7 +1903,7 @@ scan_periodic (struct ehci_hcd *ehci, struct pt_regs *regs)
dbg ("corrupt type %d frame %d shadow %p",
type, frame, q.ptr);
// BUG ();
q.ptr = 0;
q.ptr = NULL;
}
/* assume completion callbacks modify the queue */
......
......@@ -2533,7 +2533,7 @@ static int __init uhci_hcd_init(void)
}
#ifdef CONFIG_PROC_FS
uhci_proc_root = create_proc_entry("driver/uhci", S_IFDIR, 0);
uhci_proc_root = create_proc_entry("driver/uhci", S_IFDIR, NULL);
if (!uhci_proc_root)
goto proc_failed;
#endif
......@@ -2556,7 +2556,7 @@ static int __init uhci_hcd_init(void)
up_failed:
#ifdef CONFIG_PROC_FS
remove_proc_entry("driver/uhci", 0);
remove_proc_entry("driver/uhci", NULL);
proc_failed:
#endif
......@@ -2576,7 +2576,7 @@ static void __exit uhci_hcd_cleanup(void)
warn("not all urb_priv's were freed!");
#ifdef CONFIG_PROC_FS
remove_proc_entry("driver/uhci", 0);
remove_proc_entry("driver/uhci", NULL);
#endif
if (errbuf)
......
......@@ -211,7 +211,7 @@ static struct us_unusual_dev us_unusual_dev_list[] = {
.useTransport = US_PR_BULK},
/* Terminating entry */
{ 0 }
{ NULL }
};
struct usb_driver usb_storage_driver = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment