On Wed, Oct 04, 2017 at 12:59:45PM -0700, Philip Guenther wrote:
| > - if (!umcs_get_reg(sc, UMCS_GPIO, &data)) {
| > + printf("%s: data before umcs_get_reg: %d\n", DEVNAME(sc), data);
| > + umcs_get_reg(sc, UMCS_GPIO, &data);
| > + printf("%s: data after umcs_get_reg: %d\n", DEVNAME(sc), data);
| > +/* if (!umcs_get_reg(sc, UMCS_GPIO, &data)) {
| > printf("%s: unable to get number of ports\n", DEVNAME(sc));
| > usbd_deactivate(sc->sc_udev);
| > return;
| > }
| > +*/
|
| This just looks like a reversed test: umcs_get_reg() returns zero on
| success and an errno value on failure, but the current code is disabling
| the device on success and continuing on failure.
Of course, how could I have missed that :( Here's a diff to fix that.
Thanks for pointing out the obvious, Philip
Paul 'WEiRD' de Weerd
Index: umcs.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/umcs.c,v
retrieving revision 1.5
diff -u -p -r1.5 umcs.c
--- umcs.c 10 Aug 2017 15:11:34 -0000 1.5
+++ umcs.c 5 Oct 2017 05:14:52 -0000
@@ -209,7 +209,7 @@ umcs_attach(struct device *parent, struc
*
* Also, see notes in header file for these constants.
*/
- if (!umcs_get_reg(sc, UMCS_GPIO, &data)) {
+ if (umcs_get_reg(sc, UMCS_GPIO, &data)) {
printf("%s: unable to get number of ports\n", DEVNAME(sc));
usbd_deactivate(sc->sc_udev);
return;
--
>++++++++[<++++++++++>-]<+++++++.>+++[<------>-]<.>+++[<+
+++++++++++>-]<.>++[<------------>-]<+.--------------.[-]
http://www.weirdnet.nl/