[PATCH] mtd: spi-nor: core: Set mtd->eraseregions for non-uniform erase map
Tudor Ambarus
tudor.ambarus at linaro.org
Fri Jan 12 04:22:19 PST 2024
On 1/12/24 12:01, Michael Walle wrote:
>>> + struct mtd_erase_region_info *mtd_region;
>>> + u32 erase_size;
>>> + u8 erase_mask;
>>
>> put the u8 last to avoid stack padding
>
> I don't think that is a thing. Even if it were, it might clash
> with the RCT.
RCT as in reverse Christmas tree? if we put u8 at the end we'll respect
RCT and without padding holes in the stack.
>
> I couldn't find anything about how automatic variables are placed
> in memory. I'd say its not specified in the standard and the compiler
> is free to do optimizations here or just keep the contents in
> registers (?!).
>
I can't tell.
> Any stytle recommendations for spi-nor? I prefer RCT, but if we want
> to say declaration order doesn't matter, I'm fine with that too.
RCT or CT with stack padding in mind :). But that's just common sense, I
guess.
>
>>> +
>>> + for (i = 0; !spi_nor_region_is_last(®ion[i]); i++)
>>> + ;
>>> +
>>> + n_regions = i + 1;
>>
>> all this just to get the number of regions? how about saving the number
>> of regions somewhere and use it everywhere?
>
> This whole region thing should be rewritten to not store these magic
> bits in the offset.
>
yeah, probably.
More information about the linux-mtd
mailing list