mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-28 07:13:34 +00:00
mtd: bcm47xxnflash: really unregister NAND on device removal
The field bcma_nflash::mtd is never set to be non-zero anywhere, but we test for it in the removal path. So the MTD is never unregistered. Also, we should use nand_release(), not mtd_device_unregister(). Finally, we don't need to use the 'platdata' for stashing/retrieving our *driver* data -- that's what *_{get,set}_drvdata() are for. So, kill off bcm_nflash::mtd, and stash the struct bcm47xxnflash in drvdata instead. Also move the forward declaration of mtd_info up a bit, since struct bcma_sflash should be using it. Caught while inspecting other changes being made to this driver. Compile tested only. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Cc: "Rafał Miłecki" <zajec5@gmail.com> Cc: linux-wireless@vger.kernel.org Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
This commit is contained in:
parent
320092a05d
commit
665d2c2848
2 changed files with 6 additions and 7 deletions
|
@ -49,6 +49,8 @@ static int bcm47xxnflash_probe(struct platform_device *pdev)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
platform_set_drvdata(pdev, b47n);
|
||||||
|
|
||||||
err = mtd_device_parse_register(&b47n->mtd, probes, NULL, NULL, 0);
|
err = mtd_device_parse_register(&b47n->mtd, probes, NULL, NULL, 0);
|
||||||
if (err) {
|
if (err) {
|
||||||
pr_err("Failed to register MTD device: %d\n", err);
|
pr_err("Failed to register MTD device: %d\n", err);
|
||||||
|
@ -60,10 +62,9 @@ static int bcm47xxnflash_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
static int bcm47xxnflash_remove(struct platform_device *pdev)
|
static int bcm47xxnflash_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct bcma_nflash *nflash = dev_get_platdata(&pdev->dev);
|
struct bcm47xxnflash *nflash = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
if (nflash->mtd)
|
nand_release(&nflash->mtd);
|
||||||
mtd_device_unregister(nflash->mtd);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -579,6 +579,8 @@ struct bcma_pflash {
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_BCMA_SFLASH
|
#ifdef CONFIG_BCMA_SFLASH
|
||||||
|
struct mtd_info;
|
||||||
|
|
||||||
struct bcma_sflash {
|
struct bcma_sflash {
|
||||||
bool present;
|
bool present;
|
||||||
u32 window;
|
u32 window;
|
||||||
|
@ -592,13 +594,9 @@ struct bcma_sflash {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_BCMA_NFLASH
|
#ifdef CONFIG_BCMA_NFLASH
|
||||||
struct mtd_info;
|
|
||||||
|
|
||||||
struct bcma_nflash {
|
struct bcma_nflash {
|
||||||
bool present;
|
bool present;
|
||||||
bool boot; /* This is the flash the SoC boots from */
|
bool boot; /* This is the flash the SoC boots from */
|
||||||
|
|
||||||
struct mtd_info *mtd;
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue