Skip to content

Commit 16c9709

Browse files
IoanaCiorneikuba-moo
authored andcommitted
net: phy: intel-xway: remove the use of .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: Mathias Kresin <[email protected]> Cc: Hauke Mehrtens <[email protected]> Signed-off-by: Ioana Ciornei <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 1566db0 commit 16c9709

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

drivers/net/phy/intel-xway.c

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,24 @@ static int xway_gphy_ack_interrupt(struct phy_device *phydev)
212212
static int xway_gphy_config_intr(struct phy_device *phydev)
213213
{
214214
u16 mask = 0;
215+
int err;
216+
217+
if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
218+
err = xway_gphy_ack_interrupt(phydev);
219+
if (err)
220+
return err;
215221

216-
if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
217222
mask = XWAY_MDIO_INIT_MASK;
223+
err = phy_write(phydev, XWAY_MDIO_IMASK, mask);
224+
} else {
225+
err = phy_write(phydev, XWAY_MDIO_IMASK, mask);
226+
if (err)
227+
return err;
228+
229+
err = xway_gphy_ack_interrupt(phydev);
230+
}
218231

219-
return phy_write(phydev, XWAY_MDIO_IMASK, mask);
232+
return err;
220233
}
221234

222235
static irqreturn_t xway_gphy_handle_interrupt(struct phy_device *phydev)
@@ -245,7 +258,6 @@ static struct phy_driver xway_gphy[] = {
245258
/* PHY_GBIT_FEATURES */
246259
.config_init = xway_gphy_config_init,
247260
.config_aneg = xway_gphy14_config_aneg,
248-
.ack_interrupt = xway_gphy_ack_interrupt,
249261
.handle_interrupt = xway_gphy_handle_interrupt,
250262
.config_intr = xway_gphy_config_intr,
251263
.suspend = genphy_suspend,
@@ -257,7 +269,6 @@ static struct phy_driver xway_gphy[] = {
257269
/* PHY_BASIC_FEATURES */
258270
.config_init = xway_gphy_config_init,
259271
.config_aneg = xway_gphy14_config_aneg,
260-
.ack_interrupt = xway_gphy_ack_interrupt,
261272
.handle_interrupt = xway_gphy_handle_interrupt,
262273
.config_intr = xway_gphy_config_intr,
263274
.suspend = genphy_suspend,
@@ -269,7 +280,6 @@ static struct phy_driver xway_gphy[] = {
269280
/* PHY_GBIT_FEATURES */
270281
.config_init = xway_gphy_config_init,
271282
.config_aneg = xway_gphy14_config_aneg,
272-
.ack_interrupt = xway_gphy_ack_interrupt,
273283
.handle_interrupt = xway_gphy_handle_interrupt,
274284
.config_intr = xway_gphy_config_intr,
275285
.suspend = genphy_suspend,
@@ -281,7 +291,6 @@ static struct phy_driver xway_gphy[] = {
281291
/* PHY_BASIC_FEATURES */
282292
.config_init = xway_gphy_config_init,
283293
.config_aneg = xway_gphy14_config_aneg,
284-
.ack_interrupt = xway_gphy_ack_interrupt,
285294
.handle_interrupt = xway_gphy_handle_interrupt,
286295
.config_intr = xway_gphy_config_intr,
287296
.suspend = genphy_suspend,
@@ -292,7 +301,6 @@ static struct phy_driver xway_gphy[] = {
292301
.name = "Intel XWAY PHY11G (PEF 7071/PEF 7072) v1.5 / v1.6",
293302
/* PHY_GBIT_FEATURES */
294303
.config_init = xway_gphy_config_init,
295-
.ack_interrupt = xway_gphy_ack_interrupt,
296304
.handle_interrupt = xway_gphy_handle_interrupt,
297305
.config_intr = xway_gphy_config_intr,
298306
.suspend = genphy_suspend,
@@ -303,7 +311,6 @@ static struct phy_driver xway_gphy[] = {
303311
.name = "Intel XWAY PHY22F (PEF 7061) v1.5 / v1.6",
304312
/* PHY_BASIC_FEATURES */
305313
.config_init = xway_gphy_config_init,
306-
.ack_interrupt = xway_gphy_ack_interrupt,
307314
.handle_interrupt = xway_gphy_handle_interrupt,
308315
.config_intr = xway_gphy_config_intr,
309316
.suspend = genphy_suspend,
@@ -314,7 +321,6 @@ static struct phy_driver xway_gphy[] = {
314321
.name = "Intel XWAY PHY11G (xRX v1.1 integrated)",
315322
/* PHY_GBIT_FEATURES */
316323
.config_init = xway_gphy_config_init,
317-
.ack_interrupt = xway_gphy_ack_interrupt,
318324
.handle_interrupt = xway_gphy_handle_interrupt,
319325
.config_intr = xway_gphy_config_intr,
320326
.suspend = genphy_suspend,
@@ -325,7 +331,6 @@ static struct phy_driver xway_gphy[] = {
325331
.name = "Intel XWAY PHY22F (xRX v1.1 integrated)",
326332
/* PHY_BASIC_FEATURES */
327333
.config_init = xway_gphy_config_init,
328-
.ack_interrupt = xway_gphy_ack_interrupt,
329334
.handle_interrupt = xway_gphy_handle_interrupt,
330335
.config_intr = xway_gphy_config_intr,
331336
.suspend = genphy_suspend,
@@ -336,7 +341,6 @@ static struct phy_driver xway_gphy[] = {
336341
.name = "Intel XWAY PHY11G (xRX v1.2 integrated)",
337342
/* PHY_GBIT_FEATURES */
338343
.config_init = xway_gphy_config_init,
339-
.ack_interrupt = xway_gphy_ack_interrupt,
340344
.handle_interrupt = xway_gphy_handle_interrupt,
341345
.config_intr = xway_gphy_config_intr,
342346
.suspend = genphy_suspend,
@@ -347,7 +351,6 @@ static struct phy_driver xway_gphy[] = {
347351
.name = "Intel XWAY PHY22F (xRX v1.2 integrated)",
348352
/* PHY_BASIC_FEATURES */
349353
.config_init = xway_gphy_config_init,
350-
.ack_interrupt = xway_gphy_ack_interrupt,
351354
.handle_interrupt = xway_gphy_handle_interrupt,
352355
.config_intr = xway_gphy_config_intr,
353356
.suspend = genphy_suspend,

0 commit comments

Comments
 (0)