Commit 4436761b authored by Steve Glendinning's avatar Steve Glendinning Committed by David S. Miller

smsc95xx: remove unnecessary variables

Removes unnecessary variables as smsc95xx_write_reg takes its
value by parameter.  Early versions passed this parameter by
reference.

Also replace hardcoded interrupt status value with a #define
Signed-off-by: default avatarSteve Glendinning <steve.glendinning@shawell.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cf2acec2
...@@ -460,12 +460,10 @@ static int smsc95xx_link_reset(struct usbnet *dev) ...@@ -460,12 +460,10 @@ static int smsc95xx_link_reset(struct usbnet *dev)
struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET }; struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET };
unsigned long flags; unsigned long flags;
u16 lcladv, rmtadv; u16 lcladv, rmtadv;
u32 intdata;
/* clear interrupt status */ /* clear interrupt status */
smsc95xx_mdio_read(dev->net, mii->phy_id, PHY_INT_SRC); smsc95xx_mdio_read(dev->net, mii->phy_id, PHY_INT_SRC);
intdata = 0xFFFFFFFF; smsc95xx_write_reg(dev, INT_STS, INT_STS_CLEAR_ALL_);
smsc95xx_write_reg(dev, INT_STS, intdata);
mii_check_media(mii, 1, 1); mii_check_media(mii, 1, 1);
mii_ethtool_gset(&dev->mii, &ecmd); mii_ethtool_gset(&dev->mii, &ecmd);
...@@ -677,7 +675,6 @@ static void smsc95xx_start_tx_path(struct usbnet *dev) ...@@ -677,7 +675,6 @@ static void smsc95xx_start_tx_path(struct usbnet *dev)
{ {
struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]); struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
unsigned long flags; unsigned long flags;
u32 reg_val;
/* Enable Tx at MAC */ /* Enable Tx at MAC */
spin_lock_irqsave(&pdata->mac_cr_lock, flags); spin_lock_irqsave(&pdata->mac_cr_lock, flags);
...@@ -687,8 +684,7 @@ static void smsc95xx_start_tx_path(struct usbnet *dev) ...@@ -687,8 +684,7 @@ static void smsc95xx_start_tx_path(struct usbnet *dev)
smsc95xx_write_reg(dev, MAC_CR, pdata->mac_cr); smsc95xx_write_reg(dev, MAC_CR, pdata->mac_cr);
/* Enable Tx at SCSRs */ /* Enable Tx at SCSRs */
reg_val = TX_CFG_ON_; smsc95xx_write_reg(dev, TX_CFG, TX_CFG_ON_);
smsc95xx_write_reg(dev, TX_CFG, reg_val);
} }
/* Starts the Receive path */ /* Starts the Receive path */
...@@ -753,8 +749,7 @@ static int smsc95xx_reset(struct usbnet *dev) ...@@ -753,8 +749,7 @@ static int smsc95xx_reset(struct usbnet *dev)
netif_dbg(dev, ifup, dev->net, "entering smsc95xx_reset\n"); netif_dbg(dev, ifup, dev->net, "entering smsc95xx_reset\n");
write_buf = HW_CFG_LRST_; ret = smsc95xx_write_reg(dev, HW_CFG, HW_CFG_LRST_);
ret = smsc95xx_write_reg(dev, HW_CFG, write_buf);
if (ret < 0) { if (ret < 0) {
netdev_warn(dev->net, "Failed to write HW_CFG_LRST_ bit in HW_CFG register, ret = %d\n", netdev_warn(dev->net, "Failed to write HW_CFG_LRST_ bit in HW_CFG register, ret = %d\n",
ret); ret);
...@@ -777,8 +772,7 @@ static int smsc95xx_reset(struct usbnet *dev) ...@@ -777,8 +772,7 @@ static int smsc95xx_reset(struct usbnet *dev)
return ret; return ret;
} }
write_buf = PM_CTL_PHY_RST_; ret = smsc95xx_write_reg(dev, PM_CTRL, PM_CTL_PHY_RST_);
ret = smsc95xx_write_reg(dev, PM_CTRL, write_buf);
if (ret < 0) { if (ret < 0) {
netdev_warn(dev->net, "Failed to write PM_CTRL: %d\n", ret); netdev_warn(dev->net, "Failed to write PM_CTRL: %d\n", ret);
return ret; return ret;
...@@ -863,8 +857,7 @@ static int smsc95xx_reset(struct usbnet *dev) ...@@ -863,8 +857,7 @@ static int smsc95xx_reset(struct usbnet *dev)
"Read Value from BURST_CAP after writing: 0x%08x\n", "Read Value from BURST_CAP after writing: 0x%08x\n",
read_buf); read_buf);
read_buf = DEFAULT_BULK_IN_DELAY; ret = smsc95xx_write_reg(dev, BULK_IN_DLY, DEFAULT_BULK_IN_DELAY);
ret = smsc95xx_write_reg(dev, BULK_IN_DLY, read_buf);
if (ret < 0) { if (ret < 0) {
netdev_warn(dev->net, "ret = %d\n", ret); netdev_warn(dev->net, "ret = %d\n", ret);
return ret; return ret;
...@@ -910,8 +903,7 @@ static int smsc95xx_reset(struct usbnet *dev) ...@@ -910,8 +903,7 @@ static int smsc95xx_reset(struct usbnet *dev)
netif_dbg(dev, ifup, dev->net, netif_dbg(dev, ifup, dev->net,
"Read Value from HW_CFG after writing: 0x%08x\n", read_buf); "Read Value from HW_CFG after writing: 0x%08x\n", read_buf);
write_buf = 0xFFFFFFFF; ret = smsc95xx_write_reg(dev, INT_STS, INT_STS_CLEAR_ALL_);
ret = smsc95xx_write_reg(dev, INT_STS, write_buf);
if (ret < 0) { if (ret < 0) {
netdev_warn(dev->net, "Failed to write INT_STS register, ret=%d\n", netdev_warn(dev->net, "Failed to write INT_STS register, ret=%d\n",
ret); ret);
...@@ -936,15 +928,13 @@ static int smsc95xx_reset(struct usbnet *dev) ...@@ -936,15 +928,13 @@ static int smsc95xx_reset(struct usbnet *dev)
} }
/* Init Tx */ /* Init Tx */
write_buf = 0; ret = smsc95xx_write_reg(dev, FLOW, 0);
ret = smsc95xx_write_reg(dev, FLOW, write_buf);
if (ret < 0) { if (ret < 0) {
netdev_warn(dev->net, "Failed to write FLOW: %d\n", ret); netdev_warn(dev->net, "Failed to write FLOW: %d\n", ret);
return ret; return ret;
} }
read_buf = AFC_CFG_DEFAULT; ret = smsc95xx_write_reg(dev, AFC_CFG, AFC_CFG_DEFAULT);
ret = smsc95xx_write_reg(dev, AFC_CFG, read_buf);
if (ret < 0) { if (ret < 0) {
netdev_warn(dev->net, "Failed to write AFC_CFG: %d\n", ret); netdev_warn(dev->net, "Failed to write AFC_CFG: %d\n", ret);
return ret; return ret;
...@@ -959,8 +949,7 @@ static int smsc95xx_reset(struct usbnet *dev) ...@@ -959,8 +949,7 @@ static int smsc95xx_reset(struct usbnet *dev)
/* Init Rx */ /* Init Rx */
/* Set Vlan */ /* Set Vlan */
write_buf = (u32)ETH_P_8021Q; ret = smsc95xx_write_reg(dev, VLAN1, (u32)ETH_P_8021Q);
ret = smsc95xx_write_reg(dev, VLAN1, write_buf);
if (ret < 0) { if (ret < 0) {
netdev_warn(dev->net, "Failed to write VAN1: %d\n", ret); netdev_warn(dev->net, "Failed to write VAN1: %d\n", ret);
return ret; return ret;
......
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
#define INT_STS_TDFO_ (0x00001000) #define INT_STS_TDFO_ (0x00001000)
#define INT_STS_RXDF_ (0x00000800) #define INT_STS_RXDF_ (0x00000800)
#define INT_STS_GPIOS_ (0x000007FF) #define INT_STS_GPIOS_ (0x000007FF)
#define INT_STS_CLEAR_ALL_ (0xFFFFFFFF)
#define RX_CFG (0x0C) #define RX_CFG (0x0C)
#define RX_FIFO_FLUSH_ (0x00000001) #define RX_FIFO_FLUSH_ (0x00000001)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment