From patchwork Wed Aug 26 20:15:13 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 44106 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7QKH834019771 for ; Wed, 26 Aug 2009 20:17:08 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753357AbZHZUPw (ORCPT ); Wed, 26 Aug 2009 16:15:52 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753310AbZHZUPv (ORCPT ); Wed, 26 Aug 2009 16:15:51 -0400 Received: from xc.sipsolutions.net ([83.246.72.84]:49851 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753357AbZHZUPu (ORCPT ); Wed, 26 Aug 2009 16:15:50 -0400 Received: by sipsolutions.net with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1MgOuK-0005ff-EP; Wed, 26 Aug 2009 22:15:48 +0200 Subject: [PATCH] iwlwifi: fix ICT irq table endianness From: Johannes Berg To: John Linville Cc: Reinette Chatre , linux-wireless Date: Wed, 26 Aug 2009 22:15:13 +0200 Message-Id: <1251317713.14690.0.camel@johannes.local> Mime-Version: 1.0 X-Mailer: Evolution 2.27.90 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The ICT IRQ table is a set of __le32 values, not u32 values, so when reading it we need to take into account that it has to be converted to CPU endianness. This was causing a lot of trouble on my powerpc box where various things would simply not work for no apparent reason with 5xxx cards, but worked with 4965 -- which doesn't use the ICT table. Signed-off-by: Johannes Berg Acked-by: Reinette Chatre --- Oddly, the __le32 pointer doesn't help one bit, sparse doesn't warn. Oh well. This makes lots of things work better for me :) drivers/net/wireless/iwlwifi/iwl-core.c | 10 +++++----- drivers/net/wireless/iwlwifi/iwl-dev.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- wireless-testing.orig/drivers/net/wireless/iwlwifi/iwl-dev.h 2009-08-26 20:37:01.000000000 +0200 +++ wireless-testing/drivers/net/wireless/iwlwifi/iwl-dev.h 2009-08-26 20:37:06.000000000 +0200 @@ -1170,7 +1170,7 @@ struct iwl_priv { struct iwl_hw_params hw_params; /* INT ICT Table */ - u32 *ict_tbl; + __le32 *ict_tbl; dma_addr_t ict_tbl_dma; dma_addr_t aligned_ict_tbl_dma; int ict_index; --- wireless-testing.orig/drivers/net/wireless/iwlwifi/iwl-core.c 2009-08-26 20:39:14.000000000 +0200 +++ wireless-testing/drivers/net/wireless/iwlwifi/iwl-core.c 2009-08-26 20:40:36.000000000 +0200 @@ -1823,7 +1823,7 @@ int iwl_reset_ict(struct iwl_priv *priv) spin_lock_irqsave(&priv->lock, flags); iwl_disable_interrupts(priv); - memset(&priv->ict_tbl[0],0, sizeof(u32) * ICT_COUNT); + memset(&priv->ict_tbl[0], 0, sizeof(u32) * ICT_COUNT); val = priv->aligned_ict_tbl_dma >> PAGE_SHIFT; @@ -1901,13 +1901,13 @@ irqreturn_t iwl_isr_ict(int irq, void *d /* read all entries that not 0 start with ict_index */ while (priv->ict_tbl[priv->ict_index]) { - val |= priv->ict_tbl[priv->ict_index]; + val |= le32_to_cpu(priv->ict_tbl[priv->ict_index]); IWL_DEBUG_ISR(priv, "ICT index %d value 0x%08X\n", - priv->ict_index, - priv->ict_tbl[priv->ict_index]); + priv->ict_index, + le32_to_cpu(priv->ict_tbl[priv->ict_index])); priv->ict_tbl[priv->ict_index] = 0; priv->ict_index = iwl_queue_inc_wrap(priv->ict_index, - ICT_COUNT); + ICT_COUNT); }