aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/gpib/cb7210 (follow)
AgeCommit message (Collapse)AuthorFilesLines
2025-08-19staging: gpib: tidy-up commentsLuke Yang1-2/+2
Improve comment readability: - "//comment" -> "// comment" - Align comments vertically in columns - Enforce consistency between "// comments" and "/* comments */" Signed-off-by: Luke Yang <lukeyang.dev@gmail.com> Link: https://lore.kernel.org/r/aJ4ykOs_MmjnQdPa@luyang-thinkpadp1gen7.toromso.csb Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-07-09staging: gpib: Fix error handling paths in cb_gpib_probe()Christophe JAILLET1-4/+11
If cb_gpib_config() fails, 'info' needs to be freed, as already done in the remove function. While at it, remove a pointless comment related to gpib_attach(). Fixes: e9dc69956d4d ("staging: gpib: Add Computer Boards GPIB driver") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/bf89d6f2f8b8c680720d02061fc4ebdd805deca8.1751709098.git.christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-05-01staging: gpib: Avoid unused variable warningsDave Penkler1-5/+0
This addresses warnings produced by make W=1 with the configuration parameter CONFIG_GPIB_PCMCIA=y cb7210/cb7210.c:1251:28: warning: variable 'dev' set but not used [-Wunused-but-set-variable] cb7210/cb7210.c:1250:31: warning: variable 'handle' set but not used [-Wunused-but-set-variable] Remove the declarations and assignments of the unused variables. Signed-off-by: Dave Penkler <dpenkler@gmail.com> Link: https://lore.kernel.org/r/20250427093123.18565-1-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-04-18staging: gpib: Add return value to request_controlDave Penkler1-2/+2
A number of drivers are unable to release control due to hardware or software limitations. As request_system_control was defined as void, no error could be signalled. This patch changes the prototype of request_system_control to int and adds the appropriate checking and returns. In the case that a board cannot release control EINVAL is returned. If a driver does not implement request_system_control EPERM is returned. Signed-off-by: Dave Penkler <dpenkler@gmail.com> Link: https://lore.kernel.org/r/20250418133537.22491-1-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-04-17staging: gpib: cb7210: struct gpib_interfaceMichael Rubin1-9/+9
Using Linux code style for struct gpib_interface. Adhering to Linux code style. Reported by checkpatch.pl In general, a pointer, or a struct that has elements that can reasonably be directly accessed should never be a typedef. Signed-off-by: Michael Rubin <matchstick@neverthere.org> Link: https://lore.kernel.org/r/20250417003246.84445-5-matchstick@neverthere.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-04-15staging: gpib: cb7210: fixes multiline comments stylePaul Retourné2-10/+13
Fixes the style of multiline comments to comply with the linux kernel coding style. Signed-off-by: Paul Retourné <paul.retourne@orange.fr> Link: https://lore.kernel.org/r/f4b504b59c500ed5a666422128c90340e8ff4f63.1744438358.git.paul.retourne@orange.fr Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-04-15staging: gpib: cb7210: u8 over uint8_tMichael Rubin2-19/+19
Reported by checkpatch.pl. CHECK: Prefer kernel type 'u8' over 'uint8_t' Signed-off-by: Michael Rubin <matchstick@neverthere.org> Link: https://lore.kernel.org/r/20250409180953.398686-2-matchstick@neverthere.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-04-15staging: gpib: cb7210: struct gpib_board_configMichael Rubin1-6/+6
Using Linux code style for struct gpib_board_config Adhering to Linux code style. Reported by checkpatch.pl In general, a pointer, or a struct that has elements that can reasonably be directly accessed should never be a typedef. Signed-off-by: Michael Rubin <matchstick@neverthere.org> Link: https://lore.kernel.org/r/20250408223659.187109-5-matchstick@neverthere.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-03-20staging: gpib: change return type of t1_delay function to report errorsRodrigo Gobbi1-1/+1
The current code returns "unsigned int" and it doesn't handle errors correctly if it happens during ioctl call for t1 delay configuration. The ni_usb_t1_delay(), from NI, is the only function returning -1 at this point. The caller, t1_delay_ioctl(), doesn't check for errors and sets board->t1_nano_sec to -1 and returns success. The board->t1_nano_sec value is also used in ni_usb_setup_t1_delay() besides the ioctl call and a value of -1 is treated as being above 1100ns. It may or may not have a noticeable effect, but it's obviously not right considering the content of ni_usb_setup_t1_delay(). Typical delays are in the 200-2000 range, but definitely not more than INT_MAX so we can fix this code by changing the return type to int and adding a check for errors. While we're at it, lets change the error code in ni_usb_t1_delay() from -1 and instead propagate the error from ni_usb_write_registers(). Fixes: 4e127de14fa7 ("staging: gpib: Add National Instruments USB GPIB driver") Signed-off-by: Rodrigo Gobbi <rodrigo.gobbi.7@gmail.com> Link: https://lore.kernel.org/r/20250225014811.77995-1-rodrigo.gobbi.7@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-03-20staging: gpib: cb7210: struct gpib_boardMichael Rubin1-53/+54
Using Linux code style for struct gpib_board. Adhering to Linux code style. In general, a pointer, or a struct that has elements that can reasonably be directly accessed should never be a typedef. Signed-off-by: Michael Rubin <matchstick@neverthere.org> Acked-By: Dave Penkler <dpenkler@gmail.com> Link: https://lore.kernel.org/r/20250319215924.19387-5-matchstick@neverthere.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-03-20staging: gpib: Correct CamelCase for VALID enumsMichael Rubin1-1/+1
Adhere to Linux kernel coding style. Reported by checkpatch CHECK: Avoid CamelCase Signed-off-by: Michael Rubin <matchstick@neverthere.org> Acked-By: Dave Penkler <dpenkler@gmail.com> Link: https://lore.kernel.org/r/20250319211827.9854-3-matchstick@neverthere.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-03-20staging: gpib: Correct CamelCase for BUS constantsMichael Rubin1-8/+8
Adhere to Linux kernel coding style and remove duplicate enums. Reported by checkpatch CHECK: Avoid CamelCase Signed-off-by: Michael Rubin <matchstick@neverthere.org> Acked-By: Dave Penkler <dpenkler@gmail.com> Link: https://lore.kernel.org/r/20250319211827.9854-2-matchstick@neverthere.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-02-20staging: gpib: cb7210 console messaging cleanupDave Penkler1-81/+52
Enable module name to be printed in pr_xxx and dev_xxx Use DRV_NAME defined as KBUILD_MODNAME instead of hard coded string "cb7210" everywhere. Remove "cb7210:" string prefix in messages since module name printing is enabled. Change pr_err to dev_err where possible. Remove interrupt warnings. Return consistent error codes with error messages: -EBUSY when resources are busy -ENODEV when device is not present -EIO for others. Return -ENOMEM for failed kmalloc (no message in driver) Remove PCMCIA debug comments, PCMCIA_DEBUG conditional compilation symbol, the DEBUG macro definition and its uses. Change pr_warn to dev_warn and pr_err to dev_err where possible. Remove commented printk. Signed-off-by: Dave Penkler <dpenkler@gmail.com> Link: https://lore.kernel.org/r/20250220090920.32497-1-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-02-19staging: gpib: cb7210: remove unused variableGaston Gonzalez1-2/+0
Remove unused variable 'nec_priv' in function 'cb7210_line_status'. This removes the following warning found compiling with W=1: warning: variable ‘nec_priv’ set but not used [-Wunused-but-set-variable] Signed-off-by: Gaston Gonzalez <gascoar@gmail.com> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/20250214195456.104075-3-gascoar@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-02-19staging:gpib: Remove GPIB_PCMCIA in MakefilesDave Penkler1-1/+0
This symbol is no longer needed since it is being replaced directly by its Kconfig equivalent CONFIG_GPIB_PCMCIA in the drivers providing optional support for the PCMCIA bus. Remove the definition of GPIB_PCMCIA from the Makefiles. Signed-off-by: Dave Penkler <dpenkler@gmail.com> Link: https://lore.kernel.org/r/20250210151022.4358-3-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-02-19staging;gpib: Use Kconfig PCMCIA compilation symbolDave Penkler1-5/+5
The drivers supporting the PCMCIA bus were using an intermediate symbol GPIB_PCMCIA for compiling optional PCMCIA support. This symbol is no longer needed for the in-tree drivers as the Kconfig symbol is available. Use the Kconfig symbol CONFIG_GPIB_PCMCIA directly for conditional compilation of PCMCIA support. Signed-off-by: Dave Penkler <dpenkler@gmail.com> Link: https://lore.kernel.org/r/20250210151022.4358-2-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-02-19staging: gpib: Fix cb7210 pcmcia OopsDave Penkler1-1/+1
The pcmcia_driver struct was still only using the old .name initialization in the drv field. This led to a NULL pointer deref Oops in strcmp called from pcmcia_register_driver. Initialize the pcmcia_driver struct name field. Reported-by: kernel test robot <oliver.sang@intel.com> Closes: https://lore.kernel.org/oe-lkp/202502131453.cb6d2e4a-lkp@intel.com Fixes: e9dc69956d4d ("staging: gpib: Add Computer Boards GPIB driver") Signed-off-by: Dave Penkler <dpenkler@gmail.com> Link: https://lore.kernel.org/r/20250213103112.4415-1-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-02-03staging: gpib: Make static, reduce fwd declarationsDave Penkler2-87/+47
A number of drivers were unnecessarily not declaring their entry points as static. Declare them as static. In order to reduce the number of forward declarations the gpib interface structure initializations have been moved to after the code of the entry points that they use. This also makes the structure of the drivers to be more consistent between them. Signed-off-by: Dave Penkler <dpenkler@gmail.com> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/20250122103859.25499-3-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-01-15staging: gpib: fix prefixing 0x with decimal outputAjith P V1-1/+1
* pr_err() of request_region() in cb7210 uses 0x%u which is defective. * The config->ibbase is of u32 and correct prefix is 0x%x. * This error reported by checkpatch with below message: ERROR: Prefixing 0x with decimal output is defective Signed-off-by: Ajith P V <ajithpv.linux@gmail.com> Link: https://lore.kernel.org/r/20250114121656.30577-1-ajithpv.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-01-15staging: gpib: Avoid plain integers as NULL pointersDave Penkler1-3/+3
A number of drivers were comparing request_region() with 0, others were passing 0 instead of NULL as a pointer argument. This led to the following sparse warning, for example: cb7210/cb7210.c:1043:72: warning: Using plain integer as NULL pointer Use !request_region() to test for NULL return and use NULL instead of 0 as pointer parameter. Signed-off-by: Dave Penkler <dpenkler@gmail.com> Link: https://lore.kernel.org/r/20250114165403.16410-4-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-01-13staging: gpib: Modernize gpib_interface_t initialization and make staticDave Penkler2-237/+232
All interface drivers were using the old style initialization of this struct field : value; This generated the followng sparse warning, for example: agilent_82357a/agilent_82357a.c:1492:1: warning: obsolete struct initializer, use C99 syntax Change the initialization to use the C99 syntax .field = value; This also resolves the checkpatch constraint of no indentation These structs were also not declared as static, unnecessarily polluting the symbol namespace and generating the following sparse warnings, for example: agilent_82357a/agilent_82357a.c:1465:18: warning: symbol 'agilent_82357a_gpib_interface' was not declared. Should it be static? Declare them as static and remove any conflicting extern declarations in the corresponding include files. Signed-off-by: Dave Penkler <dpenkler@gmail.com> Link: https://lore.kernel.org/r/20250111160514.26954-1-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-01-13Merge 6.13-rc7 into staging nextGreg Kroah-Hartman3-9/+9
We need the gpib changes in here as well to build on top of. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-01-07staging: gpib: cb7210: Handle gpib_register_driver() errorsNihar Chaithanya1-26/+90
The function cb_pcmcia_init_module() can be replaced by calling pcmcia_register_driver() directly. The error value from this function is not returned and the previous registering functions are not unregistered. The function gpib_register_driver() can fail and similar to pcmcia_register_driver() function failing, the previous registering functions are not unregistered. Replace cb_pcmcia_init_module() with pcmcia_register_driver(). Unregister the gpib and pci register functions if the subsequent gpib or pcmcia register functions fail and return the error value. Add pr_err() statements to indicate the fail and also the error value. Signed-off-by: Nihar Chaithanya <niharchaithanya@gmail.com> Link: https://lore.kernel.org/r/20241230185633.175690-5-niharchaithanya@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-12-20staging: gpib: fix address space mixupArnd Bergmann2-8/+8
Throughout the gpib drivers, a 'void *' struct member is used in place of either port numbers or __iomem pointers, which leads to lots of extra type casts, sparse warnings and less portable code. Split the struct member in two separate ones with the correct types, so each driver can pick which one to use. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/all/f10e976e-7a04-4454-b38d-39cd18f142da@roeck-us.net/ Link: https://lore.kernel.org/r/20241213064959.1045243-3-arnd@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-12-20staging: gpib: fix MakefilesArnd Bergmann1-1/+1
Having gpib drivers built-in rather than as loadable modules causes link failure because the drivers are never actually built: arm-linux-gnueabi-ld: drivers/staging/gpib/fmh_gpib/fmh_gpib.o: in function `fmh_gpib_t1_delay': fmh_gpib.c:(.text+0x3b0): undefined reference to `nec7210_t1_delay' arm-linux-gnueabi-ld: drivers/staging/gpib/fmh_gpib/fmh_gpib.o: in function `fmh_gpib_serial_poll_status': fmh_gpib.c:(.text+0x418): undefined reference to `nec7210_serial_poll_status' arm-linux-gnueabi-ld: drivers/staging/gpib/fmh_gpib/fmh_gpib.o: in function `fmh_gpib_secondary_address': fmh_gpib.c:(.text+0x57c): undefined reference to `nec7210_secondary_address' arm-linux-gnueabi-ld: drivers/staging/gpib/fmh_gpib/fmh_gpib.o: in function `fmh_gpib_primary_address': fmh_gpib.c:(.text+0x5ac): undefined reference to `nec7210_primary_address' Change this to use the correct Makefile syntax, setting either obj-m or obj-y. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20241212154245.1411411-2-arnd@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-07staging: gpib: Replace custom debug with dev_dbgDave Penkler1-1/+1
Remove GPIB_KERNEL_DEBUG config option Remove GPIB_DEBUG reference Replace GPIB_DPRINTK with dev_dbg Change pr_alert to dev_alert Signed-off-by: Dave Penkler <dpenkler@gmail.com> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/20241104175014.12317-3-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-19staging: gpib: add module descriptionsArnd Bergmann1-0/+1
Every loadable module should have a description, and not having one causes a W=1 build warning, so add these to the newly added modules. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20241016111521.1143191-2-arnd@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-17staging: gpib: Replace kmalloc/memset with kzalloc.Rohit Chavan1-2/+1
This patch replaces kmalloc + memset with kzalloc in the GPIB driver. Signed-off-by: Rohit Chavan <roheetchavan@gmail.com> Reviewed-by: Dave Penkler <dpenkler@gmail.com> Link: https://lore.kernel.org/r/20241016103406.1618448-1-roheetchavan@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-10staging: gpib: Add Computer Boards GPIB driverDave Penkler3-0/+1811
Driver for Computer Boards interface cards. Signed-off-by: Dave Penkler <dpenkler@gmail.com> Link: https://lore.kernel.org/r/20240918121908.19366-11-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>