Commit f0c86427 authored by Johannes Berg's avatar Johannes Berg Committed by Luca Coelho
Browse files

iwlwifi: prefer WIDE_ID() over iwl_cmd_id()



The order of arguments for iwl_cmd_id() is confusing, and the
version is always 0 and thus a useless argument. Prefer the
WIDE_ID() macro (which needs to be a macro due to use in switch
cases etc.) over the iwl_cmd_id() function.

Obviously done with spatch:

  @@
  expression G, C;
  @@
  -iwl_cmd_id(C, G, 0)
  +WIDE_ID(G, C)

Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220128153014.cc4f9d1a2e9b.Ieb023cd773ea22e819d1ef1c37ae857ecc1a839d@changeid


Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent 6da7ba3a
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
 *
 * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved.
 * Copyright(c) 2015 Intel Deutschland GmbH
 * Copyright(c) 2018, 2020 Intel Corporation
 * Copyright(c) 2018, 2020-2021 Intel Corporation
 *
 * Portions of this file are derived from the ipw3945 project, as well
 * as portionhelp of the ieee80211 subsystem header files.
@@ -1015,8 +1015,7 @@ void iwl_rx_dispatch(struct iwl_op_mode *op_mode, struct napi_struct *napi,
		/* No handling needed */
		IWL_DEBUG_RX(priv, "No handler needed for %s, 0x%02x\n",
			     iwl_get_cmd_string(priv->trans,
						iwl_cmd_id(pkt->hdr.cmd,
							   0, 0)),
						WIDE_ID(0, pkt->hdr.cmd)),
			     pkt->hdr.cmd);
	}
}
+2 −2
Original line number Diff line number Diff line
@@ -150,7 +150,7 @@ static int iwl_dbgfs_enabled_severities_write(struct iwl_fw_runtime *fwrt,
{
	struct iwl_dbg_host_event_cfg_cmd event_cfg;
	struct iwl_host_cmd hcmd = {
		.id = iwl_cmd_id(HOST_EVENT_CFG, DEBUG_GROUP, 0),
		.id = WIDE_ID(DEBUG_GROUP, HOST_EVENT_CFG),
		.flags = CMD_ASYNC,
		.data[0] = &event_cfg,
		.len[0] = sizeof(event_cfg),
@@ -358,7 +358,7 @@ static int iwl_dbgfs_fw_info_seq_show(struct seq_file *seq, void *v)

	ver = &fw->ucode_capa.cmd_versions[state->pos];

	cmd_id = iwl_cmd_id(ver->cmd, ver->group, 0);
	cmd_id = WIDE_ID(ver->group, ver->cmd);

	seq_printf(seq, "  0x%04x:\n", cmd_id);
	seq_printf(seq, "    name: %s\n",
+1 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ int iwl_set_soc_latency(struct iwl_fw_runtime *fwrt)
{
	struct iwl_soc_configuration_cmd cmd = {};
	struct iwl_host_cmd hcmd = {
		.id = iwl_cmd_id(SOC_CONFIGURATION_CMD, SYSTEM_GROUP, 0),
		.id = WIDE_ID(SYSTEM_GROUP, SOC_CONFIGURATION_CMD),
		.data[0] = &cmd,
		.len[0] = sizeof(cmd),
	};
+1 −1
Original line number Diff line number Diff line
@@ -243,7 +243,7 @@ static int iwl_send_paging_cmd(struct iwl_fw_runtime *fwrt,
		.block_num = cpu_to_le32(fwrt->num_of_paging_blk),
	};
	struct iwl_host_cmd hcmd = {
		.id = iwl_cmd_id(FW_PAGING_BLOCK_CMD, IWL_ALWAYS_LONG_GROUP, 0),
		.id = WIDE_ID(IWL_ALWAYS_LONG_GROUP, FW_PAGING_BLOCK_CMD),
		.len = { sizeof(paging_cmd), },
		.data = { &paging_cmd, },
	};
+2 −2
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
/*
 * Copyright (C) 2012-2014, 2018-2020 Intel Corporation
 * Copyright (C) 2012-2014, 2018-2021 Intel Corporation
 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
 * Copyright (C) 2016-2017 Intel Deutschland GmbH
 */
@@ -89,7 +89,7 @@ void iwl_get_shared_mem_conf(struct iwl_fw_runtime *fwrt)

	if (fw_has_capa(&fwrt->fw->ucode_capa,
			IWL_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG))
		cmd.id = iwl_cmd_id(SHARED_MEM_CFG_CMD, SYSTEM_GROUP, 0);
		cmd.id = WIDE_ID(SYSTEM_GROUP, SHARED_MEM_CFG_CMD);
	else
		cmd.id = SHARED_MEM_CFG;

Loading