Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Sep 2013 23:20:45 -0300
From:      Luiz Otavio O Souza <lists.br@gmail.com>
To:        Adrian Chadd <adrian@freebsd.org>
Cc:        freebsd-embedded <freebsd-embedded@freebsd.org>
Subject:   Re: off by one error, maxpins
Message-ID:  <CAB=2f8yemaM9ZoHKzKBFwVg0CzoJ8LJhAJ_UNx3GMRLUt6AnVg@mail.gmail.com>
In-Reply-To: <CAJ-VmomPefJierbCdmkcNZ0QoZckL3Vat5CibyuJrXgGDmXszQ@mail.gmail.com>
References:  <1378420702.1647.18.camel@localhost> <FA19C2B0-8128-4A30-AF38-DDFD7F41AE82@bsdimp.com> <1378421252.1647.21.camel@localhost> <CAJ-VmomPefJierbCdmkcNZ0QoZckL3Vat5CibyuJrXgGDmXszQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Yes, please commit it.

And by the way... There is another bug in that code, the gpio driver
automatically adjust itself to the number of GPIO pins available on SoC:

ar71xx_gpiovar.h:#define AR71XX_GPIO_PINS 12
ar71xx_gpiovar.h:#define AR724X_GPIO_PINS 18
ar71xx_gpiovar.h:#define AR91XX_GPIO_PINS 22
ar933xreg.h:#define AR933X_GPIO_COUNT 30
ar934xreg.h:#define AR934X_GPIO_COUNT 23

But the size of the gpio_pins struct is statically defined (and with a
small size for most of the supported SoC):

struct ar71xx_gpio_softc {
        ....
        struct gpio_pin         gpio_pins[AR71XX_GPIO_PINS];
};

I'll write a patch to allocate this structure dynamically based on the SoC
we're running on.

Luiz


On 5 September 2013 20:14, Adrian Chadd <adrian@freebsd.org> wrote:

> Commit ahoy. :)
>
>
> -a
>
>
> On 5 September 2013 15:47, Sean Bruno <sean_bruno@yahoo.com> wrote:
>
> > On Thu, 2013-09-05 at 16:42 -0600, Warner Losh wrote:
> > > Shouldn't npins and/or maxpin just be bumped by 1 instead?
> > >
> > > Warner
> > >
> > > On Sep 5, 2013, at 4:38 PM, Sean Bruno wrote:
> > >
> > > > http://people.freebsd.org/~sbruno/maxpin_plus_one.txt
> > > >
> >
> > It looks like its  *intentionally* assigned as the h/w specific (GPIO
> > COUNT) -1 in ar71xx_gpio_pin_max()
> >
> > Userland assumes that this value is a 0-based thing.
> >
> _______________________________________________
> freebsd-embedded@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-embedded
> To unsubscribe, send any mail to "freebsd-embedded-unsubscribe@freebsd.org
> "
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAB=2f8yemaM9ZoHKzKBFwVg0CzoJ8LJhAJ_UNx3GMRLUt6AnVg>