From: Luis R. Rodriguez Date: Tue, 3 Apr 2012 03:30:10 +0000 (-0700) Subject: compat-wireless: fix pr_fmt compile warnings X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=3362c65c42220fa0458d0499262245dc3b59f430;p=openwrt%2Fstaging%2Fblogic.git compat-wireless: fix pr_fmt compile warnings 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 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 . When test cross compiling against 2.6.24 - 3.3 I notice that including 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 --- diff --git a/patches/53-pr_fmt.patch b/patches/53-pr_fmt.patch new file mode 100644 index 000000000000..3a72707662cd --- /dev/null +++ b/patches/53-pr_fmt.patch @@ -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 ++#include + #include + #include + +--- 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 ++#include + #include + #include + #include +--- 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 ++#include + #include + #include + #include +--- 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 ++#include + #include + #include + #include +--- 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 ++#include + #include + #include + #include +--- 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 ++#include + #include + #include + #include +--- 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 ++#include + #include + #include + #include +--- 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 ++#include + #include + #include + #include +--- 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 ++#include + #include + #include + #include +--- 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 ++#include + #include + #include + #include +--- 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 ++#include + #include + #include + #include +--- 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 ++#include + #include + #include + #include +--- 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 ++#include + #include + #include + #include +--- 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 ++#include + #include + #include + #include +--- 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 ++#include + #include + #include + +--- 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 ++#include + #include + #include + +--- 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 ++#include + #include + #include + #include +--- 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 ++#include + #include + #include + #include +--- 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 ++#include + #include + #include + #include +--- 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 ++#include + #include + #include + +--- 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 ++#include + #include + #include + #include +--- 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 ++#include + #include + #include + #include +--- 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 ++#include + #include + #include + #include +--- 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 + #include ++#include + #include + #include + #include +--- 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 ++#include + #include + #include + #include +--- 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 ++#include + #include + #include + #include +--- 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 ++#include + #include + #include + #include +--- 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 +--- 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 ++#include + #include + #include + #include +--- 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 ++#include + #include + #include + #include +--- a/net/wireless/core.c ++++ b/net/wireless/core.c +@@ -4,8 +4,11 @@ + * Copyright 2006-2010 Johannes Berg + */ + ++#undef pr_fmt + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + ++#include ++#include + #include + #include + #include +--- 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 + + #include ++#include + #include + #include + #include +--- 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 ++#include + #include + #include + #include +--- 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 ++#include + #include + #include + +--- 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 ++#include + #include + #include + #include