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

[MTD] NAND Consolidate references and add back default name setting

We have a type pointer. Make use of it instead of the error prone nand_ids[i]
reference.

The NAND driver used to set default name settings from the chip ID
string for the device. The feature got lost during the rework. Add it back.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

+10 -7
+10 -7
drivers/mtd/nand/nand_base.c
··· 1954 1954 if (!type) 1955 1955 return ERR_PTR(-ENODEV); 1956 1956 1957 - chip->chipsize = nand_flash_ids[i].chipsize << 20; 1957 + if (!mtd->name) 1958 + mtd->name = type->name; 1959 + 1960 + chip->chipsize = type->chipsize << 20; 1958 1961 1959 1962 /* Newer devices have all the information in additional id bytes */ 1960 - if (!nand_flash_ids[i].pagesize) { 1963 + if (!type->pagesize) { 1961 1964 int extid; 1962 1965 /* The 3rd id byte contains non relevant data ATM */ 1963 1966 extid = chip->read_byte(mtd); ··· 1982 1979 /* 1983 1980 * Old devices have chip data hardcoded in the device id table 1984 1981 */ 1985 - mtd->erasesize = nand_flash_ids[i].erasesize; 1986 - mtd->writesize = nand_flash_ids[i].pagesize; 1982 + mtd->erasesize = type->erasesize; 1983 + mtd->writesize = type->pagesize; 1987 1984 mtd->oobsize = mtd->writesize / 32; 1988 - busw = nand_flash_ids[i].options & NAND_BUSWIDTH_16; 1985 + busw = type->options & NAND_BUSWIDTH_16; 1989 1986 } 1990 1987 1991 1988 /* Try to identify manufacturer */ ··· 2023 2020 2024 2021 /* Get chip options, preserve non chip based options */ 2025 2022 chip->options &= ~NAND_CHIPOPTIONS_MSK; 2026 - chip->options |= nand_flash_ids[i].options & NAND_CHIPOPTIONS_MSK; 2023 + chip->options |= type->options & NAND_CHIPOPTIONS_MSK; 2027 2024 2028 2025 /* 2029 2026 * Set chip as a default. Board drivers can override it, if necessary ··· 2033 2030 /* Check if chip is a not a samsung device. Do not clear the 2034 2031 * options for chips which are not having an extended id. 2035 2032 */ 2036 - if (*maf_id != NAND_MFR_SAMSUNG && !nand_flash_ids[i].pagesize) 2033 + if (*maf_id != NAND_MFR_SAMSUNG && !type->pagesize) 2037 2034 chip->options &= ~NAND_SAMSUNG_LP_OPTIONS; 2038 2035 2039 2036 /* Check for AND chips with 4 page planes */