Skip to content

Commit

Permalink
USB: xhci: Avoid global namespace pollution.
Browse files Browse the repository at this point in the history
Make all globally visible functions start with xhci_ and mark functions as
static if they're only called within the same C file.  Fix some long lines
while we're at it.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Sarah Sharp authored and Greg Kroah-Hartman committed Jun 16, 2009
1 parent 06e7a14 commit 23e3be1
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 72 deletions.
14 changes: 7 additions & 7 deletions drivers/usb/host/xhci-dbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void xhci_dbg_regs(struct xhci_hcd *xhci)
xhci_dbg(xhci, "// Doorbell array at %p:\n", xhci->dba);
}

void xhci_print_cap_regs(struct xhci_hcd *xhci)
static void xhci_print_cap_regs(struct xhci_hcd *xhci)
{
u32 temp;

Expand Down Expand Up @@ -106,7 +106,7 @@ void xhci_print_cap_regs(struct xhci_hcd *xhci)
xhci_dbg(xhci, "RTSOFF 0x%x:\n", temp & RTSOFF_MASK);
}

void xhci_print_command_reg(struct xhci_hcd *xhci)
static void xhci_print_command_reg(struct xhci_hcd *xhci)
{
u32 temp;

Expand All @@ -124,7 +124,7 @@ void xhci_print_command_reg(struct xhci_hcd *xhci)
(temp & CMD_LRESET) ? "not " : "");
}

void xhci_print_status(struct xhci_hcd *xhci)
static void xhci_print_status(struct xhci_hcd *xhci)
{
u32 temp;

Expand All @@ -138,14 +138,14 @@ void xhci_print_status(struct xhci_hcd *xhci)
(temp & STS_HALT) ? "halted" : "running");
}

void xhci_print_op_regs(struct xhci_hcd *xhci)
static void xhci_print_op_regs(struct xhci_hcd *xhci)
{
xhci_dbg(xhci, "xHCI operational registers at %p:\n", xhci->op_regs);
xhci_print_command_reg(xhci);
xhci_print_status(xhci);
}

void xhci_print_ports(struct xhci_hcd *xhci)
static void xhci_print_ports(struct xhci_hcd *xhci)
{
u32 __iomem *addr;
int i, j;
Expand Down Expand Up @@ -340,13 +340,13 @@ void xhci_dbg_ring_ptrs(struct xhci_hcd *xhci, struct xhci_ring *ring)
{
xhci_dbg(xhci, "Ring deq = %p (virt), 0x%llx (dma)\n",
ring->dequeue,
(unsigned long long)trb_virt_to_dma(ring->deq_seg,
(unsigned long long)xhci_trb_virt_to_dma(ring->deq_seg,
ring->dequeue));
xhci_dbg(xhci, "Ring deq updated %u times\n",
ring->deq_updates);
xhci_dbg(xhci, "Ring enq = %p (virt), 0x%llx (dma)\n",
ring->enqueue,
(unsigned long long)trb_virt_to_dma(ring->enq_seg,
(unsigned long long)xhci_trb_virt_to_dma(ring->enq_seg,
ring->enqueue));
xhci_dbg(xhci, "Ring enq updated %u times\n",
ring->enq_updates);
Expand Down
42 changes: 23 additions & 19 deletions drivers/usb/host/xhci-hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd)
}

#ifdef CONFIG_USB_XHCI_HCD_DEBUGGING
void event_ring_work(unsigned long arg)
void xhci_event_ring_work(unsigned long arg)
{
unsigned long flags;
int temp;
Expand Down Expand Up @@ -330,8 +330,8 @@ void event_ring_work(unsigned long arg)
}

if (xhci->noops_submitted != NUM_TEST_NOOPS)
if (setup_one_noop(xhci))
ring_cmd_db(xhci);
if (xhci_setup_one_noop(xhci))
xhci_ring_cmd_db(xhci);
spin_unlock_irqrestore(&xhci->lock, flags);

if (!xhci->zombie)
Expand Down Expand Up @@ -374,7 +374,7 @@ int xhci_run(struct usb_hcd *hcd)
#ifdef CONFIG_USB_XHCI_HCD_DEBUGGING
init_timer(&xhci->event_ring_timer);
xhci->event_ring_timer.data = (unsigned long) xhci;
xhci->event_ring_timer.function = event_ring_work;
xhci->event_ring_timer.function = xhci_event_ring_work;
/* Poll the event ring */
xhci->event_ring_timer.expires = jiffies + POLL_TIMEOUT * HZ;
xhci->zombie = 0;
Expand Down Expand Up @@ -404,7 +404,7 @@ int xhci_run(struct usb_hcd *hcd)
xhci_print_ir_set(xhci, xhci->ir_set, 0);

if (NUM_TEST_NOOPS > 0)
doorbell = setup_one_noop(xhci);
doorbell = xhci_setup_one_noop(xhci);

xhci_dbg(xhci, "Command ring memory map follows:\n");
xhci_debug_ring(xhci, xhci->cmd_ring);
Expand Down Expand Up @@ -600,9 +600,11 @@ int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags)
goto exit;
}
if (usb_endpoint_xfer_control(&urb->ep->desc))
ret = queue_ctrl_tx(xhci, mem_flags, urb, slot_id, ep_index);
ret = xhci_queue_ctrl_tx(xhci, mem_flags, urb,
slot_id, ep_index);
else if (usb_endpoint_xfer_bulk(&urb->ep->desc))
ret = queue_bulk_tx(xhci, mem_flags, urb, slot_id, ep_index);
ret = xhci_queue_bulk_tx(xhci, mem_flags, urb,
slot_id, ep_index);
else
ret = -EINVAL;
exit:
Expand Down Expand Up @@ -668,8 +670,8 @@ int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
* the first cancellation to be handled.
*/
if (ep_ring->cancels_pending == 1) {
queue_stop_endpoint(xhci, urb->dev->slot_id, ep_index);
ring_cmd_db(xhci);
xhci_queue_stop_endpoint(xhci, urb->dev->slot_id, ep_index);
xhci_ring_cmd_db(xhci);
}
done:
spin_unlock_irqrestore(&xhci->lock, flags);
Expand Down Expand Up @@ -913,13 +915,14 @@ int xhci_check_bandwidth(struct usb_hcd *hcd, struct usb_device *udev)
xhci_dbg_ctx(xhci, virt_dev->in_ctx, virt_dev->in_ctx_dma,
LAST_CTX_TO_EP_NUM(virt_dev->in_ctx->slot.dev_info));

ret = queue_configure_endpoint(xhci, virt_dev->in_ctx_dma, udev->slot_id);
ret = xhci_queue_configure_endpoint(xhci, virt_dev->in_ctx_dma,
udev->slot_id);
if (ret < 0) {
xhci_dbg(xhci, "FIXME allocate a new ring segment\n");
spin_unlock_irqrestore(&xhci->lock, flags);
return -ENOMEM;
}
ring_cmd_db(xhci);
xhci_ring_cmd_db(xhci);
spin_unlock_irqrestore(&xhci->lock, flags);

/* Wait for the configure endpoint command to complete */
Expand Down Expand Up @@ -1033,12 +1036,12 @@ void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev)
return;

spin_lock_irqsave(&xhci->lock, flags);
if (queue_slot_control(xhci, TRB_DISABLE_SLOT, udev->slot_id)) {
if (xhci_queue_slot_control(xhci, TRB_DISABLE_SLOT, udev->slot_id)) {
spin_unlock_irqrestore(&xhci->lock, flags);
xhci_dbg(xhci, "FIXME: allocate a command ring segment\n");
return;
}
ring_cmd_db(xhci);
xhci_ring_cmd_db(xhci);
spin_unlock_irqrestore(&xhci->lock, flags);
/*
* Event command completion handler will free any data structures
Expand All @@ -1058,13 +1061,13 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev)
int ret;

spin_lock_irqsave(&xhci->lock, flags);
ret = queue_slot_control(xhci, TRB_ENABLE_SLOT, 0);
ret = xhci_queue_slot_control(xhci, TRB_ENABLE_SLOT, 0);
if (ret) {
spin_unlock_irqrestore(&xhci->lock, flags);
xhci_dbg(xhci, "FIXME: allocate a command ring segment\n");
return 0;
}
ring_cmd_db(xhci);
xhci_ring_cmd_db(xhci);
spin_unlock_irqrestore(&xhci->lock, flags);

/* XXX: how much time for xHC slot assignment? */
Expand All @@ -1086,8 +1089,8 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev)
if (!xhci_alloc_virt_device(xhci, xhci->slot_id, udev, GFP_KERNEL)) {
/* Disable slot, if we can do it without mem alloc */
xhci_warn(xhci, "Could not allocate xHCI USB device data structures\n");
if (!queue_slot_control(xhci, TRB_DISABLE_SLOT, udev->slot_id))
ring_cmd_db(xhci);
if (!xhci_queue_slot_control(xhci, TRB_DISABLE_SLOT, udev->slot_id))
xhci_ring_cmd_db(xhci);
spin_unlock_irqrestore(&xhci->lock, flags);
return 0;
}
Expand Down Expand Up @@ -1129,13 +1132,14 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev)
xhci_setup_addressable_virt_dev(xhci, udev);
/* Otherwise, assume the core has the device configured how it wants */

ret = queue_address_device(xhci, virt_dev->in_ctx_dma, udev->slot_id);
ret = xhci_queue_address_device(xhci, virt_dev->in_ctx_dma,
udev->slot_id);
if (ret) {
spin_unlock_irqrestore(&xhci->lock, flags);
xhci_dbg(xhci, "FIXME: allocate a command ring segment\n");
return ret;
}
ring_cmd_db(xhci);
xhci_ring_cmd_db(xhci);
spin_unlock_irqrestore(&xhci->lock, flags);

/* ctrl tx can take up to 5 sec; XXX: need more time for xHC? */
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/host/xhci-mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
xhci_writel(xhci, 0, &xhci->ir_set->erst_base[1]);

/* Set the event ring dequeue address */
set_hc_event_deq(xhci);
xhci_set_hc_event_deq(xhci);
xhci_dbg(xhci, "Wrote ERST address to ir_set 0.\n");
xhci_print_ir_set(xhci, xhci->ir_set, 0);

Expand Down
Loading

0 comments on commit 23e3be1

Please sign in to comment.