mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: "'marc.ferland@gmail.com'" <marc.ferland@gmail.com>,
	"krzysztof.kozlowski@linaro.org" <krzysztof.kozlowski@linaro.org>
Cc: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"marc.ferland@sonatest.com" <marc.ferland@sonatest.com>,
	"jeff.dagenais@gmail.com" <jeff.dagenais@gmail.com>,
	"rdunlap@infradead.org" <rdunlap@infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v3 4/5] w1: ds2433: use the kernel bitmap implementation
Date: Thu, 30 Nov 2023 14:52:10 +0000	[thread overview]
Message-ID: <d123196b2c5d486cbf3b2e7e4b1fc774@AcuMS.aculab.com> (raw)
In-Reply-To: <20231130135232.191320-5-marc.ferland@sonatest.com>

From: marc.ferland@gmail.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 :-)

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


  reply	other threads:[~2023-11-30 14:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-30 13:52 [PATCH v3 0/5] Add support for the ds28ec20 one-wire eeprom marc.ferland
2023-11-30 13:52 ` [PATCH v3 1/5] w1: ds2490: support block sizes larger than 128 bytes in ds_read_block marc.ferland
2023-12-02 12:01   ` Krzysztof Kozlowski
2023-11-30 13:52 ` [PATCH v3 2/5] w1: ds2433: remove unused definition marc.ferland
2023-12-02 12:02   ` Krzysztof Kozlowski
2023-11-30 13:52 ` [PATCH v3 3/5] w1: ds2433: introduce a configuration structure marc.ferland
2023-12-02 12:06   ` Krzysztof Kozlowski
2023-11-30 13:52 ` [PATCH v3 4/5] w1: ds2433: use the kernel bitmap implementation marc.ferland
2023-11-30 14:52   ` David Laight [this message]
2023-11-30 15:10     ` Marc Ferland
2023-11-30 13:52 ` [PATCH v3 5/5] w1: ds2433: add support for ds28ec20 eeprom marc.ferland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d123196b2c5d486cbf3b2e7e4b1fc774@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jeff.dagenais@gmail.com \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.ferland@gmail.com \
    --cc=marc.ferland@sonatest.com \
    --cc=rdunlap@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®