staging: gpib: randconfig build fixes
cover staging: gpib: randconfig build fixes
From: Arnd Bergmann <[email protected]>
The newly added drivers added a few build failures on my randconfig setup. Some of these only happen with extra warnings enabled, or with the pending series to allow CONFIG_HAS_IOPORT to be disabled.
Arnd
Arnd Bergmann (7):
staging: gpib: add module descriptions
staging: gpib: avoid unused const variables
staging: gpib: pc2: avoid calling undefined dma_free()
staging: gpib: make port I/O code conditional
staging: gpib: add bus specific Kconfig dependencies
staging: gpib: use proper format string in request_module
staging: gpib: cb7210: select NEC7210 library
drivers/staging/gpib/Kconfig | 18 ++++++++- .../gpib/agilent_82350b/agilent_82350b.c | 1 + .../gpib/agilent_82357a/agilent_82357a.c | 1 + drivers/staging/gpib/cb7210/cb7210.c | 1 + drivers/staging/gpib/cec/cec_gpib.c | 1 + drivers/staging/gpib/common/gpib_os.c | 9 +++-- drivers/staging/gpib/eastwood/fluke_gpib.c | 1 + drivers/staging/gpib/eastwood/fluke_gpib.h | 8 ++-- drivers/staging/gpib/gpio/gpib_bitbang.c | 1 + drivers/staging/gpib/hp_82335/hp82335.c | 1 + .../staging/gpib/include/nec7210_registers.h | 6 +-- drivers/staging/gpib/include/tms9914.h | 4 +- .../staging/gpib/include/tnt4882_registers.h | 4 +- drivers/staging/gpib/ines/ines.h | 3 -- drivers/staging/gpib/ines/ines_gpib.c | 7 +++- .../gpib/lpvo_usb_gpib/lpvo_usb_gpib.c | 1 + drivers/staging/gpib/nec7210/nec7210.c | 39 ++++++++++--------- drivers/staging/gpib/ni_usb/ni_usb_gpib.c | 1 + drivers/staging/gpib/pc2/pc2_gpib.c | 5 +++ drivers/staging/gpib/tms9914/tms9914.c | 6 +-- drivers/staging/gpib/tnt4882/tnt4882_gpib.c | 4 +- drivers/staging/gpib/uapi/gpib_user.h | 20 +++++----- 22 files changed, 93 insertions(+), 49 deletions(-)
Signature · 1 line
2.39.5
PATCH 1/7 staging: gpib: add module descriptions
From: Arnd Bergmann <[email protected]>
Every loadable module should have a description, and not having one causes a W=1 build warning, so add these to the newly added modules.
--- drivers/staging/gpib/agilent_82350b/agilent_82350b.c | 1 + drivers/staging/gpib/agilent_82357a/agilent_82357a.c | 1 + drivers/staging/gpib/cb7210/cb7210.c | 1 + drivers/staging/gpib/cec/cec_gpib.c | 1 + drivers/staging/gpib/common/gpib_os.c | 1 + drivers/staging/gpib/eastwood/fluke_gpib.c | 1 + drivers/staging/gpib/gpio/gpib_bitbang.c | 1 + drivers/staging/gpib/hp_82335/hp82335.c | 1 + drivers/staging/gpib/ines/ines_gpib.c | 1 + drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c | 1 + drivers/staging/gpib/nec7210/nec7210.c | 1 + drivers/staging/gpib/ni_usb/ni_usb_gpib.c | 1 + drivers/staging/gpib/pc2/pc2_gpib.c | 1 + drivers/staging/gpib/tms9914/tms9914.c | 1 + drivers/staging/gpib/tnt4882/tnt4882_gpib.c | 1 + 15 files changed, 15 insertions(+)
drivers/staging/gpib/agilent_82350b/agilent_82350b.c +1 -0
@@ -18,6 +18,7 @@#include <linux/wait.h> MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("GPIB driver for Agilent 82350b" );int agilent_82350b_accel_read (gpib_board_t *board,uint8_t *buffer,size_t length,int *end,size_t *bytes_read)
drivers/staging/gpib/agilent_82357a/agilent_82357a.c +1 -0
@@ -15,6 +15,7 @@#include "tms9914.h" MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("GPIB driver for Agilent 82357A/B usb adapter" );#define MAX_NUM_82357A_INTERFACES 128static struct usb_interface *agilent_82357a_driver_interfaces[MAX_NUM_82357A_INTERFACES ];
drivers/staging/gpib/cb7210/cb7210.c +1 -0
@@ -21,6 +21,7 @@#include "quancom_pci.h" MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("GPIB driver Measurement Computing boards using cb7210.2 and cbi488.2" );static inline int have_fifo_word (const struct cb7210_priv *cb_priv) {
drivers/staging/gpib/cec/cec_gpib.c +1 -0
@@ -13,6 +13,7 @@#include <linux/slab.h> MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("GPIB driver for CEC PCI and PCMCIA boards" );/* * GPIB interrupt service routines
drivers/staging/gpib/common/gpib_os.c +1 -0
@@ -20,6 +20,7 @@#include <linux/uaccess.h> MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("GPIB base support" );MODULE_ALIAS_CHARDEV_MAJOR (GPIB_CODE );static int board_type_ioctl (gpib_file_private_t *file_priv,gpib_board_t *board,unsigned long arg);
drivers/staging/gpib/eastwood/fluke_gpib.c +1 -0
@@ -18,6 +18,7 @@#include <linux/slab.h> MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("GPIB Driver for Fluke cda devices" );static int fluke_attach_holdoff_all (gpib_board_t *board,const gpib_board_config_t *config);static int fluke_attach_holdoff_end (gpib_board_t *board,const gpib_board_config_t *config);
drivers/staging/gpib/gpio/gpib_bitbang.c +1 -0
@@ -368,6 +368,7 @@ static inline void SET_DIR_READ(struct bb_priv *priv);#define DIR_WRITE 1MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("GPIB helper functions for bitbanging I/O" );/**** global variables ****/ #ifdef CONFIG_GPIB_DEBUG
drivers/staging/gpib/hp_82335/hp82335.c +1 -0
@@ -17,6 +17,7 @@#include <linux/init.h> MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("GPIB driver for HP 82335 interface cards" );static int hp82335_attach (gpib_board_t *board,const gpib_board_config_t *config);
drivers/staging/gpib/ines/ines_gpib.c +1 -0
@@ -19,6 +19,7 @@#include "gpib_pci_ids.h" MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("GPIB driver for Ines iGPIB 72010" );int ines_line_status (const gpib_board_t *board) {
drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c +1 -0
@@ -31,6 +31,7 @@#include "gpibP.h" MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("GPIB driver for LPVO usb devices" );#define NAME "lpvo_usb_gpib"
drivers/staging/gpib/nec7210/nec7210.c +1 -0
@@ -19,6 +19,7 @@#include <linux/delay.h> MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("GPIB library code for NEC uPD7210" );int nec7210_enable_eos (gpib_board_t *board,struct nec7210_priv *priv,uint8_t eos_byte,int compare_8_bits)
drivers/staging/gpib/ni_usb/ni_usb_gpib.c +1 -0
@@ -14,6 +14,7 @@#include "tnt4882_registers.h" MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("GPIB driver for National Instruments USB devices" );#define MAX_NUM_NI_USB_INTERFACES 128static struct usb_interface *ni_usb_driver_interfaces[MAX_NUM_NI_USB_INTERFACES ];
drivers/staging/gpib/pc2/pc2_gpib.c +1 -0
@@ -47,6 +47,7 @@ static inline unsigned int CLEAR_INTR_REG(unsigned int irq) }MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("GPIB driver for PC2/PC2a and compatible devices" );static int pc2_attach (gpib_board_t *board,const gpib_board_config_t *config);static int pc2a_attach (gpib_board_t *board,const gpib_board_config_t *config);
drivers/staging/gpib/tms9914/tms9914.c +1 -0
@@ -22,6 +22,7 @@#include "tms9914.h" MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("GPIB library for tms9914" );static unsigned int update_status_nolock (gpib_board_t *board,struct tms9914_priv *priv);
drivers/staging/gpib/tnt4882/tnt4882_gpib.c +1 -0
@@ -191,6 +191,7 @@ static inline void tnt_writeb(struct tnt4882_priv *priv, unsigned short value, u }MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("GPIB driver for National Instruments boards using tnt4882 or compatible chips" );int tnt4882_line_status (const gpib_board_t *board) {
Signature · 1 line
2.39.5
PATCH 2/7 staging: gpib: avoid unused const variables
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
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.
--- drivers/staging/gpib/common/gpib_os.c | 2 ++ drivers/staging/gpib/eastwood/fluke_gpib.h | 8 +++++--- .../staging/gpib/include/nec7210_registers.h | 6 +++--- drivers/staging/gpib/include/tms9914.h | 4 +++- .../staging/gpib/include/tnt4882_registers.h | 4 +++- drivers/staging/gpib/ines/ines.h | 3 --- drivers/staging/gpib/ines/ines_gpib.c | 6 ++++-- drivers/staging/gpib/tms9914/tms9914.c | 3 --- drivers/staging/gpib/tnt4882/tnt4882_gpib.c | 3 ++- drivers/staging/gpib/uapi/gpib_user.h | 20 ++++++++++--------- 10 files changed, 33 insertions(+), 26 deletions(-)
drivers/staging/gpib/common/gpib_os.c +2 -0
@@ -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) {
drivers/staging/gpib/eastwood/fluke_gpib.h +5 -3
@@ -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 , +};
drivers/staging/gpib/include/nec7210_registers.h +3 -3
@@ -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
drivers/staging/gpib/include/tms9914.h +3 -1
@@ -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)
drivers/staging/gpib/include/tnt4882_registers.h +3 -1
@@ -40,7 +40,9 @@ enum { BSR = BCR, }; -static const int tnt_pagein_offset =0x11 ; +enum { + tnt_pagein_offset =0x11 , +};/*============================================================*/
drivers/staging/gpib/ines/ines.h +0 -3
@@ -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
drivers/staging/gpib/ines/ines_gpib.c +4 -2
@@ -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 *configreturn 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
drivers/staging/gpib/tms9914/tms9914.c +0 -3
@@ -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 */
drivers/staging/gpib/tnt4882/tnt4882_gpib.c +2 -1
@@ -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)
@@ -1796,6 +1795,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;
drivers/staging/gpib/uapi/gpib_user.h +11 -9
@@ -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 preturn 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 ,
Signature · 1 line
2.39.5
PATCH 3/7 staging: gpib: pc2: avoid calling undefined dma_free()
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
On architectures that don't support the ISA DMA API, this causes a build failure. The corresponding dma_alloc() call is already in an #ifdef, so use the same one for dma_free().
Note that nothing seems to set PC2_DMA, so parts of this driver are likely unused. ISA DMA usually does not work on PCI or PCMCIA devices, only on physical ISA slots.
--- drivers/staging/gpib/pc2/pc2_gpib.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/staging/gpib/pc2/pc2_gpib.c +4 -0
@@ -462,8 +462,10 @@ void pc2_detach(gpib_board_t *board)if (pc2_priv) { nec_priv = &pc2_priv->nec7210_priv; +#ifdef PC2_DMA if (nec_priv->dma_channel)free_dma (nec_priv->dma_channel); +#endif gpib_free_pseudo_irq (board);if (pc2_priv->irq)free_irq (pc2_priv->irq, board);
@@ -596,8 +598,10 @@ static void pc2a_common_detach(gpib_board_t *board, unsigned int num_registers)if (pc2_priv) { nec_priv = &pc2_priv->nec7210_priv; +#ifdef PC2_DMA if (nec_priv->dma_channel)free_dma (nec_priv->dma_channel); +#endif gpib_free_pseudo_irq (board);if (pc2_priv->irq)free_irq (pc2_priv->irq, board);
Signature · 1 line
2.39.5
PATCH 4/7 staging: gpib: make port I/O code conditional
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
A few of the helper modules contain functions for both IORESOURCE_MEM and IORESOURCE_IO type access, with the latter not being supported on all architectures but also not used by all the drivers.
Add #ifdef checks around these to allow building the library code and use it on MMIO-only configurations.
--- drivers/staging/gpib/common/gpib_os.c | 2 ++ drivers/staging/gpib/nec7210/nec7210.c | 38 ++++++++++++++------------ drivers/staging/gpib/tms9914/tms9914.c | 2 ++ 3 files changed, 24 insertions(+), 18 deletions(-)
drivers/staging/gpib/common/gpib_os.c +2 -0
@@ -140,6 +140,7 @@ unsigned int readw_wrapper(void *address) };EXPORT_SYMBOL (readw_wrapper); +#ifdef CONFIG_HAS_IOPORT void outb_wrapper (unsigned int value,void *address) {outb (value, (unsigned long )(address));
@@ -163,6 +164,7 @@ unsigned int inw_wrapper(void *address) return inw((unsigned long)(address)); };EXPORT_SYMBOL (inw_wrapper); +#endif /* this is a function instead of a constant because of Suse * defining HZ to be a function call to get_hz()
drivers/staging/gpib/nec7210/nec7210.c +20 -18
@@ -1031,6 +1031,7 @@ void nec7210_board_online(struct nec7210_priv *priv, const gpib_board_t *board) }EXPORT_SYMBOL (nec7210_board_online); +#ifdef CONFIG_HAS_IOPORT /* wrappers for io */ uint8_t nec7210_ioport_read_byte (struct nec7210_priv *priv,unsigned int register_num) {
@@ -1050,24 +1051,6 @@ void nec7210_ioport_write_byte(struct nec7210_priv *priv, uint8_t data, unsigned }EXPORT_SYMBOL (nec7210_ioport_write_byte); -uint8_t nec7210_iomem_read_byte (struct nec7210_priv *priv,unsigned int register_num) -{ -return readb (priv->iobase + register_num * priv->offset); -} -EXPORT_SYMBOL (nec7210_iomem_read_byte); - -void nec7210_iomem_write_byte (struct nec7210_priv *priv,uint8_t data,unsigned int register_num) -{ -if (register_num ==AUXMR ) -/* locking makes absolutely sure noone accesses the -* AUXMR register faster than once per microsecond -*/ -nec7210_locking_iomem_write_byte (priv, data, register_num); -else -writeb (data, priv->iobase + register_num * priv->offset); -} -EXPORT_SYMBOL (nec7210_iomem_write_byte); -/* locking variants of io wrappers, for chips that page-in registers */ uint8_t nec7210_locking_ioport_read_byte (struct nec7210_priv *priv,unsigned int register_num) {
@@ -1093,6 +1076,25 @@ void nec7210_locking_ioport_write_byte(struct nec7210_priv *priv, uint8_t data, spin_unlock_irqrestore(&priv->register_page_lock, flags); }EXPORT_SYMBOL (nec7210_locking_ioport_write_byte); +#endif + +uint8_t nec7210_iomem_read_byte (struct nec7210_priv *priv,unsigned int register_num) +{ +return readb (priv->iobase + register_num * priv->offset); +} +EXPORT_SYMBOL (nec7210_iomem_read_byte); + +void nec7210_iomem_write_byte (struct nec7210_priv *priv,uint8_t data,unsigned int register_num) +{ +if (register_num ==AUXMR ) +/* locking makes absolutely sure noone accesses the +* AUXMR register faster than once per microsecond +*/ +nec7210_locking_iomem_write_byte (priv, data, register_num); +else +writeb (data, priv->iobase + register_num * priv->offset); +} +EXPORT_SYMBOL (nec7210_iomem_write_byte);uint8_t nec7210_locking_iomem_read_byte (struct nec7210_priv *priv,unsigned int register_num) {
drivers/staging/gpib/tms9914/tms9914.c +2 -0
@@ -862,6 +862,7 @@ void tms9914_online(gpib_board_t *board, struct tms9914_priv *priv) }EXPORT_SYMBOL_GPL (tms9914_online); +#ifdef CONFIG_HAS_IOPORT // wrapper for inb uint8_t tms9914_ioport_read_byte (struct tms9914_priv *priv,unsigned int register_num) {
@@ -877,6 +878,7 @@ void tms9914_ioport_write_byte(struct tms9914_priv *priv, uint8_t data, unsigned udelay(1); }EXPORT_SYMBOL_GPL (tms9914_ioport_write_byte); +#endif // wrapper for readb uint8_t tms9914_iomem_read_byte (struct tms9914_priv *priv,unsigned int register_num)
Signature · 1 line
2.39.5
Re: [PATCH 4/7] staging: gpib: make port I/O code conditional
Hi Arnd,
Quoted 122 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
A few of the helper modules contain functions for both
IORESOURCE_MEMandIORESOURCE_IOtype access, with the latter not being supported on all architectures but also not used by all the drivers.Add #ifdef checks around these to allow building the library code and use it on MMIO-only configurations.
Signed-off-by Arnd Bergmann <[email protected]>--- drivers/staging/gpib/common/gpib_os.c | 2 ++ drivers/staging/gpib/nec7210/nec7210.c | 38 ++++++++++++++------------ drivers/staging/gpib/tms9914/tms9914.c | 2 ++ 3 files changed, 24 insertions(+), 18 deletions(-)drivers/staging/gpib/common/gpib_os.c +2
-0@@ -140,6 +140,7 @@ unsigned int readw_wrapper(void *address) };EXPORT_SYMBOL (readw_wrapper); +#ifdef CONFIG_HAS_IOPORT void outb_wrapper (unsigned int value,void *address) {outb (value, (unsigned long )(address));@@ -163,6 +164,7 @@ unsigned int inw_wrapper(void *address) return inw((unsigned long)(address)); };EXPORT_SYMBOL (inw_wrapper); +#endif /* this is a function instead of a constant because of Suse * defining HZ to be a function call to get_hz() drivers/staging/gpib/nec7210/nec7210.c +20
-18@@ -1031,6 +1031,7 @@ void nec7210_board_online(struct nec7210_priv *priv, const gpib_board_t *board) }EXPORT_SYMBOL (nec7210_board_online); +#ifdef CONFIG_HAS_IOPORT /* wrappers for io */ uint8_t nec7210_ioport_read_byte (struct nec7210_priv *priv,unsigned int register_num) {@@ -1050,24 +1051,6 @@ void nec7210_ioport_write_byte(struct nec7210_priv *priv, uint8_t data, unsigned }EXPORT_SYMBOL (nec7210_ioport_write_byte); -uint8_t nec7210_iomem_read_byte (struct nec7210_priv *priv,unsigned int register_num) -{ -return readb (priv->iobase + register_num * priv->offset); -} -EXPORT_SYMBOL (nec7210_iomem_read_byte); - -void nec7210_iomem_write_byte (struct nec7210_priv *priv,uint8_t data,unsigned int register_num) -{ -if (register_num ==AUXMR ) -/* locking makes absolutely sure noone accesses the -* AUXMR register faster than once per microsecond -*/ -nec7210_locking_iomem_write_byte (priv, data, register_num); -else -writeb (data, priv->iobase + register_num * priv->offset); -} -EXPORT_SYMBOL (nec7210_iomem_write_byte); -/* locking variants of io wrappers, for chips that page-in registers */ uint8_t nec7210_locking_ioport_read_byte (struct nec7210_priv *priv,unsigned int register_num) {@@ -1093,6 +1076,25 @@ void nec7210_locking_ioport_write_byte(struct nec7210_priv *priv, uint8_t data, spin_unlock_irqrestore(&priv->register_page_lock, flags); }EXPORT_SYMBOL (nec7210_locking_ioport_write_byte); +#endif + +uint8_t nec7210_iomem_read_byte (struct nec7210_priv *priv,unsigned int register_num) +{ +return readb (priv->iobase + register_num * priv->offset); +} +EXPORT_SYMBOL (nec7210_iomem_read_byte); + +void nec7210_iomem_write_byte (struct nec7210_priv *priv,uint8_t data,unsigned int register_num) +{ +if (register_num ==AUXMR ) +/* locking makes absolutely sure noone accesses the +* AUXMR register faster than once per microsecond +*/ +nec7210_locking_iomem_write_byte (priv, data, register_num); +else +writeb (data, priv->iobase + register_num * priv->offset); +} +EXPORT_SYMBOL (nec7210_iomem_write_byte);uint8_t nec7210_locking_iomem_read_byte (struct nec7210_priv *priv,unsigned int register_num) {drivers/staging/gpib/tms9914/tms9914.c +2
-0@@ -862,6 +862,7 @@ void tms9914_online(gpib_board_t *board, struct tms9914_priv *priv) }EXPORT_SYMBOL_GPL (tms9914_online); +#ifdef CONFIG_HAS_IOPORT // wrapper for inb uint8_t tms9914_ioport_read_byte (struct tms9914_priv *priv,unsigned int register_num) {@@ -877,6 +878,7 @@ void tms9914_ioport_write_byte(struct tms9914_priv *priv, uint8_t data, unsigned udelay(1); }EXPORT_SYMBOL_GPL (tms9914_ioport_write_byte); +#endif // wrapper for readb uint8_t tms9914_iomem_read_byte (struct tms9914_priv *priv,unsigned int register_num)Signature · 1 line
2.39.5
Now that this change is in -next, I think it might be incorrect or incomplete, as hexagon and s390 allmodconfig error with
ERROR: modpost: "inb_wrapper" [drivers/staging/gpib/tnt4882/tnt4882.ko] undefined!
ERROR: modpost: "inw_wrapper" [drivers/staging/gpib/tnt4882/tnt4882.ko] undefined!
ERROR: modpost: "nec7210_locking_ioport_write_byte" [drivers/staging/gpib/tnt4882/tnt4882.ko] undefined!
ERROR: modpost: "nec7210_locking_ioport_read_byte" [drivers/staging/gpib/tnt4882/tnt4882.ko] undefined!
ERROR: modpost: "outb_wrapper" [drivers/staging/gpib/tnt4882/tnt4882.ko] undefined!
ERROR: modpost: "outw_wrapper" [drivers/staging/gpib/tnt4882/tnt4882.ko] undefined!
and it is not immediately obvious to me what the fix is.
Cheers,
Nathan
PATCH 5/7 staging: gpib: add bus specific Kconfig dependencies
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
A number of GPIB drivers fail to build when CONFIG_HAS_IOPORT is disabled, which can be avoided with a CONFIG_ISA_BUS or CONFIG_PCMCIA dependency.
For completeness, mark all of the new device drivers with a dependency on whichever bus they use, and hide the symbols for chip drivers that are already selected by teh device drivers using them.
--- drivers/staging/gpib/Kconfig | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/staging/gpib/Kconfig +15 -2
@@ -34,6 +34,7 @@ config GPIB_COMMON config GPIB_AGILENT_82350B tristate "Agilent 8235xx PCI(e) adapters" + depends on PCI select GPIB_COMMON select GPIB_TMS9914 help
@@ -57,6 +58,8 @@ config GPIB_AGILENT_82357A config GPIB_CEC_PCI tristate "CEC PCI board" + depends on PCI + depends on HAS_IOPORT select GPIB_COMMON select GPIB_NEC7210 help
@@ -68,6 +71,7 @@ config GPIB_CEC_PCI config GPIB_NI_PCI_ISA tristate "NI PCI/ISA compatible boards" + depends on ISA_BUS select GPIB_COMMON select GPIB_NEC7210 help
@@ -89,6 +93,8 @@ config GPIB_NI_PCI_ISA config GPIB_CB7210 tristate "Measurement Computing compatible boards" + depends on HAS_IOPORT + depends on ISA_BUS || PCI || PCMCIA select GPIB_COMMON help Enable support for Measurement Computing (Computer Boards):
@@ -118,6 +124,7 @@ config GPIB_NI_USB config GPIB_FLUKE tristate "Fluke" + depends on OF select GPIB_COMMON select GPIB_NEC7210 help
@@ -140,6 +147,7 @@ config GPIB_FMH config GPIB_GPIO tristate "RPi GPIO bitbang" + depends on ARCH_BCM2835 || COMPIlE_TEST select GPIB_COMMON help GPIB bitbang driver Raspberry Pi GPIO adapters
@@ -149,6 +157,7 @@ config GPIB_GPIO config GPIB_HP82335 tristate "HP82335/HP27209" + depends on ISA_BUS select GPIB_COMMON select GPIB_TMS9914 help
@@ -172,6 +181,8 @@ config GPIB_HP82341 config GPIB_INES tristate "INES" + depends on PCI || ISA_BUS || PCMCIA + depends on HAS_IOPORT select GPIB_COMMON select GPIB_NEC7210 help
@@ -210,6 +221,8 @@ config GPIB_LPVO config GPIB_PC2 tristate "PC2 PC2a" + depends on ISA_BUS + depends on HAS_IOPORT select GPIB_COMMON select GPIB_NEC7210 help
@@ -227,7 +240,7 @@ config GPIB_PC2 config GPIB_TMS9914 - tristate "TMS 9914 GPIB Chip driver" + tristate select GPIB_COMMON help Enable support for TMS 9914 chip.
@@ -236,7 +249,7 @@ config GPIB_TMS9914 called tms9914 config GPIB_NEC7210 - tristate "NEC 7210 GPIB Chip driver" + tristate select GPIB_COMMON help Enable support for NEC 7210 compatible chips.
Signature · 1 line
2.39.5
PATCH 6/7 staging: gpib: use proper format string in request_module
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
Using a string variable as a format causes a -Wformat-security warning. Since the only use of the temporary module_string[] is to hold the sprintf() output, just pass the format string and argument directly to request_module().
--- drivers/staging/gpib/common/gpib_os.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/gpib/common/gpib_os.c +1 -3
@@ -599,11 +599,9 @@ int ibopen(struct inode *inode, struct file *filep)GPIB_DPRINTK ("pid %i, gpib: opening minor %d\n" , current->pid, minor);if (board->use_count ==0 ) { -char module_string[32 ];int retval; -snprintf (module_string,sizeof (module_string),"gpib%i" , minor); - retval =request_module (module_string); + retval =request_module ("gpib%i" , minor);if (retval) {GPIB_DPRINTK ("pid %i, gpib: request module returned %i\n" , current->pid, retval);
Signature · 1 line
2.39.5
PATCH 7/7 staging: gpib: cb7210: select NEC7210 library
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
The nec7210 library module is required to build cb7210:
ERROR: modpost: "nec7210_write" [drivers/staging/gpib/cb7210/cb7210.ko] undefined!
ERROR: modpost: "nec7210_read" [drivers/staging/gpib/cb7210/cb7210.ko] undefined!
ERROR: modpost: "nec7210_command" [drivers/staging/gpib/cb7210/cb7210.ko] undefined!
ERROR: modpost: "nec7210_take_control" [drivers/staging/gpib/cb7210/cb7210.ko] undefined!
--- drivers/staging/gpib/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/staging/gpib/Kconfig +1 -0
@@ -96,6 +96,7 @@ config GPIB_CB7210 depends on HAS_IOPORT depends on ISA_BUS || PCI || PCMCIA select GPIB_COMMON + select GPIB_NEC7210 help Enable support for Measurement Computing (Computer Boards): CPCI_GPIB, ISA-GPIB, ISA-GPIB/LC, PCI-GPIB/1M, PCI-GPIB/300K and
Signature · 1 line
2.39.5
Quoted 32 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
The newly added drivers added a few build failures on my randconfig setup. Some of these only happen with extra warnings enabled, or with the pending series to allow
CONFIG_HAS_IOPORTto be disabled.Arnd
Arnd Bergmann (7):
staging: gpib: add module descriptions
staging: gpib: avoid unused const variables
staging: gpib: pc2: avoid calling undefineddma_free()
staging: gpib: make port I/O code conditional
staging: gpib: add bus specificKconfigdependencies
staging: gpib: use proper format string inrequest_module
staging: gpib: cb7210: select NEC7210 librarydrivers/staging/gpib/Kconfig | 18 ++++++++- .../gpib/agilent_82350b/agilent_82350b.c | 1 + .../gpib/agilent_82357a/agilent_82357a.c | 1 + drivers/staging/gpib/cb7210/cb7210.c | 1 + drivers/staging/gpib/cec/cec_gpib.c | 1 + drivers/staging/gpib/common/gpib_os.c | 9 +++-- drivers/staging/gpib/eastwood/fluke_gpib.c | 1 + drivers/staging/gpib/eastwood/fluke_gpib.h | 8 ++-- drivers/staging/gpib/gpio/gpib_bitbang.c | 1 + drivers/staging/gpib/hp_82335/hp82335.c | 1 + .../staging/gpib/include/nec7210_registers.h | 6 +-- drivers/staging/gpib/include/tms9914.h | 4 +- .../staging/gpib/include/tnt4882_registers.h | 4 +- drivers/staging/gpib/ines/ines.h | 3 -- drivers/staging/gpib/ines/ines_gpib.c | 7 +++-
Quoted 12 lines
.../gpib/lpvo_usb_gpib/lpvo_usb_gpib.c | 1 + drivers/staging/gpib/nec7210/nec7210.c | 39 ++++++++++--------- drivers/staging/gpib/ni_usb/ni_usb_gpib.c | 1 + drivers/staging/gpib/pc2/pc2_gpib.c | 5 +++ drivers/staging/gpib/tms9914/tms9914.c | 6 +-- drivers/staging/gpib/tnt4882/tnt4882_gpib.c | 4 +- drivers/staging/gpib/uapi/gpib_user.h | 20 +++++----- 22 files changed, 93 insertions(+), 49 deletions(-)Signature · 1 line
2.39.5
Hi Arnd,
Thanks for this. I will test the drivers for which I have hardware and get back to you.
-Dave