Skip to content

Commit 12ae7ba

Browse files
IoanaCiorneikuba-moo
authored andcommitted
net: phy: icplus: remove the use .ack_interrupt()
In preparation of removing the .ack_interrupt() callback, we must replace its occurrences (aka phy_clear_interrupt), from the 2 places where it is called from (phy_enable_interrupts and phy_disable_interrupts), with equivalent functionality. This means that clearing interrupts now becomes something that the PHY driver is responsible of doing, before enabling interrupts and after clearing them. Make this driver follow the new contract. Cc: Martin Blumenstingl <[email protected]> Signed-off-by: Ioana Ciornei <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 25497b7 commit 12ae7ba

File tree

1 file changed

+25
-13
lines changed

1 file changed

+25
-13
lines changed

drivers/net/phy/icplus.c

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -272,17 +272,39 @@ static int ip101a_g_config_init(struct phy_device *phydev)
272272
return phy_write(phydev, IP10XX_SPEC_CTRL_STATUS, c);
273273
}
274274

275+
static int ip101a_g_ack_interrupt(struct phy_device *phydev)
276+
{
277+
int err = phy_read(phydev, IP101A_G_IRQ_CONF_STATUS);
278+
279+
if (err < 0)
280+
return err;
281+
282+
return 0;
283+
}
284+
275285
static int ip101a_g_config_intr(struct phy_device *phydev)
276286
{
277287
u16 val;
288+
int err;
289+
290+
if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
291+
err = ip101a_g_ack_interrupt(phydev);
292+
if (err)
293+
return err;
278294

279-
if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
280295
/* INTR pin used: Speed/link/duplex will cause an interrupt */
281296
val = IP101A_G_IRQ_PIN_USED;
282-
else
297+
err = phy_write(phydev, IP101A_G_IRQ_CONF_STATUS, val);
298+
} else {
283299
val = IP101A_G_IRQ_ALL_MASK;
300+
err = phy_write(phydev, IP101A_G_IRQ_CONF_STATUS, val);
301+
if (err)
302+
return err;
303+
304+
err = ip101a_g_ack_interrupt(phydev);
305+
}
284306

285-
return phy_write(phydev, IP101A_G_IRQ_CONF_STATUS, val);
307+
return err;
286308
}
287309

288310
static irqreturn_t ip101a_g_handle_interrupt(struct phy_device *phydev)
@@ -305,15 +327,6 @@ static irqreturn_t ip101a_g_handle_interrupt(struct phy_device *phydev)
305327
return IRQ_HANDLED;
306328
}
307329

308-
static int ip101a_g_ack_interrupt(struct phy_device *phydev)
309-
{
310-
int err = phy_read(phydev, IP101A_G_IRQ_CONF_STATUS);
311-
if (err < 0)
312-
return err;
313-
314-
return 0;
315-
}
316-
317330
static struct phy_driver icplus_driver[] = {
318331
{
319332
.phy_id = 0x02430d80,
@@ -340,7 +353,6 @@ static struct phy_driver icplus_driver[] = {
340353
/* PHY_BASIC_FEATURES */
341354
.probe = ip101a_g_probe,
342355
.config_intr = ip101a_g_config_intr,
343-
.ack_interrupt = ip101a_g_ack_interrupt,
344356
.handle_interrupt = ip101a_g_handle_interrupt,
345357
.config_init = &ip101a_g_config_init,
346358
.suspend = genphy_suspend,

0 commit comments

Comments
 (0)