Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 153796
b: refs/heads/master
c: bf95efd
h: refs/heads/master
v: v3
  • Loading branch information
H Hartley Sweeten authored and David Woodhouse committed Jun 5, 2009
1 parent 7e6c680 commit d3def60
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4d964824ec826ed97bdde10bc8d8c4ce10540a98
refs/heads/master: bf95efd41b1a760128eb25402791b0a4941eb655
13 changes: 11 additions & 2 deletions trunk/drivers/mtd/nand/plat_nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ static int __devinit plat_nand_probe(struct platform_device *pdev)

platform_set_drvdata(pdev, data);

/* Handle any platform specific setup */
if (pdata->ctrl.probe) {
res = pdata->ctrl.probe(pdev);
if (res)
goto out;
}

/* Scan to find existance of the device */
if (nand_scan(&data->mtd, 1)) {
res = -ENXIO;
Expand Down Expand Up @@ -101,6 +108,8 @@ static int __devinit plat_nand_probe(struct platform_device *pdev)

nand_release(&data->mtd);
out:
if (pdata->ctrl.remove)
pdata->ctrl.remove(pdev);
platform_set_drvdata(pdev, NULL);
iounmap(data->io_base);
kfree(data);
Expand All @@ -113,15 +122,15 @@ static int __devinit plat_nand_probe(struct platform_device *pdev)
static int __devexit plat_nand_remove(struct platform_device *pdev)
{
struct plat_nand_data *data = platform_get_drvdata(pdev);
#ifdef CONFIG_MTD_PARTITIONS
struct platform_nand_data *pdata = pdev->dev.platform_data;
#endif

nand_release(&data->mtd);
#ifdef CONFIG_MTD_PARTITIONS
if (data->parts && data->parts != pdata->chip.partitions)
kfree(data->parts);
#endif
if (pdata->ctrl.remove)
pdata->ctrl.remove(pdev);
iounmap(data->io_base);
kfree(data);

Expand Down
7 changes: 7 additions & 0 deletions trunk/include/linux/mtd/nand.h
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,13 @@ struct platform_nand_chip {
void *priv;
};

/* Keep gcc happy */
struct platform_device;

/**
* struct platform_nand_ctrl - controller level device structure
* @probe: platform specific function to probe/setup hardware
* @remove: platform specific function to remove/teardown hardware
* @hwcontrol: platform specific hardware control structure
* @dev_ready: platform specific function to read ready/busy pin
* @select_chip: platform specific chip select function
Expand All @@ -591,6 +596,8 @@ struct platform_nand_chip {
* All fields are optional and depend on the hardware driver requirements
*/
struct platform_nand_ctrl {
int (*probe)(struct platform_device *pdev);
void (*remove)(struct platform_device *pdev);
void (*hwcontrol)(struct mtd_info *mtd, int cmd);
int (*dev_ready)(struct mtd_info *mtd);
void (*select_chip)(struct mtd_info *mtd, int chip);
Expand Down

0 comments on commit d3def60

Please sign in to comment.