linux-i2c.vger.kernel.org archive mirror
 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 v3 6/6] i2c: mux: mlxcpld: Add callback to notify mux creation completion
Date: Sat, 30 Jan 2021 19:34:47 +0200	[thread overview]
Message-ID: <20210130173447.26328-7-vadimp@nvidia.com> (raw)
In-Reply-To: <20210130173447.26328-1-vadimp@nvidia.com>

Add notification to inform caller that mux objects array has been
created. It allows to user, invoked platform device registration for
"i2c-mux-mlxcpld" driver, to be notified that mux infrastructure is
available, and thus some devices could be connected to this
infrastructure.

Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
---
 drivers/i2c/muxes/i2c-mux-mlxcpld.c   | 4 ++++
 include/linux/platform_data/mlxcpld.h | 5 +++++
 2 files changed, 9 insertions(+)

diff --git a/drivers/i2c/muxes/i2c-mux-mlxcpld.c b/drivers/i2c/muxes/i2c-mux-mlxcpld.c
index 5e0672f9979b..1a879f6a31ef 100644
--- a/drivers/i2c/muxes/i2c-mux-mlxcpld.c
+++ b/drivers/i2c/muxes/i2c-mux-mlxcpld.c
@@ -159,6 +159,10 @@ static int mlxcpld_mux_probe(struct platform_device *pdev)
 			goto virt_reg_failed;
 	}
 
+	/* Notify caller when all channels' adapters are created. */
+	if (pdata->completion_notify)
+		pdata->completion_notify(pdata->handle, muxc->parent, muxc->adapter);
+
 	return 0;
 
 virt_reg_failed:
diff --git a/include/linux/platform_data/mlxcpld.h b/include/linux/platform_data/mlxcpld.h
index a7bee798d991..d7610b528856 100644
--- a/include/linux/platform_data/mlxcpld.h
+++ b/include/linux/platform_data/mlxcpld.h
@@ -15,12 +15,17 @@
  * @num_adaps - number of adapters
  * @sel_reg_addr - mux select register offset in CPLD space
  * @reg_size: register size in bytes
+ * @handle: handle to be passed by callback
+ * @completion_notify: callback to notify when all the adapters are created
  */
 struct mlxcpld_mux_plat_data {
 	int *chan_ids;
 	int num_adaps;
 	int sel_reg_addr;
 	u8 reg_size;
+	void *handle;
+	int (*completion_notify)(void *handle, struct i2c_adapter *parent,
+				 struct i2c_adapter *adapters[]);
 };
 
 #endif /* _LINUX_I2C_MLXCPLD_H */
-- 
2.11.0


      parent reply	other threads:[~2021-01-30 17:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-30 17:34 [PATCH i2c-next v3 0/6] i2c: mux: mlxcpld: Extend driver functionality Vadim Pasternak
2021-01-30 17:34 ` [PATCH i2c-next v3 1/6] i2c: mux: mlxcpld: Convert driver to platform driver Vadim Pasternak
2021-01-30 17:34 ` [PATCH i2c-next v3 2/6] i2c: mux: mlxcpld: Prepare mux selection infrastructure for two-byte support Vadim Pasternak
2021-01-30 17:34 ` [PATCH i2c-next v3 3/6] i2c: mux: mlxcpld: Rename mux ids array Vadim Pasternak
2021-02-01  9:09   ` Peter Rosin
2021-01-30 17:34 ` [PATCH i2c-next v3 4/6] i2c: mux: mlxcpld: Extend driver to support word address space devices Vadim Pasternak
2021-02-01  9:09   ` Peter Rosin
2021-01-30 17:34 ` [PATCH i2c-next v3 5/6] i2c: mux: mlxcpld: Extend supported mux number Vadim Pasternak
2021-01-30 17:34 ` Vadim Pasternak [this message]

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=20210130173447.26328-7-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).