Re: [PATCH v2 3/3] hwmon: ina3221: Add suspend and resume functions

From: Nicolin Chen
Date: Sun Sep 30 2018 - 23:24:23 EST


On Sun, Sep 30, 2018 at 08:27:49AM -0700, Guenter Roeck wrote:

> > static int ina3221_read_value(struct ina3221_data *ina, unsigned int reg,
> > @@ -415,9 +419,67 @@ static int ina3221_probe(struct i2c_client *client,
> > return PTR_ERR(hwmon_dev);
> > }
> >
> > + dev_set_drvdata(dev, ina);
> > +
>
> It is better to call that function before registering the hwmon device,
> to avoid the theroretical possibility that suspend is called before drvdata
> is set. I moved the call accordingly.

Oh..I see. Another lesson learned. Thank you for the fix!