mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 11:03:43 +02:00
Core MTD changes:
* Prepare mtd_otp_nvmem_add() to handle -EPROBE_DEFER * Fix error path for nvmem provider * Fix nvmem error reporting * Provide unique name for nvmem device These changes are expected to be pulled before applying nvmem layouts support in order to get a fully working support in all situations. -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEE9HuaYnbmDhq/XIDIJWrqGEe9VoQFAmQIkRoACgkQJWrqGEe9 VoR0vwf/ZkhNer2rVnC7S47P4Lvw5KHMt7p7cM2no3obM2A3JYi2qrRRw3e3RkZq CboUOKqjbKgQ+WxLnj18M9MqPac+rSKiU28Ji+Cx3x0yycubFRWewYH+vZ3VNdP8 w/sO1+uBp7rkL9fa2lR1ZmBqCFAXLI2fglhV09JQuOH+VJHe1XVQOBfrJrSwU8Ne rxlSndEew5vldQA1nDOP4BqXKaiYoLbaLuig8y17nEJ+d1MvN8NVzBqwAWVKgihn 0zsD5s+ew9BGZ5JmUwn0QmkAbX9HrQEMLERA7shixaZ4DHwK84HRgOGX6cr01fV6 AHZx7svX11rSEUf5rng2UlClOSCoXg== =Is2Q -----END PGP SIGNATURE----- Merge tag 'mtd/core-fixes-before-nvmem-layouts-for-6.4' into mtd/next Core MTD changes: * Prepare mtd_otp_nvmem_add() to handle -EPROBE_DEFER * Fix error path for nvmem provider * Fix nvmem error reporting * Provide unique name for nvmem device These changes are expected to be pulled before applying nvmem layouts support in order to get a fully working support in all situations. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
This commit is contained in:
commit
1a7537a39b
|
|
@ -888,8 +888,8 @@ static struct nvmem_device *mtd_otp_nvmem_register(struct mtd_info *mtd,
|
|||
|
||||
/* OTP nvmem will be registered on the physical device */
|
||||
config.dev = mtd->dev.parent;
|
||||
config.name = kasprintf(GFP_KERNEL, "%s-%s", dev_name(&mtd->dev), compatible);
|
||||
config.id = NVMEM_DEVID_NONE;
|
||||
config.name = compatible;
|
||||
config.id = NVMEM_DEVID_AUTO;
|
||||
config.owner = THIS_MODULE;
|
||||
config.type = NVMEM_TYPE_OTP;
|
||||
config.root_only = true;
|
||||
|
|
@ -905,7 +905,6 @@ static struct nvmem_device *mtd_otp_nvmem_register(struct mtd_info *mtd,
|
|||
nvmem = NULL;
|
||||
|
||||
of_node_put(np);
|
||||
kfree(config.name);
|
||||
|
||||
return nvmem;
|
||||
}
|
||||
|
|
@ -940,6 +939,7 @@ static int mtd_nvmem_fact_otp_reg_read(void *priv, unsigned int offset,
|
|||
|
||||
static int mtd_otp_nvmem_add(struct mtd_info *mtd)
|
||||
{
|
||||
struct device *dev = mtd->dev.parent;
|
||||
struct nvmem_device *nvmem;
|
||||
ssize_t size;
|
||||
int err;
|
||||
|
|
@ -953,8 +953,8 @@ static int mtd_otp_nvmem_add(struct mtd_info *mtd)
|
|||
nvmem = mtd_otp_nvmem_register(mtd, "user-otp", size,
|
||||
mtd_nvmem_user_otp_reg_read);
|
||||
if (IS_ERR(nvmem)) {
|
||||
dev_err(&mtd->dev, "Failed to register OTP NVMEM device\n");
|
||||
return PTR_ERR(nvmem);
|
||||
err = PTR_ERR(nvmem);
|
||||
goto err;
|
||||
}
|
||||
mtd->otp_user_nvmem = nvmem;
|
||||
}
|
||||
|
|
@ -971,7 +971,6 @@ static int mtd_otp_nvmem_add(struct mtd_info *mtd)
|
|||
nvmem = mtd_otp_nvmem_register(mtd, "factory-otp", size,
|
||||
mtd_nvmem_fact_otp_reg_read);
|
||||
if (IS_ERR(nvmem)) {
|
||||
dev_err(&mtd->dev, "Failed to register OTP NVMEM device\n");
|
||||
err = PTR_ERR(nvmem);
|
||||
goto err;
|
||||
}
|
||||
|
|
@ -983,7 +982,7 @@ static int mtd_otp_nvmem_add(struct mtd_info *mtd)
|
|||
|
||||
err:
|
||||
nvmem_unregister(mtd->otp_user_nvmem);
|
||||
return err;
|
||||
return dev_err_probe(dev, err, "Failed to register OTP NVMEM device\n");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1023,10 +1022,14 @@ int mtd_device_parse_register(struct mtd_info *mtd, const char * const *types,
|
|||
|
||||
mtd_set_dev_defaults(mtd);
|
||||
|
||||
ret = mtd_otp_nvmem_add(mtd);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
if (IS_ENABLED(CONFIG_MTD_PARTITIONED_MASTER)) {
|
||||
ret = add_mtd_device(mtd);
|
||||
if (ret)
|
||||
return ret;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Prefer parsed partitions over driver-provided fallback */
|
||||
|
|
@ -1061,9 +1064,12 @@ int mtd_device_parse_register(struct mtd_info *mtd, const char * const *types,
|
|||
register_reboot_notifier(&mtd->reboot_notifier);
|
||||
}
|
||||
|
||||
ret = mtd_otp_nvmem_add(mtd);
|
||||
|
||||
out:
|
||||
if (ret) {
|
||||
nvmem_unregister(mtd->otp_user_nvmem);
|
||||
nvmem_unregister(mtd->otp_factory_nvmem);
|
||||
}
|
||||
|
||||
if (ret && device_is_registered(&mtd->dev))
|
||||
del_mtd_device(mtd);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user