Re: [PATCH] i2c: mediatek: modify threshold passed to i2c_get_dma_safe_msg_buf()

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

 



On Fri, Feb 15, 2019 at 08:57:27PM +0800, Hsin-Yi Wang wrote:
> On Fri, Feb 15, 2019 at 5:25 PM Wolfram Sang <wsa@xxxxxxxxxxxxx> wrote:
> >
> > On Fri, Feb 15, 2019 at 05:17:27PM +0800, Hsin-Yi Wang wrote:
> > > Ok, I can add a check in another patch. Should we return NULL pointer
> > > if msg->len is 0 or print out some warnings? Thanks.
> >
> > No warning, msg->len == 0 is a valid setting. But interesting question:
> > I was about to say NULL, but your driver would assume ENOMEM there and
> > discard the message which is also not correct since msg->len == 0 is a
> > valid setting. So, should we just return msg->buf then? Will this work
> > with your driver? Can it handle zero-length transfers?
> 
> dma_map_single(i2c->dev, msg->buf , msgs->len, DMA_TO_DEVICE); breaks
> kernel if msgs->len is 0, so I think it doesn't handle zero-length transfer.

Please don't drop the i2c list.

Then, the correct solution for your driver is to forbid those transfers
with this controller. Check I2C_AQ_NO_ZERO_LEN. Also, update the
functionality like this I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK.

Attachment: signature.asc
Description: PGP signature


[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