69 Commits
Author SHA1 Message Date
Linus Torvalds 93e4b3076b Merge tag 'char-misc-7.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc/IIO/etc driver updates from Greg KH:
 "Here is the big set of char, misc, iio, counter, fpga, and other small
  driver subsystems for 7.3-rc1.

  Overall, due to some driver removals we only added a bit more code
  than removed, which was a nice change. Highlights in this merge
  request are:

   - Loads of IIO driver updates and additions

   - binder driver updates (more on that below...)

   - Removal of the SGI XP and GRU drivers as they are not used anymore
     and turn out to be pretty insecure overall

   - Removal of the obsolete ibmasm driver as it's not being used
     anymore

   - Coresight driver updates and additions

   - Mei driver udpates

   - Counter driver updates

   - FPGA driver updates

   - ICC driver updates

   - lots and lots of other tiny driver updates to resolve reported
     issues

  All of these have been in linux-next for a while"

* tag 'char-misc-7.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (513 commits)
  iio: chemical: atlas-sensor: use iio_trigger_poll_nested() to fix remove UAF
  iio: adc: pac1921: fix wrong channel used in trigger handler read
  iio: light: gp2ap002: re-enable irq if runtime suspend fails
  iio: light: gp2ap002: Fix unbalanced runtime PM on repeated event writes
  iio: light: apds9306: fix PM reference leak in apds9306_read_data()
  iio: gyro: mpu3050: fix sign of raw angular velocity readings
  iio: srf04: fix pm_runtime handling on probe error path
  iio: adc: ad4080: configure backend data size
  iio: adc: adi-axi-adc: add data size support for AD408X backend
  iio: chemical: atlas-sensor: fix PM reference leak in buffer postenable
  iio: dac: ad5446: fix OF module device table
  iio: light: opt4001: Fix reversed GENMASK() arguments in fault count mask
  iio: light: opt4001: Reject integration times with a non-zero seconds part
  iio: light: opt4001: Fix incompatible pointer type passed to div_u64_rem()
  iio: light: opt4001: Fix power down clearing bits of the wrong register
  iio: light: opt4060: Fix incorrect register name in threshold read error message
  iio: light: opt4060: Fix pointer type passed to div_u64_rem()
  iio: light: opt4060: Reject integration times with a non-zero seconds part
  iio: light: ltrf216a: fix runtime PM reference leak in error path
  iio: pressure: dps310: fix NULL pointer dereference on ACPI probe
  ...
2026-08-25 09:38:50 -07:00
Bartosz Golaszewski 8bdba6f6cf Merge tag 'config-gpio-legacy-for-7.3' of https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground into gpio/for-next
gpio: legacy interface cleanups for 7.3

These are the remaining patches for legacy gpio interface
cleanup, ensuring that files referencing them are sure to
have CONFIG_GPIOLIB_LEGACY set, and use linux/gpio/legacy.h
instead of the old linux/gpio.h header.

There are a few more patches already merged in other
branches for 7.3, including soc, led, net and media. Once
everything is in, we can apply the final patches to turn
off CONFIG_GPIOLIB_LEGACY by default and remove the obsolete
header file.

This branch is based on the immutable ib-mfd-legacy-gpio-7.3
branch from mfd.git to avoid a conflict in the rohm drivers.
2026-07-27 09:56:49 +02:00
Arnd Bergmann 57f64d52ab gpib: gpio: replace linux/gpio.h inclusion
linux/gpio.h is going away, so remove taht as the driver already
includes linux/gpio/consumer.h.

Acked-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
2026-07-24 20:12:48 +02:00
Uwe Kleine-König (The Capable Hub) bb14d970bf gpib: Improve style of pnp_device_id array terminators
To match how device-id array terminators look like for other device
types drop `.id = ""` from it and let the compiler care for zeroing the
entry.

While touching these arrays, also align spacing to how these arrays are
usually written.

There are no changes in the compiled drivers, only the source looks
nicer.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <[email protected]>
Link: https://patch.msgid.link/f23c9d77836f3b14b1efc58e3969333e8addb1c1.1781078782.git.u.kleine-koenig@baylibre.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-07-17 14:54:14 +02:00
Uwe Kleine-König (The Capable Hub) fbf64f3595 gpib: Initialize pci_device_ids using PCI_DEVICE macros
The PCI_DEVICE macro and its variants allow to initialize the first four
members of a struct pci_device_id in a bit more compact form and also
with an easier to grasp semantic. Explicit zeros are not needed, the
compiler fills these in automatically.

So convert all array members to such a macro and drop unneeded zeros.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-07-17 14:54:10 +02:00
Mohammad Shahid 9d4ce1c7cd gpib: lpvo_usb_gpib: use memdup_user() instead of kmalloc() and copy_from_user()
Use memdup_user() to replace the open-coded kmalloc() and
copy_from_user() sequence.

This simplifies the code while preserving the existing behavior.

This issue was reported by memdup_user.cocci.

Signed-off-by: Mohammad Shahid <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-07-17 14:54:05 +02:00
Zenghui Yu a168e2cfb7 gpib: lpvo_usb: fix path of the "debug" module parameter in comment
The correct path of the "debug" module parameter should be
/sys/module/lpvo_usb_gpib/parameters/debug. Fix it.

Signed-off-by: Zenghui Yu <[email protected]>
Acked-by: Randy Dunlap <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-07-17 14:54:00 +02:00
Arnd Bergmann 6cc6678928 gpib: use 'static inline' instead of 'extern inline'
With GNU inline semantics, an 'extern inline' function is only included
in the build if it can be inlined. When the compiler for some reason
decides against inlining it, this causes a link failure, as observed in
one function in the tnt4882_gpib driver:

ld.lld: error: undefined symbol: mite_irq
>>> referenced by tnt4882_gpib.c:974 (/home/arnd/arm-soc/drivers/gpib/tnt4882/tnt4882_gpib.c:974)
>>>               drivers/gpib/tnt4882/tnt4882_gpib.o:(ni_pci_attach) in archive vmlinux.a

Change all of the 'extern inline' definitions in gpib to the regular
'static inline' to avoid this.

Fixes: 0cd5b05551 ("staging: gpib: Add TNT4882 chip based GPIB driver")
Fixes: 6c52d5e3cd ("staging: gpib: Add common include files for GPIB drivers")
Signed-off-by: Arnd Bergmann <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-07-17 14:53:56 +02:00
Gui-Dong Han 7ddb521ab0 gpib: Move stuck SRQ update under lock
Move the stuck SRQ state update into autopoll_all_devices() and keep it
under big_gpib_mutex. Except for initialization, keep the stuck_srq users
under this mutex.

autopoll_all_devices() is only called by autospoll_thread(), so there is
no need to return to autospoll_thread() and set this state after dropping
big_gpib_mutex.

Without the mutex, a newly opened device can clear stuck_srq and have
that clear overwritten by the previous autospoll result:

  autospoll: serial_poll_all() returns 0 and unlocks big_gpib_mutex
  open_dev_ioctl: open new device and clear stuck_srq
                  with big_gpib_mutex held
  autospoll: set stuck_srq

That leaves the board marked stuck again after the new device is opened.
autospoll_wait_should_wake_up() then refuses to poll while stuck_srq is
set, so later SRQ handling can be mistakenly suppressed.

Without the mutex, atomic_set() and set_bit() only make individual
updates atomic. They do not order the two updates or make stuck_srq and
status visible as a consistent pair. Taking big_gpib_mutex serializes the
state transition with the other runtime users.

Keep the existing wakeup behavior unchanged and only move the stuck SRQ
state update under the mutex.

Fixes: 9dde4559e9 ("staging: gpib: Add GPIB common core driver")
Signed-off-by: Gui-Dong Han <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-07-17 14:53:47 +02:00
Dominik Karol Piątkowski 28a561eeaf gpib: fmh_gpib: Fix typo
Fix typo: Hueristically -> Heuristically

Signed-off-by: Dominik Karol Piątkowski <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-07-17 14:53:42 +02:00
Uwe Kleine-König (The Capable Hub) 995832b2ce Replace <linux/mod_devicetable.h> by more specific <linux/device-id/*.h> (c files)
Replace the #include of <linux/mod_devicetable.h> by the more specific
<linux/device-id/*.h> where applicable. For most cases the include
can be dropped completely, only a few drivers need one or two headers
added.

Acked-by: Danilo Krummrich <[email protected]>
Acked-by: Takashi Sakamoto <[email protected]>
Acked-by: Bjorn Helgaas <[email protected]>
Link: https://patch.msgid.link/1a3f2007c5c5dcf555c09a4035ce3ae8ef1b6c49.1782808461.git.u.kleine-koenig@baylibre.com
Signed-off-by: Uwe Kleine-König (The Capable Hub) <[email protected]>
2026-07-03 07:38:17 +02:00
Greg Kroah-Hartman 285ecb7d9e Revert "gpib: cb7210: Fix region leak when request_irq fails"
This reverts commit 5ad2849605.

Turns out not to be correct.

Link: https://lore.kernel.org/r/PpNUbGhrvT8I_KayoDvQYI2PYjmMw1QEkuVBDZz2PwBsVVgPkBXJarc2mBM0IhiH3AQG0GtgqEsDRXNj3yUKEDBaZa25u73pAjvcE6vfRsg=@protonmail.com
Reported-by: Dominik Karol Piątkowski <[email protected]>
Cc: Mark Brown <[email protected]>
Cc: Hongling Zeng <[email protected]>
Cc: Hongling Zeng <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-05-30 12:29:07 +02:00
Hongling Zeng 5ad2849605 gpib: cb7210: Fix region leak when request_irq fails
When request_irq() fails, the region allocated by request_region()
is not released. Fix this by calling release_region() before returning.

  Smatch warning:
    drivers/gpib/cb7210/cb7210.c:1068 cb_isa_attach() warn: 'config->ibbase'
  from __request_region() not released on lines: 1064.

Fixes: 82e3508046 ("staging: gpib: cb7210 console messaging cleanup")
Signed-off-by: Hongling Zeng <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-05-23 13:47:34 +02:00
Adam Crosser c4faab452b gpib: fix double decrement of descriptor_busy in command_ioctl()
commit d1857f8296 ("gpib: fix use-after-free in IO ioctl handlers")
introduced a descriptor_busy reference counter to pin struct
gpib_descriptor across IO ioctl operations.  In command_ioctl(), the
error path inside the loop decrements descriptor_busy and breaks, but
execution then falls through to the unconditional decrement after the
loop, underflowing the counter to -1.

This re-enables the use-after-free that the original fix was meant to
prevent: a concurrent close_dev_ioctl() sees descriptor_busy == 0 on
an actively-used descriptor and frees it.

Remove the early decrement from the error path.  The post-loop
decrement already handles all exit paths, matching the correct pattern
used in read_ioctl() and write_ioctl().

Fixes: d1857f8296 ("gpib: fix use-after-free in IO ioctl handlers")
Reported-by: Ruikai Peng <[email protected]>
Signed-off-by: Adam Crosser <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-05-23 13:47:34 +02:00
Joe Simmons-Talbott 6be50f680a gpib: agilent_82357a: don't check a NULL serial string
The agilent_82357a driver uses the USB device serial string for device
matching but does not verify that the string exists before passing it
to strcmp().

Verify that the device has a serial number before accessing it to avoid
triggering a NULL-pointer dereference with devices that don't provide
a serial number (iSerialNumber = 0).

Similar to commit aa79f996eb ("i2c: cp2615: fix serial string
NULL-deref at probe").

Found by Claude:sonnet-4.5

Signed-off-by: Joe Simmons-Talbott <[email protected]>
Acked-by: Dave Penkler <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-05-23 13:47:34 +02:00
Dave Penkler 7c19b47f5a gpib: Suppress setting END on error from NI_USB dongle
The NI USB adapter sets the END bit in the status word when an error
occurs such as a read being interrupted by the setting of ATN. This
happens for example when a device clear is received from the
controller in charge during a read.

The common driver changes the error return to 0 whenever the END bit
is set in order to avoid errors such as timeout or interrupt to be
reported after the full message has actually been read. The behaviour
of the NI USB adapter in setting the END bit on errors was causing
actual errors (-EINTR, -ETIMEDOUT) not to be reported.

We avoid setting the END bit in the ni_usb_gpib driver when an error
is reported in error_code of the status from the adaptor.

Signed-off-by: Dave Penkler <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-05-23 13:47:33 +02:00
Dave Penkler 4f2d31d243 gpib; Add register and unregister calls
Register the driver for new 72130 based pci_xl board type with the
common driver on module initialisation.
Unregister the driver on registration error and module exit.

Signed-off-by: Dave Penkler <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-05-23 13:47:33 +02:00
Dave Penkler b9e4f6e9b2 gpib: Add attach routine for pci_xl board
Add new attach routine for 72130 based boards.

Signed-off-by: Dave Penkler <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-05-23 13:47:33 +02:00
Dave Penkler 1d0e413791 gpib: Add ines_pci_xl_interface
Add new interface initialisation struct for 72130 based boards.

It is basically the same as the ines_pci_interface apart from the
name, attach and line_status fields.

Signed-off-by: Dave Penkler <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-05-23 13:47:33 +02:00
Dave Penkler 1b2bfb7ac2 gpib: Don't use extended registers
When the chip type is 72310 then avoid accessing extended registers
Apart from the BSR the 72310 supports only the standard NEC u7210
registers.

Signed-off-by: Dave Penkler <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-05-23 13:47:33 +02:00
Dave Penkler 3be376ac8f gpib: Add ines 72130 line_status routine
The 72130 chip has a different bus statue register offset
and layout.

Signed-off-by: Dave Penkler <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-05-23 13:47:33 +02:00
Dave Penkler 63625f43d1 gpib: Add enums for INES 72130 based cards
Add Chip type enum
Add offset for 72130 bus status register
Add bit masks for line state in 72130 bus status register

Signed-off-by: Dave Penkler <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-05-23 13:47:33 +02:00
Dave Penkler 70ea440324 gpib: Fix inappropriate ioctl error return
The driver was returning -ENOTTY in the case the ioctl command
was not recognised. Change it to -EBADRQC.

Fixes: 9dde4559e9 ("staging: gpib: Add GPIB common core driver")
Signed-off-by: Dave Penkler <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-05-23 13:47:33 +02:00
Dave Penkler 89f34ef577 gpib: Remove useless code
This code is a hangover from an earlier approach in the
driver where the driver modules were called gpibXX
It no longer serves any purpose.

Signed-off-by: Dave Penkler <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-05-23 13:47:32 +02:00
Greg Kroah-Hartman a521013548 Merge tag 'v7.0-rc7' into char-misc-next
We need the char/misc/iio/comedi fixes in here as well for testing

Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-04-06 09:04:53 +02:00
Adam Crosser d1857f8296 gpib: fix use-after-free in IO ioctl handlers
The IBRD, IBWRT, IBCMD, and IBWAIT ioctl handlers use a gpib_descriptor
pointer after board->big_gpib_mutex has been released.  A concurrent
IBCLOSEDEV ioctl can free the descriptor via close_dev_ioctl() during
this window, causing a use-after-free.

The IO handlers (read_ioctl, write_ioctl, command_ioctl) explicitly
release big_gpib_mutex before calling their handler.  wait_ioctl() is
called with big_gpib_mutex held, but ibwait() releases it internally
when wait_mask is non-zero.  In all four cases, the descriptor pointer
obtained from handle_to_descriptor() becomes unprotected.

Fix this by introducing a kernel-only descriptor_busy reference count
in struct gpib_descriptor.  Each handler atomically increments
descriptor_busy under file_priv->descriptors_mutex before releasing the
lock, and decrements it when done.  close_dev_ioctl() checks
descriptor_busy under the same lock and rejects the close with -EBUSY
if the count is non-zero.

A reference count rather than a simple flag is necessary because
multiple handlers can operate on the same descriptor concurrently
(e.g. IBRD and IBWAIT on the same handle from different threads).

A separate counter is needed because io_in_progress can be cleared from
unprivileged userspace via the IBWAIT ioctl (through general_ibstatus()
with set_mask containing CMPL), which would allow an attacker to bypass
a check based solely on io_in_progress.  The new descriptor_busy
counter is only modified by the kernel IO paths.

The lock ordering is consistent (big_gpib_mutex -> descriptors_mutex)
and the handlers only hold descriptors_mutex briefly during the lookup,
so there is no deadlock risk and no impact on IO throughput.

Signed-off-by: Adam Crosser <[email protected]>
Cc: stable <[email protected]>
Reviewed-by: Dave Penkler <[email protected]>
Tested-by: Dave Penkler <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-04-02 14:30:40 +02:00
Johan Hovold 5cefb52c1a gpib: lpvo_usb: fix memory leak on disconnect
The driver iterates over the registered USB interfaces during GPIB
attach and takes a reference to their USB devices until a match is
found. These references are never released which leads to a memory leak
when devices are disconnected.

Fix the leak by dropping the unnecessary references.

Fixes: fce79512a9 ("staging: gpib: Add LPVO DIY USB GPIB driver")
Cc: stable <[email protected]> # 6.13
Cc: Dave Penkler <[email protected]>
Signed-off-by: Johan Hovold <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-04-02 14:30:30 +02:00
Dave Penkler 579af7204d gpib: Fix fluke driver s390 compile issue
The following errors were reported for a s390 randconfig build
of the fluke gpib driver:

>> drivers/gpib/eastwood/fluke_gpib.c:1002:23: error: call to undeclared function 'ioremap'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    1002 |         nec_priv->mmiobase = ioremap(e_priv->gpib_iomem_res->start,
         |                              ^
>> drivers/gpib/eastwood/fluke_gpib.c:1002:21: error: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion]
    1002 |         nec_priv->mmiobase = ioremap(e_priv->gpib_iomem_res->start,
         |                            ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1003 |                                      resource_size(e_priv->gpib_iomem_res));
         |                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpib/eastwood/fluke_gpib.c:1036:33: error: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion]
    1036 |         e_priv->write_transfer_counter = ioremap(e_priv->write_transfer_counter_res->start,
         |                                        ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1037 |                                                  resource_size(e_priv->write_transfer_counter_res));
         |                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Add HAS_IOMEM dependency to Kconfig for fluke driver option

Suggested-by: Arnd Bergmann <[email protected]>
Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Fixes: baf8855c91 ("staging: gpib: fix address space mixup")
Cc: stable <[email protected]>
Signed-off-by: Dave Penkler <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-04-02 14:30:25 +02:00
Johan Hovold 678f946b40 gpib: ni_usb: drop redundant device reference
Driver core holds a reference to the USB interface and its parent USB
device while the interface is bound to a driver and there is no need to
take additional references unless the structures are needed after
disconnect.

Drop the redundant device reference to reduce cargo culting, make it
easier to spot drivers where an extra reference is needed, and reduce
the risk of memory leaks when drivers fail to release it.

Signed-off-by: Johan Hovold <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-03-16 11:48:54 +01:00
Johan Hovold d35da40ec3 gpib: agilent_82357a: drop redundant device reference
Driver core holds a reference to the USB interface and its parent USB
device while the interface is bound to a driver and there is no need to
take additional references unless the structures are needed after
disconnect.

Drop the redundant device reference to reduce cargo culting, make it
easier to spot drivers where an extra reference is needed, and reduce
the risk of memory leaks when drivers fail to release it.

Signed-off-by: Johan Hovold <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-03-16 11:48:54 +01:00
Jori Koolstra 0457681354 gpib: common: change gpib_class to a const struct
The class_create() call has been deprecated in favor of class_register()
as the driver core now allows for a struct class to be in read-only
memory. Change gpib_class to be a const struct class and drop the
class_create() call.

Link: https://lore.kernel.org/all/2023040244-duffel-pushpin-f738@gregkh/

Suggested-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Jori Koolstra <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-03-16 11:48:51 +01:00
Ethan Nelson-Moore 42df3a519a gpib: remove unnecessary module_init/exit functions
Two GPIB drivers have unnecessary empty module_init and module_exit
functions. Remove them. Note that if a module_init function exists, a
module_exit function must also exist; otherwise, the module cannot be
unloaded.

Signed-off-by: Ethan Nelson-Moore <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-03-16 11:48:40 +01:00
Johan Hovold bf3e24a9bf gpib: lpvo_usb: rename driver symbol prefix
The LPVO driver apparently includes a more or less verbatim copy of the
USB skeleton driver.

Replace the "skel_" symbol prefix with "lpvo_" and rename the "usb_skel"
struct "lpvo" to avoid symbol name clashes and make this a bit more
palatable.

Signed-off-by: Johan Hovold <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-03-16 11:43:51 +01:00
Johan Hovold 163cc462de gpib: lpvo_usb: fix unintended binding of FTDI 8U232AM devices
The LPVO USB GPIB adapter apparently uses an FTDI 8U232AM with the
default PID, but this device id is already handled by the ftdi_sio
serial driver.

Stop binding to the default PID to avoid breaking existing setups with
FTDI 8U232AM.

Anyone using this driver should blacklist the ftdi_sio driver and add
the device id manually through sysfs (e.g. using udev rules).

Fixes: fce79512a9 ("staging: gpib: Add LPVO DIY USB GPIB driver")
Fixes: e6ab504633 ("staging: gpib: Destage gpib")
Cc: Dave Penkler <[email protected]>
Cc: stable <[email protected]>
Signed-off-by: Johan Hovold <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-03-11 16:23:32 +01:00
Linus Torvalds 32a92f8c89 Convert more 'alloc_obj' cases to default GFP_KERNEL arguments
This converts some of the visually simpler cases that have been split
over multiple lines.  I only did the ones that are easy to verify the
resulting diff by having just that final GFP_KERNEL argument on the next
line.

Somebody should probably do a proper coccinelle script for this, but for
me the trivial script actually resulted in an assertion failure in the
middle of the script.  I probably had made it a bit _too_ trivial.

So after fighting that far a while I decided to just do some of the
syntactically simpler cases with variations of the previous 'sed'
scripts.

The more syntactically complex multi-line cases would mostly really want
whitespace cleanup anyway.

Signed-off-by: Linus Torvalds <[email protected]>
2026-02-21 20:03:00 -08:00
Linus Torvalds bf4afc53b7 Convert 'alloc_obj' family to use the new default GFP_KERNEL argument
This was done entirely with mindless brute force, using

    git grep -l '\<k[vmz]*alloc_objs*(.*, GFP_KERNEL)' |
        xargs sed -i 's/\(alloc_objs*(.*\), GFP_KERNEL)/\1)/'

to convert the new alloc_obj() users that had a simple GFP_KERNEL
argument to just drop that argument.

Note that due to the extreme simplicity of the scripting, any slightly
more complex cases spread over multiple lines would not be triggered:
they definitely exist, but this covers the vast bulk of the cases, and
the resulting diff is also then easier to check automatically.

For the same reason the 'flex' versions will be done as a separate
conversion.

Signed-off-by: Linus Torvalds <[email protected]>
2026-02-21 17:09:51 -08:00
Kees Cook 69050f8d6d treewide: Replace kmalloc with kmalloc_obj for non-scalar types
This is the result of running the Coccinelle script from
scripts/coccinelle/api/kmalloc_objs.cocci. The script is designed to
avoid scalar types (which need careful case-by-case checking), and
instead replace kmalloc-family calls that allocate struct or union
object instances:

Single allocations:	kmalloc(sizeof(TYPE), ...)
are replaced with:	kmalloc_obj(TYPE, ...)

Array allocations:	kmalloc_array(COUNT, sizeof(TYPE), ...)
are replaced with:	kmalloc_objs(TYPE, COUNT, ...)

Flex array allocations:	kmalloc(struct_size(PTR, FAM, COUNT), ...)
are replaced with:	kmalloc_flex(*PTR, FAM, COUNT, ...)

(where TYPE may also be *VAR)

The resulting allocations no longer return "void *", instead returning
"TYPE *".

Signed-off-by: Kees Cook <[email protected]>
2026-02-21 01:02:28 -08:00
Dominik Karol Piątkowski 3df1fd31f6 gpib: tnt4882: Unify *allocate_private usage
Use the return value of tnt4882_allocate_private in calling code as
early return value in case of error.

Signed-off-by: Dominik Karol Piątkowski <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-01-27 16:04:08 +01:00
Dominik Karol Piątkowski 9effb86530 gpib: tnt4882: Unify *allocate_private return value
Return -ENOMEM instead of -1 in tnt4882_allocate_private in case of
memory allocation failure.

Signed-off-by: Dominik Karol Piątkowski <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-01-27 16:04:08 +01:00
Dominik Karol Piątkowski a16ad9b68b gpib: tnt4882: Replace kmalloc/memset to kzalloc in *allocate_private
Replace kmalloc/memset pair to kzalloc in tnt4882_allocate_private.

Signed-off-by: Dominik Karol Piątkowski <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-01-27 16:04:08 +01:00
Dominik Karol Piątkowski c2a9f77c0e gpib: pc2: Unify *allocate_private usage
Use the return value of allocate_private in calling code as early return
value in case of error.

Signed-off-by: Dominik Karol Piątkowski <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-01-27 16:04:08 +01:00
Dominik Karol Piątkowski 68de22e994 gpib: pc2: Unify *allocate_private return value
Return -ENOMEM instead of -1 in allocate_private in case of memory
allocation failure.

Signed-off-by: Dominik Karol Piątkowski <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-01-27 16:04:08 +01:00
Dominik Karol Piątkowski 6e6dc3f7c0 gpib: pc2: Replace kmalloc/memset to kzalloc in *allocate_private
Replace kmalloc/memset pair to kzalloc in allocate_private.

Signed-off-by: Dominik Karol Piątkowski <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-01-27 16:04:08 +01:00
Dominik Karol Piątkowski 78047416f8 gpib: ni_usb: Fix the *allocate_private retval check
Change

if (retval < 0)
        return retval;

into

if (retval)
        return retval;

as it is more fitting in this case.

Signed-off-by: Dominik Karol Piątkowski <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-01-27 16:04:08 +01:00
Dominik Karol Piątkowski 64900aa878 gpib: ni_usb: Replace kmalloc/memset to kzalloc in *allocate_private
Replace kmalloc/memset pair to kzalloc in ni_usb_allocate_private.

Signed-off-by: Dominik Karol Piątkowski <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-01-27 16:04:07 +01:00
Dominik Karol Piątkowski 11f1b16916 gpib: ines: Unify *allocate_private usage
Use the return value of ines_allocate_private in calling code as early
return value in case of error.

Signed-off-by: Dominik Karol Piątkowski <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-01-27 16:04:07 +01:00
Dominik Karol Piątkowski 24d4d06acb gpib: ines: Unify *allocate_private return value
Return -ENOMEM instead of -1 in ines_allocate_private in case of memory
allocation failure.

Signed-off-by: Dominik Karol Piątkowski <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-01-27 16:04:07 +01:00
Dominik Karol Piątkowski b3d3ab10b9 gpib: ines: Replace kmalloc/memset to kzalloc in *allocate_private
Replace kmalloc/memset pair to kzalloc in ines_allocate_private.

Signed-off-by: Dominik Karol Piątkowski <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-01-27 16:04:07 +01:00
Dominik Karol Piątkowski 3f5d831600 gpib: hp_82341: Unify *allocate_private usage
Use the return value of hp_82341_allocate_private in calling code as
early return value in case of error.

Signed-off-by: Dominik Karol Piątkowski <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-01-27 16:04:07 +01:00
Dominik Karol Piątkowski c0790b6c90 gpib: hp_82335: Unify *allocate_private usage
Use the return value of hp82335_allocate_private in calling code as
early return value in case of error.

Signed-off-by: Dominik Karol Piątkowski <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2026-01-27 16:04:07 +01:00