]> Pileus Git - ~andy/linux/blobdiff - drivers/usb/host/ohci-s3c2410.c
Merge branch 'for-3.1' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/asoc...
[~andy/linux] / drivers / usb / host / ohci-s3c2410.c
index 16ec7da9237c22a5edeeeb013f70e87e9b0f0966..7c9a4d55526b3b115bed4b84e6876e1c90c0befb 100644 (file)
@@ -56,9 +56,8 @@ static void s3c2410_start_hc(struct platform_device *dev, struct usb_hcd *hcd)
                info->hcd       = hcd;
                info->report_oc = s3c2410_hcd_oc;
 
-               if (info->enable_oc != NULL) {
+               if (info->enable_oc != NULL)
                        (info->enable_oc)(info, 1);
-               }
        }
 }
 
@@ -72,9 +71,8 @@ static void s3c2410_stop_hc(struct platform_device *dev)
                info->report_oc = NULL;
                info->hcd       = NULL;
 
-               if (info->enable_oc != NULL) {
+               if (info->enable_oc != NULL)
                        (info->enable_oc)(info, 0);
-               }
        }
 
        clk_disable(clk);
@@ -88,14 +86,14 @@ static void s3c2410_stop_hc(struct platform_device *dev)
 */
 
 static int
-ohci_s3c2410_hub_status_data (struct usb_hcd *hcd, char *buf)
+ohci_s3c2410_hub_status_data(struct usb_hcd *hcd, char *buf)
 {
        struct s3c2410_hcd_info *info = to_s3c2410_info(hcd);
        struct s3c2410_hcd_port *port;
        int orig;
        int portno;
 
-       orig  = ohci_hub_status_data (hcd, buf);
+       orig  = ohci_hub_status_data(hcd, buf);
 
        if (info == NULL)
                return orig;
@@ -145,7 +143,7 @@ static void s3c2410_usb_set_power(struct s3c2410_hcd_info *info,
  * request.
 */
 
-static int ohci_s3c2410_hub_control (
+static int ohci_s3c2410_hub_control(
        struct usb_hcd  *hcd,
        u16             typeReq,
        u16             wValue,
@@ -199,9 +197,8 @@ static int ohci_s3c2410_hub_control (
                        dev_dbg(hcd->self.controller,
                                "ClearPortFeature: OVER_CURRENT\n");
 
-                       if (valid_port(wIndex)) {
+                       if (valid_port(wIndex))
                                info->port[wIndex-1].oc_status = 0;
-                       }
 
                        goto out;
 
@@ -242,8 +239,11 @@ static int ohci_s3c2410_hub_control (
                desc->wHubCharacteristics |= cpu_to_le16(0x0001);
 
                if (info->enable_oc) {
-                       desc->wHubCharacteristics &= ~cpu_to_le16(HUB_CHAR_OCPM);
-                       desc->wHubCharacteristics |=  cpu_to_le16(0x0008|0x0001);
+                       desc->wHubCharacteristics &= ~cpu_to_le16(
+                               HUB_CHAR_OCPM);
+                       desc->wHubCharacteristics |=  cpu_to_le16(
+                               0x0008 |
+                               0x0001);
                }
 
                dev_dbg(hcd->self.controller, "wHubCharacteristics after 0x%04x\n",
@@ -257,13 +257,11 @@ static int ohci_s3c2410_hub_control (
                dev_dbg(hcd->self.controller, "GetPortStatus(%d)\n", wIndex);
 
                if (valid_port(wIndex)) {
-                       if (info->port[wIndex-1].oc_changed) {
+                       if (info->port[wIndex-1].oc_changed)
                                *data |= cpu_to_le32(RH_PS_OCIC);
-                       }
 
-                       if (info->port[wIndex-1].oc_status) {
+                       if (info->port[wIndex-1].oc_status)
                                *data |= cpu_to_le32(RH_PS_POCI);
-                       }
                }
        }
 
@@ -321,7 +319,7 @@ static void s3c2410_hcd_oc(struct s3c2410_hcd_info *info, int port_oc)
 */
 
 static void
-usb_hcd_s3c2410_remove (struct usb_hcd *hcd, struct platform_device *dev)
+usb_hcd_s3c2410_remove(struct usb_hcd *hcd, struct platform_device *dev)
 {
        usb_remove_hcd(hcd);
        s3c2410_stop_hc(dev);
@@ -339,7 +337,7 @@ usb_hcd_s3c2410_remove (struct usb_hcd *hcd, struct platform_device *dev)
  * through the hotplug entry's driver_data.
  *
  */
-static int usb_hcd_s3c2410_probe (const struct hc_driver *driver,
+static int usb_hcd_s3c2410_probe(const struct hc_driver *driver,
                                  struct platform_device *dev)
 {
        struct usb_hcd *hcd = NULL;
@@ -353,7 +351,7 @@ static int usb_hcd_s3c2410_probe (const struct hc_driver *driver,
                return -ENOMEM;
 
        hcd->rsrc_start = dev->resource[0].start;
-       hcd->rsrc_len   = dev->resource[0].end - dev->resource[0].start + 1;
+       hcd->rsrc_len   = resource_size(&dev->resource[0]);
 
        if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
                dev_err(&dev->dev, "request_mem_region failed\n");
@@ -364,14 +362,14 @@ static int usb_hcd_s3c2410_probe (const struct hc_driver *driver,
        clk = clk_get(&dev->dev, "usb-host");
        if (IS_ERR(clk)) {
                dev_err(&dev->dev, "cannot get usb-host clock\n");
-               retval = -ENOENT;
+               retval = PTR_ERR(clk);
                goto err_mem;
        }
 
        usb_clk = clk_get(&dev->dev, "usb-bus-host");
        if (IS_ERR(usb_clk)) {
                dev_err(&dev->dev, "cannot get usb-bus-host clock\n");
-               retval = -ENOENT;
+               retval = PTR_ERR(usb_clk);
                goto err_clk;
        }
 
@@ -411,17 +409,19 @@ static int usb_hcd_s3c2410_probe (const struct hc_driver *driver,
 /*-------------------------------------------------------------------------*/
 
 static int
-ohci_s3c2410_start (struct usb_hcd *hcd)
+ohci_s3c2410_start(struct usb_hcd *hcd)
 {
-       struct ohci_hcd *ohci = hcd_to_ohci (hcd);
+       struct ohci_hcd *ohci = hcd_to_ohci(hcd);
        int ret;
 
-       if ((ret = ohci_init(ohci)) < 0)
+       ret = ohci_init(ohci);
+       if (ret < 0)
                return ret;
 
-       if ((ret = ohci_run (ohci)) < 0) {
-               err ("can't start %s", hcd->self.bus_name);
-               ohci_stop (hcd);
+       ret = ohci_run(ohci);
+       if (ret < 0) {
+               err("can't start %s", hcd->self.bus_name);
+               ohci_stop(hcd);
                return ret;
        }