Skip to content

Commit cae5216

Browse files
vadimp-nvidiawsakernel
authored andcommitted
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 <[email protected]> Acked-by: Peter Rosin <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent 8156693 commit cae5216

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

drivers/i2c/muxes/i2c-mux-mlxcpld.c

+2-5
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,8 @@ static int mlxcpld_mux_probe(struct platform_device *pdev)
101101
struct mlxcpld_mux_plat_data *pdata = dev_get_platdata(&pdev->dev);
102102
struct i2c_client *client = to_i2c_client(pdev->dev.parent);
103103
struct i2c_mux_core *muxc;
104-
int num, force;
105104
struct mlxcpld_mux *data;
106-
int err;
105+
int num, err;
107106

108107
if (!pdata)
109108
return -EINVAL;
@@ -130,9 +129,7 @@ static int mlxcpld_mux_probe(struct platform_device *pdev)
130129
/* discard unconfigured channels */
131130
break;
132131

133-
force = pdata->adap_ids[num];
134-
135-
err = i2c_mux_add_adapter(muxc, force, num, 0);
132+
err = i2c_mux_add_adapter(muxc, 0, pdata->chan_ids[num], 0);
136133
if (err)
137134
goto virt_reg_failed;
138135
}

include/linux/platform_data/mlxcpld.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
/* Platform data for the CPLD I2C multiplexers */
1212

1313
/* mlxcpld_mux_plat_data - per mux data, used with i2c_register_board_info
14-
* @adap_ids - adapter array
14+
* @chan_ids - channels array
1515
* @num_adaps - number of adapters
1616
* @sel_reg_addr - mux select register offset in CPLD space
1717
*/
1818
struct mlxcpld_mux_plat_data {
19-
int *adap_ids;
19+
int *chan_ids;
2020
int num_adaps;
2121
int sel_reg_addr;
2222
};

0 commit comments

Comments
 (0)