All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Andre Werner <andre.werner@systec-electronic.com>
Cc: andrew@lunn.ch, hkallweit1@gmail.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: phy: adin1100: Fix nullptr exception for phy interrupts
Date: Fri, 19 Jan 2024 09:56:43 +0000	[thread overview]
Message-ID: <ZapHWw85UAIRqsyt@shell.armlinux.org.uk> (raw)
In-Reply-To: <48245ebe-babf-52ec-407b-9ce32ffe24d2@systec-electronic.com>

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!

      reply	other threads:[~2024-01-19  9:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-18 10:43 [PATCH] net: phy: adin1100: Fix nullptr exception for phy interrupts Andre Werner
2024-01-18 16:53 ` Andrew Lunn
2024-01-18 17:36   ` Heiner Kallweit
2024-01-18 20:09     ` Andrew Lunn
2024-01-18 21:24       ` Heiner Kallweit
2024-01-18 23:34         ` Russell King (Oracle)
2024-01-19  6:30         ` Andre Werner
2024-01-18 17:20 ` Russell King (Oracle)
2024-01-19  3:05   ` Andre Werner
2024-01-19  9:56     ` Russell King (Oracle) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZapHWw85UAIRqsyt@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=andre.werner@systec-electronic.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.