Message ID | 20201123153817.1616814-7-ciorneiioana@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 84c8f773d2dc17193aba2e707338f6e107fb71e5 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: phy: add support for shared interrupts (part 3) | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 47 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
netdev/stable | success | Stable not CCed |
On Mon 23 Nov 2020 at 16:38, Ioana Ciornei <ciorneiioana@gmail.com> wrote: > From: Ioana Ciornei <ioana.ciornei@nxp.com> > > 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: Jerome Brunet <jbrunet@baylibre.com> > Cc: Neil Armstrong <narmstrong@baylibre.com> > Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> > --- > drivers/net/phy/meson-gxl.c | 19 +++++++++++-------- > 1 file changed, 11 insertions(+), 8 deletions(-) > > diff --git a/drivers/net/phy/meson-gxl.c b/drivers/net/phy/meson-gxl.c > index b16b1cc89165..7e7904fee1d9 100644 > --- a/drivers/net/phy/meson-gxl.c > +++ b/drivers/net/phy/meson-gxl.c > @@ -204,22 +204,27 @@ static int meson_gxl_config_intr(struct phy_device *phydev) > int ret; > > if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { > + /* Ack any pending IRQ */ > + ret = meson_gxl_ack_interrupt(phydev); > + if (ret) > + return ret; > + > val = INTSRC_ANEG_PR > | INTSRC_PARALLEL_FAULT > | INTSRC_ANEG_LP_ACK > | INTSRC_LINK_DOWN > | INTSRC_REMOTE_FAULT > | INTSRC_ANEG_COMPLETE; > + ret = phy_write(phydev, INTSRC_MASK, val); > } else { > val = 0; > - } > + ret = phy_write(phydev, INTSRC_MASK, val); > > - /* Ack any pending IRQ */ > - ret = meson_gxl_ack_interrupt(phydev); > - if (ret) > - return ret; > + /* Ack any pending IRQ */ > + ret = meson_gxl_ack_interrupt(phydev); > + } > > - return phy_write(phydev, INTSRC_MASK, val); > + return ret; The only thing the above does is clear the irq *after* writing INTSRC_MASK *only* when the interrupts are not enabled. If that was not the intent, please let me know. As it stands, I don't think this hunk is necessary and I would prefer if it was not included. > } > > static irqreturn_t meson_gxl_handle_interrupt(struct phy_device *phydev) > @@ -249,7 +254,6 @@ static struct phy_driver meson_gxl_phy[] = { > .soft_reset = genphy_soft_reset, > .config_init = meson_gxl_config_init, > .read_status = meson_gxl_read_status, > - .ack_interrupt = meson_gxl_ack_interrupt, > .config_intr = meson_gxl_config_intr, > .handle_interrupt = meson_gxl_handle_interrupt, > .suspend = genphy_suspend, > @@ -260,7 +264,6 @@ static struct phy_driver meson_gxl_phy[] = { > /* PHY_BASIC_FEATURES */ > .flags = PHY_IS_INTERNAL, > .soft_reset = genphy_soft_reset, > - .ack_interrupt = meson_gxl_ack_interrupt, > .config_intr = meson_gxl_config_intr, > .handle_interrupt = meson_gxl_handle_interrupt, > .suspend = genphy_suspend,
diff --git a/drivers/net/phy/meson-gxl.c b/drivers/net/phy/meson-gxl.c index b16b1cc89165..7e7904fee1d9 100644 --- a/drivers/net/phy/meson-gxl.c +++ b/drivers/net/phy/meson-gxl.c @@ -204,22 +204,27 @@ static int meson_gxl_config_intr(struct phy_device *phydev) int ret; if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { + /* Ack any pending IRQ */ + ret = meson_gxl_ack_interrupt(phydev); + if (ret) + return ret; + val = INTSRC_ANEG_PR | INTSRC_PARALLEL_FAULT | INTSRC_ANEG_LP_ACK | INTSRC_LINK_DOWN | INTSRC_REMOTE_FAULT | INTSRC_ANEG_COMPLETE; + ret = phy_write(phydev, INTSRC_MASK, val); } else { val = 0; - } + ret = phy_write(phydev, INTSRC_MASK, val); - /* Ack any pending IRQ */ - ret = meson_gxl_ack_interrupt(phydev); - if (ret) - return ret; + /* Ack any pending IRQ */ + ret = meson_gxl_ack_interrupt(phydev); + } - return phy_write(phydev, INTSRC_MASK, val); + return ret; } static irqreturn_t meson_gxl_handle_interrupt(struct phy_device *phydev) @@ -249,7 +254,6 @@ static struct phy_driver meson_gxl_phy[] = { .soft_reset = genphy_soft_reset, .config_init = meson_gxl_config_init, .read_status = meson_gxl_read_status, - .ack_interrupt = meson_gxl_ack_interrupt, .config_intr = meson_gxl_config_intr, .handle_interrupt = meson_gxl_handle_interrupt, .suspend = genphy_suspend, @@ -260,7 +264,6 @@ static struct phy_driver meson_gxl_phy[] = { /* PHY_BASIC_FEATURES */ .flags = PHY_IS_INTERNAL, .soft_reset = genphy_soft_reset, - .ack_interrupt = meson_gxl_ack_interrupt, .config_intr = meson_gxl_config_intr, .handle_interrupt = meson_gxl_handle_interrupt, .suspend = genphy_suspend,