Re: [PATCH net-next v6 11/12] net: pse-pd: tps23881: Add support for static port priority feature

From: Kory Maincent
Date: Thu Mar 20 2025 - 13:22:58 EST


On Mon, 17 Mar 2025 14:33:09 +0100
Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx> wrote:

> On Tue, Mar 04, 2025 at 11:19:00AM +0100, Kory Maincent wrote:
> > From: Kory Maincent (Dent Project) <kory.maincent@xxxxxxxxxxx>
...
> > @@ -190,7 +201,22 @@ static int tps23881_pi_enable(struct
> > pse_controller_dev *pcdev, int id) BIT(chan % 4));
> > }
> >
> > - return i2c_smbus_write_word_data(client, TPS23881_REG_PW_EN, val);
> > + ret = i2c_smbus_write_word_data(client, TPS23881_REG_PW_EN, val);
> > + if (ret)
> > + return ret;
> > +
> > + /* Enable DC disconnect*/
> > + chan = priv->port[id].chan[0];
> > + ret = i2c_smbus_read_word_data(client, TPS23881_REG_DISC_EN);
> > + if (ret < 0)
> > + return ret;
>
> Here we have RMW operation without lock on two paths: pi_enable and
> pi_disable.

I don't understand, pi_enable and pi_disable are called with pcdev->lock
acquired thanks to the pse core.

Regards,
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com