[PATCH 3/4] staging: comedi: ni_mio_common: Allow alternate board name for routes

Ian Abbott abbotti at mev.co.uk
Fri Feb 7 15:13:59 UTC 2020


We do not have or do not provide routing information for all supported
boards.  Some of the boards for which we do not provide routing
information actually have routes that are identical to a similar board
for which we already provide routing information.

To allow boards to share identical routing information, add an
`alt_route_name` member to `struct ni_board_struct`.  This will be
initialized to `NULL` for all boards except those that will use make use
of the identical routing information that has been provided for a
similar board, in which case it will name that board.  Pass the
`alt_route_name` member value to `ni_assign_device_routes()` as the
`alt_board_name` parameter, which it will use if no routing information
could be found for the actual board name.

Cc: Éric Piel <piel at delmic.com>
Cc: Spencer E. Olson <olsonse at umich.edu>
Signed-off-by: Ian Abbott <abbotti at mev.co.uk>
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 3 ++-
 drivers/staging/comedi/drivers/ni_stc.h        | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c
index a1578868ee96..b72a40a79930 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -5974,7 +5974,8 @@ static int ni_E_init(struct comedi_device *dev,
 						      : "ni_eseries";
 
 	/* prepare the device for globally-named routes. */
-	if (ni_assign_device_routes(dev_family, board->name, NULL,
+	if (ni_assign_device_routes(dev_family, board->name,
+				    board->alt_route_name,
 				    &devpriv->routing_tables) < 0) {
 		dev_warn(dev->class_dev, "%s: %s device has no signal routing table.\n",
 			 __func__, board->name);
diff --git a/drivers/staging/comedi/drivers/ni_stc.h b/drivers/staging/comedi/drivers/ni_stc.h
index 35427f8bf8f7..fbc0b753a0f5 100644
--- a/drivers/staging/comedi/drivers/ni_stc.h
+++ b/drivers/staging/comedi/drivers/ni_stc.h
@@ -941,6 +941,7 @@ enum ni_reg_type {
 
 struct ni_board_struct {
 	const char *name;
+	const char *alt_route_name;
 	int device_id;
 	int isapnp_id;
 
-- 
2.24.1



More information about the devel mailing list