Commit 5bea4304 authored by Yisheng Xie's avatar Yisheng Xie Committed by Luca Coelho
Browse files

iwlwifi: mvm: use match_string() helper



match_string() returns the index of an array for a matching string,
which can be used intead of open coded variant.

Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: default avatarYisheng Xie <xieyisheng1@huawei.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent 136521cb
Loading
Loading
Loading
Loading
+4 −9
Original line number Original line Diff line number Diff line
@@ -666,16 +666,11 @@ iwl_dbgfs_bt_force_ant_write(struct iwl_mvm *mvm, char *buf,
	};
	};
	int ret, bt_force_ant_mode;
	int ret, bt_force_ant_mode;


	for (bt_force_ant_mode = 0;
	ret = match_string(modes_str, ARRAY_SIZE(modes_str), buf);
	     bt_force_ant_mode < ARRAY_SIZE(modes_str);
	if (ret < 0)
	     bt_force_ant_mode++) {
		return ret;
		if (!strcmp(buf, modes_str[bt_force_ant_mode]))
			break;
	}

	if (bt_force_ant_mode >= ARRAY_SIZE(modes_str))
		return -EINVAL;


	bt_force_ant_mode = ret;
	ret = 0;
	ret = 0;
	mutex_lock(&mvm->mutex);
	mutex_lock(&mvm->mutex);
	if (mvm->bt_force_ant_mode == bt_force_ant_mode)
	if (mvm->bt_force_ant_mode == bt_force_ant_mode)