compat-wireless: fix pr_fmt compile warnings
authorLuis R. Rodriguez <mcgrof@frijolero.org>
Tue, 3 Apr 2012 03:30:10 +0000 (20:30 -0700)
committerLuis R. Rodriguez <mcgrof@frijolero.org>
Tue, 3 Apr 2012 04:13:08 +0000 (21:13 -0700)
This took a while to figure out... Thought this was impossible
to fix, but the fix is quite simple: fix this upstream. The
assumption by drivers when upstream is that you should #define
pr_fmt *prior* to including <linux/printk.h> but -- the assumption
is incorrect given that if a subsystem includes printk.h for
anything that the subsystem needs then the module would be defining
the pr_fmt. The proper usage then for pr_fmt then is to always
undef it first, and also include <linux/printk.h>.

When test cross compiling against 2.6.24 - 3.3 I notice that including
<linux/kernel.h> also helps, so do this for now. There may be
another reason why that is required but we can figure that out later.

This patch should be broken down into chunks and submitted upstream.
This shaves off compilation time down from 1 hour to 1/2 hour!

mcgrof@flash ~/devel/compat-wireless (git::master)$ time ckmake
Trying kernel                     3.2.2-030202-generic  [OK]
Trying kernel                    3.1.10-030110-generic  [OK]
Trying kernel                    3.0.18-030018-generic  [OK]
Trying kernel                  2.6.39-02063904-generic  [OK]
Trying kernel                  2.6.38-02063808-generic  [OK]
Trying kernel                  2.6.37-02063706-generic  [OK]
Trying kernel                  2.6.36-02063604-generic  [OK]
Trying kernel                  2.6.35-02063512-generic  [OK]
Trying kernel                  2.6.34-02063410-generic  [OK]
Trying kernel                  2.6.33-02063305-generic  [OK]
Trying kernel                  2.6.32-02063255-generic  [OK]
Trying kernel                  2.6.31-02063113-generic  [OK]
Trying kernel                  2.6.30-02063010-generic  [OK]
Trying kernel                  2.6.29-02062906-generic  [OK]
Trying kernel                  2.6.28-02062810-generic  [OK]
Trying kernel                    2.6.27-020627-generic  [OK]
Trying kernel                    2.6.26-020626-generic  [OK]
Trying kernel                    2.6.25-020625-generic  [OK]
Trying kernel                    2.6.24-020624-generic  [OK]

real    29m17.269s
user    75m56.693s
sys     10m48.469s

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
patches/53-pr_fmt.patch [new file with mode: 0644]

diff --git a/patches/53-pr_fmt.patch b/patches/53-pr_fmt.patch
new file mode 100644 (file)
index 0000000..3a72707
--- /dev/null
@@ -0,0 +1,495 @@
+This is the correct way to use pr_fmt. This helps avoid
+compiler warnings. This is going to be sent upstream.
+
+--- a/drivers/bcma/bcma_private.h
++++ b/drivers/bcma/bcma_private.h
+@@ -1,10 +1,11 @@
+ #ifndef LINUX_BCMA_PRIVATE_H_
+ #define LINUX_BCMA_PRIVATE_H_
+-#ifndef pr_fmt
++#undef pr_fmt
+ #define pr_fmt(fmt)           KBUILD_MODNAME ": " fmt
+-#endif
++#include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/bcma/bcma.h>
+ #include <linux/delay.h>
+--- a/drivers/net/ethernet/broadcom/b44.c
++++ b/drivers/net/ethernet/broadcom/b44.c
+@@ -10,9 +10,11 @@
+  * Distribute under GPL.
+  */
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+ #include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/module.h>
+ #include <linux/moduleparam.h>
+ #include <linux/types.h>
+--- a/drivers/net/wireless/iwlegacy/3945-mac.c
++++ b/drivers/net/wireless/iwlegacy/3945-mac.c
+@@ -27,9 +27,11 @@
+  *
+  *****************************************************************************/
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+ #include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/module.h>
+ #include <linux/init.h>
+ #include <linux/pci.h>
+--- a/drivers/net/wireless/iwlegacy/4965-mac.c
++++ b/drivers/net/wireless/iwlegacy/4965-mac.c
+@@ -27,9 +27,11 @@
+  *
+  *****************************************************************************/
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+ #include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/module.h>
+ #include <linux/init.h>
+ #include <linux/pci.h>
+--- a/drivers/net/wireless/libertas/cfg.c
++++ b/drivers/net/wireless/libertas/cfg.c
+@@ -6,8 +6,11 @@
+  *
+  */
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
++#include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/hardirq.h>
+ #include <linux/sched.h>
+ #include <linux/wait.h>
+--- a/drivers/net/wireless/libertas/if_usb.c
++++ b/drivers/net/wireless/libertas/if_usb.c
+@@ -2,8 +2,11 @@
+  * This file contains functions used in USB interface module.
+  */
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
++#include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/delay.h>
+ #include <linux/module.h>
+ #include <linux/firmware.h>
+--- a/drivers/net/wireless/libertas/if_sdio.c
++++ b/drivers/net/wireless/libertas/if_sdio.c
+@@ -26,9 +26,11 @@
+  * if_sdio_card_to_host() to pad the data.
+  */
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+ #include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/module.h>
+ #include <linux/slab.h>
+ #include <linux/firmware.h>
+--- a/drivers/net/wireless/libertas/if_spi.c
++++ b/drivers/net/wireless/libertas/if_spi.c
+@@ -17,8 +17,11 @@
+  * (at your option) any later version.
+  */
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
++#include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/hardirq.h>
+ #include <linux/interrupt.h>
+ #include <linux/module.h>
+--- a/drivers/net/wireless/libertas/rx.c
++++ b/drivers/net/wireless/libertas/rx.c
+@@ -2,8 +2,11 @@
+  * This file contains the handling of RX in wlan driver.
+  */
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
++#include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/etherdevice.h>
+ #include <linux/hardirq.h>
+ #include <linux/slab.h>
+--- a/drivers/net/wireless/libertas/if_cs.c
++++ b/drivers/net/wireless/libertas/if_cs.c
+@@ -21,8 +21,11 @@
+ */
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
++#include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/module.h>
+ #include <linux/slab.h>
+ #include <linux/delay.h>
+--- a/drivers/net/wireless/libertas/mesh.c
++++ b/drivers/net/wireless/libertas/mesh.c
+@@ -1,5 +1,8 @@
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
++#include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/delay.h>
+ #include <linux/etherdevice.h>
+ #include <linux/hardirq.h>
+--- a/drivers/net/wireless/libertas/main.c
++++ b/drivers/net/wireless/libertas/main.c
+@@ -4,8 +4,11 @@
+  * thread etc..
+  */
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
++#include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/module.h>
+ #include <linux/delay.h>
+ #include <linux/etherdevice.h>
+--- a/drivers/net/wireless/libertas_tf/cmd.c
++++ b/drivers/net/wireless/libertas_tf/cmd.c
+@@ -7,8 +7,11 @@
+  *  the Free Software Foundation; either version 2 of the License, or (at
+  *  your option) any later version.
+  */
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
++#include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/hardirq.h>
+ #include <linux/slab.h>
+ #include <linux/export.h>
+--- a/drivers/net/wireless/libertas_tf/if_usb.c
++++ b/drivers/net/wireless/libertas_tf/if_usb.c
+@@ -9,11 +9,14 @@
+  */
+ #define DRV_NAME "lbtf_usb"
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+ #include "libertas_tf.h"
+ #include "if_usb.h"
++#include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/delay.h>
+ #include <linux/module.h>
+ #include <linux/firmware.h>
+--- a/drivers/net/wireless/libertas_tf/main.c
++++ b/drivers/net/wireless/libertas_tf/main.c
+@@ -7,8 +7,11 @@
+  *  the Free Software Foundation; either version 2 of the License, or (at
+  *  your option) any later version.
+  */
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
++#include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/hardirq.h>
+ #include <linux/slab.h>
+--- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c
++++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c
+@@ -14,9 +14,11 @@
+  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+ #include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/delay.h>
+ #include <linux/cordic.h>
+--- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
++++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
+@@ -15,8 +15,11 @@
+  */
+ #define __UNDEF_NO_VERSION__
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
++#include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/etherdevice.h>
+ #include <linux/sched.h>
+ #include <linux/firmware.h>
+--- a/drivers/net/wireless/brcm80211/brcmsmac/dma.c
++++ b/drivers/net/wireless/brcm80211/brcmsmac/dma.c
+@@ -13,9 +13,11 @@
+  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+-
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
++#include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/slab.h>
+ #include <linux/delay.h>
+ #include <linux/pci.h>
+--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
++++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
+@@ -14,8 +14,11 @@
+  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
++#include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/pci_ids.h>
+ #include <linux/if_ether.h>
+ #include <net/mac80211.h>
+--- a/drivers/net/wireless/brcm80211/brcmutil/utils.c
++++ b/drivers/net/wireless/brcm80211/brcmutil/utils.c
+@@ -14,8 +14,11 @@
+  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
++#include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/netdevice.h>
+ #include <linux/module.h>
+--- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c
++++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c
+@@ -14,8 +14,11 @@
+  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
++#include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/types.h>
+ #include <linux/netdevice.h>
+ #include <linux/mmc/sdio.h>
+--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c
++++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c
+@@ -19,8 +19,11 @@
+  * For certain dcmd codes, the dongle interprets string data from the host.
+  ******************************************************************************/
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
++#include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/types.h>
+ #include <linux/netdevice.h>
+ #include <linux/sched.h>
+--- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
++++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
+@@ -15,8 +15,11 @@
+  */
+ /* ****************** SDIO CARD Interface Functions **************************/
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
++#include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/types.h>
+ #include <linux/netdevice.h>
+ #include <linux/export.h>
+--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
++++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
+@@ -14,10 +14,12 @@
+  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+ #include <linux/init.h>
+ #include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/kthread.h>
+ #include <linux/slab.h>
+ #include <linux/skbuff.h>
+--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
++++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
+@@ -14,9 +14,11 @@
+  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+ #include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/string.h>
+ #include <linux/sched.h>
+ #include <linux/netdevice.h>
+--- a/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c
++++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c
+@@ -15,8 +15,11 @@
+  */
+ /* ***** SDIO interface chip backplane handle functions ***** */
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
++#include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/types.h>
+ #include <linux/netdevice.h>
+ #include <linux/mmc/card.h>
+--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
++++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
+@@ -16,9 +16,11 @@
+ /* Toplevel file. Relies on dhd_linux.c to send commands to the dongle. */
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+ #include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/if_arp.h>
+ #include <linux/sched.h>
+ #include <linux/kthread.h>
+--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
++++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
+@@ -14,6 +14,7 @@
+  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+ #include <linux/types.h>
+--- a/net/wireless/lib80211.c
++++ b/net/wireless/lib80211.c
+@@ -13,8 +13,11 @@
+  *
+  */
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
++#include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/module.h>
+ #include <linux/ctype.h>
+ #include <linux/ieee80211.h>
+--- a/net/wireless/reg.c
++++ b/net/wireless/reg.c
+@@ -42,9 +42,11 @@
+  *
+  */
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+ #include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/export.h>
+ #include <linux/slab.h>
+ #include <linux/list.h>
+--- a/net/wireless/core.c
++++ b/net/wireless/core.c
+@@ -4,8 +4,11 @@
+  * Copyright 2006-2010                Johannes Berg <johannes@sipsolutions.net>
+  */
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
++#include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/if.h>
+ #include <linux/module.h>
+ #include <linux/err.h>
+--- a/net/bluetooth/lib.c
++++ b/net/bluetooth/lib.c
+@@ -24,11 +24,13 @@
+ /* Bluetooth kernel library. */
++#undef pr_fmt
+ #define pr_fmt(fmt) "Bluetooth: " fmt
+ #include <linux/module.h>
+ #include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/stddef.h>
+ #include <linux/string.h>
+ #include <asm/errno.h>
+--- a/net/wireless/lib80211_crypt_tkip.c
++++ b/net/wireless/lib80211_crypt_tkip.c
+@@ -10,8 +10,11 @@
+  * more details.
+  */
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
++#include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/err.h>
+ #include <linux/module.h>
+ #include <linux/init.h>
+--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
++++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
+@@ -16,8 +16,11 @@
+  * File contents: support functions for PCI/PCIe
+  */
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
++#include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/delay.h>
+ #include <linux/pci.h>
+--- a/drivers/net/wireless/rtlwifi/wifi.h
++++ b/drivers/net/wireless/rtlwifi/wifi.h
+@@ -30,8 +30,11 @@
+ #ifndef __RTL_WIFI_H__
+ #define __RTL_WIFI_H__
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
++#include <linux/kernel.h>
++#include <linux/printk.h>
+ #include <linux/sched.h>
+ #include <linux/firmware.h>
+ #include <linux/etherdevice.h>