Re: [PATCH 2/3] spi: spacemit: introduce SpacemiT K1 SPI controller driver
From: Alex Elder
Date: Thu Sep 18 2025 - 11:58:41 EST
On 9/18/25 9:39 AM, Yixun Lan wrote:
fair, let's put it into another lineThis is an idiom I use to make it very clear that:+ virt = drv_data->ioaddr + SSP_TOP_CTRL;I'd prefer to do like this, it's more easy for people to grep..
+ val = readl(virt);
+ val |= TOP_TRAIL; /* Trailing bytes handled by DMA */
+ writel(val, virt);
val = readl(drv_data->ioaddr + SSP_TOP_CTRL) | TOP_TRAIL;
writel(val, drv_data->ioaddr + SSP_TOP_CTRL);
- The address being read is exactly the same as what's being
written
- The value read is being updated with bits/values
I find that putting the "| TOP_TRAIL" on the same line as the
readl() call obscures things a bit. Like my eye doesn't notice
it as readiliy somehow...
Yours is a pure coding style comment. There are two pieces, andI'd strongly prefer not to introduce 'virt', so be something like this:
I'd like you to tell me how strongly you feel about them:
- Using virt to grab the address being written and read (versus
just using drv_data->ioaddr + SSP_TOP_CTRL twice)
- Put the "| TOP_TRAIL" on the same line as the readl() (versus
having that be assigned on a separate line).
To me, the second one is more important than the first.
Let me know how strongly you feel about these and I'll update
my convention througout.
val = readl(drv_data->ioaddr + SSP_TOP_CTRL);
val |= TOP_TRAIL;
writel(val, drv_data->ioaddr + SSP_TOP_CTRL);
OK. I'll do it this way throughout the driver in the
next version.
-Alex