[Patch 3/3] Detect link status on usb0
Nelson Castillo
arhuaco at freaks-unidos.net
Fri May 15 02:07:20 CEST 2009
> +static int gta02_udc_vbus_status(void)
> +{
> + struct pcf50633 *pcf = gta02_pcf;
> +
> + if (!gta02_pcf)
> + return -ENODEV;
> +
> + return !!(pcf50633_mbc_get_status(pcf) & PCF50633_MBC_USB_ONLINE);
> +}
Mike, I got a panic in the pcf50633_mbc_get_status call at boot.
Do you like this fix? I can commit it.
diff --git a/drivers/power/pcf50633-charger.c b/drivers/power/pcf50633-charger.c
index 8772604..1bdb990 100644
--- a/drivers/power/pcf50633-charger.c
+++ b/drivers/power/pcf50633-charger.c
@@ -114,6 +114,9 @@ int pcf50633_mbc_get_status(struct pcf50633 *pcf)
struct pcf50633_mbc *mbc = platform_get_drvdata(pcf->mbc_pdev);
int status = 0;
+ if (!mbc)
+ return 0;
+
if (mbc->usb_online)
status |= PCF50633_MBC_USB_ONLINE;
if (mbc->usb_active)
More information about the openmoko-kernel
mailing list