On 12/20/2018 10:41 AM, Andrew Lunn wrote: > On Wed, Dec 19, 2018 at 05:20:33PM -0800, Florian Fainelli wrote: >> On 12/19/18 5:06 PM, Marek Vasut wrote: >>> Previous patches unconver that ksz_spi_write() is always ever called >>> with len = 1, 2 or 4. We can thus drop the if (len > SPI_TX_BUF_LEN) >>> check and we can also drop the allocation of the txbuf which is part >>> of the driver data. This wastes 256 bytes for no reason and can be >>> replaced with 8-byte stack allocated buffer, which is what this patch >>> does. This is an intermediate step though, which will go away after >>> regmap conversion. >> >> dev is a kmalloc'd buffer, so dev->txbuf is a DMA-able buffer, that >> could be presumably why it was used in the first place, DMA from the >> stack is not something safe, but I did not check the core SPI layer or >> the SPI bus master driver to see whether they do take care of that already. > > Hi Marek > > This is also something i requested for the i2c layering. An i2c bus > master might use DMA. So you cannot use stack space, or the i2c core > needs to copy the data to somewhere which is DMA'able. > > Please could you check what regmap offers. If regmap does the copies, > than this buffer can be removed, but only after the change to regmap > is performed. You should not remove it before swapping to regmap, > otherwise you can introducing a regression, which somebody might hit > during a git bisect.
This code goes away with the regmap completely, so I'll just reorder the patches and remove it in 6/7 . The 6/7 will need rework anyway, I talked to Mark Brown about this crazy register layout of this switch and it seems we'll need a regmap per register width (sigh). -- Best regards, Marek Vasut