summaryrefslogtreecommitdiff
path: root/drivers/staging/kpc2000/kpc2000_spi.c
AgeCommit message (Collapse)Author
2020-03-10staging: kpc2000: kpc2000_spi: Use new structure for SPI transfer delaysSergiu Cuciurean
In a recent change to the SPI subsystem in commit <bebcfd272df6> ("spi: introduce `delay` field for `spi_transfer` + spi_transfer_delay_exec()"), a new `delay` struct was added to replace the `delay_usecs`. This change replaces the current `delay_usecs` with `delay` for this driver. The `spi_transfer_delay_exec()` function [in the SPI framework] makes sure that both `delay_usecs` & `delay` are used (in this order to preserve backwards compatibility). Signed-off-by: Sergiu Cuciurean <sergiu.cuciurean@analog.com> Link: https://lore.kernel.org/r/20200304073746.19664-1-sergiu.cuciurean@analog.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-06remove ioremap_nocache and devm_ioremap_nocacheChristoph Hellwig
ioremap has provided non-cached semantics by default since the Linux 2.6 days, so remove the additional ioremap_nocache interface. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Arnd Bergmann <arnd@arndb.de>
2019-10-30staging: KPC2000: kpc2000_spi.c: Fix style issues (Unnecessary parenthesis)Chandra Annamaneni
Resolved: CHECK: Unnecessary parentheses around table[i] Signed-off-by: Chandra Annamaneni <chandra627@gmail.com> Link: https://lore.kernel.org/r/20191029091638.16101-4-chandra627@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-10-30staging: KPC2000: kpc2000_spi.c: Fix style issues (alignment)Chandra Annamaneni
Resolved: "CHECK: Alignment should match open parenthesis" from checkpatch Signed-off-by: Chandra Annamaneni <chandra627@gmail.com> Link: https://lore.kernel.org/r/20191029091638.16101-3-chandra627@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-10-30staging: KPC2000: kpc2000_spi.c: Fix style issues (misaligned brace)Chandra Annamaneni
Resolved: ERROR: else should follow close brace '}' Signed-off-by: Chandra Annamaneni <chandra627@gmail.com> Link: https://lore.kernel.org/r/20191029091638.16101-2-chandra627@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-10-30staging: KPC2000: kpc2000_spi.c: Fix style issues (missing blank line)Chandra Annamaneni
Resolved: "CHECK: Please use a blank line after.." from checkpatch.pl Signed-off-by: Chandra Annamaneni <chandra627@gmail.com> Link: https://lore.kernel.org/r/20191029091638.16101-1-chandra627@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-10-10staging: kpc2000: Remove unnecessary return variableWambui Karuga
Remove unnecessary variable `val` in kp_spi_read_reg() that only holds the return value from readq(). Issue found by coccinelle using the script: @@ local idexpression ret; expression e; @@ -ret = +return e; -return ret; Signed-off-by: Wambui Karuga <wambui.karugax@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Link: https://lore.kernel.org/r/20191009170703.GA2869@wambui Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-22staging: kpc2000: kpc_spi: Remove unnecessary null check before kfreeYueHaibing
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-04staging: kpc2000: simplify comparison to NULL in kpc2000_spi.cSimon Sandström
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-03staging: kpc2000: fix brace issues in kpc2000_spi.cSimon Sandström
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-01staging: kpc2000: remove needless 'break'Fabian Krueger
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-01staging: kpc2000: introduce __func__Fabian Krueger
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-01staging: kpc2000: introduce 'unsigned int'Fabian Krueger
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-01staging: kpc2000: introduce usage of __packedFabian Krueger
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-01staging: kpc2000: blank lines after declarationFabian Krueger
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-01staging: kpc2000: add line breaksFabian Krueger
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-06-26staging: kpc2000: add missing spaces in kpc2000_spi.cSimon Sandström
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-10staging: kpc2000: remove extra white space in kpc2000_spi.cNaoto Kobayashi
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-06staging: kpc2000: kpc_spi: remove unnecessary cast in [read|write]_reg()Geordan Neukum
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-06staging: kpc2000: kpc_spi: remove unnecessary ulong repr of i/o addrGeordan Neukum
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-06staging: kpc2000: kpc_spi: remove unnecessary struct member chip_selectGeordan Neukum
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-06staging: kpc2000: kpc_spi: remove unnecessary struct member word_lenGeordan Neukum
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-06staging: kpc2000: kpc_spi: remove unnecessary struct member pin_dirGeordan Neukum
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-06staging: kpc2000: kpc_spi: remove unnecessary struct member physGeordan Neukum
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-03staging: kpc2000: kpc_spi: use devm_* API to manage mapped I/O spaceGeordan Neukum
The kpc_spi driver does not unmap its I/O space upon error cases in the probe() function or upon remove(). Make the driver clean up after itself more maintainably by migrating to using the managed resource API. Signed-off-by: Geordan Neukum <gneukum1@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-03staging: kpc2000: kpc_spi: remove function kp_spi_bytes_per_word()Geordan Neukum
The static function kp_spi_bytes_per_word() is defined in kpc2000_spi.c, but it is completely unused. As this function is unused, it can and should be removed. Signed-off-by: Geordan Neukum <gneukum1@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-03staging: kpc2000: kpc_spi: remove fifo_depth from kp_spi structGeordan Neukum
The kp_spi structure contains a member 'fifo_depth'. This member is never used. Therefore, it should be removed. Signed-off-by: Geordan Neukum <gneukum1@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-03staging: kpc2000: kpc_spi: column-align switch and subordinate casesGeordan Neukum
The linux style guide prescribes that switch statements and their subordinate case labels should be column-aligned rather than double-indenting the case label. Make kpc2000_spi.c follow the desired style with respect to switch/case alignment. Signed-off-by: Geordan Neukum <gneukum1@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-03staging: kpc2000: kpc_spi: Remove unnecessary consecutive newlinesGeordan Neukum
The kpc2000_spi.c file contains instances of unnecessary consecutive newlines which negatively impact the readability of the file. Remove all unnecessary consecutive newlines. Signed-off-by: Geordan Neukum <gneukum1@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-30staging: kpc2000: replace white spaces with tabs for kpc2000_spi.cMao Wenan
There are multiple wrong formats in kpc2000_spi.c, is time to do clean work for it. Signed-off-by: Mao Wenan <maowenan@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-30staging: kpc2000: report error status to spi coreMao Wenan
There is an error condition that's not reported to the spi core in kp_spi_transfer_one_message(). It should restore status value to m->status, and return it in error path. Signed-off-by: Mao Wenan <maowenan@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-21staging: kpc2000: move the spi driver out of its subdirectoryGreg Kroah-Hartman
There is no need for a subdirectory for just a single .c file. So move it out of kpc_spi/ and rename it to the module name that we want the file to build to, saving one more linking stage. Cc: Matt Sickler <Matt.Sickler@daktronics.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>