Re: [PATCH v9 3/7] i2c: fsi: Add port structures

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

 



On Mon, 2018-06-04 at 22:17 +0300, Andy Shevchenko wrote:
> 
> > +static int fsi_i2c_remove(struct device *dev)
> > +{
> > +       struct fsi_i2c_master *i2c = dev_get_drvdata(dev);
> > +       struct fsi_i2c_port *port;
> > +
> > +       list_for_each_entry(port, &i2c->ports, list) {
> > +               i2c_del_adapter(&port->adapter);
> > +               kfree(port);
> > +       }
> 
> Just to be sure, it will be called if and only if all adapters are not
> busy. Correct?

Actually i2c_del_adapter() will do the right thing. It even waits until
the embedded struct device has been fully released.

As indicated by the comment in there, it should all be turned into
something a bit better, but this is what the i2c layer gives us today.

> > +
> > +       return 0;
> > +}
> > +
> >  static const struct fsi_device_id fsi_i2c_ids[] = {
> >         { FSI_ENGID_I2C, FSI_VERSION_ANY },
> >         { 0 }
> > @@ -224,6 +313,7 @@ static int fsi_i2c_probe(struct device *dev)
> >                 .name = "i2c-fsi",
> >                 .bus = &fsi_bus_type,
> >                 .probe = fsi_i2c_probe,
> > +               .remove = fsi_i2c_remove,
> >         },
> >  };
> > 
> > --
> > 1.8.3.1
> > 
> 
> 
> 



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux