Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7805c38d authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "USB: android: Allow multiple luns creation during init"

parents 1d88ba59 fe81e5ee
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -2282,7 +2282,7 @@ static void mass_storage_function_enable(struct android_usb_function *f)
	struct mass_storage_function_config *config = f->config;
	struct fsg_common *common = config->common;
	char *lun_type;
	int i, err;
	int i, err, prev_nluns;
	char buf[MAX_LUN_STR_LEN], *b;
	int number_of_luns = 0;
	char buf1[5];
@@ -2292,6 +2292,8 @@ static void mass_storage_function_enable(struct android_usb_function *f)
	if (msc_initialized)
		return;

	prev_nluns = config->fsg.nluns;

	if (lun_info[0] != '\0') {
		strlcpy(buf, lun_info, sizeof(buf));
		b = strim(buf);
@@ -2316,14 +2318,14 @@ static void mass_storage_function_enable(struct android_usb_function *f)
	}

	pr_debug("fsg.nluns:%d\n", config->fsg.nluns);
	for (i = 1; i < config->fsg.nluns; i++) {
		snprintf(lun_name, sizeof(buf), "lun%d", (i-1));
	for (i = prev_nluns; i < config->fsg.nluns; i++) {
		snprintf(lun_name, sizeof(buf), "lun%d", (i-prev_nluns));
		pr_debug("sysfs: LUN name:%s\n", lun_name);
		err = sysfs_create_link(&f->dev->kobj,
			&common->luns[i].dev.kobj, lun_name);
		if (err)
			pr_err("sysfs file creation failed: lun%d err:%d\n",
								i, err);
							(i-prev_nluns), err);
	}

	msc_initialized = 1;
+2 −4
Original line number Diff line number Diff line
@@ -2782,10 +2782,8 @@ static int create_lun_device(struct fsg_common *common,
	 * Check if index is non-zero, increment current lun_config
	 * and cur_lun pointers.
	 */
	if (add_lun_index) {
		lcfg++;
		curlun++;
	}
	lcfg += add_lun_index;
	curlun += add_lun_index;

	for (i = add_lun_index; i < nluns; ++i, ++curlun, ++lcfg) {
		curlun->cdrom = !!lcfg->cdrom;