Hi In-Bae Jeong, Le 05/10/2011 14:08, In-Bae Jeong a écrit : > This patch adds code to match gpio_free() to the corresponding > gpio_request() > > Signed-off-by: In-Bae Jeong<kukya...@gmail.com> > --- > Changes for v2: > - added lables for gpio_request() > - separated labels and statements > --- > board/ti/beagle/beagle.c | 43 +++++++++++++++++++++++++++++-------------- > 1 files changed, 29 insertions(+), 14 deletions(-) > > diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c > index aa5047c..6859594 100644 > --- a/board/ti/beagle/beagle.c > +++ b/board/ti/beagle/beagle.c > @@ -115,24 +115,39 @@ int board_init(void) > int get_board_revision(void) > { > int revision; > + int error = 0; > > - if (!gpio_request(171, "")&& > - !gpio_request(172, "")&& > - !gpio_request(173, "")) { > + if (gpio_request(171, "revision0")) { > + error = 171; > + goto gpio_171_err; > + } > + if (gpio_request(172, "revision1")) { > + error = 172; > + goto gpio_172_err; > + } > + if (gpio_request(173, "revision2")) { > + error = 173; > + goto gpio_173_err; > + } > + > + gpio_direction_input(171); > + gpio_direction_input(172); > + gpio_direction_input(173); > > - gpio_direction_input(171); > - gpio_direction_input(172); > - gpio_direction_input(173); > + revision = gpio_get_value(173)<< 2 | > + gpio_get_value(172)<< 1 | > + gpio_get_value(171); > > - revision = gpio_get_value(173)<< 2 | > - gpio_get_value(172)<< 1 | > - gpio_get_value(171); > + gpio_free(173); > +gpio_173_err: > + gpio_free(172); > +gpio_172_err: > + gpio_free(171); > +gpio_171_err: > > - gpio_free(171); > - gpio_free(172); > - gpio_free(173); > - } else { > - printf("Error: unable to acquire board revision GPIOs\n"); > + if (error) { > + printf("Error: Unable to acquire board revision gpio %i\n",
Nitpick: i and d format specifiers are indeed interchangeable, but d is far more common -- to the point that I had to go and check wether i differed in any from d. Can you resubmit using d as the specifier? > + error); > revision = -1; > } Amicalement, -- Albert. _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot