aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target/loopback/tcm_loop.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-11-13 23:04:17 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-11-13 23:04:17 -0500
commit9aa3d651a9199103eb6451aeb0ac1b66a6d770a6 (patch)
tree42cc631c54e1fcbdeedee8e955c4797634a91af7 /drivers/target/loopback/tcm_loop.c
parent5d2eb548b309be34ecf3b91f0b7300a2b9d09b8c (diff)
parent517982229f78b2aebf00a8a337e84e8eeea70b8e (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: "This series contains HCH's changes to absorb configfs attribute ->show() + ->store() function pointer usage from it's original tree-wide consumers, into common configfs code. It includes usb-gadget, target w/ drivers, netconsole and ocfs2 changes to realize the improved simplicity, that now renders the original include/target/configfs_macros.h CPP magic for fabric drivers and others, unnecessary and obsolete. And with common code in place, new configfs attributes can be added easier than ever before. Note, there are further improvements in-flight from other folks for v4.5 code in configfs land, plus number of target fixes for post -rc1 code" In the meantime, a new user of the now-removed old configfs API came in through the char/misc tree in commit 7bd1d4093c2f ("stm class: Introduce an abstraction for System Trace Module devices"). This merge resolution comes from Alexander Shishkin, who updated his stm class tracing abstraction to account for the removal of the old show_attribute and store_attribute methods in commit 517982229f78 ("configfs: remove old API") from this pull. As Alexander says about that patch: "There's no need to keep an extra wrapper structure per item and the awkward show_attribute/store_attribute item ops are no longer needed. This patch converts policy code to the new api, all the while making the code quite a bit smaller and easier on the eyes. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>" That patch was folded into the merge so that the tree should be fully bisectable. * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (23 commits) configfs: remove old API ocfs2/cluster: use per-attribute show and store methods ocfs2/cluster: move locking into attribute store methods netconsole: use per-attribute show and store methods target: use per-attribute show and store methods spear13xx_pcie_gadget: use per-attribute show and store methods dlm: use per-attribute show and store methods usb-gadget/f_serial: use per-attribute show and store methods usb-gadget/f_phonet: use per-attribute show and store methods usb-gadget/f_obex: use per-attribute show and store methods usb-gadget/f_uac2: use per-attribute show and store methods usb-gadget/f_uac1: use per-attribute show and store methods usb-gadget/f_mass_storage: use per-attribute show and store methods usb-gadget/f_sourcesink: use per-attribute show and store methods usb-gadget/f_printer: use per-attribute show and store methods usb-gadget/f_midi: use per-attribute show and store methods usb-gadget/f_loopback: use per-attribute show and store methods usb-gadget/ether: use per-attribute show and store methods usb-gadget/f_acm: use per-attribute show and store methods usb-gadget/f_hid: use per-attribute show and store methods ...
Diffstat (limited to 'drivers/target/loopback/tcm_loop.c')
-rw-r--r--drivers/target/loopback/tcm_loop.c60
1 files changed, 26 insertions, 34 deletions
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
index 5bc85ffed720..999b6eba52e8 100644
--- a/drivers/target/loopback/tcm_loop.c
+++ b/drivers/target/loopback/tcm_loop.c
@@ -34,7 +34,6 @@
34 34
35#include <target/target_core_base.h> 35#include <target/target_core_base.h>
36#include <target/target_core_fabric.h> 36#include <target/target_core_fabric.h>
37#include <target/target_core_fabric_configfs.h>
38 37
39#include "tcm_loop.h" 38#include "tcm_loop.h"
40 39
@@ -763,21 +762,20 @@ static void tcm_loop_port_unlink(
763 762
764/* End items for tcm_loop_port_cit */ 763/* End items for tcm_loop_port_cit */
765 764
766static ssize_t tcm_loop_tpg_attrib_show_fabric_prot_type( 765static ssize_t tcm_loop_tpg_attrib_fabric_prot_type_show(
767 struct se_portal_group *se_tpg, 766 struct config_item *item, char *page)
768 char *page)
769{ 767{
768 struct se_portal_group *se_tpg = attrib_to_tpg(item);
770 struct tcm_loop_tpg *tl_tpg = container_of(se_tpg, struct tcm_loop_tpg, 769 struct tcm_loop_tpg *tl_tpg = container_of(se_tpg, struct tcm_loop_tpg,
771 tl_se_tpg); 770 tl_se_tpg);
772 771
773 return sprintf(page, "%d\n", tl_tpg->tl_fabric_prot_type); 772 return sprintf(page, "%d\n", tl_tpg->tl_fabric_prot_type);
774} 773}
775 774
776static ssize_t tcm_loop_tpg_attrib_store_fabric_prot_type( 775static ssize_t tcm_loop_tpg_attrib_fabric_prot_type_store(
777 struct se_portal_group *se_tpg, 776 struct config_item *item, const char *page, size_t count)
778 const char *page,
779 size_t count)
780{ 777{
778 struct se_portal_group *se_tpg = attrib_to_tpg(item);
781 struct tcm_loop_tpg *tl_tpg = container_of(se_tpg, struct tcm_loop_tpg, 779 struct tcm_loop_tpg *tl_tpg = container_of(se_tpg, struct tcm_loop_tpg,
782 tl_se_tpg); 780 tl_se_tpg);
783 unsigned long val; 781 unsigned long val;
@@ -796,10 +794,10 @@ static ssize_t tcm_loop_tpg_attrib_store_fabric_prot_type(
796 return count; 794 return count;
797} 795}
798 796
799TF_TPG_ATTRIB_ATTR(tcm_loop, fabric_prot_type, S_IRUGO | S_IWUSR); 797CONFIGFS_ATTR(tcm_loop_tpg_attrib_, fabric_prot_type);
800 798
801static struct configfs_attribute *tcm_loop_tpg_attrib_attrs[] = { 799static struct configfs_attribute *tcm_loop_tpg_attrib_attrs[] = {
802 &tcm_loop_tpg_attrib_fabric_prot_type.attr, 800 &tcm_loop_tpg_attrib_attr_fabric_prot_type,
803 NULL, 801 NULL,
804}; 802};
805 803
@@ -894,10 +892,9 @@ static int tcm_loop_drop_nexus(
894 892
895/* End items for tcm_loop_nexus_cit */ 893/* End items for tcm_loop_nexus_cit */
896 894
897static ssize_t tcm_loop_tpg_show_nexus( 895static ssize_t tcm_loop_tpg_nexus_show(struct config_item *item, char *page)
898 struct se_portal_group *se_tpg,
899 char *page)
900{ 896{
897 struct se_portal_group *se_tpg = to_tpg(item);
901 struct tcm_loop_tpg *tl_tpg = container_of(se_tpg, 898 struct tcm_loop_tpg *tl_tpg = container_of(se_tpg,
902 struct tcm_loop_tpg, tl_se_tpg); 899 struct tcm_loop_tpg, tl_se_tpg);
903 struct tcm_loop_nexus *tl_nexus; 900 struct tcm_loop_nexus *tl_nexus;
@@ -913,11 +910,10 @@ static ssize_t tcm_loop_tpg_show_nexus(
913 return ret; 910 return ret;
914} 911}
915 912
916static ssize_t tcm_loop_tpg_store_nexus( 913static ssize_t tcm_loop_tpg_nexus_store(struct config_item *item,
917 struct se_portal_group *se_tpg, 914 const char *page, size_t count)
918 const char *page,
919 size_t count)
920{ 915{
916 struct se_portal_group *se_tpg = to_tpg(item);
921 struct tcm_loop_tpg *tl_tpg = container_of(se_tpg, 917 struct tcm_loop_tpg *tl_tpg = container_of(se_tpg,
922 struct tcm_loop_tpg, tl_se_tpg); 918 struct tcm_loop_tpg, tl_se_tpg);
923 struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba; 919 struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba;
@@ -992,12 +988,10 @@ check_newline:
992 return count; 988 return count;
993} 989}
994 990
995TF_TPG_BASE_ATTR(tcm_loop, nexus, S_IRUGO | S_IWUSR); 991static ssize_t tcm_loop_tpg_transport_status_show(struct config_item *item,
996 992 char *page)
997static ssize_t tcm_loop_tpg_show_transport_status(
998 struct se_portal_group *se_tpg,
999 char *page)
1000{ 993{
994 struct se_portal_group *se_tpg = to_tpg(item);
1001 struct tcm_loop_tpg *tl_tpg = container_of(se_tpg, 995 struct tcm_loop_tpg *tl_tpg = container_of(se_tpg,
1002 struct tcm_loop_tpg, tl_se_tpg); 996 struct tcm_loop_tpg, tl_se_tpg);
1003 const char *status = NULL; 997 const char *status = NULL;
@@ -1020,11 +1014,10 @@ static ssize_t tcm_loop_tpg_show_transport_status(
1020 return ret; 1014 return ret;
1021} 1015}
1022 1016
1023static ssize_t tcm_loop_tpg_store_transport_status( 1017static ssize_t tcm_loop_tpg_transport_status_store(struct config_item *item,
1024 struct se_portal_group *se_tpg, 1018 const char *page, size_t count)
1025 const char *page,
1026 size_t count)
1027{ 1019{
1020 struct se_portal_group *se_tpg = to_tpg(item);
1028 struct tcm_loop_tpg *tl_tpg = container_of(se_tpg, 1021 struct tcm_loop_tpg *tl_tpg = container_of(se_tpg,
1029 struct tcm_loop_tpg, tl_se_tpg); 1022 struct tcm_loop_tpg, tl_se_tpg);
1030 1023
@@ -1044,11 +1037,12 @@ static ssize_t tcm_loop_tpg_store_transport_status(
1044 return -EINVAL; 1037 return -EINVAL;
1045} 1038}
1046 1039
1047TF_TPG_BASE_ATTR(tcm_loop, transport_status, S_IRUGO | S_IWUSR); 1040CONFIGFS_ATTR(tcm_loop_tpg_, nexus);
1041CONFIGFS_ATTR(tcm_loop_tpg_, transport_status);
1048 1042
1049static struct configfs_attribute *tcm_loop_tpg_attrs[] = { 1043static struct configfs_attribute *tcm_loop_tpg_attrs[] = {
1050 &tcm_loop_tpg_nexus.attr, 1044 &tcm_loop_tpg_attr_nexus,
1051 &tcm_loop_tpg_transport_status.attr, 1045 &tcm_loop_tpg_attr_transport_status,
1052 NULL, 1046 NULL,
1053}; 1047};
1054 1048
@@ -1216,17 +1210,15 @@ static void tcm_loop_drop_scsi_hba(
1216} 1210}
1217 1211
1218/* Start items for tcm_loop_cit */ 1212/* Start items for tcm_loop_cit */
1219static ssize_t tcm_loop_wwn_show_attr_version( 1213static ssize_t tcm_loop_wwn_version_show(struct config_item *item, char *page)
1220 struct target_fabric_configfs *tf,
1221 char *page)
1222{ 1214{
1223 return sprintf(page, "TCM Loopback Fabric module %s\n", TCM_LOOP_VERSION); 1215 return sprintf(page, "TCM Loopback Fabric module %s\n", TCM_LOOP_VERSION);
1224} 1216}
1225 1217
1226TF_WWN_ATTR_RO(tcm_loop, version); 1218CONFIGFS_ATTR_RO(tcm_loop_wwn_, version);
1227 1219
1228static struct configfs_attribute *tcm_loop_wwn_attrs[] = { 1220static struct configfs_attribute *tcm_loop_wwn_attrs[] = {
1229 &tcm_loop_wwn_version.attr, 1221 &tcm_loop_wwn_attr_version,
1230 NULL, 1222 NULL,
1231}; 1223};
1232 1224