On Wed, 2012-02-29 at 19:41 +0200, Kalle Valo wrote: > On 02/29/2012 07:37 PM, Joe Perches wrote: > > On Wed, 2012-02-29 at 19:18 +0200, Kalle Valo wrote: > >> Here are quite a few checkpatch fixes and other cleanups. > >> > >> Especially I would like to people review these two macros, they ended up > >> a bit too clever and I'm sure there are issues: > >> > >> #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; \ > >> }) > > > > Why not just make these functions? > > Because of the HI_ITEM() macro I can't pass the item parameter to a > function: > > #define HI_ITEM(item) offsetof(struct host_interest, item) Perhaps something like: void _ath6kl_bmi_write_hi32(struct ath6kl ar, size_t offset, u32 *val) { u32 addr; __le32 v; addr = ath6kl_get_hi_item_addr(ar, offset); v = cpu_to_le32(*val); ath6kl_bmi_write(ar, addr, (u8 *)&v, sizeof(v)); } #define ath6kl_bmi_write_hi32(ar, item, val) \ _ath6kl_bmi_write_hi32(ar, HI_ITEM(item), &(val)) etc... -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html