1
0
Fork 0
Commit Graph

301 Commits (2b2d4247e445b97113c5e61df8fbc0d756482ef8)

Author SHA1 Message Date
Dan Carpenter 0d0d4d21a0 staging: fbtft: array underflow in fbtft_request_gpios_match()
"val" can be negative, so we'd write before the start of the
par->gpio.db[] array.

Fixes: c296d5f995 ("staging: fbtft: core support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-28 17:08:16 -07:00
Colin Ian King 023eba2749 staging: fbtft: make const array gamma_par_mask static
Don't populate array gamma_par_mask on the stack but instead make it
static.  Makes the object code smaller by 148 bytes:

Before:
   text	   data	    bss	    dec	    hex	filename
   2993	   1104	      0	   4097	   1001	drivers/staging/fbtft/fb_st7789v.o

After:
   text	   data	    bss	    dec	    hex	filename
   2757	   1192	      0	   3949	    f6d	drivers/staging/fbtft/fb_st7789v.o

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-16 08:41:02 +02:00
Rishiraj Manwatkar 675b62d288 staging: fbtft: Fix to avoid precedence issues
Parentheses added to avoid operator precedence issues.

Signed-off-by: Rishiraj Manwatkar <manwatkar@outlook.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29 16:41:37 +02:00
Jandy Gou caaba6775e staging: fbtft: fix sparse warning
fix the following sparse warning:
 drivers/staging/fbtft/fbtft-io.c:74:29: warning: incorrect type in assignment
 (different base types) drivers/staging/fbtft/fbtft-io.c:74:29:    expected
 unsigned long long [unsigned] [long] [long long] [usertype] <noident>
 drivers/staging/fbtft/fbtft-io.c:74:29:    got restricted __be64 [usertype]
 <noident>

Signed-off-by: Jandy Gou <gouqingsong@goodix.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-16 13:56:36 +02:00
Laurence Rochfort 100007115f Staging: fbtft: Fix unbalanced braces around else statement
Balance if/else braces as recommended by checkpatch.pl

Signed-off-by: Laurence Rochfort <laurence.rochfort@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-15 07:41:59 +02:00
Christophe Colin b40f7808a0 staging: fbtft: fix open parentheses alignment
Modify the code indentations to fix the checkpatch issues.

Signed-off-by: Christophe Colin <popscolin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-28 12:07:25 +02:00
Alex Wilson 919a9bb607 staging: fbtft: fix type assignment warning
Sparse spits out a warning that a __be16 was being assigned to a u16.
Change the type of txbuf16 to __be16 b/c it's a restricted type and
prevents mixing endianness.

Signed-off-by: Alex Wilson <alex.david.wilson@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-08 17:05:59 +02:00
Arushi Singhal 12eed2f2fb staging: fbtft: Replace a bit shift by a use of BIT.
This patch replaces bit shifting on 1 with the BIT(x) macro.
This was done with coccinelle:
@@
constant c;
@@

-1 << c
+BIT(c)

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-23 14:25:33 +01:00
Alexander Kapshuk 8c8a4186ed staging/fbtft: Hush checkpatch.pl warning about unnecessary line continuations
Use a single string literal as the fmt argument passed to dev_err()
instead of multiple string literals split with an embedded backslash
character.

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-09 17:33:52 +01:00
Heiner Kallweit 74ec0a0e37 staging: fbtft: fb_sh1106: use new helper helper fbtft_write_buf_dc
Make use of new helper fbtft_write_buf_dc.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-09 17:33:18 +01:00
Heiner Kallweit e70065fdc1 staging: fbtft: use helper fbtft_write_buf_dc in fbtft-bus.c
Make use of new helper fbtft_write_buf_dc.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-09 17:33:18 +01:00
Heiner Kallweit 60da70204e staging: fbtft: add helper fbtft_write_buf_dc
Factor out setting DC GPIO and writing buffer content to helper
fbtft_write_buf_dc.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-09 17:33:03 +01:00
Heiner Kallweit 82472b8618 staging: fbtft: fb_sh1106: use own implementation of write_register
The default implementation of write_register keeps DC low for the first
byte only. SH1106 requires DC to be low for all bytes of a multi-byte
command. To deal with this limitation we currently use a separate call
to write_reg for each single command byte what is not really efficient.

Therefore override the default implementation of write_register with an
own one which keeps DC low for all bytes.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-09 17:31:56 +01:00
Heiner Kallweit 18c6142168 staging: fbtft: improve a syslog message in fbtft_register_framebuffer
There are drivers like fb_sh1106 which allocate a txbuf less than 1 KiB.
In this case the message would include "0 KiB buffer memory" what
doesn't make sense and in general I doubt that there is any benefit in
informing the user about allocation of a very small buffer.

Therefore omit this message part if the buffer has less than 1 KiB.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-09 17:31:56 +01:00
Heiner Kallweit 079306e979 staging: fbtft: add adriver for SH1106
This patch adds support for the SH1106 OLED controller chip.

It's similar to the SSD1306, however it supports only a subset of
commands and the internal video memory has a different width.

Major differences:
- Internal video memory has a width of 132 pixels
- Only a subset of commands is supported
- Only page addressing mode is supported, no support for vertical and
  horizontal addressing
- SPI frequency limited to 2 MHz according to the datasheet

Successfully tested with a 1.3" OLED display with this chip and
SPI interface.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:17:08 +01:00
Narcisa Ana Maria Vasile 2fad31423d staging: fbtft: Merged two identical conditionals into one.
Merged two if conditionals into a single one, since they had exactly
the same condition.

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:17:07 +01:00
Cezary Gapinski 5963db92cf staging: fbtft: fix unnecessary line continuations
Fix the following formatting issues:
WARNING: Avoid unnecessary line continuations

Signed-off-by: Cezary Gapinski <gapalinux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:17:07 +01:00
Joe Perches 999c8c28a8 staging: fbtft: Make some s16 arrays const
Using const reduces data size.

$ size drivers/staging/fbtft/built-in.o*
   text	   data	    bss	    dec	    hex	filename
  89909	  41584	   2928	 134421	  20d15	drivers/staging/fbtft/built-in.o.new
  88053	  43392	   2928	 134373	  20ce5	drivers/staging/fbtft/built-in.o.old

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:16:59 +01:00
Joe Perches 0a859b31ec staging: fbtft: Make the pointers to s16 init arrays const
This allows making some of the actual arrays const.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:16:59 +01:00
Anthony Brandon eb1d69c21c staging:fbtft: Fix some warnings regarding types.
Running make C=1 M=drivers/staging/fbtft reports warnings about conversion
from __be16 to unsigned short. Change the type of the variables being
assigned into __be16 to remove those warnings.

Signed-off-by: Anthony Brandon <anthony@amarulasolutions.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:16:59 +01:00
Julián de Gortari e8e9cd9786 Staging: fbtft: fb_watterott: fix incorrect type in assignments
__be16 type variables should be used with return value of macro
cpu_to_be16()

Signed-off-by: Julián de Gortari <kiototeko@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:16:59 +01:00
Gargi Sharma 027bcc5d28 staging: fbtft: Remove blank line
Remove blank line before closing brace to fix the checkpatch
issue blank lines aren't necessary before a close brace '}'.

Signed-off-by: Gargi Sharma <gs051095@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:16:59 +01:00
Gargi Sharma 4da2f4b775 staging: fbtft: Match alignment with open parentheses
Indent code to match alignment with open parentheses, to
fix the checkpatch issue alignment should match open parenthesis.

Signed-off-by: Gargi Sharma <gs051095@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:16:59 +01:00
Tobin C. Harding 423875c96f staging: fbtft: Add check on strlcpy() return value
Return value of strlcpy() is not checked. Name string is silently
truncated if longer that SPI_NAME_SIZE, whilst not detrimental to
the program logic it would be nice to notify the user. Module is
currently quite verbose, adding extra pr_warn() calls will not overly
impact this verbosity.

Check return value from call to strlcpy(). If source string is
truncated call pr_warn() to notify user.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:16:59 +01:00
Tobin C. Harding dbc364054c staging: fbtft: Replace magic number with constant
Current call to strncmp() uses a magic number. There is a compile
time constant defined for this buffer, included and used already at
other sites in the file.

Remove magic number. Replace with pre-existing compile time constant.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:16:59 +01:00
Tobin C. Harding 8414fe11ba staging: fbtft: Fix buffer overflow vulnerability
Module copies a user supplied string (module parameter) into a buffer
using strncpy() and does not check that the buffer is null terminated.

Replace call to strncpy() with call to strlcpy() ensuring that the
buffer is null terminated.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:16:59 +01:00
Umang Raghuvanshi 307a082484 staging: fbtft: fix unaligned parentheses
Fix the following formatting issues:
CHECK: Alignment should match open parenthesis

Signed-off-by: Umang Raghuvanshi <u@umangis.me>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-05 18:31:04 +01:00
Arnd Bergmann 22eb36b814 staging: fbtft: change 'gamma' array to u32
Having a local variable of 1024 bytes on 64-bit architectures is a bit
too much, and I ran into this warning while trying to see what functions
use the largest stack:

drivers/staging/fbtft/fbtft-sysfs.c: In function 'store_gamma_curve':
drivers/staging/fbtft/fbtft-sysfs.c:132:1: warning: the frame size of 1032 bytes is larger than 1024 bytes [-Wframe-larger-than=]

As there is no need for 64-bit gamma values (on 32-bit architectures,
we don't use those either), I'm changing the type from 'unsigned long'
to 'u32' here, which cuts the required space in half everywhere.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-03 13:01:36 +01:00
Umang Raghuvanshi 62f79ecdb8 staging: fbtft: fix unaligned parentheses
Fix the following formatting issues:
CHECK: Alignment should match open parenthesis

Signed-off-by: Umang Raghuvanshi <u@umangis.me>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-27 09:40:56 +01:00
Abdul Rauf ced04842d2 staging: fbtft: fix checkpatch decimal permissions error
Fix the following errors:
Use 4 digit octal (0777) not decimal permissions

Signed-off-by: Abdul Rauf <abdulraufmujahid@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-25 11:33:21 +01:00
Amitesh Singh d58812486b staging: fbtft: remove duplicate entries of ili9225
There are multiple entries for ili9225 display defined in
flexfb_chip_table array. remove duplicate entries and
keep single entry.

Signed-off-by: Amitesh Singh <singh.amitesh@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-25 11:33:21 +01:00
Andy Shevchenko 09249ecdfd staging: fbtft: fb_ssd1306: Refactor write_vmem()
Refactor write_vmem() for sake of readability.

While here, fix indentation in one comment.

Acked-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-19 12:50:28 +01:00
Andy Shevchenko 95ecde0f65 staging: fbtft: fb_ssd1306: Support smaller screen sizes
There is 64x48 display exists. In order to support that set multiplexer
to 48 pixels and window address to proper position in the graphic display
data RAM.

Acked-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-19 12:50:28 +01:00
Andy Shevchenko 09142c17da staging: fbtft: propagate error code from kstrto*()
kstrto*() functions return proper error code.

Do propogate it to the user.

Acked-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-19 12:50:27 +01:00
Andy Shevchenko 7c3eaadd02 staging: fbtft: remove custom DMA mapped buffer
There is no need to duplicate what SPI core already does, i.e. mapping buffers
for DMA capable transfers.

Remove all related pices of code.

Note, that code, besides its redundancy, was buggy: DMA address potentially can
be 0, SPI slave device has nothing to do with DMA capable device properties and
DMA mask in particular.

Suggested-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-19 12:50:27 +01:00
Andy Shevchenko 9ed2bfb3e3 staging: fbtft: convert fbtft_reset() to be non-atomic
First of all, fbtft in current state doesn't allow to override GPIOs to be
optional, like "reset" one. It might be a bug somewhere, but rather out of
scope of this fix.

Second, not all GPIOs available on the board would be SoC based, some of them
might sit on I2C GPIO expanders, for example, on Intel Edison/Arduino, and thus
any communication with them might sleep.

Besides that using udelay() and mdelay() is kinda resource wasteful.

Summarize all of the above, convert fbtft_reset() function to non-atomic
variant by using gpio_set_value_cansleep(), usleep_range(), and msleep().

Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-19 12:50:27 +01:00
Stefano Manni 0367cd002c staging: fbtft: replace decimal with 4-digit octal permissions
Following error detected by checkpatch.pl:

ERROR: Use 4 digit octal (0777) not decimal permissions

Signed-off-by: Stefano Manni <stefano.manni@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-19 10:53:15 +01:00
Scott Matheina 6b5f707c94 staging: fbtft: fix code alignment with open parenthesis
These changes where identified by checkpatch.pl as needed changes to
align the code with the linux development coding style. The several
lines of text where aligned with the precending parenthesis.

Signed-off-by: Scott Matheina <scott@matheina.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-03 16:33:17 +01:00
Maninder Singh 1007e6136c staging: fbtft: Fix 'line over 80 characters'
This patch fixes the following checkpatch.pl warning
WARNING: line over 80 characters

Signed-off-by: Maninder Singh <maninder.s2@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-10 13:55:02 +01:00
Nadim Almas c444ebc83e Staging:fbtft: Replace decimal permissions with 4 digit octal
ERROR: Use 4 digit octal (0777) not decimal permissions

This error was detected by checkpatch.pl

Signed-off-by: Nadim Almas <nadim.902@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-25 09:50:53 +02:00
Javier Martinez Canillas f2503acfe3 staging: fbtft: Fix module autoload
If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the module alias information using the MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/staging/fbtft/flexfb.ko | grep alias
$

After this patch:

$ modinfo drivers/staging/fbtft/flexfb.ko | grep alias
alias:          platform:flexpfb

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-25 09:50:52 +02:00
Gustavo A. R. Silva 5cf793714e Staging: fbtft: Fix too many leading tabs warning
This is a patch to the fb_agm1264k-fl.c file that fixes up the following
issue:

WARNING: Too many leading tabs - consider code refactoring

Add new function iterate_diffusion_matrix() to refactor a piece of code
inside write_vmem().

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-16 10:26:14 +02:00
Joe Perches 9f8e0562e3 staging: fbtft: Convert int arrays to s16
These arrays use -1, -2, and -3 as initiators for various types of
writes to initialize hardware.

No values are used that conflict with using these arrays as s16
instead of int and reducing overall data is good.

$ size drivers/staging/fbtft/built-in.o*
   text	   data	    bss	    dec	    hex	filename
 116120	  32872	   4152	 153144	  25638	drivers/staging/fbtft/built-in.o.new
 116104	  36344	   6200	 158648	  26bb8	drivers/staging/fbtft/built-in.o.old

Miscellaneous:

o Realign some of the arrays to make reading a bit easier

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-16 10:26:13 +02:00
Harman Kalra b1e9c8b76c Staging: fbtft: Fixed open parenthesis alignment check
This patch resolves all the following CHECKs caught by checkpatch.pl
CHECK: Alignment should match open parenthesis

Signed-off-by: Harman Kalra <harman4linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-16 10:25:08 +02:00
Ksenija Stanojevic fc1e2c8ea8 Staging: fbtft: Fix bug in fbtft-core
Commit 367e8560e8 introduced a bug
in fbtft-core where fps is always 0, this is because variable
update_time is not assigned correctly.

Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
Fixes: 367e8560e8 ("Staging: fbtbt: Replace timespec with ktime_t")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-02 19:51:05 +02:00
Carlos Palminha 52b4f6e081 staging: fbtft: fix NULL comparison checkpatch warning
Fixed the following checkpatch warnings (task #10 of eudyptula challenge):
- NULL comparison rewritten to use '!' operator

Signed-off-by: Carlos Palminha <palminha@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-02 17:18:38 +02:00
Sandhya Bankar 604e383c52 Staging: fbtft: Use !x instead of x == NULL.
Use !x instead of x == NULL. This patch was found by checkpatch.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-18 12:38:27 +02:00
Gargi Sharma e3f680ddae staging: fbtft: add spaces around <<
add spaces around << to fix the checkpatch issue, spaces preferred
around that '<<'.

Signed-off-by: Gargi Sharma <gs051095@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-16 10:31:18 +02:00
Gargi Sharma 007afa8bd3 staging: fbtft: move && operator for logical continuation
Move && up to the previous line, to fix the checkpatch issue Logical
continuations should be on the previous line.

Signed-off-by: Gargi Sharma <gs051095@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-16 10:31:18 +02:00
Anson Jacob 7bba53e9c2 staging: fbtft: fb_tls8204: Fix checkpatch warning
Fix checkpatch.pl warning:
Block comments use * on subsequent lines
Block comments use a trailing */ on a separate line

Signed-off-by: Anson Jacob <ansonjacob.aj@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-01 18:03:22 +02:00
Anson Jacob fe9b610b37 staging: fbtft: fbtft_device: Fix checkpatch warning
Fix checkpatch.pl warning:
Block comments use * on subsequent lines
Block comments use a trailing */ on a separate line

Signed-off-by: Anson Jacob <ansonjacob.aj@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-01 18:03:22 +02:00
Anson Jacob b2ac4a9270 staging: fbtft: fbtft-bus: Fix checkpatch warning
Fix checkpatch.pl warning:
Block comments use * on subsequent lines
Block comments use a trailing */ on a separate line

Signed-off-by: Anson Jacob <ansonjacob.aj@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-01 18:03:22 +02:00
Anson Jacob a4f368dcaf staging: fbtft: fb_st7735r: Fix checkpatch warning
Fix checkpatch.pl warning:
Block comments use * on subsequent lines
Block comments use a trailing */ on a separate line

Signed-off-by: Anson Jacob <ansonjacob.aj@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-01 18:03:22 +02:00
Anson Jacob ba6ed6431b staging: fbtft: fb_ssd1331: Fix checkpatch warning
Fix checkpatch.pl warning:
Block comments use * on subsequent lines

Signed-off-by: Anson Jacob <ansonjacob.aj@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-01 18:03:22 +02:00
Anson Jacob d0b6ecbedd staging: fbtft: fb_ssd1306: Fix checkpatch warning
Fix checkpatch.pl warning:
Block comments use * on subsequent lines
Block comments use a trailing */ on a separate line

Signed-off-by: Anson Jacob <ansonjacob.aj@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-01 18:03:21 +02:00
Anson Jacob b2a8bb7749 staging: fbtft: fb_ssd1289: Fix checkpatch warning
Fix checkpatch.pl warning:
Block comments use * on subsequent lines

Signed-off-by: Anson Jacob <ansonjacob.aj@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-01 18:03:21 +02:00
Anson Jacob a40fe1555b staging: fbtft: fb_s6d1121.c: Fix checkpatch warning
Fix checkpatch.pl warning:
Block comments use * on subsequent lines

Signed-off-by: Anson Jacob <ansonjacob.aj@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-01 18:03:21 +02:00
Anson Jacob 8c21f39cb5 staging: fbtft: fb_s6d02a1.c: Fix checkpatch warning
Fix checkpatch.pl warning:
Block comments use * on subsequent lines
Block comments use a trailing */ on a separate line

Signed-off-by: Anson Jacob <ansonjacob.aj@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-01 18:03:21 +02:00
Prit Raj ea40d674e5 staging: fbtft: This patch fixes the checkpatch.pl warning
WARNING: Statements should start on a tabstop

Signed-off-by: Prit Raj <prit.adra@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-21 17:52:47 +02:00
Ming Yang 1c41494adf Staging: fbtft: fixed unsigned type warnings
Replace unsigned by unsigned int in fbtft driver.  Issue found by
checkpatch.

Signed-off-by: Ming Yang <minos.future@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-21 17:52:47 +02:00
Michal Suchanek 175f5a4130 staging: fbtft: do not allocate huge txbuf
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.

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 <hramrach@gmail.com>
Acked-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-21 17:52:47 +02:00
Sandhya Bankar 60abe3510e Staging: fbtft: fb_agm1264k-fl: No space is necessary after cast.
No space is necessary after cast.This problem is found  by checkpatch.pl script.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28 07:30:36 -07:00
Sandhya Bankar 8d771ea8bf Staging: fbtft: fbtft-io: No space is necessary after cast.
No space is necessary after cast.This patch is found by checkpatch.pl script.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28 07:30:36 -07:00
Sandhya Bankar 8cd977c316 Staging: fbtft: fbtft_device: No space is necessary after cast.
No space is necessary after cast.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28 07:30:36 -07:00
Janani Ravichandran 5084d7c662 staging: fbtft: fb_uc1611.c: Drop void pointer cast
Void pointers need not be cast to other pointer types.
Semantic patch used:

@r@
expression x;
void* e;
type T;
identifier f;
@@

(
  *((T *)e)
|
  ((T *)x) [...]
|
  ((T *)x)->f
|
- (T *)
  e
)

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Janani Ravichandran 264cd1d1c2 staging: fbtft: fb_ra8875.c: Remove unneeded void pointer cast
Void pointers need not be cast to other pointer types.
Semantic patch used:

@r@
expression x;
void* e;
type T;
identifier f;
@@

(
  *((T *)e)
|
  ((T *)x) [...]
|
  ((T *)x)->f
|
- (T *)
  e
)

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Janani Ravichandran 64f93e1724 staging: fbtft: fbtft-bus.c: Drop unneeded void pointer cast
Remove unneeded cast on the void pointer par->txbuf.buf .
Semantic patch used:

@r@
expression x;
void* e;
type T;
identifier f;
@@

(
  *((T *)e)
|
  ((T *)x) [...]
|
  ((T *)x)->f
|
- (T *)
  e
)

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Amitoj Kaur Chawla 0c9ab986e2 staging: fbtft: Use devm_kcalloc instead of devm_kzalloc
Replace devm_kzalloc with devm_kcalloc to ensure there are no integer
overflows from the multiplication of a number * sizeof

The following Coccinelle semantic patch was used to make this change:
//<smpl>
@@
expression dev,E1,E2,E3,E4;
@@

- devm_kzalloc(dev,E1*E2*sizeof(E3),E4)
+ devm_kcalloc(dev,E1*E2,sizeof(E3),E4)
//</smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Amitoj Kaur Chawla 71e03f1038 staging: fbtft: Remove unnecessary spi_set_drvdata()
Unnecessary spi_set_drvdata() has been removed since the driver
core clears the driver data to NULL after device release or on
probe failure. There is no need to manually clear the device
driver data to NULL.

The Coccinelle semantic patch used to make this change is as follows:
@@
struct spi_device *spi;
@@
- spi_set_drvdata(spi, NULL);
// </smpl>

Due to this removal, variable `spi` was unused so dropped `spi`

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Alison Schofield 3589d3c9e3 staging: fbtft: replace ternary operator with min macro
Use macro min() to get the minimum of two values for
brevity and readability.

Found using Coccinelle:
@@ type T; T x; T y; @@
(
- x < y ? x : y
+ min(x,y)
|
- x > y ? x : y
+ max(x,y)
)

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar 7ce1b3d3ca staging: fbtft: Use kmalloc_array
Use kmalloc_array instead of kmalloc for arrays to prevent integer
overflows.
This was done using Coccinelle:

@@
expression e1, e2;
constant C;
type t;
@@
(
- kmalloc(
+ kmalloc_array(
e2
- *
+ ,
sizeof(e1), C)
|
- kmalloc(
+ kmalloc_array(
e1
- *
+ ,
sizeof(t), C)
|
- kmalloc(
+ kmalloc_array(
- sizeof(e1)
- *
e2
+ ,
+ sizeof(e1)
, C)
|
- kmalloc(
+ kmalloc_array(
- sizeof(t)
- *
e1
+ ,
+ sizeof(t)
, C)
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Anchal Jain e4d1bff1e4 staging: fbtft: Fix block comment coding style
Add the required leading * on subsequent lines as well as
move the */ on a separate line. Checkpatch found this issue.

Signed-off-by: Anchal Jain <anchalj109@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 15:09:57 -08:00
Eva Rachel Retuya 61abd03a3d staging: fbtft: Remove the use of CamelCase
Rename the macro defining constant ROWxCOL into ROW_X_COL to remove
checkpatch check concerning use of CamelCase and to achieve better
readability.

CHECK: Avoid CamelCase: <ROWxCOL>

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 16:22:49 -08:00
Eva Rachel Retuya ead3c5ce50 staging: fbtft: Delete blank line after '{' brace
Omit the whitespace after '{' brace as suggested by checkpatch.

CHECK: Blank lines aren't necessary after an open brace '{'

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 16:22:49 -08:00
Eva Rachel Retuya b4ac6b2885 staging: fbtft: Insert blank line after function declaration
Insert the required whitespace after the function declaration as
suggested by checkpatch.

CHECK: Please use a blank line after function/struct/union/enum
declarations

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 16:22:49 -08:00
Eva Rachel Retuya f07e89ce1e staging: fbtft: Fix alignment to match open parenthesis
Fix alignment issues by properly indenting function parameters in
accordance to the kernel coding style. Checkpatch pointed out this
issue.

CHECK: Alignment should match open parenthesis

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 16:22:49 -08:00
Eva Rachel Retuya 3a334ea510 staging: fbtft: Modify block comments based on kernel coding style
Add the required trailing * on subsequent lines as well as move the */
on a separate line. Checkpatch found this issue.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 16:22:49 -08:00
Eva Rachel Retuya faad1a6cba staging: fbtft: Remove blank line after '{' brace
Omit the whitespace after '{' brace as suggested by checkpatch.

CHECK: Blank lines aren't necessary after an open brace '{'

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-11 19:54:36 -08:00
Eva Rachel Retuya b15cd7e809 staging: fbtft: Add blank line after function declaration
Insert the required whitespace after the function declaration as
suggested by checkpatch.

CHECK: Please use a blank line after function/struct/union/enum
declarations

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-11 19:54:36 -08:00
Eva Rachel Retuya 5f10ef7dce staging: fbtft: Indent to match open parenthesis
Fix alignment issues by properly indenting function parameters in
accordance to the kernel coding style. Checkpatch pointed out this
issue.

CHECK: Alignment should match open parenthesis

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-11 19:54:36 -08:00
Eva Rachel Retuya e0246ea374 staging: fbtft: Fix block comments according to kernel coding style
Add the required trailing * on subsequent lines as well as move the */
on a separate line. Checkpatch found this issue.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-11 19:54:36 -08:00
Alexey Mednyy 12e2a34165 Staging: fbtft: add ssd1325 controller support
That patch adds support for SSD1325 controller.
That is 4bpp grayscale OLED display controller present in several
displays eq: Winstar WEX012864

Signed-off-by: Alexey Mednyy <swexru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:43:05 -08:00
Alexey Mednyy 5795354f75 Staging: fbtft: add ssd1305 controller support
That patch adds support for SSD1305 controller.
That is monochrome OLED display controller present in several
displays eq: Winstar WEX012864

Signed-off-by: Alexey Mednyy <swexru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:43:05 -08:00
Geliang Tang f6bfc25ee0 staging: fbtft: use to_platform_device()
Use to_platform_device() instead of open-coding it.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:42:23 -08:00
Geliang Tang 5d5ccf2196 staging: fbtft: use to_spi_device
Use to_spi_device() instead of open-coding it.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:42:23 -08:00
Priit Laes 817d1648ec staging: fbtft: Remove unused and duplicated defines
This patch makes use of the standard MIPI Display Command Set to remove
some of duplicate defines from the headers.

Signed-off-by: Priit Laes <plaes@plaes.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:41:20 -08:00
Priit Laes 3b2bf2bc18 staging: fbtft: Use standard MIPI DCS command defines for hx8340bn
This patch makes use of the standard MIPI Display Command Set to remove
some of the magic constants found in source code.

Signed-off-by: Priit Laes <plaes@plaes.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:40:18 -08:00
Priit Laes 440176316c staging: fbtft: Use standard MIPI DCS command defines for tinylcd
This patch makes use of the standard MIPI Display Command Set to remove
some of the magic constants found in source code.

Signed-off-by: Priit Laes <plaes@plaes.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:39:27 -08:00
Priit Laes a79cb3901e staging: fbtft: Use standard MIPI DCS command defines for fbtft driver
This patch makes use of the standard MIPI Display Command Set to remove
some of the magic constants found in source code.

Signed-off-by: Priit Laes <plaes@plaes.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:39:27 -08:00
Priit Laes 79f5da7d33 staging: fbtft: Use standard MIPI DCS command defines for st7735r
This patch makes use of the standard MIPI Display Command Set to remove
some of the magic constants found in source code.

Signed-off-by: Priit Laes <plaes@plaes.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:39:27 -08:00
Priit Laes 3d6924dd6a staging: fbtft: Use standard MIPI DCS command defines for s6d02a1
This patch makes use of the standard MIPI Display Command Set to remove
some of the magic constants found in source code.

Signed-off-by: Priit Laes <plaes@plaes.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:39:27 -08:00
Priit Laes 49475ed0cb staging: fbtft: Use standard MIPI DCS command defines for ili9486
This patch makes use of the standard MIPI Display Command Set to remove
some of the magic constants found in source code.

Signed-off-by: Priit Laes <plaes@plaes.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:39:27 -08:00
Priit Laes 89823edc63 staging: fbtft: Use standard MIPI DCS command defines for ili9481
This patch makes use of the standard MIPI Display Command Set to remove
some of the magic constants found in source code.

Signed-off-by: Priit Laes <plaes@plaes.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:39:27 -08:00
Priit Laes 467786c19a staging: fbtft: Use standard MIPI DCS command defines for ili9341
This patch makes use of the standard MIPI Display Command Set to remove
some of the magic constants found in source code.

Signed-off-by: Priit Laes <plaes@plaes.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:39:27 -08:00
Priit Laes 261a984c88 staging: fbtft: Use standard MIPI DCS command defines for ili9340
This patch makes use of the standard MIPI Display Command Set to remove
some of the magic constants found in source code.

Signed-off-by: Priit Laes <plaes@plaes.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:39:27 -08:00
Priit Laes 13c1226992 staging: fbtft: Use standard MIPI DCS command defines for ili9163
This patch makes use of the standard MIPI Display Command Set to remove
some of the magic constants found in source code.

Signed-off-by: Priit Laes <plaes@plaes.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:39:27 -08:00
Priit Laes 9580893255 staging: fbtft: Use standard MIPI DCS command defines for hx8357d
This patch makes use of the standard MIPI Display Command Set to remove
some of the magic constants found in source code.

Signed-off-by: Priit Laes <plaes@plaes.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:39:27 -08:00
Priit Laes fbf461d176 staging: fbtft: Use standard MIPI DCS command defines for hx8353d
This patch makes use of the standard MIPI Display Command Set to remove
some of the magic constants found in source code.

Signed-off-by: Priit Laes <plaes@plaes.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:39:27 -08:00
Ben Gilbert fd59f106f4 Staging: fbtft: Removed commented out/dead code
Deleted various commented out lines that have been replaced by write_reg()

Signed-off-by: Ben Gilbert <gillie59978@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:37:36 -08:00
Nizam Haider 2fe9f8caad Staging: fbtft: fbtft-core: Removed unnecessary checks
The driver core clears the driver data to NULL after device_release
or on probe failure.

Signed-off-by: Nizam Haider <nijamh@cdac.in>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:37:36 -08:00