Configfs usb mass_storage device always reports 8 LUNs ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c
index 3cc109f..f502f00 100644
--- a/drivers/usb/gadget/function/f_mass_storage.c
+++ b/drivers/usb/gadget/function/f_mass_storage.c
@@ -2796,8 +2796,6 @@ int fsg_common_set_nluns(struct fsg_common *common, int nluns)
 	common->luns = curlun;
 	common->nluns = nluns;
 
-	pr_info("Number of LUNs=%d\n", common->nluns);
-
 	return 0;
 }
 EXPORT_SYMBOL_GPL(fsg_common_set_nluns);
@@ -2941,6 +2939,9 @@ int fsg_common_create_lun(struct fsg_common *common, struct fsg_lun_config *cfg,
 				p = "(error)";
 		}
 	}
+
+	common->nluns = id + 1;
+
 	pr_info("LUN: %s%s%sfile: %s\n",
 	      lun->removable ? "removable " : "",
 	      lun->ro ? "read only " : "",
@@ -2973,8 +2974,6 @@ int fsg_common_create_luns(struct fsg_common *common, struct fsg_config *cfg)
 			goto fail;
 	}
 
-	pr_info("Number of LUNs=%d\n", common->nluns);
-
 	return 0;
 
 fail:
@@ -3121,6 +3120,8 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f)
 	if (ret)
 		goto autoconf_fail;
 
+	pr_info("Number of LUNs=%d\n", fsg->common->nluns);
+
 	return 0;
 
 autoconf_fail:



Is this something that needs fixing or am I misunderstanding how configfs usb mass storage is supposed to work or be configured ?

Thanks in advance for any help,
David

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux