mxcmmc: decrease minimum frequency to make MMC cards work
[safe/jmp/linux-2.6] / drivers / block / ub.c
index 048d71d..689cd27 100644 (file)
@@ -391,7 +391,7 @@ static int ub_probe_lun(struct ub_dev *sc, int lnum);
  */
 #ifdef CONFIG_USB_LIBUSUAL
 
-#define ub_usb_ids  storage_usb_ids
+#define ub_usb_ids  usb_storage_usb_ids
 #else
 
 static struct usb_device_id ub_usb_ids[] = {
@@ -1025,6 +1025,7 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
 {
        struct urb *urb = &sc->work_urb;
        struct bulk_cs_wrap *bcs;
+       int endp;
        int len;
        int rc;
 
@@ -1033,6 +1034,10 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
                return;
        }
 
+       endp = usb_pipeendpoint(sc->last_pipe);
+       if (usb_pipein(sc->last_pipe))
+               endp |= USB_DIR_IN;
+
        if (cmd->state == UB_CMDST_CLEAR) {
                if (urb->status == -EPIPE) {
                        /*
@@ -1048,9 +1053,7 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
                 * We ignore the result for the halt clear.
                 */
 
-               /* reset the endpoint toggle */
-               usb_settoggle(sc->dev, usb_pipeendpoint(sc->last_pipe),
-                       usb_pipeout(sc->last_pipe), 0);
+               usb_reset_endpoint(sc->dev, endp);
 
                ub_state_sense(sc, cmd);
 
@@ -1065,9 +1068,7 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
                 * We ignore the result for the halt clear.
                 */
 
-               /* reset the endpoint toggle */
-               usb_settoggle(sc->dev, usb_pipeendpoint(sc->last_pipe),
-                       usb_pipeout(sc->last_pipe), 0);
+               usb_reset_endpoint(sc->dev, endp);
 
                ub_state_stat(sc, cmd);
 
@@ -1082,9 +1083,7 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
                 * We ignore the result for the halt clear.
                 */
 
-               /* reset the endpoint toggle */
-               usb_settoggle(sc->dev, usb_pipeendpoint(sc->last_pipe),
-                       usb_pipeout(sc->last_pipe), 0);
+               usb_reset_endpoint(sc->dev, endp);
 
                ub_state_stat_counted(sc, cmd);
 
@@ -1579,7 +1578,7 @@ static void ub_reset_task(struct work_struct *work)
        struct ub_dev *sc = container_of(work, struct ub_dev, reset_work);
        unsigned long flags;
        struct ub_lun *lun;
-       int lkr, rc;
+       int rc;
 
        if (!sc->reset) {
                printk(KERN_WARNING "%s: Running reset unrequested\n",
@@ -1597,10 +1596,11 @@ static void ub_reset_task(struct work_struct *work)
        } else if (sc->dev->actconfig->desc.bNumInterfaces != 1) {
                ;
        } else {
-               if ((lkr = usb_lock_device_for_reset(sc->dev, sc->intf)) < 0) {
+               rc = usb_lock_device_for_reset(sc->dev, sc->intf);
+               if (rc < 0) {
                        printk(KERN_NOTICE
                            "%s: usb_lock_device_for_reset failed (%d)\n",
-                           sc->name, lkr);
+                           sc->name, rc);
                } else {
                        rc = usb_reset_device(sc->dev);
                        if (rc < 0) {
@@ -1608,9 +1608,7 @@ static void ub_reset_task(struct work_struct *work)
                                    "usb_lock_device_for_reset failed (%d)\n",
                                    sc->name, rc);
                        }
-
-                       if (lkr)
-                               usb_unlock_device(sc->dev);
+                       usb_unlock_device(sc->dev);
                }
        }
 
@@ -2120,8 +2118,7 @@ static int ub_probe_clear_stall(struct ub_dev *sc, int stalled_pipe)
        del_timer_sync(&timer);
        usb_kill_urb(&sc->work_urb);
 
-       /* reset the endpoint toggle */
-       usb_settoggle(sc->dev, endp, usb_pipeout(sc->last_pipe), 0);
+       usb_reset_endpoint(sc->dev, endp);
 
        return 0;
 }
@@ -2147,10 +2144,9 @@ static int ub_get_pipes(struct ub_dev *sc, struct usb_device *dev,
                ep = &altsetting->endpoint[i].desc;
 
                /* Is it a BULK endpoint? */
-               if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
-                               == USB_ENDPOINT_XFER_BULK) {
+               if (usb_endpoint_xfer_bulk(ep)) {
                        /* BULK in or out? */
-                       if (ep->bEndpointAddress & USB_DIR_IN) {
+                       if (usb_endpoint_dir_in(ep)) {
                                if (ep_in == NULL)
                                        ep_in = ep;
                        } else {
@@ -2169,9 +2165,9 @@ static int ub_get_pipes(struct ub_dev *sc, struct usb_device *dev,
        sc->send_ctrl_pipe = usb_sndctrlpipe(dev, 0);
        sc->recv_ctrl_pipe = usb_rcvctrlpipe(dev, 0);
        sc->send_bulk_pipe = usb_sndbulkpipe(dev,
-               ep_out->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
+               usb_endpoint_num(ep_out));
        sc->recv_bulk_pipe = usb_rcvbulkpipe(dev, 
-               ep_in->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
+               usb_endpoint_num(ep_in));
 
        return 0;
 }