Re: [PATCH V2 3/6] spi/spi-pl022: Don't allocate more sg than required.

2011-08-10 Thread viresh kumar
On 08/10/2011 05:12 PM, Sergei Shtylyov wrote: >> > - pages = (pl022->cur_transfer->len>> PAGE_SHIFT) + 1; >> > + pages = ((pl022->cur_transfer->len + (1 << PAGE_SHIFT) - 1) >> > + >> PAGE_SHIFT); > No need for parens around the rvalue. Oops, that was a mistake. Anyway i h

Re: [PATCH V2 3/6] spi/spi-pl022: Don't allocate more sg than required.

2011-08-10 Thread Sergei Shtylyov
Hello. On 10-08-2011 12:50, Viresh Kumar wrote: > In routine configure_dma(), if transfer->len = PAGE_SIZE, then pages is one > more > than required. While leads to one more sg getting allocated. > This is wrong. Correct this to allocate correct number of sg. > Signed-off-by: Viresh Kumar > Te

Re: [PATCH V2 3/6] spi/spi-pl022: Don't allocate more sg than required.

2011-08-10 Thread viresh kumar
On 08/10/2011 02:24 PM, Russell King - ARM Linux wrote: > It would be far better for this to be: > > pages = DIV_ROUND_UP(pl022->cur_transfer->len, PAGE_SIZE); > > The compiler will probably optimize it to the same code anyway. I thought of it too, but missed to update code. Thanks. -- v

Re: [PATCH V2 3/6] spi/spi-pl022: Don't allocate more sg than required.

2011-08-10 Thread Russell King - ARM Linux
On Wed, Aug 10, 2011 at 02:20:56PM +0530, Viresh Kumar wrote: > In routine configure_dma(), if transfer->len = PAGE_SIZE, then pages is one > more > than required. While leads to one more sg getting allocated. > > This is wrong. Correct this to allocate correct number of sg. > > Signed-off-by: V

[PATCH V2 3/6] spi/spi-pl022: Don't allocate more sg than required.

2011-08-10 Thread Viresh Kumar
In routine configure_dma(), if transfer->len = PAGE_SIZE, then pages is one more than required. While leads to one more sg getting allocated. This is wrong. Correct this to allocate correct number of sg. Signed-off-by: Viresh Kumar Tested-by: Linus Walleij --- drivers/spi/spi-pl022.c |3 ++