]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
staging: gpib: avoid unused const variables
authorArnd Bergmann <arnd@arndb.de>
Wed, 16 Oct 2024 11:15:16 +0000 (11:15 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 19 Oct 2024 07:57:03 +0000 (09:57 +0200)
Variables that are 'static const' but not used anywhere cause a warning
with "gcc -Wunused-const-variable", which we may want to enable by default
in the future.

The gpib code already has a mix of 'enum' and 'static const' variables
for named constants, so convert the ones that are causing problems to
enums as well, or move them closer to the only users where possible.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20241016111521.1143191-3-arnd@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/gpib/common/gpib_os.c
drivers/staging/gpib/eastwood/fluke_gpib.h
drivers/staging/gpib/include/nec7210_registers.h
drivers/staging/gpib/include/tms9914.h
drivers/staging/gpib/include/tnt4882_registers.h
drivers/staging/gpib/ines/ines.h
drivers/staging/gpib/ines/ines_gpib.c
drivers/staging/gpib/tms9914/tms9914.c
drivers/staging/gpib/tnt4882/tnt4882_gpib.c
drivers/staging/gpib/uapi/gpib_user.h

index 01efe99adeb3640c4778fb40a5731d17b9249afc..e9dd7b2d1569a042a4d50fb88a24eccaeac43232 100644 (file)
@@ -523,6 +523,8 @@ int serial_poll_all(gpib_board_t *board, unsigned int usec_timeout)
  * SPD and UNT are sent at the completion of the poll.
  */
 
+static const int gpib_addr_max = 30;   /* max address for primary/secondary gpib addresses */
+
 int dvrsp(gpib_board_t *board, unsigned int pad, int sad,
          unsigned int usec_timeout, uint8_t *result)
 {
index d6c5b0124c7e2b36247904615265144c79dc14ba..fcbd42f8f9af6144d57ff342c9adb51da6134bc6 100644 (file)
@@ -136,6 +136,8 @@ enum cb7210_aux_cmds {
        AUX_HI_SPEED = 0x41,
 };
 
-static const int fluke_reg_offset = 4;
-static const int fluke_num_regs = 8;
-static const unsigned int write_transfer_counter_mask = 0x7ff;
+enum {
+       fluke_reg_offset = 4,
+       fluke_num_regs = 8,
+       write_transfer_counter_mask = 0x7ff,
+};
index 2ad512c372c4dc0c48a2b1d78a0fe733e25b38eb..888803dd97f9e7ac2229bff5318e7b245cdff0e8 100644 (file)
@@ -17,9 +17,6 @@ enum nec7210_chipset {
        TNT5004,        // NI (minor differences to TNT4882)
 };
 
-// nec7210 has 8 registers
-static const int nec7210_num_registers = 8;
-
 /* nec7210 register numbers (might need to be multiplied by
  * a board-dependent offset to get actually io address offset)
  */
@@ -33,6 +30,9 @@ enum nec7210_write_regs {
        AUXMR,  // auxiliary mode
        ADR,    // address
        EOSR,   // end-of-string
+
+       // nec7210 has 8 registers
+       nec7210_num_registers = 8,
 };
 
 // read registers
index 1cbba02c358151ed1c8367526f8f59f8ec8a83d3..456b488212d2b7d23981618581d8fb5f5400b69b 100644 (file)
@@ -132,7 +132,9 @@ irqreturn_t tms9914_interrupt_have_status(gpib_board_t *board, struct tms9914_pr
                                          int status1,  int status2);
 
 // tms9914 has 8 registers
-static const int tms9914_num_registers = 8;
+enum {
+       ms9914_num_registers = 8,
+};
 
 /* tms9914 register numbers (might need to be multiplied by
  * a board-dependent offset to get actually io address offset)
index f0a719772f413e1ad15ec26072e955eca17f88c7..1b1441cd03d50ec23dca803be5853601b0d8addc 100644 (file)
@@ -40,7 +40,9 @@ enum {
        BSR = BCR,
 };
 
-static const int tnt_pagein_offset = 0x11;
+enum {
+       tnt_pagein_offset = 0x11,
+};
 
 /*============================================================*/
 
index ae7d042e9f040c5df23e3d1e6f508cecedc1bb63..7e8302619998fe05611221a7a6af4d126d105e87 100644 (file)
@@ -212,7 +212,4 @@ enum ines_auxd_bits {
        INES_T6_50us = 0x10,
 };
 
-static const int ines_isa_iosize = 0x20;
-static const int ines_pcmcia_iosize = 0x20;
-
 #endif // _INES_GPIB_H
index 0b9a5c70e53fab570fbbadf96ddcdbc04cabb9b6..e98a114a9570f91097cf6a9dc69302d25e3f0169 100644 (file)
@@ -88,8 +88,6 @@ unsigned int ines_t1_delay(gpib_board_t *board, unsigned int nano_sec)
        return retval;
 }
 
-static const int in_fifo_size = 0xff;
-
 static inline unsigned short num_in_fifo_bytes(struct ines_priv *ines_priv)
 {
        return ines_inb(ines_priv, IN_FIFO_COUNT);
@@ -885,6 +883,8 @@ int ines_pci_accel_attach(gpib_board_t *board, const gpib_board_config_t *config
        return 0;
 }
 
+static const int ines_isa_iosize = 0x20;
+
 int ines_isa_attach(gpib_board_t *board, const gpib_board_config_t *config)
 {
        struct ines_priv *ines_priv;
@@ -995,6 +995,8 @@ static int pc_debug = PCMCIA_DEBUG;
 #define DEBUG(args...)
 #endif
 
+static const int ines_pcmcia_iosize = 0x20;
+
 /*    The event() function is this driver's Card Services event handler.
  *    It will be called by Card Services when an appropriate card status
  *    event is received.  The config() and release() entry points are
index 4772a1ce8bc9c62d14d1efb4c538d7e70328f5a5..b55340ee25341edf09dcc7af464c5563dcfd0cdd 100644 (file)
@@ -816,9 +816,6 @@ irqreturn_t tms9914_interrupt_have_status(gpib_board_t *board, struct tms9914_pr
 }
 EXPORT_SYMBOL(tms9914_interrupt_have_status);
 
-// size of modbus pci memory io region
-static const int iomem_size = 0x2000;
-
 void tms9914_board_reset(struct tms9914_priv *priv)
 {
        /* chip reset */
index caf25c2a6e1f9c6aedcb9a8629560f1d92efdceb..4d702c4452e8f8f147d72941fb6aa31904129669 100644 (file)
@@ -100,7 +100,6 @@ static const int atgpib_reg_offset = 2;
 
 // number of ioports used
 static const int atgpib_iosize = 32;
-static const int pcmcia_gpib_iosize = 32;
 
 /* paged io */
 static inline unsigned int tnt_paged_readb(struct tnt4882_priv *priv, unsigned long offset)
@@ -1795,6 +1794,8 @@ void __exit exit_ni_gpib_cs(void)
        pcmcia_unregister_driver(&ni_gpib_cs_driver);
 }
 
+static const int pcmcia_gpib_iosize = 32;
+
 int ni_pcmcia_attach(gpib_board_t *board, const gpib_board_config_t *config)
 {
        struct local_info_t *info;
index 4348bb69c9334e73699f1b10782acce6782bd34a..0896a55a758feeae61da2047b001e482b530041b 100644 (file)
@@ -46,12 +46,12 @@ enum ibsta_bits {
        SRQI = (1 << SRQI_NUM), /* SRQ is asserted */
        END = (1 << END_NUM),   /* EOI or EOS encountered */
        TIMO = (1 << TIMO_NUM), /* Time limit on I/O or wait function exceeded */
-       ERR = (1 << ERR_NUM)    /* Function call terminated on error */
-};
+       ERR = (1 << ERR_NUM),   /* Function call terminated on error */
 
-static const int device_status_mask = ERR | TIMO | END | CMPL | RQS;
-static const int board_status_mask = ERR | TIMO | END | CMPL | SPOLL |
-       EVENT | LOK | REM | CIC | ATN | TACS | LACS | DTAS | DCAS | SRQI;
+       device_status_mask = ERR | TIMO | END | CMPL | RQS,
+       board_status_mask = ERR | TIMO | END | CMPL | SPOLL |
+               EVENT | LOK | REM | CIC | ATN | TACS | LACS | DTAS | DCAS | SRQI,
+};
 
 /* IBERR error codes */
 enum iberr_code {
@@ -209,7 +209,9 @@ static inline uint8_t CFGn(unsigned int meters)
 }
 
 /* mask of bits that actually matter in a command byte */
-static const uint8_t gpib_command_mask = 0x7f;
+enum {
+       gpib_command_mask = 0x7f,
+};
 
 static inline int is_PPE(uint8_t command)
 {
@@ -261,8 +263,6 @@ static inline int gpib_address_equal(unsigned int pad1, int sad1, unsigned int p
        return 0;
 }
 
-static const int gpib_addr_max = 30;   /* max address for primary/secondary gpib addresses */
-
 enum ibask_option {
        IbaPAD = 0x1,
        IbaSAD = 0x2,
@@ -341,7 +341,9 @@ enum t1_delays {
        T1_DELAY_350ns = 3
 };
 
-static const int request_service_bit = 0x40;
+enum {
+       request_service_bit = 0x40,
+};
 
 enum gpib_events {
        EventNone = 0,