[PATCH v5 06/15] usb/gadget: f_mass_storage: create fsg_common_set_ops/_private_data for use in fsg_common_init

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

 



fsg_common_init is a lengthy function. Factor portions of it out.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@xxxxxxxxxxx>
Signed-off-by: Kyungmin Park <kyungmin.park@xxxxxxxxxxx>
---
 drivers/usb/gadget/f_mass_storage.c |   16 ++++++++++++++--
 drivers/usb/gadget/f_mass_storage.h |    5 +++++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index 16a44e1..39f7f1f 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -2789,6 +2789,17 @@ int fsg_common_set_nluns(struct fsg_common *common, int nluns)
 	return 0;
 }
 
+void fsg_common_set_ops(struct fsg_common *common,
+			const struct fsg_operations *ops)
+{
+	common->ops = ops;
+}
+
+void fsg_common_set_private_data(struct fsg_common *common, void *priv)
+{
+	common->private_data = priv;
+}
+
 #define MAX_LUN_NAME_LEN 80
 
 struct fsg_common *fsg_common_init(struct fsg_common *common,
@@ -2815,8 +2826,9 @@ struct fsg_common *fsg_common_init(struct fsg_common *common,
 			kfree(common);
 		return ERR_PTR(rc);
 	}
-	common->ops = cfg->ops;
-	common->private_data = cfg->private_data;
+
+	fsg_common_set_ops(common, cfg->ops);
+	fsg_common_set_private_data(common, cfg->private_data);
 
 	common->gadget = gadget;
 	common->ep0 = gadget->ep0;
diff --git a/drivers/usb/gadget/f_mass_storage.h b/drivers/usb/gadget/f_mass_storage.h
index f98c792..3be09a1 100644
--- a/drivers/usb/gadget/f_mass_storage.h
+++ b/drivers/usb/gadget/f_mass_storage.h
@@ -106,6 +106,11 @@ void fsg_common_set_sysfs(struct fsg_common *common, bool sysfs);
 
 int fsg_common_set_num_buffers(struct fsg_common *common, unsigned int n);
 
+void fsg_common_set_ops(struct fsg_common *common,
+			const struct fsg_operations *ops);
+
+void fsg_common_set_private_data(struct fsg_common *common, void *priv);
+
 void fsg_common_remove_lun(struct fsg_lun *lun, bool sysfs);
 
 void fsg_common_remove_luns(struct fsg_common *common);
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




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

  Powered by Linux