From: Dave Penkler <dpenkler@gmail.com>
To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org
Cc: Dave Penkler <dpenkler@gmail.com>
Subject: [PATCH 4/4] staging: gpib: Use C99 syntax and make static
Date: Tue, 14 Jan 2025 17:54:03 +0100 [thread overview]
Message-ID: <20250114165403.16410-5-dpenkler@gmail.com> (raw)
In-Reply-To: <20250114165403.16410-1-dpenkler@gmail.com>
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>
---
.../gpib/agilent_82357a/agilent_82357a.c | 2 +-
drivers/staging/gpib/common/gpib_os.c | 14 ++---
drivers/staging/gpib/gpio/gpib_bitbang.c | 4 +-
drivers/staging/gpib/ines/ines_gpib.c | 58 +++++++++----------
4 files changed, 39 insertions(+), 39 deletions(-)
diff --git a/drivers/staging/gpib/agilent_82357a/agilent_82357a.c b/drivers/staging/gpib/agilent_82357a/agilent_82357a.c
index c22c6bb30776..34d85a1bdb37 100644
--- a/drivers/staging/gpib/agilent_82357a/agilent_82357a.c
+++ b/drivers/staging/gpib/agilent_82357a/agilent_82357a.c
@@ -19,7 +19,7 @@ MODULE_DESCRIPTION("GPIB driver for Agilent 82357A/B usb adapters");
#define MAX_NUM_82357A_INTERFACES 128
static struct usb_interface *agilent_82357a_driver_interfaces[MAX_NUM_82357A_INTERFACES];
-DEFINE_MUTEX(agilent_82357a_hotplug_lock); // protect board insertion and removal
+static DEFINE_MUTEX(agilent_82357a_hotplug_lock); // protect board insertion and removal
static unsigned int agilent_82357a_update_status(gpib_board_t *board, unsigned int clear_mask);
diff --git a/drivers/staging/gpib/common/gpib_os.c b/drivers/staging/gpib/common/gpib_os.c
index 3234d4348957..4901e660242e 100644
--- a/drivers/staging/gpib/common/gpib_os.c
+++ b/drivers/staging/gpib/common/gpib_os.c
@@ -2023,13 +2023,13 @@ static int t1_delay_ioctl(gpib_board_t *board, unsigned long arg)
return 0;
}
-const struct file_operations ib_fops = {
-owner: THIS_MODULE,
-llseek : NULL,
-unlocked_ioctl : &ibioctl,
-compat_ioctl : &ibioctl,
-open : &ibopen,
-release : &ibclose,
+static const struct file_operations ib_fops = {
+ .owner = THIS_MODULE,
+ .llseek = NULL,
+ .unlocked_ioctl = &ibioctl,
+ .compat_ioctl = &ibioctl,
+ .open = &ibopen,
+ .release = &ibclose,
};
gpib_board_t board_array[GPIB_MAX_NUM_BOARDS];
diff --git a/drivers/staging/gpib/gpio/gpib_bitbang.c b/drivers/staging/gpib/gpio/gpib_bitbang.c
index 16e2d0c5642e..828c99ea613f 100644
--- a/drivers/staging/gpib/gpio/gpib_bitbang.c
+++ b/drivers/staging/gpib/gpio/gpib_bitbang.c
@@ -147,7 +147,7 @@ DEFINE_LED_TRIGGER(ledtrig_gpib);
led_trigger_event(ledtrig_gpib, LED_OFF); } \
while (0)
-struct gpio_desc *all_descriptors[GPIB_PINS + SN7516X_PINS];
+static struct gpio_desc *all_descriptors[GPIB_PINS + SN7516X_PINS];
#define D01 all_descriptors[0]
#define D02 all_descriptors[1]
@@ -175,7 +175,7 @@ struct gpio_desc *all_descriptors[GPIB_PINS + SN7516X_PINS];
/* YOGA dapter uses a global enable for the buffer chips, re-using the TE pin */
#define YOGA_ENABLE TE
-int gpios_vector[] = {
+static int gpios_vector[] = {
D01_pin_nr,
D02_pin_nr,
D03_pin_nr,
diff --git a/drivers/staging/gpib/ines/ines_gpib.c b/drivers/staging/gpib/ines/ines_gpib.c
index 846dafc85c11..22a05a287bce 100644
--- a/drivers/staging/gpib/ines/ines_gpib.c
+++ b/drivers/staging/gpib/ines/ines_gpib.c
@@ -357,38 +357,38 @@ struct ines_pci_id {
enum ines_pci_chip pci_chip_type;
};
-struct ines_pci_id pci_ids[] = {
- {vendor_id: PCI_VENDOR_ID_PLX,
- device_id : PCI_DEVICE_ID_PLX_9050,
- subsystem_vendor_id : PCI_VENDOR_ID_PLX,
- subsystem_device_id : PCI_SUBDEVICE_ID_INES_GPIB,
- gpib_region : 2,
- io_offset : 1,
- pci_chip_type : PCI_CHIP_PLX9050,
+static struct ines_pci_id pci_ids[] = {
+ {.vendor_id = PCI_VENDOR_ID_PLX,
+ .device_id = PCI_DEVICE_ID_PLX_9050,
+ .subsystem_vendor_id = PCI_VENDOR_ID_PLX,
+ .subsystem_device_id = PCI_SUBDEVICE_ID_INES_GPIB,
+ .gpib_region = 2,
+ .io_offset = 1,
+ .pci_chip_type = PCI_CHIP_PLX9050,
},
- {vendor_id: PCI_VENDOR_ID_AMCC,
- device_id : PCI_DEVICE_ID_INES_GPIB_AMCC,
- subsystem_vendor_id : PCI_VENDOR_ID_AMCC,
- subsystem_device_id : PCI_SUBDEVICE_ID_INES_GPIB,
- gpib_region : 1,
- io_offset : 1,
- pci_chip_type : PCI_CHIP_AMCC5920,
+ {.vendor_id = PCI_VENDOR_ID_AMCC,
+ .device_id = PCI_DEVICE_ID_INES_GPIB_AMCC,
+ .subsystem_vendor_id = PCI_VENDOR_ID_AMCC,
+ .subsystem_device_id = PCI_SUBDEVICE_ID_INES_GPIB,
+ .gpib_region = 1,
+ .io_offset = 1,
+ .pci_chip_type = PCI_CHIP_AMCC5920,
},
- {vendor_id: PCI_VENDOR_ID_INES_QUICKLOGIC,
- device_id : PCI_DEVICE_ID_INES_GPIB_QL5030,
- subsystem_vendor_id : PCI_VENDOR_ID_INES_QUICKLOGIC,
- subsystem_device_id : PCI_DEVICE_ID_INES_GPIB_QL5030,
- gpib_region : 1,
- io_offset : 1,
- pci_chip_type : PCI_CHIP_QUICKLOGIC5030,
+ {.vendor_id = PCI_VENDOR_ID_INES_QUICKLOGIC,
+ .device_id = PCI_DEVICE_ID_INES_GPIB_QL5030,
+ .subsystem_vendor_id = PCI_VENDOR_ID_INES_QUICKLOGIC,
+ .subsystem_device_id = PCI_DEVICE_ID_INES_GPIB_QL5030,
+ .gpib_region = 1,
+ .io_offset = 1,
+ .pci_chip_type = PCI_CHIP_QUICKLOGIC5030,
},
- {vendor_id: PCI_VENDOR_ID_QUANCOM,
- device_id : PCI_DEVICE_ID_QUANCOM_GPIB,
- subsystem_vendor_id : -1,
- subsystem_device_id : -1,
- gpib_region : 0,
- io_offset : 4,
- pci_chip_type : PCI_CHIP_QUANCOM,
+ {.vendor_id = PCI_VENDOR_ID_QUANCOM,
+ .device_id = PCI_DEVICE_ID_QUANCOM_GPIB,
+ .subsystem_vendor_id = -1,
+ .subsystem_device_id = -1,
+ .gpib_region = 0,
+ .io_offset = 4,
+ .pci_chip_type = PCI_CHIP_QUANCOM,
},
};
--
2.47.1
prev parent reply other threads:[~2025-01-14 16:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-14 16:53 [PATCH 0/4] staging: gpib: Clean up types and struct initialization Dave Penkler
2025-01-14 16:54 ` [PATCH 1/4] staging: gpib: Use __iomem attribute for io addresses Dave Penkler
2025-01-14 16:54 ` [PATCH 2/4] staging: gpib: Use __user for user space pointers Dave Penkler
2025-01-14 16:54 ` [PATCH 3/4] staging: gpib: Avoid plain integers as NULL pointers Dave Penkler
2025-01-14 16:54 ` Dave Penkler [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250114165403.16410-5-dpenkler@gmail.com \
--to=dpenkler@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox