From: Harvey Harrison <harvey.harrison@gmail.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: "Luis R. Rodriguez" <lrodriguez@atheros.com>,
linville@tuxdriver.com, linux-wireless@vger.kernel.org,
ath9k-devel@lists.ath9k.org,
Senthil Balasubramanian <senthilkumar@atheros.com>,
Jouni Malinen <jouni.malinen@atheros.com>,
Sujith Manoharan <Sujith.Manoharan@atheros.com>,
Vasanthakumar Thiagarajan <vasanth@atheros.com>
Subject: Re: [PATCH 1/4] Add new Atheros IEEE 802.11n ath9k driver
Date: Wed, 23 Jul 2008 13:09:56 -0700 [thread overview]
Message-ID: <1216843796.30386.13.camel@brick> (raw)
In-Reply-To: <1216842238.13587.31.camel@johannes.berg>
On Wed, 2008-07-23 at 21:43 +0200, Johannes Berg wrote:
> Only STA support is currently enabled
> +#ifndef howmany
> +#define howmany(x, y) (((x)+((y)-1))/(y))
> +#endif
It's called DIV_ROUND_UP in kernel.h
> +#define REG_WRITE(_ah, _reg, _val) iowrite32(_val, _ah->ah_sh + _reg)
> +#define REG_READ(_ah, _reg) ioread32(_ah->ah_sh + _reg)
>
> Do you really need macros for this? Static inlines that do
> type-checking are so much nicer.
Or just open-code the ioread/writes
> +#define LE_READ_2(p) \
> + ((u_int16_t) \
> + ((((const u_int8_t *)(p))[0]) | \
> + (((const u_int8_t *)(p))[1] << 8)))
> +
get_unaligned_le16()
> +#define LE_READ_4(p) \
> + ((u_int32_t) \
> + ((((const u_int8_t *)(p))[0]) | \
> + (((const u_int8_t *)(p))[1] << 8) | \
> + (((const u_int8_t *)(p))[2] << 16) | \
> + (((const u_int8_t *)(p))[3] << 24)))
>
get_unaligned_le32()
> Harvey will flame you for that. Rightfully.
;-)
> + /* XXX: spin_lock_bh should not be used here, but sparse bitches
> + * otherwise. We should fix sparse :) */
> + spin_lock_bh(&mcastq->axq_lock);
>
> First and foremost you should write correct code regardless of whether
> sparse complains about it or not. Then let others review it and possibly
> submit a bug report to sparse. This is the wrong way around.
>
Indeed.
> +/* Macro to expand scalars to 64-bit objects */
> +
> +#define ito64(x) (sizeof(x) == 8) ? \
> + (((unsigned long long int)(x)) & (0xff)) : \
> + (sizeof(x) == 16) ? \
> + (((unsigned long long int)(x)) & 0xffff) : \
> + ((sizeof(x) == 32) ? \
> + (((unsigned long long int)(x)) & 0xffffffff) : \
> + (unsigned long long int)(x))
>
> Eww.
Consider using s64/u64 if you really need 64-bits.
Also, for anything shared with the hardware in a fixed endianness,
le16/32/64 and be16/32/64 are your friends. To reiterate what
Johannes mentioned elsewhere.
Cheers,
Harvey
next prev parent reply other threads:[~2008-07-23 20:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-20 2:43 [PATCH 0/4] Atheros IEEE 802.11n ath9k driver Luis R. Rodriguez
2008-07-20 2:45 ` [PATCH 1/4] Add new " Luis R. Rodriguez
2008-07-20 2:45 ` [PATCH] [PATCH 2/4] Remove Atheros 11n devices from ath5k Luis R. Rodriguez
2008-07-20 2:47 ` [PATCH 3/4] list.h: Add list_splice_tail() and list_splice_tail_init() Luis R. Rodriguez
2008-07-20 2:48 ` [PATCH] [PATCH 4/4] list.h: add list_cut_position() Luis R. Rodriguez
2008-07-21 5:12 ` [PATCH] [PATCH 2/4] Remove Atheros 11n devices from ath5k Michael Renzmann
2008-07-21 11:58 ` [ath5k-devel] " Luis R. Rodriguez
2008-07-23 19:43 ` [PATCH 1/4] Add new Atheros IEEE 802.11n ath9k driver Johannes Berg
2008-07-23 20:09 ` Harvey Harrison [this message]
2008-07-24 2:01 ` [ath9k-devel] " Sujith
2008-07-24 3:18 ` Johannes Berg
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=1216843796.30386.13.camel@brick \
--to=harvey.harrison@gmail.com \
--cc=Sujith.Manoharan@atheros.com \
--cc=ath9k-devel@lists.ath9k.org \
--cc=johannes@sipsolutions.net \
--cc=jouni.malinen@atheros.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=lrodriguez@atheros.com \
--cc=senthilkumar@atheros.com \
--cc=vasanth@atheros.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox