[U-Boot] [PATCH 1/3] sunxi: musb: Improve output during probing
Hans de Goede
hdegoede at redhat.com
Mon Jun 22 17:39:39 CEST 2015
Hi,
On 21-06-15 10:00, Ian Campbell wrote:
> On Sat, 2015-06-20 at 17:35 +0200, Hans de Goede wrote:
>> When we return an error the usb core will log a message, so in this case
>> do not print a newline, instead print ": " after our identifier as a
>> seperator between our identifier and the error message logged by the core.
>
> "separator".
Fixed in my personal tree.
> This seems like a lot of fragile faff second guessing what some other
> component does (and is going to do in the future).
Right, but if that other component changes all we end up with is less
then optimal console output it will not really break anything.
Can we not have musb
> take over init time logging completely
The problem is that all the other usb host drivers also depend on this
behavior of the usb core.
> or just live with:
> MUSB OTG: Failed host init
> Flux capacitor has reversed polarity
> which I suppose is roughly how it appears today?
I do not like just living with it, I believe a certain amount of spit
and polish is important, even for text messages like these.
I would not have written this if I did not consider the current situation
ugly :)
How about the following:
Subject: [PATCH 1/3] sunxi: musb: Improve output during probing
When we return an error the usb core will log a message, so in this case
do not print anything.
Signed-off-by: Hans de Goede <hdegoede at redhat.com>
--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -301,21 +301,22 @@ int musb_usb_probe(struct udevice *dev)
{
struct musb_host_data *host = dev_get_priv(dev);
struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
+ int ret;
priv->desc_before_addr = true;
if (!host->host) {
host->host = musb_init_controller(&musb_plat, NULL,
(void *)SUNXI_USB0_BASE);
- if (!host->host) {
- printf("Failed to init the controller\n");
+ if (!host->host)
return -EIO;
- }
}
- printf("MUSB OTG in host-mode\n");
+ ret = musb_lowlevel_init(host);
+ if (ret == 0)
+ printf("MUSB OTG\n");
- return musb_lowlevel_init(host);
+ return ret;
}
int musb_usb_remove(struct udevice *dev)
This is exactly what the other host drivers do, only print
something on success, and leave printing errors up to the
caller.
Regards,
Hans
More information about the U-Boot
mailing list