Commit graph

34 commits

Author SHA1 Message Date
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
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
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
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
Lars Svensson 4b6dc179dc staging: fbtft: use alternate screen pointer
Member screen_base in struct fb_info is declared with __iomem
qualifier causing sparse warnings when used as a regular ponter.
To avoid the warnings, instead use alternate non-__iomem pointer,
screen_buffer, troughout the driver.

Signed-off-by: Lars Svensson <lars1.svensson@sonymobile.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-13 10:51:30 -07:00
Ksenija Stanojevic 367e8560e8 Staging: fbtbt: Replace timespec with ktime_t
struct timespec will overflow in year 2038, so replace it with
ktime_t. And replace functions that use struct timespec,
timespec_sub with ktime_sub. Also use monotonic time instead of real
time, by replacing getnstimeofday with ktime_get, to be more robust
against leap seconds and settimeofday() calls.

Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-08 10:50:27 +01:00
Shraddha Barke 6f6347ef49 Staging: fbtft: Remove debug messages related to DEBUG_BACKLIGHT
Remove debug messages related to fbtft_par_dbg(DEBUG_BACKLIGHT.. )
as this info can be obtained using kernel function tracer

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-02 11:31:29 +02:00
Greg Kroah-Hartman bcabc6f328 Merge 4.3-rc3 into staging-next
We want the staging fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-29 01:52:40 +02:00
Shraddha Barke 64ffdc383b Staging: fbtft: Remove debug messages
Remove debug messages related to fbtft_par_dbg(DEBUG_INIT_DISPLAY.. )
as this info can be obtained using kernel function tracer

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-21 09:56:50 -07:00
Stefan Wahren cabb5b2a28 staging: fbtft: fix 9-bit SPI support detection
Since the result of the setup function isn't adequate to check
9-bit SPI support, we better check bits_per_word_mask. Btw this
change avoids a NULL pointer dereference with master drivers
without a separate setup function.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Acked-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-13 09:33:58 -07:00
Anish Bhatt 94c0a54427 staging/fbtft : Add missing whitespace around operators
Add blank spaces around operators where recommended
by checkpatch.pl

Signed-off-by: Anish Bhatt <anish@chelsio.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12 18:24:37 -07:00
Anish Bhatt 1014c2ce08 staging/fbtft : Fix multiple/missing blank line issues
Remove or add blank lines as recommended by checkpatch.pl

Signed-off-by: Anish Bhatt <anish@chelsio.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12 18:24:36 -07:00
Anish Bhatt e73221877a staging/fbtft : Remove repeated set_addr_win debug messages
fbtft_par_dbg(DEBUG_SET_ADDR_WIN.. ) is repeated in every
set_addr_win() handler, this could be replicated by using the kernel
function tracer instead.

Signed-off-by: Anish Bhatt <anish@chelsio.com>
Suggested-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12 18:24:36 -07:00
Mike Rapoport ed20c6fbf7 staging: fbtft: fbtft_request_gpios: reduce nesting
Returning immediately if no platform_data or platform_data->gpios is
specified reduceis code nesting

Signed-off-by: Mike Rapoport <mike.rapoport@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12 18:24:35 -07:00
Mike Rapoport c18d116d92 staging: fbtft: fbtft-core: define backlight_ops statically
instead of devm_kzalloc'ing them

Signed-off-by: Mike Rapoport <mike.rapoport@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12 18:24:35 -07:00
Mike Rapoport e7f506bd0e staging: fbtft: remove unused bl_ops from fbtft_unregister_backlight
The only usage of bl_ops variable in fbtft_unregister_backlight function
was assigment of a value to that variable, therefore the assignment and
the variable itself can be safely removed

Signed-off-by: Mike Rapoport <mike.rapoport@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12 18:24:35 -07:00
Anish Bhatt 4a1a838362 staging/fbtft : Remove FSF mailing address
checkpatch.pl recommends that this is no longer required.
Also replaces ASCII-art copyright notice with simple text

Signed-off-by: Anish Bhatt <anish@chelsio.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12 18:24:35 -07:00
Noralf Trønnes ad6d8812aa staging: fbtft: core: Don't set device platform_data
Pass platform_data as an argument to fbtft_framebuffer_alloc()
instead of using dev->platform_data.

This fixes an issue where the device comes from Device Tree
and fbtft_probe_common() sets dev->platform_data to allocated
memory. When the module is reloaded, dev->platform_data points
to freed memory.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-03 17:45:02 -07:00
Noralf Trønnes dc4b206893 staging: fbtft: Add reset to fbtft_init_display_dt()
When an init sequence is present in the Device Tree,
fbtft_init_display_dt() is used to initialize the display.
Add missing reset function call and activation of
chip select for parallel bus.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-14 19:16:16 -07:00
Sudip Mukherjee 11f2323ad3 staging: fbtft: fix build error
while building on i386 it gives a build warning about msg undeclared.

Fixes: e6ffd1ba55 ("staging: fbtft: fix out of bound access")
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-09 10:37:52 -07:00
Sudip Mukherjee e6ffd1ba55 staging: fbtft: fix out of bound access
str was 16 bytes but was mentioned as 128 in snprintf.
again msg is 128 bytes but not sufficient to hold the complete debug
message of register values.
Now removed the use of str, msg and print the register values from the
loop.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-08 13:22:45 -07:00
Madhusudhanan Ravindran b38c760ab0 staging: fbtft: replace fbtft_dev_dbg with standard dev_dbg call
This patch attempts to simplify the debugging using standard
dev_dbg call so that individual debug prints can be enabled or
disbled by dynamic debugging rather than using module params.

Signed-off-by: Madhusudhanan Ravindran <mravindr@visteon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-08 13:21:37 -07:00
Geert Uytterhoeven 8e1a4c7f71 staging: fbtft: Disable DMA support if DMA is not available
If NO_DMA=y:

    drivers/built-in.o: In function `fbtft_framebuffer_alloc':
    (.text+0xb53cae): undefined reference to `dmam_alloc_coherent'

As DMA support is already optional, make it depend on HAS_DMA.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-30 16:51:21 +02:00
Masanari Iida 92def781ee staging: fbtft: Fix typo in fbtft
This patch fix spelling typo in comment and printk within fbtft

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-26 13:07:29 +01:00
Drew Fustini d9fabbde63 Staging: fbtft: add header for internal functions
Remove extern keyword from function prototypes to suppress warning from
checkpatch.pl with --strict option: https://lkml.org/lkml/2013/7/23/422

fbtft maintainer Noralf Tronnes advised these functions are internal to
this module & suggested moving these prototypes to new internal.h file.
He also advised fbtft.h file will eventually live in include/linux/fbtft.h

Suggested-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Drew Fustini <pdp7pdp7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-06 16:44:13 -08:00
Haneen Mohammed aed1c72e44 Staging: fbtft: clean dev_err() logging
This patch removes  __func__ from dev_err. dev_err includes information about:
(devcice, driver, specific instance of device, etc) in the log printout.
This was done using Coccinelle, with the following semantic patch:

@a@
expression E, R;
expression  msg;
@@

dev_err(E, msg, __func__, R);

@script:python b@
e << a.msg;
y;
@@

if(e.find("%s: ") == True):
	m = e.replace("%s: ", "", 1);
	coccinelle.y = m;
elif(e.find("%s ") == True):
	m = e.replace("%s ", "", 1);
	coccinelle.y = m;
elif(e.find("%s:") == True):
	m = e.replace("%s:", "", 1);
	coccinelle.y = m;
else:
	m = e.replace("%s", "",1);
	coccinelle.y = m;

@c@
expression a.E, a.msg, a.R;
identifier  b.y;
@@

- dev_err(E, msg, __func__, R);
+ dev_err(E, y, R);

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-06 15:55:36 -08:00
Dilek Uzulmez 6cb624ef71 Staging: fbtft: Remove unnecessary 'out of memory' message.
This patch fixes checkpatch.pl warning in file fbtft-core.c
WARNING: Possible unnecessary 'out of memory' message

Signed-off-by: Dilek Uzulmez <dilekuzulmez@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-06 09:54:25 -08:00
Yeliz Taneroglu 6ba67a5a7b Staging: fbtft-core: remove unnecessary line continuations
This fixes the checkpatch.pl warning:
WARNING: Avoid unnecessary line continuations

Signed-off-by: Yeliz Taneroglu <yeliztaneroglu@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-06 09:54:25 -08:00
Fabio Estevam 3fed5bac16 staging: fbtft: fbtft-core: Use '%zu' to print 'size_t' format
When building for ARM64 the following build warning is seen:

drivers/staging/fbtft/fbtft-core.c:1004:4: warning: format '%d' expects argument of type 'int', but argument 3 has type 'size_t' [-Wformat=]

Use '%zu' to print 'size_t' format.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-01 17:13:12 -08:00
Aya Mahfouz 11107ffe2c staging: fbtft: remove unused variable
This patch removes a variable that was simply used to
store the return value of a function call before
returning it.

The issue was detected and resolved using the following
coccinelle script:

@@
identifier len,f;
@@

-int len;
 ... when != len
     when strict
-len =
+return
        f(...);
-return len;

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-01 16:57:36 -08:00
Aya Mahfouz 7e059db655 staging: fbtft: fix space prohibited before that ','
This patch fixes the following checkpatch.pl error:
fix space prohibited before that ','

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-26 13:06:59 -08:00
Krzysztof Adamski ed2084360d staging: fbtft: fbtft-core mark functions static
This fixes sparse warnings like:
     warning: symbol XXX was not declared. Should it be static?

by declaring all local functions static.

Signed-off-by: Krzysztof Adamski <k@japko.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-25 20:07:36 +08:00
Thomas Petazzoni c296d5f995 staging: fbtft: core support
This commit adds the core fbtft framework from
https://github.com/notro/fbtft.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Noralf Tronnes <notro@tronnes.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-17 16:44:41 -08:00