[PATCH 2/3] staging: comedi: amplc_dio200: add helper macros to check bus type

Dan Carpenter dan.carpenter at oracle.com
Wed Aug 15 07:14:09 UTC 2012


On Tue, Aug 14, 2012 at 04:31:28PM +0100, Ian Abbott wrote:
> Add helper macro IS_ISA_BOARD(board) to check if the driver supports ISA
> boards and this is an ISA board, and IS_PCI_BOARD(board) to check if the
> driver supports PCI boards and this is a PCI board.
> 
> Signed-off-by: Ian Abbott <abbotti at mev.co.uk>
> ---
>  drivers/staging/comedi/drivers/amplc_dio200.c |   11 +++++++----
>  1 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c
> index 0905e40..3a7f592 100644
> --- a/drivers/staging/comedi/drivers/amplc_dio200.c
> +++ b/drivers/staging/comedi/drivers/amplc_dio200.c
> @@ -294,6 +294,9 @@ struct dio200_board {
>  	enum dio200_layout layout;
>  };
>  
> +#define IS_ISA_BOARD(board)	(DO_ISA && (board)->bustype == isa_bustype)
> +#define IS_PCI_BOARD(board)	(DO_PCI && (board)->bustype == pci_bustype)

It would be better to make this an inline function.

#if IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_ISA)

static inline bool is_isa_board(const struct dio200_board *board)
{
	return board->bustype == isa_bustype;
}

#else

static inline bool is_isa_board(const struct dio200_board *board)
{
	return 0;
}

#endif

What I'm trying to explain is that this would be a small step
towards moving the #if statements out of the .c file and getting
comedi out of staging.  We need to do that for all the #if
statements.

regards,
dan carpenter




More information about the devel mailing list