Message ID | 1362567695-17523-1-git-send-email-zajec5@gmail.com |
---|---|
State | New, archived |
Headers | show |
On Wed, 2013-03-06 at 12:01 +0100, Rafał Miłecki wrote: > struct bcma_drv_cc; > + > struct bcm47xxsflash { > + union { > + struct bcma_drv_cc *bcma_cc; > + }; Why union?
2013/3/6 Artem Bityutskiy <dedekind1@gmail.com>: > On Wed, 2013-03-06 at 12:01 +0100, Rafał Miłecki wrote: >> struct bcma_drv_cc; >> + >> struct bcm47xxsflash { >> + union { >> + struct bcma_drv_cc *bcma_cc; >> + }; > > Why union? It's about adding support for different buses in the future (ssb) I was describing in the other patch.
2013/3/6 Rafał Miłecki <zajec5@gmail.com>: > 2013/3/6 Artem Bityutskiy <dedekind1@gmail.com>: >> On Wed, 2013-03-06 at 12:01 +0100, Rafał Miłecki wrote: >>> struct bcma_drv_cc; >>> + >>> struct bcm47xxsflash { >>> + union { >>> + struct bcma_drv_cc *bcma_cc; >>> + }; >> >> Why union? > > It's about adding support for different buses in the future (ssb) I > was describing in the other patch. Obvious for me, but just in case: union { struct bcma_drv_cc *bcma_cc; struct ssb_chipcommon *ssb_cc; };
On Wed, 2013-03-06 at 12:08 +0100, Rafał Miłecki wrote: > 2013/3/6 Artem Bityutskiy <dedekind1@gmail.com>: > > On Wed, 2013-03-06 at 12:01 +0100, Rafał Miłecki wrote: > >> struct bcma_drv_cc; > >> + > >> struct bcm47xxsflash { > >> + union { > >> + struct bcma_drv_cc *bcma_cc; > >> + }; > > > > Why union? > > It's about adding support for different buses in the future (ssb) I > was describing in the other patch. Would be a bit cleaner to add the union when you add the second field instead, or at least make sure you add the second field in this series. Otherwise how do I know if you are going to ever send a patch which justifies the union?
On Wed, 2013-03-06 at 12:01 +0100, Rafał Miłecki wrote: > To implement erase and write support we need to "talk" with ChipCommon > BCMA core which serial flash it attached to. > > Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Pushed the 3 to l2-mtd.git, thanks!
2013/3/13 Artem Bityutskiy <dedekind1@gmail.com>: > On Wed, 2013-03-06 at 12:01 +0100, Rafał Miłecki wrote: >> To implement erase and write support we need to "talk" with ChipCommon >> BCMA core which serial flash it attached to. >> >> Signed-off-by: Rafał Miłecki <zajec5@gmail.com> > > Pushed the 3 to l2-mtd.git, thanks! Thank you for your help on getting this cleaned :)
diff --git a/drivers/mtd/devices/bcm47xxsflash.c b/drivers/mtd/devices/bcm47xxsflash.c index 9526628..b22df6d 100644 --- a/drivers/mtd/devices/bcm47xxsflash.c +++ b/drivers/mtd/devices/bcm47xxsflash.c @@ -61,6 +61,8 @@ static int bcm47xxsflash_bcma_probe(struct platform_device *pdev) } sflash->priv = b47s; + b47s->bcma_cc = container_of(sflash, struct bcma_drv_cc, sflash); + b47s->window = sflash->window; b47s->blocksize = sflash->blocksize; b47s->numblocks = sflash->numblocks; diff --git a/drivers/mtd/devices/bcm47xxsflash.h b/drivers/mtd/devices/bcm47xxsflash.h index ebf6f71..9b79723 100644 --- a/drivers/mtd/devices/bcm47xxsflash.h +++ b/drivers/mtd/devices/bcm47xxsflash.h @@ -3,7 +3,13 @@ #include <linux/mtd/mtd.h> +struct bcma_drv_cc; + struct bcm47xxsflash { + union { + struct bcma_drv_cc *bcma_cc; + }; + u32 window; u32 blocksize; u16 numblocks;
To implement erase and write support we need to "talk" with ChipCommon BCMA core which serial flash it attached to. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> --- drivers/mtd/devices/bcm47xxsflash.c | 2 ++ drivers/mtd/devices/bcm47xxsflash.h | 6 ++++++ 2 files changed, 8 insertions(+)