Re: [ath9k-devel] [PATCH 0/25] Replace DEFINE_PCI_DEVICE_TABLE macro use

2014-07-18 Thread Joe Perches
On Fri, 2014-07-18 at 09:43 -0700, Greg KH wrote:
> On Fri, Jul 18, 2014 at 12:22:13PM -0400, John W. Linville wrote:
> > On Fri, Jul 18, 2014 at 05:26:47PM +0200, Benoit Taine wrote:
> > > We should prefer `const struct pci_device_id` over
> > > `DEFINE_PCI_DEVICE_TABLE` to meet kernel coding style guidelines.
> > > This issue was reported by checkpatch.
> >  scripts/checkpatch.pl | 4 ++--
> > Honestly, I prefer the macro -- it stands-out more.  Maybe the style
> > guidelines and/or checkpatch should change instead?
> 
> The macro is horrid, no other bus has this type of thing just to save a
> few characters in typing, so why should PCI be "special" in this regard
> anymore?

I think it doesn't matter much.

The PCI_DEVICE and PCI_VDEVICE macro uses are somewhat similar
and are frequently used with PCI_DEVICE_TABLE, so there's some
commonality there.

The checkpatch message could be made --strict/CHK instead of
WARN so most people would never see it.

Of course it could be removed altogether too.  I don't care.
---
(suggested patch is for -next)

 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index dc72a9b..754fbf2 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3018,8 +3018,8 @@ sub process {
 
 # check for uses of DEFINE_PCI_DEVICE_TABLE
if ($line =~ /\bDEFINE_PCI_DEVICE_TABLE\s*\(\s*(\w+)\s*\)\s*=/) 
{
-   if (WARN("DEFINE_PCI_DEVICE_TABLE",
-"Prefer struct pci_device_id over deprecated 
DEFINE_PCI_DEVICE_TABLE\n" . $herecurr) &&
+   if (CHK("DEFINE_PCI_DEVICE_TABLE",
+   "Prefer struct pci_device_id over deprecated 
DEFINE_PCI_DEVICE_TABLE\n" . $herecurr) &&
$fix) {
$fixed[$fixlinenr] =~ 
s/\b(?:static\s+|)DEFINE_PCI_DEVICE_TABLE\s*\(\s*(\w+)\s*\)\s*=\s*/static const 
struct pci_device_id $1\[\] = /;
}


___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [patch] ath9k: fix some debugfs output

2014-10-29 Thread Joe Perches
On Wed, 2014-10-29 at 19:10 +0300, Dan Carpenter wrote:
> On Wed, Oct 29, 2014 at 09:08:39AM -0700, Joe Perches wrote:
> > On Wed, 2014-10-29 at 18:48 +0300, Dan Carpenter wrote:
> > > The right shift operation has higher precedence than the mask so we
> > > left shift by "(i * 3)" and then immediately right shift by "(i * 3)"
> > > then we mask.  It should be left shift, mask, and then right shift.
[]
> > My grep pattern doesn't like operations on the thing masked.
> > Did you find this by some tool or visual inspection via grep?
[]
> I wrote a Smatch check inspired by the i40e bug you found earlier.

Nice.  fyi: I sent a bunch of these already.

https://lkml.org/lkml/2014/10/27/38


___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [patch] ath9k: fix some debugfs output

2014-10-29 Thread Joe Perches
On Wed, 2014-10-29 at 18:48 +0300, Dan Carpenter wrote:
> The right shift operation has higher precedence than the mask so we
> left shift by "(i * 3)" and then immediately right shift by "(i * 3)"
> then we mask.  It should be left shift, mask, and then right shift.
> 
Hey Dan.

My grep pattern doesn't like operations on the thing masked.

Did you find this by some tool or visual inspection via grep?


___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH net-next 00/14] Use eth__addr instead of memset

2015-03-02 Thread Joe Perches
Joe Perches (14):
  etherdevice: Add eth__addr CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS code
  ethernet: Use eth__addr instead of memset
  net: usb: Use eth__addr instead of memset
  wireless: Use eth__addr instead of memset
  netconsole: Use eth__addr instead of memset
  xen: Use eth__addr instead of memset
  8021q: Use eth__addr instead of memset
  appletalk: Use eth__addr instead of memset
  atm: Use eth__addr instead of memset
  bluetooth: Use eth__addr instead of memset
  ethernet: Use eth__addr instead of memset
  mac80211: Use eth__addr instead of memset
  wireless: Use eth__addr instead of memset
  l2tp: Use eth__addr instead of memset

 drivers/net/ethernet/amd/pcnet32.c |  2 +-
 .../net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c|  2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c   |  6 ++--
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c  |  2 +-
 drivers/net/ethernet/cisco/enic/enic_main.c|  8 +++---
 drivers/net/ethernet/emulex/benet/be_cmds.c|  2 +-
 drivers/net/ethernet/emulex/benet/be_main.c|  2 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c  |  4 +--
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c |  4 +--
 drivers/net/ethernet/mellanox/mlx4/en_selftest.c   |  2 +-
 drivers/net/ethernet/micrel/ksz884x.c  |  2 +-
 drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c |  2 +-
 drivers/net/ethernet/qlogic/qlge/qlge_main.c   |  2 +-
 drivers/net/ethernet/smsc/smsc911x.c   |  2 +-
 drivers/net/ethernet/ti/netcp_core.c   |  2 +-
 drivers/net/ethernet/toshiba/ps3_gelic_wireless.c  |  4 +--
 drivers/net/ethernet/xscale/ixp4xx_eth.c   |  2 +-
 drivers/net/netconsole.c   |  5 ++--
 drivers/net/usb/catc.c |  4 +--
 drivers/net/usb/cdc_mbim.c |  2 +-
 drivers/net/usb/lg-vl600.c |  2 +-
 drivers/net/usb/qmi_wwan.c |  2 +-
 drivers/net/wireless/airo.c|  4 +--
 drivers/net/wireless/at76c50x-usb.c|  6 ++--
 drivers/net/wireless/ath/ath10k/mac.c  |  2 +-
 drivers/net/wireless/ath/ath5k/base.c  |  2 +-
 drivers/net/wireless/ath/ath6kl/cfg80211.c |  2 +-
 drivers/net/wireless/ath/ath6kl/main.c |  2 +-
 drivers/net/wireless/ath/ath9k/htc_drv_main.c  |  2 +-
 drivers/net/wireless/ath/ath9k/main.c  |  4 +--
 drivers/net/wireless/atmel.c   | 16 +--
 drivers/net/wireless/b43/main.c|  8 +++---
 drivers/net/wireless/b43legacy/main.c  |  8 +++---
 drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 12 
 drivers/net/wireless/brcm80211/brcmfmac/flowring.c |  2 +-
 drivers/net/wireless/brcm80211/brcmfmac/p2p.c  |  2 +-
 drivers/net/wireless/cw1200/sta.c  |  2 +-
 drivers/net/wireless/cw1200/txrx.c |  2 +-
 drivers/net/wireless/hostap/hostap_80211_tx.c  |  4 +--
 drivers/net/wireless/hostap/hostap_ap.c|  8 +++---
 drivers/net/wireless/hostap/hostap_info.c  |  2 +-
 drivers/net/wireless/hostap/hostap_main.c  |  4 +--
 drivers/net/wireless/hostap/hostap_wlan.h  | 33 +++---
 drivers/net/wireless/ipw2x00/ipw2100.c |  8 +++---
 drivers/net/wireless/ipw2x00/ipw2200.c |  6 ++--
 drivers/net/wireless/iwlegacy/common.c |  2 +-
 drivers/net/wireless/iwlwifi/mvm/power.c   |  3 +-
 drivers/net/wireless/libertas/main.c   |  4 +--
 drivers/net/wireless/libertas_tf/main.c|  4 +--
 drivers/net/wireless/mac80211_hwsim.c  |  6 ++--
 drivers/net/wireless/mwifiex/cfg80211.c|  8 +++---
 drivers/net/wireless/mwifiex/init.c|  4 +--
 drivers/net/wireless/mwifiex/sta_event.c   |  2 +-
 drivers/net/wireless/mwifiex/wmm.c |  2 +-
 drivers/net/wireless/mwl8k.c   |  2 +-
 drivers/net/wireless/orinoco/wext.c|  2 +-
 drivers/net/wireless/p54/fwio.c|  2 +-
 drivers/net/wireless/p54/main.c|  8 +++---
 drivers/net/wireless/ray_cs.c  |  2 +-
 drivers/net/wireless/rndis_wlan.c  | 28 +-
 drivers/net/wireless/rtlwifi/core.c|  6 ++--
 drivers/net/wireless/ti/wl1251/main.c  |  4 +--
 drivers/net/wireless/ti/wlcore/cmd.c   |  4 +--
 drivers/net/xen-netback/interface.c|  2 +-
 include/linux/etherdevice.h| 12 +++-
 net/8021q/vlan_dev.c   |  2 +-
 net/appletalk/aarp.c   |  6 ++--
 net/atm/lec.c  |  4 +--
 net/bluetooth/bnep/netdev.c|  2 +-
 net/ethernet/eth.c |  4 +--
 net/l2tp/l2tp_eth.c

[ath9k-devel] [PATCH net-next 04/14] wireless: Use eth__addr instead of memset

2015-03-02 Thread Joe Perches
Use the built-in function instead of memset.

Miscellanea:

Add #include  where appropriate
Use ETH_ALEN instead of 6

Signed-off-by: Joe Perches 
---
 drivers/net/wireless/airo.c|  4 +--
 drivers/net/wireless/at76c50x-usb.c|  6 ++--
 drivers/net/wireless/ath/ath10k/mac.c  |  2 +-
 drivers/net/wireless/ath/ath5k/base.c  |  2 +-
 drivers/net/wireless/ath/ath6kl/cfg80211.c |  2 +-
 drivers/net/wireless/ath/ath6kl/main.c |  2 +-
 drivers/net/wireless/ath/ath9k/htc_drv_main.c  |  2 +-
 drivers/net/wireless/ath/ath9k/main.c  |  4 +--
 drivers/net/wireless/atmel.c   | 16 +--
 drivers/net/wireless/b43/main.c|  8 +++---
 drivers/net/wireless/b43legacy/main.c  |  8 +++---
 drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 12 
 drivers/net/wireless/brcm80211/brcmfmac/flowring.c |  2 +-
 drivers/net/wireless/brcm80211/brcmfmac/p2p.c  |  2 +-
 drivers/net/wireless/cw1200/sta.c  |  2 +-
 drivers/net/wireless/cw1200/txrx.c |  2 +-
 drivers/net/wireless/hostap/hostap_80211_tx.c  |  4 +--
 drivers/net/wireless/hostap/hostap_ap.c|  8 +++---
 drivers/net/wireless/hostap/hostap_info.c  |  2 +-
 drivers/net/wireless/hostap/hostap_main.c  |  4 +--
 drivers/net/wireless/hostap/hostap_wlan.h  | 33 +++---
 drivers/net/wireless/ipw2x00/ipw2100.c |  8 +++---
 drivers/net/wireless/ipw2x00/ipw2200.c |  6 ++--
 drivers/net/wireless/iwlegacy/common.c |  2 +-
 drivers/net/wireless/iwlwifi/mvm/power.c   |  3 +-
 drivers/net/wireless/libertas/main.c   |  4 +--
 drivers/net/wireless/libertas_tf/main.c|  4 +--
 drivers/net/wireless/mac80211_hwsim.c  |  6 ++--
 drivers/net/wireless/mwifiex/cfg80211.c|  8 +++---
 drivers/net/wireless/mwifiex/init.c|  4 +--
 drivers/net/wireless/mwifiex/sta_event.c   |  2 +-
 drivers/net/wireless/mwifiex/wmm.c |  2 +-
 drivers/net/wireless/mwl8k.c   |  2 +-
 drivers/net/wireless/orinoco/wext.c|  2 +-
 drivers/net/wireless/p54/fwio.c|  2 +-
 drivers/net/wireless/p54/main.c|  8 +++---
 drivers/net/wireless/ray_cs.c  |  2 +-
 drivers/net/wireless/rndis_wlan.c  | 28 +-
 drivers/net/wireless/rtlwifi/core.c|  6 ++--
 drivers/net/wireless/ti/wl1251/main.c  |  4 +--
 drivers/net/wireless/ti/wlcore/cmd.c   |  4 +--
 41 files changed, 118 insertions(+), 116 deletions(-)

diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index e71a2ce..6274432 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -2676,7 +2676,7 @@ static void wifi_setup(struct net_device *dev)
dev->addr_len   = ETH_ALEN;
dev->tx_queue_len   = 100; 
 
-   memset(dev->broadcast,0xFF, ETH_ALEN);
+   eth_broadcast_addr(dev->broadcast);
 
dev->flags  = IFF_BROADCAST|IFF_MULTICAST;
 }
@@ -3273,7 +3273,7 @@ static void airo_handle_link(struct airo_info *ai)
}
 
/* Send event to user space */
-   memset(wrqu.ap_addr.sa_data, '\0', ETH_ALEN);
+   eth_zero_addr(wrqu.ap_addr.sa_data);
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
wireless_send_event(ai->dev, SIOCGIWAP, &wrqu, NULL);
}
diff --git a/drivers/net/wireless/at76c50x-usb.c 
b/drivers/net/wireless/at76c50x-usb.c
index da92bfa..49219c5 100644
--- a/drivers/net/wireless/at76c50x-usb.c
+++ b/drivers/net/wireless/at76c50x-usb.c
@@ -1166,7 +1166,7 @@ static int at76_start_monitor(struct at76_priv *priv)
int ret;
 
memset(&scan, 0, sizeof(struct at76_req_scan));
-   memset(scan.bssid, 0xff, ETH_ALEN);
+   eth_broadcast_addr(scan.bssid);
 
scan.channel = priv->channel;
scan.scan_type = SCAN_TYPE_PASSIVE;
@@ -1427,7 +1427,7 @@ static int at76_startup_device(struct at76_priv *priv)
at76_wait_completion(priv, CMD_STARTUP);
 
/* remove BSSID from previous run */
-   memset(priv->bssid, 0, ETH_ALEN);
+   eth_zero_addr(priv->bssid);
 
priv->scanning = false;
 
@@ -1973,7 +1973,7 @@ static int at76_hw_scan(struct ieee80211_hw *hw,
ieee80211_stop_queues(hw);
 
memset(&scan, 0, sizeof(struct at76_req_scan));
-   memset(scan.bssid, 0xFF, ETH_ALEN);
+   eth_broadcast_addr(scan.bssid);
 
if (req->n_ssids) {
scan.scan_type = SCAN_TYPE_ACTIVE;
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index d6d2f0f..6c364bb 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/d

Re: [ath9k-devel] [PATCH] ath9k: add phy.c

2015-05-15 Thread Joe Perches
On Fri, 2015-05-15 at 14:35 +0200, Oleksij Rempel wrote:
> ... and move dup code from ar5008_phy.c and ar9002_phy.c to phy.c
[]
> diff --git a/drivers/net/wireless/ath/ath9k/phy.c 
> b/drivers/net/wireless/ath/ath9k/phy.c

> +void phy_hw_spur_mitigate(struct ath_hw *ah,
> +   struct ath9k_channel *chan, int bin)
> +{
> + int cur_bin;
> + int upper, lower, cur_vit_mask;
> + int i;
> + int8_t mask_m[123];
> + int8_t mask_p[123];

Looking at this code, I'm not sure if mask_m and mask_p
are always completely initialized by the loop below.

Perhaps use {} on declaration.

> + int8_t mask_amt;

These int8_t could be s8

> + int tmp_mask;
> + static int pilot_mask_reg[4] = {
> + AR_PHY_TIMING7, AR_PHY_TIMING8,
> + AR_PHY_PILOT_MASK_01_30, AR_PHY_PILOT_MASK_31_60
> + };
> + static int chan_mask_reg[4] = {
> + AR_PHY_TIMING9, AR_PHY_TIMING10,
> + AR_PHY_CHANNEL_MASK_01_30, AR_PHY_CHANNEL_MASK_31_60
> + };
> + static int inc[4] = { 0, 100, 0, 0 };

static const

> + cur_vit_mask = 6100;
> + upper = bin + 120;
> + lower = bin - 120;
> +

Is this loop guaranteed to always initialize all the
mask_p and mask_m indexes used in the or statements below it?

The 123 for -61 and 0 and +61 array indexes is a bit obscure.

> + for (i = 0; i < 123; i++) {
> + if ((cur_vit_mask > lower) && (cur_vit_mask < upper)) {
> + /* workaround for gcc bug #37014 */
> + volatile int tmp_v = abs(cur_vit_mask - bin);
> +
> + if (tmp_v < 75)
> + mask_amt = 1;
> + else
> + mask_amt = 0;
> + if (cur_vit_mask < 0)
> + mask_m[abs(cur_vit_mask / 100)] = mask_amt;
> + else
> + mask_p[cur_vit_mask / 100] = mask_amt;
> + }
> + cur_vit_mask -= 100;
> + }
> +
> + tmp_mask = (mask_m[46] << 30) | (mask_m[47] << 28)
> + | (mask_m[48] << 26) | (mask_m[49] << 24)
> + | (mask_m[50] << 22) | (mask_m[51] << 20)
> + | (mask_m[52] << 18) | (mask_m[53] << 16)
> + | (mask_m[54] << 14) | (mask_m[55] << 12)
> + | (mask_m[56] << 10) | (mask_m[57] << 8)
> + | (mask_m[58] << 6) | (mask_m[59] << 4)
> + | (mask_m[60] << 2) | (mask_m[61] << 0);
> + REG_WRITE(ah, AR_PHY_BIN_MASK_1, tmp_mask);
> + REG_WRITE(ah, AR_PHY_VIT_MASK2_M_46_61, tmp_mask);
> +
> + tmp_mask = (mask_m[31] << 28)
> + | (mask_m[32] << 26) | (mask_m[33] << 24)
> + | (mask_m[34] << 22) | (mask_m[35] << 20)
> + | (mask_m[36] << 18) | (mask_m[37] << 16)
> + | (mask_m[48] << 14) | (mask_m[39] << 12)
> + | (mask_m[40] << 10) | (mask_m[41] << 8)
> + | (mask_m[42] << 6) | (mask_m[43] << 4)
> + | (mask_m[44] << 2) | (mask_m[45] << 0);
> + REG_WRITE(ah, AR_PHY_BIN_MASK_2, tmp_mask);
> + REG_WRITE(ah, AR_PHY_MASK2_M_31_45, tmp_mask);
> +
> + tmp_mask = (mask_m[16] << 30) | (mask_m[16] << 28)
> + | (mask_m[18] << 26) | (mask_m[18] << 24)
> + | (mask_m[20] << 22) | (mask_m[20] << 20)
> + | (mask_m[22] << 18) | (mask_m[22] << 16)
> + | (mask_m[24] << 14) | (mask_m[24] << 12)
> + | (mask_m[25] << 10) | (mask_m[26] << 8)
> + | (mask_m[27] << 6) | (mask_m[28] << 4)
> + | (mask_m[29] << 2) | (mask_m[30] << 0);
> + REG_WRITE(ah, AR_PHY_BIN_MASK_3, tmp_mask);
> + REG_WRITE(ah, AR_PHY_MASK2_M_16_30, tmp_mask);
> +
> + tmp_mask = (mask_m[0] << 30) | (mask_m[1] << 28)
> + | (mask_m[2] << 26) | (mask_m[3] << 24)
> + | (mask_m[4] << 22) | (mask_m[5] << 20)
> + | (mask_m[6] << 18) | (mask_m[7] << 16)
> + | (mask_m[8] << 14) | (mask_m[9] << 12)
> + | (mask_m[10] << 10) | (mask_m[11] << 8)
> + | (mask_m[12] << 6) | (mask_m[13] << 4)
> + | (mask_m[14] << 2) | (mask_m[15] << 0);
> + REG_WRITE(ah, AR_PHY_MASK_CTL, tmp_mask);
> + REG_WRITE(ah, AR_PHY_MASK2_M_00_15, tmp_mask);
> +
> + tmp_mask = (mask_p[15] << 28)
> + | (mask_p[14] << 26) | (mask_p[13] << 24)
> + | (mask_p[12] << 22) | (mask_p[11] << 20)
> + | (mask_p[10] << 18) | (mask_p[9] << 16)
> + | (mask_p[8] << 14) | (mask_p[7] << 12)
> + | (mask_p[6] << 10) | (mask_p[5] << 8)
> + | (mask_p[4] << 6) | (mask_p[3] << 4)
> + | (mask_p[2] << 2) | (mask_p[1] << 0);
> + REG_WRITE(ah, AR_PHY_BIN_MASK2_1, tmp_mask);
> + REG_WRITE(ah, AR_PHY_MASK2_P_15_01, tmp_mask);
> +
> + tmp_mask = (mask_p[30] << 28)
> + | (mask_p[29] << 26) | (mask_p[28] << 24)
> + | (mask_p[27] << 22) | (mask_p[26] << 20)

Re: [ath9k-devel] [PATCH] ath9k: add phy.c

2015-05-15 Thread Joe Perches
On Sat, 2015-05-16 at 07:27 +0200, Oleksij Rempel wrote:

> Am 15.05.2015 um 20:35 schrieb Joe Perches:
> > On Fri, 2015-05-15 at 14:35 +0200, Oleksij Rempel wrote:
> >> ... and move dup code from ar5008_phy.c and ar9002_phy.c to phy.c
> > []
> >> diff --git a/drivers/net/wireless/ath/ath9k/phy.c 
> >> b/drivers/net/wireless/ath/ath9k/phy.c
> > 
> >> +void phy_hw_spur_mitigate(struct ath_hw *ah,
> >> +struct ath9k_channel *chan, int bin)
> >> +{
[]
> >> +  static int inc[4] = { 0, 100, 0, 0 };
> > 
> > static const

> This is cleanup patch, no fixes optimisations
> or regressions should be introduced.

Hello Oleksij.

One of the old compilation units (ar9002_phy.c) had const on
all those arrays, the other did not.

const should be used here.

> If you see some problems in this
> code, you are welcome to provide a patch on top of this one :)

I think you should take comments on the patches you submit.


___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [patch -next] ath9k: fix ath9k_hw_nvram_check_version()

2015-12-20 Thread Joe Perches
On Sat, 2015-12-19 at 13:59 +0300, Dan Carpenter wrote:
> There is a type bug so it always returns success.

How many false positives do you have to sift
through to find this sort of error?

> +++ b/drivers/net/wireless/ath/ath9k/eeprom.c
> @@ -206,7 +206,7 @@ bool ath9k_hw_nvram_check_version(struct ath_hw *ah, int 
> version, int minrev)
>   ath_err(common, "Bad EEPROM VER 0x%04x or REV 0x%04x\n",
>   ah->eep_ops->get_eeprom_ver(ah),
>   ah->eep_ops->get_eeprom_rev(ah));
> - return -EINVAL;
> + return false;
>   }
>  
>   return true;

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [patch -next] ath9k: fix ath9k_hw_nvram_check_version()

2015-12-20 Thread Joe Perches
On Sun, 2015-12-20 at 20:00 +0100, Julia Lawall wrote:
> On Sun, 20 Dec 2015, Joe Perches wrote:
> 
> > On Sat, 2015-12-19 at 13:59 +0300, Dan Carpenter wrote:
> > > There is a type bug so it always returns success.
> > 
> > How many false positives do you have to sift
> > through to find this sort of error?
> 
> The return type is thoughtfully bool, so it should be easy in this case.  
> The function has a return -EINVAL and a return true, so even without the 
> return type it would be locally apparent that there is an inconsistency.

True, -EINVAL is a non-bool constant, but
bool returns can be a variable int.

Dan, was the check any constant non-bool?

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH] /drivers/net/wireless/ath/ath9k remove unnecessary ?: operator

2015-12-28 Thread Joe Perches
On Mon, 2015-12-28 at 20:48 +0700, Ivan Safonov wrote:
> ((thermometer < 0) ? 0 : (thermometer == X)) and (thermometer == X) are equal 
> for X >= 0.

X is not guaranteed to be >= 0 here

> Signed-off-by: Ivan Safonov 
> ---
>  drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c 
> b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
[]
> @@ -4097,16 +4097,16 @@ static void ar9003_hw_thermometer_apply(struct ath_hw 
> *ah)
>   REG_RMW_FIELD(ah, AR_PHY_65NM_CH2_RXTX4,
>     AR_PHY_65NM_CH0_RXTX4_THERM_ON_OVR, therm_on);
>  
> - therm_on = (thermometer < 0) ? 0 : (thermometer == 0);
> + therm_on = thermometer == 0;

This code is not equivalent.

Check what happens when thermometer is -1.

>   REG_RMW_FIELD(ah, AR_PHY_65NM_CH0_RXTX4,
>     AR_PHY_65NM_CH0_RXTX4_THERM_ON, therm_on);
>   if (pCap->chip_chainmask & BIT(1)) {
> - therm_on = (thermometer < 0) ? 0 : (thermometer == 1);
> + therm_on = thermometer == 1;
>   REG_RMW_FIELD(ah, AR_PHY_65NM_CH1_RXTX4,
>     AR_PHY_65NM_CH0_RXTX4_THERM_ON, therm_on);
>   }
>   if (pCap->chip_chainmask & BIT(2)) {
> - therm_on = (thermometer < 0) ? 0 : (thermometer == 2);
> + therm_on = thermometer == 2;
>   REG_RMW_FIELD(ah, AR_PHY_65NM_CH2_RXTX4,
>     AR_PHY_65NM_CH0_RXTX4_THERM_ON, therm_on);
>   }

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH] /drivers/net/wireless/ath/ath9k remove unnecessary ?: operator

2015-12-28 Thread Joe Perches
On Tue, 2015-12-29 at 01:38 +0700, Ivan Safonov wrote:
> On 12/29/2015 12:56 AM, Joe Perches wrote:
> > On Mon, 2015-12-28 at 20:48 +0700, Ivan Safonov wrote:
> > > ((thermometer < 0) ? 0 : (thermometer == X)) and (thermometer ==
> > > X) are equal for X >= 0.
> > X is not guaranteed to be >= 0 here
> 
> X is fixed constant. In this case X is {0, 1, 2}.

Looks like it can be -1 to me (range: -1, 0, 1, 2)

static int ar9003_hw_get_thermometer(struct ath_hw *ah)
{
struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
struct ar9300_base_eep_hdr *pBase = &eep->baseEepHeader;
int thermometer =  (pBase->miscConfiguration >> 1) & 0x3;

return --thermometer;
}

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH] ath9k: fix checkpatch.pl identation and sapce errors.

2016-03-22 Thread Joe Perches
On Tue, 2016-03-22 at 12:23 +0530, Ashwini Singh wrote:
> Signed-off-by: Ashwini Singh 

It might be better to break this into a few different patches.

o Remove trailing whitespace
o Fix vertical line / brace location
o Multi-line statement parenthesis alignment
o Space to tab conversions
o Whitespace addition / removal

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH 27/62] drivers/net/wireless/ath/ath9k: Remove unnecessary semicolons

2009-06-28 Thread Joe Perches
Signed-off-by: Joe Perches 
---
 drivers/net/wireless/ath/ath9k/eeprom.c |2 --
 drivers/net/wireless/ath/ath9k/hw.c |2 +-
 2 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c 
b/drivers/net/wireless/ath/ath9k/eeprom.c
index a2fda70..d82a0f9 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
@@ -2516,10 +2516,8 @@ static void ath9k_hw_set_def_power_per_rate_table(struct 
ath_hw *ah,
targetPowerCck.tPow2x[1];
ratesArray[rate5_5s] = ratesArray[rate5_5l] =
targetPowerCck.tPow2x[2];
-   ;
ratesArray[rate11s] = ratesArray[rate11l] =
targetPowerCck.tPow2x[3];
-   ;
}
if (IS_CHAN_HT40(chan)) {
for (i = 0; i < ARRAY_SIZE(targetPowerHt40.tPow2x); i++) {
diff --git a/drivers/net/wireless/ath/ath9k/hw.c 
b/drivers/net/wireless/ath/ath9k/hw.c
index 34935a8..cffb078 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2345,7 +2345,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct 
ath9k_channel *chan,
ath9k_hw_init_bb(ah, chan);
 
if (!ath9k_hw_init_cal(ah, chan))
-   return -EIO;;
+   return -EIO;
 
rx_chainmask = ah->rxchainmask;
if ((rx_chainmask == 0x5) || (rx_chainmask == 0x3)) {
-- 
1.6.3.1.10.g659a0.dirty

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH] ath9k: Gather and report bus-timeout errors.

2012-04-03 Thread Joe Perches
On Tue, 2012-04-03 at 13:22 -0700, gree...@candelatech.com wrote:
> From: Ben Greear 
> 
> Seems like a useful stat to report (when debugfs
> is enabled).
[]
> diff --git a/drivers/net/wireless/ath/ath9k/debug.c 
> b/drivers/net/wireless/ath/ath9k/debug.c
[]
> @@ -385,57 +385,61 @@ static ssize_t read_file_interrupt(struct file *file, 
> char __user *user_buf,
>  size_t count, loff_t *ppos)
>  {
>   struct ath_softc *sc = file->private_data;
> - char buf[512];
> + char buf[800];

800 seems excessive.
Maybe it's better to kmalloc this.

>   unsigned int len = 0;
>  
>   if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) {
>   len += snprintf(buf + len, sizeof(buf) - len,
> - "%8s: %10u\n", "RXLP", sc->debug.stats.istats.rxlp);
> + "%11s: %10u\n", "RXLP", sc->debug.stats.istats.rxlp);

why change the size from 8 to 11?

>   len += snprintf(buf + len, sizeof(buf) - len,
> - "%8s: %10u\n", "RXHP", sc->debug.stats.istats.rxhp);
> + "%11s: %10u\n", "RXHP", sc->debug.stats.istats.rxhp);
>   len += snprintf(buf + len, sizeof(buf) - len,
> - "%8s: %10u\n", "WATCHDOG",
> + "%11s: %10u\n", "WATCHDOG",
>   sc->debug.stats.istats.bb_watchdog);

[]

> diff --git a/drivers/net/wireless/ath/ath9k/debug.h 
> b/drivers/net/wireless/ath/ath9k/debug.h
[]
> @@ -85,8 +86,15 @@ struct ath_interrupt_stats {
>   u32 dtim;
>   u32 bb_watchdog;
>   u32 tsfoor;
> + u32 sync_local_timeout;
>  };
>  
> +#define ATH_INCR_IRQ_STAT_COMMON(c, s)   
> \
> + do {\
> + struct ath_softc *sc = (struct ath_softc *) (c)->priv;  \

Isn't priv void *?
I think you don't need the cast.

> + sc->debug.stats.istats.s++; \
> + } while (0);

sb: "while (0)" without the ;


___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH v2] ath9k: Gather and report IRQ sync_cause errors.

2012-04-04 Thread Joe Perches
On Tue, 2012-04-03 at 21:20 -0700, gree...@candelatech.com wrote:
> From: Ben Greear 
> 
> Report all defined sync_cause errors in debugfs
> to aid with debugging.

just trivia:

> diff --git a/drivers/net/wireless/ath/ath9k/debug.c 
> b/drivers/net/wireless/ath/ath9k/debug.c
[]
> @@ -385,63 +385,130 @@ static ssize_t read_file_interrupt(struct file *file, 
> char __user *user_buf,
>  size_t count, loff_t *ppos)
>  {
>   struct ath_softc *sc = file->private_data;
[]
>   if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) {
[]
> + len += snprintf(buf + len, mxlen - len,
> + "%21s: %10u\n", "RXLP", sc->debug.stats.istats.rxlp);

Alignment is overrated.

I wouldn't change any of the original block
though perhaps changing the sc pointer to an
istats pointer so these dereferences become
similar to istats->rxlp;

[]

> + len += snprintf(buf + len, mxlen - len,
> + "SYNC_CAUSE stats:\n");

But _might_ add the %21s here for the new entries.

> + len += snprintf(buf + len, mxlen - len,
> + "%21s: %10u\n", "Sync-All",
> + sc->debug.stats.istats.sync_cause_all);

[]

> diff --git a/drivers/net/wireless/ath/ath9k/hw.c 
> b/drivers/net/wireless/ath/ath9k/hw.c
[]
> @@ -82,6 +84,53 @@ static void ath9k_hw_ani_cache_ini_regs(struct ath_hw *ah)
>  /* Helper Functions */
>  //
>  
> +#ifdef CONFIG_ATH9K_DEBUGFS
> +
> +void ath9k_debug_sync_cause(struct ath_common *common, u32 sync_cause)
> +{
> + struct ath_softc *sc = common->priv;
> + if (sync_cause)
> + sc->debug.stats.istats.sync_cause_all++;
> + if (sync_cause & AR_INTR_SYNC_RTC_IRQ)
> + sc->debug.stats.istats.sync_rtc_irq++;

And nicer here to use a pointer to istats too.

istats->sync_rtc_irq++;

> + if (sync_cause & AR_INTR_SYNC_MAC_IRQ)
> + sc->debug.stats.istats.sync_mac_irq++;

istats->sync_mac_irq++;

etc.

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH v2] ath9k: Gather and report IRQ sync_cause errors.

2012-04-04 Thread Joe Perches
(added Luis R and the current ath9k-devel list to cc's)

On Wed, 2012-04-04 at 11:25 -0700, Ben Greear wrote:
> On 04/04/2012 09:16 AM, Joe Perches wrote:
> > On Tue, 2012-04-03 at 21:20 -0700, gree...@candelatech.com wrote:
> >> From: Ben Greear
> >>
> >> Report all defined sync_cause errors in debugfs
> >> to aid with debugging.
> >
> > just trivia:
> >
> >> diff --git a/drivers/net/wireless/ath/ath9k/debug.c 
> >> b/drivers/net/wireless/ath/ath9k/debug.c
> > []
> >> @@ -385,63 +385,130 @@ static ssize_t read_file_interrupt(struct file 
> >> *file, char __user *user_buf,
> >>   size_t count, loff_t *ppos)
> >>   {
> >>struct ath_softc *sc = file->private_data;
> > []
> >>if (sc->sc_ah->caps.hw_caps&  ATH9K_HW_CAP_EDMA) {
> > []
> >> +  len += snprintf(buf + len, mxlen - len,
> >> +  "%21s: %10u\n", "RXLP", sc->debug.stats.istats.rxlp);
> >
> > Alignment is overrated.
> >
> > I wouldn't change any of the original block
> > though perhaps changing the sc pointer to an
> > istats pointer so these dereferences become
> > similar to istats->rxlp;
> 
> Other files in this driver are aligned, so it seems
> nice to continue the tradition.  debugfs files are
> for human consumption, so making them readable is
> a virtue.

It'd still be readable, it would just be a different block
separated by a new header line.

> If someone wants more efficient access to this data,
> then we can use ethtool stats (I'll add ethtool stats
> support for these counters if/when my first ethtool
> patches make it in...)

That'd be a good idea.

> >> +void ath9k_debug_sync_cause(struct ath_common *common, u32 sync_cause)
> >> +{
> >> +  struct ath_softc *sc = common->priv;
> >> +  if (sync_cause)
> >> +  sc->debug.stats.istats.sync_cause_all++;
> >> +  if (sync_cause&  AR_INTR_SYNC_RTC_IRQ)
> >> +  sc->debug.stats.istats.sync_rtc_irq++;
> >
> > And nicer here to use a pointer to istats too.
> 
> Hopefully the compiler is smart enough that this
> doesn't really matter.

It is, but it's really for reader clarity not
compiler output.

> If the maintainers care, I'll respin the patch, but
> otherwise I'm not sure it's worth the effort.

The patch doesn't apply cleanly against next anyway.
There's a trivial #include mismatch.

cheers, Joe

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH] ath9k: Support ethtool getstats api.

2012-05-07 Thread Joe Perches
On Mon, 2012-05-07 at 10:23 -0700, gree...@candelatech.com wrote:
> From: Ben Greear 
> 
> This returns many of the values that formerly could
> only be obtained from debugfs.  This should be an
> improvement when trying to access these counters
> programatically.  Currently this support is only
> enabled when DEBUGFS is enabled because otherwise
> these stats are not accumulated.

trivia:

[]
> +#define ATH9K_SSTATS_LEN ARRAY_SIZE(ath9k_gstrings_stats)

I think there's not much value in this #define

> +static int ath9k_get_et_sset_count(struct ieee80211_hw *hw,
> +struct ieee80211_vif *vif, int sset)
> +{
> + if (sset == ETH_SS_STATS)
> + return ATH9K_SSTATS_LEN;
> + return 0;
> +}

Is this the only use?

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH] ath9k: Support ethtool getstats api.

2012-05-08 Thread Joe Perches
On Tue, 2012-05-08 at 10:55 +0300, Kalle Valo wrote:
> Ben Greear  writes:
> 
> > No, there is a check later that does a BUG_ON if our
> > we have screwed up the indexing of the stats.
> 
> Please, no BUG_ON() calls in wifi drivers. They just make users life
> miserable. WARN_ON() with a safe bailout is enough.

$ git grep -w -E "BUG|BUG_ON" drivers/net/wireless | wc -l
209
$ git grep -w -E "BUG_ON" drivers/net/wireless | wc -l
183
$ git grep -w -E "BUG_ON" drivers/net/wireless/ath | wc -l
34

Maybe something for you to look at?

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH 1/3] drivers/net: Convert compare_ether_addr to ether_addr_equal

2012-05-09 Thread Joe Perches
Use the new bool function ether_addr_equal to add
some clarity and reduce the likelihood for misuse
of compare_ether_addr for sorting.

Done via cocci script:

$ cat compare_ether_addr.cocci
@@
expression a,b;
@@
-   !compare_ether_addr(a, b)
+   ether_addr_equal(a, b)

@@
expression a,b;
@@
-   compare_ether_addr(a, b)
+   !ether_addr_equal(a, b)

@@
expression a,b;
@@
-   !ether_addr_equal(a, b) == 0
+   ether_addr_equal(a, b)

@@
expression a,b;
@@
-   !ether_addr_equal(a, b) != 0
+   !ether_addr_equal(a, b)

@@
expression a,b;
@@
-   ether_addr_equal(a, b) == 0
+   !ether_addr_equal(a, b)

@@
expression a,b;
@@
-   ether_addr_equal(a, b) != 0
+   ether_addr_equal(a, b)

@@
expression a,b;
@@
-   !!ether_addr_equal(a, b)
+   ether_addr_equal(a, b)

Signed-off-by: Joe Perches 
---
 drivers/net/bonding/bond_main.c   |2 +-
 drivers/net/ethernet/amd/depca.c  |3 ++-
 drivers/net/ethernet/cisco/enic/enic_main.c   |   12 
 drivers/net/ethernet/dec/ewrk3.c  |3 ++-
 drivers/net/ethernet/dec/tulip/de4x5.c|2 +-
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c  |5 ++---
 drivers/net/ethernet/sfc/ethtool.c|2 +-
 drivers/net/ethernet/sun/sunvnet.c|2 +-
 drivers/net/ethernet/tile/tilepro.c   |2 +-
 drivers/net/ethernet/toshiba/ps3_gelic_wireless.c |8 
 drivers/net/tun.c |2 +-
 drivers/net/wireless/at76c50x-usb.c   |2 +-
 drivers/net/wireless/ath/ath5k/base.c |6 +++---
 drivers/net/wireless/ath/ath9k/recv.c |2 +-
 drivers/net/wireless/ath/carl9170/rx.c|2 +-
 drivers/net/wireless/ipw2x00/libipw_rx.c  |   16 
 drivers/net/wireless/iwlegacy/3945.c  |4 ++--
 drivers/net/wireless/iwlegacy/4965-mac.c  |2 +-
 drivers/net/wireless/iwlegacy/common.c|   14 +++---
 drivers/net/wireless/iwlwifi/iwl-agn-rx.c |4 ++--
 drivers/net/wireless/iwlwifi/iwl-agn-rxon.c   |8 
 drivers/net/wireless/iwlwifi/iwl-agn-sta.c|6 +++---
 drivers/net/wireless/mwl8k.c  |2 +-
 drivers/net/wireless/p54/txrx.c   |2 +-
 drivers/net/wireless/rndis_wlan.c |   12 ++--
 drivers/net/wireless/rtlwifi/base.c   |2 +-
 drivers/net/wireless/rtlwifi/ps.c |2 +-
 drivers/net/wireless/rtlwifi/rtl8192ce/trx.c  |   10 +-
 drivers/net/wireless/rtlwifi/rtl8192cu/mac.c  |   10 +-
 drivers/net/wireless/rtlwifi/rtl8192de/trx.c  |   11 ++-
 drivers/net/wireless/rtlwifi/rtl8192se/trx.c  |   11 ++-
 31 files changed, 85 insertions(+), 86 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 16dbf53..bbb0043 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1961,7 +1961,7 @@ int bond_release(struct net_device *bond_dev, struct 
net_device *slave_dev)
write_lock_bh(&bond->lock);
 
if (!bond->params.fail_over_mac) {
-   if (!compare_ether_addr(bond_dev->dev_addr, slave->perm_hwaddr) 
&&
+   if (ether_addr_equal(bond_dev->dev_addr, slave->perm_hwaddr) &&
bond->slave_cnt > 1)
pr_warning("%s: Warning: the permanent HWaddr of %s - 
%pM - is still in use by %s. Set the HWaddr of %s to a different address to 
avoid conflicts.\n",
   bond_dev->name, slave_dev->name,
diff --git a/drivers/net/ethernet/amd/depca.c b/drivers/net/ethernet/amd/depca.c
index 86dd957..7f7b99a 100644
--- a/drivers/net/ethernet/amd/depca.c
+++ b/drivers/net/ethernet/amd/depca.c
@@ -1079,7 +1079,8 @@ static int depca_rx(struct net_device *dev)
} else {

lp->pktStats.multicast++;
}
-   } else if (compare_ether_addr(buf, 
dev->dev_addr) == 0) {
+   } else if (ether_addr_equal(buf,
+   
dev->dev_addr)) {
lp->pktStats.unicast++;
}
 
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c 
b/drivers/net/ethernet/cisco/enic/enic_main.c
index d7ac6c1..8132c78 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -944,8 +944,7 @@ static void enic_update_multicast_addr_list(struct enic 
*enic)
 
for (i = 0; i < enic->mc_count; i+

[ath9k-devel] [PATCH 0/3] net, drivers/net: Use ether_addr_equal and ether_addr_equal_64bits

2012-05-09 Thread Joe Perches
Joe Perches (3):
  drivers/net: Convert compare_ether_addr to ether_addr_equal
  etherdevice.h: Add ether_addr_equal_64bits
  net,drivers/net: Convert compare_ether_addr_64bits to ether_addr_equal_64bits

 drivers/net/bonding/bond_alb.c|   58 ++--
 drivers/net/bonding/bond_main.c   |2 +-
 drivers/net/ethernet/amd/depca.c  |3 +-
 drivers/net/ethernet/cisco/enic/enic_main.c   |   12 ++---
 drivers/net/ethernet/dec/ewrk3.c  |3 +-
 drivers/net/ethernet/dec/tulip/de4x5.c|2 +-
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c  |5 +-
 drivers/net/ethernet/sfc/ethtool.c|2 +-
 drivers/net/ethernet/sun/sunvnet.c|2 +-
 drivers/net/ethernet/tile/tilepro.c   |2 +-
 drivers/net/ethernet/toshiba/ps3_gelic_wireless.c |8 ++--
 drivers/net/macvlan.c |7 +--
 drivers/net/tun.c |2 +-
 drivers/net/wireless/at76c50x-usb.c   |2 +-
 drivers/net/wireless/ath/ath5k/base.c |6 +-
 drivers/net/wireless/ath/ath9k/recv.c |2 +-
 drivers/net/wireless/ath/carl9170/rx.c|2 +-
 drivers/net/wireless/ipw2x00/libipw_rx.c  |   16 +++---
 drivers/net/wireless/iwlegacy/3945.c  |4 +-
 drivers/net/wireless/iwlegacy/4965-mac.c  |2 +-
 drivers/net/wireless/iwlegacy/common.c|   14 +++---
 drivers/net/wireless/iwlwifi/iwl-agn-rx.c |4 +-
 drivers/net/wireless/iwlwifi/iwl-agn-rxon.c   |8 ++--
 drivers/net/wireless/iwlwifi/iwl-agn-sta.c|6 +-
 drivers/net/wireless/mwl8k.c  |2 +-
 drivers/net/wireless/p54/txrx.c   |2 +-
 drivers/net/wireless/rndis_wlan.c |   12 ++--
 drivers/net/wireless/rtlwifi/base.c   |2 +-
 drivers/net/wireless/rtlwifi/ps.c |2 +-
 drivers/net/wireless/rtlwifi/rtl8192ce/trx.c  |   10 ++--
 drivers/net/wireless/rtlwifi/rtl8192cu/mac.c  |   10 ++--
 drivers/net/wireless/rtlwifi/rtl8192de/trx.c  |   11 ++--
 drivers/net/wireless/rtlwifi/rtl8192se/trx.c  |   11 ++--
 include/linux/etherdevice.h   |   20 +++
 net/ethernet/eth.c|5 +-
 35 files changed, 140 insertions(+), 121 deletions(-)

-- 
1.7.8.111.gad25c.dirty

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH V3] ath/ath9k/ar9003_eeprom.c: Remove semicolon after if

2012-10-10 Thread Joe Perches
On Wed, 2012-10-10 at 18:38 +0200, Peter Senna Tschudin wrote:
> This patch remove a semicolon after if(...) that is preventing the
> error check to work correctly. Removing this semicolon will change the
> code behavior, but this is intended.
> 
> The semantic patch that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // 
> @r1@
> position p;
> @@
> if (...);@p

this semantic patch would be a lot less tedious to
inspect the results if it excluded else after the
semicolon.

I've used perl for more or less the same output.

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH net-next 00/21] treewide: Use consistent api style for address testing

2012-10-19 Thread Joe Perches
ethernet, ipv4, and ipv6 address testing uses 3 different api naming styles.

ethernet uses:  is__ether_addr
ipv4 uses:  ipv4_is_
ipv6 uses:  ipv6_addr_

Standardize on the ipv6 style of _addr_ to reduce
the number of styles to remember.

The new consistent styles are:

eth_addr_(const u8 *)
ipv4_addr_(__be32)
ipv6_addr_(const struct in6_addr *)

Add temporary backward compatibility #defines for the old names too.

Joe Perches (21):
  etherdevice: Rename is__ether_addr tests to eth_addr_
  net: Convert is__ether_addr uses to eth_addr_
  arch: Convert is__ether_addr uses to eth_addr_
  wireless: Convert is__ether_addr uses to eth_addr_
  drivers: net: Convert is__ether_addr uses to eth_addr_
  staging: Convert is__ether_addr uses to eth_addr_
  infiniband: Convert is__ether_addr uses to eth_addr_
  scsi: Convert is__ether_addr uses to eth_addr_
  of: Convert is__ether_addr uses to eth_addr_
  s390: Convert is__ether_addr uses to eth_addr_
  usb: Convert is__ether_addr uses to eth_addr_
  uwb: Convert is__ether_addr uses to eth_addr_
  Documentation: networking: Convert is__ether_addr uses to eth_addr_
  llc_if.h: Convert is__ether_addr uses to eth_addr_
  in.h: Rename ipv4_is_ functions to ipv4_addr_
  net: Convert ipv4_is_ uses to ipv4_addr_
  infiniband: Convert ipv4_is_ uses to ipv4_addr_
  ath6kl: Convert ipv4_is_ uses to ipv4_addr_
  parisc: Convert ipv4_is_ uses to ipv4_addr_
  lockd: Convert ipv4_is_ uses to ipv4_addr_
  sctp: Convert ipv4_is_ uses to ipv4_addr_

 Documentation/networking/driver.txt|2 +-
 arch/arm/mach-davinci/board-mityomapl138.c |2 +-
 arch/arm/mach-pxa/colibri-pxa3xx.c |2 +-
 arch/avr32/boards/atngw100/setup.c |2 +-
 arch/avr32/boards/atstk1000/atstk1002.c|2 +-
 arch/avr32/boards/favr-32/setup.c  |2 +-
 arch/avr32/boards/hammerhead/setup.c   |2 +-
 arch/avr32/boards/merisc/setup.c   |2 +-
 arch/avr32/boards/mimc200/setup.c  |2 +-
 arch/mips/alchemy/common/platform.c|4 +-
 arch/um/drivers/net_kern.c |6 +-
 drivers/infiniband/core/cma.c  |4 +-
 drivers/infiniband/hw/amso1100/c2.c|2 +-
 drivers/infiniband/hw/nes/nes_nic.c|2 +-
 drivers/net/bonding/bond_3ad.c |2 +-
 drivers/net/bonding/bond_alb.c |2 +-
 drivers/net/bonding/bond_main.c|6 +-
 drivers/net/dummy.c|2 +-
 drivers/net/ethernet/3com/3c59x.c  |2 +-
 drivers/net/ethernet/3com/typhoon.c|2 +-
 drivers/net/ethernet/8390/etherh.c |2 +-
 drivers/net/ethernet/adi/bfin_mac.c|6 +-
 drivers/net/ethernet/aeroflex/greth.c  |4 +-
 drivers/net/ethernet/amd/au1000_eth.c  |2 +-
 drivers/net/ethernet/amd/depca.c   |4 +-
 drivers/net/ethernet/amd/pcnet32.c |8 ++--
 drivers/net/ethernet/atheros/atl1c/atl1c_hw.c  |2 +-
 drivers/net/ethernet/atheros/atl1c/atl1c_main.c|2 +-
 drivers/net/ethernet/atheros/atl1e/atl1e_hw.c  |4 +-
 drivers/net/ethernet/atheros/atl1e/atl1e_main.c|2 +-
 drivers/net/ethernet/atheros/atlx/atl1.c   |   10 ++--
 drivers/net/ethernet/atheros/atlx/atl2.c   |   14 +++---
 drivers/net/ethernet/atheros/atlx/atlx.c   |2 +-
 drivers/net/ethernet/broadcom/b44.c|4 +-
 drivers/net/ethernet/broadcom/bnx2.c   |2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c|6 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h|4 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c   |6 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c |2 +-
 drivers/net/ethernet/broadcom/cnic.c   |2 +-
 drivers/net/ethernet/broadcom/tg3.c|6 +-
 drivers/net/ethernet/brocade/bna/bnad.c|6 +-
 drivers/net/ethernet/cadence/at91_ether.c  |6 +-
 drivers/net/ethernet/cadence/macb.c|4 +-
 drivers/net/ethernet/calxeda/xgmac.c   |6 +-
 drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c|2 +-
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c|2 +-
 .../net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c|2 +-
 drivers/net/ethernet/cirrus/ep93xx_eth.c   |2 +-
 drivers/net/ethernet/cirrus/mac89x0.c  |2 +-
 drivers/net/ethernet/cisco/enic/enic_dev.c |4 +-
 drivers/net/ethernet/cisco/enic/enic_main.c|   10 ++--
 drivers/net/ethernet/cisco/enic/enic_pp.c  |   10 ++--
 drivers/net/ethernet/davicom/dm9000.c  |6 +-
 drivers/net/ethernet/dec/ewrk3.c   |4 +-
 drivers/net/ethernet/dec/tulip/de4x5.c |4 +-
 drivers/net

[ath9k-devel] [PATCH net-next 04/21] wireless: Convert is__ether_addr uses to eth_addr_

2012-10-19 Thread Joe Perches
Convert the old ether_addr tests to eth_addr_.
Adds api consistency.

Signed-off-by: Joe Perches 
---
 drivers/net/wireless/adm8211.c |2 +-
 drivers/net/wireless/airo.c|4 ++--
 drivers/net/wireless/at76c50x-usb.c|8 
 drivers/net/wireless/ath/ath6kl/cfg80211.c |8 
 drivers/net/wireless/ath/ath6kl/main.c |8 
 drivers/net/wireless/ath/ath6kl/txrx.c |   10 +-
 drivers/net/wireless/ath/ath9k/recv.c  |8 
 drivers/net/wireless/b43/main.c|2 +-
 drivers/net/wireless/b43legacy/main.c  |2 +-
 .../net/wireless/brcm80211/brcmfmac/dhd_linux.c|4 ++--
 .../net/wireless/brcm80211/brcmfmac/wl_cfg80211.c  |2 +-
 .../net/wireless/brcm80211/brcmsmac/mac80211_if.c  |2 +-
 drivers/net/wireless/brcm80211/brcmsmac/main.c |   16 
 drivers/net/wireless/hostap/hostap_info.c  |2 +-
 drivers/net/wireless/hostap/hostap_ioctl.c |8 
 drivers/net/wireless/hostap/hostap_main.c  |2 +-
 drivers/net/wireless/ipw2x00/ipw2100.c |6 +++---
 drivers/net/wireless/ipw2x00/ipw2200.c |   18 +-
 drivers/net/wireless/ipw2x00/libipw_rx.c   |   12 ++--
 drivers/net/wireless/ipw2x00/libipw_tx.c   |4 ++--
 drivers/net/wireless/iwlegacy/3945-mac.c   |2 +-
 drivers/net/wireless/iwlegacy/4965-mac.c   |2 +-
 drivers/net/wireless/iwlegacy/common.c |2 +-
 drivers/net/wireless/iwlwifi/dvm/sta.c |2 +-
 drivers/net/wireless/libertas_tf/main.c|2 +-
 drivers/net/wireless/mwifiex/join.c|2 +-
 drivers/net/wireless/mwifiex/scan.c|2 +-
 drivers/net/wireless/mwifiex/sta_cmd.c |2 +-
 drivers/net/wireless/mwifiex/sta_cmdresp.c |2 +-
 drivers/net/wireless/mwifiex/uap_txrx.c|2 +-
 drivers/net/wireless/mwl8k.c   |2 +-
 drivers/net/wireless/orinoco/wext.c|4 ++--
 drivers/net/wireless/p54/eeprom.c  |2 +-
 drivers/net/wireless/rndis_wlan.c  |   18 +-
 drivers/net/wireless/rt2x00/rt2400pci.c|2 +-
 drivers/net/wireless/rt2x00/rt2500pci.c|2 +-
 drivers/net/wireless/rt2x00/rt2500usb.c|2 +-
 drivers/net/wireless/rt2x00/rt2800lib.c|8 
 drivers/net/wireless/rt2x00/rt61pci.c  |2 +-
 drivers/net/wireless/rt2x00/rt73usb.c  |2 +-
 drivers/net/wireless/rtl818x/rtl8180/dev.c |4 ++--
 drivers/net/wireless/rtl818x/rtl8187/dev.c |4 ++--
 drivers/net/wireless/rtlwifi/base.c|6 +++---
 drivers/net/wireless/rtlwifi/cam.c |2 +-
 drivers/net/wireless/rtlwifi/pci.c |8 
 drivers/net/wireless/rtlwifi/rc.c  |4 ++--
 drivers/net/wireless/rtlwifi/rtl8192ce/trx.c   |4 ++--
 drivers/net/wireless/rtlwifi/rtl8192cu/trx.c   |4 ++--
 drivers/net/wireless/rtlwifi/usb.c |   12 ++--
 drivers/net/wireless/ti/wl1251/main.c  |   12 ++--
 drivers/net/wireless/ti/wlcore/cmd.c   |2 +-
 drivers/net/wireless/ti/wlcore/main.c  |6 +++---
 drivers/net/wireless/ti/wlcore/tx.c|2 +-
 drivers/net/wireless/wl3501_cs.c   |2 +-
 drivers/net/wireless/zd1211rw/zd_mac.c |2 +-
 55 files changed, 133 insertions(+), 133 deletions(-)

diff --git a/drivers/net/wireless/adm8211.c b/drivers/net/wireless/adm8211.c
index 154a496..2fd62a0 100644
--- a/drivers/net/wireless/adm8211.c
+++ b/drivers/net/wireless/adm8211.c
@@ -1853,7 +1853,7 @@ static int __devinit adm8211_probe(struct pci_dev *pdev,
*(__le16 *)&perm_addr[4] =
cpu_to_le16(ADM8211_CSR_READ(PAR1) & 0x);
 
-   if (!is_valid_ether_addr(perm_addr)) {
+   if (!eth_addr_valid(perm_addr)) {
printk(KERN_WARNING "%s (adm8211): Invalid hwaddr in EEPROM!\n",
   pci_name(pdev));
eth_random_addr(perm_addr);
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 3cd05a71..b0afd59 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -5986,8 +5986,8 @@ static int airo_set_wap(struct net_device *dev,
 
if (awrq->sa_family != ARPHRD_ETHER)
return -EINVAL;
-   else if (is_broadcast_ether_addr(awrq->sa_data) ||
-is_zero_ether_addr(awrq->sa_data)) {
+   else if (eth_addr_broadcast(awrq->sa_data) ||
+eth_addr_zero(awrq->sa_data)) {
memset(&cmd, 0, sizeof(cmd));
cmd.cmd=CMD_LOSE_SYNC;
 

Re: [ath9k-devel] [PATCH net-next 00/21] treewide: Use consistent api style for address testing

2012-10-19 Thread Joe Perches
(cc list trimmed)

On Fri, 2012-10-19 at 11:55 -0400, Pavel Roskin wrote:
> On Fri, 19 Oct 2012 09:04:14 +0200
> Eric Dumazet  wrote:
> 
> > Yes they are some names discrepancies, thats a big deal.
> > 
> > And we have alloc_skb() / kfree_skb() / skb_clone() 
> > 
> > Why not skb_alloc() / skb_free() / skb_clone() ?
> > 
> > Some people actually know current code by name of functions, they dont
> > want to change their mind and having to grep include files and git log
> > to learn the new names of an old function, especially when traveling
> > and using a laptop.
> 
> I agree.
> 
> Also, it makes sense to introduce a more consistent name for a function
> when it's improved in some way and the callers need to be adjusted or
> re-checked.
> 
> That way, the old name can be phased out as the code is made compatible
> with the new function.

That can also be done, as was done with this series, with backward
compatible #defines.



___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH 0/8] drivers/net: Remove unnecessary alloc/OOM messages

2013-02-03 Thread Joe Perches
Remove all the OOM messages that follow kernel alloc
failures as there is already a generic equivalent to
these messages in the mm subsystem.

Joe Perches (8):
  caif: Remove unnecessary alloc/OOM messages
  can: Remove unnecessary alloc/OOM messages
  ethernet: Remove unnecessary alloc/OOM messages, alloc cleanups
  drivers: net: usb: Remove unnecessary alloc/OOM messages
  wan: Remove unnecessary alloc/OOM messages
  wimax: Remove unnecessary alloc/OOM messages, alloc cleanups
  wireless: Remove unnecessary alloc/OOM messages, alloc cleanups
  drivers:net:misc: Remove unnecessary alloc/OOM messages

 drivers/net/caif/caif_shmcore.c|  6 -
 drivers/net/can/sja1000/ems_pci.c  |  1 -
 drivers/net/can/sja1000/peak_pci.c |  5 +---
 drivers/net/can/sja1000/peak_pcmcia.c  |  1 -
 drivers/net/can/sja1000/plx_pci.c  |  1 -
 drivers/net/can/usb/ems_usb.c  |  4 +---
 drivers/net/can/usb/kvaser_usb.c   |  2 --
 drivers/net/can/usb/peak_usb/pcan_usb_core.c   |  5 
 drivers/net/can/usb/usb_8dev.c |  4 +---
 drivers/net/ethernet/atheros/atl1c/atl1c_main.c|  6 ++---
 drivers/net/ethernet/atheros/atl1e/atl1e_main.c|  2 --
 drivers/net/ethernet/broadcom/b44.c|  4 +---
 drivers/net/ethernet/broadcom/bcm63xx_enet.c   |  6 ++---
 drivers/net/ethernet/broadcom/cnic.c   |  6 ++---
 drivers/net/ethernet/broadcom/tg3.c|  4 +---
 drivers/net/ethernet/freescale/gianfar_ethtool.c   |  9 
 drivers/net/ethernet/ibm/ehea/ehea_main.c  |  4 +---
 drivers/net/ethernet/ibm/ehea/ehea_qmr.c   | 19 +--
 drivers/net/ethernet/ibm/emac/mal.c|  7 ++
 drivers/net/ethernet/ibm/ibmveth.c |  1 -
 drivers/net/ethernet/intel/igb/igb_main.c  |  5 ++--
 drivers/net/ethernet/intel/igbvf/netdev.c  |  8 +++
 drivers/net/ethernet/marvell/mv643xx_eth.c |  8 +++
 drivers/net/ethernet/marvell/mvmdio.c  |  1 -
 drivers/net/ethernet/marvell/skge.c|  5 ++--
 drivers/net/ethernet/marvell/sky2.c|  4 +---
 drivers/net/ethernet/mellanox/mlx4/en_main.c   |  4 +---
 drivers/net/ethernet/mellanox/mlx4/main.c  |  4 +---
 drivers/net/ethernet/myricom/myri10ge/myri10ge.c   |  5 ++--
 .../net/ethernet/qlogic/netxen/netxen_nic_ctx.c|  5 +---
 drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c | 18 ---
 .../net/ethernet/qlogic/netxen/netxen_nic_init.c   | 27 --
 .../net/ethernet/qlogic/netxen/netxen_nic_main.c   |  5 +---
 drivers/net/ethernet/qlogic/qla3xxx.c  | 10 
 .../net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c  | 14 ---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c |  6 ++---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c   | 26 +++--
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c   | 19 +--
 .../net/ethernet/qlogic/qlcnic/qlcnic_minidump.c   |  7 ++
 drivers/net/ethernet/qlogic/qlge/qlge_main.c   |  1 -
 drivers/net/ethernet/rdc/r6040.c   |  3 +--
 drivers/net/ethernet/renesas/sh_eth.c  | 10 
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  | 11 +
 drivers/net/ethernet/sun/niu.c |  2 +-
 drivers/net/ethernet/ti/cpsw.c |  8 +++
 drivers/net/ethernet/ti/davinci_mdio.c |  4 +---
 drivers/net/ethernet/xilinx/ll_temac_main.c|  6 ++---
 drivers/net/hamradio/dmascc.c  |  7 +-
 drivers/net/phy/spi_ks8995.c   |  4 +---
 drivers/net/usb/ax88172a.c |  6 ++---
 drivers/net/usb/hso.c  | 25 ++--
 drivers/net/usb/sierra_net.c   | 10 +++-
 drivers/net/usb/smsc75xx.c |  6 ++---
 drivers/net/usb/smsc95xx.c |  6 ++---
 drivers/net/usb/usbnet.c   |  5 +---
 drivers/net/virtio_net.c   |  4 +---
 drivers/net/wan/cosa.c |  9 
 drivers/net/wan/farsync.c  |  6 ++---
 drivers/net/wan/hdlc.c |  9 
 drivers/net/wan/x25_asy.c  |  1 -
 drivers/net/wimax/i2400m/rx.c  | 16 -
 drivers/net/wimax/i2400m/usb-notif.c   |  1 -
 drivers/net/wireless/airo_cs.c |  5 ++--
 drivers/net/wireless/at76c50x-usb.c|  4 +---
 .../net/wireless/ath/ath9k/dfs_pattern_detector.c  |  6 ++---
 drivers/net/wireless/atmel_cs.c|  5 ++--
 drivers/net/wireless/ipw2x00/ipw2100.c |  9 +++-
 drivers/net/wireless/libertas/cfg.c|  4 +---
 drivers/net/wireless/mwifiex/11n.c

[ath9k-devel] [PATCH 7/8] wireless: Remove unnecessary alloc/OOM messages, alloc cleanups

2013-02-03 Thread Joe Perches
alloc failures already get standardized OOM
messages and a dump_stack.

Convert kzalloc's with multiplies to kcalloc.
Convert kmalloc's with multiplies to kmalloc_array.
Remove now unused variables.
Remove unnecessary memset after kzalloc->kcalloc.
Whitespace cleanups for these changes.

Signed-off-by: Joe Perches 
---
 drivers/net/wireless/airo_cs.c |  5 ++--
 drivers/net/wireless/at76c50x-usb.c|  4 +---
 .../net/wireless/ath/ath9k/dfs_pattern_detector.c  |  6 ++---
 drivers/net/wireless/atmel_cs.c|  5 ++--
 drivers/net/wireless/ipw2x00/ipw2100.c |  9 +++-
 drivers/net/wireless/libertas/cfg.c|  4 +---
 drivers/net/wireless/mwifiex/11n.c |  5 +---
 drivers/net/wireless/mwifiex/11n_rxreorder.c   |  5 +---
 drivers/net/wireless/mwifiex/cfg80211.c|  4 +---
 drivers/net/wireless/mwifiex/cmdevt.c  | 11 +++--
 drivers/net/wireless/mwifiex/init.c|  5 +---
 drivers/net/wireless/mwifiex/scan.c| 27 +++---
 drivers/net/wireless/mwifiex/sdio.c| 11 ++---
 drivers/net/wireless/mwifiex/sta_ioctl.c   | 11 +++--
 drivers/net/wireless/mwifiex/wmm.c |  7 ++
 drivers/net/wireless/orinoco/main.c| 16 -
 drivers/net/wireless/p54/p54usb.c  | 10 ++--
 drivers/net/wireless/prism54/islpci_mgt.c  | 14 ---
 drivers/net/wireless/rndis_wlan.c  |  5 +---
 drivers/net/wireless/ti/wlcore/sdio.c  |  4 +---
 drivers/net/wireless/ti/wlcore/spi.c   | 14 +++
 drivers/net/wireless/zd1211rw/zd_usb.c |  1 -
 22 files changed, 50 insertions(+), 133 deletions(-)

diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c
index 630577d..956024a 100644
--- a/drivers/net/wireless/airo_cs.c
+++ b/drivers/net/wireless/airo_cs.c
@@ -69,10 +69,9 @@ static int airo_probe(struct pcmcia_device *p_dev)
 
/* Allocate space for private device-specific data */
local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
-   if (!local) {
-   printk(KERN_ERR "airo_cs: no memory for new device\n");
+   if (!local)
return -ENOMEM;
-   }
+
p_dev->priv = local;
 
return airo_config(p_dev);
diff --git a/drivers/net/wireless/at76c50x-usb.c 
b/drivers/net/wireless/at76c50x-usb.c
index 77fa428..5ac5f7a 100644
--- a/drivers/net/wireless/at76c50x-usb.c
+++ b/drivers/net/wireless/at76c50x-usb.c
@@ -2164,10 +2164,8 @@ static int at76_alloc_urbs(struct at76_priv *priv,
 
buffer_size = sizeof(struct at76_tx_buffer) + MAX_PADDING_SIZE;
priv->bulk_out_buffer = kmalloc(buffer_size, GFP_KERNEL);
-   if (!priv->bulk_out_buffer) {
-   dev_err(&interface->dev, "cannot allocate output buffer\n");
+   if (!priv->bulk_out_buffer)
return -ENOMEM;
-   }
 
at76_dbg(DBG_PROC_ENTRY, "%s: EXIT", __func__);
 
diff --git a/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c 
b/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c
index 24877b0..467b600 100644
--- a/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c
+++ b/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c
@@ -288,11 +288,11 @@ struct dfs_pattern_detector *
 dfs_pattern_detector_init(enum nl80211_dfs_regions region)
 {
struct dfs_pattern_detector *dpd;
+
dpd = kmalloc(sizeof(*dpd), GFP_KERNEL);
-   if (dpd == NULL) {
-   pr_err("allocation of dfs_pattern_detector failed\n");
+   if (dpd == NULL)
return NULL;
-   }
+
*dpd = default_dpd;
INIT_LIST_HEAD(&dpd->channel_detectors);
 
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c
index ded03d2..b42930f 100644
--- a/drivers/net/wireless/atmel_cs.c
+++ b/drivers/net/wireless/atmel_cs.c
@@ -79,10 +79,9 @@ static int atmel_probe(struct pcmcia_device *p_dev)
 
/* Allocate space for private device-specific data */
local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
-   if (!local) {
-   printk(KERN_ERR "atmel_cs: no memory for new device\n");
+   if (!local)
return -ENOMEM;
-   }
+
p_dev->priv = local;
 
return atmel_config(p_dev);
diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c 
b/drivers/net/wireless/ipw2x00/ipw2100.c
index d92b21a..04d5e64 100644
--- a/drivers/net/wireless/ipw2x00/ipw2100.c
+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
@@ -4478,13 +4478,10 @@ static int ipw2100_tx_allocate(struct ipw2100_priv 
*priv)
return err;
}
 
-   priv->tx_buffers =
-   kmalloc(TX_PENDED_QUEUE_LENGTH * sizeof(struct ipw2100_tx_packet),
-   GFP_ATOMIC);
+   priv->tx_buff

[ath9k-devel] [PATCH] drivers: net: Remove remaining alloc/OOM messages

2013-02-07 Thread Joe Perches
alloc failures already get standardized OOM
messages and a dump_stack.

For the affected mallocs around these OOM messages:

Converted kmallocs with multiplies to kmalloc_array.
Converted a kmalloc/memcpy to kmemdup.
Removed now unused stack variables.
Removed unnecessary parentheses.
Neatened alignment.

Signed-off-by: Joe Perches 
---
Let me know if you want multiple small patches instead.

 drivers/net/can/usb/ems_usb.c  |  4 +-
 drivers/net/ethernet/amd/pcnet32.c | 47 +++---
 drivers/net/ethernet/freescale/gianfar.c   | 25 +---
 drivers/net/ethernet/intel/e1000/e1000_main.c  | 14 ++-
 drivers/net/ethernet/intel/ixgb/ixgb_main.c| 10 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c  |  4 +-
 drivers/net/ethernet/mellanox/mlx4/en_ethtool.c|  2 -
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 11 ++---
 drivers/net/ethernet/mellanox/mlx4/en_rx.c |  6 +--
 drivers/net/ethernet/qlogic/qlge/qlge_main.c   | 22 --
 drivers/net/ethernet/smsc/smsc9420.c   |  9 ++---
 drivers/net/usb/pegasus.c  |  6 +--
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c  | 11 ++---
 drivers/net/wireless/ath/ath9k/hw.c|  7 +---
 drivers/net/wireless/ath/ath9k/rc.c| 12 +-
 drivers/net/wireless/ath/wil6210/txrx.c|  2 -
 drivers/net/wireless/ath/wil6210/wmi.c | 10 ++---
 drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c |  5 +--
 drivers/net/wireless/brcm80211/brcmfmac/usb.c  |  7 ++--
 drivers/net/wireless/mwl8k.c   |  2 -
 20 files changed, 66 insertions(+), 150 deletions(-)

diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c
index 0e7bde7..5f9a7ad 100644
--- a/drivers/net/can/usb/ems_usb.c
+++ b/drivers/net/can/usb/ems_usb.c
@@ -1019,10 +1019,8 @@ static int ems_usb_probe(struct usb_interface *intf,
 
dev->tx_msg_buffer = kzalloc(CPC_HEADER_SIZE +
 sizeof(struct ems_cpc_msg), GFP_KERNEL);
-   if (!dev->tx_msg_buffer) {
-   dev_err(&intf->dev, "Couldn't alloc Tx buffer\n");
+   if (!dev->tx_msg_buffer)
goto cleanup_intr_in_buffer;
-   }
 
usb_set_intfdata(intf, dev);
 
diff --git a/drivers/net/ethernet/amd/pcnet32.c 
b/drivers/net/ethernet/amd/pcnet32.c
index 74cfc01..797f847 100644
--- a/drivers/net/ethernet/amd/pcnet32.c
+++ b/drivers/net/ethernet/amd/pcnet32.c
@@ -494,19 +494,15 @@ static void pcnet32_realloc_tx_ring(struct net_device 
*dev,
}
memset(new_tx_ring, 0, sizeof(struct pcnet32_tx_head) * (1 << size));
 
-   new_dma_addr_list = kcalloc((1 << size), sizeof(dma_addr_t),
-   GFP_ATOMIC);
-   if (!new_dma_addr_list) {
-   netif_err(lp, drv, dev, "Memory allocation failed\n");
+   new_dma_addr_list = kcalloc(1 << size, sizeof(dma_addr_t),
+   GFP_ATOMIC);
+   if (!new_dma_addr_list)
goto free_new_tx_ring;
-   }
 
-   new_skb_list = kcalloc((1 << size), sizeof(struct sk_buff *),
-   GFP_ATOMIC);
-   if (!new_skb_list) {
-   netif_err(lp, drv, dev, "Memory allocation failed\n");
+   new_skb_list = kcalloc(1 << size, sizeof(struct sk_buff *),
+  GFP_ATOMIC);
+   if (!new_skb_list)
goto free_new_lists;
-   }
 
kfree(lp->tx_skbuff);
kfree(lp->tx_dma_addr);
@@ -564,19 +560,14 @@ static void pcnet32_realloc_rx_ring(struct net_device 
*dev,
}
memset(new_rx_ring, 0, sizeof(struct pcnet32_rx_head) * (1 << size));
 
-   new_dma_addr_list = kcalloc((1 << size), sizeof(dma_addr_t),
-   GFP_ATOMIC);
-   if (!new_dma_addr_list) {
-   netif_err(lp, drv, dev, "Memory allocation failed\n");
+   new_dma_addr_list = kcalloc(1 << size, sizeof(dma_addr_t), GFP_ATOMIC);
+   if (!new_dma_addr_list)
goto free_new_rx_ring;
-   }
 
-   new_skb_list = kcalloc((1 << size), sizeof(struct sk_buff *),
-   GFP_ATOMIC);
-   if (!new_skb_list) {
-   netif_err(lp, drv, dev, "Memory allocation failed\n");
+   new_skb_list = kcalloc(1 << size, sizeof(struct sk_buff *),
+  GFP_ATOMIC);
+   if (!new_skb_list)
goto free_new_lists;
-   }
 
/* first copy the current receive buffers */
overlap = min(size, lp->rx_ring_size);
@@ -1933,31 +1924,23 @@ static int pcnet32_alloc_ring(struct net_device *dev, 
const char *name)
 
lp->tx_dma_addr = kcalloc(lp->tx_ring_size, sizeof(dma_addr_t),

[ath9k-devel] [PATCH 2/2] ath10k: Neaten ath10k_ uses

2013-05-16 Thread Joe Perches
Standardize the logging messages a bit.

A couple of typos were fixed.
Standardize the use of "VDEV:%d" instead of mixing in some "VDEV: %d".

Signed-off-by: Joe Perches 
---

Resending to ath9k per Kalle

 drivers/net/wireless/ath/ath10k/ce.c |   6 +-
 drivers/net/wireless/ath/ath10k/core.c   |   2 +-
 drivers/net/wireless/ath/ath10k/htc.c|  24 +++
 drivers/net/wireless/ath/ath10k/htt_rx.c |   2 +-
 drivers/net/wireless/ath/ath10k/htt_tx.c |   2 +-
 drivers/net/wireless/ath/ath10k/mac.c| 119 ---
 drivers/net/wireless/ath/ath10k/pci.c|  44 ++--
 drivers/net/wireless/ath/ath10k/wmi.c|   4 +-
 8 files changed, 102 insertions(+), 101 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.c 
b/drivers/net/wireless/ath/ath10k/ce.c
index 61a8ac7..36aa524 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -1126,13 +1126,13 @@ struct ce_state *ath10k_ce_init(struct ath10k *ar,
 
ce_state = ath10k_ce_init_state(ar, ce_id, attr);
if (!ce_state) {
-   ath10k_err("Failed to initialize CE state for ID: %d\n", ce_id);
+   ath10k_err("failed to initialize CE state for ID: %d\n", ce_id);
return NULL;
}
 
if (attr->src_nentries) {
if (ath10k_ce_init_src_ring(ar, ce_id, ce_state, attr)) {
-   ath10k_err("Failed to initialize CE src ring for ID: 
%d\n",
+   ath10k_err("failed to initialize CE src ring for ID: 
%d\n",
   ce_id);
ath10k_ce_deinit(ce_state);
return NULL;
@@ -1141,7 +1141,7 @@ struct ce_state *ath10k_ce_init(struct ath10k *ar,
 
if (attr->dest_nentries) {
if (ath10k_ce_init_dest_ring(ar, ce_id, ce_state, attr)) {
-   ath10k_err("Failed to initialize CE dest ring for ID: 
%d\n",
+   ath10k_err("failed to initialize CE dest ring for ID: 
%d\n",
   ce_id);
ath10k_ce_deinit(ce_state);
return NULL;
diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index b258042..c13de8b 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -84,7 +84,7 @@ static int ath10k_check_fw_version(struct ath10k *ar)
 SUPPORTED_FW_MAJOR, SUPPORTED_FW_MINOR,
 SUPPORTED_FW_RELEASE, SUPPORTED_FW_BUILD);
 
-   ath10k_warn("WARNING: Firmware version %s is not officially 
supported.\n",
+   ath10k_warn("WARNING: Firmware version %s is not officially 
supported\n",
ar->hw->wiphy->fw_version);
ath10k_warn("Please upgrade to version %s (or newer)\n", version);
 
diff --git a/drivers/net/wireless/ath/ath10k/htc.c 
b/drivers/net/wireless/ath/ath10k/htc.c
index 9b6c681..1e1251a 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -88,7 +88,7 @@ static struct sk_buff *ath10k_htc_build_tx_ctrl_skb(void *ar)
 
skb = dev_alloc_skb(ATH10K_HTC_CONTROL_BUFFER_SIZE);
if (!skb) {
-   ath10k_warn("Unable to allocate ctrl skb\n");
+   ath10k_warn("unable to allocate ctrl skb\n");
return NULL;
}
 
@@ -304,7 +304,7 @@ int ath10k_htc_send(struct ath10k_htc *htc,
struct ath10k_htc_ep *ep = &htc->endpoint[eid];
 
if (eid >= ATH10K_HTC_EP_COUNT) {
-   ath10k_warn("Invalid endpoint id: %d\n", eid);
+   ath10k_warn("invalid endpoint id: %d\n", eid);
return -ENOENT;
}
 
@@ -382,7 +382,7 @@ ath10k_htc_process_credit_report(struct ath10k_htc *htc,
int i, n_reports;
 
if (len % sizeof(*report))
-   ath10k_warn("Uneven credit report len %d", len);
+   ath10k_warn("uneven credit report len %d", len);
 
n_reports = len / sizeof(*report);
 
@@ -427,7 +427,7 @@ static int ath10k_htc_process_trailer(struct ath10k_htc 
*htc,
 
if (record->hdr.len > length) {
/* no room left in buffer for record */
-   ath10k_warn("Invalid record length: %d\n",
+   ath10k_warn("invalid record length: %d\n",
record->hdr.len);
status = -EINVAL;
break;
@@ -437,7 +437,7 @@ static int ath10k_htc_process_trailer(struct ath10k_htc 
*htc,
case ATH10K_HTC_RECORD_CREDITS:
len = sizeof(struct ath10k_htc_credit_report);
   

Re: [ath9k-devel] [PATCH 1/2] ath10k: Convert ath10k_dbg uses

2013-05-20 Thread Joe Perches
On Mon, 2013-05-20 at 10:12 +0300, Kalle Valo wrote:
> Michal Kazior  writes:
> 
> > On 16/05/13 09:03, Joe Perches wrote:
> >> Neaten and shorten the uses of ath10k_dbg and ath10k_dbg_dump.
> >>
> >> Add macros to hold the "ATH10K_DBG_" mask portion of the functions.
> >
> > I'm not really fond of this idea. It's harder to locate symbols when
> > doing macro name concatenation. You can't jump to, e.g. WMI symbol
> > definition because it doesn't exist (ATH10K_DBG_WMI is what you
> > actually want). Although you don't look for this symbol often so I
> > guess it's okay-ish.
> 
> That's a good point. I sometimes use cscope to find all messages with
> certain level, this patch makes that impossible. And I don't really see
> that we have problems with ATH10K_DBG_WMI being too long.

from the diffstat: 12 files changed, 226 insertions(+), 260 deletions(-)

Reducing the line count has value and I've always found code like:

long_function_name(long_function_name_variant, ...)

more readable and less error prone as

long_function_name(variant, ...)

grep -w works well for me, but I'm not a cscope user.


___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH 00/11 - GIT PULL] drivers: net: Last block of Remove extern from function prototypes

2013-09-25 Thread Joe Perches
The following changes since commit 294da3abaa73a0b69fd54e442b0b5bd9455b7be6:

  irda: Remove extern from function prototypes (2013-09-24 12:54:17 -0700)

are available in the git repository at:

  git://repo.or.cz/linux-2.6/trivial-mods.git 20130925_dn_externs_3

for you to fetch changes up to a958df5dc3065ce517726dc54087639e13ffee8f:

  rtlwifi: Remove extern from function prototypes (2013-09-24 18:06:51 -0700)


Joe Perches (11):
  vmxnet3: Remove extern from function prototypes
  wan: Remove extern from function prototypes
  wimax: Remove extern from function prototypes
  ath: Remove extern from function prototypes
  brcm80211: Remove extern from function prototypes
  ipw2x00: Remove extern from function prototypes
  iwlegacy: Remove extern from function prototypes
  iwlwifi: Remove extern from function prototypes
  mwifiex: Remove extern from function prototypes
  orinoco: Remove extern from function prototypes
  rtlwifi: Remove extern from function prototypes

 drivers/net/vmxnet3/vmxnet3_int.h  |   4 +-
 drivers/net/wan/x25_asy.h  |   2 +-
 drivers/net/wan/z85230.h   |  27 +-
 drivers/net/wimax/i2400m/i2400m-usb.h  |  27 +-
 drivers/net/wimax/i2400m/i2400m.h  | 117 ---
 drivers/net/wireless/ath/ath10k/debug.h|   8 +-
 drivers/net/wireless/ath/ath6kl/common.h   |   3 +-
 drivers/net/wireless/ath/ath6kl/debug.h|   9 +-
 drivers/net/wireless/ath/ath9k/ath9k.h |   2 +-
 drivers/net/wireless/brcm80211/brcmfmac/dhd.h  |  30 +-
 drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h  |  27 +-
 .../net/wireless/brcm80211/brcmfmac/dhd_proto.h|  12 +-
 .../net/wireless/brcm80211/brcmfmac/sdio_chip.h|  23 +-
 .../net/wireless/brcm80211/brcmfmac/sdio_host.h|  92 +++--
 drivers/net/wireless/brcm80211/brcmsmac/aiutils.h  |  18 +-
 drivers/net/wireless/brcm80211/brcmsmac/ampdu.h|  22 +-
 drivers/net/wireless/brcm80211/brcmsmac/antsel.h   |  14 +-
 drivers/net/wireless/brcm80211/brcmsmac/channel.h  |  20 +-
 .../net/wireless/brcm80211/brcmsmac/mac80211_if.h  |  38 +--
 drivers/net/wireless/brcm80211/brcmsmac/main.h | 110 +++---
 .../net/wireless/brcm80211/brcmsmac/phy/phy_hal.h  | 219 ++--
 .../net/wireless/brcm80211/brcmsmac/phy/phy_int.h  | 371 ++---
 drivers/net/wireless/brcm80211/brcmsmac/phy_shim.h |  91 +++--
 drivers/net/wireless/brcm80211/brcmsmac/pmu.h  |   4 +-
 drivers/net/wireless/brcm80211/brcmsmac/pub.h  | 145 
 drivers/net/wireless/brcm80211/brcmsmac/rate.h |  48 ++-
 drivers/net/wireless/brcm80211/brcmsmac/stf.h  |  31 +-
 .../net/wireless/brcm80211/brcmsmac/ucode_loader.h |  16 +-
 drivers/net/wireless/brcm80211/include/brcmu_d11.h |   2 +-
 .../net/wireless/brcm80211/include/brcmu_utils.h   |  44 ++-
 drivers/net/wireless/ipw2x00/libipw.h  |  87 +++--
 drivers/net/wireless/iwlegacy/3945.h   |  82 +++--
 drivers/net/wireless/iwlegacy/4965.h   |   2 +-
 drivers/net/wireless/iwlegacy/common.h |  66 ++--
 drivers/net/wireless/iwlwifi/dvm/agn.h |   2 +-
 drivers/net/wireless/iwlwifi/dvm/dev.h |   2 +-
 drivers/net/wireless/iwlwifi/dvm/rs.h  |   8 +-
 drivers/net/wireless/iwlwifi/mvm/rs.h  |   9 +-
 drivers/net/wireless/mwifiex/wmm.h |  24 +-
 drivers/net/wireless/orinoco/orinoco.h |  31 +-
 drivers/net/wireless/rtlwifi/cam.h |  10 +-
 drivers/net/wireless/rtlwifi/efuse.h   |  29 +-
 drivers/net/wireless/rtlwifi/rtl8188ee/phy.h   |  49 ++-
 drivers/net/wireless/rtlwifi/rtl8192ce/phy.h   |  54 ++-
 drivers/net/wireless/rtlwifi/rtl8192ce/rf.h|  13 +-
 drivers/net/wireless/rtlwifi/rtl8192cu/rf.h|  13 +-
 drivers/net/wireless/rtlwifi/rtl8192de/hw.h|   7 +-
 drivers/net/wireless/rtlwifi/rtl8192de/phy.h   |  44 ++-
 drivers/net/wireless/rtlwifi/rtl8192de/rf.h|  18 +-
 drivers/net/wireless/rtlwifi/rtl8723ae/phy.h   |  61 ++--
 drivers/net/wireless/rtlwifi/rtl8723ae/rf.h|  13 +-
 51 files changed, 1026 insertions(+), 1174 deletions(-)

-- 
1.8.1.2.459.gbcd45b4.dirty

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH 04/11] ath: Remove extern from function prototypes

2013-09-25 Thread Joe Perches
There are a mix of function prototypes with and without extern
in the kernel sources.  Standardize on not using extern for
function prototypes.

Function prototypes don't need to be written with extern.
extern is assumed by the compiler.  Its use is as unnecessary as
using auto to declare automatic/local variables in a block.

Signed-off-by: Joe Perches 
---
 drivers/net/wireless/ath/ath10k/debug.h  | 8 
 drivers/net/wireless/ath/ath6kl/common.h | 3 +--
 drivers/net/wireless/ath/ath6kl/debug.h  | 9 -
 drivers/net/wireless/ath/ath9k/ath9k.h   | 2 +-
 4 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/debug.h 
b/drivers/net/wireless/ath/ath10k/debug.h
index 168140c..bb00633 100644
--- a/drivers/net/wireless/ath/ath10k/debug.h
+++ b/drivers/net/wireless/ath/ath10k/debug.h
@@ -37,9 +37,9 @@ enum ath10k_debug_mask {
 
 extern unsigned int ath10k_debug_mask;
 
-extern __printf(1, 2) int ath10k_info(const char *fmt, ...);
-extern __printf(1, 2) int ath10k_err(const char *fmt, ...);
-extern __printf(1, 2) int ath10k_warn(const char *fmt, ...);
+__printf(1, 2) int ath10k_info(const char *fmt, ...);
+__printf(1, 2) int ath10k_err(const char *fmt, ...);
+__printf(1, 2) int ath10k_warn(const char *fmt, ...);
 
 #ifdef CONFIG_ATH10K_DEBUGFS
 int ath10k_debug_create(struct ath10k *ar);
@@ -68,7 +68,7 @@ static inline void ath10k_debug_read_target_stats(struct 
ath10k *ar,
 #endif /* CONFIG_ATH10K_DEBUGFS */
 
 #ifdef CONFIG_ATH10K_DEBUG
-extern __printf(2, 3) void ath10k_dbg(enum ath10k_debug_mask mask,
+__printf(2, 3) void ath10k_dbg(enum ath10k_debug_mask mask,
  const char *fmt, ...);
 void ath10k_dbg_dump(enum ath10k_debug_mask mask,
 const char *msg, const char *prefix,
diff --git a/drivers/net/wireless/ath/ath6kl/common.h 
b/drivers/net/wireless/ath/ath6kl/common.h
index 98a8861..05debf7 100644
--- a/drivers/net/wireless/ath/ath6kl/common.h
+++ b/drivers/net/wireless/ath/ath6kl/common.h
@@ -22,8 +22,7 @@
 
 #define ATH6KL_MAX_IE  256
 
-extern __printf(2, 3)
-int ath6kl_printk(const char *level, const char *fmt, ...);
+__printf(2, 3) int ath6kl_printk(const char *level, const char *fmt, ...);
 
 /*
  * Reflects the version of binary interface exposed by ATH6KL target
diff --git a/drivers/net/wireless/ath/ath6kl/debug.h 
b/drivers/net/wireless/ath/ath6kl/debug.h
index 74369de..ca9ba00 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.h
+++ b/drivers/net/wireless/ath/ath6kl/debug.h
@@ -50,11 +50,10 @@ enum ATH6K_DEBUG_MASK {
 };
 
 extern unsigned int debug_mask;
-extern __printf(2, 3)
-int ath6kl_printk(const char *level, const char *fmt, ...);
-extern __printf(1, 2) int ath6kl_info(const char *fmt, ...);
-extern __printf(1, 2) int ath6kl_err(const char *fmt, ...);
-extern __printf(1, 2) int ath6kl_warn(const char *fmt, ...);
+__printf(2, 3) int ath6kl_printk(const char *level, const char *fmt, ...);
+__printf(1, 2) int ath6kl_info(const char *fmt, ...);
+__printf(1, 2) int ath6kl_err(const char *fmt, ...);
+__printf(1, 2) int ath6kl_warn(const char *fmt, ...);
 
 enum ath6kl_war {
ATH6KL_WAR_INVALID_RATE,
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h 
b/drivers/net/wireless/ath/ath9k/ath9k.h
index 2ee35f6..da24ba2 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -952,7 +952,7 @@ void ath9k_ps_restore(struct ath_softc *sc);
 u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate);
 
 void ath_start_rfkill_poll(struct ath_softc *sc);
-extern void ath9k_rfkill_poll_state(struct ieee80211_hw *hw);
+void ath9k_rfkill_poll_state(struct ieee80211_hw *hw);
 void ath9k_calculate_iter_data(struct ieee80211_hw *hw,
   struct ieee80211_vif *vif,
   struct ath9k_vif_iter_data *iter_data);
-- 
1.8.1.2.459.gbcd45b4.dirty

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH 00/11 - GIT PULL] drivers: net: Last block of Remove extern from function prototypes

2013-09-26 Thread Joe Perches
On Thu, 2013-09-26 at 13:44 -0400, David Miller wrote:
> From: Joe Perches 
> Date: Wed, 25 Sep 2013 12:37:18 -0700
[]
> Pulled, thanks Joe.
> That should be about it for networking right?

Yes for drivers/net/...

There are some more files like:

include/linux/etherdevice.h
include/linux/inetdevice.h
include/linux/net.h
include/linux/netdevice.h
include/linux/skbuff.h

and some netfilter ones:

include/linux/netfilter*.h
include/linux/netfilter/...

and maybe a few others like:

include/linux/atmdev.h
include/linux/fddidevice.h

that I was planning on converting then submitting.

Want those in one more pull request or
maybe individually?

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH] wcn36xx: Fix logging macro with unnecessary semicolon

2013-11-06 Thread Joe Perches
On Wed, 2013-11-06 at 07:49 +, Eugene Krasnikov wrote:
> Hm... when it comes to semicolon the patch seems to be good. When it
> comes to dynamic debugging i think we should have a separate
> discussion about that.
> I personally like the whole idea about dynamic debug but if you want
> to change it i would suggest to have some kind of framework for all
> ath drivers(or maybe all wireless drivers). Because obviously you can
> find common code in every driver that defines it's own debug
> functions/debug levels and so on. Why not to make a framework with
> standard API/levels?

You need to bring that up with the Atheros folk.
I've tried.  The view seemed to be it was more
trouble than it was worth.



___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH] wcn36xx: Fix logging macro with unnecessary semicolon

2013-11-07 Thread Joe Perches
On Thu, 2013-11-07 at 07:32 +, Eugene Krasnikov wrote:
> Hi Joe,

Hi Eugene.

> I personally like the idea of making some kind of framework on top of
> printing because all ath drivers are using the same printing approach
> and combining all that code in one place will reduce amount of code in
> each particular driver. As a true engineer i like when it's less code
> = less work to do = less bugs:)
> 
> Suggestion is to send a patch with semicolon fix only

It's a one line fix, and pretty trivial to do yourself if you
want it.

I do think though the slightly odd wcn36xx_ uses of:

-#define wcn36xx_err(fmt, arg...)   \
-   printk(KERN_ERR pr_fmt("ERROR " fmt), ##arg);
-
-#define wcn36xx_warn(fmt, arg...)  \
-   printk(KERN_WARNING pr_fmt("WARNING " fmt), ##arg)
-
-#define wcn36xx_info(fmt, arg...)  \
-   printk(KERN_INFO pr_fmt(fmt), ##arg)
-
[]
+#define wcn36xx_err(fmt, ...)  \
+   pr_err("ERROR " fmt, ##__VA_ARGS__)
+#define wcn36xx_warn(fmt, ...) \
+   pr_warn("WARNING " fmt, ##__VA_ARGS__)
+#define wcn36xx_info(fmt, ...) \
+   pr_info(fmt, ##__VA_ARGS__)

should still be converted to more normal pr_ like I did.

I don't believe that prefixing of "ERROR " and "WARNING " to
pr_err and pr_warn actually gain anything as the same level
information can be got already with dmesg -r via the "<3>" and
"<4>" prefixes or dmesg -l3 -l4

> have a
> second round of convincing ath guys to change printing code. How does
> that sound?

Luis?  Kalle?  Other Qualcomm/Atheros folk?

One of the nominal benefits of separating the ath_
macros by subsystem was perf/tracing.  I believe some of the
ath subsystems have integrated the dmesg and tracing code.

I'm not sure how separable those may be here or if it's even
desirable to separate them.  I'd guess not.

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH 1/3] ath9k: Fix build error on ARM

2014-02-03 Thread Joe Perches
On Tue, 2014-02-04 at 08:37 +0530, Sujith Manoharan wrote:
> From: Sujith Manoharan 
> 
> Use mdelay instead of udelay to fix this error:
> 
> ERROR: "__bad_udelay" [drivers/net/wireless/ath/ath9k/ath9k_hw.ko] undefined!
> make[1]: *** [__modpost] Error 1
> make: *** [modules] Error 2
> 
> Reported-by: Josh Boyer 
> Signed-off-by: Sujith Manoharan 
> ---
>  drivers/net/wireless/ath/ath9k/hw.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath9k/hw.c 
> b/drivers/net/wireless/ath/ath9k/hw.c
> index fbf43c0..11eab9f 100644
> --- a/drivers/net/wireless/ath/ath9k/hw.c
> +++ b/drivers/net/wireless/ath/ath9k/hw.c
> @@ -1316,7 +1316,7 @@ static bool ath9k_hw_set_reset(struct ath_hw *ah, int 
> type)
>   if (AR_SREV_9300_20_OR_LATER(ah))
>   udelay(50);
>   else if (AR_SREV_9100(ah))
> - udelay(1);
> + mdelay(10);
>   else
>   udelay(100);

How can this help?
There are udelays above and below this line.

>  
> @@ -2051,9 +2051,8 @@ static bool ath9k_hw_set_power_awake(struct ath_hw *ah)
>  
>   REG_SET_BIT(ah, AR_RTC_FORCE_WAKE,
>   AR_RTC_FORCE_WAKE_EN);
> -
>   if (AR_SREV_9100(ah))
> - udelay(1);
> + mdelay(10);
>   else
>   udelay(50);
>  



___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH] checkpatch: Add test for long udelay

2014-02-04 Thread Joe Perches
On Tue, 2014-02-04 at 08:03 +0100, Holger Schurig wrote:
> The macro udelay
> cannot handle large values because of lost-of-precision.
> 
> IMHO udelay on ARM is broken, because it also cannot work with fast
> ARM processors (where bogomips >= 3355, which is in sight now). It's
> just not broken enought that someone did something against it ...   so
> the current kludge is good enought.

Until then, warn on long udelay uses.

Also fix uses of $line that should have been $herecurr.

Signed-off-by: Joe Perches 
---
 scripts/checkpatch.pl | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 0ea2a1e..36275c5 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3912,10 +3912,15 @@ sub process {
 
 # prefer usleep_range over udelay
if ($line =~ /\budelay\s*\(\s*(\d+)\s*\)/) {
+   my $delay = $1;
# ignore udelay's < 10, however
-   if (! ($1 < 10) ) {
+   if (! ($delay < 10) ) {
CHK("USLEEP_RANGE",
-   "usleep_range is preferred over udelay; see 
Documentation/timers/timers-howto.txt\n" . $line);
+   "usleep_range is preferred over udelay; see 
Documentation/timers/timers-howto.txt\n" . $herecurr);
+   }
+   if ($delay > 2000) {
+   WARN("LONG_UDELAY",
+"long udelay - prefer mdelay; see 
arch/arm/include/asm/delay.h\n" . $herecurr);
}
}
 
@@ -3923,7 +3928,7 @@ sub process {
if ($line =~ /\bmsleep\s*\((\d+)\);/) {
if ($1 < 20) {
WARN("MSLEEP",
-"msleep < 20ms can sleep for up to 20ms; 
see Documentation/timers/timers-howto.txt\n" . $line);
+"msleep < 20ms can sleep for up to 20ms; 
see Documentation/timers/timers-howto.txt\n" . $herecurr);
}
}
 


___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH 1/3] ath9k: Fix build error on ARM

2014-02-04 Thread Joe Perches
On Tue, 2014-02-04 at 08:03 +0100, Holger Schurig wrote:
> Joe, look in linux/arch/arm/include/asm/delay.h. The macro udelay
> cannot handle large values because of lost-of-precision.
> 
> IMHO udelay on ARM is broken, because it also cannot work with fast
> ARM processors (where bogomips >= 3355, which is in sight now). It's
> just not broken enought that someone did something against it ...   so
> the current kludge is good enought.

Maybe something like this would be better?

---
 arch/arm/include/asm/delay.h | 33 +
 1 file changed, 29 insertions(+), 4 deletions(-)

diff --git a/arch/arm/include/asm/delay.h b/arch/arm/include/asm/delay.h
index dff714d..ac33c56 100644
--- a/arch/arm/include/asm/delay.h
+++ b/arch/arm/include/asm/delay.h
@@ -15,6 +15,8 @@
 
 #ifndef __ASSEMBLY__
 
+#include 
+
 struct delay_timer {
unsigned long (*read_current_timer)(void);
unsigned long freq;
@@ -51,11 +53,34 @@ extern void __bad_udelay(void);
 #define __udelay(n)arm_delay_ops.udelay(n)
 #define __const_udelay(n)  arm_delay_ops.const_udelay(n)
 
+#ifdef DEBUG
+#define __udelay_debug_max_delay(n)\
+do {   \
+   if (n > MAX_UDELAY_MS * 1000) { \
+   pr_debug("udelay(%d) too large - Convert to mdelay\n", n); \
+   dump_stack();   \
+   }   \
+} while (0)
+#else
+#define __udelay_debug_max_delay(n)\
+   do {} while (0)
+#endif
+
 #define udelay(n)  \
-   (__builtin_constant_p(n) ?  \
- ((n) > (MAX_UDELAY_MS * 1000) ? __bad_udelay() :  \
-   __const_udelay((n) * UDELAY_MULT)) :\
- __udelay(n))
+({ \
+   if (__builtin_constant_p(n)) {  \
+   typeof n _n = n;\
+   while (_n > MAX_UDELAY_MS * 1000) { \
+   __const_udelay(MAX_UDELAY_MS * 1000 * UDELAY_MULT); \
+   _n -= MAX_UDELAY_MS * 1000; \
+   }   \
+   if (_n) \
+   __const_udelay(_n * 1000 * UDELAY_MULT);\
+   } else {\
+   __udelay_debug_max_delay(n);\
+   __udelay(n);\
+   }   \
+})
 
 /* Loop-based definitions for assembly code. */
 extern void __loop_delay(unsigned long loops);


___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH 1/3] ath9k: Fix build error on ARM

2014-02-04 Thread Joe Perches
On Tue, 2014-02-04 at 19:40 +0100, Arnd Bergmann wrote:
> On Tuesday 04 February 2014 08:36:36 Joe Perches wrote:
> > On Tue, 2014-02-04 at 08:03 +0100, Holger Schurig wrote:
> > > Joe, look in linux/arch/arm/include/asm/delay.h. The macro udelay
> > > cannot handle large values because of lost-of-precision.
> > > 
> > > IMHO udelay on ARM is broken, because it also cannot work with fast
> > > ARM processors (where bogomips >= 3355, which is in sight now). It's
> > > just not broken enought that someone did something against it ...   so
> > > the current kludge is good enought.
> > 
> > Maybe something like this would be better?
> > 
> 
> I actually like the fact that we get link errors for insane 'udelay'
> times.

For static values yes, for computed values no.

This emits a warning/dump_stack on the non-static
values.  It could also emit some similar #warning
on static values > insane too.



___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH 1/3] ath9k: Fix build error on ARM

2014-02-05 Thread Joe Perches
On Wed, 2014-02-05 at 11:50 +, Russell King - ARM Linux wrote:
> On Tue, Feb 04, 2014 at 08:36:36AM -0800, Joe Perches wrote:
> > On Tue, 2014-02-04 at 08:03 +0100, Holger Schurig wrote:
> > > Joe, look in linux/arch/arm/include/asm/delay.h. The macro udelay
> > > cannot handle large values because of lost-of-precision.
> > > 
> > > IMHO udelay on ARM is broken, because it also cannot work with fast
> > > ARM processors (where bogomips >= 3355, which is in sight now). It's
> > > just not broken enought that someone did something against it ...   so
> > > the current kludge is good enought.
> > 
> > Maybe something like this would be better?
> 
> No, the point of __bad_udelay() is that people doing stupidly large
> udelay()s result in build errors,

Apparently, people just convert stupidly large udelay()s
to mdelay and not be bothered.

>  rather than having to run the kernel
> and trip over a non-existent debugging message beacuse they haven't
> built the kernel with DEBUG defined.
> 
> NAK.



Perhaps there should be some runtime udelay > maximum
supported check.

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH 1/3] ath9k: Fix build error on ARM

2014-02-05 Thread Joe Perches
On Wed, 2014-02-05 at 12:41 +, Russell King - ARM Linux wrote:
> On Wed, Feb 05, 2014 at 04:32:46AM -0800, Joe Perches wrote:
> > Apparently, people just convert stupidly large udelay()s
> > to mdelay and not be bothered.
> 
> And that's the correct answer.  Having udelay(1) rather than mdelay(10)
> is a sign that they weren't paying that much attention when writing the
> code.

Not really.

Look at the code that brought this up in the first place.

On Tue, 2014-02-04 at 08:37 +0530, Sujith Manoharan wrote:
> From: Sujith Manoharan 
> 
> Use mdelay instead of udelay to fix this error:
> 
> ERROR: "__bad_udelay" [drivers/net/wireless/ath/ath9k/ath9k_hw.ko] undefined!
[]
diff --git a/drivers/net/wireless/ath/ath9k/hw.c 
b/drivers/net/wireless/ath/ath9k/hw.c
[]
> @@ -1316,7 +1316,7 @@ static bool ath9k_hw_set_reset(struct ath_hw *ah, int 
> type)
>   if (AR_SREV_9300_20_OR_LATER(ah))
>   udelay(50);
>   else if (AR_SREV_9100(ah))
> - udelay(1);
> + mdelay(10);
>   else
>   udelay(100);
>  
> 
> > if (AR_SREV_9300_20_OR_LATER(ah))
> > udelay(50);
> > else if (AR_SREV_9100(ah))
> > -   udelay(1);
> > +   mdelay(10);
> > else
> > udelay(100);

One chip needs a larger delay than the others.

It's not so much not paying attention as not
knowing ARM is broken for large udelay().


___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH 1/3] ath9k: Fix build error on ARM

2014-02-05 Thread Joe Perches
On Wed, 2014-02-05 at 13:39 +, Russell King - ARM Linux wrote:
> On Wed, Feb 05, 2014 at 05:04:54AM -0800, Joe Perches wrote:
> > On Wed, 2014-02-05 at 12:41 +, Russell King - ARM Linux wrote:
> > > On Wed, Feb 05, 2014 at 04:32:46AM -0800, Joe Perches wrote:
> > > > Apparently, people just convert stupidly large udelay()s
> > > > to mdelay and not be bothered.
> > > 
> > > And that's the correct answer.  Having udelay(1) rather than 
> > > mdelay(10)
> > > is a sign that they weren't paying that much attention when writing the
> > > code.
> > 
> > Not really.
[]
> > It's not so much not paying attention as not
> > knowing ARM is broken for large udelay().
> 
> And now read my suggestion about how to avoid the "not knowing" problem. :)

I'd read it already.  I didn't and don't disagree.

I still think adding a #warning on large static udelay()s
would be sensible.  Maybe adding another option like
#define UDELAY_TOO_BIG_I_KNOW_ALREADY_DONT_BOTHER_ME
guard to avoid seeing the #warning when there's no other
option.


___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH 1/3] ath9k: Fix build error on ARM

2014-02-05 Thread Joe Perches
On Wed, 2014-02-05 at 14:21 +, Russell King - ARM Linux wrote:
> On Wed, Feb 05, 2014 at 06:03:13AM -0800, Joe Perches wrote:
> > On Wed, 2014-02-05 at 13:39 +, Russell King - ARM Linux wrote:
> > > On Wed, Feb 05, 2014 at 05:04:54AM -0800, Joe Perches wrote:
> > > > On Wed, 2014-02-05 at 12:41 +, Russell King - ARM Linux wrote:
> > > > > On Wed, Feb 05, 2014 at 04:32:46AM -0800, Joe Perches wrote:
> > > > > > Apparently, people just convert stupidly large udelay()s
> > > > > > to mdelay and not be bothered.
> > > > > 
> > > > > And that's the correct answer.  Having udelay(1) rather than 
> > > > > mdelay(10)
> > > > > is a sign that they weren't paying that much attention when writing 
> > > > > the
> > > > > code.
> > > > 
> > > > Not really.
> > []
> > > > It's not so much not paying attention as not
> > > > knowing ARM is broken for large udelay().
> > > 
> > > And now read my suggestion about how to avoid the "not knowing" problem. 
> > > :)
> > 
> > I'd read it already.  I didn't and don't disagree.
> 
> Please explain /why/ you don't agree.

Please reread what I wrote.

We agree a lot more than you seem to think.

> > I still think adding a #warning on large static udelay()s
> > would be sensible.  Maybe adding another option like
> > #define UDELAY_TOO_BIG_I_KNOW_ALREADY_DONT_BOTHER_ME
> > guard to avoid seeing the #warning when there's no other
> > option.
> 
> How does that help?  It's /not/ a warning situation - if you ask for
> udelay(1) on ARM, you will /not/ get a 10ms delay.  You'll instead
> get something much shorter because the arithmetic will overflow.

> Now, you could argue that maybe ARM's udelay() implementation should
> know about this and implement a loop around the underlying udelay()
> implementation to achieve it,

I suggested something like that was possible.

> and I might agree with you - but I
> don't for one very simple reason: we /already/ have such an
> implementation.  It's called mdelay():

I think mdelay should be for the case where the range
is too big for a udelay.  I think arm's 11 bit range
is unfortunately small.

I think we agree be nice to get a generic compiler
#warning when a __builtin_constant_p value is too large
and a ratelimited dmesg/warning for the runtime case.


___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH net-next] ath9k: Use static const

2014-02-21 Thread Joe Perches
Trivially reduces text size too.

$ size drivers/net/wireless/ath/ath9k/debug.o*
   textdata bss dec hex filename
  3443625285128   42092a46c 
drivers/net/wireless/ath/ath9k/debug.o.new
  3446425285128   42120a488 
drivers/net/wireless/ath/ath9k/debug.o.old

Signed-off-by: Joe Perches 
---
 drivers/net/wireless/ath/ath9k/debug.c | 20 
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/debug.c 
b/drivers/net/wireless/ath/ath9k/debug.c
index ab7264c..9131175 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -135,7 +135,8 @@ static ssize_t read_file_ani(struct file *file, char __user 
*user_buf,
struct ath_softc *sc = file->private_data;
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ath_hw *ah = sc->sc_ah;
-   unsigned int len = 0, size = 1024;
+   unsigned int len = 0;
+   const unsigned int size = 1024;
ssize_t retval = 0;
char *buf;
 
@@ -307,13 +308,13 @@ static ssize_t read_file_antenna_diversity(struct file 
*file,
struct ath_antenna_stats *as_main = 
&sc->debug.stats.ant_stats[ANT_MAIN];
struct ath_antenna_stats *as_alt = &sc->debug.stats.ant_stats[ANT_ALT];
struct ath_hw_antcomb_conf div_ant_conf;
-   unsigned int len = 0, size = 1024;
+   unsigned int len = 0;
+   const unsigned int size = 1024;
ssize_t retval = 0;
char *buf;
-   char *lna_conf_str[4] = {"LNA1_MINUS_LNA2",
-"LNA2",
-"LNA1",
-"LNA1_PLUS_LNA2"};
+   static const char *lna_conf_str[4] = {
+   "LNA1_MINUS_LNA2", "LNA2", "LNA1", "LNA1_PLUS_LNA2"
+   };
 
buf = kzalloc(size, GFP_KERNEL);
if (buf == NULL)
@@ -716,10 +717,13 @@ static ssize_t read_file_queues(struct file *file, char 
__user *user_buf,
struct ath_softc *sc = file->private_data;
struct ath_txq *txq;
char *buf;
-   unsigned int len = 0, size = 1024;
+   unsigned int len = 0;
+   const unsigned int size = 1024;
ssize_t retval = 0;
int i;
-   char *qname[4] = {"VO", "VI", "BE", "BK"};
+   static const char *qname[4] = {
+   "VO", "VI", "BE", "BK"
+   };
 
buf = kzalloc(size, GFP_KERNEL);
if (buf == NULL)


___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH net-next 0/9] drivers/net: Convert uses of __constant_ to

2014-03-12 Thread Joe Perches
Joe Perches (9):
  brocade: Convert uses of __constant_ to 
  e100: Convert uses of __constant_ to 
  igb: Convert uses of __constant_ to 
  igbvf: Convert uses of __constant_ to 
  ixgbe: Convert uses of __constant_ to 
  ixgbevf: Convert uses of __constant_ to 
  xilinx: Convert uses of __constant_ to 
  lg-vl600: Convert uses of __constant_ to 
  ath9k: Convert uses of __constant_ to 

 drivers/net/ethernet/brocade/bna/bnad.c   | 16 +---
 drivers/net/ethernet/intel/e100.c |  4 +--
 drivers/net/ethernet/intel/igb/igb_main.c | 12 -
 drivers/net/ethernet/intel/igbvf/netdev.c |  4 +--
 drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c |  8 +++---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 30 +++
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |  4 +--
 drivers/net/ethernet/xilinx/ll_temac_main.c   |  4 +--
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c |  2 +-
 drivers/net/usb/lg-vl600.c|  2 +-
 drivers/net/wireless/ath/ath9k/ar9003_eeprom.c|  4 +--
 11 files changed, 43 insertions(+), 47 deletions(-)

-- 
1.8.1.2.459.gbcd45b4.dirty

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH net-next 9/9] ath9k: Convert uses of __constant_ to

2014-03-12 Thread Joe Perches
The use of __constant_ has been unnecessary for quite awhile now.

Make these uses consistent with the rest of the kernel.

Signed-off-by: Joe Perches 
---
 drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c 
b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
index b8daff7..d7625ec 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
@@ -23,8 +23,8 @@
 #define COMP_HDR_LEN 4
 #define COMP_CKSUM_LEN 2
 
-#define LE16(x) __constant_cpu_to_le16(x)
-#define LE32(x) __constant_cpu_to_le32(x)
+#define LE16(x) cpu_to_le16(x)
+#define LE32(x) cpu_to_le32(x)
 
 /* Local defines to distinguish between extension and control CTL's */
 #define EXT_ADDITIVE (0x8000)
-- 
1.8.1.2.459.gbcd45b4.dirty

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH 14/36] drivers/net/wireless: Remove unnecessary casts of private_data

2010-07-12 Thread Joe Perches
Signed-off-by: Joe Perches 
---
 drivers/net/wireless/airo.c   |   22 +++---
 drivers/net/wireless/ath/ath9k/htc_drv_main.c |9 +++--
 drivers/net/wireless/iwlwifi/iwl-debugfs.c|   10 +-
 drivers/net/wireless/libertas/debugfs.c   |4 ++--
 4 files changed, 21 insertions(+), 24 deletions(-)

diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 6b605df..115442b 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -4657,7 +4657,7 @@ static ssize_t proc_write( struct file *file,
   loff_t *offset )
 {
loff_t pos = *offset;
-   struct proc_data *priv = (struct proc_data*)file->private_data;
+   struct proc_data *priv = file->private_data;
 
if (!priv->wbuffer)
return -EINVAL;
@@ -4689,7 +4689,7 @@ static int proc_status_open(struct inode *inode, struct 
file *file)
 
if ((file->private_data = kzalloc(sizeof(struct proc_data ), 
GFP_KERNEL)) == NULL)
return -ENOMEM;
-   data = (struct proc_data *)file->private_data;
+   data = file->private_data;
if ((data->rbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) {
kfree (file->private_data);
return -ENOMEM;
@@ -4772,7 +4772,7 @@ static int proc_stats_rid_open( struct inode *inode,
 
if ((file->private_data = kzalloc(sizeof(struct proc_data ), 
GFP_KERNEL)) == NULL)
return -ENOMEM;
-   data = (struct proc_data *)file->private_data;
+   data = file->private_data;
if ((data->rbuffer = kmalloc( 4096, GFP_KERNEL )) == NULL) {
kfree (file->private_data);
return -ENOMEM;
@@ -5045,7 +5045,7 @@ static int proc_config_open(struct inode *inode, struct 
file *file)
 
if ((file->private_data = kzalloc(sizeof(struct proc_data ), 
GFP_KERNEL)) == NULL)
return -ENOMEM;
-   data = (struct proc_data *)file->private_data;
+   data = file->private_data;
if ((data->rbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) {
kfree (file->private_data);
return -ENOMEM;
@@ -5127,7 +5127,7 @@ static int proc_config_open(struct inode *inode, struct 
file *file)
 
 static void proc_SSID_on_close(struct inode *inode, struct file *file)
 {
-   struct proc_data *data = (struct proc_data *)file->private_data;
+   struct proc_data *data = file->private_data;
struct proc_dir_entry *dp = PDE(inode);
struct net_device *dev = dp->data;
struct airo_info *ai = dev->ml_priv;
@@ -5163,7 +5163,7 @@ static void proc_SSID_on_close(struct inode *inode, 
struct file *file)
 }
 
 static void proc_APList_on_close( struct inode *inode, struct file *file ) {
-   struct proc_data *data = (struct proc_data *)file->private_data;
+   struct proc_data *data = file->private_data;
struct proc_dir_entry *dp = PDE(inode);
struct net_device *dev = dp->data;
struct airo_info *ai = dev->ml_priv;
@@ -5309,7 +5309,7 @@ static void proc_wepkey_on_close( struct inode *inode, 
struct file *file ) {
 
memset(key, 0, sizeof(key));
 
-   data = (struct proc_data *)file->private_data;
+   data = file->private_data;
if ( !data->writelen ) return;
 
if (data->wbuffer[0] >= '0' && data->wbuffer[0] <= '3' &&
@@ -5363,7 +5363,7 @@ static int proc_wepkey_open( struct inode *inode, struct 
file *file )
if ((file->private_data = kzalloc(sizeof(struct proc_data ), 
GFP_KERNEL)) == NULL)
return -ENOMEM;
memset(&wkr, 0, sizeof(wkr));
-   data = (struct proc_data *)file->private_data;
+   data = file->private_data;
if ((data->rbuffer = kzalloc( 180, GFP_KERNEL )) == NULL) {
kfree (file->private_data);
return -ENOMEM;
@@ -5409,7 +5409,7 @@ static int proc_SSID_open(struct inode *inode, struct 
file *file)
 
if ((file->private_data = kzalloc(sizeof(struct proc_data ), 
GFP_KERNEL)) == NULL)
return -ENOMEM;
-   data = (struct proc_data *)file->private_data;
+   data = file->private_data;
if ((data->rbuffer = kmalloc( 104, GFP_KERNEL )) == NULL) {
kfree (file->private_data);
return -ENOMEM;
@@ -5453,7 +5453,7 @@ static int proc_APList_open( struct inode *inode, struct 
file *file ) {
 
if ((file->private_data = kzalloc(sizeof(struct proc_data ), 
GFP_KERNEL)) == NULL)
return -ENOMEM;
-   data = (struct proc_data *)file->private_data;
+   data = file->private_data;
if ((data->rbuffer = kmalloc( 104, GFP_KERNEL )) == NULL) {
kfree (file->private_data);
return -ENOMEM;
@@ -

[ath9k-devel] [PATCH 16/44] drivers/net/wireless/ath: Remove unnecessary semicolons

2010-11-14 Thread Joe Perches
Signed-off-by: Joe Perches 
---
 drivers/net/wireless/ath/ath9k/htc.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc.h 
b/drivers/net/wireless/ath/ath9k/htc.h
index 75ecf6a..4c98b93 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -434,7 +434,7 @@ void ath9k_htc_beaconep(void *drv_priv, struct sk_buff *skb,
 
 void ath9k_htc_station_work(struct work_struct *work);
 void ath9k_htc_aggr_work(struct work_struct *work);
-void ath9k_ani_work(struct work_struct *work);;
+void ath9k_ani_work(struct work_struct *work);
 
 int ath9k_tx_init(struct ath9k_htc_priv *priv);
 void ath9k_tx_tasklet(unsigned long data);
-- 
1.7.3.1.g432b3.dirty

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH 00/44] remove unnecessary semicolons

2010-11-15 Thread Joe Perches
ya trivial series...

Joe Perches (44):
  arch/arm: Remove unnecessary semicolons
  arch/microblaze: Remove unnecessary semicolons
  arch/um: Remove unnecessary semicolons
  drivers/cpufreq: Remove unnecessary semicolons
  drivers/gpio: Remove unnecessary semicolons
  drivers/i2c: Remove unnecessary semicolons
  drivers/isdn: Remove unnecessary semicolons
  drivers/leds: Remove unnecessary semicolons
  drivers/media/video: Remove unnecessary semicolons
  drivers/misc: Remove unnecessary semicolons
  drivers/mmc: Remove unnecessary semicolons
  drivers/net/bnx2x: Remove unnecessary semicolons
  drivers/net/e1000e: Remove unnecessary semicolons
  drivers/net/ixgbe: Remove unnecessary semicolons
  drivers/net/vxge: Remove unnecessary semicolons
  drivers/net/wireless/ath: Remove unnecessary semicolons
  drivers/net/wireless/iwlwifi: Remove unnecessary semicolons
  drivers/net/cnic.c: Remove unnecessary semicolons
  drivers/platform/x86: Remove unnecessary semicolons
  drivers/power: Remove unnecessary semicolons
  drivers/s390/net: Remove unnecessary semicolons
  drivers/scsi/be2iscsi: Remove unnecessary semicolons
  drivers/scsi/bfa: Remove unnecessary semicolons
  drivers/scsi/lpfc: Remove unnecessary semicolons
  drivers/scsi/pm8001: Remove unnecessary semicolons
  drivers/scsi/qla2xxx: Remove unnecessary semicolons
  drivers/serial: Remove unnecessary semicolons
  drivers/spi: Remove unnecessary semicolons
  drivers/staging: Remove unnecessary semicolons
  drivers/usb/gadget: Remove unnecessary semicolons
  drivers/xen: Remove unnecessary semicolons
  fs/9p: Remove unnecessary semicolons
  fs/ceph: Remove unnecessary semicolons
  fs/logfs: Remove unnecessary semicolons
  fs/nfs: Remove unnecessary semicolons
  fs/ocfs2: Remove unnecessary semicolons
  fs/ubifs: Remove unnecessary semicolons
  include/linux/if_macvlan.h: Remove unnecessary semicolons
  include/net/caif/cfctrl.h: Remove unnecessary semicolons
  mm/hugetlb.c: Remove unnecessary semicolons
  net/ipv6/mcast.c: Remove unnecessary semicolons
  net/sunrpc/addr.c: Remove unnecessary semicolons
  sound/core/pcm_lib.c: Remove unnecessary semicolons
  sound/soc/codecs: Remove unnecessary semicolons

 arch/arm/mach-at91/at91cap9_devices.c  |2 +-
 arch/arm/mach-at91/at91sam9g45_devices.c   |2 +-
 arch/arm/mach-at91/at91sam9rl_devices.c|2 +-
 arch/arm/mach-nuc93x/time.c|2 +-
 arch/arm/mach-tegra/tegra2_clocks.c|2 +-
 arch/arm/mach-w90x900/cpu.c|2 +-
 arch/arm/plat-mxc/irq.c|2 +-
 arch/microblaze/lib/memmove.c  |2 +-
 arch/um/drivers/mmapper_kern.c |2 +-
 drivers/cpufreq/cpufreq_conservative.c |2 +-
 drivers/gpio/langwell_gpio.c   |2 +-
 drivers/i2c/busses/i2c-designware.c|2 +-
 drivers/isdn/hardware/mISDN/mISDNinfineon.c|4 ++--
 drivers/isdn/hardware/mISDN/mISDNisar.c|2 +-
 drivers/leds/leds-mc13783.c|2 +-
 drivers/media/video/cx88/cx88-blackbird.c  |2 +-
 drivers/media/video/davinci/vpfe_capture.c |2 +-
 drivers/media/video/em28xx/em28xx-cards.c  |2 +-
 drivers/misc/bmp085.c  |2 +-
 drivers/misc/isl29020.c|2 +-
 drivers/mmc/host/davinci_mmc.c |2 +-
 drivers/net/bnx2x/bnx2x_link.c |4 ++--
 drivers/net/bnx2x/bnx2x_main.c |2 +-
 drivers/net/cnic.c |2 +-
 drivers/net/e1000e/netdev.c|2 +-
 drivers/net/ixgbe/ixgbe_sriov.c|2 +-
 drivers/net/vxge/vxge-main.c   |2 +-
 drivers/net/wireless/ath/ath9k/htc.h   |2 +-
 drivers/net/wireless/iwlwifi/iwl-agn.c |2 +-
 drivers/platform/x86/classmate-laptop.c|2 +-
 drivers/platform/x86/thinkpad_acpi.c   |2 +-
 drivers/power/intel_mid_battery.c  |2 +-
 drivers/s390/net/qeth_core_sys.c   |2 +-
 drivers/scsi/be2iscsi/be_main.c|4 ++--
 drivers/scsi/bfa/bfa_fcs_lport.c   |2 +-
 drivers/scsi/lpfc/lpfc_bsg.c   |2 +-
 drivers/scsi/pm8001/pm8001_init.c  |2 +-
 drivers/scsi/qla2xxx/qla_isr.c |4 ++--
 drivers/scsi/qla2xxx/qla_nx.c  |2 +-
 drivers/serial/mrst_max3110.c  |2 +-
 drivers/spi/amba-pl022.c   |2 +-
 drivers/spi/spi_nuc900.c   |2 +-
 .../staging/ath6kl/hif/sdio/linux_sdio/src/hif.c   |2 +-
 drivers/staging/ath6kl/os/linux/ar6000_drv.c   |2 +-
 drivers/staging/bcm/InterfaceInit.c|2

[ath9k-devel] [PATCH 00/62] drivers/net: Use static const

2010-11-20 Thread Joe Perches
Using static const generally increases object text and decreases data size.
It also generally decreases overall object size.

Summary of sizes old and new.  Compiled allyesconfig x86 only.

   textdata bss dec hex filename
2075402   67170  466644 2609216  27d040 (TOTALS) -new
2074597   70614  48 2611879  27daa7 (TOTALS) -old

Joe Perches (62):
  3c501: Use static const
  3c503: Use static const
  3c507: Use static const
  3c527: Use static const
  at1700: Use static const
  benet: Use static const
  bnx2: Use static const
  bnx2x: Use static const
  can: Use static const
  chelsio: Use static const
  cxgb3: Use static const
  cxgb3: Use static const
  cxgb4: Use static const
  cxgb4vf: Use static const
  e1000: Use static const
  e1000: Use static const
  e1000e: Use static const
  e2100: Use static const
  eepro: Use static const
  eexpress: Use static const
  gianfar: Use static const
  hp: Use static const
  igb: Use static const
  irda: Use static const
  irda: Use static const
  ixgbe: Use static const
  ixgbevf: Use static const
  ixgb: Use static const
  jme: Use static const
  ksz884x: Use static const
  netxen: Use static const
  ni52: Use static const
  ni65: Use static const
  pcmcia: Use static const
  qlcnic: Use static const
  qlge: Use static const
  r8169: Use static const
  s2io: Use static const
  skfp: Use static const
  skge: Use static const
  smc-ultra: Use static const
  tg3: Use static const
  tokenring: Use static const
  tulip: Use static const
  tulip: Use static const
  usb: Use static const
  vmxnet3: Use static const
  wan: Use static const
  wd: Use static const
  ar9170: Use const
  ath5k: Use static const
  ath9k: Use static const
  carl9170: Use static const
  atmel: Use static const
  b43: Use static const
  iwlwifi: Use static const
  libertas: Use static const
  ray_cs: Use static const
  rndis_wlan: Use static const
  rt2x00: Use static const
  wl12xx: Use static const
  zd1211rw: Use const

 drivers/net/3c501.c|4 +-
 drivers/net/3c503.c|4 +-
 drivers/net/3c507.c|4 +-
 drivers/net/3c527.c|6 +-
 drivers/net/at1700.c   |6 +-
 drivers/net/benet/be_ethtool.c |4 +-
 drivers/net/benet/be_main.c|   10 ++--
 drivers/net/bnx2.c |   46 ---
 drivers/net/bnx2x/bnx2x_main.c |6 ++-
 drivers/net/can/sja1000/plx_pci.c  |2 +-
 drivers/net/chelsio/sge.c  |   10 ++---
 drivers/net/cxgb3/ael1002.c|   24 ++--
 drivers/net/cxgb3/t3_hw.c  |2 +-
 drivers/net/cxgb4/t4_hw.c  |   48 
 drivers/net/cxgb4vf/t4vf_hw.c  |2 +-
 drivers/net/e1000/e1000_hw.c   |8 ++--
 drivers/net/e1000/e1000_param.c|   13 +++---
 drivers/net/e1000e/phy.c   |   11 +++--
 drivers/net/e2100.c|2 +-
 drivers/net/eepro.c|9 ++--
 drivers/net/eexpress.c |2 +-
 drivers/net/gianfar.c  |   10 +++--
 drivers/net/hp.c   |6 +-
 drivers/net/igb/e1000_phy.c|   11 +++--
 drivers/net/irda/act200l-sir.c |2 +-
 drivers/net/irda/donauboe.c|4 +-
 drivers/net/ixgb/ixgb_param.c  |   21 +-
 drivers/net/ixgbe/ixgbe_ethtool.c  |   22 ++
 drivers/net/ixgbevf/ethtool.c  |   18 +---
 drivers/net/jme.c  |4 +-
 drivers/net/ksz884x.c  |   20 +-
 drivers/net/netxen/netxen_nic_hw.c |   16 +---
 drivers/net/ni52.c |4 +-
 drivers/net/ni65.c |4 +-
 drivers/net/pcmcia/nmclan_cs.c |2 +-
 drivers/net/qlcnic/qlcnic_hw.c |   15 ---
 drivers/net/qlge/qlge_main.c   |   13 +++---
 drivers/net/r8169.c|2 +-
 drivers/net/s2io.c |   20 ++
 drivers/net/skfp/smt.c |4 +-
 drivers/net/skge.c |4 +-
 drivers/net/smc-ultra.c|8 +++-
 drivers/net/tg3.c  |   26 ++---
 drivers/net/tokenring/ibmtr.c  |5 +-
 drivers/net/tulip/de2104x.c|   18 ++---
 drivers/net/tulip/tulip_core.c |   15 ---
 drivers/net/usb/hso.c  |   39 ---
 drivers/net/vmxnet3/vmxnet3_drv.c  |4 +-
 drivers/net/wan/dscc4.c|6

[ath9k-devel] [PATCH 52/62] ath9k: Use static const

2010-11-20 Thread Joe Perches
Using static const generally increases object text and decreases data size.
It also generally decreases overall object size.

   textdata bss dec hex filename
  11161  562136   133533429 
drivers/net/wireless/ath/ath9k/ar9003_paprd.o.new
  11167  562136   13359342f 
drivers/net/wireless/ath/ath9k/ar9003_paprd.o.old
  15428  563056   18540486c 
drivers/net/wireless/ath/ath9k/eeprom_4k.o.old
  15451  563056   185634883 
drivers/net/wireless/ath/ath9k/eeprom_4k.o.new
  14087  562560   16703413f 
drivers/net/wireless/ath/ath9k/eeprom_9287.o.old
  14036  562560   16652410c 
drivers/net/wireless/ath/ath9k/eeprom_9287.o.new
  10041  562384   1248130c1 drivers/net/wireless/ath/ath9k/ani.o.new
  10088  562384   1252830f0 drivers/net/wireless/ath/ath9k/ani.o.old
   931615802304   132003390 
drivers/net/wireless/ath/ath9k/htc_drv_init.o.new
   931615802304   132003390 
drivers/net/wireless/ath/ath9k/htc_drv_init.o.old
  16483  563432   199714e03 
drivers/net/wireless/ath/ath9k/ar9003_phy.o.new
  16517  563432   200054e25 
drivers/net/wireless/ath/ath9k/ar9003_phy.o.old
  18221 1042960   212855325 drivers/net/wireless/ath/ath9k/rc.o.old
  18203 1042960   212675313 drivers/net/wireless/ath/ath9k/rc.o.new
  19985  564288   243295f09 
drivers/net/wireless/ath/ath9k/eeprom_def.o.new
  20040  564288   243845f40 
drivers/net/wireless/ath/ath9k/eeprom_def.o.old
  23997  564984   29037716d 
drivers/net/wireless/ath/ath9k/ar5008_phy.o.old
  23846  564984   2888670d6 
drivers/net/wireless/ath/ath9k/ar5008_phy.o.new
  24285  563184   275256b85 
drivers/net/wireless/ath/ath9k/ar9003_eeprom.o.old
  24101  563184   273416acd 
drivers/net/wireless/ath/ath9k/ar9003_eeprom.o.new
   6834  56103279221ef2 
drivers/net/wireless/ath/ath9k/ar9002_phy.o.old
   6780  56103278681ebc 
drivers/net/wireless/ath/ath9k/ar9002_phy.o.new
  36211  648624   44899af63 drivers/net/wireless/ath/ath9k/hw.o.new
  36401  648624   45089b021 drivers/net/wireless/ath/ath9k/hw.o.old
   9281  561496   108332a51 
drivers/net/wireless/ath/ath9k/ar9003_calib.o.old
   9150  561496   1070229ce 
drivers/net/wireless/ath/ath9k/ar9003_calib.o.new

Use ARRAY_SIZE instead of a magic number.

Signed-off-by: Joe Perches 
---
 drivers/net/wireless/ath/ath9k/ani.c   |8 +++---
 drivers/net/wireless/ath/ath9k/ar5008_phy.c|   32 ---
 drivers/net/wireless/ath/ath9k/ar9002_phy.c|   12 +---
 drivers/net/wireless/ath/ath9k/ar9003_calib.c  |   10 +++---
 drivers/net/wireless/ath/ath9k/ar9003_eeprom.c |8 +++--
 drivers/net/wireless/ath/ath9k/ar9003_paprd.c  |4 +-
 drivers/net/wireless/ath/ath9k/ar9003_phy.c|4 +-
 drivers/net/wireless/ath/ath9k/eeprom_4k.c |   12 +---
 drivers/net/wireless/ath/ath9k/eeprom_9287.c   |   14 +-
 drivers/net/wireless/ath/ath9k/eeprom_def.c|   17 +++-
 drivers/net/wireless/ath/ath9k/htc_drv_init.c  |2 +-
 drivers/net/wireless/ath/ath9k/hw.c|9 +++---
 drivers/net/wireless/ath/ath9k/rc.c|6 ++--
 13 files changed, 74 insertions(+), 64 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ani.c 
b/drivers/net/wireless/ath/ath9k/ani.c
index 63ccb39..29a045d 100644
--- a/drivers/net/wireless/ath/ath9k/ani.c
+++ b/drivers/net/wireless/ath/ath9k/ani.c
@@ -834,10 +834,10 @@ void ath9k_hw_ani_setup(struct ath_hw *ah)
 {
int i;
 
-   const int totalSizeDesired[] = { -55, -55, -55, -55, -62 };
-   const int coarseHigh[] = { -14, -14, -14, -14, -12 };
-   const int coarseLow[] = { -64, -64, -64, -64, -70 };
-   const int firpwr[] = { -78, -78, -78, -78, -80 };
+   static const int totalSizeDesired[] = { -55, -55, -55, -55, -62 };
+   static const int coarseHigh[] = { -14, -14, -14, -14, -12 };
+   static const int coarseLow[] = { -64, -64, -64, -64, -70 };
+   static const int firpwr[] = { -78, -78, -78, -78, -80 };
 
for (i = 0; i < 5; i++) {
ah->totalSizeDesired[i] = totalSizeDesired[i];
diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c 
b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
index 7303d98..06e34d2 100644
--- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
@@ -244,13 +244,15 @@ static void ar5008_hw_spur_mitigate(struct ath_hw *ah,
int upper, lower, cur_vit_mask;
int tmp, new;
int i;
-   int pilot_mask_reg[4] = { AR_PHY_TIMING7, AR_PHY_TIMING8,
- AR_PHY_PILOT_MASK_01_30, AR_PHY_PILOT_MASK_31_60
+   static int pilot_mask_reg[4] = {
+   AR_PHY_TIMING7, AR_PHY_TIMING8,
+   AR_PHY_PILOT_MASK

Re: [ath9k-devel] [PATCH 00/62] drivers/net: Use static const

2010-11-22 Thread Joe Perches
On Sat, 2010-11-20 at 20:50 -0800, David Miller wrote: 
> From: Joe Perches 
> Date: Sat, 20 Nov 2010 18:38:01 -0800
> 
> > Using static const generally increases object text and decreases data size.
> > It also generally decreases overall object size.
> 
> Joe, I'm going to be frank and say that I'm not going to review and
> apply such a large chunk of networking patches.

Hi David.  No worries.

> Separation is cool, splitting up patches is cool to make review
> perhaps easier and more distributed.

I know you have ownership of netdev.  Thanks for doing all that
work.  You may not get enough feedback on the very good job that
you do at it.

I posted these patches not so much to get you to immediately pick
them up, but to get review from and/or notify the maintainers of
each of these subsystems.  I would have submitted them to Jiri
Kosina/trivial, but he asked me to post and track these style
patches separately and wait for a few weeks before submitting any
remaining patches not picked up by maintainers to him.

> It severely negatively effects my mood,

Can't have that...

> You also make this more difficult for me by not using GIT.

I do of course use git locally.  I have a public tree as well,
but I hardly update it.  I updated it recently for this.

These patches are available in:

  git://repo.or.cz/linux-2.6/trivial-mods.git 20101121_net_next_static_const

Perhaps I should ask Stephen Rothwell to include some trivial tree
branch like this in next.

> Even with patchwork helping me significantly, it's still a lot of work
> to apply large sets of patches.

I think that cc'ing netdev is always appropriate for netdev patches, but
maybe triv...@kernel.org could become linux-triv...@vger.kernel.org or
something like that.

Perhaps there could be some way to automatically mark these exceptionally
trivial patches as something like "not applicable" so they don't appear
on your personal queue.

> If I had to take in John Linville's
> wireless stuff without GIT I'd be banging my head on a wall.
> 
> And these incessant huge patch bombs also take time away from me for
> the things I'd like to at least occiasionally work on that involve
> more intellect than monkeying around with such mindless patches.

Establishing trust is always a long term thing.
Breaking trust is easy too.

Anyway, I think these patches are obvious and correct and can be
directly applied without significant risk.

I think the the issues are:

o should the nominal maintainers of the subsystems pick them up
o should these subsystem maintainers should be bypassed
o should the subsystem mailing lists be cc'd
o should these be pulled as a single changeset or multiples

I think that getting the nominal subsystem maintainers involved
is good, but perhaps not too necessary for these sorts of patches.

btw: it doesn't seem that, other than John Linville for wireless,
you currently pull from many (any?) other people.  Do let me know
if you'd consider pulling these sorts of changes from me.

$ git log --merges --since=2-years-ago drivers/net | grep "^Author: " | sort | 
uniq -c | sort -rn
259 Author: David S. Miller 
201 Author: Linus Torvalds 
 45 Author: John W. Linville 
 15 Author: Russell King 
 15 Author: Ingo Molnar 
 14 Author: Benjamin Herrenschmidt 
  7 Author: Russell King 
  6 Author: Jiri Kosina 
  4 Author: Reinette Chatre 
  3 Author: Roland Dreier 
  3 Author: James Morris 
  2 Author: Tony Lindgren 
  2 Author: Grant Likely 
  1 Author: Stefano Stabellini 
  1 Author: root 
  1 Author: Paul Mackerras 
  1 Author: Kevin Hilman 
  1 Author: James Bottomley 

> Thanks for your understanding.  Feel free to submit this stuff in
> smaller chunks, say ~10 patches at a time.

Let me know if you want to pull or want them in smaller chunks in
say a month from now.

cheers, Joe

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH 00/62] drivers/net: Use static const

2010-11-22 Thread Joe Perches
On Mon, 2010-11-22 at 14:19 -0800, David Miller wrote:
> From: Joe Perches 
> Date: Mon, 22 Nov 2010 14:10:46 -0800
> > Do let me know if you'd consider pulling these sorts of
> > changes from me.
> Expand your horizon beyond drivers/net/ and into places like net/
> and you'll see I also pull from people like Patrick McHardy, for
> example.

I'll see who picks up or acks what and send a pull request to
you for the remainder of these patches mid December or so.

Do you want micro patches or a single patch?

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH wireless-next] ath: Rename ath_print to ath_debug

2010-11-29 Thread Joe Perches
On Mon, 2010-11-29 at 23:41 +0100, Felix Fietkau wrote:
> On 2010-11-29 7:07 AM, Peter Stuge wrote:
> > Luis R. Rodriguez wrote:
> >> On Sun, Nov 28, 2010 at 3:53 PM, Joe Perches  wrote:
> >> > Make the function name match the function purpose.
> >> > ath_debug is a debug only facility.
> >> > ath_print seems too generic a name for a debug only use.
> >> Nack, I don't see the point.
> > 
> > The point is to improve readability. I like the patch.
> And how exactly does this improve readability? Don't get me wrong, I
> generally like to see more cleanups merged to the ath/ath9k drivers
> (they do need it, after all).

It's considered polite to cc the patch author.

print is generic, debug is specific.
This function has a specific use for debugging
not a generic use all for logging.

If it was ath_print(level, etc) with KERN_
passed as the first argument that'd be similar
to other kernel calls.  As is, it's not.

> But in my opinion, simple renaming churn like this does nothing but
> annoy people who want to get other work done at the same time.

This sort of thing can be done when other changes have
just been merged to minimize conflicts.

> Consider the large number of lines touched (and the potential merge
> conflicts with other code because of that), relative to the microscopic
> aesthetic gain (if any).
> 
> Instead I'd like to see more cleanups that go beyond trivial function
> renames.

I gauge my willingness to spend time on subsystems on
the maintainers willingness to merge things that improve
readability and correctness.

cheers, Joe

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH] ath9k: hif_usb: Reduce indent 1 column

2010-11-30 Thread Joe Perches
Invert test and return early.
Move variable declarations to local scope.
Don't initialize variables to 0 unnecessarily.

Signed-off-by: Joe Perches 
---
 drivers/net/wireless/ath/ath9k/hif_usb.c |  106 +++---
 1 files changed, 53 insertions(+), 53 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c 
b/drivers/net/wireless/ath/ath9k/hif_usb.c
index ae842db..63bf9a7 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -363,9 +363,9 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb 
*hif_dev,
struct sk_buff *skb)
 {
struct sk_buff *nskb, *skb_pool[MAX_PKT_NUM_IN_TRANSFER];
-   int index = 0, i = 0, chk_idx, len = skb->len;
-   int rx_remain_len = 0, rx_pkt_len = 0;
-   u16 pkt_len, pkt_tag, pool_index = 0;
+   int index = 0, i = 0, len = skb->len;
+   int rx_remain_len, rx_pkt_len;
+   u16 pool_index = 0;
u8 *ptr;
 
spin_lock(&hif_dev->rx_lock);
@@ -399,64 +399,64 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb 
*hif_dev,
spin_unlock(&hif_dev->rx_lock);
 
while (index < len) {
+   u16 pkt_len;
+   u16 pkt_tag;
+   u16 pad_len;
+   int chk_idx;
+
ptr = (u8 *) skb->data;
 
pkt_len = ptr[index] + (ptr[index+1] << 8);
pkt_tag = ptr[index+2] + (ptr[index+3] << 8);
 
-   if (pkt_tag == ATH_USB_RX_STREAM_MODE_TAG) {
-   u16 pad_len;
-
-   pad_len = 4 - (pkt_len & 0x3);
-   if (pad_len == 4)
-   pad_len = 0;
-
-   chk_idx = index;
-   index = index + 4 + pkt_len + pad_len;
-
-   if (index > MAX_RX_BUF_SIZE) {
-   spin_lock(&hif_dev->rx_lock);
-   hif_dev->rx_remain_len = index - 
MAX_RX_BUF_SIZE;
-   hif_dev->rx_transfer_len =
-   MAX_RX_BUF_SIZE - chk_idx - 4;
-   hif_dev->rx_pad_len = pad_len;
-
-   nskb = __dev_alloc_skb(pkt_len + 32,
-  GFP_ATOMIC);
-   if (!nskb) {
-   dev_err(&hif_dev->udev->dev,
-   "ath9k_htc: RX memory allocation"
-   " error\n");
-   spin_unlock(&hif_dev->rx_lock);
-   goto err;
-   }
-   skb_reserve(nskb, 32);
-   RX_STAT_INC(skb_allocated);
-
-   memcpy(nskb->data, &(skb->data[chk_idx+4]),
-  hif_dev->rx_transfer_len);
-
-   /* Record the buffer pointer */
-   hif_dev->remain_skb = nskb;
+   if (pkt_tag != ATH_USB_RX_STREAM_MODE_TAG) {
+   RX_STAT_INC(skb_dropped);
+   return;
+   }
+
+   pad_len = 4 - (pkt_len & 0x3);
+   if (pad_len == 4)
+   pad_len = 0;
+
+   chk_idx = index;
+   index = index + 4 + pkt_len + pad_len;
+
+   if (index > MAX_RX_BUF_SIZE) {
+   spin_lock(&hif_dev->rx_lock);
+   hif_dev->rx_remain_len = index - MAX_RX_BUF_SIZE;
+   hif_dev->rx_transfer_len =
+   MAX_RX_BUF_SIZE - chk_idx - 4;
+   hif_dev->rx_pad_len = pad_len;
+
+   nskb = __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC);
+   if (!nskb) {
+   dev_err(&hif_dev->udev->dev,
+   "ath9k_htc: RX memory allocation 
error\n");
spin_unlock(&hif_dev->rx_lock);
-   } else {
-   nskb = __dev_alloc_skb(pkt_len + 32, 
GFP_ATOMIC);
-   if (!nskb) {
-   dev_err(&hif_dev->udev->dev,
-   "ath9k_htc: RX memory allocation"
-   " error\n");
-   goto err;
-   }
-   skb_reserve(nskb, 32);
-   RX_STAT_INC(skb_allocated);
-
-   memcpy(nskb->

Re: [ath9k-devel] [PATCH wireless-next] ath: Rename ath_print to ath_debug

2010-11-30 Thread Joe Perches
On Tue, 2010-11-30 at 03:43 +0100, Felix Fietkau wrote:
> On 2010-11-30 2:39 AM, Joe Perches wrote:
> > I gauge my willingness to spend time on subsystems on
> > the maintainers willingness to merge things that improve
> > readability and correctness.
> I'm not trying to discourage you from spending time on improving this
> code, just doubting the usefulness of such simple function renames.

Poor function naming is just that.
It reduces readability and the uses are counter expectation.



___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH 2/2] wireless: Remove unnecessary casts of usb_get_intfdata

2010-11-30 Thread Joe Perches
Signed-off-by: Joe Perches 
---
 drivers/net/wireless/ath/ar9170/usb.c|6 ++
 drivers/net/wireless/ath/ath9k/hif_usb.c |   13 +
 drivers/net/wireless/ath/carl9170/usb.c  |3 +--
 drivers/net/wireless/p54/p54usb.c|2 +-
 drivers/net/wireless/zd1201.c|2 +-
 5 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/ath/ar9170/usb.c 
b/drivers/net/wireless/ath/ar9170/usb.c
index 5dbb536..d3be6f9 100644
--- a/drivers/net/wireless/ath/ar9170/usb.c
+++ b/drivers/net/wireless/ath/ar9170/usb.c
@@ -161,8 +161,7 @@ static void ar9170_usb_submit_urb(struct ar9170_usb *aru)
 static void ar9170_usb_tx_urb_complete_frame(struct urb *urb)
 {
struct sk_buff *skb = urb->context;
-   struct ar9170_usb *aru = (struct ar9170_usb *)
- usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
+   struct ar9170_usb *aru = usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
 
if (unlikely(!aru)) {
dev_kfree_skb_irq(skb);
@@ -219,8 +218,7 @@ free:
 static void ar9170_usb_rx_completed(struct urb *urb)
 {
struct sk_buff *skb = urb->context;
-   struct ar9170_usb *aru = (struct ar9170_usb *)
-   usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
+   struct ar9170_usb *aru = usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
int err;
 
if (!aru)
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c 
b/drivers/net/wireless/ath/ath9k/hif_usb.c
index ae842db..beb750e 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -471,7 +471,7 @@ err:
 static void ath9k_hif_usb_rx_cb(struct urb *urb)
 {
struct sk_buff *skb = (struct sk_buff *) urb->context;
-   struct hif_device_usb *hif_dev = (struct hif_device_usb *)
+   struct hif_device_usb *hif_dev =
usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
int ret;
 
@@ -518,7 +518,7 @@ static void ath9k_hif_usb_reg_in_cb(struct urb *urb)
 {
struct sk_buff *skb = (struct sk_buff *) urb->context;
struct sk_buff *nskb;
-   struct hif_device_usb *hif_dev = (struct hif_device_usb *)
+   struct hif_device_usb *hif_dev =
usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
int ret;
 
@@ -993,8 +993,7 @@ static void ath9k_hif_usb_reboot(struct usb_device *udev)
 static void ath9k_hif_usb_disconnect(struct usb_interface *interface)
 {
struct usb_device *udev = interface_to_usbdev(interface);
-   struct hif_device_usb *hif_dev =
-   (struct hif_device_usb *) usb_get_intfdata(interface);
+   struct hif_device_usb *hif_dev = usb_get_intfdata(interface);
 
if (hif_dev) {
ath9k_htc_hw_deinit(hif_dev->htc_handle,
@@ -1016,8 +1015,7 @@ static void ath9k_hif_usb_disconnect(struct usb_interface 
*interface)
 static int ath9k_hif_usb_suspend(struct usb_interface *interface,
 pm_message_t message)
 {
-   struct hif_device_usb *hif_dev =
-   (struct hif_device_usb *) usb_get_intfdata(interface);
+   struct hif_device_usb *hif_dev = usb_get_intfdata(interface);
 
ath9k_hif_usb_dealloc_urbs(hif_dev);
 
@@ -1026,8 +1024,7 @@ static int ath9k_hif_usb_suspend(struct usb_interface 
*interface,
 
 static int ath9k_hif_usb_resume(struct usb_interface *interface)
 {
-   struct hif_device_usb *hif_dev =
-   (struct hif_device_usb *) usb_get_intfdata(interface);
+   struct hif_device_usb *hif_dev = usb_get_intfdata(interface);
struct htc_target *htc_handle = hif_dev->htc_handle;
int ret;
 
diff --git a/drivers/net/wireless/ath/carl9170/usb.c 
b/drivers/net/wireless/ath/carl9170/usb.c
index a268053..2d947a3 100644
--- a/drivers/net/wireless/ath/carl9170/usb.c
+++ b/drivers/net/wireless/ath/carl9170/usb.c
@@ -160,8 +160,7 @@ err_acc:
 
 static void carl9170_usb_tx_data_complete(struct urb *urb)
 {
-   struct ar9170 *ar = (struct ar9170 *)
- usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
+   struct ar9170 *ar = usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
 
if (WARN_ON_ONCE(!ar)) {
dev_kfree_skb_irq(urb->context);
diff --git a/drivers/net/wireless/p54/p54usb.c 
b/drivers/net/wireless/p54/p54usb.c
index d5bc21e..dd4d8fc 100644
--- a/drivers/net/wireless/p54/p54usb.c
+++ b/drivers/net/wireless/p54/p54usb.c
@@ -183,7 +183,7 @@ static void p54u_rx_cb(struct urb *urb)
 static void p54u_tx_cb(struct urb *urb)
 {
struct sk_buff *skb = urb->context;
-   struct ieee80211_hw *dev = (struct ieee80211_hw *)
+   struct ieee80211_hw *dev =
usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
 
p54_free_skb(dev, skb);
diff --git a/drivers/net/wireless/zd1201.c b/drivers/net/wireless/zd1201.c
index b97aa9c..415eec4 100644
--- a/drivers/net/wireless/zd1201.c
+++ b/drivers/net/wireless/zd

Re: [ath9k-devel] [PATCH wireless-next] ath: Rename ath_print to ath_debug

2010-12-01 Thread Joe Perches
On Tue, 2010-11-30 at 23:56 -0800, Luis R. Rodriguez wrote:
> On Tue, Nov 30, 2010 at 12:19 PM, Joe Perches  wrote:
> > Poor function naming is just that.
> > It reduces readability and the uses are counter expectation.
> The name is perfect, we use it to print anything, even non-debugging stuff.

'fraid not.

ath/debug.h

#ifdef CONFIG_ATH_DEBUG
void ath_print(struct ath_common *common, int dbg_mask, const char *fmt, ...)
__attribute__ ((format (printf, 3, 4)));
#else
static inline void __attribute__ ((format (printf, 3, 4)))
ath_print(struct ath_common *common, int dbg_mask, const char *fmt, ...)
{
}
#endif /* CONFIG_ATH_DEBUG */


___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH wireless-next] ath: Rename ath_print to ath_debug

2010-12-01 Thread Joe Perches
On Wed, 2010-12-01 at 15:37 +0100, Felix Fietkau wrote:
> On 2010-12-01 3:27 PM, Joe Perches wrote:
> > On Tue, 2010-11-30 at 23:56 -0800, Luis R. Rodriguez wrote:
> >> On Tue, Nov 30, 2010 at 12:19 PM, Joe Perches  wrote:
> >> > Poor function naming is just that.
> >> > It reduces readability and the uses are counter expectation.
> >> The name is perfect, we use it to print anything, even non-debugging stuff.
> > 
> > 'fraid not.
> > 
> > ath/debug.h
> > 
> > #ifdef CONFIG_ATH_DEBUG
> > void ath_print(struct ath_common *common, int dbg_mask, const char *fmt, 
> > ...)
> > __attribute__ ((format (printf, 3, 4)));
> > #else
> > static inline void __attribute__ ((format (printf, 3, 4)))
> > ath_print(struct ath_common *common, int dbg_mask, const char *fmt, ...)
> > {
> > }
> > #endif /* CONFIG_ATH_DEBUG */
> Now we're getting closer to something worth fixing. IMHO we should
> change the code so that ath_print(common, ATH_DBG_FATAL, ...) prints
> something even with CONFIG_ATH_DEBUG unset. To get this done, some
> renaming would make sense here.

Perhaps the function name is bad after all
if Luis believed it be be always active.

If there are going to be other non-debug uses,
I suggest adding the more standard styles of
ath_printk and ath_ similar to
dev_printk and dev_ from device.h

Something like this for a start, then a more
gradual rename of ath_print to ath_dbg (or
ath_debug) as the original patch suggested.

This basically removes debug.h leaving
only an #define ath_printk ath_dbg
there and moving all the ATH_DBG_
enums to ath.h

I do not think there's much purpose for struct
ath_common * being passed to the ath_printk
functions, but perhaps there might be.

Signed-off-by: Joe Perches 

---

 drivers/net/wireless/ath/ath.h   |  103 ++
 drivers/net/wireless/ath/debug.c |   20 ---
 drivers/net/wireless/ath/debug.h |   72 +--
 drivers/net/wireless/ath/main.c  |   20 +++
 4 files changed, 124 insertions(+), 91 deletions(-)

diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
index 26bdbee..5a598b9 100644
--- a/drivers/net/wireless/ath/ath.h
+++ b/drivers/net/wireless/ath/ath.h
@@ -186,4 +186,107 @@ bool ath_hw_keyreset(struct ath_common *common, u16 
entry);
 void ath_hw_cycle_counters_update(struct ath_common *common);
 int32_t ath_hw_get_listen_time(struct ath_common *common);
 
+extern __attribute__ ((format (printf, 3, 4))) int
+ath_printk(const char *level, struct ath_common *common, const char *fmt, ...);
+
+#define ath_emerg(common, fmt, ...)\
+   ath_printk(KERN_EMERG, common, fmt, ##__VA_ARGS)
+#define ath_alert(common, fmt, ...)\
+   ath_printk(KERN_ALERT, common, fmt, ##__VA_ARGS)
+#define ath_crit(common, fmt, ...) \
+   ath_printk(KERN_CRIT, common, fmt, ##__VA_ARGS)
+#define ath_err(common, fmt, ...)  \
+   ath_printk(KERN_ERR, common, fmt, ##__VA_ARGS)
+#define ath_warn(common, fmt, ...) \
+   ath_printk(KERN_WARNING, common, fmt, ##__VA_ARGS)
+#define ath_notice(common, fmt, ...)   \
+   ath_printk(KERN_NOTICE, common, fmt, ##__VA_ARGS)
+#define ath_info(common, fmt, ...) \
+   ath_printk(KERN_INFO, common, fmt, ##__VA_ARGS)
+
+/**
+ * enum ath_debug_level - atheros wireless debug level
+ *
+ * @ATH_DBG_RESET: reset processing
+ * @ATH_DBG_QUEUE: hardware queue management
+ * @ATH_DBG_EEPROM: eeprom processing
+ * @ATH_DBG_CALIBRATE: periodic calibration
+ * @ATH_DBG_INTERRUPT: interrupt processing
+ * @ATH_DBG_REGULATORY: regulatory processing
+ * @ATH_DBG_ANI: adaptive noise immunitive processing
+ * @ATH_DBG_XMIT: basic xmit operation
+ * @ATH_DBG_BEACON: beacon handling
+ * @ATH_DBG_CONFIG: configuration of the hardware
+ * @ATH_DBG_FATAL: fatal errors, this is the default, DBG_DEFAULT
+ * @ATH_DBG_PS: power save processing
+ * @ATH_DBG_HWTIMER: hardware timer handling
+ * @ATH_DBG_BTCOEX: bluetooth coexistance
+ * @ATH_DBG_BSTUCK: stuck beacons
+ * @ATH_DBG_ANY: enable all debugging
+ *
+ * The debug level is used to control the amount and type of debugging output
+ * we want to see. Each driver has its own method for enabling debugging and
+ * modifying debug level states -- but this is typically done through a
+ * module parameter 'debug' along with a respective 'debug' debugfs file
+ * entry.
+ */
+enum ATH_DEBUG {
+   ATH_DBG_RESET   = 0x0001,
+   ATH_DBG_QUEUE   = 0x0002,
+   ATH_DBG_EEPROM  = 0x0004,
+   ATH_DBG_CALIBRATE   = 0x0008,
+   ATH_DBG_INTERRUPT   = 0x0010,
+   ATH_DBG_REGULATORY  = 0x

Re: [ath9k-devel] [PATCH wireless-next] ath: Rename ath_print to ath_debug

2010-12-01 Thread Joe Perches
> +#define ath_emerg(common, fmt, ...)  \
> + ath_printk(KERN_EMERG, common, fmt, ##__VA_ARGS)

Sorry, that patch is defective. (and an old version)

That's what I get for not using git format-patch to send it.
I'll resend it appropriately.

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH wireless-next] MAINTAINERS: Add ATH GENERIC UTILITIES

2010-12-01 Thread Joe Perches
This file pattern is not currently shown as maintained
by atheros.  Perhaps it should be?

Signed-off-by: Joe Perches 
---
 MAINTAINERS |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index b162fbb..b744d08 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1080,6 +1080,12 @@ S:   Supported
 F: Documentation/aoe/
 F: drivers/block/aoe/
 
+ATHEROS ATH GENERIC UTILITIES
+M: "Luis R. Rodriguez" 
+L: linux-wirel...@vger.kernel.org
+S: Supported
+F: drivers/net/wireless/ath/*
+
 ATHEROS ATH5K WIRELESS DRIVER
 M: Jiri Slaby 
 M: Nick Kossifidis 


___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH] ath: Add and use ath_printk and ath_

2010-12-01 Thread Joe Perches
Add ath_printk and ath_ similar to
dev_printk and dev_ from device.h

This allows a more gradual rename of ath_print
to to ath_dbg or perhaps ath_debug.

This basically removes debug.h leaving
only an #define ath_printk ath_dbg
there and moving all the ATH_DBG_
enums to ath.h

I do not think there's much purpose for struct
ath_common * being passed to the ath_printk
functions, but perhaps there might be.

Signed-off-by: Joe Perches 
---
 drivers/net/wireless/ath/ath.h   |  103 ++
 drivers/net/wireless/ath/debug.c |   20 ---
 drivers/net/wireless/ath/debug.h |   72 +--
 drivers/net/wireless/ath/main.c  |   20 +++
 4 files changed, 124 insertions(+), 91 deletions(-)

diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
index 26bdbee..5a598b9 100644
--- a/drivers/net/wireless/ath/ath.h
+++ b/drivers/net/wireless/ath/ath.h
@@ -186,4 +186,107 @@ bool ath_hw_keyreset(struct ath_common *common, u16 
entry);
 void ath_hw_cycle_counters_update(struct ath_common *common);
 int32_t ath_hw_get_listen_time(struct ath_common *common);
 
+extern __attribute__ ((format (printf, 3, 4))) int
+ath_printk(const char *level, struct ath_common *common, const char *fmt, ...);
+
+#define ath_emerg(common, fmt, ...)\
+   ath_printk(KERN_EMERG, common, fmt, ##__VA_ARGS)
+#define ath_alert(common, fmt, ...)\
+   ath_printk(KERN_ALERT, common, fmt, ##__VA_ARGS)
+#define ath_crit(common, fmt, ...) \
+   ath_printk(KERN_CRIT, common, fmt, ##__VA_ARGS)
+#define ath_err(common, fmt, ...)  \
+   ath_printk(KERN_ERR, common, fmt, ##__VA_ARGS)
+#define ath_warn(common, fmt, ...) \
+   ath_printk(KERN_WARNING, common, fmt, ##__VA_ARGS)
+#define ath_notice(common, fmt, ...)   \
+   ath_printk(KERN_NOTICE, common, fmt, ##__VA_ARGS)
+#define ath_info(common, fmt, ...) \
+   ath_printk(KERN_INFO, common, fmt, ##__VA_ARGS)
+
+/**
+ * enum ath_debug_level - atheros wireless debug level
+ *
+ * @ATH_DBG_RESET: reset processing
+ * @ATH_DBG_QUEUE: hardware queue management
+ * @ATH_DBG_EEPROM: eeprom processing
+ * @ATH_DBG_CALIBRATE: periodic calibration
+ * @ATH_DBG_INTERRUPT: interrupt processing
+ * @ATH_DBG_REGULATORY: regulatory processing
+ * @ATH_DBG_ANI: adaptive noise immunitive processing
+ * @ATH_DBG_XMIT: basic xmit operation
+ * @ATH_DBG_BEACON: beacon handling
+ * @ATH_DBG_CONFIG: configuration of the hardware
+ * @ATH_DBG_FATAL: fatal errors, this is the default, DBG_DEFAULT
+ * @ATH_DBG_PS: power save processing
+ * @ATH_DBG_HWTIMER: hardware timer handling
+ * @ATH_DBG_BTCOEX: bluetooth coexistance
+ * @ATH_DBG_BSTUCK: stuck beacons
+ * @ATH_DBG_ANY: enable all debugging
+ *
+ * The debug level is used to control the amount and type of debugging output
+ * we want to see. Each driver has its own method for enabling debugging and
+ * modifying debug level states -- but this is typically done through a
+ * module parameter 'debug' along with a respective 'debug' debugfs file
+ * entry.
+ */
+enum ATH_DEBUG {
+   ATH_DBG_RESET   = 0x0001,
+   ATH_DBG_QUEUE   = 0x0002,
+   ATH_DBG_EEPROM  = 0x0004,
+   ATH_DBG_CALIBRATE   = 0x0008,
+   ATH_DBG_INTERRUPT   = 0x0010,
+   ATH_DBG_REGULATORY  = 0x0020,
+   ATH_DBG_ANI = 0x0040,
+   ATH_DBG_XMIT= 0x0080,
+   ATH_DBG_BEACON  = 0x0100,
+   ATH_DBG_CONFIG  = 0x0200,
+   ATH_DBG_FATAL   = 0x0400,
+   ATH_DBG_PS  = 0x0800,
+   ATH_DBG_HWTIMER = 0x1000,
+   ATH_DBG_BTCOEX  = 0x2000,
+   ATH_DBG_WMI = 0x4000,
+   ATH_DBG_BSTUCK  = 0x8000,
+   ATH_DBG_ANY = 0x
+};
+
+#define ATH_DBG_DEFAULT (ATH_DBG_FATAL)
+
+#ifdef CONFIG_ATH_DEBUG
+
+#define ath_dbg(common, dbg_mask, fmt, ...)\
+({ \
+   int rtn;\
+   if ((common)->debug_mask & dbg_mask)\
+   rtn = ath_printk(KERN_DEBUG, common, fmt,   \
+##__VA_ARGS__);\
+   else\
+   rtn = 0;\
+   \
+   rtn;\
+})
+#define ATH_DBG_WARN(foo, arg...) WARN(foo, arg)
+
+#else
+
+static inline  __attribute__ ((format (printf, 3, 4))) int
+ath_dbg(struct ath_common *common, enum ATH_DEBUG dbg_mask,
+   const cha

[ath9k-devel] [PATCH V2] ath: Add and use ath_printk and ath_

2010-12-01 Thread Joe Perches
Add ath_printk and ath_ similar to
dev_printk and dev_ from device.h

This allows a more gradual rename of ath_print
to to ath_dbg or perhaps ath_debug.

This basically removes debug.h leaving
only an #define ath_printk ath_dbg
there and moving all the ATH_DBG_
enums to ath.h

I do not think there's much purpose for struct
ath_common * being passed to the ath_printk
functions, but perhaps there might be.

Signed-off-by: Joe Perches 
---

V2:

Yes, Joe's an eedjot that must learn to use git commit --amend properly.

Compiled and built with and without CONFIG_ATH_DEBUG but otherwise
untested.

 drivers/net/wireless/ath/ath.h   |  103 ++
 drivers/net/wireless/ath/debug.c |   20 ---
 drivers/net/wireless/ath/debug.h |   72 +--
 drivers/net/wireless/ath/main.c  |   20 +++
 4 files changed, 124 insertions(+), 91 deletions(-)

diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
index 26bdbee..cbdd654 100644
--- a/drivers/net/wireless/ath/ath.h
+++ b/drivers/net/wireless/ath/ath.h
@@ -186,4 +186,107 @@ bool ath_hw_keyreset(struct ath_common *common, u16 
entry);
 void ath_hw_cycle_counters_update(struct ath_common *common);
 int32_t ath_hw_get_listen_time(struct ath_common *common);
 
+extern __attribute__ ((format (printf, 3, 4))) int
+ath_printk(const char *level, struct ath_common *common, const char *fmt, ...);
+
+#define ath_emerg(common, fmt, ...)\
+   ath_printk(KERN_EMERG, common, fmt, ##__VA_ARGS__)
+#define ath_alert(common, fmt, ...)\
+   ath_printk(KERN_ALERT, common, fmt, ##__VA_ARGS__)
+#define ath_crit(common, fmt, ...) \
+   ath_printk(KERN_CRIT, common, fmt, ##__VA_ARGS__)
+#define ath_err(common, fmt, ...)  \
+   ath_printk(KERN_ERR, common, fmt, ##__VA_ARGS__)
+#define ath_warn(common, fmt, ...) \
+   ath_printk(KERN_WARNING, common, fmt, ##__VA_ARGS__)
+#define ath_notice(common, fmt, ...)   \
+   ath_printk(KERN_NOTICE, common, fmt, ##__VA_ARGS__)
+#define ath_info(common, fmt, ...) \
+   ath_printk(KERN_INFO, common, fmt, ##__VA_ARGS__)
+
+/**
+ * enum ath_debug_level - atheros wireless debug level
+ *
+ * @ATH_DBG_RESET: reset processing
+ * @ATH_DBG_QUEUE: hardware queue management
+ * @ATH_DBG_EEPROM: eeprom processing
+ * @ATH_DBG_CALIBRATE: periodic calibration
+ * @ATH_DBG_INTERRUPT: interrupt processing
+ * @ATH_DBG_REGULATORY: regulatory processing
+ * @ATH_DBG_ANI: adaptive noise immunitive processing
+ * @ATH_DBG_XMIT: basic xmit operation
+ * @ATH_DBG_BEACON: beacon handling
+ * @ATH_DBG_CONFIG: configuration of the hardware
+ * @ATH_DBG_FATAL: fatal errors, this is the default, DBG_DEFAULT
+ * @ATH_DBG_PS: power save processing
+ * @ATH_DBG_HWTIMER: hardware timer handling
+ * @ATH_DBG_BTCOEX: bluetooth coexistance
+ * @ATH_DBG_BSTUCK: stuck beacons
+ * @ATH_DBG_ANY: enable all debugging
+ *
+ * The debug level is used to control the amount and type of debugging output
+ * we want to see. Each driver has its own method for enabling debugging and
+ * modifying debug level states -- but this is typically done through a
+ * module parameter 'debug' along with a respective 'debug' debugfs file
+ * entry.
+ */
+enum ATH_DEBUG {
+   ATH_DBG_RESET   = 0x0001,
+   ATH_DBG_QUEUE   = 0x0002,
+   ATH_DBG_EEPROM  = 0x0004,
+   ATH_DBG_CALIBRATE   = 0x0008,
+   ATH_DBG_INTERRUPT   = 0x0010,
+   ATH_DBG_REGULATORY  = 0x0020,
+   ATH_DBG_ANI = 0x0040,
+   ATH_DBG_XMIT= 0x0080,
+   ATH_DBG_BEACON  = 0x0100,
+   ATH_DBG_CONFIG  = 0x0200,
+   ATH_DBG_FATAL   = 0x0400,
+   ATH_DBG_PS  = 0x0800,
+   ATH_DBG_HWTIMER = 0x1000,
+   ATH_DBG_BTCOEX  = 0x2000,
+   ATH_DBG_WMI = 0x4000,
+   ATH_DBG_BSTUCK  = 0x8000,
+   ATH_DBG_ANY = 0x
+};
+
+#define ATH_DBG_DEFAULT (ATH_DBG_FATAL)
+
+#ifdef CONFIG_ATH_DEBUG
+
+#define ath_dbg(common, dbg_mask, fmt, ...)\
+({ \
+   int rtn;\
+   if ((common)->debug_mask & dbg_mask)\
+   rtn = ath_printk(KERN_DEBUG, common, fmt,   \
+##__VA_ARGS__);\
+   else\
+   rtn = 0;\
+   \
+   rtn;\
+})
+#define ATH_DBG_WARN

[ath9k-devel] [PATCH] ath: Convert ath_print(.., ATH_DBG_FATAL to ath_err

2010-12-01 Thread Joe Perches
So these errors are always emitted at KERN_ERR level.

Signed-off-by: Joe Perches 
---
 drivers/net/wireless/ath/ath9k/ahb.c|7 +-
 drivers/net/wireless/ath/ath9k/ar5008_phy.c |   12 +---
 drivers/net/wireless/ath/ath9k/ar9002_hw.c  |6 +-
 drivers/net/wireless/ath/ath9k/beacon.c |   14 ++---
 drivers/net/wireless/ath/ath9k/eeprom_4k.c  |   13 ++---
 drivers/net/wireless/ath/ath9k/eeprom_9287.c|   13 ++---
 drivers/net/wireless/ath/ath9k/eeprom_def.c |   14 ++---
 drivers/net/wireless/ath/ath9k/gpio.c   |4 +-
 drivers/net/wireless/ath/ath9k/htc_drv_beacon.c |4 +-
 drivers/net/wireless/ath/ath9k/htc_drv_init.c   |   27 +++-
 drivers/net/wireless/ath/ath9k/htc_drv_main.c   |   59 -
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c   |   25 +++-
 drivers/net/wireless/ath/ath9k/hw.c |   78 ++-
 drivers/net/wireless/ath/ath9k/init.c   |6 +-
 drivers/net/wireless/ath/ath9k/mac.c|   31 -
 drivers/net/wireless/ath/ath9k/main.c   |   56 +++--
 drivers/net/wireless/ath/ath9k/pci.c|7 +-
 drivers/net/wireless/ath/ath9k/rc.c |4 +-
 drivers/net/wireless/ath/ath9k/recv.c   |   15 ++---
 drivers/net/wireless/ath/ath9k/xmit.c   |   30 -
 drivers/net/wireless/ath/key.c  |   15 ++---
 21 files changed, 186 insertions(+), 254 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ahb.c 
b/drivers/net/wireless/ath/ath9k/ahb.c
index 1a984b0..25a6e44 100644
--- a/drivers/net/wireless/ath/ath9k/ahb.c
+++ b/drivers/net/wireless/ath/ath9k/ahb.c
@@ -35,10 +35,9 @@ static bool ath_ahb_eeprom_read(struct ath_common *common, 
u32 off, u16 *data)
 
pdata = (struct ath9k_platform_data *) pdev->dev.platform_data;
if (off >= (ARRAY_SIZE(pdata->eeprom_data))) {
-   ath_print(common, ATH_DBG_FATAL,
- "%s: flash read failed, offset %08x "
- "is out of range\n",
- __func__, off);
+   ath_err(common,
+   "%s: flash read failed, offset %08x is out of range\n",
+   __func__, off);
return false;
}
 
diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c 
b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
index 06e34d2..9af9f23 100644
--- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
@@ -173,8 +173,7 @@ static int ar5008_hw_set_channel(struct ath_hw *ah, struct 
ath9k_channel *chan)
channelSel = ((freq - 704) * 2 - 3040) / 10;
bModeSynth = 1;
} else {
-   ath_print(common, ATH_DBG_FATAL,
- "Invalid channel %u MHz\n", freq);
+   ath_err(common, "Invalid channel %u MHz\n", freq);
return -EINVAL;
}
 
@@ -206,8 +205,7 @@ static int ar5008_hw_set_channel(struct ath_hw *ah, struct 
ath9k_channel *chan)
channelSel = ath9k_hw_reverse_bits((freq - 4800) / 5, 8);
aModeRefSel = ath9k_hw_reverse_bits(1, 2);
} else {
-   ath_print(common, ATH_DBG_FATAL,
- "Invalid channel %u MHz\n", freq);
+   ath_err(common, "Invalid channel %u MHz\n", freq);
return -EINVAL;
}
 
@@ -448,8 +446,7 @@ static int ar5008_hw_rf_alloc_ext_banks(struct ath_hw *ah)
 #define ATH_ALLOC_BANK(bank, size) do { \
bank = kzalloc((sizeof(u32) * size), GFP_KERNEL); \
if (!bank) { \
-   ath_print(common, ATH_DBG_FATAL, \
- "Cannot allocate RF banks\n"); \
+   ath_err(common, "Cannot allocate RF banks\n"); \
return -ENOMEM; \
} \
} while (0);
@@ -879,8 +876,7 @@ static int ar5008_hw_process_ini(struct ath_hw *ah,
 
/* Write analog registers */
if (!ath9k_hw_set_rf_regs(ah, chan, freqIndex)) {
-   ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL,
- "ar5416SetRfRegs failed\n");
+   ath_err(ath9k_hw_common(ah), "ar5416SetRfRegs failed\n");
return -EIO;
}
 
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_hw.c 
b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
index 48261b7..7d5cb20 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_hw.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
@@ -494,9 +494,9 @@ int ar9002_hw_rf_claim(struct ath_hw *ah)
case AR_RAD2122_SREV_MAJOR:
break;
default:
-   ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL,
-

Re: [ath9k-devel] [PATCH wireless-next] MAINTAINERS: Add ATH GENERIC UTILITIES

2010-12-01 Thread Joe Perches
On Wed, 2010-12-01 at 11:46 -0800, Luis R. Rodriguez wrote:
> On Wed, Dec 1, 2010 at 9:37 AM, Joe Perches  wrote:
> > This file pattern is not currently shown as maintained
> > by atheros.  Perhaps it should be?
> > Signed-off-by: Joe Perches 
> Sure but its maintained by the community and Atheros hackers, not just me.

No doubt.

$ git log next-20101130 -- drivers/net/wireless/ath/*.[ch] | \
grep -P "(^Author)" | cut -f2- -d":" | sort | uniq -c | sort -rn | head
 27  Luis R. Rodriguez 
  6  Felix Fietkau 
  4  Bruno Randolf 
  3  Sujith 
      3  John W. Linville 
  3  Joe Perches 
  3  Bob Copeland 
  2  Pavel Roskin 
  2  Johannes Berg 
  2  David S. Miller 

Without any sort of MAINTAINERS entry, the results
for files in that directory are like this:

$ ./scripts/get_maintainer.pl -f --rolestats drivers/net/wireless/ath/main.c
"John W. Linville"  (maintainer:NETWORKING [WIREL...)
linux-wirel...@vger.kernel.org (open list:NETWORKING [WIREL...)
net...@vger.kernel.org (open list:NETWORKING DRIVERS)
linux-ker...@vger.kernel.org (open list)

Perhaps you want to be cc'd?
Perhaps there are atheros lists that should be cc'd?
If cc'ing linux-wireless is good enough,
that's good enough for me too.

cheers, Joe

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH wireless-next] MAINTAINERS: Add ATH GENERIC UTILITIES

2010-12-01 Thread Joe Perches
On Wed, 2010-12-01 at 12:41 -0800, Luis R. Rodriguez wrote:
> But you sent it as part of an old thread, not sure if John will see it.

He was on the To: list, I think he'll see it eventually.

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH 2/2] ath: Fix logging message typos

2010-12-01 Thread Joe Perches
Fix immunity misspelling.
Standardize strings from multiple modules.
Add spaces between words of concatenated strings.

Signed-off-by: Joe Perches 
---
 drivers/net/wireless/ath/ath5k/ani.c  |2 +-
 drivers/net/wireless/ath/ath9k/ar9002_calib.c |4 ++--
 drivers/net/wireless/ath/ath9k/eeprom_4k.c|4 ++--
 drivers/net/wireless/ath/ath9k/eeprom_9287.c  |2 +-
 drivers/net/wireless/ath/ath9k/eeprom_def.c   |2 +-
 drivers/net/wireless/ath/ath9k/htc_hst.c  |6 +++---
 6 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/ani.c 
b/drivers/net/wireless/ath/ath5k/ani.c
index 6b75b22..9c41881 100644
--- a/drivers/net/wireless/ath/ath5k/ani.c
+++ b/drivers/net/wireless/ath/ath5k/ani.c
@@ -74,7 +74,7 @@ ath5k_ani_set_noise_immunity_level(struct ath5k_hw *ah, int 
level)
static const s8 fr[] = { -78, -80 };
 #endif
if (level < 0 || level >= ARRAY_SIZE(sz)) {
-   ATH5K_ERR(ah->ah_sc, "noise immuniy level %d out of range",
+   ATH5K_ERR(ah->ah_sc, "noise immunity level %d out of range",
  level);
return;
}
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_calib.c 
b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
index a7705e7..199131e 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
@@ -720,7 +720,7 @@ static bool ar9285_hw_cl_cal(struct ath_hw *ah, struct 
ath9k_channel *chan)
if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL,
  AR_PHY_AGC_CONTROL_CAL, 0, AH_WAIT_TIMEOUT)) {
ath_dbg(common, ATH_DBG_CALIBRATE,
-   "offset calibration failed to complete in 1ms; 
noisy ??\n");
+   "offset calibration failed to complete in 1ms; 
noisy environment?\n");
return false;
}
REG_CLR_BIT(ah, AR_PHY_TURBO, AR_PHY_FC_DYN2040_EN);
@@ -734,7 +734,7 @@ static bool ar9285_hw_cl_cal(struct ath_hw *ah, struct 
ath9k_channel *chan)
if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_CAL,
  0, AH_WAIT_TIMEOUT)) {
ath_dbg(common, ATH_DBG_CALIBRATE,
-   "offset calibration failed to complete in 1ms; noisy 
??\n");
+   "offset calibration failed to complete in 1ms; noisy 
enfironment?\n");
return false;
}
 
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_4k.c 
b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
index 35b1a8c..939fc7a 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
@@ -90,7 +90,7 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah)
}
} else {
ath_err(common,
-   "Invalid EEPROM Magic. endianness 
mismatch.\n");
+   "Invalid EEPROM Magic. Endianness 
mismatch.\n");
return -EINVAL;
}
}
@@ -1178,7 +1178,7 @@ static u16 ath9k_hw_4k_get_spur_channel(struct ath_hw 
*ah, u16 i, bool is2GHz)
u16 spur_val = AR_NO_SPUR;
 
ath_dbg(common, ATH_DBG_ANI,
-   "Getting spur idx %d is2Ghz. %d val %x\n",
+   "Getting spur idx:%d is2Ghz:%d val:%x\n",
i, is2GHz, ah->config.spurchans[i][is2GHz]);
 
switch (ah->config.spurmode) {
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c 
b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
index 0be5351..9ec4bc8 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
@@ -1150,7 +1150,7 @@ static u16 ath9k_hw_ar9287_get_spur_channel(struct ath_hw 
*ah,
u16 spur_val = AR_NO_SPUR;
 
ath_dbg(common, ATH_DBG_ANI,
-   "Getting spur idx %d is2Ghz. %d val %x\n",
+   "Getting spur idx:%d is2Ghz:%d val:%x\n",
i, is2GHz, ah->config.spurchans[i][is2GHz]);
 
switch (ah->config.spurmode) {
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_def.c 
b/drivers/net/wireless/ath/ath9k/eeprom_def.c
index 91722fb..9aa31aa 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
@@ -1458,7 +1458,7 @@ static u16 ath9k_hw_def_get_spur_channel(struct ath_hw 
*ah, u16 i, bool is2GHz)
u16 spur_val = AR_NO_SPUR;
 
ath_dbg(common, ATH_DBG_ANI,
-   "Getting spur idx %d is2Ghz. %d val %x\n",
+   "Getting spur idx:%d is2Ghz:%d val:%x\n",
i, is2GHz, ah->config.spurchans[i][is2GHz]);
 
 

[ath9k-devel] [PATCH 1/2] ath: Fix ath_dbg uses missing newlines and access beyond array bound

2010-12-01 Thread Joe Perches
Add missing newlines to ath_dbg uses
ar9300RateSize is not a power of 4, fix to print array line by line.

Signed-off-by: Joe Perches 
---
 drivers/net/wireless/ath/ath9k/ar9003_eeprom.c |   29 ++-
 drivers/net/wireless/ath/ath9k/calib.c |4 +-
 drivers/net/wireless/ath/ath9k/gpio.c  |6 ++--
 drivers/net/wireless/ath/ath9k/htc_drv_gpio.c  |7 ++---
 drivers/net/wireless/ath/ath9k/htc_drv_main.c  |2 +-
 5 files changed, 12 insertions(+), 36 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c 
b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
index e6ae62b..beb3e87 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
@@ -3342,7 +3342,7 @@ static int ar9300_eeprom_restore_internal(struct ath_hw 
*ah,
goto fail;
 
 found:
-   ath_dbg(common, ATH_DBG_EEPROM, "Found valid EEPROM data");
+   ath_dbg(common, ATH_DBG_EEPROM, "Found valid EEPROM data\n");
 
for (it = 0; it < MSTATE; it++) {
if (!read(ah, cptr, word, COMP_HDR_LEN))
@@ -4084,22 +4084,9 @@ static void ar9003_hw_set_target_power_eeprom(struct 
ath_hw *ah, u16 freq,
ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_23, freq,
  is2GHz) + ht40PowerIncForPdadc;
 
-   while (i < ar9300RateSize) {
-   ath_dbg(common, ATH_DBG_EEPROM,
-   "TPC[%02d] 0x%08x ", i, targetPowerValT2[i]);
-   i++;
-
-   ath_dbg(common, ATH_DBG_EEPROM,
-   "TPC[%02d] 0x%08x ", i, targetPowerValT2[i]);
-   i++;
-
-   ath_dbg(common, ATH_DBG_EEPROM,
-   "TPC[%02d] 0x%08x ", i, targetPowerValT2[i]);
-   i++;
-
+   for (i = 0; i < ar9300RateSize; i++) {
ath_dbg(common, ATH_DBG_EEPROM,
"TPC[%02d] 0x%08x\n", i, targetPowerValT2[i]);
-   i++;
}
 }
 
@@ -4687,17 +4674,7 @@ static void ath9k_hw_ar9300_set_txpower(struct ath_hw 
*ah,
 
for (i = 0; i < ar9300RateSize; i++) {
ath_dbg(common, ATH_DBG_EEPROM,
-   "TPC[%02d] 0x%08x ", i, targetPowerValT2[i]);
-   i++;
-   ath_dbg(common, ATH_DBG_EEPROM,
-   "TPC[%02d] 0x%08x ", i, targetPowerValT2[i]);
-   i++;
-   ath_dbg(common, ATH_DBG_EEPROM,
-   "TPC[%02d] 0x%08x ", i, targetPowerValT2[i]);
-   i++;
-   ath_dbg(common, ATH_DBG_EEPROM,
-   "TPC[%02d] 0x%08x\n\n", i, targetPowerValT2[i]);
-   i++;
+   "TPC[%02d] 0x%08x\n", i, targetPowerValT2[i]);
}
 
/*
diff --git a/drivers/net/wireless/ath/ath9k/calib.c 
b/drivers/net/wireless/ath/ath9k/calib.c
index 0b6c623..b68a1ac 100644
--- a/drivers/net/wireless/ath/ath9k/calib.c
+++ b/drivers/net/wireless/ath/ath9k/calib.c
@@ -324,12 +324,12 @@ static void ath9k_hw_nf_sanitize(struct ath_hw *ah, s16 
*nf)
 
if (nf[i] > ATH9K_NF_TOO_HIGH) {
ath_dbg(common, ATH_DBG_CALIBRATE,
-   "NF[%d] (%d) > MAX (%d), correcting to MAX",
+   "NF[%d] (%d) > MAX (%d), correcting to MAX\n",
i, nf[i], ATH9K_NF_TOO_HIGH);
nf[i] = limit->max;
} else if (nf[i] < limit->min) {
ath_dbg(common, ATH_DBG_CALIBRATE,
-   "NF[%d] (%d) < MIN (%d), correcting to NOM",
+   "NF[%d] (%d) < MIN (%d), correcting to NOM\n",
i, nf[i], limit->min);
nf[i] = limit->nominal;
}
diff --git a/drivers/net/wireless/ath/ath9k/gpio.c 
b/drivers/net/wireless/ath/ath9k/gpio.c
index 60b2fb7..1337640 100644
--- a/drivers/net/wireless/ath/ath9k/gpio.c
+++ b/drivers/net/wireless/ath/ath9k/gpio.c
@@ -237,12 +237,12 @@ static void ath_detect_bt_priority(struct ath_softc *sc)
/* Detect if colocated bt started scanning */
if (btcoex->bt_priority_cnt >= ATH_BT_CNT_SCAN_THRESHOLD) {
ath_dbg(ath9k_hw_common(sc->sc_ah), ATH_DBG_BTCOEX,
-   "BT scan detected");
+   "BT scan detected\n");
sc->sc_flags |= (SC_OP_BT_SCAN |
 SC_OP_BT_PRIORITY_DETECTED);
} else if (btcoex->bt_priority_cnt >= ATH_BT_CNT_THRESHOLD) {
ath_dbg(ath9k_hw_common(sc->sc_ah), ATH_DBG_BTCOEX,
-  

Re: [ath9k-devel] [PATCH 2/2] ath: Fix logging message typos

2010-12-01 Thread Joe Perches
On Thu, 2010-12-02 at 06:30 +0100, Peter Stuge wrote:
> Joe Perches wrote:
> > +++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
> ..
> > @@ -734,7 +734,7 @@ static bool ar9285_hw_cl_cal(struct ath_hw *ah, struct 
> > ath9k_channel *chan)
> > if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_CAL,
> >   0, AH_WAIT_TIMEOUT)) {
> > ath_dbg(common, ATH_DBG_CALIBRATE,
> > -   "offset calibration failed to complete in 1ms; noisy 
> > ??\n");
> > +   "offset calibration failed to complete in 1ms; noisy 
> > enfironment?\n");
> 
> enfironment? :)

Umm, what's a typo fix patch without more typos?
Correct?  How dull...

> > ath_dbg(common, ATH_DBG_ANI,
> > -   "Getting spur idx %d is2Ghz. %d val %x\n",
> > +   "Getting spur idx:%d is2Ghz:%d val:%x\n",
> > i, is2GHz, ah->config.spurchans[i][is2GHz]);
> 
> Is this short for "spurious" ?

Likely.  Anyone want to change it to a whole word?

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH 2/2 V2] ath: Fix logging message typos

2010-12-01 Thread Joe Perches
Fix immunity misspelling.
Standardize strings from multiple modules.
Add spaces between words of concatenated strings.

Signed-off-by: Joe Perches 
---

V2: Fix a newly introduced tyop...

 drivers/net/wireless/ath/ath5k/ani.c  |2 +-
 drivers/net/wireless/ath/ath9k/ar9002_calib.c |4 ++--
 drivers/net/wireless/ath/ath9k/eeprom_4k.c|4 ++--
 drivers/net/wireless/ath/ath9k/eeprom_9287.c  |2 +-
 drivers/net/wireless/ath/ath9k/eeprom_def.c   |2 +-
 drivers/net/wireless/ath/ath9k/htc_hst.c  |6 +++---
 6 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/ani.c 
b/drivers/net/wireless/ath/ath5k/ani.c
index 6b75b22..9c41881 100644
--- a/drivers/net/wireless/ath/ath5k/ani.c
+++ b/drivers/net/wireless/ath/ath5k/ani.c
@@ -74,7 +74,7 @@ ath5k_ani_set_noise_immunity_level(struct ath5k_hw *ah, int 
level)
static const s8 fr[] = { -78, -80 };
 #endif
if (level < 0 || level >= ARRAY_SIZE(sz)) {
-   ATH5K_ERR(ah->ah_sc, "noise immuniy level %d out of range",
+   ATH5K_ERR(ah->ah_sc, "noise immunity level %d out of range",
  level);
return;
}
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_calib.c 
b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
index a7705e7..199131e 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
@@ -720,7 +720,7 @@ static bool ar9285_hw_cl_cal(struct ath_hw *ah, struct 
ath9k_channel *chan)
if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL,
  AR_PHY_AGC_CONTROL_CAL, 0, AH_WAIT_TIMEOUT)) {
ath_dbg(common, ATH_DBG_CALIBRATE,
-   "offset calibration failed to complete in 1ms; 
noisy ??\n");
+   "offset calibration failed to complete in 1ms; 
noisy environment?\n");
return false;
}
REG_CLR_BIT(ah, AR_PHY_TURBO, AR_PHY_FC_DYN2040_EN);
@@ -734,7 +734,7 @@ static bool ar9285_hw_cl_cal(struct ath_hw *ah, struct 
ath9k_channel *chan)
if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_CAL,
  0, AH_WAIT_TIMEOUT)) {
ath_dbg(common, ATH_DBG_CALIBRATE,
-   "offset calibration failed to complete in 1ms; noisy 
??\n");
+   "offset calibration failed to complete in 1ms; noisy 
environment?\n");
return false;
}
 
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_4k.c 
b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
index 35b1a8c..939fc7a 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
@@ -90,7 +90,7 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah)
}
} else {
ath_err(common,
-   "Invalid EEPROM Magic. endianness 
mismatch.\n");
+   "Invalid EEPROM Magic. Endianness 
mismatch.\n");
return -EINVAL;
}
}
@@ -1178,7 +1178,7 @@ static u16 ath9k_hw_4k_get_spur_channel(struct ath_hw 
*ah, u16 i, bool is2GHz)
u16 spur_val = AR_NO_SPUR;
 
ath_dbg(common, ATH_DBG_ANI,
-   "Getting spur idx %d is2Ghz. %d val %x\n",
+   "Getting spur idx:%d is2Ghz:%d val:%x\n",
i, is2GHz, ah->config.spurchans[i][is2GHz]);
 
switch (ah->config.spurmode) {
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c 
b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
index 0be5351..9ec4bc8 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
@@ -1150,7 +1150,7 @@ static u16 ath9k_hw_ar9287_get_spur_channel(struct ath_hw 
*ah,
u16 spur_val = AR_NO_SPUR;
 
ath_dbg(common, ATH_DBG_ANI,
-   "Getting spur idx %d is2Ghz. %d val %x\n",
+   "Getting spur idx:%d is2Ghz:%d val:%x\n",
i, is2GHz, ah->config.spurchans[i][is2GHz]);
 
switch (ah->config.spurmode) {
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_def.c 
b/drivers/net/wireless/ath/ath9k/eeprom_def.c
index 91722fb..9aa31aa 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
@@ -1458,7 +1458,7 @@ static u16 ath9k_hw_def_get_spur_channel(struct ath_hw 
*ah, u16 i, bool is2GHz)
u16 spur_val = AR_NO_SPUR;
 
ath_dbg(common, ATH_DBG_ANI,
-   "Getting spur idx %d is2Ghz. %d val %x\n",
+   "Getting spur idx:%d is2Ghz:%d val:%x\n",
i, is2GHz, ah->c

[ath9k-devel] [PATCH 0/4] ath: logging message conversion

2010-12-02 Thread Joe Perches
ath_print is misleading as it's only used with CONFIG_ATH_DEBUG.

Add and use the more normal _printk and _
printk equivalents. (ath_printk and ath_)

Fix various defects in the current uses of ath_print formats
and arguments: Unnecessary casts, missing newlines, multiple
prints, and 1 loop which can exceed array bounds.

Bundled and integrated the individual patches into a single patch series.

Joe Perches (4):
  ath: Add and use ath_printk and ath_
  ath: Convert ath_print(.., ATH_DBG_FATAL to ath_err
  ath: Convert ath_print to ath_dbg
  ath: Fix ath_dbg access beyond array bound

 drivers/net/wireless/ath/ath.h  |  103 +++
 drivers/net/wireless/ath/ath5k/base.c   |1 -
 drivers/net/wireless/ath/ath5k/debug.c  |1 -
 drivers/net/wireless/ath/ath9k/ahb.c|7 +-
 drivers/net/wireless/ath/ath9k/ani.c|   97 +--
 drivers/net/wireless/ath/ath9k/ar5008_phy.c |  199 +
 drivers/net/wireless/ath/ath9k/ar9002_calib.c   |  220 +++
 drivers/net/wireless/ath/ath9k/ar9002_hw.c  |6 +-
 drivers/net/wireless/ath/ath9k/ar9002_mac.c |   20 +-
 drivers/net/wireless/ath/ath9k/ar9003_calib.c   |  217 +++---
 drivers/net/wireless/ath/ath9k/ar9003_eeprom.c  |  174 ---
 drivers/net/wireless/ath/ath9k/ar9003_mac.c |   16 +-
 drivers/net/wireless/ath/ath9k/ar9003_phy.c |  205 ++---
 drivers/net/wireless/ath/ath9k/beacon.c |   79 -
 drivers/net/wireless/ath/ath9k/calib.c  |   59 +++---
 drivers/net/wireless/ath/ath9k/common.c |4 +-
 drivers/net/wireless/ath/ath9k/common.h |1 -
 drivers/net/wireless/ath/ath9k/eeprom.c |4 +-
 drivers/net/wireless/ath/ath9k/eeprom_4k.c  |   72 
 drivers/net/wireless/ath/ath9k/eeprom_9287.c|   39 ++---
 drivers/net/wireless/ath/ath9k/eeprom_def.c |   67 
 drivers/net/wireless/ath/ath9k/gpio.c   |   20 +-
 drivers/net/wireless/ath/ath9k/htc_drv_beacon.c |   24 ++--
 drivers/net/wireless/ath/ath9k/htc_drv_gpio.c   |   15 +-
 drivers/net/wireless/ath/ath9k/htc_drv_init.c   |   63 +++
 drivers/net/wireless/ath/ath9k/htc_drv_main.c   |  192 ++--
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c   |   33 ++--
 drivers/net/wireless/ath/ath9k/hw.c |  161 -
 drivers/net/wireless/ath/ath9k/hw.h |1 -
 drivers/net/wireless/ath/ath9k/init.c   |   28 ++--
 drivers/net/wireless/ath/ath9k/mac.c|  117 ++---
 drivers/net/wireless/ath/ath9k/main.c   |  185 +--
 drivers/net/wireless/ath/ath9k/pci.c|7 +-
 drivers/net/wireless/ath/ath9k/rc.c |   18 +-
 drivers/net/wireless/ath/ath9k/recv.c   |   48 +++---
 drivers/net/wireless/ath/ath9k/virtual.c|7 +-
 drivers/net/wireless/ath/ath9k/wmi.c|   12 +-
 drivers/net/wireless/ath/ath9k/xmit.c   |   84 -
 drivers/net/wireless/ath/debug.c|   20 --
 drivers/net/wireless/ath/debug.h|   92 --
 drivers/net/wireless/ath/key.c  |   28 ++--
 drivers/net/wireless/ath/main.c |   20 ++
 42 files changed, 1306 insertions(+), 1460 deletions(-)
 delete mode 100644 drivers/net/wireless/ath/debug.h

-- 
1.7.3.2.245.g03276.dirty

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH 2/4] ath: Convert ath_print(.., ATH_DBG_FATAL to ath_err

2010-12-02 Thread Joe Perches
So these errors are always emitted at KERN_ERR level.
Remove ARRAY_SIZE casts, use printf type %zu

Signed-off-by: Joe Perches 
---
 drivers/net/wireless/ath/ath9k/ahb.c|7 +-
 drivers/net/wireless/ath/ath9k/ar5008_phy.c |   12 +---
 drivers/net/wireless/ath/ath9k/ar9002_hw.c  |6 +-
 drivers/net/wireless/ath/ath9k/beacon.c |   14 ++---
 drivers/net/wireless/ath/ath9k/eeprom_4k.c  |   13 ++---
 drivers/net/wireless/ath/ath9k/eeprom_9287.c|   13 ++---
 drivers/net/wireless/ath/ath9k/eeprom_def.c |   14 ++---
 drivers/net/wireless/ath/ath9k/gpio.c   |4 +-
 drivers/net/wireless/ath/ath9k/htc_drv_beacon.c |4 +-
 drivers/net/wireless/ath/ath9k/htc_drv_init.c   |   27 +++-
 drivers/net/wireless/ath/ath9k/htc_drv_main.c   |   59 -
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c   |   25 +++-
 drivers/net/wireless/ath/ath9k/hw.c |   78 ++-
 drivers/net/wireless/ath/ath9k/init.c   |6 +-
 drivers/net/wireless/ath/ath9k/mac.c|   31 -
 drivers/net/wireless/ath/ath9k/main.c   |   56 +++--
 drivers/net/wireless/ath/ath9k/pci.c|7 +-
 drivers/net/wireless/ath/ath9k/rc.c |4 +-
 drivers/net/wireless/ath/ath9k/recv.c   |   15 ++---
 drivers/net/wireless/ath/ath9k/xmit.c   |   30 -
 drivers/net/wireless/ath/key.c  |   15 ++---
 21 files changed, 186 insertions(+), 254 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ahb.c 
b/drivers/net/wireless/ath/ath9k/ahb.c
index 1a984b0..25a6e44 100644
--- a/drivers/net/wireless/ath/ath9k/ahb.c
+++ b/drivers/net/wireless/ath/ath9k/ahb.c
@@ -35,10 +35,9 @@ static bool ath_ahb_eeprom_read(struct ath_common *common, 
u32 off, u16 *data)
 
pdata = (struct ath9k_platform_data *) pdev->dev.platform_data;
if (off >= (ARRAY_SIZE(pdata->eeprom_data))) {
-   ath_print(common, ATH_DBG_FATAL,
- "%s: flash read failed, offset %08x "
- "is out of range\n",
- __func__, off);
+   ath_err(common,
+   "%s: flash read failed, offset %08x is out of range\n",
+   __func__, off);
return false;
}
 
diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c 
b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
index 06e34d2..9af9f23 100644
--- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
@@ -173,8 +173,7 @@ static int ar5008_hw_set_channel(struct ath_hw *ah, struct 
ath9k_channel *chan)
channelSel = ((freq - 704) * 2 - 3040) / 10;
bModeSynth = 1;
} else {
-   ath_print(common, ATH_DBG_FATAL,
- "Invalid channel %u MHz\n", freq);
+   ath_err(common, "Invalid channel %u MHz\n", freq);
return -EINVAL;
}
 
@@ -206,8 +205,7 @@ static int ar5008_hw_set_channel(struct ath_hw *ah, struct 
ath9k_channel *chan)
channelSel = ath9k_hw_reverse_bits((freq - 4800) / 5, 8);
aModeRefSel = ath9k_hw_reverse_bits(1, 2);
} else {
-   ath_print(common, ATH_DBG_FATAL,
- "Invalid channel %u MHz\n", freq);
+   ath_err(common, "Invalid channel %u MHz\n", freq);
return -EINVAL;
}
 
@@ -448,8 +446,7 @@ static int ar5008_hw_rf_alloc_ext_banks(struct ath_hw *ah)
 #define ATH_ALLOC_BANK(bank, size) do { \
bank = kzalloc((sizeof(u32) * size), GFP_KERNEL); \
if (!bank) { \
-   ath_print(common, ATH_DBG_FATAL, \
- "Cannot allocate RF banks\n"); \
+   ath_err(common, "Cannot allocate RF banks\n"); \
return -ENOMEM; \
} \
} while (0);
@@ -879,8 +876,7 @@ static int ar5008_hw_process_ini(struct ath_hw *ah,
 
/* Write analog registers */
if (!ath9k_hw_set_rf_regs(ah, chan, freqIndex)) {
-   ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL,
- "ar5416SetRfRegs failed\n");
+   ath_err(ath9k_hw_common(ah), "ar5416SetRfRegs failed\n");
return -EIO;
}
 
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_hw.c 
b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
index 48261b7..7d5cb20 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_hw.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
@@ -494,9 +494,9 @@ int ar9002_hw_rf_claim(struct ath_hw *ah)
case AR_RAD2122_SREV_MAJOR:
break;
default:
-   ath_print(ath9k_hw_comm

[ath9k-devel] [PATCH 4/4] ath: Fix ath_dbg access beyond array bound

2010-12-02 Thread Joe Perches
ar9300RateSize is not necessarily a power of 4.

Change ar9003_hw_set_target_power_eeprom
to print the targetPowerValT2 array one per line.

ath9k_hw_ar9300_set_txpower repeated the output 4 times per line,
change it to print the targetPowerValT2 value one per line.

Signed-off-by: Joe Perches 
---
 drivers/net/wireless/ath/ath9k/ar9003_eeprom.c |   27 +--
 1 files changed, 2 insertions(+), 25 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c 
b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
index 7b13a2e..34d1d7a 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
@@ -4086,22 +4086,9 @@ static void ar9003_hw_set_target_power_eeprom(struct 
ath_hw *ah, u16 freq,
ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_23, freq,
  is2GHz) + ht40PowerIncForPdadc;
 
-   while (i < ar9300RateSize) {
-   ath_dbg(common, ATH_DBG_EEPROM,
-   "TPC[%02d] 0x%08x ", i, targetPowerValT2[i]);
-   i++;
-
-   ath_dbg(common, ATH_DBG_EEPROM,
-   "TPC[%02d] 0x%08x ", i, targetPowerValT2[i]);
-   i++;
-
-   ath_dbg(common, ATH_DBG_EEPROM,
-   "TPC[%02d] 0x%08x ", i, targetPowerValT2[i]);
-   i++;
-
+   for (i = 0; i < ar9300RateSize; i++) {
ath_dbg(common, ATH_DBG_EEPROM,
"TPC[%02d] 0x%08x\n", i, targetPowerValT2[i]);
-   i++;
}
 }
 
@@ -4689,17 +4676,7 @@ static void ath9k_hw_ar9300_set_txpower(struct ath_hw 
*ah,
 
for (i = 0; i < ar9300RateSize; i++) {
ath_dbg(common, ATH_DBG_EEPROM,
-   "TPC[%02d] 0x%08x ", i, targetPowerValT2[i]);
-   i++;
-   ath_dbg(common, ATH_DBG_EEPROM,
-   "TPC[%02d] 0x%08x ", i, targetPowerValT2[i]);
-   i++;
-   ath_dbg(common, ATH_DBG_EEPROM,
-   "TPC[%02d] 0x%08x ", i, targetPowerValT2[i]);
-   i++;
-   ath_dbg(common, ATH_DBG_EEPROM,
-   "TPC[%02d] 0x%08x\n\n", i, targetPowerValT2[i]);
-   i++;
+   "TPC[%02d] 0x%08x\n", i, targetPowerValT2[i]);
}
 
/*
-- 
1.7.3.2.245.g03276.dirty

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH 1/3] ath5k: move nohwcrypt to ath_common structure

2011-01-05 Thread Joe Perches
On Wed, 2011-01-05 at 14:22 -0500, John W. Linville wrote:

> diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
[]
> + bool nohwcrypt;

> diff --git a/drivers/net/wireless/ath/ath5k/base.c 
> b/drivers/net/wireless/ath/ath5k/base.c
> -int modparam_nohwcrypt;
> +static int modparam_nohwcrypt;
>  module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO);

bool/int matching?

Perhaps the modparam_nohwcrypts should be
bool and S_IRUGO

> diff --git a/drivers/net/wireless/ath/ath9k/init.c 
[]
> -int modparam_nohwcrypt;
> +static int modparam_nohwcrypt;
>  module_param_named(nohwcrypt, modparam_nohwcrypt, int, 0444);

> diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c 
[]
> -int htc_modparam_nohwcrypt;
> -module_param_named(nohwcrypt, htc_modparam_nohwcrypt, int, 0444);
> +static int modparam_nohwcrypt;
> +module_param_named(nohwcrypt, modparam_nohwcrypt, int, 0444);


___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH 1/3] ath5k: move nohwcrypt to ath_common structure

2011-01-05 Thread Joe Perches
On Wed, 2011-01-05 at 14:49 -0500, Bob Copeland wrote:
> On Wed, Jan 5, 2011 at 2:40 PM, Joe Perches  wrote:
> > On Wed, 2011-01-05 at 14:22 -0500, John W. Linville wrote:
> >> diff --git a/drivers/net/wireless/ath/ath.h 
> >> b/drivers/net/wireless/ath/ath.h
> > []
> >> + bool nohwcrypt;
> >> diff --git a/drivers/net/wireless/ath/ath5k/base.c 
> >> b/drivers/net/wireless/ath/ath5k/base.c
> >> -int modparam_nohwcrypt;
> >> +static int modparam_nohwcrypt;
> >>  module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO);
> > bool/int matching?
> It used to be the case that you had to use ints here.  Google tells me
> that changed about 2 years ago, so bool should be ok.

bool is OK.

modparam_nohwcrypt is declared int and should be declared bool.
Also should be declared and used as bool in ath9k and ath9k_htc too.

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH net-next 1/2] wireless: Remove casts of void *

2011-06-13 Thread Joe Perches
Unnecessary casts of void * clutter the code.

These are the remainder casts after several specific
patches to remove netdev_priv and dev_priv.

Done via coccinelle script:

$ cat cast_void_pointer.cocci
@@
type T;
T *pt;
void *pv;
@@

- pt = (T *)pv;
+ pt = pv;

Signed-off-by: Joe Perches 
---
 drivers/net/wireless/ath/ath9k/ar9003_mac.c|2 +-
 drivers/net/wireless/ath/ath9k/htc_hst.c   |6 ++
 drivers/net/wireless/ath/ath9k/init.c  |2 +-
 drivers/net/wireless/ath/ath9k/wmi.c   |2 +-
 drivers/net/wireless/ath/carl9170/usb.c|2 +-
 drivers/net/wireless/hostap/hostap_cs.c|4 ++--
 drivers/net/wireless/hostap/hostap_pci.c   |4 ++--
 drivers/net/wireless/hostap/hostap_plx.c   |4 ++--
 drivers/net/wireless/ipw2x00/ipw2100.c |6 ++
 drivers/net/wireless/iwlegacy/iwl-4965-rs.c|2 +-
 drivers/net/wireless/iwlegacy/iwl-4965-ucode.c |8 
 drivers/net/wireless/iwlegacy/iwl3945-base.c   |8 
 drivers/net/wireless/iwlegacy/iwl4965-base.c   |2 +-
 drivers/net/wireless/iwlwifi/iwl-agn-rs.c  |2 +-
 drivers/net/wireless/mwifiex/11n.c |5 ++---
 drivers/net/wireless/mwifiex/cmdevt.c  |3 +--
 drivers/net/wireless/mwifiex/join.c|2 +-
 drivers/net/wireless/mwifiex/scan.c|2 +-
 drivers/net/wireless/mwifiex/sta_cmd.c |4 ++--
 drivers/net/wireless/mwifiex/sta_cmdresp.c |   12 ++--
 drivers/net/wireless/mwifiex/txrx.c|2 +-
 drivers/net/wireless/p54/eeprom.c  |4 ++--
 22 files changed, 41 insertions(+), 47 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mac.c 
b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
index 04e6be0..2321e5b 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
@@ -654,7 +654,7 @@ void ath9k_hw_setup_statusring(struct ath_hw *ah, void 
*ts_start,
ah->ts_paddr_start = ts_paddr_start;
ah->ts_paddr_end = ts_paddr_start + (size * sizeof(struct ar9003_txs));
ah->ts_size = size;
-   ah->ts_ring = (struct ar9003_txs *) ts_start;
+   ah->ts_ring = ts_start;
 
ath9k_hw_reset_txstatus_ring(ah);
 }
diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c 
b/drivers/net/wireless/ath/ath9k/htc_hst.c
index 1b90ed8..34e42c8 100644
--- a/drivers/net/wireless/ath/ath9k/htc_hst.c
+++ b/drivers/net/wireless/ath/ath9k/htc_hst.c
@@ -107,8 +107,7 @@ static void htc_process_conn_rsp(struct htc_target *target,
u16 max_msglen;
enum htc_endpoint_id epid, tepid;
 
-   svc_rspmsg = (struct htc_conn_svc_rspmsg *)
-   ((void *) htc_hdr + sizeof(struct htc_frame_hdr));
+   svc_rspmsg = (void *)htc_hdr + sizeof(struct htc_frame_hdr);
 
if (svc_rspmsg->status == HTC_SERVICE_SUCCESS) {
epid = svc_rspmsg->endpoint_id;
@@ -393,8 +392,7 @@ void ath9k_htc_rx_msg(struct htc_target *htc_handle,
}
 
/* Get the message ID */
-   msg_id = (__be16 *) ((void *) htc_hdr +
-sizeof(struct htc_frame_hdr));
+   msg_id = (void *)htc_hdr + sizeof(struct htc_frame_hdr);
 
/* Now process HTC messages */
switch (be16_to_cpu(*msg_id)) {
diff --git a/drivers/net/wireless/ath/ath9k/init.c 
b/drivers/net/wireless/ath/ath9k/init.c
index d4b166c..d4b44a8 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -352,7 +352,7 @@ int ath_descdma_setup(struct ath_softc *sc, struct 
ath_descdma *dd,
error = -ENOMEM;
goto fail;
}
-   ds = (u8 *) dd->dd_desc;
+   ds = dd->dd_desc;
ath_dbg(common, ATH_DBG_CONFIG, "%s DMA map: %p (%u) -> %llx (%u)\n",
name, ds, (u32) dd->dd_desc_len,
ito64(dd->dd_desc_paddr), /*XXX*/(u32) dd->dd_desc_len);
diff --git a/drivers/net/wireless/ath/ath9k/wmi.c 
b/drivers/net/wireless/ath/ath9k/wmi.c
index 35422fc..0934b38 100644
--- a/drivers/net/wireless/ath/ath9k/wmi.c
+++ b/drivers/net/wireless/ath/ath9k/wmi.c
@@ -156,7 +156,7 @@ void ath9k_wmi_event_tasklet(unsigned long data)
 
switch (cmd_id) {
case WMI_SWBA_EVENTID:
-   swba = (struct wmi_event_swba *) wmi_event;
+   swba = wmi_event;
ath9k_htc_swba(priv, swba);
break;
case WMI_FATAL_EVENTID:
diff --git a/drivers/net/wireless/ath/carl9170/usb.c 
b/drivers/net/wireless/ath/carl9170/usb.c
index 2fb53d0..7f1d13a 100644
--- a/drivers/net/wireless/ath/carl9170/usb.c
+++ b/drivers/net/wireless/ath/carl9170/usb.c
@@ -649,7 +649,7 @@ int carl9170_exec_cmd(struct ar9170 *ar, const enum 
carl9170_cmd_oids cmd,
memcpy(ar->cmd.data, payload, plen

[ath9k-devel] [PATCH net-next 0/2] drivers/net: Remove casts of void *

2011-06-13 Thread Joe Perches
Joe Perches (2):
  wireless: Remove casts of void *
  drivers/net: Remove casts of void *

 drivers/net/a2065.c|2 +-
 drivers/net/appletalk/ltpc.c   |8 ++--
 drivers/net/atl1e/atl1e_main.c |5 +--
 drivers/net/atlx/atl2.c|3 +-
 drivers/net/benet/be_cmds.c|3 +-
 drivers/net/benet/be_ethtool.c |4 +-
 drivers/net/bna/bfa_cee.c  |2 +-
 drivers/net/bna/cna.h  |2 +-
 drivers/net/caif/caif_shmcore.c|2 +-
 drivers/net/cnic.c |4 +-
 drivers/net/cxgb3/cxgb3_offload.c  |2 +-
 drivers/net/davinci_cpdma.c|2 +-
 drivers/net/declance.c |   38 -
 drivers/net/depca.c|4 +-
 drivers/net/dl2k.c |4 +-
 drivers/net/ehea/ehea_qmr.c|2 +-
 drivers/net/epic100.c  |4 +-
 drivers/net/fealnx.c   |4 +-
 drivers/net/gianfar.c  |4 +-
 drivers/net/hamachi.c  |4 +-
 drivers/net/macmace.c  |2 +-
 drivers/net/mlx4/en_rx.c   |2 +-
 drivers/net/mlx4/en_tx.c   |5 +--
 drivers/net/myri_sbus.c|3 +-
 drivers/net/netxen/netxen_nic_ctx.c|   16 
 drivers/net/pxa168_eth.c   |2 +-
 drivers/net/qla3xxx.c  |5 +--
 drivers/net/qlcnic/qlcnic_ctx.c|   26 +++---
 drivers/net/qlcnic/qlcnic_ethtool.c|2 +-
 drivers/net/qlcnic/qlcnic_hw.c |3 +-
 drivers/net/qlcnic/qlcnic_main.c   |2 +-
 drivers/net/qlge/qlge_main.c   |4 +-
 drivers/net/s2io.c |   18 --
 drivers/net/sfc/siena.c|2 +-
 drivers/net/sis900.c   |4 +-
 drivers/net/tokenring/madgemc.c|2 +-
 drivers/net/typhoon.c  |2 +-
 drivers/net/vxge/vxge-config.c |   44 ---
 drivers/net/vxge/vxge-traffic.c|6 ++--
 drivers/net/wan/pc300_tty.c|2 +-
 drivers/net/wireless/ath/ath9k/ar9003_mac.c|2 +-
 drivers/net/wireless/ath/ath9k/htc_hst.c   |6 +--
 drivers/net/wireless/ath/ath9k/init.c  |2 +-
 drivers/net/wireless/ath/ath9k/wmi.c   |2 +-
 drivers/net/wireless/ath/carl9170/usb.c|2 +-
 drivers/net/wireless/hostap/hostap_cs.c|4 +-
 drivers/net/wireless/hostap/hostap_pci.c   |4 +-
 drivers/net/wireless/hostap/hostap_plx.c   |4 +-
 drivers/net/wireless/ipw2x00/ipw2100.c |6 +--
 drivers/net/wireless/iwlegacy/iwl-4965-rs.c|2 +-
 drivers/net/wireless/iwlegacy/iwl-4965-ucode.c |8 ++--
 drivers/net/wireless/iwlegacy/iwl3945-base.c   |8 ++--
 drivers/net/wireless/iwlegacy/iwl4965-base.c   |2 +-
 drivers/net/wireless/iwlwifi/iwl-agn-rs.c  |2 +-
 drivers/net/wireless/mwifiex/11n.c |5 +--
 drivers/net/wireless/mwifiex/cmdevt.c  |3 +-
 drivers/net/wireless/mwifiex/join.c|2 +-
 drivers/net/wireless/mwifiex/scan.c|2 +-
 drivers/net/wireless/mwifiex/sta_cmd.c |4 +-
 drivers/net/wireless/mwifiex/sta_cmdresp.c |   12 +++---
 drivers/net/wireless/mwifiex/txrx.c|2 +-
 drivers/net/wireless/p54/eeprom.c  |4 +-
 drivers/net/xilinx_emaclite.c  |4 +-
 drivers/net/yellowfin.c|6 ++--
 64 files changed, 164 insertions(+), 189 deletions(-)

-- 
1.7.6.rc0

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH net-next 1/2] wireless: Remove casts of void *

2011-06-13 Thread Joe Perches
On Tue, 2011-06-14 at 15:23 +1000, Julian Calaby wrote:
> Joe,

Hi Julian.

> On Tue, Jun 14, 2011 at 14:02, Joe Perches  wrote:
> > Unnecessary casts of void * clutter the code.
> > These are the remainder casts after several specific
> > patches to remove netdev_priv and dev_priv.
> You seem to have removed a lot of casts that don't relate to these cleanups.
> In particular, some of the casts seem to relate more to documentation
> rather than just changing pointer types to make the compiler happy.

All of the cast removals are casts of void* types.
I think none of of the casts are useful.
None of them are required, all are duplicative.

> In
> particular, I'm referring to the casts describing the different usages
> of data_buf in mwiflex, and around some pointer math in ath9k.

Can you describe more in detail why you think these are documentary?

This sort of cast:

diff --git a/drivers/net/wireless/mwifiex/11n.c 
b/drivers/net/wireless/mwifiex/11n.c
@@ -191,7 +191,7 @@ int mwifiex_ret_11n_cfg(struct host_cmd_ds_command *resp, 
void *data_buf)
struct host_cmd_ds_11n_cfg *htcfg = &resp->params.htcfg;
 
if (data_buf) {
-   tx_cfg = (struct mwifiex_ds_11n_tx_cfg *) data_buf;
+   tx_cfg = data_buf;

I think pretty useless.  tx_cfg is a struct mwifiex_ds_11n_tx_cfg *.

> Whilst I'm sure that the compiler is smart enough to handle automatic
> casts between pointer types, some of these, in particular the mwiflex
> bits, add some documentation to the code.

I think not.  Opinions of course can vary.

cheers, Joe

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH net-next 1/2] wireless: Remove casts of void *

2011-06-14 Thread Joe Perches
On Tue, 2011-06-14 at 15:39 +1000, Julian Calaby wrote:
> My issue here is that you mention in the commit log that this relates
> to the removal of netdev_priv and dev_priv, but the casts removed
> (mostly) don't.

Sorry if that was unclear to you.

None of these patches remove casts of netdev_priv.

What I meant to say was that net and drivers/net have
had many patches that remove casts of void * like the
patches that removed casts of netdev_priv.

These patches remove the last casts of void * types
in net and drivers/net.

cheers, Joe

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH net-next 1/2] wireless: Remove casts of void *

2011-06-14 Thread Joe Perches
On Tue, 2011-06-14 at 12:31 -0400, Pavel Roskin wrote:
> On 06/14/2011 12:02 AM, Joe Perches wrote:
> > /* Get the message ID */
> > -   msg_id = (__be16 *) ((void *) htc_hdr +
> > -sizeof(struct htc_frame_hdr));
> > +   msg_id = (void *)htc_hdr + sizeof(struct htc_frame_hdr);
> I would never do stuff like this without verifying by sparse that no 
> warnings are introduced.

I did that.  I believe there are no new warnings.

> Sparse warnings should be avoided to keep sparse checks useful. 
> Otherwise, important warnings would drown in the noise.

$ make allyesconfig
$ git log -1 --pretty=oneline drivers/net/wireless/ath/ath9k/htc_hst.c
337c22b774ff7f007b90b266b25c9a33ff555c48 wireless: Remove casts of void *
$ make C=2 drivers/net/wireless/ath/ath9k/htc_hst.o
make[1]: Nothing to be done for `all'.
  CHK include/linux/version.h
  CHK include/generated/utsrelease.h
  CALLscripts/checksyscalls.sh
  CHECK   scripts/mod/empty.c
  CHECK   drivers/net/wireless/ath/ath9k/htc_hst.c
  CC  drivers/net/wireless/ath/ath9k/htc_hst.o
$

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH wireless-next] ath: Convert ath_dbg(bar, ATH_DBG_, to ath_dbg(bar, FOO

2011-12-15 Thread Joe Perches
On Thu, 2011-12-15 at 15:00 -0800, Luis R. Rodriguez wrote:
> On Thu, Dec 15, 2011 at 2:55 PM, Joe Perches  wrote:
> > Add ATH_DBG_ to macros to shorten the uses and
> > reduce the line count.
> >
> > Coalesce ath_dbg formats.
> > Add missing spaces to coalesced formats.
> > Add missing newline terminations to ath_dbg formats.
> > Align ath_dbg arguments where appropriate.
> > Standardize ath_dbg formats without periods.
> >
> > Signed-off-by: Joe Perches 
> > ---
> 
> Good idea, are you cocci spatching this? This will obviosly create
> conflicts with pending patches.

sed/emacs
inspection of formats post sed.

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH wireless-next] ath: Convert ath_dbg(bar, ATH_DBG_, to ath_dbg(bar, FOO

2011-12-15 Thread Joe Perches
On Thu, 2011-12-15 at 15:09 -0800, Luis R. Rodriguez wrote:
> On Thu, Dec 15, 2011 at 3:05 PM, Joe Perches  wrote:
> > sed/emacs
> > inspection of formats post sed.
> Is it easy to run again at a later time or was it a bitch?

Pretty trivial, but the format mods post coalescing
(missing newlines, missing spaces) were eyeballed.

Unless you've got a _lot_ of unqueued patches for
wireless-next, I doubt the delta will be very high.

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH 25/26] ath9k_hw: MCI whitespace/debug cleanup

2012-02-22 Thread Joe Perches
On Wed, 2012-02-22 at 12:42 +0530, Sujith Manoharan wrote:
> This patch fixes indentation and the general coding style
> in ar9003_mci.c. Also, minimize the amount of debug log
> output generated by MCI.
[]
> diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mci.c 
> b/drivers/net/wireless/ath/ath9k/ar9003_mci.c
[]
> @@ -35,13 +35,10 @@ static int ar9003_mci_wait_for_interrupt(struct ath_hw 
> *ah, u32 address,
>   struct ath_common *common = ath9k_hw_common(ah);
>  
>   while (time_out) {
> -
>   if (REG_READ(ah, address) & bit_position) {
> -
>   REG_WRITE(ah, address, bit_position);

A for loop with a test/continue would reduce indentation.
Might fix a bug too if timeout is ever negative.

for (; timeout > 0; udelay(10), timeout -= 10) {
if (!(REG_READ(ah, address) & bit_position))
continue;
etc...


___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH 26/26] ath9k: Cleanup mci.c

2012-02-22 Thread Joe Perches
On Wed, 2012-02-22 at 12:42 +0530, Sujith Manoharan wrote:
> Cleanup whitespace, fix indentation and coding style.

No mention of deleted dbg messages.


___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH] ath9k: Add wiphy name to log messages.

2012-03-07 Thread Joe Perches
On Wed, 2012-03-07 at 16:05 -0800, gree...@candelatech.com wrote:
> From: Ben Greear 
> 
> On systems with multiple NICs, it's nice to know which
> one is producing warnings.  Here is an example of the
> new ouput:
> 
> ath: wiphy0: Failed to stop TX DMA, queues=0x005!

Makes some sense.

> diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
[]
> @@ -174,12 +174,13 @@ bool ath_hw_keyreset(struct ath_common *common, u16 
> entry);
>  void ath_hw_cycle_counters_update(struct ath_common *common);
>  int32_t ath_hw_get_listen_time(struct ath_common *common);
>  
> -extern __printf(2, 3) void ath_printk(const char *level, const char *fmt, 
> ...);
> +extern __printf(3, 4) void ath_printk(const char *level,
> +   const struct ath_common *common,
> +   const char *fmt, ...);

Maybe

__printf(3, 4)
void ath_printk(etc...

>  
>  #define _ath_printk(level, common, fmt, ...) \
>  do { \
> - __always_unused struct ath_common *unused = common; \
> - ath_printk(level, fmt, ##__VA_ARGS__);  \
> + ath_printk(level, common, fmt, ##__VA_ARGS__);  \
>  } while (0)
>  
>  #define ath_emerg(common, fmt, ...)  \

It's probably better to remove the _ath_printk
indirection altogether and just use ath_printk
directly in the ath_ macros.

> diff --git a/drivers/net/wireless/ath/main.c b/drivers/net/wireless/ath/main.c
[]
> @@ -57,7 +57,8 @@ struct sk_buff *ath_rxbuf_alloc(struct ath_common *common,
>  }
>  EXPORT_SYMBOL(ath_rxbuf_alloc);
>  
> -void ath_printk(const char *level, const char *fmt, ...)
> +void ath_printk(const char *level, const struct ath_common* common,
> + const char *fmt, ...)
>  {
>   struct va_format vaf;
>   va_list args;
> @@ -67,7 +68,11 @@ void ath_printk(const char *level, const char *fmt, ...)
>   vaf.fmt = fmt;
>   vaf.va = &args;
>  
> - printk("%sath: %pV", level, &vaf);
> + if (common && common->hw && common->hw->wiphy)
> + printk("%sath: %s: %pV",
> +level, wiphy_name(common->hw->wiphy), &vaf);
> + else
> + printk("%sath: %pV", level, &vaf);
>  
>   va_end(args);

Maybe it's better to print wiphyX: only when
multiple ath nics exist?



___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH wireless-next 0/3] ath: printk cleanups and code reduction

2012-03-18 Thread Joe Perches
Joe Perches (3):
  ath: Add and use pr_fmt, convert printks to pr_
  ath5k: Introduce _ath5k_printk to reduce code/text
  ath6kl: Add __printf verification to ath6kl_printk

 drivers/net/wireless/ath/ath5k/ani.c  |   44 +++--
 drivers/net/wireless/ath/ath5k/ath5k.h|   29 +---
 drivers/net/wireless/ath/ath5k/attach.c   |2 +
 drivers/net/wireless/ath/ath5k/base.c |   22 
 drivers/net/wireless/ath/ath5k/debug.c|   17 ++
 drivers/net/wireless/ath/ath5k/desc.c |2 +
 drivers/net/wireless/ath/ath5k/dma.c  |2 +
 drivers/net/wireless/ath/ath5k/eeprom.c   |2 +
 drivers/net/wireless/ath/ath5k/initvals.c |5 ++-
 drivers/net/wireless/ath/ath5k/led.c  |2 +
 drivers/net/wireless/ath/ath5k/mac80211-ops.c |2 +
 drivers/net/wireless/ath/ath5k/pci.c  |4 ++-
 drivers/net/wireless/ath/ath5k/phy.c  |2 +
 drivers/net/wireless/ath/ath5k/qcu.c  |2 +
 drivers/net/wireless/ath/ath5k/reset.c|2 +
 drivers/net/wireless/ath/ath5k/sysfs.c|2 +
 drivers/net/wireless/ath/ath6kl/cfg80211.c|2 +
 drivers/net/wireless/ath/ath6kl/common.h  |3 +-
 drivers/net/wireless/ath/ath6kl/init.c|2 +
 drivers/net/wireless/ath/ath6kl/main.c|2 +
 drivers/net/wireless/ath/ath6kl/txrx.c|2 +
 drivers/net/wireless/ath/ath9k/htc_drv_init.c |8 ++--
 drivers/net/wireless/ath/ath9k/htc_hst.c  |7 ++--
 drivers/net/wireless/ath/ath9k/init.c |   13 +++
 drivers/net/wireless/ath/ath9k/pci.c  |9 +++--
 drivers/net/wireless/ath/main.c   |4 ++-
 drivers/net/wireless/ath/regd.c   |4 ++-
 27 files changed, 128 insertions(+), 69 deletions(-)

-- 
1.7.8.111.gad25c.dirty

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH wireless-next 1/3] ath: Add and use pr_fmt, convert printks to pr_

2012-03-18 Thread Joe Perches
Use a more current logging style.
Make sure all output is prefixed appropriately.

Signed-off-by: Joe Perches 
---
 drivers/net/wireless/ath/ath5k/ani.c  |   44 +++--
 drivers/net/wireless/ath/ath5k/ath5k.h|   32 +
 drivers/net/wireless/ath/ath5k/attach.c   |2 +
 drivers/net/wireless/ath/ath5k/base.c |2 +
 drivers/net/wireless/ath/ath5k/debug.c|   17 ++
 drivers/net/wireless/ath/ath5k/desc.c |2 +
 drivers/net/wireless/ath/ath5k/dma.c  |2 +
 drivers/net/wireless/ath/ath5k/eeprom.c   |2 +
 drivers/net/wireless/ath/ath5k/initvals.c |5 ++-
 drivers/net/wireless/ath/ath5k/led.c  |2 +
 drivers/net/wireless/ath/ath5k/mac80211-ops.c |2 +
 drivers/net/wireless/ath/ath5k/pci.c  |4 ++-
 drivers/net/wireless/ath/ath5k/phy.c  |2 +
 drivers/net/wireless/ath/ath5k/qcu.c  |2 +
 drivers/net/wireless/ath/ath5k/reset.c|2 +
 drivers/net/wireless/ath/ath5k/sysfs.c|2 +
 drivers/net/wireless/ath/ath6kl/cfg80211.c|2 +
 drivers/net/wireless/ath/ath6kl/init.c|2 +
 drivers/net/wireless/ath/ath6kl/main.c|2 +
 drivers/net/wireless/ath/ath6kl/txrx.c|2 +
 drivers/net/wireless/ath/ath9k/htc_drv_init.c |8 ++--
 drivers/net/wireless/ath/ath9k/htc_hst.c  |7 ++--
 drivers/net/wireless/ath/ath9k/init.c |   13 +++
 drivers/net/wireless/ath/ath9k/pci.c  |9 +++--
 drivers/net/wireless/ath/main.c   |4 ++-
 drivers/net/wireless/ath/regd.c   |4 ++-
 26 files changed, 107 insertions(+), 70 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/ani.c 
b/drivers/net/wireless/ath/ath5k/ani.c
index bf67416..6841f5c 100644
--- a/drivers/net/wireless/ath/ath5k/ani.c
+++ b/drivers/net/wireless/ath/ath5k/ani.c
@@ -14,6 +14,8 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include "ath5k.h"
 #include "reg.h"
 #include "debug.h"
@@ -728,33 +730,25 @@ void
 ath5k_ani_print_counters(struct ath5k_hw *ah)
 {
/* clears too */
-   printk(KERN_NOTICE "ACK fail\t%d\n",
-   ath5k_hw_reg_read(ah, AR5K_ACK_FAIL));
-   printk(KERN_NOTICE "RTS fail\t%d\n",
-   ath5k_hw_reg_read(ah, AR5K_RTS_FAIL));
-   printk(KERN_NOTICE "RTS success\t%d\n",
-   ath5k_hw_reg_read(ah, AR5K_RTS_OK));
-   printk(KERN_NOTICE "FCS error\t%d\n",
-   ath5k_hw_reg_read(ah, AR5K_FCS_FAIL));
+   pr_notice("ACK fail\t%d\n", ath5k_hw_reg_read(ah, AR5K_ACK_FAIL));
+   pr_notice("RTS fail\t%d\n", ath5k_hw_reg_read(ah, AR5K_RTS_FAIL));
+   pr_notice("RTS success\t%d\n", ath5k_hw_reg_read(ah, AR5K_RTS_OK));
+   pr_notice("FCS error\t%d\n", ath5k_hw_reg_read(ah, AR5K_FCS_FAIL));
 
/* no clear */
-   printk(KERN_NOTICE "tx\t%d\n",
-   ath5k_hw_reg_read(ah, AR5K_PROFCNT_TX));
-   printk(KERN_NOTICE "rx\t%d\n",
-   ath5k_hw_reg_read(ah, AR5K_PROFCNT_RX));
-   printk(KERN_NOTICE "busy\t%d\n",
-   ath5k_hw_reg_read(ah, AR5K_PROFCNT_RXCLR));
-   printk(KERN_NOTICE "cycles\t%d\n",
-   ath5k_hw_reg_read(ah, AR5K_PROFCNT_CYCLE));
-
-   printk(KERN_NOTICE "AR5K_PHYERR_CNT1\t%d\n",
-   ath5k_hw_reg_read(ah, AR5K_PHYERR_CNT1));
-   printk(KERN_NOTICE "AR5K_PHYERR_CNT2\t%d\n",
-   ath5k_hw_reg_read(ah, AR5K_PHYERR_CNT2));
-   printk(KERN_NOTICE "AR5K_OFDM_FIL_CNT\t%d\n",
-   ath5k_hw_reg_read(ah, AR5K_OFDM_FIL_CNT));
-   printk(KERN_NOTICE "AR5K_CCK_FIL_CNT\t%d\n",
-   ath5k_hw_reg_read(ah, AR5K_CCK_FIL_CNT));
+   pr_notice("tx\t%d\n", ath5k_hw_reg_read(ah, AR5K_PROFCNT_TX));
+   pr_notice("rx\t%d\n", ath5k_hw_reg_read(ah, AR5K_PROFCNT_RX));
+   pr_notice("busy\t%d\n", ath5k_hw_reg_read(ah, AR5K_PROFCNT_RXCLR));
+   pr_notice("cycles\t%d\n", ath5k_hw_reg_read(ah, AR5K_PROFCNT_CYCLE));
+
+   pr_notice("AR5K_PHYERR_CNT1\t%d\n",
+ ath5k_hw_reg_read(ah, AR5K_PHYERR_CNT1));
+   pr_notice("AR5K_PHYERR_CNT2\t%d\n",
+ ath5k_hw_reg_read(ah, AR5K_PHYERR_CNT2));
+   pr_notice("AR5K_OFDM_FIL_CNT\t%d\n",
+ ath5k_hw_reg_read(ah, AR5K_OFDM_FIL_CNT));
+   pr_notice("AR5K_CCK_FIL_CNT\t%d\n",
+ ath5k_hw_reg_read(ah, AR5K_CCK_FIL_CNT));
 }
 
 #endif
diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h 
b/drivers/net/wireless/ath/ath5k/ath5k.h
index 8d434b8..954c373 100644
--- a/drivers/net/wireless/ath/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath/ath5k/