Re: [PATCH v3 13/16] can: m_can: Introduce a tx_fifo_in_flight counter

From: Simon Horman
Date: Wed Jun 21 2023 - 09:51:03 EST


On Tue, Jun 20, 2023 at 02:53:54PM +0200, Markus Schneider-Pargmann wrote:
> Hi Simon,
>
> On Fri, Mar 17, 2023 at 05:02:44PM +0100, Simon Horman wrote:
> > On Wed, Mar 15, 2023 at 12:05:43PM +0100, Markus Schneider-Pargmann wrote:
> > > Keep track of the number of transmits in flight.
> > >
> > > This patch prepares the driver to control the network interface queue
> > > based on this counter. By itself this counter be
> > > implemented with an atomic, but as we need to do other things in the
> > > critical sections later I am using a spinlock instead.
> > >
> > > Signed-off-by: Markus Schneider-Pargmann <msp@xxxxxxxxxxxx>
>
> Thank you for all your reviews, very helpful.
>
> >
> > Nit, assuming the values are always positive, I think
> > that unsigned might be a more appropriate type than int
> > for the tx_fifo_in_flight field, and associated function
> > parameters and local variables.
>
> I agree that tx_fifo_in_flight is and should always be a positive value.
> However as the code is operating with ++ and -- exclusively I would
> personally prefer int here as that shows off-by-one errors much easier
> in case there are any at some point.
>
> Is that fine for you?

Yes, I think so.