Browse Source

bflsc only need one xlinkstr

Kano 13 years ago
parent
commit
de009dab01
1 changed files with 12 additions and 19 deletions
  1. 12 19
      driver-bflsc.c

+ 12 - 19
driver-bflsc.c

@@ -304,19 +304,24 @@ static const char *blank = "";
 
 struct device_drv bflsc_drv;
 
-static void bflsc_applog(struct cgpu_info *bflsc, int dev, enum usb_cmds cmd, int amount, int err)
+static void xlinkstr(char *xlink, int dev, struct bflsc_info *sc_info)
 {
-	struct bflsc_info *sc_info = (struct bflsc_info *)(bflsc->device_file);
-	char xlink[17];
-
 	if (dev > 0)
-		sprintf(xlink, "x-%d", dev);
+		sprintf(xlink, " x-%d", dev);
 	else {
-		if (sc_info->sc_count > 0)
+		if (sc_info->sc_count > 1)
 			strcpy(xlink, " master");
 		else
-			xlink[0] = '\0';
+			*xlink = '\0';
 	}
+}
+
+static void bflsc_applog(struct cgpu_info *bflsc, int dev, enum usb_cmds cmd, int amount, int err)
+{
+	struct bflsc_info *sc_info = (struct bflsc_info *)(bflsc->device_file);
+	char xlink[17];
+
+	xlinkstr(xlink, dev, sc_info);
 
 	usb_applog(bflsc, cmd, xlink, amount, err);
 }
@@ -450,18 +455,6 @@ static void freebreakdown(int *count, char **firstname, char ***fields)
 	*fields = NULL;
 }
 
-static void xlinkstr(char *xlink, int dev, struct bflsc_info *sc_info)
-{
-	if (dev > 0)
-		sprintf(xlink, " x-%d", dev);
-	else {
-		if (sc_info->sc_count > 0)
-			strcpy(xlink, " mast");
-		else
-			*xlink = '\0';
-	}
-}
-
 static int write_to_dev(struct cgpu_info *bflsc, int dev, char *buf, int buflen, int *amount, enum usb_cmds cmd)
 {
 	struct DataForwardToChain data;