aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/gpib/gpio (follow)
AgeCommit message (Collapse)AuthorFilesLines
2025-09-06staging: gpib: use int type to store negative error codesQianfeng Rong1-1/+1
The "ret" variable is used to store the return from bb_write() returns either zero on success or negative error codes on failure. Storing the error codes in size_t which is an unsigned long, doesn't cause an issue at runtime but it's ugly as pants. Change "ret" from size_t to int type. No effect on runtime. Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/20250826123208.300145-1-rongqianfeng@vivo.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-08-19staging: gpib: tidy-up commentsLuke Yang1-7/+7
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-24staging: gpib: fix typoGaston Gonzalez1-1/+1
Fix typo in comment: dapter/adapter. Signed-off-by: Gaston Gonzalez <gascoar@gmail.com> Link: https://lore.kernel.org/r/20250718194029.35652-2-gascoar@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-04-25staging: gpib: Set control lines in attachDave Penkler1-0/+4
When the driver is attached the state of the main control lines is not defined and can lead to hangs. Set the control lines to a known state (logic false). Fixes: 4cd654f84769 ("staging: gpib: Add gpio bitbang GPIB driver") Tested-by: Dave Penkler <dpenkler@gmail.com> Signed-off-by: Dave Penkler <dpenkler@gmail.com> Link: https://lore.kernel.org/r/20250418173434.2892-9-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-04-25staging: gpib: Cleanup allocate_gpios codeDave Penkler1-21/+18
The function was using unnecessary variables error and retval. Simplify the code by testing for failure first and remove the redundant variables. Tested-by: Dave Penkler <dpenkler@gmail.com> Signed-off-by: Dave Penkler <dpenkler@gmail.com> Link: https://lore.kernel.org/r/20250418173434.2892-8-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-04-25staging: gpib: Change error code for no listenerDave Penkler1-1/+1
When doing a write a test is made to see whether there are any listeners. The code was returning ENODEV which is incorrect. The user library translates ENOTCONN to a user level no listener error code. Change the error code to ENOTCONN. Fixes: 4cd654f84769 ("staging: gpib: Add gpio bitbang GPIB driver") Tested-by: Dave Penkler <dpenkler@gmail.com> Signed-off-by: Dave Penkler <dpenkler@gmail.com> Link: https://lore.kernel.org/r/20250418173434.2892-7-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-04-25staging: gpib: Remove atn_asserted global variableDave Penkler1-8/+8
atn_asserted was introduced to deal with an issue where certain models of the Raspberry Pi would lose interrupts under heavy load. Using a combination of edge and level interrupts the problem was resolved so the work-around is no longer needed. This patch removes the work-around. Tested-by: Dave Penkler <dpenkler@gmail.com> Signed-off-by: Dave Penkler <dpenkler@gmail.com> Link: https://lore.kernel.org/r/20250418173434.2892-6-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-04-25staging: gpib: Remove dependency on LED subsystemDave Penkler1-17/+6
The yoga pin map is compatible with the others so that its led can be used as the activity led. Using the LED subsytem required adding a dtoverlay to the boot config as well as setting up the activity led via sysfs. To simplify the setup we remove the dependency on the LED subsystem and use the on board led as for the other pin maps. Tested-by: Dave Penkler <dpenkler@gmail.com> Signed-off-by: Dave Penkler <dpenkler@gmail.com> Link: https://lore.kernel.org/r/20250418173434.2892-5-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-04-25staging: gpib: Enable SRQ irq on request_system_controlDave Penkler1-2/+4
The SRQ irq was being enabled on attach but the board is not set up to handle it until it becomes system controller. Move the enabling of the SRQ irq to bb_request_system_control. Fixes: 4cd654f84769 ("staging: gpib: Add gpio bitbang GPIB driver") Tested-by: Dave Penkler <dpenkler@gmail.com> Signed-off-by: Dave Penkler <dpenkler@gmail.com> Link: https://lore.kernel.org/r/20250418173434.2892-4-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-04-25staging: gpib: Fix setting controller-in-chargeDave Penkler1-1/+1
The gpio board can only act as system controller. By the IEEE488.1 standard a system controller becomes controller-in-charge when it asserts the interface-clear control line. Remove the setting of controller-in-charge from bb_take_control and move it to bb_interface_clear. Fixes: 4cd654f84769 ("staging: gpib: Add gpio bitbang GPIB driver") Tested-by: Dave Penkler <dpenkler@gmail.com> Signed-off-by: Dave Penkler <dpenkler@gmail.com> Link: https://lore.kernel.org/r/20250418173434.2892-3-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-04-25staging: gpib: Fix request_system_control in gpioDave Penkler1-3/+7
The implementation of the bb_request_system_control function confused setting controller-in-charge with becoming system-controller. Remove setting controller-in-charge and add initialization of the control lines for the system-controller role. Fixes: 4cd654f84769 ("staging: gpib: Add gpio bitbang GPIB driver") Tested-by: Dave Penkler <dpenkler@gmail.com> Signed-off-by: Dave Penkler <dpenkler@gmail.com> Link: https://lore.kernel.org/r/20250418173434.2892-2-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-04-18staging: gpib: Add return value to request_controlDave Penkler1-8/+8
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: gpio: struct gpib_interfaceMichael Rubin1-1/+1
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-10-matchstick@neverthere.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-04-17staging: gpib: gpib_bitbang: u8 over uint8_tMichael Rubin1-10/+10
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/20250417004533.86765-8-matchstick@neverthere.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-04-15staging: gpib: gpio: fixes multiline comments stylePaul Retourné1-2/+4
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/44c064ed914fef384800e94ac99d00af5ff5f13b.1744438358.git.paul.retourne@orange.fr Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-04-15staging: gpib: gpio: struct gpib_board_configMichael Rubin1-1/+1
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-10-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: gpio: struct gpib_boardMichael Rubin1-36/+36
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-10-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-19staging: gpib: gpio bitbang console messaging cleanupDave Penkler1-33/+23
Enable module name to be printed in pr_xxx and dev_xxx Change pr_info in the dbg_printk macro to dev_dbg. In order for dbg_printk macro to have the board variable defined the signatures and calls to bb_buffer_print and set_atn were changed to include board as a parameter. Remove the #ifdef CONFIG_GPIB_DEBUG code. Remove commented dbk_printk's. Change dbg_printk(0, to dev_err where an error message is needed. Remove dbg_printk for "not implemented" functions. Remove "gpib_bitbang:" prefix in pr_err as it will be printed with the module name. Signed-off-by: Dave Penkler <dpenkler@gmail.com> Link: https://lore.kernel.org/r/20250214114708.28947-9-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-01-15staging: gpib: Use C99 syntax and make staticDave Penkler1-2/+2
Some drivers were still using the old syntax for initializing structs: field : value; This caused sparse to emit the following warning, for example: common/gpib_os.c:2026:1: warning: obsolete struct initializer, use C99 syntax Use C99 syntax: .field = value; Some local structs and arrays were not declared static causing sparse to emit the following warning, for example: warning: symbol 'ib_fops' was not declared. Should it be static? Declare the local structs and arrays as static. Signed-off-by: Dave Penkler <dpenkler@gmail.com> Link: https://lore.kernel.org/r/20250114165403.16410-5-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-01-15staging: gpib: Avoid plain integers as NULL pointersDave Penkler1-2/+2
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 Penkler1-25/+25
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-Hartman2-2/+2
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: gpio: Return error value from gpib_register_driver()Nihar Chaithanya1-1/+6
The function gpib_register_driver() can fail and does not return an error value if it fails. Return the error value if gpib_register_driver() fails. Add pr_err() statement indicating the fail and also the error value. Signed-off-by: Nihar Chaithanya <niharchaithanya@gmail.com> Link: https://lore.kernel.org/r/20241230185633.175690-9-niharchaithanya@gmail.com 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-12-20staging: gpib: make global 'usec_diff' functions staticArnd Bergmann1-1/+1
Trying to build both gpib_bitbang and lpvo_usb_gpib into the kernel reveals a function that should have been static and is also duplicated: x86_64-linux-ld: drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.o: in function `usec_diff': lpvo_usb_gpib.c:(.text+0x23c0): multiple definition of `usec_diff'; drivers/staging/gpib/gpio/gpib_bitbang.o:gpib_bitbang.c:(.text+0x2470): first defined here Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20241212154245.1411411-1-arnd@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-07staging: gpib: Re-order the lookup tablesDave Penkler1-3/+3
Re-order the tables so that the bcm27xx table is used first as these devices are more popular and numerous than the older ones. This is slightly more efficient for the later pi3 and subsequent models but should not be noticable in practice for all users. Signed-off-by: Dave Penkler <dpenkler@gmail.com> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/20241104175014.12317-12-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-07staging: gpib: Remove GPIO14 and GPIO15 lines in lookup tablesDave Penkler1-4/+0
GPIO14 and GPIO15 are not used in the current pin maps Signed-off-by: Dave Penkler <dpenkler@gmail.com> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/20241104175014.12317-11-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-07staging: gpib: Remove unneeded lookup tableDave Penkler1-33/+0
Remove bcm2837 table as the only difference is GPIO14 and GPIO15 which are not used with the current pin maps. Signed-off-by: Dave Penkler <dpenkler@gmail.com> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/20241104175014.12317-10-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 gpio bitbang GPIB driverDave Penkler2-0/+1517
GPIO bitbang driver for Rasbberry Pi 2/3/4/5 Signed-off-by: Dave Penkler <dpenkler@gmail.com> Link: https://lore.kernel.org/r/20240918121908.19366-15-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>