All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <lrodriguez@atheros.com>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org, ath9k-devel@lists.ath9k.org,
	devel@linuxdriverproject.org,
	"Luis R. Rodriguez" <lrodriguez@atheros.com>
Subject: [PATCH 3/4] ath5k: define ath_common ops
Date: Thu, 10 Sep 2009 21:34:54 -0400	[thread overview]
Message-ID: <1252632895-11914-4-git-send-email-lrodriguez@atheros.com> (raw)
In-Reply-To: <1252632895-11914-1-git-send-email-lrodriguez@atheros.com>

All read/write ops now go through the common ops.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath/ath5k/ath5k.h |   20 ++++++++++++--------
 drivers/net/wireless/ath/ath5k/base.c  |   17 +++++++++++++++++
 drivers/net/wireless/ath/ath5k/base.h  |   11 -----------
 3 files changed, 29 insertions(+), 19 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h
index 29ce868..997101b 100644
--- a/drivers/net/wireless/ath/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
@@ -1315,20 +1315,24 @@ static inline unsigned int ath5k_hw_clocktoh(unsigned int clock, bool turbo)
 	return turbo ? (clock / 80) : (clock / 40);
 }
 
-/*
- * Read from a register
- */
+static inline struct ath_common *ath5k_hw_common(struct ath5k_hw *ah)
+{
+        return &ah->common;
+}
+
+static inline struct ath_regulatory *ath5k_hw_regulatory(struct ath5k_hw *ah)
+{
+        return &(ath5k_hw_common(ah)->regulatory);
+}
+
 static inline u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
 {
-	return ioread32(ah->ah_iobase + reg);
+	return ath5k_hw_common(ah)->ops->read(ah, reg);
 }
 
-/*
- * Write to a register
- */
 static inline void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
 {
-	iowrite32(val, ah->ah_iobase + reg);
+	ath5k_hw_common(ah)->ops->write(ah, reg, val);
 }
 
 #if defined(_ATH5K_RESET) || defined(_ATH5K_PHY)
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 3cb0752..535ea72 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -437,6 +437,22 @@ ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val)
 
 	return name;
 }
+static unsigned int ath5k_ioread32(void *hw_priv, u32 reg_offset)
+{
+	struct ath5k_hw *ah = (struct ath5k_hw *) hw_priv;
+	return ioread32(ah->ah_iobase + reg_offset);
+}
+
+static void ath5k_iowrite32(void *hw_priv, u32 reg_offset, u32 val)
+{
+	struct ath5k_hw *ah = (struct ath5k_hw *) hw_priv;
+	iowrite32(val, ah->ah_iobase + reg_offset);
+}
+
+static struct ath_ops ath5k_common_ops = {
+	.read = ath5k_ioread32,
+	.write = ath5k_iowrite32,
+};
 
 static int __devinit
 ath5k_pci_probe(struct pci_dev *pdev,
@@ -576,6 +592,7 @@ ath5k_pci_probe(struct pci_dev *pdev,
 	sc->ah->ah_sc = sc;
 	sc->ah->ah_iobase = sc->iobase;
 	common = ath5k_hw_common(sc->ah);
+	common->ops = &ath5k_common_ops;
 	common->cachelsz = csz << 2; /* convert to bytes */
 
 	/* Initialize device */
diff --git a/drivers/net/wireless/ath/ath5k/base.h b/drivers/net/wireless/ath/ath5k/base.h
index 005d25f..b14ba07 100644
--- a/drivers/net/wireless/ath/ath5k/base.h
+++ b/drivers/net/wireless/ath/ath5k/base.h
@@ -201,15 +201,4 @@ struct ath5k_softc {
 #define ath5k_hw_hasveol(_ah) \
 	(ath5k_hw_get_capability(_ah, AR5K_CAP_VEOL, 0, NULL) == 0)
 
-static inline struct ath_common *ath5k_hw_common(struct ath5k_hw *ah)
-{
-	return &ah->common;
-}
-
-static inline struct ath_regulatory *ath5k_hw_regulatory(struct ath5k_hw *ah)
-{
-	return &(ath5k_hw_common(ah)->regulatory);
-
-}
-
 #endif
-- 
1.6.3.3


WARNING: multiple messages have this Message-ID (diff)
From: Luis R. Rodriguez <lrodriguez@atheros.com>
To: ath9k-devel@lists.ath9k.org
Subject: [ath9k-devel] [PATCH 3/4] ath5k: define ath_common ops
Date: Thu, 10 Sep 2009 21:34:54 -0400	[thread overview]
Message-ID: <1252632895-11914-4-git-send-email-lrodriguez@atheros.com> (raw)
In-Reply-To: <1252632895-11914-1-git-send-email-lrodriguez@atheros.com>

All read/write ops now go through the common ops.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath/ath5k/ath5k.h |   20 ++++++++++++--------
 drivers/net/wireless/ath/ath5k/base.c  |   17 +++++++++++++++++
 drivers/net/wireless/ath/ath5k/base.h  |   11 -----------
 3 files changed, 29 insertions(+), 19 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h
index 29ce868..997101b 100644
--- a/drivers/net/wireless/ath/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
@@ -1315,20 +1315,24 @@ static inline unsigned int ath5k_hw_clocktoh(unsigned int clock, bool turbo)
 	return turbo ? (clock / 80) : (clock / 40);
 }
 
-/*
- * Read from a register
- */
+static inline struct ath_common *ath5k_hw_common(struct ath5k_hw *ah)
+{
+        return &ah->common;
+}
+
+static inline struct ath_regulatory *ath5k_hw_regulatory(struct ath5k_hw *ah)
+{
+        return &(ath5k_hw_common(ah)->regulatory);
+}
+
 static inline u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
 {
-	return ioread32(ah->ah_iobase + reg);
+	return ath5k_hw_common(ah)->ops->read(ah, reg);
 }
 
-/*
- * Write to a register
- */
 static inline void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
 {
-	iowrite32(val, ah->ah_iobase + reg);
+	ath5k_hw_common(ah)->ops->write(ah, reg, val);
 }
 
 #if defined(_ATH5K_RESET) || defined(_ATH5K_PHY)
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 3cb0752..535ea72 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -437,6 +437,22 @@ ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val)
 
 	return name;
 }
+static unsigned int ath5k_ioread32(void *hw_priv, u32 reg_offset)
+{
+	struct ath5k_hw *ah = (struct ath5k_hw *) hw_priv;
+	return ioread32(ah->ah_iobase + reg_offset);
+}
+
+static void ath5k_iowrite32(void *hw_priv, u32 reg_offset, u32 val)
+{
+	struct ath5k_hw *ah = (struct ath5k_hw *) hw_priv;
+	iowrite32(val, ah->ah_iobase + reg_offset);
+}
+
+static struct ath_ops ath5k_common_ops = {
+	.read = ath5k_ioread32,
+	.write = ath5k_iowrite32,
+};
 
 static int __devinit
 ath5k_pci_probe(struct pci_dev *pdev,
@@ -576,6 +592,7 @@ ath5k_pci_probe(struct pci_dev *pdev,
 	sc->ah->ah_sc = sc;
 	sc->ah->ah_iobase = sc->iobase;
 	common = ath5k_hw_common(sc->ah);
+	common->ops = &ath5k_common_ops;
 	common->cachelsz = csz << 2; /* convert to bytes */
 
 	/* Initialize device */
diff --git a/drivers/net/wireless/ath/ath5k/base.h b/drivers/net/wireless/ath/ath5k/base.h
index 005d25f..b14ba07 100644
--- a/drivers/net/wireless/ath/ath5k/base.h
+++ b/drivers/net/wireless/ath/ath5k/base.h
@@ -201,15 +201,4 @@ struct ath5k_softc {
 #define ath5k_hw_hasveol(_ah) \
 	(ath5k_hw_get_capability(_ah, AR5K_CAP_VEOL, 0, NULL) == 0)
 
-static inline struct ath_common *ath5k_hw_common(struct ath5k_hw *ah)
-{
-	return &ah->common;
-}
-
-static inline struct ath_regulatory *ath5k_hw_regulatory(struct ath5k_hw *ah)
-{
-	return &(ath5k_hw_common(ah)->regulatory);
-
-}
-
 #endif
-- 
1.6.3.3

  parent reply	other threads:[~2009-09-11  1:34 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-11  1:34 [PATCH 0/4] atheros: implement common read/write ops Luis R. Rodriguez
2009-09-11  1:34 ` [ath9k-devel] " Luis R. Rodriguez
2009-09-11  1:34 ` [PATCH 1/4] atheros/ath9k: add common read/write ops and port ath9k to use it Luis R. Rodriguez
2009-09-11  1:34   ` [ath9k-devel] " Luis R. Rodriguez
2009-09-11  1:34 ` [PATCH 2/4] ath5k: allocate ath5k_hw prior to initializing hw Luis R. Rodriguez
2009-09-11  1:34   ` [ath9k-devel] " Luis R. Rodriguez
2009-09-11  1:34 ` Luis R. Rodriguez [this message]
2009-09-11  1:34   ` [ath9k-devel] [PATCH 3/4] ath5k: define ath_common ops Luis R. Rodriguez
2009-09-11  1:42   ` Bob Copeland
2009-09-11  1:42     ` [ath9k-devel] " Bob Copeland
2009-09-11  1:46     ` Luis R. Rodriguez
2009-09-11  1:46       ` [ath9k-devel] " Luis R. Rodriguez
2009-09-11  6:16   ` Nick Kossifidis
2009-09-11  6:16     ` [ath9k-devel] " Nick Kossifidis
2009-09-11  6:46     ` Jiri Slaby
2009-09-11  6:46       ` [ath9k-devel] " Jiri Slaby
2009-09-11  7:23       ` Luis R. Rodriguez
2009-09-11  7:23         ` [ath9k-devel] " Luis R. Rodriguez
2009-09-11 11:35         ` Bob Copeland
2009-09-11 11:35           ` [ath9k-devel] " Bob Copeland
2009-09-11 17:53           ` Luis R. Rodriguez
2009-09-11 17:53             ` [ath9k-devel] " Luis R. Rodriguez
2009-09-11 14:24         ` Linus Torvalds
2009-09-11 14:24           ` [ath9k-devel] " Linus Torvalds
2009-09-11 17:43           ` Luis R. Rodriguez
2009-09-11 17:43             ` [ath9k-devel] " Luis R. Rodriguez
2009-09-11 20:11             ` Linus Torvalds
2009-09-11 20:11               ` [ath9k-devel] " Linus Torvalds
2009-09-12 11:53         ` Jiri Slaby
2009-09-12 11:53           ` [ath9k-devel] " Jiri Slaby
2009-09-13  0:56           ` Luis R. Rodriguez
2009-09-13  0:56             ` [ath9k-devel] " Luis R. Rodriguez
2009-09-11  1:34 ` [PATCH 4/4] atheros: define shared bssidmask setting Luis R. Rodriguez
2009-09-11  1:34   ` [ath9k-devel] " Luis R. Rodriguez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1252632895-11914-4-git-send-email-lrodriguez@atheros.com \
    --to=lrodriguez@atheros.com \
    --cc=ath9k-devel@lists.ath9k.org \
    --cc=devel@linuxdriverproject.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.