On Wed, May 08, 2019 at 02:28:29PM +0300, Alexandru Ardelean wrote:
> This change re-introduces `match_string()` as a macro that uses
> ARRAY_SIZE() to compute the size of the array.
> The macro is added in all the places that do
> `match_string(_a, ARRAY_SIZE(_a), s)`, since the change is pretty
> straightforward.
Can you split include/linux/ change from the rest?
>
> Signed-off-by: Alexandru Ardelean
> ---
> drivers/clk/bcm/clk-bcm2835.c| 4 +---
> drivers/gpio/gpiolib-of.c| 2 +-
> drivers/gpu/drm/i915/intel_pipe_crc.c| 2 +-
> drivers/mfd/omap-usb-host.c | 2 +-
> drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c | 2 +-
> drivers/pci/pcie/aer.c | 2 +-
> drivers/usb/common/common.c | 4 ++--
> drivers/usb/typec/class.c| 8 +++-
> drivers/usb/typec/tps6598x.c | 2 +-
> drivers/vfio/vfio.c | 4 +---
> include/linux/string.h | 9 +
> sound/firewire/oxfw/oxfw.c | 2 +-
> sound/soc/codecs/max98088.c | 2 +-
> sound/soc/codecs/max98095.c | 2 +-
> 14 files changed, 25 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
> index a775f6a1f717..1ab388590ead 100644
> --- a/drivers/clk/bcm/clk-bcm2835.c
> +++ b/drivers/clk/bcm/clk-bcm2835.c
> @@ -1390,9 +1390,7 @@ static struct clk_hw *bcm2835_register_clock(struct
> bcm2835_cprman *cprman,
> for (i = 0; i < data->num_mux_parents; i++) {
> parents[i] = data->parents[i];
>
> - ret = __match_string(cprman_parent_names,
> - ARRAY_SIZE(cprman_parent_names),
> - parents[i]);
> + ret = match_string(cprman_parent_names, parents[i]);
> if (ret >= 0)
> parents[i] = cprman->real_parent_names[ret];
> }
> diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
> index 27d6f04ab58e..71e886869d78 100644
> --- a/drivers/gpio/gpiolib-of.c
> +++ b/drivers/gpio/gpiolib-of.c
> @@ -279,7 +279,7 @@ static struct gpio_desc *of_find_regulator_gpio(struct
> device *dev, const char *
> if (!con_id)
> return ERR_PTR(-ENOENT);
>
> - i = __match_string(whitelist, ARRAY_SIZE(whitelist), con_id);
> + i = match_string(whitelist, con_id);
> if (i < 0)
> return ERR_PTR(-ENOENT);
>
> diff --git a/drivers/gpu/drm/i915/intel_pipe_crc.c
> b/drivers/gpu/drm/i915/intel_pipe_crc.c
> index 286fad1f0e08..6fc4f3d3d1f6 100644
> --- a/drivers/gpu/drm/i915/intel_pipe_crc.c
> +++ b/drivers/gpu/drm/i915/intel_pipe_crc.c
> @@ -449,7 +449,7 @@ display_crc_ctl_parse_source(const char *buf, enum
> intel_pipe_crc_source *s)
> return 0;
> }
>
> - i = __match_string(pipe_crc_sources, ARRAY_SIZE(pipe_crc_sources), buf);
> + i = match_string(pipe_crc_sources, buf);
> if (i < 0)
> return i;
>
> diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
> index 9aaacb5bdb26..53dff34c0afc 100644
> --- a/drivers/mfd/omap-usb-host.c
> +++ b/drivers/mfd/omap-usb-host.c
> @@ -509,7 +509,7 @@ static int usbhs_omap_get_dt_pdata(struct device *dev,
> continue;
>
> /* get 'enum usbhs_omap_port_mode' from port mode string */
> - ret = __match_string(port_modes, ARRAY_SIZE(port_modes), mode);
> + ret = match_string(port_modes, mode);
> if (ret < 0) {
> dev_warn(dev, "Invalid port%d-mode \"%s\" in device
> tree\n",
> i, mode);
> diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
> b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
> index 59ce3ff35553..778b4dfd8b75 100644
> --- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
> +++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
> @@ -667,7 +667,7 @@ iwl_dbgfs_bt_force_ant_write(struct iwl_mvm *mvm, char
> *buf,
> };
> int ret, bt_force_ant_mode;
>
> - ret = __match_string(modes_str, ARRAY_SIZE(modes_str), buf);
> + ret = match_string(modes_str, buf);
> if (ret < 0)
> return ret;
>
> diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
> index 41a0773a1cbc..2278caba109c 100644
> --- a/drivers/pci/pcie/aer.c
> +++ b/drivers/pci/pcie/aer.c
> @@ -203,7 +203,7 @@ void pcie_ecrc_get_policy(char *str)
> {
> int i;
>
> - i = __match_string(ecrc_policy_str, ARRAY_SIZE(ecrc_policy_str), str);
> + i = match_string(ecrc_policy_str, str);
> if (i < 0)
> return;
>
> diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
> index bca0c404c6ca..5a651d311d38 100644
> --- a/drivers/usb/common/common.c
> +++ b