From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Jim Wylder <jwylder@google.com>
Cc: Mark Brown <broonie@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
kernel-team@android.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] regmap-i2c: Subtract reg size from max_write
Date: Sun, 2 Jun 2024 10:29:07 +0300 [thread overview]
Message-ID: <ZlwfQ3ERbo5snLcK@surfacebook.localdomain> (raw)
In-Reply-To: <20240523211437.2839942-1-jwylder@google.com>
Thu, May 23, 2024 at 04:14:36PM -0500, Jim Wylder kirjoitti:
> Currently, when an adapter defines a max_write_len quirk,
> the data will be chunked into data sizes equal to the
> max_write_len quirk value. But the payload will be increased by
> the size of the register address before transmission. The
> resulting value always ends up larger than the limit set
> by the quirk.
>
> Avoid this error by setting regmap's max_write to the quirk's
> max_write_len minus the number of bytes for the register and
> padding. This allows the chunking to work correctly for this
> limited case without impacting other use-cases.
...
> (bus->max_raw_write == 0 || bus->max_raw_write > quirks->max_write_len))
> - max_write = quirks->max_write_len;
> + max_write = quirks->max_write_len -
> + (config->reg_bits + config->pad_bits) / BITS_PER_BYTE;
Interesting. regmap-spi does this slightly differently, i.e. reg/8 + pad/8.
I'm wondering which one is more correct (potential off-by-one I suppose).
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2024-06-02 7:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-23 21:14 Jim Wylder
2024-05-24 4:18 ` Greg Kroah-Hartman
2024-05-29 11:08 ` Mark Brown
2024-06-02 7:29 ` Andy Shevchenko [this message]
2024-06-03 12:08 ` Mark Brown
2024-06-04 9:15 ` Andy Shevchenko
2024-06-04 11:50 ` Mark Brown
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=ZlwfQ3ERbo5snLcK@surfacebook.localdomain \
--to=andy.shevchenko@gmail.com \
--cc=broonie@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jwylder@google.com \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.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®