Re: [PATCH v2 4/4] i2c: mv64xxx: use i2c_adapter_dev()
From: Bartosz Golaszewski
Date: Mon Feb 23 2026 - 04:28:03 EST
On Mon, Feb 23, 2026 at 10:14 AM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> On Mon, Feb 23, 2026 at 10:02:52AM +0100, Bartosz Golaszewski wrote:
> > Use i2c_adapter_dev() where applicable in order to avoid direct
> > dereferencing of struct device embedded within struct i2c_adapter.
>
> ...
>
> > mv64xxx_i2c_xfer_core(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
>
> > struct mv64xxx_i2c_data *drv_data = i2c_get_adapdata(adap);
> > int rc, ret = num;
> >
> > - rc = pm_runtime_resume_and_get(&adap->dev);
> > + rc = pm_runtime_resume_and_get(i2c_adapter_dev(adap));
> > if (rc)
> > return rc;
>
> ...
>
> > drv_data->num_msgs = 0;
> > drv_data->msgs = NULL;
> >
> > - pm_runtime_put_autosuspend(&adap->dev);
> > + pm_runtime_put_autosuspend(i2c_adapter_dev(adap));
> >
> > return ret;
>
> These two changes are in the same function, perhaps temporary variable
> would be better?
>
If all else is fine, maybe let's do it in a follow-up?
Bart