Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: gpib: avoid unused const variables

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>

authored by

Arnd Bergmann and committed by
Greg Kroah-Hartman
b8989f45 ad59cf38

+33 -26
+2
drivers/staging/gpib/common/gpib_os.c
··· 523 523 * SPD and UNT are sent at the completion of the poll. 524 524 */ 525 525 526 + static const int gpib_addr_max = 30; /* max address for primary/secondary gpib addresses */ 527 + 526 528 int dvrsp(gpib_board_t *board, unsigned int pad, int sad, 527 529 unsigned int usec_timeout, uint8_t *result) 528 530 {
+5 -3
drivers/staging/gpib/eastwood/fluke_gpib.h
··· 136 136 AUX_HI_SPEED = 0x41, 137 137 }; 138 138 139 - static const int fluke_reg_offset = 4; 140 - static const int fluke_num_regs = 8; 141 - static const unsigned int write_transfer_counter_mask = 0x7ff; 139 + enum { 140 + fluke_reg_offset = 4, 141 + fluke_num_regs = 8, 142 + write_transfer_counter_mask = 0x7ff, 143 + };
+3 -3
drivers/staging/gpib/include/nec7210_registers.h
··· 17 17 TNT5004, // NI (minor differences to TNT4882) 18 18 }; 19 19 20 - // nec7210 has 8 registers 21 - static const int nec7210_num_registers = 8; 22 - 23 20 /* nec7210 register numbers (might need to be multiplied by 24 21 * a board-dependent offset to get actually io address offset) 25 22 */ ··· 30 33 AUXMR, // auxiliary mode 31 34 ADR, // address 32 35 EOSR, // end-of-string 36 + 37 + // nec7210 has 8 registers 38 + nec7210_num_registers = 8, 33 39 }; 34 40 35 41 // read registers
+3 -1
drivers/staging/gpib/include/tms9914.h
··· 132 132 int status1, int status2); 133 133 134 134 // tms9914 has 8 registers 135 - static const int tms9914_num_registers = 8; 135 + enum { 136 + ms9914_num_registers = 8, 137 + }; 136 138 137 139 /* tms9914 register numbers (might need to be multiplied by 138 140 * a board-dependent offset to get actually io address offset)
+3 -1
drivers/staging/gpib/include/tnt4882_registers.h
··· 40 40 BSR = BCR, 41 41 }; 42 42 43 - static const int tnt_pagein_offset = 0x11; 43 + enum { 44 + tnt_pagein_offset = 0x11, 45 + }; 44 46 45 47 /*============================================================*/ 46 48
-3
drivers/staging/gpib/ines/ines.h
··· 212 212 INES_T6_50us = 0x10, 213 213 }; 214 214 215 - static const int ines_isa_iosize = 0x20; 216 - static const int ines_pcmcia_iosize = 0x20; 217 - 218 215 #endif // _INES_GPIB_H
+4 -2
drivers/staging/gpib/ines/ines_gpib.c
··· 88 88 return retval; 89 89 } 90 90 91 - static const int in_fifo_size = 0xff; 92 - 93 91 static inline unsigned short num_in_fifo_bytes(struct ines_priv *ines_priv) 94 92 { 95 93 return ines_inb(ines_priv, IN_FIFO_COUNT); ··· 883 885 return 0; 884 886 } 885 887 888 + static const int ines_isa_iosize = 0x20; 889 + 886 890 int ines_isa_attach(gpib_board_t *board, const gpib_board_config_t *config) 887 891 { 888 892 struct ines_priv *ines_priv; ··· 994 994 #else 995 995 #define DEBUG(args...) 996 996 #endif 997 + 998 + static const int ines_pcmcia_iosize = 0x20; 997 999 998 1000 /* The event() function is this driver's Card Services event handler. 999 1001 * It will be called by Card Services when an appropriate card status
-3
drivers/staging/gpib/tms9914/tms9914.c
··· 816 816 } 817 817 EXPORT_SYMBOL(tms9914_interrupt_have_status); 818 818 819 - // size of modbus pci memory io region 820 - static const int iomem_size = 0x2000; 821 - 822 819 void tms9914_board_reset(struct tms9914_priv *priv) 823 820 { 824 821 /* chip reset */
+2 -1
drivers/staging/gpib/tnt4882/tnt4882_gpib.c
··· 100 100 101 101 // number of ioports used 102 102 static const int atgpib_iosize = 32; 103 - static const int pcmcia_gpib_iosize = 32; 104 103 105 104 /* paged io */ 106 105 static inline unsigned int tnt_paged_readb(struct tnt4882_priv *priv, unsigned long offset) ··· 1793 1794 DEBUG(0, "ni_gpib_cs: unloading\n"); 1794 1795 pcmcia_unregister_driver(&ni_gpib_cs_driver); 1795 1796 } 1797 + 1798 + static const int pcmcia_gpib_iosize = 32; 1796 1799 1797 1800 int ni_pcmcia_attach(gpib_board_t *board, const gpib_board_config_t *config) 1798 1801 {
+11 -9
drivers/staging/gpib/uapi/gpib_user.h
··· 46 46 SRQI = (1 << SRQI_NUM), /* SRQ is asserted */ 47 47 END = (1 << END_NUM), /* EOI or EOS encountered */ 48 48 TIMO = (1 << TIMO_NUM), /* Time limit on I/O or wait function exceeded */ 49 - ERR = (1 << ERR_NUM) /* Function call terminated on error */ 50 - }; 49 + ERR = (1 << ERR_NUM), /* Function call terminated on error */ 51 50 52 - static const int device_status_mask = ERR | TIMO | END | CMPL | RQS; 53 - static const int board_status_mask = ERR | TIMO | END | CMPL | SPOLL | 54 - EVENT | LOK | REM | CIC | ATN | TACS | LACS | DTAS | DCAS | SRQI; 51 + device_status_mask = ERR | TIMO | END | CMPL | RQS, 52 + board_status_mask = ERR | TIMO | END | CMPL | SPOLL | 53 + EVENT | LOK | REM | CIC | ATN | TACS | LACS | DTAS | DCAS | SRQI, 54 + }; 55 55 56 56 /* IBERR error codes */ 57 57 enum iberr_code { ··· 209 209 } 210 210 211 211 /* mask of bits that actually matter in a command byte */ 212 - static const uint8_t gpib_command_mask = 0x7f; 212 + enum { 213 + gpib_command_mask = 0x7f, 214 + }; 213 215 214 216 static inline int is_PPE(uint8_t command) 215 217 { ··· 262 260 263 261 return 0; 264 262 } 265 - 266 - static const int gpib_addr_max = 30; /* max address for primary/secondary gpib addresses */ 267 263 268 264 enum ibask_option { 269 265 IbaPAD = 0x1, ··· 341 341 T1_DELAY_350ns = 3 342 342 }; 343 343 344 - static const int request_service_bit = 0x40; 344 + enum { 345 + request_service_bit = 0x40, 346 + }; 345 347 346 348 enum gpib_events { 347 349 EventNone = 0,