Re: [PATCH] staging: fbtft: do not allocate huge txbuf

2016-06-09 Thread Noralf Trønnes

[resending got rejected on the list for html format]

Den 09.06.2016 19:18, skrev Michal Suchanek:

Hello,

On 9 June 2016 at 18:20, Noralf Trønnes  wrote:

Den 09.06.2016 17:08, skrev Michal Suchanek:

txbuflen can be set to arbitrary value by user and it is also set
automagically to the maximum transfer size of the SPI master controller.


AFAICT this is a result of your previous patch. Please make a new version of
your previous patch with this fix in it. Also make a note in that thread
that

That patch is pretty much independent and just exposes this problem
under different circumstances. The txbuflen can be also set by the
user.


a new version is made so Greg doesn't pull it when he sees my ack. He
handles a large volume of patches so let's make it as easy as we can for
him.

Which would be letting in the patches separately imho.



Ok,

Acked-by: Noralf Trønnes 


Thanks

Michal





Re: [PATCH] staging: fbtft: do not allocate huge txbuf

2016-06-09 Thread Noralf Trønnes

[resending got rejected on the list for html format]

Den 09.06.2016 19:18, skrev Michal Suchanek:

Hello,

On 9 June 2016 at 18:20, Noralf Trønnes  wrote:

Den 09.06.2016 17:08, skrev Michal Suchanek:

txbuflen can be set to arbitrary value by user and it is also set
automagically to the maximum transfer size of the SPI master controller.


AFAICT this is a result of your previous patch. Please make a new version of
your previous patch with this fix in it. Also make a note in that thread
that

That patch is pretty much independent and just exposes this problem
under different circumstances. The txbuflen can be also set by the
user.


a new version is made so Greg doesn't pull it when he sees my ack. He
handles a large volume of patches so let's make it as easy as we can for
him.

Which would be letting in the patches separately imho.



Ok,

Acked-by: Noralf Trønnes 


Thanks

Michal





Re: [PATCH] staging: fbtft: do not allocate huge txbuf

2016-06-09 Thread Michal Suchanek
Hello,

On 9 June 2016 at 18:20, Noralf Trønnes  wrote:
>
> Den 09.06.2016 17:08, skrev Michal Suchanek:
>>
>> txbuflen can be set to arbitrary value by user and it is also set
>> automagically to the maximum transfer size of the SPI master controller.
>
>
> AFAICT this is a result of your previous patch. Please make a new version of
> your previous patch with this fix in it. Also make a note in that thread
> that

That patch is pretty much independent and just exposes this problem
under different circumstances. The txbuflen can be also set by the
user.

> a new version is made so Greg doesn't pull it when he sees my ack. He
> handles a large volume of patches so let's make it as easy as we can for
> him.

Which would be letting in the patches separately imho.

Thanks

Michal


Re: [PATCH] staging: fbtft: do not allocate huge txbuf

2016-06-09 Thread Michal Suchanek
Hello,

On 9 June 2016 at 18:20, Noralf Trønnes  wrote:
>
> Den 09.06.2016 17:08, skrev Michal Suchanek:
>>
>> txbuflen can be set to arbitrary value by user and it is also set
>> automagically to the maximum transfer size of the SPI master controller.
>
>
> AFAICT this is a result of your previous patch. Please make a new version of
> your previous patch with this fix in it. Also make a note in that thread
> that

That patch is pretty much independent and just exposes this problem
under different circumstances. The txbuflen can be also set by the
user.

> a new version is made so Greg doesn't pull it when he sees my ack. He
> handles a large volume of patches so let's make it as easy as we can for
> him.

Which would be letting in the patches separately imho.

Thanks

Michal


Re: [PATCH] staging: fbtft: do not allocate huge txbuf

2016-06-09 Thread Noralf Trønnes


Den 09.06.2016 17:08, skrev Michal Suchanek:

txbuflen can be set to arbitrary value by user and it is also set
automagically to the maximum transfer size of the SPI master controller.


AFAICT this is a result of your previous patch. Please make a new version of
your previous patch with this fix in it. Also make a note in that thread 
that

a new version is made so Greg doesn't pull it when he sees my ack. He
handles a large volume of patches so let's make it as easy as we can for 
him.


Thanks,
Noralf.


Do not allocate the buffer when larger than vmem. When my SPI master
controller reports maximum transfer size 16M the probe of fbtft fails.

Signed-off-by: Michal Suchanek 
---
  drivers/staging/fbtft/fbtft-core.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/drivers/staging/fbtft/fbtft-core.c 
b/drivers/staging/fbtft/fbtft-core.c
index f3bdc8f..b95cf69 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -820,6 +820,8 @@ struct fb_info *fbtft_framebuffer_alloc(struct 
fbtft_display *display,
/* Transmit buffer */
if (txbuflen == -1)
txbuflen = vmem_size + 2; /* add in case startbyte is used */
+   if (txbuflen >= vmem_size + 2)
+   txbuflen = 0;
  
  #ifdef __LITTLE_ENDIAN

if ((!txbuflen) && (bpp > 8))




Re: [PATCH] staging: fbtft: do not allocate huge txbuf

2016-06-09 Thread Noralf Trønnes


Den 09.06.2016 17:08, skrev Michal Suchanek:

txbuflen can be set to arbitrary value by user and it is also set
automagically to the maximum transfer size of the SPI master controller.


AFAICT this is a result of your previous patch. Please make a new version of
your previous patch with this fix in it. Also make a note in that thread 
that

a new version is made so Greg doesn't pull it when he sees my ack. He
handles a large volume of patches so let's make it as easy as we can for 
him.


Thanks,
Noralf.


Do not allocate the buffer when larger than vmem. When my SPI master
controller reports maximum transfer size 16M the probe of fbtft fails.

Signed-off-by: Michal Suchanek 
---
  drivers/staging/fbtft/fbtft-core.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/drivers/staging/fbtft/fbtft-core.c 
b/drivers/staging/fbtft/fbtft-core.c
index f3bdc8f..b95cf69 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -820,6 +820,8 @@ struct fb_info *fbtft_framebuffer_alloc(struct 
fbtft_display *display,
/* Transmit buffer */
if (txbuflen == -1)
txbuflen = vmem_size + 2; /* add in case startbyte is used */
+   if (txbuflen >= vmem_size + 2)
+   txbuflen = 0;
  
  #ifdef __LITTLE_ENDIAN

if ((!txbuflen) && (bpp > 8))