aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-04-24 13:22:09 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-24 13:22:09 -0400
commitc6668726d2c2c581e6c417448c472c994d026f5f (patch)
treeccbc5a73b9dfe09a065cb5d8627aa2297e730ec0 /drivers/usb
parent06b45f2aa703837163496f5db6a53575665cc6b4 (diff)
parent68d4cef3bab3fb9bb0dbac690ba35a96cb5a16d9 (diff)
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Pull SCSI target updates from Nicholas Bellinger: "Lots of activity in target land the last months. The highlights include: - Convert fabric drivers tree-wide to target_register_template() (hch + bart) - iser-target hardening fixes + v1.0 improvements (sagi) - Convert iscsi_thread_set usage to kthread.h + kill iscsi_target_tq.c (sagi + nab) - Add support for T10-PI WRITE_STRIP + READ_INSERT operation (mkp + sagi + nab) - DIF fixes for CONFIG_DEBUG_SG=y + UNMAP file emulation (akinobu + sagi + mkp) - Extended TCMU ABI v2 for future BIDI + DIF support (andy + ilias) - Fix COMPARE_AND_WRITE handling for NO_ALLLOC drivers (hch + nab) Thanks to everyone who contributed this round with new features, bug-reports, fixes, cleanups and improvements. Looking forward, it's currently shaping up to be a busy v4.2 as well" * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (69 commits) target: Put TCMU under a new config option target: Version 2 of TCMU ABI target: fix tcm_mod_builder.py target/file: Fix UNMAP with DIF protection support target/file: Fix SG table for prot_buf initialization target/file: Fix BUG() when CONFIG_DEBUG_SG=y and DIF protection enabled target: Make core_tmr_abort_task() skip TMFs target/sbc: Update sbc_dif_generate pr_debug output target/sbc: Make internal DIF emulation honor ->prot_checks target/sbc: Return INVALID_CDB_FIELD if DIF + sess_prot_type disabled target: Ensure sess_prot_type is saved across session restart target/rd: Don't pass incomplete scatterlist entries to sbc_dif_verify_* target: Remove the unused flag SCF_ACK_KREF target: Fix two sparse warnings target: Fix COMPARE_AND_WRITE with SG_TO_MEM_NOALLOC handling target: simplify the target template registration API target: simplify target_xcopy_init_pt_lun target: remove the unused SCF_CMD_XCOPY_PASSTHROUGH flag target/rd: reduce code duplication in rd_execute_rw() tcm_loop: fixup tpgt string to integer conversion ...
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/legacy/tcm_usb_gadget.c57
1 files changed, 9 insertions, 48 deletions
diff --git a/drivers/usb/gadget/legacy/tcm_usb_gadget.c b/drivers/usb/gadget/legacy/tcm_usb_gadget.c
index 6e0a019aad54..8b80addc4ce6 100644
--- a/drivers/usb/gadget/legacy/tcm_usb_gadget.c
+++ b/drivers/usb/gadget/legacy/tcm_usb_gadget.c
@@ -29,7 +29,7 @@
29 29
30USB_GADGET_COMPOSITE_OPTIONS(); 30USB_GADGET_COMPOSITE_OPTIONS();
31 31
32static struct target_fabric_configfs *usbg_fabric_configfs; 32static const struct target_core_fabric_ops usbg_ops;
33 33
34static inline struct f_uas *to_f_uas(struct usb_function *f) 34static inline struct f_uas *to_f_uas(struct usb_function *f)
35{ 35{
@@ -1572,8 +1572,7 @@ static struct se_portal_group *usbg_make_tpg(
1572 tpg->tport = tport; 1572 tpg->tport = tport;
1573 tpg->tport_tpgt = tpgt; 1573 tpg->tport_tpgt = tpgt;
1574 1574
1575 ret = core_tpg_register(&usbg_fabric_configfs->tf_ops, wwn, 1575 ret = core_tpg_register(&usbg_ops, wwn, &tpg->se_tpg, tpg,
1576 &tpg->se_tpg, tpg,
1577 TRANSPORT_TPG_TYPE_NORMAL); 1576 TRANSPORT_TPG_TYPE_NORMAL);
1578 if (ret < 0) { 1577 if (ret < 0) {
1579 destroy_workqueue(tpg->workqueue); 1578 destroy_workqueue(tpg->workqueue);
@@ -1864,7 +1863,9 @@ static int usbg_check_stop_free(struct se_cmd *se_cmd)
1864 return 1; 1863 return 1;
1865} 1864}
1866 1865
1867static struct target_core_fabric_ops usbg_ops = { 1866static const struct target_core_fabric_ops usbg_ops = {
1867 .module = THIS_MODULE,
1868 .name = "usb_gadget",
1868 .get_fabric_name = usbg_get_fabric_name, 1869 .get_fabric_name = usbg_get_fabric_name,
1869 .get_fabric_proto_ident = usbg_get_fabric_proto_ident, 1870 .get_fabric_proto_ident = usbg_get_fabric_proto_ident,
1870 .tpg_get_wwn = usbg_get_fabric_wwn, 1871 .tpg_get_wwn = usbg_get_fabric_wwn,
@@ -1906,46 +1907,9 @@ static struct target_core_fabric_ops usbg_ops = {
1906 .fabric_drop_np = NULL, 1907 .fabric_drop_np = NULL,
1907 .fabric_make_nodeacl = usbg_make_nodeacl, 1908 .fabric_make_nodeacl = usbg_make_nodeacl,
1908 .fabric_drop_nodeacl = usbg_drop_nodeacl, 1909 .fabric_drop_nodeacl = usbg_drop_nodeacl,
1909};
1910
1911static int usbg_register_configfs(void)
1912{
1913 struct target_fabric_configfs *fabric;
1914 int ret;
1915
1916 fabric = target_fabric_configfs_init(THIS_MODULE, "usb_gadget");
1917 if (IS_ERR(fabric)) {
1918 printk(KERN_ERR "target_fabric_configfs_init() failed\n");
1919 return PTR_ERR(fabric);
1920 }
1921
1922 fabric->tf_ops = usbg_ops;
1923 fabric->tf_cit_tmpl.tfc_wwn_cit.ct_attrs = usbg_wwn_attrs;
1924 fabric->tf_cit_tmpl.tfc_tpg_base_cit.ct_attrs = usbg_base_attrs;
1925 fabric->tf_cit_tmpl.tfc_tpg_attrib_cit.ct_attrs = NULL;
1926 fabric->tf_cit_tmpl.tfc_tpg_param_cit.ct_attrs = NULL;
1927 fabric->tf_cit_tmpl.tfc_tpg_np_base_cit.ct_attrs = NULL;
1928 fabric->tf_cit_tmpl.tfc_tpg_nacl_base_cit.ct_attrs = NULL;
1929 fabric->tf_cit_tmpl.tfc_tpg_nacl_attrib_cit.ct_attrs = NULL;
1930 fabric->tf_cit_tmpl.tfc_tpg_nacl_auth_cit.ct_attrs = NULL;
1931 fabric->tf_cit_tmpl.tfc_tpg_nacl_param_cit.ct_attrs = NULL;
1932 ret = target_fabric_configfs_register(fabric);
1933 if (ret < 0) {
1934 printk(KERN_ERR "target_fabric_configfs_register() failed"
1935 " for usb-gadget\n");
1936 return ret;
1937 }
1938 usbg_fabric_configfs = fabric;
1939 return 0;
1940};
1941 1910
1942static void usbg_deregister_configfs(void) 1911 .tfc_wwn_attrs = usbg_wwn_attrs,
1943{ 1912 .tfc_tpg_base_attrs = usbg_base_attrs,
1944 if (!(usbg_fabric_configfs))
1945 return;
1946
1947 target_fabric_configfs_deregister(usbg_fabric_configfs);
1948 usbg_fabric_configfs = NULL;
1949}; 1913};
1950 1914
1951/* Start gadget.c code */ 1915/* Start gadget.c code */
@@ -2454,16 +2418,13 @@ static void usbg_detach(struct usbg_tpg *tpg)
2454 2418
2455static int __init usb_target_gadget_init(void) 2419static int __init usb_target_gadget_init(void)
2456{ 2420{
2457 int ret; 2421 return target_register_template(&usbg_ops);
2458
2459 ret = usbg_register_configfs();
2460 return ret;
2461} 2422}
2462module_init(usb_target_gadget_init); 2423module_init(usb_target_gadget_init);
2463 2424
2464static void __exit usb_target_gadget_exit(void) 2425static void __exit usb_target_gadget_exit(void)
2465{ 2426{
2466 usbg_deregister_configfs(); 2427 target_unregister_template(&usbg_ops);
2467} 2428}
2468module_exit(usb_target_gadget_exit); 2429module_exit(usb_target_gadget_exit);
2469 2430