b43-dev.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC][PATCH] b43: HT-PHY: allow writing longer tables with a single call
@ 2011-08-11 22:10 Rafał Miłecki
  2011-08-23 13:44 ` Rafał Miłecki
  0 siblings, 1 reply; 3+ messages in thread
From: Rafał Miłecki @ 2011-08-11 22:10 UTC (permalink / raw)
  To: linux-wireless, John W. Linville; +Cc: b43-dev, Rafał Miłecki

Sometime we need to write table which is 2-10 elements long. It's easier
to create such a function instead of defining array every time.

Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
---
 drivers/net/wireless/b43/tables_phy_ht.c |   45 ++++++++++++++++++++++++++++++
 drivers/net/wireless/b43/tables_phy_ht.h |    1 +
 2 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/b43/tables_phy_ht.c b/drivers/net/wireless/b43/tables_phy_ht.c
index 6039386..9681af5 100644
--- a/drivers/net/wireless/b43/tables_phy_ht.c
+++ b/drivers/net/wireless/b43/tables_phy_ht.c
@@ -674,6 +674,51 @@ void b43_httab_write(struct b43_wldev *dev, u32 offset, u32 value)
 	return;
 }
 
+void b43_httab_write_few(struct b43_wldev *dev, u32 offset, size_t num, ...)
+{
+	va_list args;
+	u32 type, value;
+	unsigned int i;
+
+	type = offset & B43_HTTAB_TYPEMASK;
+	offset &= 0xFFFF;
+
+	va_start(args, num);
+	switch (type) {
+	case B43_HTTAB_8BIT:
+		b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset);
+		for (i = 0; i < num; i++) {
+			value = va_arg(args, int);
+			B43_WARN_ON(value & ~0xFF);
+			b43_phy_write(dev, B43_PHY_HT_TABLE_DATALO, value);
+		}
+		break;
+	case B43_HTTAB_16BIT:
+		b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset);
+		for (i = 0; i < num; i++) {
+			value = va_arg(args, int);
+			B43_WARN_ON(value & ~0xFFFF);
+			b43_phy_write(dev, B43_PHY_HT_TABLE_DATALO, value);
+		}
+		break;
+	case B43_HTTAB_32BIT:
+		b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset);
+		for (i = 0; i < num; i++) {
+			value = va_arg(args, int);
+			b43_phy_write(dev, B43_PHY_HT_TABLE_DATAHI,
+				      value >> 16);
+			b43_phy_write(dev, B43_PHY_HT_TABLE_DATALO,
+				      value & 0xFFFF);
+		}
+		break;
+	default:
+		B43_WARN_ON(1);
+	}
+	va_end(args);
+
+	return;
+}
+
 void b43_httab_write_bulk(struct b43_wldev *dev, u32 offset,
 			  unsigned int nr_elements, const void *_data)
 {
diff --git a/drivers/net/wireless/b43/tables_phy_ht.h b/drivers/net/wireless/b43/tables_phy_ht.h
index ea3be38..c68b0fa 100644
--- a/drivers/net/wireless/b43/tables_phy_ht.h
+++ b/drivers/net/wireless/b43/tables_phy_ht.h
@@ -14,6 +14,7 @@ u32 b43_httab_read(struct b43_wldev *dev, u32 offset);
 void b43_httab_read_bulk(struct b43_wldev *dev, u32 offset,
 			 unsigned int nr_elements, void *_data);
 void b43_httab_write(struct b43_wldev *dev, u32 offset, u32 value);
+void b43_httab_write_few(struct b43_wldev *dev, u32 offset, size_t num, ...);
 void b43_httab_write_bulk(struct b43_wldev *dev, u32 offset,
 			  unsigned int nr_elements, const void *_data);
 
-- 
1.7.3.4

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

* [RFC][PATCH] b43: HT-PHY: allow writing longer tables with a single call
  2011-08-11 22:10 [RFC][PATCH] b43: HT-PHY: allow writing longer tables with a single call Rafał Miłecki
@ 2011-08-23 13:44 ` Rafał Miłecki
  2011-08-23 13:53   ` John W. Linville
  0 siblings, 1 reply; 3+ messages in thread
From: Rafał Miłecki @ 2011-08-23 13:44 UTC (permalink / raw)
  To: linux-wireless, John W. Linville; +Cc: b43-dev, Rafał Miłecki

W dniu 12 sierpnia 2011 00:10 u?ytkownik Rafa? Mi?ecki
<zajec5@gmail.com> napisa?:
> Sometime we need to write table which is 2-10 elements long. It's easier
> to create such a function instead of defining array every time.

John, take this one please.

-- 
Rafa?

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

* [RFC][PATCH] b43: HT-PHY: allow writing longer tables with a single call
  2011-08-23 13:44 ` Rafał Miłecki
@ 2011-08-23 13:53   ` John W. Linville
  0 siblings, 0 replies; 3+ messages in thread
From: John W. Linville @ 2011-08-23 13:53 UTC (permalink / raw)
  To: Rafał Miłecki; +Cc: linux-wireless, b43-dev

On Tue, Aug 23, 2011 at 03:44:51PM +0200, Rafa? Mi?ecki wrote:
> W dniu 12 sierpnia 2011 00:10 u?ytkownik Rafa? Mi?ecki
> <zajec5@gmail.com> napisa?:
> > Sometime we need to write table which is 2-10 elements long. It's easier
> > to create such a function instead of defining array every time.
> 
> John, take this one please.

Repost it, without "RFC" in the title.

-- 
John W. Linville		Someday the world will need a hero, and you
linville at tuxdriver.com			might be all we have.  Be ready.

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

end of thread, other threads:[~2011-08-23 13:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-11 22:10 [RFC][PATCH] b43: HT-PHY: allow writing longer tables with a single call Rafał Miłecki
2011-08-23 13:44 ` Rafał Miłecki
2011-08-23 13:53   ` John W. Linville

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).