From: Mark Brown <broonie@kernel.org>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: linux-can@vger.kernel.org, manivannan.sadhasivam@linaro.org,
dev.kurt@vandijck-laurijssen.be
Subject: Re: [PATCH v53 2/6] can: mcp25xxfd: add regmap infrastructure
Date: Tue, 22 Sep 2020 15:23:53 +0100 [thread overview]
Message-ID: <20200922142353.GV4792@sirena.org.uk> (raw)
In-Reply-To: <e483ba1f-5958-4ba6-e82e-be611247ccd1@pengutronix.de>
[-- Attachment #1: Type: text/plain, Size: 1764 bytes --]
On Tue, Sep 22, 2020 at 03:56:38PM +0200, Marc Kleine-Budde wrote:
> On 9/22/20 2:13 PM, Mark Brown wrote:
> > This feels like a non-idiomatic way of doing this - usually you'd
> > enumerate then allocate the extra maps (using regmap_reinit_cache() to
> > replace the regmap used to do the enumeration).
> I have implemented two regmap clients for this driver. One does transfers with
> CRC, the other one not. Both are REGCACHE_NONE.
Hrm, right. The assumption when that was written was that nothing
fundamental would change about the regmap format but we should probably
extend to allow that since it's the general idea. However it looks like
that might not be needed here.
> For autodetection the driver initializes the regmap which does transfers with
> CRC. Then it detects the chip variant and maybe that variant works properly
> without CRC. The CRC regmap is not needed anymore, so the buffer used to
> linearize the data, is freed.
That flow sounds sensible but the way the code is written it's really
not clear that this is what's going on since there's only one init
function with no indication that it'll be invoked multiple times, the
logic for detection is in a completely separate place and functions by
changing the quirk flags underneath this code - just reading the regmap
handling alone you'd be hard pressed to spot that this is what's going
on. It might be clearer to have an explicit function to generate the
regmap for detection and then call the current function _reinit(),
which would also allow it to be a bit more explicit about the
transitions (if it only needs to handle the CRC->no CRC transition).
Failing that at least some comments about what's going on would be
useful, even just a "this will be called twice because...".
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2020-09-22 14:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-18 17:25 [PATCH v53 1/6] mcp25xxfd: initial driver support Marc Kleine-Budde
2020-09-18 17:25 ` [PATCH v53 1/6] dt-binding: can: mcp25xxfd: document device tree bindings Marc Kleine-Budde
2020-09-18 17:25 ` [PATCH v53 2/6] can: mcp25xxfd: add regmap infrastructure Marc Kleine-Budde
2020-09-21 19:33 ` Mark Brown
2020-09-22 5:57 ` Marc Kleine-Budde
2020-09-22 12:13 ` Mark Brown
2020-09-22 13:56 ` Marc Kleine-Budde
2020-09-22 14:23 ` Mark Brown [this message]
2020-09-18 17:25 ` [PATCH v53 3/6] can: mcp25xxfd: add driver for Microchip MCP25xxFD SPI CAN Marc Kleine-Budde
2020-09-18 17:25 ` [PATCH v53 4/6] can: mcp25xxfd: add listen-only mode Marc Kleine-Budde
2020-09-18 17:25 ` [PATCH v53 5/6] MAINTAINERS: Add entry for Microchip MCP25XXFD SPI-CAN network driver Marc Kleine-Budde
2020-09-18 17:25 ` [PATCH v53 6/6] MAINTAINERS: Add reviewer entry for microchip mcp25xxfd " Marc Kleine-Budde
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=20200922142353.GV4792@sirena.org.uk \
--to=broonie@kernel.org \
--cc=dev.kurt@vandijck-laurijssen.be \
--cc=linux-can@vger.kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=mkl@pengutronix.de \
/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