mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andre Werner <andre.werner@systec-electronic.com>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: Andre Werner <andre.werner@systec-electronic.com>,
	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 04:05:29 +0100 (CET)	[thread overview]
Message-ID: <48245ebe-babf-52ec-407b-9ce32ffe24d2@systec-electronic.com> (raw)
In-Reply-To: <Zald7u8B+uKzCn42@shell.armlinux.org.uk>

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);
>
>> +}
>> +
>> +static irqreturn_t adin_phy_handle_interrupt(struct phy_device *phydev)
>> +{
>> +	int irq_status;
>> +
>> +	irq_status = phy_read_mmd(phydev, MDIO_MMD_VEND2, ADIN_PHY_SUBSYS_IRQ_STATUS);
>
> Probably want to wrap this - if you're going to bother wrapping your
> phy_write_mmd() above because it overflows 80 columns, then please do
> so consistently.

Done.

>
> Thanks.
>
> -- 
> 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  3:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-18 10:43 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 [this message]
2024-01-19  9:56     ` Russell King (Oracle)

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=48245ebe-babf-52ec-407b-9ce32ffe24d2@systec-electronic.com \
    --to=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=linux@armlinux.org.uk \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®