usb: dwc_otg: Remove build warnings 87/159587/2
authorWook Song <wook16.song@samsung.com>
Fri, 10 Nov 2017 02:22:55 +0000 (11:22 +0900)
committerWook Song <wook16.song@samsung.com>
Fri, 10 Nov 2017 04:07:58 +0000 (13:07 +0900)
This patch removes build warnings caused by type conversions without
cast, unused variables/functions, wrong printk format strings, 'return'
with a value in function returning void, and ignorance of return value
of several functions.

Change-Id: Icbb1b40984f6ad3f78a3a921320fdf7660e4f7d2
Signed-off-by: Wook Song <wook16.song@samsung.com>
drivers/usb/gadget/dwc_otg/dwc_otg_attr.c
drivers/usb/gadget/dwc_otg/dwc_otg_driver.c
drivers/usb/gadget/dwc_otg/dwc_otg_hcd_linux.c
drivers/usb/gadget/dwc_otg/dwc_otg_pcd_linux.c
drivers/usb/gadget/dwc_otg/usb_hw.c

index 3b552ffa1a4bd5bf36d85ed7cc9fed70a7bf76b6..7582a9b1a406d1e5755cfbea5f044e7cb2064ac3 100644 (file)
@@ -987,7 +987,7 @@ static ssize_t hostenable_store(struct device *_dev,
                DWC_PRINTF("gpio_otgdet = %d irq = %d enabled\n",
                pdata->gpio_otgdet, otg_cable_irq);
        } else {
-               DWC_PRINTF("gpio_otgdet = %d irq = %d case3!!!!!!!!!!!!!!\n",
+               DWC_PRINTF("gpio_otgdet = %d irq = %d buf = %s case3!!!!!!!!!!!!!!\n",
                        pdata->gpio_otgdet, otg_cable_irq, buf);
                return 0;
        }
@@ -1002,7 +1002,6 @@ static ssize_t otgstatus_show(struct device *_dev,
                                struct device_attribute *attr, char *buf)
 {
        struct platform_device *dev = to_platform_device(_dev);
-       dwc_otg_device_t *otg_dev = platform_get_drvdata(dev);
        struct sprd_usb_platform_data *pdata = dev->dev.platform_data;
        int otg_status;
 
@@ -1031,7 +1030,6 @@ static ssize_t hostvbus_store(struct device *_dev,
        struct platform_device *dev = to_platform_device(_dev);
        dwc_otg_device_t *otg_dev = platform_get_drvdata(dev);
        struct sprd_usb_platform_data *pdata = dev->dev.platform_data;
-       int otg_cable_irq;
 
 
        if (strncmp(buf, "off", 3) == 0) {
index e11a449eb464f708851d56011ae946927ec91bac..0e106794ec2d13e30fb02d5ba8cb93ba105572b3 100644 (file)
@@ -656,12 +656,13 @@ static int dwc_otg_driver_remove(
        return 0;
 }
 #ifdef CONFIG_PM
-static int dwc_otg_suspend(struct platform_device *dev, pm_message_t state)
+static __maybe_unused int dwc_otg_suspend(struct platform_device *dev,
+               pm_message_t state)
 {
        pr_info("%s\n", __func__);
        return 0;
 }
-static int dwc_otg_resume(struct platform_device *dev)
+static __maybe_unused int dwc_otg_resume(struct platform_device *dev)
 {
        pr_info("%s\n", __func__);
        return 0;
@@ -701,7 +702,7 @@ static int dwc_otg_driver_probe(
        ret = of_address_to_resource(np, 0, &res);
        if(ret < 0){
                dev_err(&_dev->dev, "no reg of property specified\n");
-               return NULL;
+               return ret;
        }
 #endif
        usb_phy_init(_dev);
@@ -723,7 +724,7 @@ static int dwc_otg_driver_probe(
         * Map the DWC_otg Core memory into virtual address space.
         */
 #ifdef CONFIG_OF
-       dwc_otg_device->os_dep.base = (unsigned long)ioremap_nocache(res.start,
+       dwc_otg_device->os_dep.base = (void *)ioremap_nocache(res.start,
                        resource_size(&res));
 #if defined(CONFIG_ARCH_SCX20)
        USB_GUSBCFG_REG = dwc_otg_device->os_dep.base + GUSBCFG_OFFSET;
index 68624c0b4f3a93e5610a312218fef7190c1cbfcf..7f99182ff9ffad68d6b72411b6da2541def023f4 100644 (file)
@@ -400,10 +400,13 @@ static int start_otg_flag = 0;
 void usb_otg_cable_detect_work(void *p)
 {
        dwc_otg_device_t *otg_dev = p;
-        struct sprd_usb_platform_data *platform_data =&otg_dev->platform_data;
+       /*
+        * struct sprd_usb_platform_data *platform_data
+        * = &otg_dev->platform_data;
+        */
        int value = 0;
        int vbus_irq;
-       
+
        vbus_irq = usb_get_vbus_irq();
        value = usb_get_id_state();
        if (value){
@@ -453,6 +456,8 @@ void usb_otg_cable_detect_event(bool is_otg_cable_in)
 
 }
 
+#ifndef CONFIG_USB_EXTERNAL_DETECT
+#ifndef CONFIG_MFD_SM5504
 static irqreturn_t usb_otg_cable_detect_handler(int irq, void *dev)
 {
        dwc_otg_device_t *otg_dev = dev;
@@ -482,14 +487,14 @@ static irqreturn_t usb_otg_cable_detect_handler(int irq, void *dev)
 
        return IRQ_HANDLED;
 }
+#endif /* CONFIG_MFD_SM5504 */
+#endif /* CONFIG_USB_EXTERNAL_DETECT */
 
 #ifdef CONFIG_USB_EXTERNAL_DETECT
 int dwc_otg_start(void *data, bool enable)
 {
        struct usb_hcd *hcd = NULL;
        dwc_otg_device_t *otg_dev = (dwc_otg_device_t *)data;
-       struct sprd_usb_platform_data *platform_data
-                               = &otg_dev->platform_data;
 
        pr_info("%s enable=%d+\n", __func__, enable);
 
@@ -514,7 +519,9 @@ int dwc_otg_start(void *data, bool enable)
        return 0;
 }
 #endif
+#ifdef CONFIG_ARM64
 static struct device *device_hcd_dwc_otg;
+#endif /* CONFIG_ARM64 */
 static u64 dwc_otg_dmamask = DMA_BIT_MASK(32);
 /**
  * Initializes the HCD. This function allocates memory for and initializes the
@@ -529,10 +536,14 @@ int hcd_init(
        struct usb_hcd *hcd = NULL;
        dwc_otg_hcd_t *dwc_otg_hcd = NULL;
        dwc_otg_device_t *otg_dev = platform_get_drvdata(_dev);
-       struct sprd_usb_platform_data *pdata= _dev->dev.platform_data;
        int irq;
+#ifndef CONFIG_USB_EXTERNAL_DETECT
+#ifndef CONFIG_MFD_SM5504
+       struct sprd_usb_platform_data *pdata= _dev->dev.platform_data;
        int otg_cable_irq;
        int otg_cable_connected;
+#endif /* CONFIG_MFD_SM5504 */
+#endif /* CONFIG_USB_EXTERNAL_DETECT */
        int retval = 0;
 
        DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD INIT\n");
index f8444ba8d51818fea1c9f739a98393f84dc2a2bc..b3af5cdac1d018cf1e71fcd6ceb94898a32be9f6 100755 (executable)
@@ -1056,7 +1056,9 @@ static struct gadget_wrapper *alloc_wrapper(
        static char pcd_name[] = "dwc_otg";
        dwc_otg_device_t *otg_dev = platform_get_drvdata(_dev);
        struct gadget_wrapper *d;
+#if 0
        int retval;
+#endif
 
        d = dwc_alloc(sizeof(*d));
        if (d == NULL) {
index 3113d54d7cdf2da652c54bec9c00599a8652fb2b..6a7959b32fced907413f17292959e4232672f417 100644 (file)
@@ -67,13 +67,14 @@ __setup("usb_phy_tune=", usb_phy_tune_get);
 
 static void usb_ldo_switch(int is_on)
 {
+       int ret;
 
        if(!IS_ERR_OR_NULL(usb_regulator)){
-               if(is_on){
+               if(is_on) {
                        regulator_set_voltage(usb_regulator,3300000,3300000);
-                       regulator_enable(usb_regulator);
-               }else{
-                       regulator_disable(usb_regulator);
+                       ret = regulator_enable(usb_regulator);
+               } else {
+                       ret = regulator_disable(usb_regulator);
                }
        }
 }
@@ -137,7 +138,7 @@ void usb_phy_init(struct platform_device *_dev)
        if (of_property_read_u32(np, "tune_value", &tune_from_uboot))
        {
                pr_info("read tune_value error\n");
-               return -ENODEV;
+               return;
        }
        pr_info("Usb_hw.c: [%s]usb phy tune from uboot: 0x%x\n", __FUNCTION__, tune_from_uboot);
 #endif
@@ -150,7 +151,8 @@ __raw_writel(0x44073e33,REG_AP_AHB_OTG_PHY_TUNE);
 #elif defined(CONFIG_ARCH_SCX20)
        __raw_writel(tune_from_uboot,REG_AP_APB_USB_CTRL0);
 #else
-        __raw_writel(tune_from_uboot,REG_AP_APB_USB_PHY_TUNE);
+        __raw_writel(tune_from_uboot,
+               (void __iomem __force *)REG_AP_APB_USB_PHY_TUNE);
 #endif
 #endif
 
@@ -213,8 +215,9 @@ void usb_phy_tune_host(void)
        __raw_writel(tune_host, REG_AP_APB_USB_CTRL0);
        phy_tune = __raw_readl(REG_AP_APB_USB_CTRL0);
 #else
-       __raw_writel(tune_host, REG_AP_APB_USB_PHY_TUNE);
-       phy_tune = __raw_readl(REG_AP_APB_USB_PHY_TUNE);
+       __raw_writel(tune_host,
+               (void __iomem __force *)REG_AP_APB_USB_PHY_TUNE);
+       phy_tune = __raw_readl((void __iomem __force *)REG_AP_APB_USB_PHY_TUNE);
 #endif
 #endif
        pr_info("Usb_hw.c: [%s] set tune_host=0x%x\n", __func__, phy_tune);
@@ -237,8 +240,9 @@ void usb_phy_tune_dev(void)
        __raw_writel(tune_from_uboot, REG_AP_APB_USB_CTRL0);
        phy_tune = __raw_readl(REG_AP_APB_USB_CTRL0);
 #else
-       __raw_writel(tune_from_uboot, REG_AP_APB_USB_PHY_TUNE);
-       phy_tune = __raw_readl(REG_AP_APB_USB_PHY_TUNE);
+       __raw_writel(tune_from_uboot,
+               (void __iomem __force *)REG_AP_APB_USB_PHY_TUNE);
+       phy_tune = __raw_readl((void __iomem __force *)REG_AP_APB_USB_PHY_TUNE);
 #endif
 #endif
        pr_info("Usb_hw.c: [%s] set tune_from_uboot=0x%x\n", __func__, phy_tune);
@@ -381,6 +385,7 @@ void usb_set_vbus_irq_type(int irq, int irq_type)
 void charge_pump_set(int gpio, int state)
 {
        struct regulator *usb_regulator = NULL;
+       int ret;
 #define  USB_CHG_PUMP_NAME     "chg_pump"
 
        if( GPIO_INVALID != gpio) {
@@ -392,9 +397,9 @@ void charge_pump_set(int gpio, int state)
                        usb_regulator = regulator_get(NULL, USB_CHG_PUMP_NAME);
                if (usb_regulator) {
                        if (state)
-                               regulator_enable(usb_regulator);
+                               ret = regulator_enable(usb_regulator);
                        else
-                               regulator_disable(usb_regulator);
+                               ret = regulator_disable(usb_regulator);
                        regulator_put(usb_regulator);
                }
        }