summaryrefslogtreecommitdiff
path: root/drivers/staging/pi433/pi433_if.c
AgeCommit message (Collapse)AuthorFilesLines
2017-12-19staging: pi433: replace printk calls with dev_dbgValentin Vidic1-2/+2
Fixes checkpatch warning: WARNING: printk() should include KERN_<LEVEL> facility level Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-19staging: pi433: avoid logging ENOMEM messagesValentin Vidic1-3/+1
Fixes checkpatch warning: WARNING: Possible unnecessary 'out of memory' message Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-19staging: pi433: replace unsigned with unsigned intValentin Vidic1-1/+1
Fixes checkpatch warning: WARNING: Prefer 'unsigned int' to bare use of 'unsigned' Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-19staging: pi433: collapse else block after return statementValentin Vidic1-7/+7
Fixes checkpatch warning: WARNING: else is not generally useful after a break or return Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-19Staging: Pi433: Bugfix for wrong argument for sizeof() in TX threadMarcus Wolf1-7/+6
sizeof(array) != sizeof(pointer to array) Fixes: "staging: pi433: reduce stack size in tx thread" Fixes: 62f39d49d168 ("staging: pi433: reduce stack size in tx thread") Signed-off-by: Marcus Wolf <linux@wolf-entwicklungen.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-19staging: pi433: remove multiple blank linesValentin Vidic1-11/+0
Fixes checkpatch warning for multiple blank lines in source. Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13staging: pi433: remove comparison with trueValentin Vidic1-1/+1
Fixes checkpatch warning for error prone comparison. Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13staging: pi433: remove comparison with falseValentin Vidic1-1/+1
Fixes checkpatch warning for error prone comparison. Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13staging: pi433: add blank line after functionValentin Vidic1-0/+1
Fixes checkpatch warning for blank line after function/struct/union/enum declarations. Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13staging: pi433: rewrite comparison with NULLValentin Vidic1-2/+2
Fixes checkpatch warning for comparing value with NULL. Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13staging: pi433: remove return from a void functionValentin Vidic1-1/+0
Fixes checkpatch warning for void function return statements. Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13staging: pi433: remove spaces before tabsValentin Vidic1-1/+1
Fixes checkpatch warning for hidden spaces before tabs. Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13staging: pi433: move trailing statements to next lineValentin Vidic1-14/+31
Fixes checkpatch error for trailing if statements. Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13staging: pi433: use tabs for code indentValentin Vidic1-4/+4
Fixes checkpatch error for whitespace idents. Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13staging: pi433: use consistent brace styleValentin Vidic1-88/+41
Fixes checkpatch error for open/close braces. Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13staging: pi433: remove space inside parenthesisValentin Vidic1-17/+17
Fixes checkpatch error for prohibited spaces. Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13staging: pi433: add space around operatorsValentin Vidic1-5/+4
Fixes checkpatch error for missing spaces. Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13staging: pi433: add space after commaValentin Vidic1-2/+2
Fixes checkpatch error for missing spaces. Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13staging: pi433: add space before open parenthesisValentin Vidic1-2/+2
Fixes checkpatch error for missing spaces. Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-08staging: pi433: pi433_if.c remove SET_CHECKED macroNguyen Phan Quang Minh1-54/+139
The macro calls its argument -a function- twice, makes the calling function return prematurely -skipping resource cleanup code- and hurts understandability. Signed-off-by: Nguyen Phan Quang Minh <minhnpq16@gmail.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-07staging: pi433: Remove SET_CHECKED usage from pi433_probeSimon Sandström1-7/+21
SET_CHECKED returns from the function on failure and in pi433_probe it is necessary to free the GPIOs and the device on failure. Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-07staging: pi433: Combine all rf69_set_amplifier_x()Simon Sandström1-3/+3
Replaces the functions rf69_set_amplifier_1, _2, _3 with two functions: rf69_enable_amplifier(dev, amp_mask) and rf69_disable_amplifier(dev, amp_mask). Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-07staging: pi433: Remove enum data_modeSimon Sandström1-1/+1
Call rf69_set_data_mode with DATAMODUL_MODE value directly. Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-07staging: pi433: Split rf69_set_sync_enabled into two functionsSimon Sandström1-2/+19
Splits rf69_set_sync_enabled(dev, enabled) into rf69_enable_sync(dev) and rf69_disable_sync(dev). Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-07staging: pi433: Split rf69_set_crc_enabled into two functionsSimon Sandström1-2/+20
Splits rf69_set_crc_enabled(dev, enabled) into rf69_enable_crc(dev) and rf69_disable_crc(dev). Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-06staging: pi433: Rename enum modShaping in rf69_enum.hSimon Sandström1-1/+1
Renames enum modShaping and its values to get rid of checkpatch.pl warnings: "Avoid CamelCase: <modShaping>". Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-06staging: pi433: Rename enum optionOnOff in rf69_enum.hSimon Sandström1-17/+17
Renames the enum optionOnOff and its values optionOn, optionOff to enum option_on_off and OPTION_ON, OPTION_OFF. Fixes checkpatch.pl warnings: "Avoid CamelCase: <optionOnOff>, <optionOn>, <optionOff>". Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-06staging: pi433: Rename variable in struct pi433_rx_cfgSimon Sandström1-1/+1
Renames variable thresholdDecrement in struct pi433_rx_cfg to threshold_decrement to get rid of checkpatch.pl warning "Avoid CamelCase: <thresholdDecrement>". Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-06staging: pi433: Capitalize constant definitionsSimon Sandström1-16/+16
Fixes checkpatch.pl warnings "Avoid CamelCase <DIO_x>". Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28staging: pi433: pi433_if.c codestyle fixOliver Graute1-3/+2
This patch fixes the following checkpatch.pl error: ERROR: spaces required around that '>=' (ctx:VxV) #930: FILE: pi433_if.c:930: + for (i--; i>=0; i--) ERROR: spaces required around that '=' (ctx:VxV) #970: FILE: pi433_if.c:970: + for (i=0; i<NUM_DIO; i++) Signed-off-by: Oliver Graute <oliver.graute@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28staging: pi433: pi433_if.c fix codestyle on two long linesOliver Graute1-2/+4
This patch fixes the following checkpatch.pl warning: WARNING: line over 80 characters #1233: FILE: pi433_if.c:1233: + unregister_chrdev(MAJOR(pi433_dev), pi433_spi_driver.driver.name); WARNING: line over 80 characters #1240: FILE: pi433_if.c:1240: + unregister_chrdev(MAJOR(pi433_dev), pi433_spi_driver.driver.name); Signed-off-by: Oliver Graute <oliver.graute@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28staging: pi433: fix naming when more than one radio is usedMarcin Ciupak1-2/+4
When using more than one hardware radio module pi433_probe fails as the same name is used for all modules. Create unique name by adding minor number to the device name. Signed-off-by: Marcin Ciupak <marcin.s.ciupak@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28staging: pi433: fix (NULL device *) in log messageMarcin Ciupak1-13/+13
(NULL device *) is printed in log message in pi433_probe and pi433_get_minor functions due to device->dev being used prior to call to device_create function. Signed-off-by: Marcin Ciupak <marcin.s.ciupak@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28staging: pi433: fixed signedness of 4th argument to kfifo_from_userStefano Manni1-1/+2
sparse warning: incorrect type in initializer (different signedness) expected unsigned int *__copied, got int *<noident> Signed-off-by: Stefano Manni <stefano.manni@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-17Merge branch 'misc.compat' of ↵Linus Torvalds1-76/+14
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs Pull compat and uaccess updates from Al Viro: - {get,put}_compat_sigset() series - assorted compat ioctl stuff - more set_fs() elimination - a few more timespec64 conversions - several removals of pointless access_ok() in places where it was followed only by non-__ variants of primitives * 'misc.compat' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (24 commits) coredump: call do_unlinkat directly instead of sys_unlink fs: expose do_unlinkat for built-in callers ext4: take handling of EXT4_IOC_GROUP_ADD into a helper, get rid of set_fs() ipmi: get rid of pointless access_ok() pi433: sanitize ioctl cxlflash: get rid of pointless access_ok() mtdchar: get rid of pointless access_ok() r128: switch compat ioctls to drm_ioctl_kernel() selection: get rid of field-by-field copyin VT_RESIZEX: get rid of field-by-field copyin i2c compat ioctls: move to ->compat_ioctl() sched_rr_get_interval(): move compat to native, get rid of set_fs() mips: switch to {get,put}_compat_sigset() sparc: switch to {get,put}_compat_sigset() s390: switch to {get,put}_compat_sigset() ppc: switch to {get,put}_compat_sigset() parisc: switch to {get,put}_compat_sigset() get_compat_sigset() get rid of {get,put}_compat_itimerspec() io_getevents: Use timespec64 to represent timeouts ...
2017-11-10pi433: sanitize ioctlAl Viro1-78/+14
a) those access_ok() are pointless b) guarding against the ioctl number declaration changes in that way is pointless, especially since we _know_ the size of object we want to copy. [folded braino fixes from Colin Ian King and Dan Carpenter] Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-10-18Staging: pi433: Fix the position of brace after ifSrishti Sharma1-36/+18
Fix the position of the brace after if when it is on the next line. Done using the following semantic patch by coccinelle. @r1@ position p1, p2; @@ if(...)@p1 {@p2 ... } @script: python r2@ p1 << r1.p1; p2 << r1.p2; @@ l1 = int (p1[0].line) l2 = int (p2[0].line) c1 = int (p1[0].column_end) c2 = int (p2[0].column) if l1 == l2 and c1+1 == c2: cocci.include_match(False) @r3@ position r1.p1, r1.p2; @@ if(... - )@p1 -{@p2 +) { ... } Signed-off-by: Srishti Sharma <srishtishar@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-17staging: pi433: Replace printk() with dev_dbg()Haneen Mohammed1-4/+5
This patch convert printk() to the preferred variant dev_dbg() and remove unnecessary comment line. Issue detected with checkpatch.pl. Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-17staging: pi433: Fixes minor typo errorsHarsha Sharma1-2/+2
Fixes checkpatch warning -- "occured" and "succesfully" are misspelled Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28staging: pi433: fix interrupt handler signaturesCihangir Akturk1-11/+8
Remove "struct pt_regs *" parameter from interrupt handlers, since it is no longer passed to interrupt handlers. Also, convert return types to irqreturn_t. Additionally, move DIO_irq_handler variable into the setup_GPIO function, as it's not used outside of this function. Signed-off-by: Cihangir Akturk <cakturk@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-20staging: pi433: fixed coding style issuesXiangyang Zhang1-8/+7
space required before the open parenthesis, open brace should be on previous line. Signed-off-by: Xiangyang Zhang <xyz.sun.ok@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-15staging: pi433: reduce stack size in tx threadArnd Bergmann1-1/+2
Putting a 900 byte array on the stack is a clearly too much in the kernel, and sometimes results in warnings like: drivers/staging/pi433/pi433_if.c: In function 'pi433_tx_thread': drivers/staging/pi433/pi433_if.c:645:1: error: the frame size of 1028 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] This moves the buffer into the dynamically allocated per-device structure. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Marcus Wolf <linux@wolf-entwicklungen.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-15staging: pi433: Use matching enum types calling rf69_set_packet_formatElia Geretto1-2/+21
This patch fixes the following four warnings found using sparse: drivers/staging/pi433/pi433_if.c:211:9: warning: mixing different enum types drivers/staging/pi433/pi433_if.c:211:9: int enum optionOnOff versus drivers/staging/pi433/pi433_if.c:211:9: int enum packetFormat drivers/staging/pi433/pi433_if.c:211:9: warning: mixing different enum types drivers/staging/pi433/pi433_if.c:211:9: int enum optionOnOff versus drivers/staging/pi433/pi433_if.c:211:9: int enum packetFormat drivers/staging/pi433/pi433_if.c:268:9: warning: mixing different enum types drivers/staging/pi433/pi433_if.c:268:9: int enum optionOnOff versus drivers/staging/pi433/pi433_if.c:268:9: int enum packetFormat drivers/staging/pi433/pi433_if.c:268:9: warning: mixing different enum types drivers/staging/pi433/pi433_if.c:268:9: int enum optionOnOff versus drivers/staging/pi433/pi433_if.c:268:9: int enum packetFormat This is done calling the rf69_set_packet_format function using the appropriate enum for the packetFormat argument. Signed-off-by: Elia Geretto <elia.f.geretto@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-29staging: pi433: Style fix - align block commentsDerek Robson1-15/+23
Fixed the alignment of block comments Found using checkpatch Signed-off-by: Derek Robson <robsonde@gmail.com> Reviewed-by: Marcus Wolf <linux@wolf-entwicklungen.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-29Staging: pi433: check error after kthread_run()Joseph Wright1-1/+1
Error should be checked with IS_ERR after calling kthread_run() instead of comparing the returned pointer to an int. Found by sparse warning: incompatible types for operation (<) left side has type struct task_struct *tx_task_struct right side has type int Signed-off-by: Joseph Wright <rjosephwright@gmail.com> Reviewed-by: Marcus Wolf <linux@wolf-entwicklungen.de> Tested-by: Marcus Wolf <linux@wolf-entwicklungen.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-29Staging: pi433: declare functions staticJoseph Wright1-2/+2
Declare functions static to fix sparse warnings: warning: symbol 'pi433_receive' was not declared. Should it be static? warning: symbol 'pi433_tx_thread' was not declared. Should it be static? Signed-off-by: Joseph Wright <rjosephwright@gmail.com> Reviewed-by: Marcus Wolf <linux@wolf-entwicklungen.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-29staging: pi433: return -EFAULT if copy_to_user() failsdan.carpenter@oracle.com1-1/+1
copy_to_user() to user returns the number of bytes that weren't copied, but we should be returning -EFAULT to the user. Fixes: 874bcba65f9a ("staging: pi433: New driver") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-18staging: pi433: Fix a couple of spelling mistakesColin Ian King1-2/+2
Trivial fix to spelling mistakes in dev_dbg debug messages "wiat" -> "wait" "fonud" -> "found" Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-16staging: pi433: New driverMarcus Wolf1-0/+1314
Added a driver for the pi433 radio module (see https://www.pi433.de/en.html for details). Signed-off-by: Marcus Wolf <linux@Wolf-Entwicklungen.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>