Revision | 9d1806fadc24811a5338f3fecb82ff5538114455 (tree) |
---|---|
Time | 2022-07-22 17:34:02 |
Author | Michael Trimarchi <michael@amar...> |
Commiter | Michael Trimarchi |
mtd: nand: Get rid of mtd variable in function calls
chip points to mtd. Passing chip is enough to have a reference
to mtd when is necessary
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
@@ -4160,8 +4160,9 @@ static int nand_get_bits_per_cell(u8 cellinfo) | ||
4160 | 4160 | * chip. The rest of the parameters must be decoded according to generic or |
4161 | 4161 | * manufacturer-specific "extended ID" decoding patterns. |
4162 | 4162 | */ |
4163 | -static void nand_decode_ext_id(struct mtd_info *mtd, struct nand_chip *chip) | |
4163 | +static void nand_decode_ext_id(struct nand_chip *chip) | |
4164 | 4164 | { |
4165 | + struct mtd_info *mtd = &chip->mtd; | |
4165 | 4166 | int extid, id_len; |
4166 | 4167 | /* The 3rd id byte holds MLC / multichip data */ |
4167 | 4168 | chip->bits_per_cell = nand_get_bits_per_cell(chip->id.data[2]); |
@@ -4291,7 +4292,7 @@ static void nand_decode_ext_id(struct mtd_info *mtd, struct nand_chip *chip) | ||
4291 | 4292 | * compliant and does not have a full-id or legacy-id entry in the nand_ids |
4292 | 4293 | * table. |
4293 | 4294 | */ |
4294 | -static void nand_manufacturer_detect(struct mtd_info *mtd, struct nand_chip *chip) | |
4295 | +static void nand_manufacturer_detect(struct nand_chip *chip) | |
4295 | 4296 | { |
4296 | 4297 | /* |
4297 | 4298 | * Try manufacturer detection if available and use |
@@ -4301,7 +4302,7 @@ static void nand_manufacturer_detect(struct mtd_info *mtd, struct nand_chip *chi | ||
4301 | 4302 | chip->manufacturer.desc->ops->detect) |
4302 | 4303 | chip->manufacturer.desc->ops->detect(chip); |
4303 | 4304 | else |
4304 | - nand_decode_ext_id(mtd, chip); | |
4305 | + nand_decode_ext_id(chip); | |
4305 | 4306 | } |
4306 | 4307 | |
4307 | 4308 | /* |
@@ -4324,9 +4325,9 @@ static int nand_manufacturer_init(struct nand_chip *chip) | ||
4324 | 4325 | * decodes a matching ID table entry and assigns the MTD size parameters for |
4325 | 4326 | * the chip. |
4326 | 4327 | */ |
4327 | -static void nand_decode_id(struct mtd_info *mtd, struct nand_chip *chip, | |
4328 | - struct nand_flash_dev *type) | |
4328 | +static void nand_decode_id(struct nand_chip *chip, struct nand_flash_dev *type) | |
4329 | 4329 | { |
4330 | + struct mtd_info *mtd = &chip->mtd; | |
4330 | 4331 | int maf_id = chip->id.data[0]; |
4331 | 4332 | |
4332 | 4333 | mtd->erasesize = type->erasesize; |
@@ -4439,11 +4440,11 @@ static const struct nand_manufacturers *nand_get_manufacturer_desc(u8 id) | ||
4439 | 4440 | /* |
4440 | 4441 | * Get the flash and manufacturer id and lookup if the type is supported. |
4441 | 4442 | */ |
4442 | -struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, | |
4443 | - struct nand_chip *chip, | |
4444 | - int *maf_id, int *dev_id, | |
4445 | - struct nand_flash_dev *type) | |
4443 | +struct nand_flash_dev *nand_get_flash_type(struct nand_chip *chip, int *maf_id, | |
4444 | + int *dev_id, | |
4445 | + struct nand_flash_dev *type) | |
4446 | 4446 | { |
4447 | + struct mtd_info *mtd = &chip->mtd; | |
4447 | 4448 | const struct nand_manufacturers *manufacturer_desc; |
4448 | 4449 | int busw, ret; |
4449 | 4450 | u8 *id_data = chip->id.data; |
@@ -4539,9 +4540,9 @@ struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, | ||
4539 | 4540 | chip->chipsize = (uint64_t)type->chipsize << 20; |
4540 | 4541 | |
4541 | 4542 | if (!type->pagesize) { |
4542 | - nand_manufacturer_detect(mtd, chip); | |
4543 | + nand_manufacturer_detect(chip); | |
4543 | 4544 | } else { |
4544 | - nand_decode_id(mtd, chip, type); | |
4545 | + nand_decode_id(chip, type); | |
4545 | 4546 | } |
4546 | 4547 | |
4547 | 4548 | /* Get chip options */ |
@@ -4729,7 +4730,7 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips, | ||
4729 | 4730 | nand_set_defaults(chip, chip->options & NAND_BUSWIDTH_16); |
4730 | 4731 | |
4731 | 4732 | /* Read the flash type */ |
4732 | - type = nand_get_flash_type(mtd, chip, &nand_maf_id, | |
4733 | + type = nand_get_flash_type(chip, &nand_maf_id, | |
4733 | 4734 | &nand_dev_id, table); |
4734 | 4735 | |
4735 | 4736 | if (IS_ERR(type)) { |
@@ -29,8 +29,7 @@ struct nand_flash_dev; | ||
29 | 29 | struct device_node; |
30 | 30 | |
31 | 31 | /* Get the flash and manufacturer id and lookup if the type is supported. */ |
32 | -struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, | |
33 | - struct nand_chip *chip, | |
32 | +struct nand_flash_dev *nand_get_flash_type(struct nand_chip *chip, | |
34 | 33 | int *maf_id, int *dev_id, |
35 | 34 | struct nand_flash_dev *type); |
36 | 35 |