diff options
author | Timur Tabi <timur@codeaurora.org> | 2017-01-20 18:21:04 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-01-23 13:03:28 -0500 |
commit | 4404323c6ac256c2a11d86fda65fbdb7d198ff8c (patch) | |
tree | cfe7c2cd98fd0cfc4212b631577216c9700fb045 | |
parent | 41c1093f2e1a33f4bf38848b4b1526903c5052bb (diff) |
net: qcom/emac: claim the irq only when the device is opened
During reset, functions emac_mac_down() and emac_mac_up() are called,
so we don't want to free and claim the IRQ unnecessarily. Move those
operations to open/close.
Signed-off-by: Timur Tabi <timur@codeaurora.org>
Reviewed-by: Lino Sanfilippo <LinoSanfilippo@gmx.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/qualcomm/emac/emac-mac.c | 13 | ||||
-rw-r--r-- | drivers/net/ethernet/qualcomm/emac/emac.c | 11 | ||||
-rw-r--r-- | drivers/net/ethernet/qualcomm/emac/emac.h | 1 |
3 files changed, 11 insertions, 14 deletions
diff --git a/drivers/net/ethernet/qualcomm/emac/emac-mac.c b/drivers/net/ethernet/qualcomm/emac/emac-mac.c index 98570eb6ef1a..e4793d703ed9 100644 --- a/drivers/net/ethernet/qualcomm/emac/emac-mac.c +++ b/drivers/net/ethernet/qualcomm/emac/emac-mac.c | |||
@@ -314,8 +314,6 @@ struct emac_skb_cb { | |||
314 | RX_PKT_INT2 |\ | 314 | RX_PKT_INT2 |\ |
315 | RX_PKT_INT3) | 315 | RX_PKT_INT3) |
316 | 316 | ||
317 | #define EMAC_MAC_IRQ_RES "core0" | ||
318 | |||
319 | void emac_mac_multicast_addr_set(struct emac_adapter *adpt, u8 *addr) | 317 | void emac_mac_multicast_addr_set(struct emac_adapter *adpt, u8 *addr) |
320 | { | 318 | { |
321 | u32 crc32, bit, reg, mta; | 319 | u32 crc32, bit, reg, mta; |
@@ -977,26 +975,16 @@ static void emac_adjust_link(struct net_device *netdev) | |||
977 | int emac_mac_up(struct emac_adapter *adpt) | 975 | int emac_mac_up(struct emac_adapter *adpt) |
978 | { | 976 | { |
979 | struct net_device *netdev = adpt->netdev; | 977 | struct net_device *netdev = adpt->netdev; |
980 | struct emac_irq *irq = &adpt->irq; | ||
981 | int ret; | 978 | int ret; |
982 | 979 | ||
983 | emac_mac_rx_tx_ring_reset_all(adpt); | 980 | emac_mac_rx_tx_ring_reset_all(adpt); |
984 | emac_mac_config(adpt); | 981 | emac_mac_config(adpt); |
985 | |||
986 | ret = request_irq(irq->irq, emac_isr, 0, EMAC_MAC_IRQ_RES, irq); | ||
987 | if (ret) { | ||
988 | netdev_err(adpt->netdev, "could not request %s irq\n", | ||
989 | EMAC_MAC_IRQ_RES); | ||
990 | return ret; | ||
991 | } | ||
992 | |||
993 | emac_mac_rx_descs_refill(adpt, &adpt->rx_q); | 982 | emac_mac_rx_descs_refill(adpt, &adpt->rx_q); |
994 | 983 | ||
995 | ret = phy_connect_direct(netdev, adpt->phydev, emac_adjust_link, | 984 | ret = phy_connect_direct(netdev, adpt->phydev, emac_adjust_link, |
996 | PHY_INTERFACE_MODE_SGMII); | 985 | PHY_INTERFACE_MODE_SGMII); |
997 | if (ret) { | 986 | if (ret) { |
998 | netdev_err(adpt->netdev, "could not connect phy\n"); | 987 | netdev_err(adpt->netdev, "could not connect phy\n"); |
999 | free_irq(irq->irq, irq); | ||
1000 | return ret; | 988 | return ret; |
1001 | } | 989 | } |
1002 | 990 | ||
@@ -1030,7 +1018,6 @@ void emac_mac_down(struct emac_adapter *adpt) | |||
1030 | writel(DIS_INT, adpt->base + EMAC_INT_STATUS); | 1018 | writel(DIS_INT, adpt->base + EMAC_INT_STATUS); |
1031 | writel(0, adpt->base + EMAC_INT_MASK); | 1019 | writel(0, adpt->base + EMAC_INT_MASK); |
1032 | synchronize_irq(adpt->irq.irq); | 1020 | synchronize_irq(adpt->irq.irq); |
1033 | free_irq(adpt->irq.irq, &adpt->irq); | ||
1034 | 1021 | ||
1035 | phy_disconnect(adpt->phydev); | 1022 | phy_disconnect(adpt->phydev); |
1036 | 1023 | ||
diff --git a/drivers/net/ethernet/qualcomm/emac/emac.c b/drivers/net/ethernet/qualcomm/emac/emac.c index b74ec7fba0e0..3e1be9107d55 100644 --- a/drivers/net/ethernet/qualcomm/emac/emac.c +++ b/drivers/net/ethernet/qualcomm/emac/emac.c | |||
@@ -256,18 +256,27 @@ static int emac_change_mtu(struct net_device *netdev, int new_mtu) | |||
256 | static int emac_open(struct net_device *netdev) | 256 | static int emac_open(struct net_device *netdev) |
257 | { | 257 | { |
258 | struct emac_adapter *adpt = netdev_priv(netdev); | 258 | struct emac_adapter *adpt = netdev_priv(netdev); |
259 | struct emac_irq *irq = &adpt->irq; | ||
259 | int ret; | 260 | int ret; |
260 | 261 | ||
262 | ret = request_irq(irq->irq, emac_isr, 0, "emac-core0", irq); | ||
263 | if (ret) { | ||
264 | netdev_err(adpt->netdev, "could not request emac-core0 irq\n"); | ||
265 | return ret; | ||
266 | } | ||
267 | |||
261 | /* allocate rx/tx dma buffer & descriptors */ | 268 | /* allocate rx/tx dma buffer & descriptors */ |
262 | ret = emac_mac_rx_tx_rings_alloc_all(adpt); | 269 | ret = emac_mac_rx_tx_rings_alloc_all(adpt); |
263 | if (ret) { | 270 | if (ret) { |
264 | netdev_err(adpt->netdev, "error allocating rx/tx rings\n"); | 271 | netdev_err(adpt->netdev, "error allocating rx/tx rings\n"); |
272 | free_irq(irq->irq, irq); | ||
265 | return ret; | 273 | return ret; |
266 | } | 274 | } |
267 | 275 | ||
268 | ret = emac_mac_up(adpt); | 276 | ret = emac_mac_up(adpt); |
269 | if (ret) { | 277 | if (ret) { |
270 | emac_mac_rx_tx_rings_free_all(adpt); | 278 | emac_mac_rx_tx_rings_free_all(adpt); |
279 | free_irq(irq->irq, irq); | ||
271 | return ret; | 280 | return ret; |
272 | } | 281 | } |
273 | 282 | ||
@@ -286,6 +295,8 @@ static int emac_close(struct net_device *netdev) | |||
286 | emac_mac_down(adpt); | 295 | emac_mac_down(adpt); |
287 | emac_mac_rx_tx_rings_free_all(adpt); | 296 | emac_mac_rx_tx_rings_free_all(adpt); |
288 | 297 | ||
298 | free_irq(adpt->irq.irq, &adpt->irq); | ||
299 | |||
289 | mutex_unlock(&adpt->reset_lock); | 300 | mutex_unlock(&adpt->reset_lock); |
290 | 301 | ||
291 | return 0; | 302 | return 0; |
diff --git a/drivers/net/ethernet/qualcomm/emac/emac.h b/drivers/net/ethernet/qualcomm/emac/emac.h index 1368440ea91d..2725507ae866 100644 --- a/drivers/net/ethernet/qualcomm/emac/emac.h +++ b/drivers/net/ethernet/qualcomm/emac/emac.h | |||
@@ -331,7 +331,6 @@ struct emac_adapter { | |||
331 | 331 | ||
332 | int emac_reinit_locked(struct emac_adapter *adpt); | 332 | int emac_reinit_locked(struct emac_adapter *adpt); |
333 | void emac_reg_update32(void __iomem *addr, u32 mask, u32 val); | 333 | void emac_reg_update32(void __iomem *addr, u32 mask, u32 val); |
334 | irqreturn_t emac_isr(int irq, void *data); | ||
335 | 334 | ||
336 | void emac_set_ethtool_ops(struct net_device *netdev); | 335 | void emac_set_ethtool_ops(struct net_device *netdev); |
337 | void emac_update_hw_stats(struct emac_adapter *adpt); | 336 | void emac_update_hw_stats(struct emac_adapter *adpt); |