2011-08-04 18:53:17

by Larry Finger

[permalink] [raw]
Subject: [RFC] rtlwifi: Fix build failures due to raw port access

When rtlwifi is built for the sh4 architecture, build errors of the following
type occur. As these raw port accesses are specific to the X86 architecture,
their usage is restricted and dummy routines are substituted for all other
platforms.

v3.0/sh4/sh-allmodconfig v3.0/sh4/sh-allyesconfig
src/drivers/net/wireless/rtlwifi/rtl8192c/../pci.h:290: error: implicit declaration of function 'outl': 4 errors in 2 logs
v3.0/sh4/sh-allmodconfig v3.0/sh4/sh-allyesconfig
src/drivers/net/wireless/rtlwifi/rtl8192c/../pci.h:295: error: implicit declaration of function 'outb': 4 errors in 2 logs
v3.0/sh4/sh-allmodconfig v3.0/sh4/sh-allyesconfig
src/drivers/net/wireless/rtlwifi/rtl8192c/../pci.h:300: error: implicit declaration of function 'inb': 4 errors in 2 logs
v3.0/sh4/sh-allmodconfig v3.0/sh4/sh-allyesconfig
src/drivers/net/wireless/rtlwifi/rtl8192c/../pci.h:305: error: implicit declaration of function 'inw': 4 errors in 2 logs

Signed-off-by: Larry Finger <[email protected]>
---

Index: wireless-testing-new/drivers/net/wireless/rtlwifi/pci.h
===================================================================
--- wireless-testing-new.orig/drivers/net/wireless/rtlwifi/pci.h
+++ wireless-testing-new/drivers/net/wireless/rtlwifi/pci.h
@@ -273,6 +273,7 @@ static inline void pci_write32_async(str
writel(val, (u8 __iomem *) rtlpriv->io.pci_mem_start + addr);
}

+#ifdef CONFIG_X86
static inline void rtl_pci_raw_write_port_ulong(u32 port, u32 val)
{
outl(val, port);
@@ -288,14 +289,29 @@ static inline void rtl_pci_raw_read_port
*pval = inb(port);
}

-static inline void rtl_pci_raw_read_port_ushort(u32 port, u16 *pval)
+static inline void rtl_pci_raw_read_port_ulong(u32 port, u32 *pval)
+{
+ *pval = inl(port);
+}
+#else
+/* define dummy routines if not X86 architecture */
+static inline void rtl_pci_raw_write_port_ulong(u32 port, u32 val)
+{
+}
+
+static inline void rtl_pci_raw_write_port_uchar(u32 port, u8 val)
{
- *pval = inw(port);
+}
+
+static inline void rtl_pci_raw_read_port_uchar(u32 port, u8 *pval)
+{
+ *pval = 0;
}

static inline void rtl_pci_raw_read_port_ulong(u32 port, u32 *pval)
{
- *pval = inl(port);
+ *pval = 0;
}
+#endif /* ifdef CONFIG_X86 */

#endif


2011-08-04 19:03:34

by Felix Fietkau

[permalink] [raw]
Subject: Re: [RFC] rtlwifi: Fix build failures due to raw port access

On 2011-08-04 8:53 PM, Larry Finger wrote:
> When rtlwifi is built for the sh4 architecture, build errors of the following
> type occur. As these raw port accesses are specific to the X86 architecture,
> their usage is restricted and dummy routines are substituted for all other
> platforms.
By the way, even on x86 I'd recommend getting rid of this code. It seems
that ASPM handling is mostly sorted out in the kernel, so that kind of
hacks should no longer be necessary.

- Felix