Linux wireless drivers development
 help / color / mirror / Atom feed
From: Bruno Randolf <br1@einfach.org>
To: Tomas Winkler <tomas.winkler@intel.com>
Cc: linville@tuxdriver.com, johannes@sipsolutions.net,
	yi.zhu@intel.com, linux-wireless@vger.kernel.org
Subject: Re: [PATCH 1/1] iwlwif: remove compilation warnings iwl_add_radiotap
Date: Thu, 10 Jul 2008 13:42:36 +0200	[thread overview]
Message-ID: <200807101342.36920.br1@einfach.org> (raw)
In-Reply-To: <1215689322-25017-1-git-send-email-tomas.winkler@intel.com>

On Thursday 10 July 2008 13:28:42 Tomas Winkler wrote:
> Use directly put_unaligned_leX instead of put_unaligned(cpu_to_leX
>
> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>

hi!

what about using the generic function to add the radiotap header from 
mac80211? it should be flexible enough to handle all devices by now.

bruno

> ---
>  drivers/net/wireless/iwlwifi/iwl-rx.c |   37
> +++++++++++++++----------------- 1 files changed, 17 insertions(+), 20
> deletions(-)
>
> diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c
> b/drivers/net/wireless/iwlwifi/iwl-rx.c index d062d4d..6a465d5 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-rx.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
> @@ -29,6 +29,7 @@
>
>  #include <linux/etherdevice.h>
>  #include <net/mac80211.h>
> +#include <asm/unaligned.h>
>  #include "iwl-eeprom.h"
>  #include "iwl-dev.h"
>  #include "iwl-core.h"
> @@ -829,23 +830,22 @@ static void iwl_add_radiotap(struct iwl_priv *priv,
>  	iwl4965_rt->rt_hdr.it_pad = 0;
>
>  	/* total header + data */
> -	put_unaligned(cpu_to_le16(sizeof(*iwl4965_rt)),
> -		      &iwl4965_rt->rt_hdr.it_len);
> +	put_unaligned_le16(sizeof(*iwl4965_rt), &iwl4965_rt->rt_hdr.it_len);
>
>  	/* Indicate all the fields we add to the radiotap header */
> -	put_unaligned(cpu_to_le32((1 << IEEE80211_RADIOTAP_TSFT) |
> -				  (1 << IEEE80211_RADIOTAP_FLAGS) |
> -				  (1 << IEEE80211_RADIOTAP_RATE) |
> -				  (1 << IEEE80211_RADIOTAP_CHANNEL) |
> -				  (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) |
> -				  (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) |
> -				  (1 << IEEE80211_RADIOTAP_ANTENNA)),
> -		      &iwl4965_rt->rt_hdr.it_present);
> +	put_unaligned_le32((1 << IEEE80211_RADIOTAP_TSFT) |
> +			   (1 << IEEE80211_RADIOTAP_FLAGS) |
> +			   (1 << IEEE80211_RADIOTAP_RATE) |
> +			   (1 << IEEE80211_RADIOTAP_CHANNEL) |
> +			   (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) |
> +			   (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) |
> +			   (1 << IEEE80211_RADIOTAP_ANTENNA),
> +			   &(iwl4965_rt->rt_hdr.it_present));
>
>  	/* Zero the flags, we'll add to them as we go */
>  	iwl4965_rt->rt_flags = 0;
>
> -	put_unaligned(cpu_to_le64(tsf), &iwl4965_rt->rt_tsf);
> +	put_unaligned_le64(tsf, &iwl4965_rt->rt_tsf);
>
>  	iwl4965_rt->rt_dbmsignal = signal;
>  	iwl4965_rt->rt_dbmnoise = noise;
> @@ -853,17 +853,14 @@ static void iwl_add_radiotap(struct iwl_priv *priv,
>  	/* Convert the channel frequency and set the flags */
>  	put_unaligned(cpu_to_le16(stats->freq), &iwl4965_rt->rt_channelMHz);
>  	if (!(phy_flags_hw & RX_RES_PHY_FLAGS_BAND_24_MSK))
> -		put_unaligned(cpu_to_le16(IEEE80211_CHAN_OFDM |
> -					  IEEE80211_CHAN_5GHZ),
> -			      &iwl4965_rt->rt_chbitmask);
> +		put_unaligned_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ,
> +				   &iwl4965_rt->rt_chbitmask);
>  	else if (phy_flags_hw & RX_RES_PHY_FLAGS_MOD_CCK_MSK)
> -		put_unaligned(cpu_to_le16(IEEE80211_CHAN_CCK |
> -					  IEEE80211_CHAN_2GHZ),
> -			      &iwl4965_rt->rt_chbitmask);
> +		put_unaligned_le16(IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ,
> +				   &iwl4965_rt->rt_chbitmask);
>  	else	/* 802.11g */
> -		put_unaligned(cpu_to_le16(IEEE80211_CHAN_OFDM |
> -					  IEEE80211_CHAN_2GHZ),
> -			      &iwl4965_rt->rt_chbitmask);
> +		put_unaligned_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ,
> +				   &iwl4965_rt->rt_chbitmask);
>
>  	if (rate == -1)
>  		iwl4965_rt->rt_rate = 0;

  reply	other threads:[~2008-07-10 11:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-10 11:28 [PATCH 1/1] iwlwif: remove compilation warnings iwl_add_radiotap Tomas Winkler
2008-07-10 11:42 ` Bruno Randolf [this message]
2008-07-10 12:25   ` Tomas Winkler
2008-07-10 13:52     ` Johannes Berg
2008-07-10 14:47       ` Tomas Winkler
2008-07-12 12:57         ` Bruno Randolf
2008-07-12 21:34           ` Tomas Winkler

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=200807101342.36920.br1@einfach.org \
    --to=br1@einfach.org \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=tomas.winkler@intel.com \
    --cc=yi.zhu@intel.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