mtd: elbc nand: use drvdata to only remove the relevant chip
Subsystems (2)
PATCH 1/1 mtd: elbc nand: use drvdata to only remove the relevant chip
Previously the remove method was looping and removing all chips, which is obviously not the right thing to do -- left over from when the driver was organized differently and that was the remove method for the entire controller. This would result in bad things happening if you have more than one NAND chip, and remove the module.
This also fixes priv->dev to properly point to the chip's device rather than the controller's. Until now priv->dev was only used for error/debug prints (and it's an improvement there), so this shouldn't break anything.
--- drivers/mtd/nand/fsl_elbc_nand.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/mtd/nand/fsl_elbc_nand.c +5 -5
@@ -916,7 +916,8 @@ static int __devinit fsl_elbc_nand_probe(struct platform_device *pdev) elbc_fcm_ctrl->chips[bank] = priv; priv->bank = bank; priv->ctrl = fsl_lbc_ctrl_dev; - priv->dev = dev; + priv->dev = &pdev->dev; +dev_set_drvdata (priv->dev, priv); priv->vbase =ioremap (res.start,resource_size (&res));if (!priv->vbase) {
@@ -963,11 +964,10 @@ err:static int fsl_elbc_nand_remove (struct platform_device *pdev) { -int i;struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = fsl_lbc_ctrl_dev->nand; -for (i =0 ; i <MAX_BANKS ; i++) -if (elbc_fcm_ctrl->chips[i]) -fsl_elbc_chip_remove (elbc_fcm_ctrl->chips[i]); +struct fsl_elbc_mtd *priv =dev_get_drvdata (&pdev->dev); + +fsl_elbc_chip_remove (priv);mutex_lock (&fsl_elbc_nand_mutex); elbc_fcm_ctrl->counter--;
Signature · 1 line
1.7.5.4
Artem Bityutskiy
AppliedQuoted 11 lines · Scott Wood
Previously the remove method was looping and removing all chips, which is obviously not the right thing to do -- left over from when the driver was organized differently and that was the remove method for the entire controller. This would result in bad things happening if you have more than one NAND chip, and remove the module.
This also fixes
priv->devto properly point to the chip's device rather than the controller's. Until nowpriv->devwas only used for error/debug prints (and it's an improvement there), so this shouldn't break anything.Signed-off-by Scott Wood <[email protected]>
Pushed to l2-mtd.git, thanks!
Signature · 2 lines
Best Regards, Artem Bityutskiy