On Wed, Sep 05, 2018 at 10:17:26PM +0000, Ajay Gupta wrote:
> Hi Greg,
> 
> > > +static int ccg_read(struct ucsi_ccg *uc, u16 rab, u8 *data, u32 len)
> > > +{
> > > + struct device *dev = uc->dev;
> > > + struct i2c_client *client = uc->client;
> > > + unsigned char buf[2];
> > > + struct i2c_msg msgs[] = {
> > > +         {
> > > +                 .addr   = client->addr,
> > > +                 .flags  = 0x0,
> > > +                 .len    = 0x2,
> > > +                 .buf    = buf,
> > > +         },
> > > +         {
> > > +                 .addr   = client->addr,
> > > +                 .flags  = I2C_M_RD,
> > > +                 .buf    = data,
> > > +         },
> > > + };
> > 
> > Are you sure you are allowed to do i2c messages off of the stack like this?
> > Will that work on all platforms?

DMA is optional with I2C. These messages do not set the I2C_M_DMASAFE
flag, so it should be OK.

Attachment: signature.asc
Description: PGP signature

Reply via email to