All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] drivers: usb: musb: Fail if the ctrl mod register is missing
@ 2020-05-06 10:39 Arnaud Ferraris
  2020-05-06 10:39 ` [PATCH v2 2/2] drivers: usb: musb: ti: Use dev_err instead of pr_err Arnaud Ferraris
  2020-05-06 10:51 ` [PATCH v2 1/2] drivers: usb: musb: Fail if the ctrl mod register is missing Marek Vasut
  0 siblings, 2 replies; 3+ messages in thread
From: Arnaud Ferraris @ 2020-05-06 10:39 UTC (permalink / raw)
  To: u-boot

From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>

If the trcl mode register address cannot be found error out rather then
trying to continue (which cannot work)

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
---

Changes in v2:
- squashed commits as they both affect the same code
- replaced pr_err() with dev_err()

 drivers/usb/musb-new/ti-musb.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c
index 608facefa3..56d6134dc6 100644
--- a/drivers/usb/musb-new/ti-musb.c
+++ b/drivers/usb/musb-new/ti-musb.c
@@ -91,6 +91,11 @@ static int ti_musb_ofdata_to_platdata(struct udevice *dev)
 	phys = fdtdec_lookup_phandle(fdt, node, "phys");
 	ctrl_mod = fdtdec_lookup_phandle(fdt, phys, "ti,ctrl_mod");
 	platdata->ctrl_mod_base = (void *)fdtdec_get_addr(fdt, ctrl_mod, "reg");
+	if (platdata->ctrl_mod_base == (void *)FDT_ADDR_T_NONE) {
+		dev_err(dev, "MUSB ctrl mod missing\n");
+		return -ENOENT;
+	}
+
 	usb_index = ti_musb_get_usb_index(node);
 	switch (usb_index) {
 	case 1:
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2 2/2] drivers: usb: musb: ti: Use dev_err instead of pr_err
  2020-05-06 10:39 [PATCH v2 1/2] drivers: usb: musb: Fail if the ctrl mod register is missing Arnaud Ferraris
@ 2020-05-06 10:39 ` Arnaud Ferraris
  2020-05-06 10:51 ` [PATCH v2 1/2] drivers: usb: musb: Fail if the ctrl mod register is missing Marek Vasut
  1 sibling, 0 replies; 3+ messages in thread
From: Arnaud Ferraris @ 2020-05-06 10:39 UTC (permalink / raw)
  To: u-boot

In order to maintain consistency, every call to pr_err() is replaced
with dev_err().

Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
---

Changes in v2:
- added in v2

 drivers/usb/musb-new/ti-musb.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c
index 56d6134dc6..f8cb488cc4 100644
--- a/drivers/usb/musb-new/ti-musb.c
+++ b/drivers/usb/musb-new/ti-musb.c
@@ -114,7 +114,7 @@ static int ti_musb_ofdata_to_platdata(struct udevice *dev)
 	musb_config->multipoint = fdtdec_get_int(fdt, node,
 						 "mentor,multipoint", -1);
 	if (musb_config->multipoint < 0) {
-		pr_err("MUSB multipoint DT entry missing\n");
+		dev_err(dev, "MUSB multipoint DT entry missing\n");
 		return -ENOENT;
 	}
 
@@ -123,14 +123,14 @@ static int ti_musb_ofdata_to_platdata(struct udevice *dev)
 	musb_config->num_eps = fdtdec_get_int(fdt, node, "mentor,num-eps",
 					      -1);
 	if (musb_config->num_eps < 0) {
-		pr_err("MUSB num-eps DT entry missing\n");
+		dev_err(dev, "MUSB num-eps DT entry missing\n");
 		return -ENOENT;
 	}
 
 	musb_config->ram_bits = fdtdec_get_int(fdt, node, "mentor,ram-bits",
 					       -1);
 	if (musb_config->ram_bits < 0) {
-		pr_err("MUSB ram-bits DT entry missing\n");
+		dev_err(dev, "MUSB ram-bits DT entry missing\n");
 		return -ENOENT;
 	}
 
@@ -138,7 +138,7 @@ static int ti_musb_ofdata_to_platdata(struct udevice *dev)
 
 	platdata->plat.power = fdtdec_get_int(fdt, node, "mentor,power", -1);
 	if (platdata->plat.power < 0) {
-		pr_err("MUSB mentor,power DT entry missing\n");
+		dev_err(dev, "MUSB mentor,power DT entry missing\n");
 		return -ENOENT;
 	}
 
@@ -189,7 +189,7 @@ static int ti_musb_host_ofdata_to_platdata(struct udevice *dev)
 
 	ret = ti_musb_ofdata_to_platdata(dev);
 	if (ret) {
-		pr_err("platdata dt parse error\n");
+		dev_err(dev, "platdata dt parse error\n");
 		return ret;
 	}
 
@@ -227,7 +227,7 @@ static int ti_musb_peripheral_ofdata_to_platdata(struct udevice *dev)
 
 	ret = ti_musb_ofdata_to_platdata(dev);
 	if (ret) {
-		pr_err("platdata dt parse error\n");
+		dev_err(dev, "platdata dt parse error\n");
 		return ret;
 	}
 	platdata->plat.mode = MUSB_PERIPHERAL;
@@ -312,7 +312,7 @@ static int ti_musb_wrapper_bind(struct udevice *parent)
 							 node,
 							 &dev);
 			if (ret)
-				pr_err("musb - not able to bind usb peripheral node\n");
+				dev_err(dev, "musb - not able to bind usb peripheral node\n");
 			break;
 		case USB_DR_MODE_HOST:
 			/* Bind MUSB host */
@@ -322,7 +322,7 @@ static int ti_musb_wrapper_bind(struct udevice *parent)
 							 node,
 							 &dev);
 			if (ret)
-				pr_err("musb - not able to bind usb host node\n");
+				dev_err(dev, "musb - not able to bind usb host node\n");
 			break;
 		default:
 			break;
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2 1/2] drivers: usb: musb: Fail if the ctrl mod register is missing
  2020-05-06 10:39 [PATCH v2 1/2] drivers: usb: musb: Fail if the ctrl mod register is missing Arnaud Ferraris
  2020-05-06 10:39 ` [PATCH v2 2/2] drivers: usb: musb: ti: Use dev_err instead of pr_err Arnaud Ferraris
@ 2020-05-06 10:51 ` Marek Vasut
  1 sibling, 0 replies; 3+ messages in thread
From: Marek Vasut @ 2020-05-06 10:51 UTC (permalink / raw)
  To: u-boot

On 5/6/20 12:39 PM, Arnaud Ferraris wrote:
> From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
> 
> If the trcl mode register address cannot be found error out rather then
> trying to continue (which cannot work)
> 
> Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
> Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
> Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
> ---
> 
> Changes in v2:
> - squashed commits as they both affect the same code
> - replaced pr_err() with dev_err()
> 
>  drivers/usb/musb-new/ti-musb.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c
> index 608facefa3..56d6134dc6 100644
> --- a/drivers/usb/musb-new/ti-musb.c
> +++ b/drivers/usb/musb-new/ti-musb.c
> @@ -91,6 +91,11 @@ static int ti_musb_ofdata_to_platdata(struct udevice *dev)
>  	phys = fdtdec_lookup_phandle(fdt, node, "phys");
>  	ctrl_mod = fdtdec_lookup_phandle(fdt, phys, "ti,ctrl_mod");
>  	platdata->ctrl_mod_base = (void *)fdtdec_get_addr(fdt, ctrl_mod, "reg");
> +	if (platdata->ctrl_mod_base == (void *)FDT_ADDR_T_NONE) {
> +		dev_err(dev, "MUSB ctrl mod missing\n");
> +		return -ENOENT;
> +	}

When does this happen ?

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-06 10:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-06 10:39 [PATCH v2 1/2] drivers: usb: musb: Fail if the ctrl mod register is missing Arnaud Ferraris
2020-05-06 10:39 ` [PATCH v2 2/2] drivers: usb: musb: ti: Use dev_err instead of pr_err Arnaud Ferraris
2020-05-06 10:51 ` [PATCH v2 1/2] drivers: usb: musb: Fail if the ctrl mod register is missing Marek Vasut

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.