Browse Source

icarus: Defer initial open until init

Luke Dashjr 12 years ago
parent
commit
872414b647
1 changed files with 10 additions and 16 deletions
  1. 10 16
      driver-icarus.c

+ 10 - 16
driver-icarus.c

@@ -594,21 +594,6 @@ bool icarus_lowl_probe(const struct lowlevel_device_info * const info)
 static bool icarus_prepare(struct thr_info *thr)
 {
 	struct cgpu_info *icarus = thr->cgpu;
-	struct ICARUS_INFO *info = icarus->device_data;
-
-	icarus->device_fd = -1;
-
-	int fd = icarus_open2(icarus->device_path, info->baud, true);
-	if (unlikely(-1 == fd)) {
-		applog(LOG_ERR, "%s: Failed to open %s",
-		       icarus->dev_repr,
-		       icarus->device_path);
-		return false;
-	}
-
-	icarus->device_fd = fd;
-
-	applog(LOG_INFO, "%s: Opened %s", icarus->dev_repr, icarus->device_path);
 
 	struct icarus_state *state;
 	thr->cgpu_data = state = calloc(1, sizeof(*state));
@@ -632,7 +617,16 @@ static bool icarus_init(struct thr_info *thr)
 {
 	struct cgpu_info *icarus = thr->cgpu;
 	struct ICARUS_INFO *info = icarus->device_data;
-	int fd = icarus->device_fd;
+	
+	int fd = icarus_open2(icarus->device_path, info->baud, true);
+	icarus->device_fd = fd;
+	if (unlikely(-1 == fd)) {
+		applog(LOG_ERR, "%s: Failed to open %s",
+		       icarus->dev_repr,
+		       icarus->device_path);
+		return false;
+	}
+	applog(LOG_INFO, "%s: Opened %s", icarus->dev_repr, icarus->device_path);
 	
 	if (!info->work_division)
 	{