Commit 448c86dd authored by Johannes Erdfelt's avatar Johannes Erdfelt Committed by Greg Kroah-Hartman

[PATCH] 2.4.19-pre8 uhci.c incorrect bit operations

This fixes up a couple of problems I came across while working on
uhci-hcd. There are a couple of places where shifts are used where they
shouldn't be and others where should be.

This cleans up a couple of cases and tidys it up.

The patch is relative to 2.4.19-pre8 and my other patches, but it's
alright to wait for 2.4.20. It should also be applied to 2.5.
parent 7ed10dbc
......@@ -121,7 +121,7 @@ static inline void uhci_set_next_interrupt(struct uhci *uhci)
unsigned long flags;
spin_lock_irqsave(&uhci->frame_list_lock, flags);
uhci->skel_term_td->status |= TD_CTRL_IOC_BIT;
uhci->skel_term_td->status |= TD_CTRL_IOC;
spin_unlock_irqrestore(&uhci->frame_list_lock, flags);
}
......@@ -130,7 +130,7 @@ static inline void uhci_clear_next_interrupt(struct uhci *uhci)
unsigned long flags;
spin_lock_irqsave(&uhci->frame_list_lock, flags);
uhci->skel_term_td->status &= ~TD_CTRL_IOC_BIT;
uhci->skel_term_td->status &= ~TD_CTRL_IOC;
spin_unlock_irqrestore(&uhci->frame_list_lock, flags);
}
......@@ -860,7 +860,7 @@ static int uhci_submit_control(struct urb *urb)
return -ENOMEM;
/* Alternate Data0/1 (start with Data1) */
destination ^= 1 << TD_TOKEN_TOGGLE;
destination ^= TD_TOKEN_TOGGLE;
uhci_add_td_to_urb(urb, td);
uhci_fill_td(td, status, destination | ((pktsze - 1) << 21),
......@@ -887,7 +887,7 @@ static int uhci_submit_control(struct urb *urb)
else
destination |= USB_PID_OUT;
destination |= 1 << TD_TOKEN_TOGGLE; /* End in Data1 */
destination |= TD_TOKEN_TOGGLE; /* End in Data1 */
status &= ~TD_CTRL_SPD;
......@@ -1094,7 +1094,7 @@ static int uhci_submit_interrupt(struct urb *urb)
if (!td)
return -ENOMEM;
destination |= (usb_gettoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe)) << TD_TOKEN_TOGGLE);
destination |= (usb_gettoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe)) << TD_TOKEN_TOGGLE_SHIFT);
destination |= ((urb->transfer_buffer_length - 1) << 21);
usb_dotoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe));
......@@ -1187,8 +1187,8 @@ static void uhci_reset_interrupt(struct urb *urb)
td = list_entry(urbp->td_list.next, struct uhci_td, list);
td->status = (td->status & 0x2F000000) | TD_CTRL_ACTIVE | TD_CTRL_IOC;
td->info &= ~(1 << TD_TOKEN_TOGGLE);
td->info |= (usb_gettoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe)) << TD_TOKEN_TOGGLE);
td->info &= ~TD_TOKEN_TOGGLE;
td->info |= (usb_gettoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe)) << TD_TOKEN_TOGGLE_SHIFT);
usb_dotoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe));
out:
......@@ -1244,7 +1244,7 @@ static int uhci_submit_bulk(struct urb *urb, struct urb *eurb)
uhci_fill_td(td, status, destination |
(((pktsze - 1) & UHCI_NULL_DATA_SIZE) << 21) |
(usb_gettoggle(urb->dev, usb_pipeendpoint(urb->pipe),
usb_pipeout(urb->pipe)) << TD_TOKEN_TOGGLE),
usb_pipeout(urb->pipe)) << TD_TOKEN_TOGGLE_SHIFT),
data);
data += pktsze;
......@@ -1272,7 +1272,7 @@ static int uhci_submit_bulk(struct urb *urb, struct urb *eurb)
uhci_fill_td(td, status, destination |
(UHCI_NULL_DATA_SIZE << 21) |
(usb_gettoggle(urb->dev, usb_pipeendpoint(urb->pipe),
usb_pipeout(urb->pipe)) << TD_TOKEN_TOGGLE),
usb_pipeout(urb->pipe)) << TD_TOKEN_TOGGLE_SHIFT),
data);
usb_dotoggle(urb->dev, usb_pipeendpoint(urb->pipe),
......
......@@ -100,7 +100,6 @@ struct uhci_qh {
#define TD_CTRL_C_ERR_SHIFT 27
#define TD_CTRL_LS (1 << 26) /* Low Speed Device */
#define TD_CTRL_IOS (1 << 25) /* Isochronous Select */
#define TD_CTRL_IOC_BIT 24
#define TD_CTRL_IOC (1 << 24) /* Interrupt on Complete */
#define TD_CTRL_ACTIVE (1 << 23) /* TD Active */
#define TD_CTRL_STALLED (1 << 22) /* TD Stalled */
......@@ -120,7 +119,8 @@ struct uhci_qh {
/*
* for TD <info>: (a.k.a. Token)
*/
#define TD_TOKEN_TOGGLE 19
#define TD_TOKEN_TOGGLE_SHIFT 19
#define TD_TOKEN_TOGGLE (1 << 19)
#define TD_TOKEN_PID_MASK 0xFF
#define TD_TOKEN_EXPLEN_MASK 0x7FF /* expected length, encoded as n - 1 */
......
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