USB: EHCI: rename "reclaim"
This patch (as1569) renames the ehci->reclaim list in ehci-hcd. The word "reclaim" is used in the EHCI specification to mean something quite different, and "unlink_next" is more descriptive of the list's purpose anyway. Similarly, the "reclaim" field in the ehci_stats structure is renamed "iaa", which is more meaningful (to experts, anyway) and is a better match for the "lost_iaa" field. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
4c53de7210
commit
99ac5b1e95
|
@ -538,12 +538,13 @@ static ssize_t fill_async_buffer(struct debug_buffer *buf)
|
||||||
spin_lock_irqsave (&ehci->lock, flags);
|
spin_lock_irqsave (&ehci->lock, flags);
|
||||||
for (qh = ehci->async->qh_next.qh; size > 0 && qh; qh = qh->qh_next.qh)
|
for (qh = ehci->async->qh_next.qh; size > 0 && qh; qh = qh->qh_next.qh)
|
||||||
qh_lines (ehci, qh, &next, &size);
|
qh_lines (ehci, qh, &next, &size);
|
||||||
if (ehci->reclaim && size > 0) {
|
if (ehci->async_unlink && size > 0) {
|
||||||
temp = scnprintf (next, size, "\nreclaim =\n");
|
temp = scnprintf(next, size, "\nunlink =\n");
|
||||||
size -= temp;
|
size -= temp;
|
||||||
next += temp;
|
next += temp;
|
||||||
|
|
||||||
for (qh = ehci->reclaim; size > 0 && qh; qh = qh->reclaim)
|
for (qh = ehci->async_unlink; size > 0 && qh;
|
||||||
|
qh = qh->unlink_next)
|
||||||
qh_lines (ehci, qh, &next, &size);
|
qh_lines (ehci, qh, &next, &size);
|
||||||
}
|
}
|
||||||
spin_unlock_irqrestore (&ehci->lock, flags);
|
spin_unlock_irqrestore (&ehci->lock, flags);
|
||||||
|
@ -841,16 +842,17 @@ static ssize_t fill_registers_buffer(struct debug_buffer *buf)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ehci->reclaim) {
|
if (ehci->async_unlink) {
|
||||||
temp = scnprintf(next, size, "reclaim qh %p\n", ehci->reclaim);
|
temp = scnprintf(next, size, "async unlink qh %p\n",
|
||||||
|
ehci->async_unlink);
|
||||||
size -= temp;
|
size -= temp;
|
||||||
next += temp;
|
next += temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef EHCI_STATS
|
#ifdef EHCI_STATS
|
||||||
temp = scnprintf (next, size,
|
temp = scnprintf (next, size,
|
||||||
"irq normal %ld err %ld reclaim %ld (lost %ld)\n",
|
"irq normal %ld err %ld iaa %ld (lost %ld)\n",
|
||||||
ehci->stats.normal, ehci->stats.error, ehci->stats.reclaim,
|
ehci->stats.normal, ehci->stats.error, ehci->stats.iaa,
|
||||||
ehci->stats.lost_iaa);
|
ehci->stats.lost_iaa);
|
||||||
size -= temp;
|
size -= temp;
|
||||||
next += temp;
|
next += temp;
|
||||||
|
|
|
@ -403,7 +403,7 @@ static void ehci_iaa_watchdog(unsigned long param)
|
||||||
* (a) SMP races against real IAA firing and retriggering, and
|
* (a) SMP races against real IAA firing and retriggering, and
|
||||||
* (b) clean HC shutdown, when IAA watchdog was pending.
|
* (b) clean HC shutdown, when IAA watchdog was pending.
|
||||||
*/
|
*/
|
||||||
if (ehci->reclaim
|
if (ehci->async_unlink
|
||||||
&& !timer_pending(&ehci->iaa_watchdog)
|
&& !timer_pending(&ehci->iaa_watchdog)
|
||||||
&& ehci->rh_state == EHCI_RH_RUNNING) {
|
&& ehci->rh_state == EHCI_RH_RUNNING) {
|
||||||
u32 cmd, status;
|
u32 cmd, status;
|
||||||
|
@ -583,8 +583,8 @@ static void ehci_stop (struct usb_hcd *hcd)
|
||||||
usb_amd_dev_put();
|
usb_amd_dev_put();
|
||||||
|
|
||||||
#ifdef EHCI_STATS
|
#ifdef EHCI_STATS
|
||||||
ehci_dbg (ehci, "irq normal %ld err %ld reclaim %ld (lost %ld)\n",
|
ehci_dbg(ehci, "irq normal %ld err %ld iaa %ld (lost %ld)\n",
|
||||||
ehci->stats.normal, ehci->stats.error, ehci->stats.reclaim,
|
ehci->stats.normal, ehci->stats.error, ehci->stats.iaa,
|
||||||
ehci->stats.lost_iaa);
|
ehci->stats.lost_iaa);
|
||||||
ehci_dbg (ehci, "complete %ld unlink %ld\n",
|
ehci_dbg (ehci, "complete %ld unlink %ld\n",
|
||||||
ehci->stats.complete, ehci->stats.unlink);
|
ehci->stats.complete, ehci->stats.unlink);
|
||||||
|
@ -651,7 +651,6 @@ static int ehci_init(struct usb_hcd *hcd)
|
||||||
else // N microframes cached
|
else // N microframes cached
|
||||||
ehci->i_thresh = 2 + HCC_ISOC_THRES(hcc_params);
|
ehci->i_thresh = 2 + HCC_ISOC_THRES(hcc_params);
|
||||||
|
|
||||||
ehci->reclaim = NULL;
|
|
||||||
ehci->next_uframe = -1;
|
ehci->next_uframe = -1;
|
||||||
ehci->clock_frame = -1;
|
ehci->clock_frame = -1;
|
||||||
|
|
||||||
|
@ -896,11 +895,11 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
|
||||||
/* guard against (alleged) silicon errata */
|
/* guard against (alleged) silicon errata */
|
||||||
if (cmd & CMD_IAAD)
|
if (cmd & CMD_IAAD)
|
||||||
ehci_dbg(ehci, "IAA with IAAD still set?\n");
|
ehci_dbg(ehci, "IAA with IAAD still set?\n");
|
||||||
if (ehci->reclaim) {
|
if (ehci->async_unlink) {
|
||||||
COUNT(ehci->stats.reclaim);
|
COUNT(ehci->stats.iaa);
|
||||||
end_unlink_async(ehci);
|
end_unlink_async(ehci);
|
||||||
} else
|
} else
|
||||||
ehci_dbg(ehci, "IAA with nothing to reclaim?\n");
|
ehci_dbg(ehci, "IAA with nothing unlinked?\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* remote wakeup [4.3.1] */
|
/* remote wakeup [4.3.1] */
|
||||||
|
@ -1027,7 +1026,7 @@ static int ehci_urb_enqueue (
|
||||||
static void unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
|
static void unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
|
||||||
{
|
{
|
||||||
/* failfast */
|
/* failfast */
|
||||||
if (ehci->rh_state != EHCI_RH_RUNNING && ehci->reclaim)
|
if (ehci->rh_state != EHCI_RH_RUNNING && ehci->async_unlink)
|
||||||
end_unlink_async(ehci);
|
end_unlink_async(ehci);
|
||||||
|
|
||||||
/* If the QH isn't linked then there's nothing we can do
|
/* If the QH isn't linked then there's nothing we can do
|
||||||
|
@ -1041,15 +1040,15 @@ static void unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* defer till later if busy */
|
/* defer till later if busy */
|
||||||
if (ehci->reclaim) {
|
if (ehci->async_unlink) {
|
||||||
struct ehci_qh *last;
|
struct ehci_qh *last;
|
||||||
|
|
||||||
for (last = ehci->reclaim;
|
for (last = ehci->async_unlink;
|
||||||
last->reclaim;
|
last->unlink_next;
|
||||||
last = last->reclaim)
|
last = last->unlink_next)
|
||||||
continue;
|
continue;
|
||||||
qh->qh_state = QH_STATE_UNLINK_WAIT;
|
qh->qh_state = QH_STATE_UNLINK_WAIT;
|
||||||
last->reclaim = qh;
|
last->unlink_next = qh;
|
||||||
|
|
||||||
/* start IAA cycle */
|
/* start IAA cycle */
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -301,7 +301,7 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
|
||||||
ehci_halt (ehci);
|
ehci_halt (ehci);
|
||||||
ehci->rh_state = EHCI_RH_SUSPENDED;
|
ehci->rh_state = EHCI_RH_SUSPENDED;
|
||||||
|
|
||||||
if (ehci->reclaim)
|
if (ehci->async_unlink)
|
||||||
end_unlink_async(ehci);
|
end_unlink_async(ehci);
|
||||||
|
|
||||||
/* allow remote wakeup */
|
/* allow remote wakeup */
|
||||||
|
|
|
@ -1153,11 +1153,11 @@ submit_async (
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/* the async qh for the qtds being reclaimed are now unlinked from the HC */
|
/* the async qh for the qtds being unlinked are now gone from the HC */
|
||||||
|
|
||||||
static void end_unlink_async (struct ehci_hcd *ehci)
|
static void end_unlink_async (struct ehci_hcd *ehci)
|
||||||
{
|
{
|
||||||
struct ehci_qh *qh = ehci->reclaim;
|
struct ehci_qh *qh = ehci->async_unlink;
|
||||||
struct ehci_qh *next;
|
struct ehci_qh *next;
|
||||||
|
|
||||||
iaa_watchdog_done(ehci);
|
iaa_watchdog_done(ehci);
|
||||||
|
@ -1167,9 +1167,9 @@ static void end_unlink_async (struct ehci_hcd *ehci)
|
||||||
qh->qh_next.qh = NULL;
|
qh->qh_next.qh = NULL;
|
||||||
|
|
||||||
/* other unlink(s) may be pending (in QH_STATE_UNLINK_WAIT) */
|
/* other unlink(s) may be pending (in QH_STATE_UNLINK_WAIT) */
|
||||||
next = qh->reclaim;
|
next = qh->unlink_next;
|
||||||
ehci->reclaim = next;
|
ehci->async_unlink = next;
|
||||||
qh->reclaim = NULL;
|
qh->unlink_next = NULL;
|
||||||
|
|
||||||
qh_completions (ehci, qh);
|
qh_completions (ehci, qh);
|
||||||
|
|
||||||
|
@ -1185,7 +1185,7 @@ static void end_unlink_async (struct ehci_hcd *ehci)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (next) {
|
if (next) {
|
||||||
ehci->reclaim = NULL;
|
ehci->async_unlink = NULL;
|
||||||
start_unlink_async (ehci, next);
|
start_unlink_async (ehci, next);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1203,7 +1203,7 @@ static void start_unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
assert_spin_locked(&ehci->lock);
|
assert_spin_locked(&ehci->lock);
|
||||||
if (ehci->reclaim
|
if (ehci->async_unlink
|
||||||
|| (qh->qh_state != QH_STATE_LINKED
|
|| (qh->qh_state != QH_STATE_LINKED
|
||||||
&& qh->qh_state != QH_STATE_UNLINK_WAIT)
|
&& qh->qh_state != QH_STATE_UNLINK_WAIT)
|
||||||
)
|
)
|
||||||
|
@ -1214,7 +1214,7 @@ static void start_unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
|
||||||
if (unlikely (qh == ehci->async)) {
|
if (unlikely (qh == ehci->async)) {
|
||||||
/* can't get here without STS_ASS set */
|
/* can't get here without STS_ASS set */
|
||||||
if (ehci->rh_state != EHCI_RH_HALTED
|
if (ehci->rh_state != EHCI_RH_HALTED
|
||||||
&& !ehci->reclaim) {
|
&& !ehci->async_unlink) {
|
||||||
/* ... and CMD_IAAD clear */
|
/* ... and CMD_IAAD clear */
|
||||||
ehci->command &= ~CMD_ASE;
|
ehci->command &= ~CMD_ASE;
|
||||||
ehci_writel(ehci, ehci->command, &ehci->regs->command);
|
ehci_writel(ehci, ehci->command, &ehci->regs->command);
|
||||||
|
@ -1226,7 +1226,7 @@ static void start_unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
|
||||||
}
|
}
|
||||||
|
|
||||||
qh->qh_state = QH_STATE_UNLINK;
|
qh->qh_state = QH_STATE_UNLINK;
|
||||||
ehci->reclaim = qh;
|
ehci->async_unlink = qh;
|
||||||
|
|
||||||
prev = ehci->async;
|
prev = ehci->async;
|
||||||
while (prev->qh_next.qh != qh)
|
while (prev->qh_next.qh != qh)
|
||||||
|
@ -1240,7 +1240,7 @@ static void start_unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
|
||||||
|
|
||||||
/* If the controller isn't running, we don't have to wait for it */
|
/* If the controller isn't running, we don't have to wait for it */
|
||||||
if (unlikely(ehci->rh_state != EHCI_RH_RUNNING)) {
|
if (unlikely(ehci->rh_state != EHCI_RH_RUNNING)) {
|
||||||
/* if (unlikely (qh->reclaim != 0))
|
/* if (unlikely (qh->unlink_next != 0))
|
||||||
* this will recurse, probably not much
|
* this will recurse, probably not much
|
||||||
*/
|
*/
|
||||||
end_unlink_async (ehci);
|
end_unlink_async (ehci);
|
||||||
|
@ -1295,7 +1295,7 @@ static void scan_async (struct ehci_hcd *ehci)
|
||||||
*/
|
*/
|
||||||
if (list_empty(&qh->qtd_list)
|
if (list_empty(&qh->qtd_list)
|
||||||
&& qh->qh_state == QH_STATE_LINKED) {
|
&& qh->qh_state == QH_STATE_LINKED) {
|
||||||
if (!ehci->reclaim && (stopped ||
|
if (!ehci->async_unlink && (stopped ||
|
||||||
time_after_eq(jiffies, qh->unlink_time)))
|
time_after_eq(jiffies, qh->unlink_time)))
|
||||||
start_unlink_async(ehci, qh);
|
start_unlink_async(ehci, qh);
|
||||||
else
|
else
|
||||||
|
|
|
@ -42,7 +42,7 @@ struct ehci_stats {
|
||||||
/* irq usage */
|
/* irq usage */
|
||||||
unsigned long normal;
|
unsigned long normal;
|
||||||
unsigned long error;
|
unsigned long error;
|
||||||
unsigned long reclaim;
|
unsigned long iaa;
|
||||||
unsigned long lost_iaa;
|
unsigned long lost_iaa;
|
||||||
|
|
||||||
/* termination of urbs from core */
|
/* termination of urbs from core */
|
||||||
|
@ -51,7 +51,7 @@ struct ehci_stats {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ehci_hcd->lock guards shared data against other CPUs:
|
/* ehci_hcd->lock guards shared data against other CPUs:
|
||||||
* ehci_hcd: async, reclaim, periodic (and shadow), ...
|
* ehci_hcd: async, unlink, periodic (and shadow), ...
|
||||||
* usb_host_endpoint: hcpriv
|
* usb_host_endpoint: hcpriv
|
||||||
* ehci_qh: qh_next, qtd_list
|
* ehci_qh: qh_next, qtd_list
|
||||||
* ehci_qtd: qtd_list
|
* ehci_qtd: qtd_list
|
||||||
|
@ -81,7 +81,7 @@ struct ehci_hcd { /* one per controller */
|
||||||
/* async schedule support */
|
/* async schedule support */
|
||||||
struct ehci_qh *async;
|
struct ehci_qh *async;
|
||||||
struct ehci_qh *dummy; /* For AMD quirk use */
|
struct ehci_qh *dummy; /* For AMD quirk use */
|
||||||
struct ehci_qh *reclaim;
|
struct ehci_qh *async_unlink;
|
||||||
struct ehci_qh *qh_scan_next;
|
struct ehci_qh *qh_scan_next;
|
||||||
unsigned scanning : 1;
|
unsigned scanning : 1;
|
||||||
|
|
||||||
|
@ -354,7 +354,7 @@ struct ehci_qh {
|
||||||
union ehci_shadow qh_next; /* ptr to qh; or periodic */
|
union ehci_shadow qh_next; /* ptr to qh; or periodic */
|
||||||
struct list_head qtd_list; /* sw qtd list */
|
struct list_head qtd_list; /* sw qtd list */
|
||||||
struct ehci_qtd *dummy;
|
struct ehci_qtd *dummy;
|
||||||
struct ehci_qh *reclaim; /* next to reclaim */
|
struct ehci_qh *unlink_next; /* next on unlink list */
|
||||||
|
|
||||||
unsigned long unlink_time;
|
unsigned long unlink_time;
|
||||||
unsigned stamp;
|
unsigned stamp;
|
||||||
|
@ -364,7 +364,7 @@ struct ehci_qh {
|
||||||
#define QH_STATE_LINKED 1 /* HC sees this */
|
#define QH_STATE_LINKED 1 /* HC sees this */
|
||||||
#define QH_STATE_UNLINK 2 /* HC may still see this */
|
#define QH_STATE_UNLINK 2 /* HC may still see this */
|
||||||
#define QH_STATE_IDLE 3 /* HC doesn't see this */
|
#define QH_STATE_IDLE 3 /* HC doesn't see this */
|
||||||
#define QH_STATE_UNLINK_WAIT 4 /* LINKED and on reclaim q */
|
#define QH_STATE_UNLINK_WAIT 4 /* LINKED and on unlink q */
|
||||||
#define QH_STATE_COMPLETING 5 /* don't touch token.HALT */
|
#define QH_STATE_COMPLETING 5 /* don't touch token.HALT */
|
||||||
|
|
||||||
u8 xacterrs; /* XactErr retry counter */
|
u8 xacterrs; /* XactErr retry counter */
|
||||||
|
|
Loading…
Reference in New Issue