mtd: spi-nor: sst: Factor out common write operation to `sst_nor_write_data()`
authorCsókás, Bence <csokas.bence@prolan.hu>
Wed, 10 Jul 2024 09:14:01 +0000 (11:14 +0200)
committerPratyush Yadav <pratyush@kernel.org>
Sat, 14 Sep 2024 15:56:31 +0000 (17:56 +0200)
commit18bcb4aa54eab75dce41e5c176a1c2bff94f0f79
tree2eec312a90df3a54eae2a917d58a2ae79b38fc0c
parent8400291e289ee6b2bf9779ff1c83a291501f017b
mtd: spi-nor: sst: Factor out common write operation to `sst_nor_write_data()`

Writing to the Flash in `sst_nor_write()` is a 3-step process:
first an optional one-byte write to get 2-byte-aligned, then the
bulk of the data is written out in vendor-specific 2-byte writes.
Finally, if there's a byte left over, another one-byte write.
This was implemented 3 times in the body of `sst_nor_write()`.
To reduce code duplication, factor out these sub-steps to their
own function.

Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu>
Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
[pratyush@kernel.org: fixup whitespace, use %zu instead of %i in WARN()]
Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
Link: https://lore.kernel.org/r/20240710091401.1282824-1-csokas.bence@prolan.hu
drivers/mtd/spi-nor/sst.c