[Bug 876] finished usb host patch

Sébastien Lorquet squalyl at gmail.com
Wed Sep 19 08:54:10 CEST 2007


In the attached patch, I noticed in this function:

+static ssize_t set_usb_mode(struct device *dev, struct device_attribute *attr,
+			    const char *buf, size_t count)
+{
+	if (!strncmp(buf, "host", 4)) {
+		printk("s3c2410: changing usb to host\n");
+		s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST,
+				      S3C2410_MISCCR_USBHOST);
+		/* FIXME:
+		 * - call machine-specific disable-pullup function i
+		 * - enable +Vbus (if hardware supports it)
+		 */
+		s3c2410_gpio_setpin(S3C2410_GPE5, 0);
+	} else if (!strncmp(buf, "device", 6)) {
+		printk("s3c2410: changing usb to device\n");
+		s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST, 0);
+		s3c2410_gpio_setpin(S3C2410_GPE5, 1);
+	} else
+		printk("s3c2410: unknown mode\n");
+		return -EINVAL;
+	return count;
+}

Didn't you want to put {} around the else? -EINVAL is only returned if the
mode is incorrect :

+	} else {
+		printk("s3c2410: unknown mode\n");
+		return -EINVAL;
+	}
+	return count;



2007/9/17, bugzilla-daemon at bugzilla.openmoko.org <
bugzilla-daemon at bugzilla.openmoko.org>:
>
> http://bugzilla.openmoko.org/cgi-bin/bugzilla/show_bug.cgi?id=876
>
>
>
>
>
> ------- Additional Comments From zeroping at gmail.com  2007-09-17 20:53
> -------
> Created an attachment (id=312)
> --> (
> http://bugzilla.openmoko.org/cgi-bin/bugzilla/attachment.cgi?id=312&action=view
> )
> The updated usb mode switching patch
>
>
>
>
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug, or are watching someone who is.
>
> _______________________________________________
> buglog mailing list
> buglog at lists.openmoko.org
> http://lists.openmoko.org/mailman/listinfo/buglog
>



-- 
Sébastien LORQUET - 이세영 (李世榮)
Ingénieur ENSPG 2006 / ENSIMAG-ASI 2007
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openmoko.org/pipermail/buglog/attachments/20070919/717826b0/attachment.htm 


More information about the buglog mailing list