lkml.org 
[lkml]   [2012]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v6 1/3] spi/pl022: Add chip select handling via GPIO
From
On Sun, Sep 2, 2012 at 3:12 PM, shiraz hashim
<shiraz.linux.kernel@gmail.com> wrote:
> Hi Linus,

>> Yes that is why the allocation looks like this:
>>
>> + master = spi_alloc_master(dev, sizeof(struct pl022) + sizeof(int) *
>> + platform_info->num_chipselect);
>>
>
> The allocation is such because type of chipselects is int.
>
> The statement for allocation is correct, but
>
> pl022->chipselects = (int *) pl022 + sizeof(struct pl022);
>
> is not adding sizeof(struct pl022) bytes to pl022 base (which we want),
> but infact 4 times the size of pl022 (because type of pl022 is now int *).
>
> Do you get my point ? This would go way beyond memory allocated
> for chipselects.

Yes of course ... how could I not see this. Sorry!

Yours,
Linus Walleij


\
 
 \ /
  Last update: 2012-09-03 11:43    [W:0.115 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site