Remove dead code and unused variables
[fw/stlink] / src / stlink-sg.c
index f9170009b0c0533549a1abc12085d881c1a51adb..b6ac4963bf7cf8b3ec1c3d8a19f6a9ab1894cc7b 100644 (file)
 #define WLOG(format, args...)         ugly_log(UWARN, LOG_TAG, format, ## args)
 #define fatal(format, args...)        ugly_log(UFATAL, LOG_TAG, format, ## args)
 
-// Suspends execution of the calling process for
-// (at least) ms milliseconds.
-
-static void delay(int ms) {
-    //fprintf(stderr, "*** wait %d ms\n", ms);
-    usleep(1000 * ms);
-}
-
 static void clear_cdb(struct stlink_libsg *sl) {
     for (size_t i = 0; i < sizeof (sl->cdb_cmd_blk); i++)
         sl->cdb_cmd_blk[i] = 0;
@@ -467,7 +459,7 @@ void _stlink_sg_enter_jtag_mode(stlink_t *sl) {
 }
 
 // XXX kernel driver performs reset, the device temporally disappears
-
+// Suspect this is no longer the case when we have ignore on? RECHECK
 void _stlink_sg_exit_dfu_mode(stlink_t *sl) {
     struct stlink_libsg *sg = sl->backend_data;
     DLOG("\n*** stlink_exit_dfu_mode ***\n");
@@ -964,18 +956,6 @@ stlink_t* stlink_v1_open_inner(const int verbose) {
     DLOG("Attempting to exit DFU mode\n");
     _stlink_sg_exit_dfu_mode(sl);
     
-    // exit the dfu mode -> the device is gone
-    DLOG("\n*** reopen the stlink device ***\n");
-    delay(1000);
-    stlink_close(sl);
-    delay(5000);
-
-    DLOG("Attempting to reopen the stlink...\n");
-    sl = stlink_open(verbose);
-    if (sl == NULL) {
-        fputs("Error: could not open stlink device\n", stderr);
-        return NULL;
-    }
     // re-query device info (and retest)
     stlink_version(sl);
     if ((sl->version.st_vid != USB_ST_VID) || (sl->version.stlink_pid != USB_STLINK_PID)) {