Use the macro parameter lp directly instead of relying on ioaddr being
defined in the surrounding scope.
Signed-off-by: Thorsten Blum <[email protected]>
Suggested-by: Andrew Lunn <[email protected]>
---
drivers/net/ethernet/smsc/smc91x.c | 24 +----
drivers/net/ethernet/smsc/smc91x.h | 152 ++++++++++++++---------------
2 files changed, 77 insertions(+), 99 deletions(-)
diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c
index 78ff3af7911a..2518953fe565 100644
--- a/drivers/net/ethernet/smsc/smc91x.c
+++ b/drivers/net/ethernet/smsc/smc91x.c
@@ -239,7 +239,6 @@ static inline void PRINT_PKT(u_char *buf, int length) { }
static void smc_reset(struct net_device *dev)
{
struct smc_local *lp = netdev_priv(dev);
- void __iomem *ioaddr = lp->base;
unsigned int ctl, cfg;
struct sk_buff *pending_skb;
@@ -333,7 +332,6 @@ static void smc_reset(struct net_device *dev)
static void smc_enable(struct net_device *dev)
{
struct smc_local *lp = netdev_priv(dev);
- void __iomem *ioaddr = lp->base;
int mask;
DBG(2, dev, "%s\n", __func__);
@@ -367,7 +365,6 @@ static void smc_enable(struct net_device *dev)
static void smc_shutdown(struct net_device *dev)
{
struct smc_local *lp = netdev_priv(dev);
- void __iomem *ioaddr = lp->base;
struct sk_buff *pending_skb;
DBG(2, dev, "%s: %s\n", CARDNAME, __func__);
@@ -399,7 +396,6 @@ static void smc_shutdown(struct net_device *dev)
static inline void smc_rcv(struct net_device *dev)
{
struct smc_local *lp = netdev_priv(dev);
- void __iomem *ioaddr = lp->base;
unsigned int packet_number, status, packet_len;
DBG(3, dev, "%s\n", __func__);
@@ -540,7 +536,6 @@ static void smc_hardware_send_pkt(struct tasklet_struct *t)
{
struct smc_local *lp = from_tasklet(lp, t, tx_task);
struct net_device *dev = lp->dev;
- void __iomem *ioaddr = lp->base;
struct sk_buff *skb;
unsigned int packet_no, len;
unsigned char *buf;
@@ -590,7 +585,7 @@ static void smc_hardware_send_pkt(struct tasklet_struct *t)
SMC_PUSH_DATA(lp, buf, len & ~1);
/* Send final ctl word with the last byte if there is one */
- SMC_outw(lp, ((len & 1) ? (0x2000 | buf[len - 1]) : 0), ioaddr,
+ SMC_outw(lp, ((len & 1) ? (0x2000 | buf[len - 1]) : 0), lp->base,
DATA_REG(lp));
/*
@@ -630,7 +625,6 @@ static netdev_tx_t
smc_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct smc_local *lp = netdev_priv(dev);
- void __iomem *ioaddr = lp->base;
unsigned int numPages, poll_count, status;
unsigned long flags;
@@ -703,7 +697,6 @@ smc_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
static void smc_tx(struct net_device *dev)
{
struct smc_local *lp = netdev_priv(dev);
- void __iomem *ioaddr = lp->base;
unsigned int saved_packet, packet_no, tx_status;
unsigned int pkt_len __always_unused;
@@ -762,7 +755,6 @@ static void smc_tx(struct net_device *dev)
static void smc_mii_out(struct net_device *dev, unsigned int val, int bits)
{
struct smc_local *lp = netdev_priv(dev);
- void __iomem *ioaddr = lp->base;
unsigned int mii_reg, mask;
mii_reg = SMC_GET_MII(lp) & ~(MII_MCLK | MII_MDOE | MII_MDO);
@@ -784,7 +776,6 @@ static void smc_mii_out(struct net_device *dev, unsigned int val, int bits)
static unsigned int smc_mii_in(struct net_device *dev, int bits)
{
struct smc_local *lp = netdev_priv(dev);
- void __iomem *ioaddr = lp->base;
unsigned int mii_reg, mask, val;
mii_reg = SMC_GET_MII(lp) & ~(MII_MCLK | MII_MDOE | MII_MDO);
@@ -809,7 +800,6 @@ static unsigned int smc_mii_in(struct net_device *dev, int bits)
static int smc_phy_read(struct net_device *dev, int phyaddr, int phyreg)
{
struct smc_local *lp = netdev_priv(dev);
- void __iomem *ioaddr = lp->base;
unsigned int phydata;
SMC_SELECT_BANK(lp, 3);
@@ -840,7 +830,6 @@ static void smc_phy_write(struct net_device *dev, int phyaddr, int phyreg,
int phydata)
{
struct smc_local *lp = netdev_priv(dev);
- void __iomem *ioaddr = lp->base;
SMC_SELECT_BANK(lp, 3);
@@ -902,7 +891,6 @@ static void smc_phy_detect(struct net_device *dev)
static int smc_phy_fixed(struct net_device *dev)
{
struct smc_local *lp = netdev_priv(dev);
- void __iomem *ioaddr = lp->base;
int phyaddr = lp->mii.phy_id;
int bmcr, cfg1;
@@ -1005,7 +993,6 @@ static void smc_phy_powerdown(struct net_device *dev)
static void smc_phy_check_media(struct net_device *dev, int init)
{
struct smc_local *lp = netdev_priv(dev);
- void __iomem *ioaddr = lp->base;
if (mii_check_media(&lp->mii, netif_msg_link(lp), init)) {
/* duplex state has changed */
@@ -1034,7 +1021,6 @@ static void smc_phy_configure(struct work_struct *work)
struct smc_local *lp =
container_of(work, struct smc_local, phy_configure);
struct net_device *dev = lp->dev;
- void __iomem *ioaddr = lp->base;
int phyaddr = lp->mii.phy_id;
int my_phy_caps; /* My PHY capabilities */
int my_ad_caps; /* My Advertised capabilities */
@@ -1158,7 +1144,6 @@ static void smc_phy_interrupt(struct net_device *dev)
static void smc_10bt_check_media(struct net_device *dev, int init)
{
struct smc_local *lp = netdev_priv(dev);
- void __iomem *ioaddr = lp->base;
unsigned int old_carrier, new_carrier;
old_carrier = netif_carrier_ok(dev) ? 1 : 0;
@@ -1182,7 +1167,6 @@ static void smc_10bt_check_media(struct net_device *dev, int init)
static void smc_eph_interrupt(struct net_device *dev)
{
struct smc_local *lp = netdev_priv(dev);
- void __iomem *ioaddr = lp->base;
unsigned int ctl;
smc_10bt_check_media(dev, 0);
@@ -1202,7 +1186,6 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id)
{
struct net_device *dev = dev_id;
struct smc_local *lp = netdev_priv(dev);
- void __iomem *ioaddr = lp->base;
int status, mask, timeout, card_stats;
int saved_pointer;
@@ -1325,7 +1308,6 @@ static void smc_poll_controller(struct net_device *dev)
static void smc_timeout(struct net_device *dev, unsigned int txqueue)
{
struct smc_local *lp = netdev_priv(dev);
- void __iomem *ioaddr = lp->base;
int status, mask, eph_st, meminfo, fifo;
DBG(2, dev, "%s\n", __func__);
@@ -1367,7 +1349,6 @@ static void smc_timeout(struct net_device *dev, unsigned int txqueue)
static void smc_set_multicast_list(struct net_device *dev)
{
struct smc_local *lp = netdev_priv(dev);
- void __iomem *ioaddr = lp->base;
unsigned char multicast_table[8];
int update_multicast = 0;
@@ -1625,7 +1606,6 @@ static int smc_write_eeprom_word(struct net_device *dev, u16 addr, u16 word)
{
u16 ctl;
struct smc_local *lp = netdev_priv(dev);
- void __iomem *ioaddr = lp->base;
spin_lock_irq(&lp->lock);
/* load word into GP register */
@@ -1653,7 +1633,6 @@ static int smc_read_eeprom_word(struct net_device *dev, u16 addr, u16 *word)
{
u16 ctl;
struct smc_local *lp = netdev_priv(dev);
- void __iomem *ioaddr = lp->base;
spin_lock_irq(&lp->lock);
/* set the EEPROM address to get the data from */
@@ -1773,7 +1752,6 @@ static const struct net_device_ops smc_netdev_ops = {
*/
static int smc_findirq(struct smc_local *lp)
{
- void __iomem *ioaddr = lp->base;
int timeout = 20;
unsigned long cookie;
diff --git a/drivers/net/ethernet/smsc/smc91x.h b/drivers/net/ethernet/smsc/smc91x.h
index 38aa4374e813..2be9ea33a36c 100644
--- a/drivers/net/ethernet/smsc/smc91x.h
+++ b/drivers/net/ethernet/smsc/smc91x.h
@@ -839,190 +839,190 @@ static const char * chip_ids[ 16 ] = {
#define SMC_MUST_ALIGN_WRITE(lp) SMC_32BIT(lp)
#define SMC_GET_PN(lp) \
- (SMC_8BIT(lp) ? (SMC_inb(ioaddr, PN_REG(lp))) \
- : (SMC_inw(ioaddr, PN_REG(lp)) & 0xFF))
+ (SMC_8BIT(lp) ? (SMC_inb(lp->base, PN_REG(lp))) \
+ : (SMC_inw(lp->base, PN_REG(lp)) & 0xFF))
#define SMC_SET_PN(lp, x) \
do { \
if (SMC_MUST_ALIGN_WRITE(lp)) \
- SMC_outl((x)<<16, ioaddr, SMC_REG(lp, 0, 2)); \
+ SMC_outl((x)<<16, lp->base, SMC_REG(lp, 0, 2)); \
else if (SMC_8BIT(lp)) \
- SMC_outb(x, ioaddr, PN_REG(lp)); \
+ SMC_outb(x, lp->base, PN_REG(lp)); \
else \
- SMC_outw(lp, x, ioaddr, PN_REG(lp)); \
+ SMC_outw(lp, x, lp->base, PN_REG(lp)); \
} while (0)
#define SMC_GET_AR(lp) \
- (SMC_8BIT(lp) ? (SMC_inb(ioaddr, AR_REG(lp))) \
- : (SMC_inw(ioaddr, PN_REG(lp)) >> 8))
+ (SMC_8BIT(lp) ? (SMC_inb(lp->base, AR_REG(lp))) \
+ : (SMC_inw(lp->base, PN_REG(lp)) >> 8))
#define SMC_GET_TXFIFO(lp) \
- (SMC_8BIT(lp) ? (SMC_inb(ioaddr, TXFIFO_REG(lp))) \
- : (SMC_inw(ioaddr, TXFIFO_REG(lp)) & 0xFF))
+ (SMC_8BIT(lp) ? (SMC_inb(lp->base, TXFIFO_REG(lp))) \
+ : (SMC_inw(lp->base, TXFIFO_REG(lp)) & 0xFF))
#define SMC_GET_RXFIFO(lp) \
- (SMC_8BIT(lp) ? (SMC_inb(ioaddr, RXFIFO_REG(lp))) \
- : (SMC_inw(ioaddr, TXFIFO_REG(lp)) >> 8))
+ (SMC_8BIT(lp) ? (SMC_inb(lp->base, RXFIFO_REG(lp))) \
+ : (SMC_inw(lp->base, TXFIFO_REG(lp)) >> 8))
#define SMC_GET_INT(lp) \
- (SMC_8BIT(lp) ? (SMC_inb(ioaddr, INT_REG(lp))) \
- : (SMC_inw(ioaddr, INT_REG(lp)) & 0xFF))
+ (SMC_8BIT(lp) ? (SMC_inb(lp->base, INT_REG(lp))) \
+ : (SMC_inw(lp->base, INT_REG(lp)) & 0xFF))
#define SMC_ACK_INT(lp, x) \
do { \
if (SMC_8BIT(lp)) \
- SMC_outb(x, ioaddr, INT_REG(lp)); \
+ SMC_outb(x, lp->base, INT_REG(lp)); \
else { \
unsigned long __flags; \
int __mask; \
local_irq_save(__flags); \
- __mask = SMC_inw(ioaddr, INT_REG(lp)) & ~0xff; \
- SMC_outw(lp, __mask | (x), ioaddr, INT_REG(lp)); \
+ __mask = SMC_inw(lp->base, INT_REG(lp)) & ~0xff; \
+ SMC_outw(lp, __mask | (x), lp->base, INT_REG(lp)); \
local_irq_restore(__flags); \
} \
} while (0)
#define SMC_GET_INT_MASK(lp) \
- (SMC_8BIT(lp) ? (SMC_inb(ioaddr, IM_REG(lp))) \
- : (SMC_inw(ioaddr, INT_REG(lp)) >> 8))
+ (SMC_8BIT(lp) ? (SMC_inb(lp->base, IM_REG(lp))) \
+ : (SMC_inw(lp->base, INT_REG(lp)) >> 8))
#define SMC_SET_INT_MASK(lp, x) \
do { \
if (SMC_8BIT(lp)) \
- SMC_outb(x, ioaddr, IM_REG(lp)); \
+ SMC_outb(x, lp->base, IM_REG(lp)); \
else \
- SMC_outw(lp, (x) << 8, ioaddr, INT_REG(lp)); \
+ SMC_outw(lp, (x) << 8, lp->base, INT_REG(lp)); \
} while (0)
-#define SMC_CURRENT_BANK(lp) SMC_inw(ioaddr, BANK_SELECT)
+#define SMC_CURRENT_BANK(lp) SMC_inw(lp->base, BANK_SELECT)
#define SMC_SELECT_BANK(lp, x) \
do { \
if (SMC_MUST_ALIGN_WRITE(lp)) \
- SMC_outl((x)<<16, ioaddr, 12<<SMC_IO_SHIFT); \
+ SMC_outl((x)<<16, lp->base, 12<<SMC_IO_SHIFT); \
else \
- SMC_outw(lp, x, ioaddr, BANK_SELECT); \
+ SMC_outw(lp, x, lp->base, BANK_SELECT); \
} while (0)
-#define SMC_GET_BASE(lp) SMC_inw(ioaddr, BASE_REG(lp))
+#define SMC_GET_BASE(lp) SMC_inw(lp->base, BASE_REG(lp))
-#define SMC_SET_BASE(lp, x) SMC_outw(lp, x, ioaddr, BASE_REG(lp))
+#define SMC_SET_BASE(lp, x) SMC_outw(lp, x, lp->base, BASE_REG(lp))
-#define SMC_GET_CONFIG(lp) SMC_inw(ioaddr, CONFIG_REG(lp))
+#define SMC_GET_CONFIG(lp) SMC_inw(lp->base, CONFIG_REG(lp))
-#define SMC_SET_CONFIG(lp, x) SMC_outw(lp, x, ioaddr, CONFIG_REG(lp))
+#define SMC_SET_CONFIG(lp, x) SMC_outw(lp, x, lp->base, CONFIG_REG(lp))
-#define SMC_GET_COUNTER(lp) SMC_inw(ioaddr, COUNTER_REG(lp))
+#define SMC_GET_COUNTER(lp) SMC_inw(lp->base, COUNTER_REG(lp))
-#define SMC_GET_CTL(lp) SMC_inw(ioaddr, CTL_REG(lp))
+#define SMC_GET_CTL(lp) SMC_inw(lp->base, CTL_REG(lp))
-#define SMC_SET_CTL(lp, x) SMC_outw(lp, x, ioaddr, CTL_REG(lp))
+#define SMC_SET_CTL(lp, x) SMC_outw(lp, x, lp->base, CTL_REG(lp))
-#define SMC_GET_MII(lp) SMC_inw(ioaddr, MII_REG(lp))
+#define SMC_GET_MII(lp) SMC_inw(lp->base, MII_REG(lp))
-#define SMC_GET_GP(lp) SMC_inw(ioaddr, GP_REG(lp))
+#define SMC_GET_GP(lp) SMC_inw(lp->base, GP_REG(lp))
#define SMC_SET_GP(lp, x) \
do { \
if (SMC_MUST_ALIGN_WRITE(lp)) \
- SMC_outl((x)<<16, ioaddr, SMC_REG(lp, 8, 1)); \
+ SMC_outl((x)<<16, lp->base, SMC_REG(lp, 8, 1)); \
else \
- SMC_outw(lp, x, ioaddr, GP_REG(lp)); \
+ SMC_outw(lp, x, lp->base, GP_REG(lp)); \
} while (0)
-#define SMC_SET_MII(lp, x) SMC_outw(lp, x, ioaddr, MII_REG(lp))
+#define SMC_SET_MII(lp, x) SMC_outw(lp, x, lp->base, MII_REG(lp))
-#define SMC_GET_MIR(lp) SMC_inw(ioaddr, MIR_REG(lp))
+#define SMC_GET_MIR(lp) SMC_inw(lp->base, MIR_REG(lp))
-#define SMC_SET_MIR(lp, x) SMC_outw(lp, x, ioaddr, MIR_REG(lp))
+#define SMC_SET_MIR(lp, x) SMC_outw(lp, x, lp->base, MIR_REG(lp))
-#define SMC_GET_MMU_CMD(lp) SMC_inw(ioaddr, MMU_CMD_REG(lp))
+#define SMC_GET_MMU_CMD(lp) SMC_inw(lp->base, MMU_CMD_REG(lp))
-#define SMC_SET_MMU_CMD(lp, x) SMC_outw(lp, x, ioaddr, MMU_CMD_REG(lp))
+#define SMC_SET_MMU_CMD(lp, x) SMC_outw(lp, x, lp->base, MMU_CMD_REG(lp))
-#define SMC_GET_FIFO(lp) SMC_inw(ioaddr, FIFO_REG(lp))
+#define SMC_GET_FIFO(lp) SMC_inw(lp->base, FIFO_REG(lp))
-#define SMC_GET_PTR(lp) SMC_inw(ioaddr, PTR_REG(lp))
+#define SMC_GET_PTR(lp) SMC_inw(lp->base, PTR_REG(lp))
#define SMC_SET_PTR(lp, x) \
do { \
if (SMC_MUST_ALIGN_WRITE(lp)) \
- SMC_outl((x)<<16, ioaddr, SMC_REG(lp, 4, 2)); \
+ SMC_outl((x)<<16, lp->base, SMC_REG(lp, 4, 2)); \
else \
- SMC_outw(lp, x, ioaddr, PTR_REG(lp)); \
+ SMC_outw(lp, x, lp->base, PTR_REG(lp)); \
} while (0)
-#define SMC_GET_EPH_STATUS(lp) SMC_inw(ioaddr, EPH_STATUS_REG(lp))
+#define SMC_GET_EPH_STATUS(lp) SMC_inw(lp->base, EPH_STATUS_REG(lp))
-#define SMC_GET_RCR(lp) SMC_inw(ioaddr, RCR_REG(lp))
+#define SMC_GET_RCR(lp) SMC_inw(lp->base, RCR_REG(lp))
-#define SMC_SET_RCR(lp, x) SMC_outw(lp, x, ioaddr, RCR_REG(lp))
+#define SMC_SET_RCR(lp, x) SMC_outw(lp, x, lp->base, RCR_REG(lp))
-#define SMC_GET_REV(lp) SMC_inw(ioaddr, REV_REG(lp))
+#define SMC_GET_REV(lp) SMC_inw(lp->base, REV_REG(lp))
-#define SMC_GET_RPC(lp) SMC_inw(ioaddr, RPC_REG(lp))
+#define SMC_GET_RPC(lp) SMC_inw(lp->base, RPC_REG(lp))
#define SMC_SET_RPC(lp, x) \
do { \
if (SMC_MUST_ALIGN_WRITE(lp)) \
- SMC_outl((x)<<16, ioaddr, SMC_REG(lp, 8, 0)); \
+ SMC_outl((x)<<16, lp->base, SMC_REG(lp, 8, 0)); \
else \
- SMC_outw(lp, x, ioaddr, RPC_REG(lp)); \
+ SMC_outw(lp, x, lp->base, RPC_REG(lp)); \
} while (0)
-#define SMC_GET_TCR(lp) SMC_inw(ioaddr, TCR_REG(lp))
+#define SMC_GET_TCR(lp) SMC_inw(lp->base, TCR_REG(lp))
-#define SMC_SET_TCR(lp, x) SMC_outw(lp, x, ioaddr, TCR_REG(lp))
+#define SMC_SET_TCR(lp, x) SMC_outw(lp, x, lp->base, TCR_REG(lp))
#ifndef SMC_GET_MAC_ADDR
#define SMC_GET_MAC_ADDR(lp, addr) \
do { \
unsigned int __v; \
- __v = SMC_inw(ioaddr, ADDR0_REG(lp)); \
+ __v = SMC_inw(lp->base, ADDR0_REG(lp)); \
addr[0] = __v; addr[1] = __v >> 8; \
- __v = SMC_inw(ioaddr, ADDR1_REG(lp)); \
+ __v = SMC_inw(lp->base, ADDR1_REG(lp)); \
addr[2] = __v; addr[3] = __v >> 8; \
- __v = SMC_inw(ioaddr, ADDR2_REG(lp)); \
+ __v = SMC_inw(lp->base, ADDR2_REG(lp)); \
addr[4] = __v; addr[5] = __v >> 8; \
} while (0)
#endif
#define SMC_SET_MAC_ADDR(lp, addr) \
do { \
- SMC_outw(lp, addr[0] | (addr[1] << 8), ioaddr, ADDR0_REG(lp)); \
- SMC_outw(lp, addr[2] | (addr[3] << 8), ioaddr, ADDR1_REG(lp)); \
- SMC_outw(lp, addr[4] | (addr[5] << 8), ioaddr, ADDR2_REG(lp)); \
+ SMC_outw(lp, addr[0] | (addr[1] << 8), lp->base, ADDR0_REG(lp)); \
+ SMC_outw(lp, addr[2] | (addr[3] << 8), lp->base, ADDR1_REG(lp)); \
+ SMC_outw(lp, addr[4] | (addr[5] << 8), lp->base, ADDR2_REG(lp)); \
} while (0)
#define SMC_SET_MCAST(lp, x) \
do { \
const unsigned char *mt = (x); \
- SMC_outw(lp, mt[0] | (mt[1] << 8), ioaddr, MCAST_REG1(lp)); \
- SMC_outw(lp, mt[2] | (mt[3] << 8), ioaddr, MCAST_REG2(lp)); \
- SMC_outw(lp, mt[4] | (mt[5] << 8), ioaddr, MCAST_REG3(lp)); \
- SMC_outw(lp, mt[6] | (mt[7] << 8), ioaddr, MCAST_REG4(lp)); \
+ SMC_outw(lp, mt[0] | (mt[1] << 8), lp->base, MCAST_REG1(lp)); \
+ SMC_outw(lp, mt[2] | (mt[3] << 8), lp->base, MCAST_REG2(lp)); \
+ SMC_outw(lp, mt[4] | (mt[5] << 8), lp->base, MCAST_REG3(lp)); \
+ SMC_outw(lp, mt[6] | (mt[7] << 8), lp->base, MCAST_REG4(lp)); \
} while (0)
#define SMC_PUT_PKT_HDR(lp, status, length) \
do { \
if (SMC_32BIT(lp)) \
- SMC_outl((status) | (length)<<16, ioaddr, \
+ SMC_outl((status) | (length)<<16, lp->base, \
DATA_REG(lp)); \
else { \
- SMC_outw(lp, status, ioaddr, DATA_REG(lp)); \
- SMC_outw(lp, length, ioaddr, DATA_REG(lp)); \
+ SMC_outw(lp, status, lp->base, DATA_REG(lp)); \
+ SMC_outw(lp, length, lp->base, DATA_REG(lp)); \
} \
} while (0)
#define SMC_GET_PKT_HDR(lp, status, length) \
do { \
if (SMC_32BIT(lp)) { \
- unsigned int __val = SMC_inl(ioaddr, DATA_REG(lp)); \
+ unsigned int __val = SMC_inl(lp->base, DATA_REG(lp)); \
(status) = __val & 0xffff; \
(length) = __val >> 16; \
} else { \
- (status) = SMC_inw(ioaddr, DATA_REG(lp)); \
- (length) = SMC_inw(ioaddr, DATA_REG(lp)); \
+ (status) = SMC_inw(lp->base, DATA_REG(lp)); \
+ (length) = SMC_inw(lp->base, DATA_REG(lp)); \
} \
} while (0)
@@ -1031,10 +1031,10 @@ static const char * chip_ids[ 16 ] = {
if (SMC_32BIT(lp)) { \
void *__ptr = (p); \
int __len = (l); \
- void __iomem *__ioaddr = ioaddr; \
+ void __iomem *__ioaddr = lp->base; \
if (__len >= 2 && (unsigned long)__ptr & 2) { \
__len -= 2; \
- SMC_outsw(ioaddr, DATA_REG(lp), __ptr, 1); \
+ SMC_outsw(lp->base, DATA_REG(lp), __ptr, 1); \
__ptr += 2; \
} \
if (SMC_CAN_USE_DATACS && lp->datacs) \
@@ -1042,12 +1042,12 @@ static const char * chip_ids[ 16 ] = {
SMC_outsl(__ioaddr, DATA_REG(lp), __ptr, __len>>2); \
if (__len & 2) { \
__ptr += (__len & ~3); \
- SMC_outsw(ioaddr, DATA_REG(lp), __ptr, 1); \
+ SMC_outsw(lp->base, DATA_REG(lp), __ptr, 1); \
} \
} else if (SMC_16BIT(lp)) \
- SMC_outsw(ioaddr, DATA_REG(lp), p, (l) >> 1); \
+ SMC_outsw(lp->base, DATA_REG(lp), p, (l) >> 1); \
else if (SMC_8BIT(lp)) \
- SMC_outsb(ioaddr, DATA_REG(lp), p, l); \
+ SMC_outsb(lp->base, DATA_REG(lp), p, l); \
} while (0)
#define SMC_PULL_DATA(lp, p, l) \
@@ -1055,7 +1055,7 @@ static const char * chip_ids[ 16 ] = {
if (SMC_32BIT(lp)) { \
void *__ptr = (p); \
int __len = (l); \
- void __iomem *__ioaddr = ioaddr; \
+ void __iomem *__ioaddr = lp->base; \
if ((unsigned long)__ptr & 2) { \
/* \
* We want 32bit alignment here. \
@@ -1080,9 +1080,9 @@ static const char * chip_ids[ 16 ] = {
__len += 2; \
SMC_insl(__ioaddr, DATA_REG(lp), __ptr, __len>>2); \
} else if (SMC_16BIT(lp)) \
- SMC_insw(ioaddr, DATA_REG(lp), p, (l) >> 1); \
+ SMC_insw(lp->base, DATA_REG(lp), p, (l) >> 1); \
else if (SMC_8BIT(lp)) \
- SMC_insb(ioaddr, DATA_REG(lp), p, l); \
+ SMC_insb(lp->base, DATA_REG(lp), p, l); \
} while (0)
#endif /* _SMC91X_H_ */
--
2.45.1
On Tue, May 28, 2024 at 12:44:23PM +0200, Thorsten Blum wrote:
> Use the macro parameter lp directly instead of relying on ioaddr being
> defined in the surrounding scope.
>
> Signed-off-by: Thorsten Blum <[email protected]>
> Suggested-by: Andrew Lunn <[email protected]>
Reviewed-by: Andrew Lunn <[email protected]>
Andrew
On Tue, 28 May 2024 12:44:23 +0200 Thorsten Blum wrote:
> Use the macro parameter lp directly instead of relying on ioaddr being
> defined in the surrounding scope.
Have you tested this, or just compile tested (please mention what
testing has been done in the commit message in the future)?
What's the motivation - cleanup or this helps remove some warnings?
(again, please mention in the commit message)
AFAICT this will break smc_probe().
--
pw-bot: cr
On 30. May 2024, at 02:17, Jakub Kicinski <[email protected]> wrote:
> On Tue, 28 May 2024 12:44:23 +0200 Thorsten Blum wrote:
>> Use the macro parameter lp directly instead of relying on ioaddr being
>> defined in the surrounding scope.
>
> Have you tested this, or just compile tested (please mention what
> testing has been done in the commit message in the future)?
Just compile tested.
> What's the motivation - cleanup or this helps remove some warnings?
> (again, please mention in the commit message)
It's a cleanup suggested by Andrew Lunn [1][2]. His suggestion might
have been for SMC_PUSH_DATA() and SMC_PULL_DATA() only; or to add
another macro param for ioaddr if lp->base and ioaddr are different (as
in smc_probe()).
> AFAICT this will break smc_probe().
Yes, it does break smc_probe(). I'll fix it and submit a v2.
Thanks,
Thorsten
[1] https://lore.kernel.org/linux-kernel/[email protected]/
[2] https://lore.kernel.org/linux-kernel/[email protected]/