Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1426439
| From | Boris Brezillon <boris.brezillon@free-electrons.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v3 05/16] mtd: nand: rename nand_get_flash_type() into nand_detect() |
| Date | 2016-06-20 11:50 +0200 |
| Message-ID | <rM40a-6wa-21@gated-at.bofh.it> (permalink) |
| References | <rM3Qt-6sw-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
The only caller of nand_get_flash_type() (nand_scan_ident()) actually
don't use the returned nand_flash_dev pointer except for converting it to
to an error code.
Rename this function nand_detect() and make it return an integer.
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
---
drivers/mtd/nand/nand_base.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index b174d7c6ba1f..14c28abec9aa 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3814,8 +3814,7 @@ static bool find_full_id_nand(struct nand_chip *chip,
/*
* Get the flash and manufacturer id and lookup if the type is supported.
*/
-static struct nand_flash_dev *nand_get_flash_type(struct nand_chip *chip,
- struct nand_flash_dev *type)
+static int nand_detect(struct nand_chip *chip, struct nand_flash_dev *type)
{
struct mtd_info *mtd = nand_to_mtd(chip);
int busw;
@@ -3855,7 +3854,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct nand_chip *chip,
if (id_data[0] != maf_id || id_data[1] != dev_id) {
pr_info("second ID read did not match %02x,%02x against %02x,%02x\n",
maf_id, dev_id, id_data[0], id_data[1]);
- return ERR_PTR(-ENODEV);
+ return -ENODEV;
}
chip->id.len = nand_id_len(id_data, 8);
@@ -3899,7 +3898,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct nand_chip *chip,
}
if (!type->name)
- return ERR_PTR(-ENODEV);
+ return -ENODEV;
if (!mtd->name)
mtd->name = type->name;
@@ -3942,7 +3941,7 @@ ident_done:
pr_info("%s %s\n", nand_manuf_ids[maf_idx].name, mtd->name);
pr_warn("bus width %d instead %d bit\n", busw ? 16 : 8,
(chip->options & NAND_BUSWIDTH_16) ? 16 : 8);
- return ERR_PTR(-EINVAL);
+ return -EINVAL;
}
nand_decode_bbm_options(chip);
@@ -3984,7 +3983,7 @@ ident_done:
pr_info("%d MiB, %s, erase size: %d KiB, page size: %d, OOB size: %d\n",
(int)(chip->chipsize >> 20), nand_is_slc(chip) ? "SLC" : "MLC",
mtd->erasesize >> 10, mtd->writesize, mtd->oobsize);
- return type;
+ return 0;
}
static const char * const nand_ecc_modes[] = {
@@ -4147,7 +4146,6 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips,
{
int i, nand_maf_id, nand_dev_id;
struct nand_chip *chip = mtd_to_nand(mtd);
- struct nand_flash_dev *type;
int ret;
ret = nand_dt_init(chip);
@@ -4161,13 +4159,12 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips,
nand_set_defaults(chip);
/* Read the flash type */
- type = nand_get_flash_type(chip, table);
-
- if (IS_ERR(type)) {
+ ret = nand_detect(chip, table);
+ if (ret) {
if (!(chip->options & NAND_SCAN_SILENT_NODEV))
pr_warn("No NAND device found\n");
chip->select_chip(mtd, -1);
- return PTR_ERR(type);
+ return ret;
}
nand_maf_id = chip->id.data[0];
--
2.7.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v3 00/16] mtd: nand: allow vendor specific detection/initialization Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-20 11:40 +0200 [PATCH v3 12/16] mtd: nand: move AMD/Spansion specific init/detection logic in nand_amd.c Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-20 11:40 +0200 [PATCH v3 07/16] mtd: nand: kill the MTD_NAND_IDS Kconfig option Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-20 11:40 +0200 [PATCH v3 04/16] mtd: nand: get rid of busw parameter Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-20 11:40 +0200 [PATCH v3 09/16] mtd: nand: move Hynix specific init/detection logic in nand_hynix.c Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-20 11:40 +0200 [PATCH v3 11/16] mtd: nand: move Micron specific init logic in nand_micron.c Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-20 11:40 +0200 [PATCH v3 03/16] mtd: nand: store nand ID in struct nand_chip Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-20 11:40 +0200 [PATCH v3 01/16] mtd: nand: Fix nand_command_lp() for 8bits opcodes Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-20 11:40 +0200 [PATCH v3 15/16] mtd: nand: hynix: rework NAND ID decoding to extract more information Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-20 11:40 +0200 [PATCH v3 02/16] mtd: nand: get rid of the mtd parameter in all auto-detection functions Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-20 11:40 +0200 [PATCH v3 13/16] mtd: nand: move Macronix specific initialization in nand_macronix.c Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-20 11:40 +0200 [PATCH v3 16/16] mtd: nand: hynix: add read-retry support for 1x nm MLC NANDs Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-20 11:40 +0200 [PATCH v3 08/16] mtd: nand: move Samsung specific init/detection logic in nand_samsung.c Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-20 11:40 +0200 Re: [PATCH v3 00/16] mtd: nand: allow vendor specific detection/initialization Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-20 11:40 +0200 [PATCH v3 14/16] mtd: nand: samsung: retrieve ECC requirements from extended ID Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-20 11:40 +0200 [PATCH v3 10/16] mtd: nand: move Toshiba specific init/detection logic in nand_toshiba.c Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-20 11:40 +0200 [PATCH v3 05/16] mtd: nand: rename nand_get_flash_type() into nand_detect() Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-20 11:50 +0200 [PATCH v3 06/16] mtd: nand: add manufacturer specific initialization/detection steps Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-20 11:50 +0200
csiph-web