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:
+ virt = drv_data->ioaddr + SSP_TOP_CTRL;
+ val = readl(virt);
+ val |= TOP_TRAIL; /* Trailing bytes handled by DMA */
+ writel(val, virt);
I'd prefer to do like this, it's more easy for people to grep..
val = readl(drv_data->ioaddr + SSP_TOP_CTRL) | TOP_TRAIL;
writel(val, drv_data->ioaddr + SSP_TOP_CTRL);
This is an idiom I use to make it very clear that:
- 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...
fair, let's put it into another line

Yours is a pure coding style comment. There are two pieces, and
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.

I'd strongly prefer not to introduce 'virt', so be something like this:
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