* [PATCH v3 3/4] ath5k: define ath_common ops
@ 2009-09-14 9:07 Luis R. Rodriguez
2009-09-14 9:10 ` Jiri Slaby
2009-09-14 18:12 ` Bob Copeland
0 siblings, 2 replies; 3+ messages in thread
From: Luis R. Rodriguez @ 2009-09-14 9:07 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, devel, ath9k-devel, Luis R. Rodriguez
Only common ath read/write ops go through the common ops.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
Here's a respin of 3/4 based on Jiri's comments.
drivers/net/wireless/ath/ath5k/ath5k.h | 16 ++++++++++------
drivers/net/wireless/ath/ath5k/base.c | 17 +++++++++++++++++
drivers/net/wireless/ath/ath5k/base.h | 11 -----------
3 files changed, 27 insertions(+), 17 deletions(-)
diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h
index 29ce868..1416562 100644
--- a/drivers/net/wireless/ath/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
@@ -1315,17 +1315,21 @@ 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);
}
-/*
- * 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);
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 3cb0752..13bbf3d 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 ath5k_hw_reg_read(ah, reg_offset);
+}
+
+static void ath5k_iowrite32(void *hw_priv, u32 val, u32 reg_offset)
+{
+ struct ath5k_hw *ah = (struct ath5k_hw *) hw_priv;
+ ath5k_hw_reg_write(ah, val, reg_offset);
+}
+
+static const 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
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v3 3/4] ath5k: define ath_common ops
2009-09-14 9:07 [PATCH v3 3/4] ath5k: define ath_common ops Luis R. Rodriguez
@ 2009-09-14 9:10 ` Jiri Slaby
2009-09-14 18:12 ` Bob Copeland
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2009-09-14 9:10 UTC (permalink / raw)
To: Luis R. Rodriguez; +Cc: linville, devel, ath9k-devel, linux-wireless
On 09/14/2009 11:07 AM, Luis R. Rodriguez wrote:
> Only common ath read/write ops go through the common ops.
>
> Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
> ---
>
> Here's a respin of 3/4 based on Jiri's comments.
Thanks.
Acked-by: Jiri Slaby <jirislaby@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3 3/4] ath5k: define ath_common ops
2009-09-14 9:07 [PATCH v3 3/4] ath5k: define ath_common ops Luis R. Rodriguez
2009-09-14 9:10 ` Jiri Slaby
@ 2009-09-14 18:12 ` Bob Copeland
1 sibling, 0 replies; 3+ messages in thread
From: Bob Copeland @ 2009-09-14 18:12 UTC (permalink / raw)
To: Luis R. Rodriguez; +Cc: linville, linux-wireless, devel, ath9k-devel
On Mon, Sep 14, 2009 at 5:07 AM, Luis R. Rodriguez
<lrodriguez@atheros.com> wrote:
> Only common ath read/write ops go through the common ops.
>
> Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Thanks Luis, looks good to me too.
--
Bob Copeland %% www.bobcopeland.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-09-14 18:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-14 9:07 [PATCH v3 3/4] ath5k: define ath_common ops Luis R. Rodriguez
2009-09-14 9:10 ` Jiri Slaby
2009-09-14 18:12 ` Bob Copeland
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).