From cd6a9f8bae1fbb1f8e5fe0c1f88d2480609fc738 Mon Sep 17 00:00:00 2001
From: Gregory Nutt <gnutt@nuttx.org>
Date: Tue, 6 Dec 2016 08:54:38 -0600
Subject: [PATCH] Remove BOARDIOC_CAN_INITIALIZE.  CAN initialization is now
 done in the board initialization logic just like every other device driver.

---
 canutils/canlib/Kconfig       |  3 +--
 examples/can/Kconfig          |  3 +--
 examples/can/can_main.c       | 13 ++-----------
 examples/canard/canard_main.c | 14 ++------------
 4 files changed, 6 insertions(+), 27 deletions(-)

diff --git a/canutils/canlib/Kconfig b/canutils/canlib/Kconfig
index 228a98544..f54a667af 100644
--- a/canutils/canlib/Kconfig
+++ b/canutils/canlib/Kconfig
@@ -6,8 +6,7 @@
 config CANUTILS_CANLIB
 	bool "CAN utility library"
 	default n
-	depends on CAN && LIB_BOARDCTL
-	select BOARDCTL_CANINIT
+	depends on CAN
 	---help---
 		Enable the CAN utility library
 
diff --git a/examples/can/Kconfig b/examples/can/Kconfig
index afc062c0a..ffcba90fa 100644
--- a/examples/can/Kconfig
+++ b/examples/can/Kconfig
@@ -6,8 +6,7 @@
 config EXAMPLES_CAN
 	bool "CAN example"
 	default n
-	depends on CAN && LIB_BOARDCTL
-	select BOARDCTL_CANINIT
+	depends on CAN
 	---help---
 		Enable the CAN example
 
diff --git a/examples/can/can_main.c b/examples/can/can_main.c
index 724a0455d..84c8b9ae5 100644
--- a/examples/can/can_main.c
+++ b/examples/can/can_main.c
@@ -41,7 +41,6 @@
 
 #include <sys/types.h>
 #include <sys/ioctl.h>
-#include <sys/boardctl.h>
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -294,18 +293,10 @@ int can_main(int argc, FAR char *argv[])
   printf("min ID: %ld max ID: %ld\n", minid, maxid);
 #endif
 
-  /* Initialization of the CAN hardware is performed by logic external to
-   * this test.
+  /* Initialization of the CAN hardware is performed by board-specific,
+   * logic external prior to running this test.
    */
 
-  ret = boardctl(BOARDIOC_CAN_INITIALIZE, 0);
-  if (ret < 0)
-    {
-      printf("ERROR: BOARDIOC_CAN_INITIALIZE failed: %d\n", ret);
-      errval = 1;
-      goto errout;
-    }
-
   /* Open the CAN device for reading */
 
   fd = open(CONFIG_EXAMPLES_CAN_DEVPATH, CAN_OFLAGS);
diff --git a/examples/canard/canard_main.c b/examples/canard/canard_main.c
index 7b64959da..b7d2d60ee 100644
--- a/examples/canard/canard_main.c
+++ b/examples/canard/canard_main.c
@@ -43,7 +43,6 @@
                                  * with Libcanard */
 
 #include <sys/ioctl.h>
-#include <sys/boardctl.h>
 #include <sched.h>
 
 #include <stdio.h>
@@ -432,19 +431,10 @@ static int canard_daemon(int argc, char *argv[])
   int errval = 0;
   int ret;
 
-  /* Initialization of the CAN hardware is performed by logic external to
-   * this test.
+  /* Initialization of the CAN hardware is performed by external, board-
+   * specific logic to running this test.
    */
 
-  ret = boardctl(BOARDIOC_CAN_INITIALIZE, 0);
-  if (ret < 0)
-    {
-      printf("canard_daemon: ERROR: BOARDIOC_CAN_INITIALIZE failed: %d\n",
-             ret);
-      errval = 1;
-      goto errout;
-    }
-
   /* Open the CAN device for reading */
 
   ret = canardNuttXInit(&canardnuttx_instance,