public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Romain Gantois <romain.gantois@bootlin.com>
To: Cosmin Tanislav <demonsingur@gmail.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
	Luca Ceresoli <luca.ceresoli@bootlin.com>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-media@vger.kernel.org,
	Cosmin Tanislav <demonsingur@gmail.com>
Subject: Re: [PATCH v4 7/9] i2c: atr: add flags parameter to i2c_atr_new()
Date: Mon, 05 May 2025 17:50:14 +0200	[thread overview]
Message-ID: <6198924.lOV4Wx5bFT@fw-rgant> (raw)
In-Reply-To: <20250428102516.933571-8-demonsingur@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4326 bytes --]

On Monday, 28 April 2025 12:25:12 CEST Cosmin Tanislav wrote:
> In preparation for adding multiple flags that change the behavior,
> add a flags parameter to i2c_atr_new() and an i2c_atr_flags enum.
> 
> Signed-off-by: Cosmin Tanislav <demonsingur@gmail.com>
> ---
>  drivers/i2c/i2c-atr.c         |  6 +++++-
>  drivers/media/i2c/ds90ub960.c |  2 +-
>  drivers/misc/ti_fpc202.c      |  2 +-
>  include/linux/i2c-atr.h       | 10 +++++++++-
>  4 files changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/i2c/i2c-atr.c b/drivers/i2c/i2c-atr.c
> index 7214a59ddf15..e2350fcf3d68 100644
> --- a/drivers/i2c/i2c-atr.c
> +++ b/drivers/i2c/i2c-atr.c
> @@ -106,6 +106,7 @@ struct i2c_atr_chan {
>   * @lock:      Lock for the I2C bus segment (see &struct
> i2c_lock_operations) * @lock_key:  Lock key for @lock
>   * @max_adapters: Maximum number of adapters this I2C ATR can have
> + * @flags:     Flags for ATR
>   * @alias_pool: Optional common pool of available client aliases
>   * @i2c_nb:    Notifier for remote client add & del events
>   * @adapter:   Array of adapters
> @@ -122,6 +123,7 @@ struct i2c_atr {
>  	struct mutex lock;
>  	struct lock_class_key lock_key;
>  	int max_adapters;
> +	u32 flags;
> 
>  	struct i2c_atr_alias_pool *alias_pool;
> 
> @@ -703,7 +705,8 @@ static int i2c_atr_parse_alias_pool(struct i2c_atr *atr)
> }
> 
>  struct i2c_atr *i2c_atr_new(struct i2c_adapter *parent, struct device *dev,
> -			    const struct i2c_atr_ops *ops, int max_adapters)
> +			    const struct i2c_atr_ops *ops, int max_adapters,
> +			    u32 flags)
>  {
>  	struct i2c_atr *atr;
>  	int ret;
> @@ -725,6 +728,7 @@ struct i2c_atr *i2c_atr_new(struct i2c_adapter *parent,
> struct device *dev, atr->dev = dev;
>  	atr->ops = ops;
>  	atr->max_adapters = max_adapters;
> +	atr->flags = flags;
> 
>  	if (parent->algo->master_xfer)
>  		atr->algo.master_xfer = i2c_atr_master_xfer;
> diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c
> index 869e32bd07e8..6f475bae94b3 100644
> --- a/drivers/media/i2c/ds90ub960.c
> +++ b/drivers/media/i2c/ds90ub960.c
> @@ -1122,7 +1122,7 @@ static int ub960_init_atr(struct ub960_data *priv)
>  	struct i2c_adapter *parent_adap = priv->client->adapter;
> 
>  	priv->atr = i2c_atr_new(parent_adap, dev, &ub960_atr_ops,
> -				priv->hw_data->num_rxports);
> +				priv->hw_data->num_rxports, 0);
>  	if (IS_ERR(priv->atr))
>  		return PTR_ERR(priv->atr);
> 
> diff --git a/drivers/misc/ti_fpc202.c b/drivers/misc/ti_fpc202.c
> index b9c9ee4bfc4e..f7cde245ac95 100644
> --- a/drivers/misc/ti_fpc202.c
> +++ b/drivers/misc/ti_fpc202.c
> @@ -349,7 +349,7 @@ static int fpc202_probe(struct i2c_client *client)
>  		goto disable_gpio;
>  	}
> 
> -	priv->atr = i2c_atr_new(client->adapter, dev, &fpc202_atr_ops, 2);
> +	priv->atr = i2c_atr_new(client->adapter, dev, &fpc202_atr_ops, 2, 0);
>  	if (IS_ERR(priv->atr)) {
>  		ret = PTR_ERR(priv->atr);
>  		dev_err(dev, "failed to create i2c atr err %d\n", ret);
> diff --git a/include/linux/i2c-atr.h b/include/linux/i2c-atr.h
> index 1c3a5bcd939f..5082f4dd0e23 100644
> --- a/include/linux/i2c-atr.h
> +++ b/include/linux/i2c-atr.h
> @@ -18,6 +18,12 @@ struct device;
>  struct fwnode_handle;
>  struct i2c_atr;
> 
> +/**
> + * enum i2c_atr_flags - Flags for an I2C ATR driver
> + */
> +enum i2c_atr_flags {
> +};
> +
>  /**
>   * struct i2c_atr_ops - Callbacks from ATR to the device driver.
>   * @attach_addr: Notify the driver of a new device connected on a child
> @@ -65,6 +71,7 @@ struct i2c_atr_adap_desc {
>   * @dev:          The device acting as an ATR
>   * @ops:          Driver-specific callbacks
>   * @max_adapters: Maximum number of child adapters
> + * @flags:        Flags for ATR
>   *
>   * The new ATR helper is connected to the parent adapter but has no child
>   * adapters. Call i2c_atr_add_adapter() to add some.
> @@ -74,7 +81,8 @@ struct i2c_atr_adap_desc {
>   * Return: pointer to the new ATR helper object, or ERR_PTR
>   */
>  struct i2c_atr *i2c_atr_new(struct i2c_adapter *parent, struct device *dev,
> -			    const struct i2c_atr_ops *ops, int max_adapters);
> +			    const struct i2c_atr_ops *ops, int max_adapters,
> +			    u32 flags);
> 
>  /**
>   * i2c_atr_delete - Delete an I2C ATR helper.

Thanks!

Reviewed-by: Romain Gantois <romain.gantois@bootlin.com>

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2025-05-05 15:50 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-28 10:25 [PATCH v4 0/9] i2c: atr: allow usage of nested ATRs Cosmin Tanislav
2025-04-28 10:25 ` [PATCH v4 1/9] i2c: atr: Fix lockdep for " Cosmin Tanislav
2025-04-30 14:31   ` Luca Ceresoli
2025-04-28 10:25 ` [PATCH v4 2/9] i2c: atr: find_mapping() -> get_mapping() Cosmin Tanislav
2025-04-30 14:32   ` Luca Ceresoli
2025-04-28 10:25 ` [PATCH v4 3/9] i2c: atr: split up i2c_atr_get_mapping_by_addr() Cosmin Tanislav
2025-04-30 14:33   ` Luca Ceresoli
2025-05-05 10:26     ` Cosmin Tanislav
2025-05-05 11:22       ` Luca Ceresoli
2025-04-28 10:25 ` [PATCH v4 4/9] i2c: atr: do not create mapping in detach_addr() Cosmin Tanislav
2025-04-30 14:33   ` Luca Ceresoli
2025-04-28 10:25 ` [PATCH v4 5/9] i2c: atr: deduplicate logic in attach_addr() Cosmin Tanislav
2025-04-30 14:33   ` Luca Ceresoli
2025-05-05 15:40   ` Romain Gantois
2025-04-28 10:25 ` [PATCH v4 6/9] i2c: atr: allow replacing mappings " Cosmin Tanislav
2025-04-30 14:33   ` Luca Ceresoli
2025-05-05 10:33     ` Cosmin Tanislav
2025-05-05 11:32       ` Luca Ceresoli
2025-04-28 10:25 ` [PATCH v4 7/9] i2c: atr: add flags parameter to i2c_atr_new() Cosmin Tanislav
2025-04-30 14:34   ` Luca Ceresoli
2025-05-05 15:50   ` Romain Gantois [this message]
2025-04-28 10:25 ` [PATCH v4 8/9] i2c: atr: add static flag Cosmin Tanislav
2025-04-30 14:36   ` Luca Ceresoli
2025-05-05 15:58   ` Romain Gantois
2025-04-28 10:25 ` [PATCH v4 9/9] i2c: atr: add passthrough flag Cosmin Tanislav
2025-04-30 14:36   ` Luca Ceresoli
2025-05-05 16:13   ` Romain Gantois

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=6198924.lOV4Wx5bFT@fw-rgant \
    --to=romain.gantois@bootlin.com \
    --cc=arnd@arndb.de \
    --cc=demonsingur@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=luca.ceresoli@bootlin.com \
    --cc=mchehab@kernel.org \
    --cc=tomi.valkeinen@ideasonboard.com \
    --cc=wsa+renesas@sang-engineering.com \
    /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