diff mbox series

[i2c-next,v3,3/6] i2c: mux: mlxcpld: Rename mux ids array

Message ID 20210130173447.26328-4-vadimp@nvidia.com
State Superseded
Delegated to: Peter Rosin
Headers show
Series i2c: mux: mlxcpld: Extend driver functionality | expand

Commit Message

Vadim Pasternak Jan. 30, 2021, 5:34 p.m. UTC
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>
---
 drivers/i2c/muxes/i2c-mux-mlxcpld.c   | 2 +-
 include/linux/platform_data/mlxcpld.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Peter Rosin Feb. 1, 2021, 9:09 a.m. UTC | #1
Hi!

On 2021-01-30 18:34, Vadim Pasternak wrote:
> 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.

The series is starting to take shape!

However, it's still bad to only change the name of adap_id to chan_id
here. I.e., the division between 3/6 and 5/6 makes no sense at all.
For as long as the variable is used to fill in the force_nr argument of
i2c_mux_add_adapter, the name adap_id makes sense. It's only when the
variable is used to fill in the chan_id argument of that function that
the name chan_id makes more sense.

See, it is not just a rename, in the end you have changed the meaning.
You should change the name at the same time you change the semantics.

I.e., this patch needs to include the parts of 5/6 that deals with
argument two and three of the i2c_mux_add_adapter call (but not the
parts that deal with the CPLD_MUX_MAX_NCHANS to pdata->num_adaps
transition, I feel that should remain a separate patch).

Cheers,
Peter

> Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
> ---
>  drivers/i2c/muxes/i2c-mux-mlxcpld.c   | 2 +-
>  include/linux/platform_data/mlxcpld.h | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/i2c/muxes/i2c-mux-mlxcpld.c b/drivers/i2c/muxes/i2c-mux-mlxcpld.c
> index 113ad84cdd94..9e9d74bd1059 100644
> --- a/drivers/i2c/muxes/i2c-mux-mlxcpld.c
> +++ b/drivers/i2c/muxes/i2c-mux-mlxcpld.c
> @@ -130,7 +130,7 @@ static int mlxcpld_mux_probe(struct platform_device *pdev)
>  			/* discard unconfigured channels */
>  			break;
>  
> -		force = pdata->adap_ids[num];
> +		force = pdata->chan_ids[num];
>  
>  		err = i2c_mux_add_adapter(muxc, force, num, 0);
>  		if (err)
> diff --git a/include/linux/platform_data/mlxcpld.h b/include/linux/platform_data/mlxcpld.h
> index e6c18bf017dd..04d93c563c04 100644
> --- a/include/linux/platform_data/mlxcpld.h
> +++ b/include/linux/platform_data/mlxcpld.h
> @@ -11,12 +11,12 @@
>  /* Platform data for the CPLD I2C multiplexers */
>  
>  /* 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
>   * @sel_reg_addr - mux select register offset in CPLD space
>   */
>  struct mlxcpld_mux_plat_data {
> -	int *adap_ids;
> +	int *chan_ids;
>  	int num_adaps;
>  	int sel_reg_addr;
>  };
>
diff mbox series

Patch

diff --git a/drivers/i2c/muxes/i2c-mux-mlxcpld.c b/drivers/i2c/muxes/i2c-mux-mlxcpld.c
index 113ad84cdd94..9e9d74bd1059 100644
--- a/drivers/i2c/muxes/i2c-mux-mlxcpld.c
+++ b/drivers/i2c/muxes/i2c-mux-mlxcpld.c
@@ -130,7 +130,7 @@  static int mlxcpld_mux_probe(struct platform_device *pdev)
 			/* discard unconfigured channels */
 			break;
 
-		force = pdata->adap_ids[num];
+		force = pdata->chan_ids[num];
 
 		err = i2c_mux_add_adapter(muxc, force, num, 0);
 		if (err)
diff --git a/include/linux/platform_data/mlxcpld.h b/include/linux/platform_data/mlxcpld.h
index e6c18bf017dd..04d93c563c04 100644
--- a/include/linux/platform_data/mlxcpld.h
+++ b/include/linux/platform_data/mlxcpld.h
@@ -11,12 +11,12 @@ 
 /* Platform data for the CPLD I2C multiplexers */
 
 /* 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
  * @sel_reg_addr - mux select register offset in CPLD space
  */
 struct mlxcpld_mux_plat_data {
-	int *adap_ids;
+	int *chan_ids;
 	int num_adaps;
 	int sel_reg_addr;
 };