Forráskód Böngészése

msm: ipa: Interface names standardization

Use macros instead of magic strings for interfaces names.

Change-Id: I908f35725c72d425334beebd55bc0f0532e183ce
Acked-by: Eliad Ben Yishay <[email protected]>
Signed-off-by: Ilia Lin <[email protected]>
Ilia Lin 3 éve
szülő
commit
fb6b6d379d

+ 2 - 2
drivers/platform/msm/ipa/ipa_clients/ipa_eth.c

@@ -858,13 +858,13 @@ static int ipa_eth_client_reg_intf_internal(struct ipa_eth_intf_info *intf)
 
 	IPA_ETH_DBG("register interface for netdev %s\n", intf->net_dev->name);
 	/* multiple attach support */
-	if (strnstr(intf->net_dev->name, "eth0", strlen(intf->net_dev->name))) {
+	if (strnstr(intf->net_dev->name, STR_ETH0_IFACE, strlen(intf->net_dev->name))) {
 		ret = ipa3_is_vlan_mode(IPA_VLAN_IF_ETH0, &vlan_mode);
 		if (ret) {
 			IPA_ETH_ERR("Could not determine IPA VLAN mode\n");
 			return ret;
 		}
-	} else if (strnstr(intf->net_dev->name, "eth1", strlen(intf->net_dev->name))) {
+	} else if (strnstr(intf->net_dev->name, STR_ETH1_IFACE, strlen(intf->net_dev->name))) {
 		ret = ipa3_is_vlan_mode(IPA_VLAN_IF_ETH1, &vlan_mode);
 		if (ret) {
 			IPA_ETH_ERR("Could not determine IPA VLAN mode\n");

+ 6 - 0
drivers/platform/msm/ipa/ipa_common_i.h

@@ -179,6 +179,12 @@ do {\
 #define IPA_GSI_CHANNEL_STOP_SLEEP_MIN_USEC (3000)
 #define IPA_GSI_CHANNEL_STOP_SLEEP_MAX_USEC (5000)
 
+#define STR_ETH_IFACE "eth"
+#define STR_ETH0_IFACE "eth0"
+#define STR_ETH1_IFACE "eth1"
+#define STR_RNDIS_IFACE "rndis"
+#define STR_ECM_IFACE "ecm"
+
 /**
  * qmap_hdr -
  * @next_hdr: 1 - there is a qmap extension header, 0 - opposite

+ 5 - 5
drivers/platform/msm/ipa/ipa_v3/ipa.c

@@ -8088,25 +8088,25 @@ static ssize_t ipa3_write(struct file *file, const char __user *buf,
 	if (ipa3_ctx->platform_type == IPA_PLAT_TYPE_MDM) {
 
 		if (strnstr(dbg_buff, "vlan", strlen(dbg_buff))) {
-			if (strnstr(dbg_buff, "eth", strlen(dbg_buff)))
+			if (strnstr(dbg_buff, STR_ETH_IFACE, strlen(dbg_buff)))
 				ipa3_ctx->vlan_mode_iface[IPA_VLAN_IF_EMAC] =
 				true;
 #if IPA_ETH_API_VER >= 2
 			/* In Dual NIC mode we get "vlan: eth [eth0|eth1] [eth0|eth1]?" while device name is
 			   "eth0" in legacy so, we set it to false to diffrentiate Dual NIC from legacy */
-			if (strnstr(dbg_buff, "eth0", strlen(dbg_buff))) {
+			if (strnstr(dbg_buff, STR_ETH0_IFACE, strlen(dbg_buff))) {
 				ipa3_ctx->vlan_mode_iface[IPA_VLAN_IF_ETH0] = true;
 				ipa3_ctx->vlan_mode_iface[IPA_VLAN_IF_EMAC] = false;
 			}
-			if (strnstr(dbg_buff, "eth1", strlen(dbg_buff))){
+			if (strnstr(dbg_buff, STR_ETH1_IFACE, strlen(dbg_buff))){
 				ipa3_ctx->vlan_mode_iface[IPA_VLAN_IF_ETH1] = true;
 				ipa3_ctx->vlan_mode_iface[IPA_VLAN_IF_EMAC] = false;
 			}
 #endif
-			if (strnstr(dbg_buff, "rndis", strlen(dbg_buff)))
+			if (strnstr(dbg_buff, STR_RNDIS_IFACE, strlen(dbg_buff)))
 				ipa3_ctx->vlan_mode_iface[IPA_VLAN_IF_RNDIS] =
 				true;
-			if (strnstr(dbg_buff, "ecm", strlen(dbg_buff)))
+			if (strnstr(dbg_buff, STR_ECM_IFACE, strlen(dbg_buff)))
 				ipa3_ctx->vlan_mode_iface[IPA_VLAN_IF_ECM] =
 				true;
 

+ 2 - 2
drivers/platform/msm/ipa/ipa_v3/ipa_eth_i.c

@@ -941,13 +941,13 @@ int ipa3_eth_connect(
 	net_dev = pipe->client_info->net_dev;
 
 	/* multiple attach support */
-	if (strnstr(net_dev->name, "eth0", strlen(net_dev->name))) {
+	if (strnstr(net_dev->name, STR_ETH0_IFACE, strlen(net_dev->name))) {
 		result = ipa3_is_vlan_mode(IPA_VLAN_IF_ETH0, &vlan_mode);
 		if (result) {
 			IPAERR("Could not determine IPA VLAN mode\n");
 			return result;
 		}
-	} else if (strnstr(net_dev->name, "eth1", strlen(net_dev->name))) {
+	} else if (strnstr(net_dev->name, STR_ETH1_IFACE, strlen(net_dev->name))) {
 		result = ipa3_is_vlan_mode(IPA_VLAN_IF_ETH1, &vlan_mode);
 		if (result) {
 			IPAERR("Could not determine IPA VLAN mode\n");