All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vadim Pasternak <vadimp@nvidia.com>
To: peda@axentia.se, wsa@the-dreams.de
Cc: linux-i2c@vger.kernel.org, Vadim Pasternak <vadimp@nvidia.com>
Subject: [PATCH i2c-next v5 3/6] i2c: mux: mlxcpld: Get rid of adapter numbers enforcement
Date: Mon,  8 Feb 2021 22:16:03 +0200	[thread overview]
Message-ID: <20210208201606.10620-4-vadimp@nvidia.com> (raw)
In-Reply-To: <20210208201606.10620-1-vadimp@nvidia.com>

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>
---
v4->v5:
 Comments pointed out by Peter:
 - Move code for unconfigured channels validation from patch 5/6 to
   patch 3/6.
v3->v4:
 Comments pointed out by Peter:
 - Extend patch with the code from the next patches dealing with
   argument two and three of the i2c_mux_add_adapter() routine.
v2->v3:
 Changes added by Vadim:
 - Rename patch from "Rename mux ids array" to "Get rid of adapter
   numbers enforcement".
---
 drivers/i2c/muxes/i2c-mux-mlxcpld.c   | 7 ++-----
 include/linux/platform_data/mlxcpld.h | 4 ++--
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/i2c/muxes/i2c-mux-mlxcpld.c b/drivers/i2c/muxes/i2c-mux-mlxcpld.c
index 113ad84cdd94..e99a7ad09886 100644
--- a/drivers/i2c/muxes/i2c-mux-mlxcpld.c
+++ b/drivers/i2c/muxes/i2c-mux-mlxcpld.c
@@ -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 i2c_client *client = to_i2c_client(pdev->dev.parent);
 	struct i2c_mux_core *muxc;
-	int num, force;
 	struct mlxcpld_mux *data;
-	int err;
+	int num, err;
 
 	if (!pdata)
 		return -EINVAL;
@@ -130,9 +129,7 @@ static int mlxcpld_mux_probe(struct platform_device *pdev)
 			/* discard unconfigured channels */
 			break;
 
-		force = pdata->adap_ids[num];
-
-		err = i2c_mux_add_adapter(muxc, force, num, 0);
+		err = i2c_mux_add_adapter(muxc, 0, pdata->chan_ids[num], 0);
 		if (err)
 			goto virt_reg_failed;
 	}
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;
 };
-- 
2.11.0


  parent reply	other threads:[~2021-02-08 20:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-08 20:16 [PATCH i2c-next v5 0/6] mux: mlxcpld: Extend driver functionality Vadim Pasternak
2021-02-08 20:16 ` [PATCH i2c-next v5 1/6] i2c: mux: mlxcpld: Convert driver to platform driver Vadim Pasternak
2021-02-08 21:26   ` Peter Rosin
2021-02-08 20:16 ` [PATCH i2c-next v5 2/6] i2c: mux: mlxcpld: Prepare mux selection infrastructure for two-byte support Vadim Pasternak
2021-02-08 21:26   ` Peter Rosin
2021-02-08 20:16 ` Vadim Pasternak [this message]
2021-02-08 21:26   ` [PATCH i2c-next v5 3/6] i2c: mux: mlxcpld: Get rid of adapter numbers enforcement Peter Rosin
2021-02-08 20:16 ` [PATCH i2c-next v5 4/6] i2c: mux: mlxcpld: Extend driver to support word address space devices Vadim Pasternak
2021-02-08 21:27   ` Peter Rosin
2021-02-08 20:16 ` [PATCH i2c-next v5 5/6] i2c: mux: mlxcpld: Extend supported mux number Vadim Pasternak
2021-02-08 21:27   ` Peter Rosin
2021-02-08 20:16 ` [PATCH i2c-next v5 6/6] i2c: mux: mlxcpld: Add callback to notify mux creation completion Vadim Pasternak
2021-02-08 21:27   ` Peter Rosin
2021-02-08 21:26 ` [PATCH i2c-next v5 0/6] mux: mlxcpld: Extend driver functionality Peter Rosin
2021-02-08 22:01   ` Vadim Pasternak
2021-02-09 10:38   ` Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210208201606.10620-4-vadimp@nvidia.com \
    --to=vadimp@nvidia.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=peda@axentia.se \
    --cc=wsa@the-dreams.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.