[PATCH -next] [POWERPC] Rename get_property to of_get_property: use DEFINE_SPINLOCK() for spinlock

2021-04-09 Thread Ye Bin
spinlock can be initialized automatically with DEFINE_SPINLOCK()
rather than explicitly calling spin_lock_init().

Reported-by: Hulk Robot 
Signed-off-by: Ye Bin 
---
 drivers/macintosh/via-pmu-led.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/macintosh/via-pmu-led.c b/drivers/macintosh/via-pmu-led.c
index ae067ab2373d..2502119cff42 100644
--- a/drivers/macintosh/via-pmu-led.c
+++ b/drivers/macintosh/via-pmu-led.c
@@ -27,7 +27,7 @@
 #include 
 #include 
 
-static spinlock_t pmu_blink_lock;
+static DEFINE_SPINLOCK(pmu_blink_lock);
 static struct adb_request pmu_blink_req;
 /* -1: no change, 0: request off, 1: request on */
 static int requested_change;
@@ -105,8 +105,6 @@ static int __init via_pmu_led_init(void)
return -ENODEV;
}
of_node_put(dt);
-
-   spin_lock_init(_blink_lock);
/* no outstanding req */
pmu_blink_req.complete = 1;
pmu_blink_req.done = pmu_req_done;



[PATCH -next] soc: fsl: qe: use DEFINE_SPINLOCK() for spinlock

2021-04-09 Thread Ye Bin
spinlock can be initialized automatically with DEFINE_SPINLOCK()
rather than explicitly calling spin_lock_init().

Reported-by: Hulk Robot 
Signed-off-by: Ye Bin 
---
 drivers/soc/fsl/qe/qe_common.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/soc/fsl/qe/qe_common.c b/drivers/soc/fsl/qe/qe_common.c
index 654e9246ce6b..a0cb8e746879 100644
--- a/drivers/soc/fsl/qe/qe_common.c
+++ b/drivers/soc/fsl/qe/qe_common.c
@@ -26,7 +26,7 @@
 #include 
 
 static struct gen_pool *muram_pool;
-static spinlock_t cpm_muram_lock;
+static DEFINE_SPINLOCK(cpm_muram_lock);
 static void __iomem *muram_vbase;
 static phys_addr_t muram_pbase;
 
@@ -54,7 +54,6 @@ int cpm_muram_init(void)
if (muram_pbase)
return 0;
 
-   spin_lock_init(_muram_lock);
np = of_find_compatible_node(NULL, NULL, "fsl,cpm-muram-data");
if (!np) {
/* try legacy bindings */



[PATCH -next] macintosh/via-pmu: Use DEFINE_SPINLOCK() for spinlock

2021-04-09 Thread Ye Bin
spinlock can be initialized automatically with DEFINE_SPINLOCK()
rather than explicitly calling spin_lock_init().

Reported-by: Hulk Robot 
Signed-off-by: Ye Bin 
---
 drivers/macintosh/via-pmu.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index 73e6ae88fafd..bab913e3541a 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -161,7 +161,7 @@ static unsigned char __iomem *gpio_reg;
 static int gpio_irq = 0;
 static int gpio_irq_enabled = -1;
 static volatile int pmu_suspended;
-static spinlock_t pmu_lock;
+static DEFINE_SPINLOCK(pmu_lock);
 static u8 pmu_intr_mask;
 static int pmu_version;
 static int drop_interrupts;
@@ -306,8 +306,6 @@ int __init find_via_pmu(void)
goto fail;
}
 
-   spin_lock_init(_lock);
-
pmu_has_adb = 1;
 
pmu_intr_mask = PMU_INT_PCEJECT |
@@ -389,8 +387,6 @@ int __init find_via_pmu(void)
 
pmu_kind = PMU_UNKNOWN;
 
-   spin_lock_init(_lock);
-
pmu_has_adb = 1;
 
pmu_intr_mask = PMU_INT_PCEJECT |



[PATCH v2] usb: gadget: fsl: Fix unsigned expression compared with zero in fsl_udc_probe

2020-08-24 Thread Ye Bin
udc_controller->irq is "unsigned int" always >= 0, but platform_get_irq may
return little than zero. So "dc_controller->irq < 0" condition is never
accessible.

Signed-off-by: Ye Bin 
---
 drivers/usb/gadget/udc/fsl_udc_core.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c 
b/drivers/usb/gadget/udc/fsl_udc_core.c
index a6f7b2594c09..3e98740b8cfc 100644
--- a/drivers/usb/gadget/udc/fsl_udc_core.c
+++ b/drivers/usb/gadget/udc/fsl_udc_core.c
@@ -2439,11 +2439,12 @@ static int fsl_udc_probe(struct platform_device *pdev)
/* DEN is bidirectional ep number, max_ep doubles the number */
udc_controller->max_ep = (dccparams & DCCPARAMS_DEN_MASK) * 2;
 
-   udc_controller->irq = platform_get_irq(pdev, 0);
-   if (udc_controller->irq <= 0) {
-   ret = udc_controller->irq ? : -ENODEV;
+   ret = platform_get_irq(pdev, 0);
+   if (ret <= 0) {
+   ret = ret ? : -ENODEV;
goto err_iounmap;
}
+   udc_controller->irq = ret;
 
ret = request_irq(udc_controller->irq, fsl_udc_irq, IRQF_SHARED,
driver_name, udc_controller);
-- 
2.25.4



[PATCH] usb: gadget: fsl: Fix unsigned expression compared with zero in fsl_udc_probe

2020-08-24 Thread Ye Bin
Signed-off-by: Ye Bin 
---
 drivers/usb/gadget/udc/fsl_udc_core.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c 
b/drivers/usb/gadget/udc/fsl_udc_core.c
index a6f7b2594c09..3e98740b8cfc 100644
--- a/drivers/usb/gadget/udc/fsl_udc_core.c
+++ b/drivers/usb/gadget/udc/fsl_udc_core.c
@@ -2439,11 +2439,12 @@ static int fsl_udc_probe(struct platform_device *pdev)
/* DEN is bidirectional ep number, max_ep doubles the number */
udc_controller->max_ep = (dccparams & DCCPARAMS_DEN_MASK) * 2;
 
-   udc_controller->irq = platform_get_irq(pdev, 0);
-   if (udc_controller->irq <= 0) {
-   ret = udc_controller->irq ? : -ENODEV;
+   ret = platform_get_irq(pdev, 0);
+   if (ret <= 0) {
+   ret = ret ? : -ENODEV;
goto err_iounmap;
}
+   udc_controller->irq = ret;
 
ret = request_irq(udc_controller->irq, fsl_udc_irq, IRQF_SHARED,
driver_name, udc_controller);
-- 
2.25.4