Commit graph

152 commits

Author SHA1 Message Date
Harsh Jain
f08ab0abb6 staging: kpc2000: Fix long constant sparse warning
It fixed following warning in kpc2000 driver
"constant XXXX is so big it is unsigned long"

Signed-off-by: Harsh Jain <harshjain32@gmail.com>
Link: https://lore.kernel.org/r/20190831115532.2398-1-harshjain32@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-09-03 09:39:48 +02:00
Eduardo Barretto
1327d35ac3 staging: kpc2000: kpc2000_i2c: Fix different address spaces warnings
This patch fixes the following sparse warnings:

kpc2000_i2c.c:137: warning: incorrect type in argument 1
                                   (different address spaces)
kpc2000_i2c.c:137:    expected void const volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:137:    got void *
kpc2000_i2c.c:146: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:146:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:146:    got void *
kpc2000_i2c.c:147: warning: incorrect type in argument 1
                                   (different address spaces)
kpc2000_i2c.c:147:    expected void const volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:147:    got void *
kpc2000_i2c.c:166: warning: incorrect type in argument 1
                                   (different address spaces)
kpc2000_i2c.c:166:    expected void const volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:166:    got void *
kpc2000_i2c.c:166: warning: incorrect type in argument 2
                                  (different address spaces)
kpc2000_i2c.c:166:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:166:    got void *
kpc2000_i2c.c:168: warning: incorrect type in argument 1
                                   (different address spaces)
kpc2000_i2c.c:168:    expected void const volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:168:    got void *
kpc2000_i2c.c:168: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:168:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:168:    got void *
kpc2000_i2c.c:171: warning: incorrect type in argument 1
                                   (different address spaces)
kpc2000_i2c.c:171:    expected void const volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:171:    got void *
kpc2000_i2c.c:174: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:174:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:174:    got void *
kpc2000_i2c.c:193: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:193:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:193:    got void *
kpc2000_i2c.c:194: warning: incorrect type in argument 1
                                   (different address spaces)
kpc2000_i2c.c:194:    expected void const volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:194:    got void *
kpc2000_i2c.c:214: warning: incorrect type in argument 2
                                  (different address spaces)
kpc2000_i2c.c:214:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:214:    got void *
kpc2000_i2c.c:219: warning: incorrect type in argument 1
                                  (different address spaces)
kpc2000_i2c.c:219:    expected void const volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:219:    got void *
kpc2000_i2c.c:226: warning: incorrect type in argument 2
                                  (different address spaces)
kpc2000_i2c.c:226:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:226:    got void *
kpc2000_i2c.c:238: warning: incorrect type in argument 1
                                   (different address spaces)
kpc2000_i2c.c:238:    expected void const volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:238:    got void *
kpc2000_i2c.c:244: warning: incorrect type in argument 2
                                  (different address spaces)
kpc2000_i2c.c:244:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:244:    got void *
kpc2000_i2c.c:252: warning: incorrect type in argument 1
                                  (different address spaces)
kpc2000_i2c.c:252:    expected void const volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:252:    got void *
kpc2000_i2c.c:257: warning: incorrect type in argument 2
                                  (different address spaces)
kpc2000_i2c.c:257:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:257:    got void *
kpc2000_i2c.c:259: warning: incorrect type in argument 2
				   (different address spaces)
kpc2000_i2c.c:259:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:259:    got void *
kpc2000_i2c.c:267: warning: incorrect type in argument 1
                                   (different address spaces)
kpc2000_i2c.c:267:    expected void const volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:267:    got void *
kpc2000_i2c.c:273: warning: incorrect type in argument 1
                                   (different address spaces)
kpc2000_i2c.c:273:    expected void const volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:273:    got void *
kpc2000_i2c.c:293: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:293:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:293:    got void *
kpc2000_i2c.c:294: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:294:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:294:    got void *
kpc2000_i2c.c:309: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:309:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:309:    got void *
kpc2000_i2c.c:312: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:312:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:312:    got void *
kpc2000_i2c.c:317: warning: incorrect type in argument 1
                                   (different address spaces)
kpc2000_i2c.c:317:    expected void const volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:317:    got void *
kpc2000_i2c.c:324: warning: incorrect type in argument 1
                                   (different address spaces)
kpc2000_i2c.c:324:    expected void const volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:324:    got void *
kpc2000_i2c.c:328: warning: incorrect type in argument 1
                                   (different address spaces)
kpc2000_i2c.c:328:    expected void const volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:328:    got void *
kpc2000_i2c.c:329: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:329:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:329:    got void *
kpc2000_i2c.c:330: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:330:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:330:    got void *
kpc2000_i2c.c:338: warning: incorrect type in argument 1
                                   (different address spaces)
kpc2000_i2c.c:338:    expected void const volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:338:    got void *
kpc2000_i2c.c:340: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:340:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:340:    got void *
kpc2000_i2c.c:342: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:342:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:342:    got void *
kpc2000_i2c.c:350: warning: incorrect type in argument 1
                                  (different address spaces)
kpc2000_i2c.c:350:    expected void const volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:350:    got void *
kpc2000_i2c.c:350: warning: incorrect type in argument 2
                                  (different address spaces)
kpc2000_i2c.c:350:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:350:    got void *
kpc2000_i2c.c:351: warning: incorrect type in argument 1
                                   (different address spaces)
kpc2000_i2c.c:351:    expected void const volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:351:    got void *
kpc2000_i2c.c:414: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:414:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:414:    got void *
kpc2000_i2c.c:420: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:420:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:420:    got void *
kpc2000_i2c.c:422: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:422:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:422:    got void *
kpc2000_i2c.c:427: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:427:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:427:    got void *
kpc2000_i2c.c:428: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:428:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:428:    got void *
kpc2000_i2c.c:430: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:430:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:430:    got void *
kpc2000_i2c.c:435: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:435:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:435:    got void *
kpc2000_i2c.c:436: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:436:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:436:    got void *
kpc2000_i2c.c:438: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:438:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:438:    got void *
kpc2000_i2c.c:439: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:439:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:439:    got void *
kpc2000_i2c.c:445: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:445:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:445:    got void *
kpc2000_i2c.c:446: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:446:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:446:    got void *
kpc2000_i2c.c:454: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:454:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:454:    got void *
kpc2000_i2c.c:459: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:459:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:459:    got void *
kpc2000_i2c.c:461: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:461:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:461:    got void *
kpc2000_i2c.c:472: warning: incorrect type in argument 1
                                   (different address spaces)
kpc2000_i2c.c:472:    expected void const volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:472:    got void *
kpc2000_i2c.c:472: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:472:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:472:    got void *
kpc2000_i2c.c:475: warning: incorrect type in argument 1
                                   (different address spaces)
kpc2000_i2c.c:475:    expected void const volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:475:    got void *
kpc2000_i2c.c:475: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:475:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:475:    got void *
kpc2000_i2c.c:493: warning: incorrect type in argument 1
                                   (different address spaces)
kpc2000_i2c.c:493:    expected void const volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:493:    got void *
kpc2000_i2c.c:493: warning: incorrect type in argument 2
                                   (different address spaces)
kpc2000_i2c.c:493:    expected void volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:493:    got void *
kpc2000_i2c.c:512: warning: incorrect type in argument 1
                                   (different address spaces)
kpc2000_i2c.c:512:    expected void const volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:512:    got void *
kpc2000_i2c.c:516: warning: incorrect type in argument 1
                                   (different address spaces)
kpc2000_i2c.c:516:    expected void const volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:516:    got void *
kpc2000_i2c.c:516: warning: incorrect type in argument 1
                                   (different address spaces)
kpc2000_i2c.c:516:    expected void const volatile [noderef] <asn:2> *addr
kpc2000_i2c.c:516:    got void *

Signed-off-by: Eduardo Barretto <edusbarretto@gmail.com>
Link: https://lore.kernel.org/r/20190818183555.7167-1-edusbarretto@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-08-21 05:48:06 -07:00
Greg Kroah-Hartman
9a675a13c3 Revert "staging: kpc2000: Convert put_page() to put_user_page*()"
This reverts commit 8e7cb7352e.

Bharath writes:
	Could you drop this patch from the staging-next tree? This is
	because John is making some changes to the put_user_page*()
	functions. He has submitted a patch recently removing
	put_user_page_dirty() function which is being used in this
	patch. This might break the kernel build if John's patch gets
	merged in.

	I ll submit a patch once the put_user_page*() apis are fixed.

Reported-by: Bharath Vedartham <linux.bhar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-31 07:28:04 +02:00
Bharath Vedartham
8e7cb7352e staging: kpc2000: Convert put_page() to put_user_page*()
For pages that were retained via get_user_pages*(), release those pages
via the new put_user_page*() routines, instead of via put_page().

This is part a tree-wide conversion, as described in commit fc1d8e7cca
("mm: introduce put_user_page*(), placeholder versions").

Cc: Ira Weiny <ira.weiny@intel.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Jérôme Glisse <jglisse@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Matt Sickler <Matt.Sickler@daktronics.com>
Cc: devel@driverdev.osuosl.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org
Reviewed-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Bharath Vedartham <linux.bhar@gmail.com>
Link: https://lore.kernel.org/r/1564058658-3551-1-git-send-email-linux.bhar@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-30 09:54:48 +02:00
YueHaibing
d59381d639 staging: kpc2000: kpc_spi: Remove unnecessary null check before kfree
A null check before a kfree is redundant, so remove it.
This is detected by coccinelle.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20190711140726.46732-1-yuehaibing@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-22 07:34:13 +02:00
Simon Sandström
5d15324829 staging: kpc2000: simplify comparison to NULL in fileops.c
Fixes checkpatch warning "Comparison to NULL could be written [...]".

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Link: https://lore.kernel.org/r/20190704060811.10330-4-simon@nikanor.nu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-04 10:40:44 +02:00
Simon Sandström
a50d99d401 staging: kpc2000: simplify comparison to NULL in dma.c
Fixes checkpatch warning "Comparison to NULL could be written [...]".

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Link: https://lore.kernel.org/r/20190704060811.10330-3-simon@nikanor.nu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-04 10:40:44 +02:00
Simon Sandström
209ff937b0 staging: kpc2000: simplify comparison to NULL in kpc2000_spi.c
Fixes checkpatch warning "Comparison to NULL could be written [...]".

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Link: https://lore.kernel.org/r/20190704060811.10330-2-simon@nikanor.nu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-04 10:40:44 +02:00
Simon Sandström
6a2ac8d4bf staging: kpc2000: fix brace issues in kpc2000_spi.c
Fixes issues found by checkpatch:

- "WARNING: braces {} are not necessary for single statement blocks"
- "WARNING: braces {} are not necessary for any arm of this statement"

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Link: https://lore.kernel.org/r/20190701091819.18528-1-simon@nikanor.nu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-03 18:32:09 +02:00
Jean Delvare
268d828144 staging: kpc2000: drop useless softdep statement
The i2c-dev module is for access to I2C buses from user-space.
Kernel drivers do not care about its presence.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Matt Sickler <Matt.Sickler@daktronics.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-01 17:44:50 +02:00
Fabian Krueger
d19b75b051 staging: kpc2000: remove needless 'break'
The unconditioned jump will prohibit to ever reach the break-statement.
Deleting this needless statement, the code becomes more understandable.

Signed-off-by: Fabian Krueger <fabian.krueger@fau.de>
Signed-off-by: Michael Scheiderer <michael.scheiderer@fau.de>
Cc: <linux-kernel@i4.cs.fau.de>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-01 09:19:43 +02:00
Fabian Krueger
39e828584b staging: kpc2000: introduce __func__
Instead of using the function name hard coded as string, using __func__
and the '%s'-placeholder will always give the current name of the
function. When renaming a function, the debugging-messages won't have to
be rewritten.

Signed-off-by: Fabian Krueger <fabian.krueger@fau.de>
Signed-off-by: Michael Scheiderer <michael.scheiderer@fau.de>
Cc: <linux-kernel@i4.cs.fau.de>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-01 09:19:43 +02:00
Fabian Krueger
69086fb80d staging: kpc2000: introduce 'unsigned int'
Replaced 'unsigned' with it's equivalent 'unsigned int' to reduce
confusion while reading the code.

Signed-off-by: Fabian Krueger <fabian.krueger@fau.de>
Signed-off-by: Michael Scheiderer <michael.scheiderer@fau.de>
Cc: <linux-kernel@i4.cs.fau.de>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-01 09:19:43 +02:00
Fabian Krueger
ecb87018bb staging: kpc2000: introduce usage of __packed
Replaced __attribute__((packed)) with __packed. Both ways of attributing
are equivalent, but being shorter, __packed should be preferred.
This refactoring makes the core more readable.

Signed-off-by: Fabian Krueger <fabian.krueger@fau.de>
Signed-off-by: Michael Scheiderer <michael.scheiderer@fau.de>
Cc: <linux-kernel@i4.cs.fau.de>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-01 09:19:27 +02:00
Fabian Krueger
c70c7284a0 staging: kpc2000: blank lines after declaration
After the declarations in a function, there should be a blank line, so
that the declaration part is visibly separated from the rest.
This refactoring makes the code more readable.

Signed-off-by: Fabian Krueger <fabian.krueger@fau.de>
Signed-off-by: Michael Scheiderer <michael.scheiderer@fau.de>
Cc: <linux-kernel@i4.cs.fau.de>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-01 09:19:27 +02:00
Fabian Krueger
06ed6146d6 staging: kpc2000: add line breaks
To fix some checkpatch-warnings some lines of this module had to be
shortened so that they do not exceed 80 characters per line.
This refactoring makes the code more readable.

Signed-off-by: Fabian Krueger <fabian.krueger@fau.de>
Signed-off-by: Michael Scheiderer <michael.scheiderer@fau.de>
Cc: <linux-kernel@i4.cs.fau.de>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-01 09:19:23 +02:00
Simon Sandström
8e590ef5b2 staging: kpc2000: add missing spaces in kpc2000_spi.c
Fixes checkpatch errors:
- spaces required around that '=' (ctx:VxV)
- space required before the open parenthesis '('
- spaces preferred around that '-' (ctx:VxV)
- space required before the open brace '{'

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-26 09:56:35 +08:00
Simon Sandström
03c1feff9e staging: kpc2000: add missing spaces in kpc2000_i2c.c
Fixes checkpatch "CHECK: spaces preferred around that '+' (ctx:VxV)".

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-26 09:56:34 +08:00
YueHaibing
10055c6fe2 Staging: kpc2000: kpc_dma: Fix platform_no_drv_owner.cocci warnings
Remove .owner field if calls are used which set it automatically
Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-21 16:46:17 +02:00
Colin Ian King
d326d99aa0 staging: kpc2000: fix integer overflow with left shifts
Currently there are several left shifts that are assigned to 64 bit
unsigned longs where a signed int 1 is being shifted, resulting in
an integer overflow.  Fix this bit using the BIT_ULL macro to perform
a 64 bit shift.  Also clean up an overly long statement.

Addresses-Coverity: ("Unintentional integer overflow")
Fixes: 7dc7967fc3 ("staging: kpc2000: add initial set of Daktronics drivers")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-20 14:39:16 +02:00
Simon Sandström
a50185cbb3 staging: kpc2000: simplify error handling in kp2000_pcie_probe
We can get rid of a few iounmaps in the middle of the function by
re-ordering the error handling labels and adding two new labels.

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-20 14:39:16 +02:00
Simon Sandström
0c3b9b7e19 staging: kpc2000: remove dead code in core.c
Fixes checkpatch warning: "Consider removing the code enclosed by
this #if 0 and its #endif".

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-15 20:54:28 +02:00
Jeremy Sowden
c77a6794c0 staging: kpc2000: removed DMA AIO implementation.
The existing implementation for doing DMA via asynchronous IO didn't
work and there was no longer a use-case for it.  Removed it.

Fixed a few checkpatch warnings about too-long lines and extraneous
braces in the process.

Reported-by: Matt Sickler <matt.sickler@daktronics.com>
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-13 11:39:30 +02:00
Simon Sandström
eafae15fe1 staging: kpc2000: remove unnecessary comments in kp2000_pcie_probe
Much of the code comments in kp2000_pcie_probe just repeats the code and
does not add any additional information. Delete them and make sure that
comments still left in the function all use the same style.

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-13 10:48:50 +02:00
Simon Sandström
fd5a82f4a6 staging: kpc2000: improve label names in kp2000_pcie_probe
Use self-explanatory label names instead of the generic numbered ones,
to make it easier to follow and understand the code.

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-13 10:48:50 +02:00
YueHaibing
0bbb1374f1 Staging: kpc2000: kpc_dma: Make some symbols static
Fix sparse warnings:

drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c:46:6: warning: symbol 'kpc_dma_del_device' was not declared. Should it be static?
drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c:84:1: warning: symbol 'dev_attr_engine_regs' was not declared. Should it be static?
drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c:91:14: warning: symbol 'kpc_dma_class' was not declared. Should it be static?
drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c:199:24: warning: symbol 'kpc_dma_plat_driver_i' was not declared. Should it be static?

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-13 10:47:49 +02:00
Rishiraj Manwatkar
abddd78ef4 staging: kpc2000: Fix: 'kpc_dma_del_device' and other symbols were not declared
This patch removes the Sparse generated warnings. Following warnings are reported by Sparse:
drivers/staging/kpc2000//kpc_dma/kpc_dma_driver.c:46:6: warning: symbol 'kpc_dma_del_device' was not declared. Should it be static?
drivers/staging/kpc2000//kpc_dma/kpc_dma_driver.c:91:14: warning: symbol 'kpc_dma_class' was not declared. Should it be static?
drivers/staging/kpc2000//kpc_dma/kpc_dma_driver.c:199:24: warning: symbol 'kpc_dma_plat_driver_i' was not declared. Should it be static?

Signed-off-by: Rishiraj Manwatkar <manwatkar@outlook.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-13 10:47:12 +02:00
Simon Sandström
a98daf5c5d staging: kpc2000: remove unnecessary debug prints in kpc_dma_driver.c
Debug prints that are used only to inform about function entry or exit
can be removed as ftrace can be used to get this information.

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-10 17:55:07 +02:00
Simon Sandström
7cb0163aa2 staging: kpc2000: remove unnecessary debug prints in fileops.c
Debug prints that are used only to inform about function entry or exit
can be removed as ftrace can be used to get this information.

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-10 17:55:07 +02:00
Simon Sandström
39547bc5e8 staging: kpc2000: remove unnecessary debug prints in dma.c
Debug prints that are used only to inform about function entry or exit
can be removed as ftrace can be used to get this information.

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-10 17:55:07 +02:00
Simon Sandström
fef138203b staging: kpc2000: remove unnecessary debug prints in core.c
Debug prints that are used only to inform about function entry or exit
can be removed as ftrace can be used to get this information.

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-10 17:55:07 +02:00
Simon Sandström
ac6ab6da5b staging: kpc2000: remove unnecessary debug prints in cell_probe.c
Debug prints that are used only to inform about function entry or exit
can be removed as ftrace can be used to get this information.

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-10 17:53:09 +02:00
Naoto Kobayashi
991661e673 staging: kpc2000: remove extra white space in kpc2000_spi.c
Since whitespace should not appear between asterisk and
variable name in a declaration statement, remove it and
fix checkpatch.pl error "foo * bar" should be "foo *bar".

Signed-off-by: Naoto Kobayashi <naoto.kobayashi4c@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-10 17:53:05 +02:00
Hao Xu
58462a4435 staging: kpc2000: kpc2000_i2c: add space after ,
add space after , for #define outb_p(d,a) writeq(d,(void *)a)

Signed-off-by: Hao Xu <haoxu.linuxkernel@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-09 13:07:23 +02:00
Hao Xu
546cbac4ab staging: kpc2000: kpc2000_i2c: void* -> void *
modify void* to void * for #define inb_p(a) readq((void*)a)
and #define outb_p(d,a) writeq(d,(void*)a)

Signed-off-by: Hao Xu <haoxu.linuxkernel@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-09 13:07:23 +02:00
Geordan Neukum
17dcc588d4 staging: kpc2000: kpc_spi: remove unnecessary cast in [read|write]_reg()
The kpc_spi driver unnecessarily casts from a (u64 __iomem *) to a (void
*) when invoking readq and writeq which both take a (void __iomem *) arg.
There is no need for this cast, and it actually harms us by discarding
the sparse cookie, __iomem. Make the driver stop performing this casting
operation.

Signed-off-by: Geordan Neukum <gneukum1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-06 15:05:02 +02:00
Geordan Neukum
fbf476ea29 staging: kpc2000: kpc_spi: remove unnecessary ulong repr of i/o addr
The kpc_spi driver stashes off an unsigned long representation of the
i/o mapping returned by devm_ioremap_nocache(). This is unnecessary, as
the only use of the unsigned long repr is to eventually be re-cast to
an (u64 __iomem *). Instead of casting the (void __iomem *) to an
(unsigned long) then a (u64 __iomem *), just remove this intermediate
step. As this intermediary is no longer used, also remove it from its
structure.

Signed-off-by: Geordan Neukum <gneukum1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-06 15:05:02 +02:00
Geordan Neukum
77a91f4b68 staging: kpc2000: kpc_spi: remove unnecessary struct member chip_select
The structure kp_spi_controller_state, defined in the kpc2000_spi
driver, contains a member named chip_select which is never used after
initialization. Therefore, it should be removed for simplicity's sake.

Signed-off-by: Geordan Neukum <gneukum1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-06 15:05:02 +02:00
Geordan Neukum
dafcc4a546 staging: kpc2000: kpc_spi: remove unnecessary struct member word_len
The structure kp_spi_controller_state, defined in the kpc2000_spi
driver, contains a member named word_len which is never used after
initialization. Therefore, it should be removed for simplicity's sake.

Signed-off-by: Geordan Neukum <gneukum1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-06 15:05:02 +02:00
Geordan Neukum
d06ad04b7d staging: kpc2000: kpc_spi: remove unnecessary struct member pin_dir
The structure kpc_spi, defined in in the kpc2000_spi driver, contains
a member named pin_dir which is never used after initialization.
Therefore, it should be removed for simplicity's sake.

Signed-off-by: Geordan Neukum <gneukum1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-06 15:05:02 +02:00
Geordan Neukum
8b37865055 staging: kpc2000: kpc_spi: remove unnecessary struct member phys
The structure kp_spi_controller_state, defined in the kpc2000_spi
driver, contains a member named phys which is never used after
initialization. Therefore, it should be removed for simplicity's sake.

Signed-off-by: Geordan Neukum <gneukum1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-06 15:05:01 +02:00
Fabio Estevam
fa6a80ca5a staging: kpc2000: Use '%zu' for printing 'size_t' type
In order to print a 'size_t' type the '%zu' specifier needs to be used.

Change it accordingly in order to fix the following build warning:

drivers/staging/kpc2000/kpc_dma/fileops.c:57:35: warning: format '%ld' expects argument of type 'long int', but argument 8 has type 'size_t {aka unsigned int}' [-Wformat=]

Reported-by: Build bot for Mark Brown <broonie@kernel.org>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-06 15:03:35 +02:00
Fabio Estevam
89a237aa84 staging: kpc2000: Use '%llx' for printing 'long long int' type
In order to print a 'long long int' type the 'llx' specifier needs to be
used.

Change it accordingly in order to fix the following build warning:

drivers/staging/kpc2000/kpc2000/core.c:245:4: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'long long int' [-Wformat=]

Reported-by: Build bot for Mark Brown <broonie@kernel.org>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-06 15:03:34 +02:00
Valerio Genovese
7942b209ad staging: staging: kpc2000: kpc_dma: fix symbol 'kpc_dma_add_device' was not declared.
This was reported by sparse:
drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c:39:7: warning: symbol 'kpc_dma_add_device
' was not declared. Should it be static?

Signed-off-by: Valerio Genovese <valerio.click@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-06 15:03:34 +02:00
Simon Sandström
c1c7830cc7 staging: kpc2000: fix incorrect code comment in core.c
Step 11 was removed from kp2000_pcie_probe in a previous commit but the
comment was not changed to reflect this, so do it now.

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-06 14:57:01 +02:00
Simon Sandström
a1ceab8b92 staging: kpc2000: use sizeof(var) in kzalloc call
Fixes checkpatch.pl warning "Prefer kzalloc(sizeof(*pcard)...) over
kzalloc(sizeof(struct kp2000_device)...)".

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-06 14:57:01 +02:00
Simon Sandström
a12cae870a staging: kpc2000: remove unnecessary include in core.c
Fixes checkpatch.pl warning "Use #include <linux/io.h> instead of
<asm/io.h>".

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-06 14:57:01 +02:00
Simon Sandström
745cde4ef6 staging: kpc2000: use __func__ in debug messages in core.c
Fixes checkpatch.pl warning "Prefer using '"%s...", __func__' to using
'<function name>', this function's name, in a string".

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-06 14:57:01 +02:00
Simon Sandström
5298be4877 staging: kpc2000: remove unnecessary oom message in core.c
Fixes checkpatch.pl warning "Possible unnecessary 'out of memory'
message".

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-06 14:57:01 +02:00
Simon Sandström
1c10f06940 staging: kpc2000: remove unnecessary parentheses in core.c
Fixes checkpatch.pl check "Unnecessary parentheses around
pdev->dev.kobj".

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-06 14:57:01 +02:00