]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/usb/storage/usb.c
[PATCH] Add include/linux/freezer.h and move definitions from sched.h
[net-next-2.6.git] / drivers / usb / storage / usb.c
index 5ee19be52f6510bd2efea0ca6ac81d0f70082b38..70644506651f2bf58042ea9f1c5707145c3cb5c9 100644 (file)
@@ -49,7 +49,7 @@
 
 #include <linux/sched.h>
 #include <linux/errno.h>
-#include <linux/suspend.h>
+#include <linux/freezer.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
@@ -98,6 +98,9 @@
 #ifdef CONFIG_USB_STORAGE_ALAUDA
 #include "alauda.h"
 #endif
+#ifdef CONFIG_USB_STORAGE_KARMA
+#include "karma.h"
+#endif
 
 /* Some informational data */
 MODULE_AUTHOR("Matthew Dharm <mdharm-usb@one-eyed-alien.net>");
@@ -483,7 +486,7 @@ static struct us_unusual_dev *find_unusual(const struct usb_device_id *id)
 }
 
 /* Get the unusual_devs entries and the string descriptors */
-static void get_device_info(struct us_data *us, const struct usb_device_id *id)
+static int get_device_info(struct us_data *us, const struct usb_device_id *id)
 {
        struct usb_device *dev = us->pusb_dev;
        struct usb_interface_descriptor *idesc =
@@ -500,6 +503,11 @@ static void get_device_info(struct us_data *us, const struct usb_device_id *id)
                        unusual_dev->useTransport;
        us->flags = USB_US_ORIG_FLAGS(id->driver_info);
 
+       if (us->flags & US_FL_IGNORE_DEVICE) {
+               printk(KERN_INFO USB_STORAGE "device ignored\n");
+               return -ENODEV;
+       }
+
        /*
         * This flag is only needed when we're in high-speed, so let's
         * disable it if we're in full-speed
@@ -541,6 +549,8 @@ static void get_device_info(struct us_data *us, const struct usb_device_id *id)
                                msgs[msg],
                                UTS_RELEASE);
        }
+
+       return 0;
 }
 
 /* Get the transport settings */
@@ -639,6 +649,14 @@ static int get_transport(struct us_data *us)
                break;
 #endif
 
+#ifdef CONFIG_USB_STORAGE_KARMA
+       case US_PR_KARMA:
+               us->transport_name = "Rio Karma/Bulk";
+               us->transport = rio_karma_transport;
+               us->transport_reset = usb_stor_Bulk_reset;
+               break;
+#endif
+
        default:
                return -EIO;
        }
@@ -722,18 +740,16 @@ static int get_pipes(struct us_data *us)
                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))
                                ep_in = ep;
                        else
                                ep_out = ep;
                }
 
                /* Is it an interrupt endpoint? */
-               else if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
-                               == USB_ENDPOINT_XFER_INT) {
+               else if (usb_endpoint_xfer_int(ep)) {
                        ep_int = ep;
                }
        }
@@ -969,7 +985,9 @@ static int storage_probe(struct usb_interface *intf,
         * of the match from the usb_device_id table, so we can find the
         * corresponding entry in the private table.
         */
-       get_device_info(us, id);
+       result = get_device_info(us, id);
+       if (result)
+               goto BadDevice;
 
        /* Get the transport, protocol, and pipe settings */
        result = get_transport(us);