i2c: mux: mlxcpld: Get rid of adapter numbers enforcement

Do not set the argument 'force_nr' of i2c_mux_add_adapter() routine,
instead provide argument 'chan_id'.
Rename mux ids array from 'adap_ids' to 'chan_ids'.

The motivation is to prepare infrastructure to be able to:
- Create only the child adapters which are actually needed - for which
  channel ids are specified.
- To assign 'nrs' to these child adapters dynamically, with no 'nr'
  enforcement.

Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
Acked-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
This commit is contained in:
Vadim Pasternak 2021-02-08 22:16:03 +02:00 committed by Wolfram Sang
parent 8156693808
commit cae5216387
2 changed files with 4 additions and 7 deletions

View file

@ -101,9 +101,8 @@ static int mlxcpld_mux_probe(struct platform_device *pdev)
struct mlxcpld_mux_plat_data *pdata = dev_get_platdata(&pdev->dev); struct mlxcpld_mux_plat_data *pdata = dev_get_platdata(&pdev->dev);
struct i2c_client *client = to_i2c_client(pdev->dev.parent); struct i2c_client *client = to_i2c_client(pdev->dev.parent);
struct i2c_mux_core *muxc; struct i2c_mux_core *muxc;
int num, force;
struct mlxcpld_mux *data; struct mlxcpld_mux *data;
int err; int num, err;
if (!pdata) if (!pdata)
return -EINVAL; return -EINVAL;
@ -130,9 +129,7 @@ static int mlxcpld_mux_probe(struct platform_device *pdev)
/* discard unconfigured channels */ /* discard unconfigured channels */
break; break;
force = pdata->adap_ids[num]; err = i2c_mux_add_adapter(muxc, 0, pdata->chan_ids[num], 0);
err = i2c_mux_add_adapter(muxc, force, num, 0);
if (err) if (err)
goto virt_reg_failed; goto virt_reg_failed;
} }

View file

@ -11,12 +11,12 @@
/* Platform data for the CPLD I2C multiplexers */ /* Platform data for the CPLD I2C multiplexers */
/* mlxcpld_mux_plat_data - per mux data, used with i2c_register_board_info /* mlxcpld_mux_plat_data - per mux data, used with i2c_register_board_info
* @adap_ids - adapter array * @chan_ids - channels array
* @num_adaps - number of adapters * @num_adaps - number of adapters
* @sel_reg_addr - mux select register offset in CPLD space * @sel_reg_addr - mux select register offset in CPLD space
*/ */
struct mlxcpld_mux_plat_data { struct mlxcpld_mux_plat_data {
int *adap_ids; int *chan_ids;
int num_adaps; int num_adaps;
int sel_reg_addr; int sel_reg_addr;
}; };