[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZapHWw85UAIRqsyt@shell.armlinux.org.uk>
Date: Fri, 19 Jan 2024 09:56:43 +0000
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Andre Werner <andre.werner@...tec-electronic.com>
Cc: andrew@...n.ch, hkallweit1@...il.com, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: phy: adin1100: Fix nullptr exception for phy
interrupts
On Fri, Jan 19, 2024 at 04:05:29AM +0100, Andre Werner wrote:
> On Thu, 18 Jan 2024, Russell King (Oracle) wrote:
>
> > In addition to Andrew's comments:
> >
> > On Thu, Jan 18, 2024 at 11:43:41AM +0100, Andre Werner wrote:
> > > +static int adin_config_intr(struct phy_device *phydev)
> > > +{
> > > + int ret, regval;
> > > +
> > > + ret = adin_phy_ack_intr(phydev);
> > > +
> > > + if (ret)
> > > + return ret;
> > > +
> > > + regval = phy_read_mmd(phydev, MDIO_MMD_VEND2, ADIN_PHY_SUBSYS_IRQ_MASK);
> > > + if (regval < 0)
> > > + return regval;
> > > +
> > > + if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
> > > + regval |= ADIN_LINK_STAT_CHNG_IRQ_EN;
> > > + else
> > > + regval &= ~ADIN_LINK_STAT_CHNG_IRQ_EN;
> > > +
> > > + ret = phy_write_mmd(phydev, MDIO_MMD_VEND2,
> > > + ADIN_PHY_SUBSYS_IRQ_MASK,
> > > + regval);
> > > + return ret;
> >
> > u16 irq_mask;
> >
> > if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
> > irq_mask = ADIN_LINK_STAT_CHNG_IRQ_EN;
> > else
> > irq_mask = 0;
>
> Unfortunately, I can not do this, because that phy ask for read-modify-write access to
> registers and some bits in this register are already set after reset and
> should not being modified.
>
> >
> > return phy_modify_mmd(phydev, MDIO_MMD_VEND2,
> > ADIN_PHY_SUBSYS_IRQ_MASK,
> > ADIN_LINK_STAT_CHNG_IRQ_EN, irq_mask);
So you don't understand... phy_modify_mmd() will do a read-modify-write
and because the mask passed is ADIN_LINK_STAT_CHNG_IRQ_EN, this is the
_only_ bit that will be affected.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists