All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] b43: make b43_wireless_init bus generic
@ 2011-07-05 21:54 ` Rafał Miłecki
  0 siblings, 0 replies; 12+ messages in thread
From: Rafał Miłecki @ 2011-07-05 21:54 UTC (permalink / raw)
  To: linux-wireless, John W. Linville; +Cc: b43-dev, Rafał Miłecki

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
 drivers/net/wireless/b43/main.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 834df5a..410b77f 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -4959,9 +4959,9 @@ static void b43_wireless_exit(struct b43_bus_dev *dev, struct b43_wl *wl)
 	ieee80211_free_hw(hw);
 }
 
-static struct b43_wl *b43_wireless_init(struct ssb_device *dev)
+static struct b43_wl *b43_wireless_init(struct b43_bus_dev *dev)
 {
-	struct ssb_sprom *sprom = &dev->bus->sprom;
+	struct ssb_sprom *sprom = dev->bus_sprom;
 	struct ieee80211_hw *hw;
 	struct b43_wl *wl;
 
@@ -5003,7 +5003,7 @@ static struct b43_wl *b43_wireless_init(struct ssb_device *dev)
 	skb_queue_head_init(&wl->tx_queue);
 
 	b43info(wl, "Broadcom %04X WLAN found (core revision %u)\n",
-		dev->bus->chip_id, dev->id.revision);
+		dev->chip_id, dev->core_rev);
 	return wl;
 }
 
@@ -5045,7 +5045,7 @@ int b43_ssb_probe(struct ssb_device *sdev, const struct ssb_device_id *id)
 		/* Probing the first core. Must setup common struct b43_wl */
 		first = 1;
 		b43_sprom_fixup(sdev->bus);
-		wl = b43_wireless_init(sdev);
+		wl = b43_wireless_init(dev);
 		if (IS_ERR(wl)) {
 			err = PTR_ERR(wl);
 			goto out;
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 1/2] b43: make b43_wireless_init bus generic
@ 2011-07-05 21:54 ` Rafał Miłecki
  0 siblings, 0 replies; 12+ messages in thread
From: Rafał Miłecki @ 2011-07-05 21:54 UTC (permalink / raw)
  To: linux-wireless, John W. Linville; +Cc: b43-dev, Rafał Miłecki

Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
---
 drivers/net/wireless/b43/main.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 834df5a..410b77f 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -4959,9 +4959,9 @@ static void b43_wireless_exit(struct b43_bus_dev *dev, struct b43_wl *wl)
 	ieee80211_free_hw(hw);
 }
 
-static struct b43_wl *b43_wireless_init(struct ssb_device *dev)
+static struct b43_wl *b43_wireless_init(struct b43_bus_dev *dev)
 {
-	struct ssb_sprom *sprom = &dev->bus->sprom;
+	struct ssb_sprom *sprom = dev->bus_sprom;
 	struct ieee80211_hw *hw;
 	struct b43_wl *wl;
 
@@ -5003,7 +5003,7 @@ static struct b43_wl *b43_wireless_init(struct ssb_device *dev)
 	skb_queue_head_init(&wl->tx_queue);
 
 	b43info(wl, "Broadcom %04X WLAN found (core revision %u)\n",
-		dev->bus->chip_id, dev->id.revision);
+		dev->chip_id, dev->core_rev);
 	return wl;
 }
 
@@ -5045,7 +5045,7 @@ int b43_ssb_probe(struct ssb_device *sdev, const struct ssb_device_id *id)
 		/* Probing the first core. Must setup common struct b43_wl */
 		first = 1;
 		b43_sprom_fixup(sdev->bus);
-		wl = b43_wireless_init(sdev);
+		wl = b43_wireless_init(dev);
 		if (IS_ERR(wl)) {
 			err = PTR_ERR(wl);
 			goto out;
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/2] b43: implement BCMA bus ops
  2011-07-05 21:54 ` Rafał Miłecki
@ 2011-07-05 21:54   ` Rafał Miłecki
  -1 siblings, 0 replies; 12+ messages in thread
From: Rafał Miłecki @ 2011-07-05 21:54 UTC (permalink / raw)
  To: linux-wireless, John W. Linville; +Cc: b43-dev, Rafał Miłecki


Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
 drivers/net/wireless/b43/bus.c  |  100 +++++++++++++++++++++++++++++++++++++++
 drivers/net/wireless/b43/bus.h  |    3 +
 drivers/net/wireless/b43/main.c |    7 +++
 3 files changed, 110 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/b43/bus.c b/drivers/net/wireless/b43/bus.c
index 4200713..f56604f 100644
--- a/drivers/net/wireless/b43/bus.c
+++ b/drivers/net/wireless/b43/bus.c
@@ -23,6 +23,106 @@
 #include "b43.h"
 #include "bus.h"
 
+/* BCMA */
+#ifdef CONFIG_B43_BCMA
+static inline int b43_bus_bcma_bus_may_powerdown(struct b43_bus_dev *dev)
+{
+	return 0; /* bcma_bus_may_powerdown(dev->bdev->bus); */
+}
+static inline int b43_bus_bcma_bus_powerup(struct b43_bus_dev *dev,
+					  bool dynamic_pctl)
+{
+	return 0; /* bcma_bus_powerup(dev->sdev->bus, dynamic_pctl); */
+}
+static inline int b43_bus_bcma_device_is_enabled(struct b43_bus_dev *dev)
+{
+	return bcma_core_is_enabled(dev->bdev);
+}
+static inline void b43_bus_bcma_device_enable(struct b43_bus_dev *dev,
+					     u32 core_specific_flags)
+{
+	bcma_core_enable(dev->bdev, core_specific_flags);
+}
+static inline void b43_bus_bcma_device_disable(struct b43_bus_dev *dev,
+					      u32 core_specific_flags)
+{
+	bcma_core_disable(dev->bdev, core_specific_flags);
+}
+static inline u16 b43_bus_bcma_read16(struct b43_bus_dev *dev, u16 offset)
+{
+	return bcma_read16(dev->bdev, offset);
+}
+static inline u32 b43_bus_bcma_read32(struct b43_bus_dev *dev, u16 offset)
+{
+	return bcma_read32(dev->bdev, offset);
+}
+static inline
+void b43_bus_bcma_write16(struct b43_bus_dev *dev, u16 offset, u16 value)
+{
+	bcma_write16(dev->bdev, offset, value);
+}
+static inline
+void b43_bus_bcma_write32(struct b43_bus_dev *dev, u16 offset, u32 value)
+{
+	bcma_write32(dev->bdev, offset, value);
+}
+static inline
+void b43_bus_bcma_block_read(struct b43_bus_dev *dev, void *buffer,
+			    size_t count, u16 offset, u8 reg_width)
+{
+	bcma_block_read(dev->bdev, buffer, count, offset, reg_width);
+}
+static inline
+void b43_bus_bcma_block_write(struct b43_bus_dev *dev, const void *buffer,
+			     size_t count, u16 offset, u8 reg_width)
+{
+	bcma_block_write(dev->bdev, buffer, count, offset, reg_width);
+}
+
+struct b43_bus_dev *b43_bus_dev_bcma_init(struct bcma_device *core)
+{
+	struct b43_bus_dev *dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+	if (!dev)
+		return NULL;
+
+	dev->bus_type = B43_BUS_BCMA;
+	dev->bdev = core;
+
+	dev->bus_may_powerdown = b43_bus_bcma_bus_may_powerdown;
+	dev->bus_powerup = b43_bus_bcma_bus_powerup;
+	dev->device_is_enabled = b43_bus_bcma_device_is_enabled;
+	dev->device_enable = b43_bus_bcma_device_enable;
+	dev->device_disable = b43_bus_bcma_device_disable;
+
+	dev->read16 = b43_bus_bcma_read16;
+	dev->read32 = b43_bus_bcma_read32;
+	dev->write16 = b43_bus_bcma_write16;
+	dev->write32 = b43_bus_bcma_write32;
+	dev->block_read = b43_bus_bcma_block_read;
+	dev->block_write = b43_bus_bcma_block_write;
+
+	dev->dev = &core->dev;
+	dev->dma_dev = core->dma_dev;
+	dev->irq = core->irq;
+
+	/*
+	dev->board_vendor = core->bus->boardinfo.vendor;
+	dev->board_type = core->bus->boardinfo.type;
+	dev->board_rev = core->bus->boardinfo.rev;
+	*/
+
+	dev->chip_id = core->bus->chipinfo.id;
+	dev->chip_rev = core->bus->chipinfo.rev;
+	dev->chip_pkg = core->bus->chipinfo.pkg;
+
+	dev->bus_sprom = &core->bus->sprom;
+
+	dev->core_id = core->id.id;
+	dev->core_rev = core->id.rev;
+
+	return dev;
+}
+#endif /* CONFIG_B43_BCMA */
 
 /* SSB */
 #ifdef CONFIG_B43_SSB
diff --git a/drivers/net/wireless/b43/bus.h b/drivers/net/wireless/b43/bus.h
index 79a5ab4..a70b7b9 100644
--- a/drivers/net/wireless/b43/bus.h
+++ b/drivers/net/wireless/b43/bus.h
@@ -2,12 +2,14 @@
 #define B43_BUS_H_
 
 enum b43_bus_type {
+	B43_BUS_BCMA,
 	B43_BUS_SSB,
 };
 
 struct b43_bus_dev {
 	enum b43_bus_type bus_type;
 	union {
+		struct bcma_device *bdev;
 		struct ssb_device *sdev;
 	};
 
@@ -57,6 +59,7 @@ static inline bool b43_bus_host_is_sdio(struct b43_bus_dev *dev)
 		dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO);
 }
 
+struct b43_bus_dev *b43_bus_dev_bcma_init(struct bcma_device *core);
 struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev);
 
 #endif /* B43_BUS_H_ */
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 410b77f..b85a973 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -5010,7 +5010,14 @@ static struct b43_wl *b43_wireless_init(struct b43_bus_dev *dev)
 #ifdef CONFIG_B43_BCMA
 static int b43_bcma_probe(struct bcma_device *core)
 {
+	struct b43_bus_dev *dev;
+
+	dev = b43_bus_dev_bcma_init(core);
+	if (!dev)
+		return -ENODEV;
+
 	b43err(NULL, "BCMA is not supported yet!");
+	kfree(dev);
 	return -EOPNOTSUPP;
 }
 
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/2] b43: implement BCMA bus ops
@ 2011-07-05 21:54   ` Rafał Miłecki
  0 siblings, 0 replies; 12+ messages in thread
From: Rafał Miłecki @ 2011-07-05 21:54 UTC (permalink / raw)
  To: linux-wireless, John W. Linville; +Cc: b43-dev, Rafał Miłecki


Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
---
 drivers/net/wireless/b43/bus.c  |  100 +++++++++++++++++++++++++++++++++++++++
 drivers/net/wireless/b43/bus.h  |    3 +
 drivers/net/wireless/b43/main.c |    7 +++
 3 files changed, 110 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/b43/bus.c b/drivers/net/wireless/b43/bus.c
index 4200713..f56604f 100644
--- a/drivers/net/wireless/b43/bus.c
+++ b/drivers/net/wireless/b43/bus.c
@@ -23,6 +23,106 @@
 #include "b43.h"
 #include "bus.h"
 
+/* BCMA */
+#ifdef CONFIG_B43_BCMA
+static inline int b43_bus_bcma_bus_may_powerdown(struct b43_bus_dev *dev)
+{
+	return 0; /* bcma_bus_may_powerdown(dev->bdev->bus); */
+}
+static inline int b43_bus_bcma_bus_powerup(struct b43_bus_dev *dev,
+					  bool dynamic_pctl)
+{
+	return 0; /* bcma_bus_powerup(dev->sdev->bus, dynamic_pctl); */
+}
+static inline int b43_bus_bcma_device_is_enabled(struct b43_bus_dev *dev)
+{
+	return bcma_core_is_enabled(dev->bdev);
+}
+static inline void b43_bus_bcma_device_enable(struct b43_bus_dev *dev,
+					     u32 core_specific_flags)
+{
+	bcma_core_enable(dev->bdev, core_specific_flags);
+}
+static inline void b43_bus_bcma_device_disable(struct b43_bus_dev *dev,
+					      u32 core_specific_flags)
+{
+	bcma_core_disable(dev->bdev, core_specific_flags);
+}
+static inline u16 b43_bus_bcma_read16(struct b43_bus_dev *dev, u16 offset)
+{
+	return bcma_read16(dev->bdev, offset);
+}
+static inline u32 b43_bus_bcma_read32(struct b43_bus_dev *dev, u16 offset)
+{
+	return bcma_read32(dev->bdev, offset);
+}
+static inline
+void b43_bus_bcma_write16(struct b43_bus_dev *dev, u16 offset, u16 value)
+{
+	bcma_write16(dev->bdev, offset, value);
+}
+static inline
+void b43_bus_bcma_write32(struct b43_bus_dev *dev, u16 offset, u32 value)
+{
+	bcma_write32(dev->bdev, offset, value);
+}
+static inline
+void b43_bus_bcma_block_read(struct b43_bus_dev *dev, void *buffer,
+			    size_t count, u16 offset, u8 reg_width)
+{
+	bcma_block_read(dev->bdev, buffer, count, offset, reg_width);
+}
+static inline
+void b43_bus_bcma_block_write(struct b43_bus_dev *dev, const void *buffer,
+			     size_t count, u16 offset, u8 reg_width)
+{
+	bcma_block_write(dev->bdev, buffer, count, offset, reg_width);
+}
+
+struct b43_bus_dev *b43_bus_dev_bcma_init(struct bcma_device *core)
+{
+	struct b43_bus_dev *dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+	if (!dev)
+		return NULL;
+
+	dev->bus_type = B43_BUS_BCMA;
+	dev->bdev = core;
+
+	dev->bus_may_powerdown = b43_bus_bcma_bus_may_powerdown;
+	dev->bus_powerup = b43_bus_bcma_bus_powerup;
+	dev->device_is_enabled = b43_bus_bcma_device_is_enabled;
+	dev->device_enable = b43_bus_bcma_device_enable;
+	dev->device_disable = b43_bus_bcma_device_disable;
+
+	dev->read16 = b43_bus_bcma_read16;
+	dev->read32 = b43_bus_bcma_read32;
+	dev->write16 = b43_bus_bcma_write16;
+	dev->write32 = b43_bus_bcma_write32;
+	dev->block_read = b43_bus_bcma_block_read;
+	dev->block_write = b43_bus_bcma_block_write;
+
+	dev->dev = &core->dev;
+	dev->dma_dev = core->dma_dev;
+	dev->irq = core->irq;
+
+	/*
+	dev->board_vendor = core->bus->boardinfo.vendor;
+	dev->board_type = core->bus->boardinfo.type;
+	dev->board_rev = core->bus->boardinfo.rev;
+	*/
+
+	dev->chip_id = core->bus->chipinfo.id;
+	dev->chip_rev = core->bus->chipinfo.rev;
+	dev->chip_pkg = core->bus->chipinfo.pkg;
+
+	dev->bus_sprom = &core->bus->sprom;
+
+	dev->core_id = core->id.id;
+	dev->core_rev = core->id.rev;
+
+	return dev;
+}
+#endif /* CONFIG_B43_BCMA */
 
 /* SSB */
 #ifdef CONFIG_B43_SSB
diff --git a/drivers/net/wireless/b43/bus.h b/drivers/net/wireless/b43/bus.h
index 79a5ab4..a70b7b9 100644
--- a/drivers/net/wireless/b43/bus.h
+++ b/drivers/net/wireless/b43/bus.h
@@ -2,12 +2,14 @@
 #define B43_BUS_H_
 
 enum b43_bus_type {
+	B43_BUS_BCMA,
 	B43_BUS_SSB,
 };
 
 struct b43_bus_dev {
 	enum b43_bus_type bus_type;
 	union {
+		struct bcma_device *bdev;
 		struct ssb_device *sdev;
 	};
 
@@ -57,6 +59,7 @@ static inline bool b43_bus_host_is_sdio(struct b43_bus_dev *dev)
 		dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO);
 }
 
+struct b43_bus_dev *b43_bus_dev_bcma_init(struct bcma_device *core);
 struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev);
 
 #endif /* B43_BUS_H_ */
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 410b77f..b85a973 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -5010,7 +5010,14 @@ static struct b43_wl *b43_wireless_init(struct b43_bus_dev *dev)
 #ifdef CONFIG_B43_BCMA
 static int b43_bcma_probe(struct bcma_device *core)
 {
+	struct b43_bus_dev *dev;
+
+	dev = b43_bus_dev_bcma_init(core);
+	if (!dev)
+		return -ENODEV;
+
 	b43err(NULL, "BCMA is not supported yet!");
+	kfree(dev);
 	return -EOPNOTSUPP;
 }
 
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/2] b43: implement BCMA bus ops
  2011-07-05 21:54   ` Rafał Miłecki
@ 2011-07-06 15:40     ` Michael Büsch
  -1 siblings, 0 replies; 12+ messages in thread
From: Michael Büsch @ 2011-07-06 15:40 UTC (permalink / raw)
  To: Rafał Miłecki; +Cc: linux-wireless, John W. Linville, b43-dev

On Tue,  5 Jul 2011 23:54:08 +0200
Rafał Miłecki <zajec5@gmail.com> wrote:

> 
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
> ---
>  drivers/net/wireless/b43/bus.c  |  100 +++++++++++++++++++++++++++++++++++++++
>  drivers/net/wireless/b43/bus.h  |    3 +
>  drivers/net/wireless/b43/main.c |    7 +++
>  3 files changed, 110 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/net/wireless/b43/bus.c b/drivers/net/wireless/b43/bus.c
> index 4200713..f56604f 100644
> --- a/drivers/net/wireless/b43/bus.c
> +++ b/drivers/net/wireless/b43/bus.c
> @@ -23,6 +23,106 @@
>  #include "b43.h"
>  #include "bus.h"
>  
> +/* BCMA */
> +#ifdef CONFIG_B43_BCMA
> +static inline int b43_bus_bcma_bus_may_powerdown(struct b43_bus_dev *dev)
> +{
> +	return 0; /* bcma_bus_may_powerdown(dev->bdev->bus); */
> +}

Why is this inline?
You can't inline and take a pointer of the function at the same time.
(The compiler will workaround this by generating multiple versions of
the function, of which at least one is not inline).
So remove it, please. Same below...

> +static inline int b43_bus_bcma_bus_powerup(struct b43_bus_dev *dev,
> +					  bool dynamic_pctl)
> +{
> +	return 0; /* bcma_bus_powerup(dev->sdev->bus, dynamic_pctl); */
> +}
> +static inline int b43_bus_bcma_device_is_enabled(struct b43_bus_dev *dev)
> +{
> +	return bcma_core_is_enabled(dev->bdev);
> +}
> +static inline void b43_bus_bcma_device_enable(struct b43_bus_dev *dev,
> +					     u32 core_specific_flags)
> +{
> +	bcma_core_enable(dev->bdev, core_specific_flags);
> +}
> +static inline void b43_bus_bcma_device_disable(struct b43_bus_dev *dev,
> +					      u32 core_specific_flags)
> +{
> +	bcma_core_disable(dev->bdev, core_specific_flags);
> +}
> +static inline u16 b43_bus_bcma_read16(struct b43_bus_dev *dev, u16 offset)
> +{
> +	return bcma_read16(dev->bdev, offset);
> +}
> +static inline u32 b43_bus_bcma_read32(struct b43_bus_dev *dev, u16 offset)
> +{
> +	return bcma_read32(dev->bdev, offset);
> +}
> +static inline
> +void b43_bus_bcma_write16(struct b43_bus_dev *dev, u16 offset, u16 value)
> +{
> +	bcma_write16(dev->bdev, offset, value);
> +}
> +static inline
> +void b43_bus_bcma_write32(struct b43_bus_dev *dev, u16 offset, u32 value)
> +{
> +	bcma_write32(dev->bdev, offset, value);
> +}
> +static inline
> +void b43_bus_bcma_block_read(struct b43_bus_dev *dev, void *buffer,
> +			    size_t count, u16 offset, u8 reg_width)
> +{
> +	bcma_block_read(dev->bdev, buffer, count, offset, reg_width);
> +}
> +static inline
> +void b43_bus_bcma_block_write(struct b43_bus_dev *dev, const void *buffer,
> +			     size_t count, u16 offset, u8 reg_width)
> +{
> +	bcma_block_write(dev->bdev, buffer, count, offset, reg_width);
> +}
> +
> +struct b43_bus_dev *b43_bus_dev_bcma_init(struct bcma_device *core)
> +{
> +	struct b43_bus_dev *dev = kzalloc(sizeof(*dev), GFP_KERNEL);
> +	if (!dev)
> +		return NULL;
> +
> +	dev->bus_type = B43_BUS_BCMA;
> +	dev->bdev = core;
> +
> +	dev->bus_may_powerdown = b43_bus_bcma_bus_may_powerdown;
> +	dev->bus_powerup = b43_bus_bcma_bus_powerup;
> +	dev->device_is_enabled = b43_bus_bcma_device_is_enabled;
> +	dev->device_enable = b43_bus_bcma_device_enable;
> +	dev->device_disable = b43_bus_bcma_device_disable;
> +
> +	dev->read16 = b43_bus_bcma_read16;
> +	dev->read32 = b43_bus_bcma_read32;
> +	dev->write16 = b43_bus_bcma_write16;
> +	dev->write32 = b43_bus_bcma_write32;
> +	dev->block_read = b43_bus_bcma_block_read;
> +	dev->block_write = b43_bus_bcma_block_write;
> +
> +	dev->dev = &core->dev;
> +	dev->dma_dev = core->dma_dev;
> +	dev->irq = core->irq;
> +
> +	/*
> +	dev->board_vendor = core->bus->boardinfo.vendor;
> +	dev->board_type = core->bus->boardinfo.type;
> +	dev->board_rev = core->bus->boardinfo.rev;
> +	*/
> +
> +	dev->chip_id = core->bus->chipinfo.id;
> +	dev->chip_rev = core->bus->chipinfo.rev;
> +	dev->chip_pkg = core->bus->chipinfo.pkg;
> +
> +	dev->bus_sprom = &core->bus->sprom;
> +
> +	dev->core_id = core->id.id;
> +	dev->core_rev = core->id.rev;
> +
> +	return dev;
> +}
> +#endif /* CONFIG_B43_BCMA */
>  
>  /* SSB */
>  #ifdef CONFIG_B43_SSB
> diff --git a/drivers/net/wireless/b43/bus.h b/drivers/net/wireless/b43/bus.h
> index 79a5ab4..a70b7b9 100644
> --- a/drivers/net/wireless/b43/bus.h
> +++ b/drivers/net/wireless/b43/bus.h
> @@ -2,12 +2,14 @@
>  #define B43_BUS_H_
>  
>  enum b43_bus_type {
> +	B43_BUS_BCMA,
>  	B43_BUS_SSB,
>  };
>  
>  struct b43_bus_dev {
>  	enum b43_bus_type bus_type;
>  	union {
> +		struct bcma_device *bdev;
>  		struct ssb_device *sdev;
>  	};
>  
> @@ -57,6 +59,7 @@ static inline bool b43_bus_host_is_sdio(struct b43_bus_dev *dev)
>  		dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO);
>  }
>  
> +struct b43_bus_dev *b43_bus_dev_bcma_init(struct bcma_device *core);
>  struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev);
>  
>  #endif /* B43_BUS_H_ */
> diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
> index 410b77f..b85a973 100644
> --- a/drivers/net/wireless/b43/main.c
> +++ b/drivers/net/wireless/b43/main.c
> @@ -5010,7 +5010,14 @@ static struct b43_wl *b43_wireless_init(struct b43_bus_dev *dev)
>  #ifdef CONFIG_B43_BCMA
>  static int b43_bcma_probe(struct bcma_device *core)
>  {
> +	struct b43_bus_dev *dev;
> +
> +	dev = b43_bus_dev_bcma_init(core);
> +	if (!dev)
> +		return -ENODEV;
> +
>  	b43err(NULL, "BCMA is not supported yet!");
> +	kfree(dev);
>  	return -EOPNOTSUPP;
>  }
>  


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 2/2] b43: implement BCMA bus ops
@ 2011-07-06 15:40     ` Michael Büsch
  0 siblings, 0 replies; 12+ messages in thread
From: Michael Büsch @ 2011-07-06 15:40 UTC (permalink / raw)
  To: Rafał Miłecki; +Cc: linux-wireless, John W. Linville, b43-dev

On Tue,  5 Jul 2011 23:54:08 +0200
Rafa? Mi?ecki <zajec5@gmail.com> wrote:

> 
> Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
> ---
>  drivers/net/wireless/b43/bus.c  |  100 +++++++++++++++++++++++++++++++++++++++
>  drivers/net/wireless/b43/bus.h  |    3 +
>  drivers/net/wireless/b43/main.c |    7 +++
>  3 files changed, 110 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/net/wireless/b43/bus.c b/drivers/net/wireless/b43/bus.c
> index 4200713..f56604f 100644
> --- a/drivers/net/wireless/b43/bus.c
> +++ b/drivers/net/wireless/b43/bus.c
> @@ -23,6 +23,106 @@
>  #include "b43.h"
>  #include "bus.h"
>  
> +/* BCMA */
> +#ifdef CONFIG_B43_BCMA
> +static inline int b43_bus_bcma_bus_may_powerdown(struct b43_bus_dev *dev)
> +{
> +	return 0; /* bcma_bus_may_powerdown(dev->bdev->bus); */
> +}

Why is this inline?
You can't inline and take a pointer of the function at the same time.
(The compiler will workaround this by generating multiple versions of
the function, of which at least one is not inline).
So remove it, please. Same below...

> +static inline int b43_bus_bcma_bus_powerup(struct b43_bus_dev *dev,
> +					  bool dynamic_pctl)
> +{
> +	return 0; /* bcma_bus_powerup(dev->sdev->bus, dynamic_pctl); */
> +}
> +static inline int b43_bus_bcma_device_is_enabled(struct b43_bus_dev *dev)
> +{
> +	return bcma_core_is_enabled(dev->bdev);
> +}
> +static inline void b43_bus_bcma_device_enable(struct b43_bus_dev *dev,
> +					     u32 core_specific_flags)
> +{
> +	bcma_core_enable(dev->bdev, core_specific_flags);
> +}
> +static inline void b43_bus_bcma_device_disable(struct b43_bus_dev *dev,
> +					      u32 core_specific_flags)
> +{
> +	bcma_core_disable(dev->bdev, core_specific_flags);
> +}
> +static inline u16 b43_bus_bcma_read16(struct b43_bus_dev *dev, u16 offset)
> +{
> +	return bcma_read16(dev->bdev, offset);
> +}
> +static inline u32 b43_bus_bcma_read32(struct b43_bus_dev *dev, u16 offset)
> +{
> +	return bcma_read32(dev->bdev, offset);
> +}
> +static inline
> +void b43_bus_bcma_write16(struct b43_bus_dev *dev, u16 offset, u16 value)
> +{
> +	bcma_write16(dev->bdev, offset, value);
> +}
> +static inline
> +void b43_bus_bcma_write32(struct b43_bus_dev *dev, u16 offset, u32 value)
> +{
> +	bcma_write32(dev->bdev, offset, value);
> +}
> +static inline
> +void b43_bus_bcma_block_read(struct b43_bus_dev *dev, void *buffer,
> +			    size_t count, u16 offset, u8 reg_width)
> +{
> +	bcma_block_read(dev->bdev, buffer, count, offset, reg_width);
> +}
> +static inline
> +void b43_bus_bcma_block_write(struct b43_bus_dev *dev, const void *buffer,
> +			     size_t count, u16 offset, u8 reg_width)
> +{
> +	bcma_block_write(dev->bdev, buffer, count, offset, reg_width);
> +}
> +
> +struct b43_bus_dev *b43_bus_dev_bcma_init(struct bcma_device *core)
> +{
> +	struct b43_bus_dev *dev = kzalloc(sizeof(*dev), GFP_KERNEL);
> +	if (!dev)
> +		return NULL;
> +
> +	dev->bus_type = B43_BUS_BCMA;
> +	dev->bdev = core;
> +
> +	dev->bus_may_powerdown = b43_bus_bcma_bus_may_powerdown;
> +	dev->bus_powerup = b43_bus_bcma_bus_powerup;
> +	dev->device_is_enabled = b43_bus_bcma_device_is_enabled;
> +	dev->device_enable = b43_bus_bcma_device_enable;
> +	dev->device_disable = b43_bus_bcma_device_disable;
> +
> +	dev->read16 = b43_bus_bcma_read16;
> +	dev->read32 = b43_bus_bcma_read32;
> +	dev->write16 = b43_bus_bcma_write16;
> +	dev->write32 = b43_bus_bcma_write32;
> +	dev->block_read = b43_bus_bcma_block_read;
> +	dev->block_write = b43_bus_bcma_block_write;
> +
> +	dev->dev = &core->dev;
> +	dev->dma_dev = core->dma_dev;
> +	dev->irq = core->irq;
> +
> +	/*
> +	dev->board_vendor = core->bus->boardinfo.vendor;
> +	dev->board_type = core->bus->boardinfo.type;
> +	dev->board_rev = core->bus->boardinfo.rev;
> +	*/
> +
> +	dev->chip_id = core->bus->chipinfo.id;
> +	dev->chip_rev = core->bus->chipinfo.rev;
> +	dev->chip_pkg = core->bus->chipinfo.pkg;
> +
> +	dev->bus_sprom = &core->bus->sprom;
> +
> +	dev->core_id = core->id.id;
> +	dev->core_rev = core->id.rev;
> +
> +	return dev;
> +}
> +#endif /* CONFIG_B43_BCMA */
>  
>  /* SSB */
>  #ifdef CONFIG_B43_SSB
> diff --git a/drivers/net/wireless/b43/bus.h b/drivers/net/wireless/b43/bus.h
> index 79a5ab4..a70b7b9 100644
> --- a/drivers/net/wireless/b43/bus.h
> +++ b/drivers/net/wireless/b43/bus.h
> @@ -2,12 +2,14 @@
>  #define B43_BUS_H_
>  
>  enum b43_bus_type {
> +	B43_BUS_BCMA,
>  	B43_BUS_SSB,
>  };
>  
>  struct b43_bus_dev {
>  	enum b43_bus_type bus_type;
>  	union {
> +		struct bcma_device *bdev;
>  		struct ssb_device *sdev;
>  	};
>  
> @@ -57,6 +59,7 @@ static inline bool b43_bus_host_is_sdio(struct b43_bus_dev *dev)
>  		dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO);
>  }
>  
> +struct b43_bus_dev *b43_bus_dev_bcma_init(struct bcma_device *core);
>  struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev);
>  
>  #endif /* B43_BUS_H_ */
> diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
> index 410b77f..b85a973 100644
> --- a/drivers/net/wireless/b43/main.c
> +++ b/drivers/net/wireless/b43/main.c
> @@ -5010,7 +5010,14 @@ static struct b43_wl *b43_wireless_init(struct b43_bus_dev *dev)
>  #ifdef CONFIG_B43_BCMA
>  static int b43_bcma_probe(struct bcma_device *core)
>  {
> +	struct b43_bus_dev *dev;
> +
> +	dev = b43_bus_dev_bcma_init(core);
> +	if (!dev)
> +		return -ENODEV;
> +
>  	b43err(NULL, "BCMA is not supported yet!");
> +	kfree(dev);
>  	return -EOPNOTSUPP;
>  }
>  

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/2] b43: implement BCMA bus ops
  2011-07-06 15:40     ` Michael Büsch
@ 2011-07-06 15:52       ` Rafał Miłecki
  -1 siblings, 0 replies; 12+ messages in thread
From: Rafał Miłecki @ 2011-07-06 15:52 UTC (permalink / raw)
  To: Michael Büsch; +Cc: linux-wireless, John W. Linville, b43-dev

W dniu 6 lipca 2011 17:40 użytkownik Michael Büsch <m@bues.ch> napisał:
> On Tue,  5 Jul 2011 23:54:08 +0200
> Rafał Miłecki <zajec5@gmail.com> wrote:
>
>>
>> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
>> ---
>>  drivers/net/wireless/b43/bus.c  |  100 +++++++++++++++++++++++++++++++++++++++
>>  drivers/net/wireless/b43/bus.h  |    3 +
>>  drivers/net/wireless/b43/main.c |    7 +++
>>  3 files changed, 110 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/net/wireless/b43/bus.c b/drivers/net/wireless/b43/bus.c
>> index 4200713..f56604f 100644
>> --- a/drivers/net/wireless/b43/bus.c
>> +++ b/drivers/net/wireless/b43/bus.c
>> @@ -23,6 +23,106 @@
>>  #include "b43.h"
>>  #include "bus.h"
>>
>> +/* BCMA */
>> +#ifdef CONFIG_B43_BCMA
>> +static inline int b43_bus_bcma_bus_may_powerdown(struct b43_bus_dev *dev)
>> +{
>> +     return 0; /* bcma_bus_may_powerdown(dev->bdev->bus); */
>> +}
>
> Why is this inline?
> You can't inline and take a pointer of the function at the same time.
> (The compiler will workaround this by generating multiple versions of
> the function, of which at least one is not inline).
> So remove it, please. Same below...

I didn't know about any such a limitation.

Just for sure: did you really mean "pointer of the function"? Cause my
function is taking pointer of the struct, not pointer of function.

-- 
Rafał

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 2/2] b43: implement BCMA bus ops
@ 2011-07-06 15:52       ` Rafał Miłecki
  0 siblings, 0 replies; 12+ messages in thread
From: Rafał Miłecki @ 2011-07-06 15:52 UTC (permalink / raw)
  To: Michael Büsch; +Cc: linux-wireless, John W. Linville, b43-dev

W dniu 6 lipca 2011 17:40 u?ytkownik Michael B?sch <m@bues.ch> napisa?:
> On Tue, ?5 Jul 2011 23:54:08 +0200
> Rafa? Mi?ecki <zajec5@gmail.com> wrote:
>
>>
>> Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
>> ---
>> ?drivers/net/wireless/b43/bus.c ?| ?100 +++++++++++++++++++++++++++++++++++++++
>> ?drivers/net/wireless/b43/bus.h ?| ? ?3 +
>> ?drivers/net/wireless/b43/main.c | ? ?7 +++
>> ?3 files changed, 110 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/net/wireless/b43/bus.c b/drivers/net/wireless/b43/bus.c
>> index 4200713..f56604f 100644
>> --- a/drivers/net/wireless/b43/bus.c
>> +++ b/drivers/net/wireless/b43/bus.c
>> @@ -23,6 +23,106 @@
>> ?#include "b43.h"
>> ?#include "bus.h"
>>
>> +/* BCMA */
>> +#ifdef CONFIG_B43_BCMA
>> +static inline int b43_bus_bcma_bus_may_powerdown(struct b43_bus_dev *dev)
>> +{
>> + ? ? return 0; /* bcma_bus_may_powerdown(dev->bdev->bus); */
>> +}
>
> Why is this inline?
> You can't inline and take a pointer of the function at the same time.
> (The compiler will workaround this by generating multiple versions of
> the function, of which at least one is not inline).
> So remove it, please. Same below...

I didn't know about any such a limitation.

Just for sure: did you really mean "pointer of the function"? Cause my
function is taking pointer of the struct, not pointer of function.

-- 
Rafa?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/2] b43: implement BCMA bus ops
  2011-07-06 15:52       ` Rafał Miłecki
@ 2011-07-06 15:58         ` Michael Büsch
  -1 siblings, 0 replies; 12+ messages in thread
From: Michael Büsch @ 2011-07-06 15:58 UTC (permalink / raw)
  To: Rafał Miłecki; +Cc: linux-wireless, John W. Linville, b43-dev

On Wed, 6 Jul 2011 17:52:40 +0200
Rafał Miłecki <zajec5@gmail.com> wrote:
> >> +/* BCMA */
> >> +#ifdef CONFIG_B43_BCMA
> >> +static inline int b43_bus_bcma_bus_may_powerdown(struct b43_bus_dev *dev)
> >> +{
> >> +     return 0; /* bcma_bus_may_powerdown(dev->bdev->bus); */
> >> +}
> >
> > Why is this inline?
> > You can't inline and take a pointer of the function at the same time.
> > (The compiler will workaround this by generating multiple versions of
> > the function, of which at least one is not inline).
> > So remove it, please. Same below...
> 
> I didn't know about any such a limitation.

This is not a limitation. It's just the way it is. You can't take
a reference to an object, that doesn't exist as an independent object.

So in this case, if there are no static callers of your function, the
compiler will simply ignore the inline. However, if there were other static
callers (in addition to the indirect callers through pointer), the compiler
would generate (most likely) an inline version for the static callers
and additionally a non-inline version for the indirect callers.

> Just for sure: did you really mean "pointer of the function"? Cause my
> function is taking pointer of the struct, not pointer of function.

You are taking the pointer to the function (C adds the & for you, so you only
need the function name) and put it into the bus struct.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 2/2] b43: implement BCMA bus ops
@ 2011-07-06 15:58         ` Michael Büsch
  0 siblings, 0 replies; 12+ messages in thread
From: Michael Büsch @ 2011-07-06 15:58 UTC (permalink / raw)
  To: Rafał Miłecki; +Cc: linux-wireless, John W. Linville, b43-dev

On Wed, 6 Jul 2011 17:52:40 +0200
Rafa? Mi?ecki <zajec5@gmail.com> wrote:
> >> +/* BCMA */
> >> +#ifdef CONFIG_B43_BCMA
> >> +static inline int b43_bus_bcma_bus_may_powerdown(struct b43_bus_dev *dev)
> >> +{
> >> + ? ? return 0; /* bcma_bus_may_powerdown(dev->bdev->bus); */
> >> +}
> >
> > Why is this inline?
> > You can't inline and take a pointer of the function at the same time.
> > (The compiler will workaround this by generating multiple versions of
> > the function, of which at least one is not inline).
> > So remove it, please. Same below...
> 
> I didn't know about any such a limitation.

This is not a limitation. It's just the way it is. You can't take
a reference to an object, that doesn't exist as an independent object.

So in this case, if there are no static callers of your function, the
compiler will simply ignore the inline. However, if there were other static
callers (in addition to the indirect callers through pointer), the compiler
would generate (most likely) an inline version for the static callers
and additionally a non-inline version for the indirect callers.

> Just for sure: did you really mean "pointer of the function"? Cause my
> function is taking pointer of the struct, not pointer of function.

You are taking the pointer to the function (C adds the & for you, so you only
need the function name) and put it into the bus struct.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/2] b43: implement BCMA bus ops
  2011-07-06 15:58         ` Michael Büsch
@ 2011-07-06 16:02           ` Rafał Miłecki
  -1 siblings, 0 replies; 12+ messages in thread
From: Rafał Miłecki @ 2011-07-06 16:02 UTC (permalink / raw)
  To: Michael Büsch; +Cc: linux-wireless, John W. Linville, b43-dev

W dniu 6 lipca 2011 17:58 użytkownik Michael Büsch <m@bues.ch> napisał:
> On Wed, 6 Jul 2011 17:52:40 +0200
> Rafał Miłecki <zajec5@gmail.com> wrote:
>> >> +/* BCMA */
>> >> +#ifdef CONFIG_B43_BCMA
>> >> +static inline int b43_bus_bcma_bus_may_powerdown(struct b43_bus_dev *dev)
>> >> +{
>> >> +     return 0; /* bcma_bus_may_powerdown(dev->bdev->bus); */
>> >> +}
>> >
>> > Why is this inline?
>> > You can't inline and take a pointer of the function at the same time.
>> > (The compiler will workaround this by generating multiple versions of
>> > the function, of which at least one is not inline).
>> > So remove it, please. Same below...
>>
>> I didn't know about any such a limitation.
>
> This is not a limitation. It's just the way it is. You can't take
> a reference to an object, that doesn't exist as an independent object.
>
> So in this case, if there are no static callers of your function, the
> compiler will simply ignore the inline. However, if there were other static
> callers (in addition to the indirect callers through pointer), the compiler
> would generate (most likely) an inline version for the static callers
> and additionally a non-inline version for the indirect callers.
>
>> Just for sure: did you really mean "pointer of the function"? Cause my
>> function is taking pointer of the struct, not pointer of function.
>
> You are taking the pointer to the function (C adds the & for you, so you only
> need the function name) and put it into the bus struct.

Ohh, I though you mean getting function pointer as argument of
b43_bus_bcma_bus_may_powerdown
function.

Of course you meant taking pointer in this place:
dev->bus_may_powerdown = b43_bus_bcma_bus_may_powerdown;


Now I see the problem, thanks.

-- 
Rafał

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 2/2] b43: implement BCMA bus ops
@ 2011-07-06 16:02           ` Rafał Miłecki
  0 siblings, 0 replies; 12+ messages in thread
From: Rafał Miłecki @ 2011-07-06 16:02 UTC (permalink / raw)
  To: Michael Büsch; +Cc: linux-wireless, John W. Linville, b43-dev

W dniu 6 lipca 2011 17:58 u?ytkownik Michael B?sch <m@bues.ch> napisa?:
> On Wed, 6 Jul 2011 17:52:40 +0200
> Rafa? Mi?ecki <zajec5@gmail.com> wrote:
>> >> +/* BCMA */
>> >> +#ifdef CONFIG_B43_BCMA
>> >> +static inline int b43_bus_bcma_bus_may_powerdown(struct b43_bus_dev *dev)
>> >> +{
>> >> + ? ? return 0; /* bcma_bus_may_powerdown(dev->bdev->bus); */
>> >> +}
>> >
>> > Why is this inline?
>> > You can't inline and take a pointer of the function at the same time.
>> > (The compiler will workaround this by generating multiple versions of
>> > the function, of which at least one is not inline).
>> > So remove it, please. Same below...
>>
>> I didn't know about any such a limitation.
>
> This is not a limitation. It's just the way it is. You can't take
> a reference to an object, that doesn't exist as an independent object.
>
> So in this case, if there are no static callers of your function, the
> compiler will simply ignore the inline. However, if there were other static
> callers (in addition to the indirect callers through pointer), the compiler
> would generate (most likely) an inline version for the static callers
> and additionally a non-inline version for the indirect callers.
>
>> Just for sure: did you really mean "pointer of the function"? Cause my
>> function is taking pointer of the struct, not pointer of function.
>
> You are taking the pointer to the function (C adds the & for you, so you only
> need the function name) and put it into the bus struct.

Ohh, I though you mean getting function pointer as argument of
b43_bus_bcma_bus_may_powerdown
function.

Of course you meant taking pointer in this place:
dev->bus_may_powerdown = b43_bus_bcma_bus_may_powerdown;


Now I see the problem, thanks.

-- 
Rafa?

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-07-06 16:02 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-05 21:54 [PATCH 1/2] b43: make b43_wireless_init bus generic Rafał Miłecki
2011-07-05 21:54 ` Rafał Miłecki
2011-07-05 21:54 ` [PATCH 2/2] b43: implement BCMA bus ops Rafał Miłecki
2011-07-05 21:54   ` Rafał Miłecki
2011-07-06 15:40   ` Michael Büsch
2011-07-06 15:40     ` Michael Büsch
2011-07-06 15:52     ` Rafał Miłecki
2011-07-06 15:52       ` Rafał Miłecki
2011-07-06 15:58       ` Michael Büsch
2011-07-06 15:58         ` Michael Büsch
2011-07-06 16:02         ` Rafał Miłecki
2011-07-06 16:02           ` Rafał Miłecki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.