* [PATCH v5] mtd: nand: bcm47xx: use the mtd instance embedded in struct nand_chip
@ 2015-12-18 19:38 Brian Norris
2015-12-18 20:50 ` Boris Brezillon
0 siblings, 1 reply; 3+ messages in thread
From: Brian Norris @ 2015-12-18 19:38 UTC (permalink / raw)
To: linux-mtd
Cc: Boris Brezillon, Brian Norris, Rafał Miłecki,
linux-wireless
From: Boris BREZILLON <boris.brezillon@free-electrons.com>
struct nand_chip now embeds an mtd device. Make use of this mtd instance.
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
Rebased Boris's patch to l2-mtd.git
drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h | 1 -
drivers/mtd/nand/bcm47xxnflash/main.c | 10 ++++++----
drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c | 2 +-
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h b/drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h
index c005a62330b1..8ea75710a854 100644
--- a/drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h
+++ b/drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h
@@ -12,7 +12,6 @@ struct bcm47xxnflash {
struct bcma_drv_cc *cc;
struct nand_chip nand_chip;
- struct mtd_info mtd;
unsigned curr_command;
int curr_page_addr;
diff --git a/drivers/mtd/nand/bcm47xxnflash/main.c b/drivers/mtd/nand/bcm47xxnflash/main.c
index 0b3acc439181..2c9bffb614c5 100644
--- a/drivers/mtd/nand/bcm47xxnflash/main.c
+++ b/drivers/mtd/nand/bcm47xxnflash/main.c
@@ -27,6 +27,7 @@ static int bcm47xxnflash_probe(struct platform_device *pdev)
{
struct bcma_nflash *nflash = dev_get_platdata(&pdev->dev);
struct bcm47xxnflash *b47n;
+ struct mtd_info *mtd;
int err = 0;
b47n = devm_kzalloc(&pdev->dev, sizeof(*b47n), GFP_KERNEL);
@@ -34,8 +35,9 @@ static int bcm47xxnflash_probe(struct platform_device *pdev)
return -ENOMEM;
b47n->nand_chip.priv = b47n;
- b47n->mtd.dev.parent = &pdev->dev;
- b47n->mtd.priv = &b47n->nand_chip; /* Required */
+ mtd = nand_to_mtd(&b47n->nand_chip);
+ mtd->dev.parent = &pdev->dev;
+ mtd->priv = &b47n->nand_chip; /* Required */
b47n->cc = container_of(nflash, struct bcma_drv_cc, nflash);
if (b47n->cc->core->bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) {
@@ -51,7 +53,7 @@ static int bcm47xxnflash_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, b47n);
- err = mtd_device_parse_register(&b47n->mtd, probes, NULL, NULL, 0);
+ err = mtd_device_parse_register(mtd, probes, NULL, NULL, 0);
if (err) {
pr_err("Failed to register MTD device: %d\n", err);
return err;
@@ -64,7 +66,7 @@ static int bcm47xxnflash_remove(struct platform_device *pdev)
{
struct bcm47xxnflash *nflash = platform_get_drvdata(pdev);
- nand_release(&nflash->mtd);
+ nand_release(nand_to_mtd(&nflash->nand_chip));
return 0;
}
diff --git a/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c b/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c
index e5b2e48658c4..652478035a7d 100644
--- a/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c
+++ b/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c
@@ -421,7 +421,7 @@ int bcm47xxnflash_ops_bcm4706_init(struct bcm47xxnflash *b47n)
(w4 << 24 | w3 << 18 | w2 << 12 | w1 << 6 | w0));
/* Scan NAND */
- err = nand_scan(&b47n->mtd, 1);
+ err = nand_scan(nand_to_mtd(&b47n->nand_chip), 1);
if (err) {
pr_err("Could not scan NAND flash: %d\n", err);
goto exit;
--
2.6.0.rc2.230.g3dd15c0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v5] mtd: nand: bcm47xx: use the mtd instance embedded in struct nand_chip
2015-12-18 19:38 [PATCH v5] mtd: nand: bcm47xx: use the mtd instance embedded in struct nand_chip Brian Norris
@ 2015-12-18 20:50 ` Boris Brezillon
2015-12-18 21:01 ` Brian Norris
0 siblings, 1 reply; 3+ messages in thread
From: Boris Brezillon @ 2015-12-18 20:50 UTC (permalink / raw)
To: Brian Norris; +Cc: linux-mtd, Rafał Miłecki, linux-wireless
On Fri, 18 Dec 2015 11:38:18 -0800
Brian Norris <computersforpeace@gmail.com> wrote:
> From: Boris BREZILLON <boris.brezillon@free-electrons.com>
>
> struct nand_chip now embeds an mtd device. Make use of this mtd instance.
>
> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Looks good to me, not we can have both a SoB and an AB tag coming from
the same person, but
Acked-by: Boris Brezillon <boris.brezillon@free-elctrons.com>
> ---
> Rebased Boris's patch to l2-mtd.git
>
> drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h | 1 -
> drivers/mtd/nand/bcm47xxnflash/main.c | 10 ++++++----
> drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c | 2 +-
> 3 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h b/drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h
> index c005a62330b1..8ea75710a854 100644
> --- a/drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h
> +++ b/drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h
> @@ -12,7 +12,6 @@ struct bcm47xxnflash {
> struct bcma_drv_cc *cc;
>
> struct nand_chip nand_chip;
> - struct mtd_info mtd;
>
> unsigned curr_command;
> int curr_page_addr;
> diff --git a/drivers/mtd/nand/bcm47xxnflash/main.c b/drivers/mtd/nand/bcm47xxnflash/main.c
> index 0b3acc439181..2c9bffb614c5 100644
> --- a/drivers/mtd/nand/bcm47xxnflash/main.c
> +++ b/drivers/mtd/nand/bcm47xxnflash/main.c
> @@ -27,6 +27,7 @@ static int bcm47xxnflash_probe(struct platform_device *pdev)
> {
> struct bcma_nflash *nflash = dev_get_platdata(&pdev->dev);
> struct bcm47xxnflash *b47n;
> + struct mtd_info *mtd;
> int err = 0;
>
> b47n = devm_kzalloc(&pdev->dev, sizeof(*b47n), GFP_KERNEL);
> @@ -34,8 +35,9 @@ static int bcm47xxnflash_probe(struct platform_device *pdev)
> return -ENOMEM;
>
> b47n->nand_chip.priv = b47n;
> - b47n->mtd.dev.parent = &pdev->dev;
> - b47n->mtd.priv = &b47n->nand_chip; /* Required */
> + mtd = nand_to_mtd(&b47n->nand_chip);
> + mtd->dev.parent = &pdev->dev;
> + mtd->priv = &b47n->nand_chip; /* Required */
> b47n->cc = container_of(nflash, struct bcma_drv_cc, nflash);
>
> if (b47n->cc->core->bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) {
> @@ -51,7 +53,7 @@ static int bcm47xxnflash_probe(struct platform_device *pdev)
>
> platform_set_drvdata(pdev, b47n);
>
> - err = mtd_device_parse_register(&b47n->mtd, probes, NULL, NULL, 0);
> + err = mtd_device_parse_register(mtd, probes, NULL, NULL, 0);
> if (err) {
> pr_err("Failed to register MTD device: %d\n", err);
> return err;
> @@ -64,7 +66,7 @@ static int bcm47xxnflash_remove(struct platform_device *pdev)
> {
> struct bcm47xxnflash *nflash = platform_get_drvdata(pdev);
>
> - nand_release(&nflash->mtd);
> + nand_release(nand_to_mtd(&nflash->nand_chip));
>
> return 0;
> }
> diff --git a/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c b/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c
> index e5b2e48658c4..652478035a7d 100644
> --- a/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c
> +++ b/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c
> @@ -421,7 +421,7 @@ int bcm47xxnflash_ops_bcm4706_init(struct bcm47xxnflash *b47n)
> (w4 << 24 | w3 << 18 | w2 << 12 | w1 << 6 | w0));
>
> /* Scan NAND */
> - err = nand_scan(&b47n->mtd, 1);
> + err = nand_scan(nand_to_mtd(&b47n->nand_chip), 1);
> if (err) {
> pr_err("Could not scan NAND flash: %d\n", err);
> goto exit;
--
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v5] mtd: nand: bcm47xx: use the mtd instance embedded in struct nand_chip
2015-12-18 20:50 ` Boris Brezillon
@ 2015-12-18 21:01 ` Brian Norris
0 siblings, 0 replies; 3+ messages in thread
From: Brian Norris @ 2015-12-18 21:01 UTC (permalink / raw)
To: Boris Brezillon; +Cc: linux-mtd, Rafał Miłecki, linux-wireless
On Fri, Dec 18, 2015 at 09:50:00PM +0100, Boris Brezillon wrote:
> On Fri, 18 Dec 2015 11:38:18 -0800
> Brian Norris <computersforpeace@gmail.com> wrote:
>
> > From: Boris BREZILLON <boris.brezillon@free-electrons.com>
> >
> > struct nand_chip now embeds an mtd device. Make use of this mtd instance.
> >
> > Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> > Signed-off-by: Brian Norris <computersforpeace@gmail.com>
>
> Looks good to me, not we can have both a SoB and an AB tag coming from
> the same person, but
>
> Acked-by: Boris Brezillon <boris.brezillon@free-elctrons.com>
Good point. I guess the ack can just assure me I didn't screw up your
work *too* badly :)
Applied without the duplicate tag
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-12-18 21:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-18 19:38 [PATCH v5] mtd: nand: bcm47xx: use the mtd instance embedded in struct nand_chip Brian Norris
2015-12-18 20:50 ` Boris Brezillon
2015-12-18 21:01 ` Brian Norris
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).