[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMRMzCCW9dsCLL0karbWOsbunCO=JGaiDEcT4ZD50O7wRqCfsw@mail.gmail.com>
Date: Thu, 30 Nov 2023 10:10:41 -0500
From: Marc Ferland <marc.ferland@...il.com>
To: David Laight <David.Laight@...lab.com>
Cc: "krzysztof.kozlowski@...aro.org" <krzysztof.kozlowski@...aro.org>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"marc.ferland@...atest.com" <marc.ferland@...atest.com>,
"jeff.dagenais@...il.com" <jeff.dagenais@...il.com>,
"rdunlap@...radead.org" <rdunlap@...radead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 4/5] w1: ds2433: use the kernel bitmap implementation
On Thu, Nov 30, 2023 at 9:52 AM David Laight <David.Laight@...lab.com> wrote:
>
> From: marc.ferland@...il.com
> > Sent: 30 November 2023 13:53
> >
> > The ds2433 driver uses the 'validcrc' variable to mark out which pages
> > have been successfully (crc is valid) retrieved from the eeprom and
> > placed in the internal 'memory' buffer (see CONFIG_W1_SLAVE_DS2433_CRC).
> >
> > The current implementation assumes that the number of pages will never
> > go beyond 32 pages (bit field is a u32). This is fine for the ds2433
> > since it only has 16 pages.
> >
> > Use a dynamically allocated bitmap so that we can support eeproms with
> > more than 32 pages which is the case for the ds28ec20 (80 pages).
>
> Dynamically allocating seems excessive.
> Why not just make the maximum a compile-time constant (say 96 or 128)
> and just check that the actual size isn't too big.
>
> > As an added bonus, the code also gets easier on the eye.
>
> and slower :-)
>
Sounds reasonable to me. Thanks for the tip!
Marc
Powered by blists - more mailing lists