summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/onenand/onenand_base.c
diff options
context:
space:
mode:
authorTudor Ambarus <tudor.ambarus@microchip.com>2021-04-03 09:09:31 +0300
committerMiquel Raynal <miquel.raynal@bootlin.com>2021-04-16 20:30:54 +0200
commit1df1fc8c62f7527d953c7f3869930067bf5b3f29 (patch)
treeb683a6e18b43e5a37f47bbbdb2cfb27d54056cde /drivers/mtd/nand/onenand/onenand_base.c
parentef4ed780d005d65b1a70ba7803233cace93a73ac (diff)
downloadlinux-1df1fc8c62f7527d953c7f3869930067bf5b3f29.tar.bz2
mtd: core: Constify buf in mtd_write_user_prot_reg()
The write buffer comes from user and should be const. Constify write buffer in mtd core and across all _write_user_prot_reg() users. cfi_cmdset_{0001, 0002} and onenand_base will pay the cost of an explicit cast to discard the const qualifier since the beginning, since they are using an otp_op_t function prototype that is used for both reads and writes. mtd_dataflash and SPI NOR will benefit of the const buffer because they are using different paths for writes and reads. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210403060931.7119-1-tudor.ambarus@microchip.com
Diffstat (limited to 'drivers/mtd/nand/onenand/onenand_base.c')
-rw-r--r--drivers/mtd/nand/onenand/onenand_base.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/mtd/nand/onenand/onenand_base.c b/drivers/mtd/nand/onenand/onenand_base.c
index a9fdea26ea46..958bac54b190 100644
--- a/drivers/mtd/nand/onenand/onenand_base.c
+++ b/drivers/mtd/nand/onenand/onenand_base.c
@@ -3167,9 +3167,10 @@ static int onenand_read_user_prot_reg(struct mtd_info *mtd, loff_t from,
* Write user OTP area.
*/
static int onenand_write_user_prot_reg(struct mtd_info *mtd, loff_t from,
- size_t len, size_t *retlen, u_char *buf)
+ size_t len, size_t *retlen, const u_char *buf)
{
- return onenand_otp_walk(mtd, from, len, retlen, buf, do_otp_write, MTD_OTP_USER);
+ return onenand_otp_walk(mtd, from, len, retlen, (u_char *)buf,
+ do_otp_write, MTD_OTP_USER);
}
/**