Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[MTD] [NAND] pxa3xx_nand: added some 'const' annotations to the exported API

This patch marks some attributes as 'const' which are set only once and
never be modified by the driver. There are some changes in parameter
list and variable declarations too which mark them as 'const'.

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

authored by

Enrico Scholz and committed by
David Woodhouse
7dad482e 80ebf20f

+9 -9
+4 -4
arch/arm/mach-pxa/include/mach/pxa3xx_nand.h
··· 30 30 }; 31 31 32 32 struct pxa3xx_nand_flash { 33 - struct pxa3xx_nand_timing *timing; /* NAND Flash timing */ 34 - struct pxa3xx_nand_cmdset *cmdset; 33 + const struct pxa3xx_nand_timing *timing; /* NAND Flash timing */ 34 + const struct pxa3xx_nand_cmdset *cmdset; 35 35 36 36 uint32_t page_per_block;/* Pages per block (PG_PER_BLK) */ 37 37 uint32_t page_size; /* Page size in bytes (PAGE_SZ) */ ··· 56 56 */ 57 57 int enable_arbiter; 58 58 59 - struct mtd_partition *parts; 60 - unsigned int nr_parts; 59 + const struct mtd_partition *parts; 60 + unsigned int nr_parts; 61 61 62 62 struct pxa3xx_nand_flash * const flash; 63 63 size_t num_flash;
+5 -5
drivers/mtd/nand/pxa3xx_nand.c
··· 293 293 #define ns2cycle(ns, clk) (int)(((ns) * (clk / 1000000) / 1000) + 1) 294 294 295 295 static void pxa3xx_nand_set_timing(struct pxa3xx_nand_info *info, 296 - struct pxa3xx_nand_timing *t) 296 + const struct pxa3xx_nand_timing *t) 297 297 { 298 298 unsigned long nand_clk = clk_get_rate(info->clk); 299 299 uint32_t ndtr0, ndtr1; ··· 336 336 uint16_t cmd, int column, int page_addr) 337 337 { 338 338 struct pxa3xx_nand_flash *f = info->flash_info; 339 - struct pxa3xx_nand_cmdset *cmdset = f->cmdset; 339 + const struct pxa3xx_nand_cmdset *cmdset = f->cmdset; 340 340 341 341 /* calculate data size */ 342 342 switch (f->page_size) { ··· 387 387 388 388 static int prepare_other_cmd(struct pxa3xx_nand_info *info, uint16_t cmd) 389 389 { 390 - struct pxa3xx_nand_cmdset *cmdset = info->flash_info->cmdset; 390 + const struct pxa3xx_nand_cmdset *cmdset = info->flash_info->cmdset; 391 391 392 392 info->ndcb0 = cmd | ((cmd & 0xff00) ? NDCB0_DBC : 0); 393 393 info->ndcb1 = 0; ··· 623 623 { 624 624 struct pxa3xx_nand_info *info = mtd->priv; 625 625 struct pxa3xx_nand_flash *flash_info = info->flash_info; 626 - struct pxa3xx_nand_cmdset *cmdset = flash_info->cmdset; 626 + const struct pxa3xx_nand_cmdset *cmdset = flash_info->cmdset; 627 627 int ret; 628 628 629 629 info->use_dma = (use_dma) ? 1 : 0; ··· 843 843 static int __readid(struct pxa3xx_nand_info *info, uint32_t *id) 844 844 { 845 845 struct pxa3xx_nand_flash *f = info->flash_info; 846 - struct pxa3xx_nand_cmdset *cmdset = f->cmdset; 846 + const struct pxa3xx_nand_cmdset *cmdset = f->cmdset; 847 847 uint32_t ndcr; 848 848 uint8_t id_buff[8]; 849 849