[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <95dad033-4338-46de-b62a-be1db459b0ec@wanadoo.fr>
Date: Fri, 4 Jul 2025 20:40:51 +0200
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Abd-Alrhman Masalkhi <abd.masalkhi@...il.com>
Cc: arnd@...db.de, conor+dt@...nel.org, devicetree@...r.kernel.org,
gregkh@...uxfoundation.org, krzk+dt@...nel.org,
linux-kernel@...r.kernel.org, luoyifan@...s.chinamobile.com, robh@...nel.org
Subject: Re: [PATCH v5 2/3] eeprom: add driver for ST M24LR series RFID/NFC
EEPROM chips
Le 04/07/2025 à 17:11, Abd-Alrhman Masalkhi a écrit :
> Hi Christophe,
>
> Thank you for the review!
>
> On Fri, 4 Jul 2025 16:12:56 +0200, Christophe JAILLET wrote:
>>> +/**
>>> + * m24lr_regmap_read - read data using regmap with retry on failure
>>> + * @regmap: regmap instance for the device
>>> + * @buf: buffer to store the read data
>>> + * @size: number of bytes to read
>>> + * @offset: starting register address
>>> + *
>>> + * Attempts to read a block of data from the device with retries and timeout.
>>> + * Some M24LR chips may transiently NACK reads (e.g., during internal write
>>> + * cycles), so this function retries with a short sleep until the timeout
>>> + * expires.
>>> + *
>>> + * Returns:
>>> + * Number of bytes read on success,
>>> + * -ETIMEDOUT if the read fails within the timeout window.
>>> + */
>>> +static ssize_t m24lr_regmap_read(struct regmap *regmap, u8 *buf,
>>> + size_t size, unsigned int offset)
>>
>> Why returning a ssize_t?
>> regmap_bulk_read() returns an int.
>
> Since I return @size (of type size_t) on success, should I keep the
> return type as ssize_t, or would it be better to change it to int
> to match regmap_bulk_read()?
Hmm, this ends being used with BIN_ATTR() in
m24lr_ctl_sss_[read|write]() so it needs to keep with ssize_t.
CJ
>
> Best regards,
> Abd-Alrhman Masalkhi
>
>
Powered by blists - more mailing lists