Michal Kazior <michal.kaz...@tieto.com> writes: > On 18/04/13 10:08, Janusz Dziedzic wrote: >> Add ath10k_bmi_read32/ath10k_bmi_write32 functions >> and use them in core layer when read32/write32. >> >> Signed-off-by: Janusz Dziedzic <janusz.dzied...@tieto.com> >> --- >> drivers/net/wireless/ath/ath10k/bmi.h | 10 ++++++++++ >> drivers/net/wireless/ath/ath10k/core.c | 24 ++++++++++++------------ >> 2 files changed, 22 insertions(+), 12 deletions(-) >> >> diff --git a/drivers/net/wireless/ath/ath10k/bmi.h >> b/drivers/net/wireless/ath/ath10k/bmi.h >> index e2bd70b..2035d5d 100644 >> --- a/drivers/net/wireless/ath/ath10k/bmi.h >> +++ b/drivers/net/wireless/ath/ath10k/bmi.h >> @@ -191,6 +191,16 @@ int ath10k_bmi_read_memory(struct ath10k *ar, u32 >> address, >> void *buffer, u32 length); >> int ath10k_bmi_write_memory(struct ath10k *ar, u32 address, >> const void *buffer, u32 length); >> +static inline int ath10k_bmi_read32(struct ath10k *ar, u32 address, >> + void *buffer) >> +{ >> + return ath10k_bmi_read_memory(ar, address, buffer, sizeof(u32)); >> +} >> +static inline int ath10k_bmi_write32(struct ath10k *ar, u32 address, >> + void *buffer) >> +{ >> + return ath10k_bmi_write_memory(ar, address, buffer, sizeof(u32)); >> +} > > I think these functions should do endianess converions so it is not > necessary at call sites anymore. > > Also the buffer could be a u32* instead of a void* implicitly stating > what the functions are meant to do.
Yeah, the idea is that the wrappers simplify writing to registers instead of duplicating the same code in every register access. I think we can just follow what ath6kl does: #define ath6kl_bmi_write_hi32(ar, item, val) \ ({ \ u32 addr; \ __le32 v; \ \ addr = ath6kl_get_hi_item_addr(ar, HI_ITEM(item)); \ v = cpu_to_le32(val); \ ath6kl_bmi_write(ar, addr, (u8 *) &v, sizeof(v)); \ }) #define ath6kl_bmi_read_hi32(ar, item, val) \ ({ \ u32 addr, *check_type = val; \ __le32 tmp; \ int ret; \ \ (void) (check_type == val); \ addr = ath6kl_get_hi_item_addr(ar, HI_ITEM(item)); \ ret = ath6kl_bmi_read(ar, addr, (u8 *) &tmp, 4); \ *val = le32_to_cpu(tmp); \ ret; \ }) -- Kalle Valo _______________________________________________ ath9k-devel mailing list ath9k-devel@lists.ath9k.org https://lists.ath9k.org/mailman/listinfo/ath9k-devel