[Patch v1 15/21] staging: gpib: Using gpib_select_device_path_ioctl

From: Michael Rubin
Date: Wed Apr 09 2025 - 02:03:06 EST


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@xxxxxxxxxxxxxx>
---
drivers/staging/gpib/common/gpib_os.c | 7 ++++---
drivers/staging/gpib/uapi/gpib_ioctl.h | 6 +++---
2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/gpib/common/gpib_os.c b/drivers/staging/gpib/common/gpib_os.c
index 8febd683fe0b..71c379c22be0 100644
--- a/drivers/staging/gpib/common/gpib_os.c
+++ b/drivers/staging/gpib/common/gpib_os.c
@@ -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;
diff --git a/drivers/staging/gpib/uapi/gpib_ioctl.h b/drivers/staging/gpib/uapi/gpib_ioctl.h
index a0fbc660ab99..473b09d4efaa 100644
--- a/drivers/staging/gpib/uapi/gpib_ioctl.h
+++ b/drivers/staging/gpib/uapi/gpib_ioctl.h
@@ -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)
};
--
2.43.0