staging: gpib: Using gpib_select_device_path_ioctl
authorMichael Rubin <matchstick@neverthere.org>
Wed, 9 Apr 2025 05:58:57 +0000 (05:58 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 15 Apr 2025 14:46:09 +0000 (16:46 +0200)
Using Linux code style for 'struct gpib_select_device_path_ioctl' to
remove typedef.

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/20250409055903.321438-16-matchstick@neverthere.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/gpib/common/gpib_os.c
drivers/staging/gpib/uapi/gpib_ioctl.h

index ceaf9cc93233ab4c1450a903e10a6760882d6fae..b47a5078c493c043cb38302f0348e933b1af213f 100644 (file)
@@ -1815,17 +1815,18 @@ static int select_pci_ioctl(struct gpib_board_config *config, unsigned long arg)
 
 static int select_device_path_ioctl(struct gpib_board_config *config, unsigned long arg)
 {
-       select_device_path_ioctl_t *selection;
+       struct gpib_select_device_path_ioctl *selection;
        int retval;
 
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
 
-       selection = vmalloc(sizeof(select_device_path_ioctl_t));
+       selection = vmalloc(sizeof(struct gpib_select_device_path_ioctl));
        if (!selection)
                return -ENOMEM;
 
-       retval = copy_from_user(selection, (void __user *)arg, sizeof(select_device_path_ioctl_t));
+       retval = copy_from_user(selection, (void __user *)arg,
+                               sizeof(struct gpib_select_device_path_ioctl));
        if (retval) {
                vfree(selection);
                return -EFAULT;
index a0fbc660ab996e8fd0555128d4152fa0fe8607ae..473b09d4efaa7b5a4dce16353e895cdde0ee8861 100644 (file)
@@ -103,9 +103,9 @@ struct gpib_sad_ioctl {
 };
 
 // select a piece of hardware to attach by its sysfs device path
-typedef struct {
+struct gpib_select_device_path_ioctl {
        char device_path[0x1000];
-} select_device_path_ioctl_t;
+};
 
 typedef short event_ioctl_t;
 typedef int rsc_ioctl_t;
@@ -161,7 +161,7 @@ enum gpib_ioctl {
        IBONL = _IOW(GPIB_CODE, 39, struct gpib_online_ioctl),
        IBPP2_SET = _IOW(GPIB_CODE, 40, local_ppoll_mode_ioctl_t),
        IBPP2_GET = _IOR(GPIB_CODE, 41, local_ppoll_mode_ioctl_t),
-       IBSELECT_DEVICE_PATH = _IOW(GPIB_CODE, 43, select_device_path_ioctl_t),
+       IBSELECT_DEVICE_PATH = _IOW(GPIB_CODE, 43, struct gpib_select_device_path_ioctl),
        // 44 was IBSELECT_SERIAL_NUMBER
        IBRSV2 = _IOW(GPIB_CODE, 45, request_service2_t)
 };