Skip to content

Commit 4404323

Browse files
Timur Tabidavem330
authored andcommitted
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 <[email protected]> Reviewed-by: Lino Sanfilippo <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 41c1093 commit 4404323

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

drivers/net/ethernet/qualcomm/emac/emac-mac.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,6 @@ struct emac_skb_cb {
314314
RX_PKT_INT2 |\
315315
RX_PKT_INT3)
316316

317-
#define EMAC_MAC_IRQ_RES "core0"
318-
319317
void emac_mac_multicast_addr_set(struct emac_adapter *adpt, u8 *addr)
320318
{
321319
u32 crc32, bit, reg, mta;
@@ -977,26 +975,16 @@ static void emac_adjust_link(struct net_device *netdev)
977975
int emac_mac_up(struct emac_adapter *adpt)
978976
{
979977
struct net_device *netdev = adpt->netdev;
980-
struct emac_irq *irq = &adpt->irq;
981978
int ret;
982979

983980
emac_mac_rx_tx_ring_reset_all(adpt);
984981
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-
993982
emac_mac_rx_descs_refill(adpt, &adpt->rx_q);
994983

995984
ret = phy_connect_direct(netdev, adpt->phydev, emac_adjust_link,
996985
PHY_INTERFACE_MODE_SGMII);
997986
if (ret) {
998987
netdev_err(adpt->netdev, "could not connect phy\n");
999-
free_irq(irq->irq, irq);
1000988
return ret;
1001989
}
1002990

@@ -1030,7 +1018,6 @@ void emac_mac_down(struct emac_adapter *adpt)
10301018
writel(DIS_INT, adpt->base + EMAC_INT_STATUS);
10311019
writel(0, adpt->base + EMAC_INT_MASK);
10321020
synchronize_irq(adpt->irq.irq);
1033-
free_irq(adpt->irq.irq, &adpt->irq);
10341021

10351022
phy_disconnect(adpt->phydev);
10361023

drivers/net/ethernet/qualcomm/emac/emac.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,18 +256,27 @@ static int emac_change_mtu(struct net_device *netdev, int new_mtu)
256256
static int emac_open(struct net_device *netdev)
257257
{
258258
struct emac_adapter *adpt = netdev_priv(netdev);
259+
struct emac_irq *irq = &adpt->irq;
259260
int ret;
260261

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+
261268
/* allocate rx/tx dma buffer & descriptors */
262269
ret = emac_mac_rx_tx_rings_alloc_all(adpt);
263270
if (ret) {
264271
netdev_err(adpt->netdev, "error allocating rx/tx rings\n");
272+
free_irq(irq->irq, irq);
265273
return ret;
266274
}
267275

268276
ret = emac_mac_up(adpt);
269277
if (ret) {
270278
emac_mac_rx_tx_rings_free_all(adpt);
279+
free_irq(irq->irq, irq);
271280
return ret;
272281
}
273282

@@ -286,6 +295,8 @@ static int emac_close(struct net_device *netdev)
286295
emac_mac_down(adpt);
287296
emac_mac_rx_tx_rings_free_all(adpt);
288297

298+
free_irq(adpt->irq.irq, &adpt->irq);
299+
289300
mutex_unlock(&adpt->reset_lock);
290301

291302
return 0;

drivers/net/ethernet/qualcomm/emac/emac.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,6 @@ struct emac_adapter {
331331

332332
int emac_reinit_locked(struct emac_adapter *adpt);
333333
void emac_reg_update32(void __iomem *addr, u32 mask, u32 val);
334-
irqreturn_t emac_isr(int irq, void *data);
335334

336335
void emac_set_ethtool_ops(struct net_device *netdev);
337336
void emac_update_hw_stats(struct emac_adapter *adpt);

0 commit comments

Comments
 (0)