diff mbox

[V2,1/3] mtd: bcm47xxsflash: keep a reference to the BCMA

Message ID 1362567695-17523-1-git-send-email-zajec5@gmail.com
State New, archived
Headers show

Commit Message

Rafał Miłecki March 6, 2013, 11:01 a.m. UTC
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(+)

Comments

Artem Bityutskiy March 6, 2013, 11:07 a.m. UTC | #1
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?
Rafał Miłecki March 6, 2013, 11:08 a.m. UTC | #2
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.
Rafał Miłecki March 6, 2013, 11:10 a.m. UTC | #3
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;
};
Artem Bityutskiy March 6, 2013, 11:13 a.m. UTC | #4
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?
Artem Bityutskiy March 13, 2013, 10:58 a.m. UTC | #5
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!
Rafał Miłecki March 13, 2013, 11:04 a.m. UTC | #6
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 mbox

Patch

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;