[PATCH v4 4/5] usb/gadget: f_mass_storage: remove compatibility layer

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

 



There are no more old interface users left. Remove it.

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

diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index 4320eae..837a443 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -2644,17 +2644,13 @@ void fsg_common_get(struct fsg_common *common)
 {
 	kref_get(&common->ref);
 }
-#ifndef USB_FMS_INCLUDED
 EXPORT_SYMBOL(fsg_common_get);
-#endif
 
 void fsg_common_put(struct fsg_common *common)
 {
 	kref_put(&common->ref, fsg_common_release);
 }
-#ifndef USB_FMS_INCLUDED
 EXPORT_SYMBOL(fsg_common_put);
-#endif
 
 /* check if fsg_num_buffers is within a valid range */
 static inline int fsg_num_buffers_validate(unsigned int fsg_num_buffers)
@@ -2692,9 +2688,7 @@ void fsg_common_set_sysfs(struct fsg_common *common, bool sysfs)
 {
 	common->sysfs = sysfs;
 }
-#ifndef USB_FMS_INCLUDED
 EXPORT_SYMBOL(fsg_common_set_sysfs);
-#endif
 
 static void _fsg_common_free_buffers(struct fsg_buffhd *buffhds, unsigned n)
 {
@@ -2746,9 +2740,7 @@ error_release:
 
 	return -ENOMEM;
 }
-#ifndef USB_FMS_INCLUDED
 EXPORT_SYMBOL(fsg_common_set_num_buffers);
-#endif
 
 static inline void fsg_common_remove_sysfs(struct fsg_lun *lun)
 {
@@ -2769,9 +2761,7 @@ void fsg_common_remove_lun(struct fsg_lun *lun, bool sysfs)
 	kfree(lun->name);
 	kfree(lun);
 }
-#ifndef USB_FMS_INCLUDED
 EXPORT_SYMBOL(fsg_common_remove_lun);
-#endif
 
 void _fsg_common_remove_luns(struct fsg_common *common, int n)
 {
@@ -2783,9 +2773,7 @@ void _fsg_common_remove_luns(struct fsg_common *common, int n)
 			common->luns[i] = NULL;
 		}
 }
-#ifndef USB_FMS_INCLUDED
 EXPORT_SYMBOL(fsg_common_remove_luns);
-#endif
 
 void fsg_common_remove_luns(struct fsg_common *common)
 {
@@ -2798,9 +2786,7 @@ void fsg_common_free_luns(struct fsg_common *common)
 	kfree(common->luns);
 	common->luns = NULL;
 }
-#ifndef USB_FMS_INCLUDED
 EXPORT_SYMBOL(fsg_common_free_luns);
-#endif
 
 int fsg_common_set_nluns(struct fsg_common *common, int nluns)
 {
@@ -2826,35 +2812,27 @@ int fsg_common_set_nluns(struct fsg_common *common, int nluns)
 
 	return 0;
 }
-#ifndef USB_FMS_INCLUDED
 EXPORT_SYMBOL(fsg_common_set_nluns);
-#endif
 
 void fsg_common_free_buffers(struct fsg_common *common)
 {
 	_fsg_common_free_buffers(common->buffhds, common->fsg_num_buffers);
 	common->buffhds = NULL;
 }
-#ifndef USB_FMS_INCLUDED
 EXPORT_SYMBOL(fsg_common_free_buffers);
-#endif
 
 void fsg_common_set_ops(struct fsg_common *common,
 			const struct fsg_operations *ops)
 {
 	common->ops = ops;
 }
-#ifndef USB_FMS_INCLUDED
 EXPORT_SYMBOL(fsg_common_set_ops);
-#endif
 
 void fsg_common_set_private_data(struct fsg_common *common, void *priv)
 {
 	common->private_data = priv;
 }
-#ifndef USB_FMS_INCLUDED
 EXPORT_SYMBOL(fsg_common_set_private_data);
-#endif
 
 int fsg_common_set_cdev(struct fsg_common *common,
 			 struct usb_composite_dev *cdev, bool can_stall)
@@ -2884,9 +2862,7 @@ int fsg_common_set_cdev(struct fsg_common *common,
 
 	return 0;
 }
-#ifndef USB_FMS_INCLUDED
 EXPORT_SYMBOL(fsg_common_set_cdev);
-#endif
 
 static inline int fsg_common_add_sysfs(struct fsg_common *common,
 				       struct fsg_lun *lun)
@@ -3027,9 +3003,7 @@ error_name:
 	kfree(lun);
 	return rc;
 }
-#ifndef USB_FMS_INCLUDED
 EXPORT_SYMBOL(fsg_common_create_lun);
-#endif
 
 int fsg_common_create_luns(struct fsg_common *common, struct fsg_config *cfg)
 {
@@ -3051,9 +3025,7 @@ fail:
 	_fsg_common_remove_luns(common, i);
 	return rc;
 }
-#ifndef USB_FMS_INCLUDED
 EXPORT_SYMBOL(fsg_common_create_luns);
-#endif
 
 void fsg_common_set_inquiry_string(struct fsg_common *common, const char *vn,
 				   const char *pn)
@@ -3070,9 +3042,7 @@ void fsg_common_set_inquiry_string(struct fsg_common *common, const char *vn,
 		     : "File-Stor Gadget"),
 		 i);
 }
-#ifndef USB_FMS_INCLUDED
 EXPORT_SYMBOL(fsg_common_set_inquiry_string);
-#endif
 
 int fsg_common_run_thread(struct fsg_common *common)
 {
@@ -3091,66 +3061,7 @@ int fsg_common_run_thread(struct fsg_common *common)
 
 	return 0;
 }
-#ifndef USB_FMS_INCLUDED
 EXPORT_SYMBOL(fsg_common_run_thread);
-#endif
-
-struct fsg_common *fsg_common_init(struct fsg_common *common,
-				   struct usb_composite_dev *cdev,
-				   struct fsg_config *cfg)
-{
-	int rc;
-
-	common = fsg_common_setup(common, !!common);
-	if (IS_ERR(common))
-		return common;
-	fsg_common_set_sysfs(common, true);
-	common->state = FSG_STATE_IDLE;
-
-	rc = fsg_common_set_num_buffers(common, cfg->fsg_num_buffers);
-	if (rc) {
-		if (common->free_storage_on_release)
-			kfree(common);
-		return ERR_PTR(rc);
-	}
-
-	fsg_common_set_ops(common, cfg->ops);
-	fsg_common_set_private_data(common, cfg->private_data);
-
-	rc = fsg_common_set_cdev(common, cdev, cfg->can_stall);
-	if (rc)
-		goto error_release;
-
-	rc = fsg_common_set_nluns(common, cfg->nluns);
-	if (rc)
-		goto error_release;
-
-	rc = fsg_common_create_luns(common, cfg);
-	if (rc)
-		goto error_release;
-
-
-	fsg_common_set_inquiry_string(common, cfg->vendor_name,
-				      cfg->product_name);
-
-	/* Information */
-	INFO(common, FSG_DRIVER_DESC ", version: " FSG_DRIVER_VERSION "\n");
-
-	rc = fsg_common_run_thread(common);
-	if (rc)
-		goto error_release;
-
-	return common;
-
-error_release:
-	common->state = FSG_STATE_TERMINATED;	/* The thread is dead */
-	/* Call fsg_common_release() directly, ref might be not initialised. */
-	fsg_common_release(&common->ref);
-	return ERR_PTR(rc);
-}
-#ifndef USB_FMS_INCLUDED
-EXPORT_SYMBOL(fsg_common_init);
-#endif
 
 static void fsg_common_release(struct kref *ref)
 {
@@ -3201,9 +3112,8 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f)
 	struct usb_ep		*ep;
 	unsigned		max_burst;
 	int			ret;
-
-#ifndef USB_FMS_INCLUDED
 	struct fsg_opts		*opts;
+
 	opts = container_of(f->fi, struct fsg_opts, func_inst);
 	if (!opts->no_configfs) {
 		ret = fsg_common_set_cdev(fsg->common, c->cdev,
@@ -3215,7 +3125,6 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f)
 		if (ret)
 			return ret;
 	}
-#endif
 
 	fsg->gadget = gadget;
 
@@ -3270,63 +3179,6 @@ autoconf_fail:
 
 /****************************** ALLOCATE FUNCTION *************************/
 
-#ifdef USB_FMS_INCLUDED
-
-static void old_fsg_unbind(struct usb_configuration *c, struct usb_function *f)
-{
-	struct fsg_dev		*fsg = fsg_from_func(f);
-	struct fsg_common	*common = fsg->common;
-
-	DBG(fsg, "unbind\n");
-	if (fsg->common->fsg == fsg) {
-		fsg->common->new_fsg = NULL;
-		raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE);
-		/* FIXME: make interruptible or killable somehow? */
-		wait_event(common->fsg_wait, common->fsg != fsg);
-	}
-
-	fsg_common_put(common);
-	usb_free_all_descriptors(&fsg->function);
-	kfree(fsg);
-}
-
-static int fsg_bind_config(struct usb_composite_dev *cdev,
-			   struct usb_configuration *c,
-			   struct fsg_common *common)
-{
-	struct fsg_dev *fsg;
-	int rc;
-
-	fsg = kzalloc(sizeof *fsg, GFP_KERNEL);
-	if (unlikely(!fsg))
-		return -ENOMEM;
-
-	fsg->function.name        = FSG_DRIVER_DESC;
-	fsg->function.bind        = fsg_bind;
-	fsg->function.unbind      = old_fsg_unbind;
-	fsg->function.setup       = fsg_setup;
-	fsg->function.set_alt     = fsg_set_alt;
-	fsg->function.disable     = fsg_disable;
-
-	fsg->common               = common;
-	/*
-	 * Our caller holds a reference to common structure so we
-	 * don't have to be worry about it being freed until we return
-	 * from this function.  So instead of incrementing counter now
-	 * and decrement in error recovery we increment it only when
-	 * call to usb_add_function() was successful.
-	 */
-
-	rc = usb_add_function(c, &fsg->function);
-	if (unlikely(rc))
-		kfree(fsg);
-	else
-		fsg_common_get(fsg->common);
-	return rc;
-}
-
-#else
-
 static inline struct fsg_lun_opts *to_fsg_lun_opts(struct config_item *item)
 {
 	return container_of(to_config_group(item), struct fsg_lun_opts, group);
@@ -3796,8 +3648,6 @@ DECLARE_USB_FUNCTION_INIT(mass_storage, fsg_alloc_inst, fsg_alloc);
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Michal Nazarewicz");
 
-#endif
-
 /************************* Module parameters *************************/
 
 
@@ -3833,7 +3683,5 @@ void fsg_config_from_params(struct fsg_config *cfg,
 	cfg->can_stall = params->stall;
 	cfg->fsg_num_buffers = fsg_num_buffers;
 }
-#ifndef USB_FMS_INCLUDED
 EXPORT_SYMBOL(fsg_config_from_params);
-#endif
 
diff --git a/drivers/usb/gadget/f_mass_storage.h b/drivers/usb/gadget/f_mass_storage.h
index 65851aa..81a1a3a 100644
--- a/drivers/usb/gadget/f_mass_storage.h
+++ b/drivers/usb/gadget/f_mass_storage.h
@@ -122,10 +122,6 @@ void fsg_common_get(struct fsg_common *common);
 
 void fsg_common_put(struct fsg_common *common);
 
-struct fsg_common *fsg_common_init(struct fsg_common *common,
-				   struct usb_composite_dev *cdev,
-				   struct fsg_config *cfg);
-
 void fsg_common_set_sysfs(struct fsg_common *common, bool sysfs);
 
 int fsg_common_set_num_buffers(struct fsg_common *common, unsigned int n);
@@ -163,21 +159,4 @@ void fsg_config_from_params(struct fsg_config *cfg,
 			    const struct fsg_module_parameters *params,
 			    unsigned int fsg_num_buffers);
 
-static inline struct fsg_common *
-fsg_common_from_params(struct fsg_common *common,
-		       struct usb_composite_dev *cdev,
-		       const struct fsg_module_parameters *params,
-		       unsigned int fsg_num_buffers)
-	__attribute__((unused));
-static inline struct fsg_common *
-fsg_common_from_params(struct fsg_common *common,
-		       struct usb_composite_dev *cdev,
-		       const struct fsg_module_parameters *params,
-		       unsigned int fsg_num_buffers)
-{
-	struct fsg_config cfg;
-	fsg_config_from_params(&cfg, params, fsg_num_buffers);
-	return fsg_common_init(common, cdev, &cfg);
-}
-
 #endif /* USB_F_MASS_STORAGE_H */
-- 
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