Re: [PATCH v14 2/2] i2c: core: support bus regulator controlling in adapter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Wolfram,

Thanks for the reviewing, I will sent next version for fixing up them.

Bibby

On Tue, 2020-05-19 at 08:59 +0200, Wolfram Sang wrote:
> On Tue, Apr 28, 2020 at 02:18:13PM +0800, Bibby Hsieh wrote:
> > Although in the most platforms, the bus power of i2c
> > are alway on, some platforms disable the i2c bus power
> > in order to meet low power request.
> > 
> > We get and enable bulk regulator in i2c adapter device.
> > 
> > Signed-off-by: Bibby Hsieh <bibby.hsieh@xxxxxxxxxxxx>
> > ---
> >  drivers/i2c/i2c-core-base.c | 82 +++++++++++++++++++++++++++++++++++++
> >  include/linux/i2c.h         |  2 +
> >  2 files changed, 84 insertions(+)
> > 
> > diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
> > index 5cc0b0ec5570..f81b42a4ed07 100644
> > --- a/drivers/i2c/i2c-core-base.c
> > +++ b/drivers/i2c/i2c-core-base.c
> > @@ -313,6 +313,7 @@ static int i2c_smbus_host_notify_to_irq(const struct i2c_client *client)
> >  static int i2c_device_probe(struct device *dev)
> >  {
> >  	struct i2c_client	*client = i2c_verify_client(dev);
> > +	struct i2c_adapter	*adap = client->adapter;
> 
> You are accessing client before the NULL pointer check.
> 
> 
> > @@ -414,6 +421,7 @@ static int i2c_device_probe(struct device *dev)
> >  static int i2c_device_remove(struct device *dev)
> >  {
> >  	struct i2c_client	*client = i2c_verify_client(dev);
> > +	struct i2c_adapter      *adap = client->adapter;
> 
> Same here.
> 
> > +static int i2c_suspend_late(struct device *dev)
> > +{
> > +	struct i2c_client *client = i2c_verify_client(dev);
> > +	struct i2c_adapter *adap = client->adapter;
> > +	int err;
> > +
> > +	err = pm_generic_suspend_late(&client->dev);
> > +	if (err)
> > +		return err;
> > +
> > +	if (!pm_runtime_status_suspended(&client->dev))
> > +		return regulator_disable(adap->bus_regulator);
> > +
> > +	return err;
> 
> Can be 'return 0'.
> 





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux