Subject: Re: [PATCH] sfp: sfp_read: split-up request when hw rx buffer is too small.

From: Andrew Lunn <[email-masked]>
Date: Fri, 25 Jan 2019 23:43:17 +0100

> My point still stands, we have an abstraction layer through the i2c core
> which sits between clients and adapters.
> 
> If you have a simple read into a buffer transaction (like what we have
> here), then you can provide a safe accessor function that takes care of
> looking at the max_read_len quirk and splitting things into the
> appropriate number of transaction. Then we can also eliminate the "msg
> too long" annoying message since we are now using an appropriate function.
> 
> The fact that there are multiple drivers that need to be patched to
> split i2c transaction is an indication that this is not IMHO addressed
> at the right level, especially if what they do is as simple as an
> i2c_transfer() into a single buffer and require no quirky transaction.
> 
> Andrew, Heiner and Russell might have a different view on this.

Hi Florian

I suspect the issue is, only the driver knows if the device supports
splitting a read into multiple reads without having to do something in
between. Some device might require you do an address setup between
each read, for example.

However, the core could offer an i2c_transfer_segmentable(), which
does the segmentation as required here, and the driver can then elect
to use that, not i2c_transfer().

   Andrew