aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/kpc2000/kpc2000 (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-09-03staging: kpc2000: Fix long constant sparse warningHarsh Jain2-18/+18
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-06-20staging: kpc2000: fix integer overflow with left shiftsColin Ian King1-4/+6
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: 7dc7967fc39a ("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-20staging: kpc2000: simplify error handling in kp2000_pcie_probeSimon Sandström1-12/+10
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-15staging: kpc2000: remove dead code in core.cSimon Sandström1-6/+0
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-13staging: kpc2000: remove unnecessary comments in kp2000_pcie_probeSimon Sandström1-33/+5
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-13staging: kpc2000: improve label names in kp2000_pcie_probeSimon Sandström1-22/+20
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-10staging: kpc2000: remove unnecessary debug prints in core.cSimon Sandström1-6/+0
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-10staging: kpc2000: remove unnecessary debug prints in cell_probe.cSimon Sandström1-5/+0
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-06staging: kpc2000: Use '%llx' for printing 'long long int' typeFabio Estevam2-2/+2
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-06staging: kpc2000: fix incorrect code comment in core.cSimon Sandström1-1/+1
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-06staging: kpc2000: use sizeof(var) in kzalloc callSimon Sandström1-1/+1
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-06staging: kpc2000: remove unnecessary include in core.cSimon Sandström1-1/+0
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-06staging: kpc2000: use __func__ in debug messages in core.cSimon Sandström1-5/+5
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-06staging: kpc2000: remove unnecessary oom message in core.cSimon Sandström1-4/+1
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-06staging: kpc2000: remove unnecessary parentheses in core.cSimon Sandström1-3/+3
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-06staging: kpc2000: simplify comparisons to NULL in core.cSimon Sandström1-6/+6
Fixes checkpatch.pl warnings "Comparison to NULL could be written [...]" and "Comparisons should place the constant on the right side of the test". Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-03staging: kpc2000: removed misc device.Jeremy Sowden2-127/+2
Now that all the card information is available via sysfs, the misc device is no longer necessary. Removed it. Signed-off-by: Jeremy Sowden <jeremy@azazel.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-03staging: kpc2000: export more device attributes via sysfs.Jeremy Sowden1-0/+57
Added more read-only device attributes in order to expose all the information about the hardware which is available by calling read() or ioct() on the misc device associated with it. Signed-off-by: Jeremy Sowden <jeremy@azazel.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-30staging: kpc2000: replace bogus variable name in core.cSimon Sandström1-13/+13
"struct kp2000_regs temp" has nothing to do with temperatures, so replace it with the more proper name "regs". Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-30staging: kpc2000: remove extra spaces in core.cSimon Sandström1-2/+2
Fixes checkpatch.pl error "foo __init bar" should be "foo __init bar" and "foo __exit bar" should be "foo __exit bar". Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-30staging: kpc2000: remove extra blank line in core.cSimon Sandström1-1/+0
Fixes checkpatch.pl check "Please don't use multiple blank lines". Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-24staging: kpc2000: remove unnecessary oom messageSimon Sandström1-3/+1
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-05-24staging: kpc2000: remove unnecessary include in cell_probe.cSimon Sandström1-1/+0
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-05-24staging: kpc2000: remove unnecessary braces in cell_probe.cSimon Sandström1-7/+4
Fixes checkpatch.pl warnings "braces {} are not necessary for single statement blocks". Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-24staging: kpc2000: use kzalloc(sizeof(var)...) in cell_probe.cSimon Sandström1-1/+1
Fixes checkpatch.pl warning "Prefer kzalloc(sizeof(*kudev)...) over kzalloc(sizeof(struct kpc_uio_device)...)" Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-24staging: kpc2000: remove extra blank lines in cell_probe.cSimon Sandström1-4/+0
Fixes checkpatch.pl warnings "Please don't use multiple blank lines". Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-24staging: kpc2000: fix alignment issues in cell_probe.cSimon Sandström1-19/+15
Fixes checkpatch.pl warnings "Alignment should match open parenthesis" and "Lines should not end with a '('". Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-24staging: kpc2000: add missing asterisk in commentSimon Sandström1-1/+1
Fixes checkpatch.pl error "code indent should use tabs where possible". Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-24staging: kpc2000: use __func__ in debug messagesSimon Sandström1-7/+12
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-05-24staging: kpc2000: add blank line after declarationsSimon Sandström1-0/+4
Fixes checkpatch.pl warning "Missing a blank line after declarations". Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-23staging: kpc2000: remove invalid spaces in cell_probe.cSimon Sandström1-2/+2
Fixes checkpatch.pl error "space prohibited before/after that parenthesis". Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-23staging: kpc2000: add space after comma in cell_probe.cSimon Sandström1-1/+1
Fixes checkpatch.pl error "space required after that ','". Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-23staging: kpc2000: add spaces around operators in cell_probe.cSimon Sandström1-3/+3
Fixes checkpatch.pl warning "spaces preferred around that <op>". Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-23staging: kpc2000: fix invalid linebreaks in cell_probe.cSimon Sandström1-5/+12
Fixes checkpatch.pl error "else should follow close brace '}'" and "trailing statements should be on next line". Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-23staging: kpc2000: add space between ) and { in cell_probe.cSimon Sandström1-18/+18
Fixes checkpatch.pl error "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-05-23staging: kpc2000: fix indent in cell_probe.cSimon Sandström1-286/+286
Use tabs instead of spaces for indentation. Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-22staging: kpc2000: removed superfluous NULL checks from device attribute call-backs.Jeremy Sowden1-27/+0
All the attribute show call-backs check whether pcard is NULL. However, pci_set_drvdata(pdev, pcard) is called before the sysfs files are created during probe, and pci_set_drvdata(pdev, NULL) is not called until after they are destroyed during remove; therefore, pcard will not be NULL, and we can drop the checks. Signed-off-by: Jeremy Sowden <jeremy@azazel.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-22staging: kpc2000: simplified kp2000_device retrieval in device attribute call-backs.Jeremy Sowden1-19/+9
All the call-backs used the same formula to retrieve the pcard from dev: struct pci_dev *pdev = to_pci_dev(dev); struct kp2000_device *pcard; if (!pdev) return NULL; pcard = pci_get_drvdata(pdev); Since to_pci_dev is a wrapper for container_of, it will not return NULL, and since pci_get_drvdata just calls dev_get_drvdata on the dev member of pdev, this is equivalent to: struct kp2000_device *pcard = dev_get_drvdata(&(container_of(dev, struct pci_dev, dev)->dev)); and we can simplify it to: struct kp2000_device *pcard = dev_get_drvdata(dev); Signed-off-by: Jeremy Sowden <jeremy@azazel.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-22staging: kpc2000: use IDA to assign card numbers.Jeremy Sowden1-4/+15
Previously the next card number was assigned from a static int local variable. Replaced it with an IDA. Avoids the assignment of ever- increasing card-numbers by allowing them to be reused. Updated TODO. Corrected format-specifier for unsigned pcard->card_num. Signed-off-by: Jeremy Sowden <jeremy@azazel.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-22staging: kpc2000: added separate show functions for readable kp device attributes, defined them as read-only, and declared them static.Jeremy Sowden1-33/+73
Defined separate simple show functions for each attribute instead of having a one big one containing a chain of conditionals. Replaced calls to scnprintf with sprintf since all the outputs are single integers. All the readable device attributes are read-only, so used DEVICE_ATTR_RO to define them. The definitions are only used to populate the kp_attr_list attribute array, so declared them as static. Fixes the following sparse warnings: drivers/staging/kpc2000/kpc2000/core.c:152:1: warning: symbol 'dev_attr_ssid' was not declared. Should it be static? drivers/staging/kpc2000/kpc2000/core.c:153:1: warning: symbol 'dev_attr_ddna' was not declared. Should it be static? drivers/staging/kpc2000/kpc2000/core.c:154:1: warning: symbol 'dev_attr_card_id' was not declared. Should it be static? drivers/staging/kpc2000/kpc2000/core.c:155:1: warning: symbol 'dev_attr_hw_rev' was not declared. Should it be static? drivers/staging/kpc2000/kpc2000/core.c:156:1: warning: symbol 'dev_attr_build' was not declared. Should it be static? drivers/staging/kpc2000/kpc2000/core.c:157:1: warning: symbol 'dev_attr_build_date' was not declared. Should it be static? drivers/staging/kpc2000/kpc2000/core.c:158:1: warning: symbol 'dev_attr_build_time' was not declared. Should it be static? drivers/staging/kpc2000/kpc2000/core.c:159:1: warning: symbol 'dev_attr_cpld_reg' was not declared. Should it be static? drivers/staging/kpc2000/kpc2000/core.c:161:1: warning: symbol 'dev_attr_cpld_reconfigure' was not declared. Should it be static? Signed-off-by: Jeremy Sowden <jeremy@azazel.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-22staging: kpc2000: added a helper to get struct kp2000_device from struct device.Jeremy Sowden1-16/+13
The attribute call-backs all use the same formula to get the pcard from dev: struct pci_dev *pdev = to_pci_dev(dev); struct kp2000_device *pcard; if (!pdev) return -ENXIO; pcard = pci_get_drvdata(pdev); if (!pcard) return -ENXIO; Added a function to reduce the duplicated code. Signed-off-by: Jeremy Sowden <jeremy@azazel.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-22staging: kpc2000: improved formatting of core.c.Jeremy Sowden1-347/+422
* Indented with tabs. * Broke lines over 80 columns where possible. * Removed braces from one-statement blocks. * Tidied up some comments. * Removed multiple blank lines. Signed-off-by: Jeremy Sowden <jeremy@azazel.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-21staging: kpc2000: removed two kpc_uio_class device attributes.Jeremy Sowden1-16/+0
The show functions of two attributes output nothing and they are unused. Removed them. Signed-off-by: Jeremy Sowden <jeremy@azazel.net> Reported-by: Matt Sickler <matt.sickler@daktronics.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-21staging: kpc2000: added separate show functions for kpc_uio_class device attributes, defined them as read-only and declared them static.Jeremy Sowden1-46/+89
Defined separate simple show functions for each attribute instead of having a one big one containing a chain of conditionals. Replaced scnprintf calls with sprintf since all the outputs are short bounded strings or single integers. All of the device attributes are read-only, so used DEVICE_ATTR_RO to define them. The definitions are only used to populate the kpc_uio_class_attrs attribute array, so declared them as static. Fixes the following sparse warnings: drivers/staging/kpc2000/kpc2000/cell_probe.c:220:1: warning: symbol 'dev_attr_offset' was not declared. Should it be static? drivers/staging/kpc2000/kpc2000/cell_probe.c:221:1: warning: symbol 'dev_attr_size' was not declared. Should it be static? drivers/staging/kpc2000/kpc2000/cell_probe.c:222:1: warning: symbol 'dev_attr_type' was not declared. Should it be static? drivers/staging/kpc2000/kpc2000/cell_probe.c:223:1: warning: symbol 'dev_attr_s2c_dma' was not declared. Should it be static? drivers/staging/kpc2000/kpc2000/cell_probe.c:224:1: warning: symbol 'dev_attr_c2s_dma' was not declared. Should it be static? drivers/staging/kpc2000/kpc2000/cell_probe.c:225:1: warning: symbol 'dev_attr_irq_count' was not declared. Should it be static? drivers/staging/kpc2000/kpc2000/cell_probe.c:226:1: warning: symbol 'dev_attr_irq_base_num' was not declared. Should it be static? drivers/staging/kpc2000/kpc2000/cell_probe.c:227:1: warning: symbol 'dev_attr_core_num' was not declared. Should it be static? Signed-off-by: Jeremy Sowden <jeremy@azazel.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-21staging: kpc2000: remove SetBackEndControl() functionGreg Kroah-Hartman2-10/+10
As this is only called twice, just call writel() like a normal driver should :) At the same time, clean up the formatting for the irq handler, as there is no need to have that be incorrect, it just hurts the eyes... Cc: Matt Sickler <Matt.Sickler@daktronics.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-21staging: kpc2000: dma_common_defs.h: remove unused inline functionsGreg Kroah-Hartman1-14/+0
The functions GetBackEndStatus() and BackEndControlSetClear() are never used by any code, so just remove them. Cc: Matt Sickler <Matt.Sickler@daktronics.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-21staging: kpc2000: fix coding style in pcie.hGreg Kroah-Hartman1-53/+53
Use tabs in pcie.h, like is mandated. Cc: Matt Sickler <Matt.Sickler@daktronics.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-21staging: kpc2000: remove fileops.c file.Greg Kroah-Hartman4-128/+114
The fileops.c file does not need to be stand-alone, so move it into the core.c file. This lets us make some functions static, reducing the global namespace of the driver. Cc: Matt Sickler <Matt.Sickler@daktronics.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-20staging: kpc2000: remove lock_card/unlock_card functionsGreg Kroah-Hartman3-21/+7
We do not need an inline function to "hide" the lock, so just replace the few calls to these functions with the "real" mutex_lock/unlock() calls. Cc: Matt Sickler <Matt.Sickler@daktronics.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-20staging: kpc2000: remove kp200_module.c fileGreg Kroah-Hartman4-59/+43
The kp200_module.c does not need to be stand-alone, so move it into the core.c file. This lets us make some functions static, reducing the global namespace of the driver. Cc: Matt Sickler <Matt.Sickler@daktronics.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>