[PATCH] bsp/raspberrypi: Store the current taskid before waiting for the transient event in i2c-driver

Joel Sherrill joel at rtems.org
Tue Dec 29 20:19:06 UTC 2015


The code currently in git does not compile. A quick visual inspection shows
the obviously incorrect code. This is in raspberrypi/i2c/i2c.c around line
95.
I am guessing that the assignment is not intended to be in the conditional
expression but Jan needs to confirm that and submit a new patch.

Did this make it to any branches?

      /* Sleep until the TX FIFO has free space for a new write. */
      if (
          bus->task_id = rtems_task_self();
          rtems_event_transient_receive(RTEMS_WAIT, bus->base.timeout) !=
          RTEMS_SUCCESSFUL
      ) {
        rtems_event_transient_clear();

        return -ETIMEDOUT;
      }


On Tue, Dec 1, 2015 at 8:11 PM, Gedare Bloom <gedare at rtems.org> wrote:

> can you file a ticket and describe the bug this fixes. then #close the
> ticket with the commit message.
>
> On Mon, Nov 30, 2015 at 5:16 PM, Jan Sommer
> <soja-lists at aries.uberspace.de> wrote:
> > Before having the i2c device as an shared resource will create a
> deadlock because the taskid
> > for the transient_event is only stored during device registration.
> > ---
> >  c/src/lib/libbsp/arm/raspberrypi/i2c/i2c.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/c/src/lib/libbsp/arm/raspberrypi/i2c/i2c.c
> b/c/src/lib/libbsp/arm/raspberrypi/i2c/i2c.c
> > index 14a2467..9bf90ec 100644
> > --- a/c/src/lib/libbsp/arm/raspberrypi/i2c/i2c.c
> > +++ b/c/src/lib/libbsp/arm/raspberrypi/i2c/i2c.c
> > @@ -91,6 +91,7 @@ static int rpi_i2c_bus_transfer(rpi_i2c_bus *bus)
> >        BCM2835_REG(BCM2835_I2C_C) |= (1 << 9);
> >
> >        /* Sleep until the TX FIFO has free space for a new write. */
> > +      bus->task_id = rtems_task_self();
> >        if (
> >            rtems_event_transient_receive(RTEMS_WAIT, bus->base.timeout)
> !=
> >            RTEMS_SUCCESSFUL
> > --
> > 2.5.0
> >
> > _______________________________________________
> > devel mailing list
> > devel at rtems.org
> > http://lists.rtems.org/mailman/listinfo/devel
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20151229/ec822c61/attachment-0002.html>


More information about the devel mailing list