[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200923165745.GA3732240@kroah.com>
Date:   Wed, 23 Sep 2020 18:57:45 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Maximilian Luz <luzmaximilian@...il.com>
Cc:     linux-kernel@...r.kernel.org, linux-serial@...r.kernel.org,
        Arnd Bergmann <arnd@...db.de>, Rob Herring <robh@...nel.org>,
        Jiri Slaby <jirislaby@...nel.org>,
        Blaž Hrastnik <blaz@...n.io>,
        Dorian Stoll <dorian.stoll@...p.io>
Subject: Re: [RFC PATCH 1/9] misc: Add Surface Aggregator subsystem
On Wed, Sep 23, 2020 at 05:15:03PM +0200, Maximilian Luz wrote:
> +/* -- Safe counters. -------------------------------------------------------- */
> +
> +/**
> + * ssh_seq_reset() - Reset/initialize sequence ID counter.
> + * @c: The counter to reset.
> + */
> +static void ssh_seq_reset(struct ssh_seq_counter *c)
> +{
> +	WRITE_ONCE(c->value, 0);
> +}
These "counters" are odd, what exactly are they?
They seem like a simple atomic counter, but not quite, so you have
rolled your own pseudo-atomic variable.  Are you sure that it works
properly?  If so, how?
What about just using an ida/idr structure instead?  Or just a simple
atomic counter that avoids the values you can't touch, or better yet, a
simple number with a correct lock protecting it :)
thanks,
greg k-h
Powered by blists - more mailing lists
 
