All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Lengfeld <contact@stefanchrist.eu>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-i2c@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Peter Rosin <peda@axentia.se>,
	linux-omap@vger.kernel.org, linux-tegra@vger.kernel.org,
	Linus Walleij <linus.walleij@linaro.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Tero Kristo <t-kristo@ti.com>, Keerthy <j-keerthy@ti.com>,
	Simon Horman <horms+renesas@verge.net.au>
Subject: Re: [PATCH 06/12] i2c: omap: Add the master_xfer_irqless hook
Date: Tue, 16 Apr 2019 00:05:46 +0200	[thread overview]
Message-ID: <20190415220546.bvrp7jodgdq7phwg@porty> (raw)
In-Reply-To: <20190403124019.8947-7-wsa+renesas@sang-engineering.com>

Hi Wolfram,

the subject line of this patch

    i2c: omap: Add the master_xfer_irqless hook

still contains the old name of the callback '_irqless'. It should be
'_atomic' instead.


On Wed, Apr 03, 2019 at 02:40:13PM +0200, Wolfram Sang wrote:
> Add the master_xfer_irqless hook to enable i2c transactions

Here again. It should be 'master_xfer_atomic'.


> in irq disabled contexts like the poweroff case.
> 
> Signed-off-by: Tero Kristo <t-kristo@ti.com>
> Signed-off-by: Keerthy <j-keerthy@ti.com>
> [wsa: simplified code a little: 'timeout = !ret']
> Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  drivers/i2c/busses/i2c-omap.c | 76 +++++++++++++++++++++++++++++++++++--------
>  1 file changed, 63 insertions(+), 13 deletions(-)
> 

snipped 

> @@ -648,15 +650,28 @@ static void omap_i2c_resize_fifo(struct omap_i2c_dev *omap, u8 size, bool is_rx)
>  			(1000 * omap->speed / 8);
>  }
>  
> +static void omap_i2c_wait(struct omap_i2c_dev *omap)
> +{
> +	u16 stat;
> +	u16 mask = omap_i2c_read_reg(omap, OMAP_I2C_IE_REG);
> +	int count = 0;
> +
> +	do {
> +		stat = omap_i2c_read_reg(omap, OMAP_I2C_STAT_REG);
> +		count++;
> +	} while (!(stat & mask) && count < 5);
> +}
> +
>  /*
>   * Low level master read/write transaction.
>   */
>  static int omap_i2c_xfer_msg(struct i2c_adapter *adap,
> -			     struct i2c_msg *msg, int stop)
> +			     struct i2c_msg *msg, int stop, bool polling)

Nitpick. In the patches for the other drivers the boolean flag is called
'atomic' and not 'polling'.

>  {
>  	struct omap_i2c_dev *omap = i2c_get_adapdata(adap);
>  	unsigned long timeout;
>  	u16 w;
> +	int ret;
>  
>  	dev_dbg(omap->dev, "addr: 0x%04x, len: %d, flags: 0x%x, stop: %d\n",
>  		msg->addr, msg->len, msg->flags, stop);

sniped

> @@ -1165,14 +1204,25 @@ omap_i2c_isr_thread(int this_irq, void *dev_id)
>  		}
>  	} while (stat);
>  
> -	omap_i2c_complete_cmd(omap, err);
> +	return err;
> +}
> +
> +static irqreturn_t
> +omap_i2c_isr_thread(int this_irq, void *dev_id)
> +{
> +	int ret;
> +	struct omap_i2c_dev *omap = dev_id;
> +
> +	ret = omap_i2c_xfer_data(omap);
> +	if (ret != -EAGAIN)
> +		omap_i2c_complete_cmd(omap, ret);
>  
> -out:
>  	return IRQ_HANDLED;
>  }
>  
>  static const struct i2c_algorithm omap_i2c_algo = {
> -	.master_xfer	= omap_i2c_xfer,
> +	.master_xfer	= omap_i2c_xfer_irq,
> +	.master_xfer_atomic	= omap_i2c_xfer_polling,

When consistency with other drivers is a goal, the functions should be
named like:

    .master_xfe = omap_i2c_xfer,
    .master_xfer_atomic = omap_i2c_xfer_atomic,

The first without a suffix and the second with the '_atomic' suffix.

Kind regards,
Stefan

WARNING: multiple messages have this Message-ID (diff)
From: Stefan Lengfeld <contact@stefanchrist.eu>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: Tero Kristo <t-kristo@ti.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Keerthy <j-keerthy@ti.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	linux-i2c@vger.kernel.org, linux-tegra@vger.kernel.org,
	Simon Horman <horms+renesas@verge.net.au>,
	linux-omap@vger.kernel.org, Peter Rosin <peda@axentia.se>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 06/12] i2c: omap: Add the master_xfer_irqless hook
Date: Tue, 16 Apr 2019 00:05:46 +0200	[thread overview]
Message-ID: <20190415220546.bvrp7jodgdq7phwg@porty> (raw)
In-Reply-To: <20190403124019.8947-7-wsa+renesas@sang-engineering.com>

Hi Wolfram,

the subject line of this patch

    i2c: omap: Add the master_xfer_irqless hook

still contains the old name of the callback '_irqless'. It should be
'_atomic' instead.


On Wed, Apr 03, 2019 at 02:40:13PM +0200, Wolfram Sang wrote:
> Add the master_xfer_irqless hook to enable i2c transactions

Here again. It should be 'master_xfer_atomic'.


> in irq disabled contexts like the poweroff case.
> 
> Signed-off-by: Tero Kristo <t-kristo@ti.com>
> Signed-off-by: Keerthy <j-keerthy@ti.com>
> [wsa: simplified code a little: 'timeout = !ret']
> Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  drivers/i2c/busses/i2c-omap.c | 76 +++++++++++++++++++++++++++++++++++--------
>  1 file changed, 63 insertions(+), 13 deletions(-)
> 

snipped 

> @@ -648,15 +650,28 @@ static void omap_i2c_resize_fifo(struct omap_i2c_dev *omap, u8 size, bool is_rx)
>  			(1000 * omap->speed / 8);
>  }
>  
> +static void omap_i2c_wait(struct omap_i2c_dev *omap)
> +{
> +	u16 stat;
> +	u16 mask = omap_i2c_read_reg(omap, OMAP_I2C_IE_REG);
> +	int count = 0;
> +
> +	do {
> +		stat = omap_i2c_read_reg(omap, OMAP_I2C_STAT_REG);
> +		count++;
> +	} while (!(stat & mask) && count < 5);
> +}
> +
>  /*
>   * Low level master read/write transaction.
>   */
>  static int omap_i2c_xfer_msg(struct i2c_adapter *adap,
> -			     struct i2c_msg *msg, int stop)
> +			     struct i2c_msg *msg, int stop, bool polling)

Nitpick. In the patches for the other drivers the boolean flag is called
'atomic' and not 'polling'.

>  {
>  	struct omap_i2c_dev *omap = i2c_get_adapdata(adap);
>  	unsigned long timeout;
>  	u16 w;
> +	int ret;
>  
>  	dev_dbg(omap->dev, "addr: 0x%04x, len: %d, flags: 0x%x, stop: %d\n",
>  		msg->addr, msg->len, msg->flags, stop);

sniped

> @@ -1165,14 +1204,25 @@ omap_i2c_isr_thread(int this_irq, void *dev_id)
>  		}
>  	} while (stat);
>  
> -	omap_i2c_complete_cmd(omap, err);
> +	return err;
> +}
> +
> +static irqreturn_t
> +omap_i2c_isr_thread(int this_irq, void *dev_id)
> +{
> +	int ret;
> +	struct omap_i2c_dev *omap = dev_id;
> +
> +	ret = omap_i2c_xfer_data(omap);
> +	if (ret != -EAGAIN)
> +		omap_i2c_complete_cmd(omap, ret);
>  
> -out:
>  	return IRQ_HANDLED;
>  }
>  
>  static const struct i2c_algorithm omap_i2c_algo = {
> -	.master_xfer	= omap_i2c_xfer,
> +	.master_xfer	= omap_i2c_xfer_irq,
> +	.master_xfer_atomic	= omap_i2c_xfer_polling,

When consistency with other drivers is a goal, the functions should be
named like:

    .master_xfe = omap_i2c_xfer,
    .master_xfer_atomic = omap_i2c_xfer_atomic,

The first without a suffix and the second with the '_atomic' suffix.

Kind regards,
Stefan

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-04-15 22:05 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-03 12:40 [PATCH 00/12] i2c: core: introduce atomic transfers Wolfram Sang
2019-04-03 12:40 ` Wolfram Sang
2019-04-03 12:40 ` [PATCH 01/12] i2c: remove use of in_atomic() Wolfram Sang
2019-04-03 12:40   ` Wolfram Sang
2019-04-15 12:40   ` Andy Shevchenko
2019-04-15 12:40     ` Andy Shevchenko
2019-04-15 21:55   ` Stefan Lengfeld
2019-04-15 21:55     ` Stefan Lengfeld
2019-04-15 21:55     ` Stefan Lengfeld
2019-04-16 10:48     ` Wolfram Sang
2019-04-16 10:48       ` Wolfram Sang
2019-04-03 12:40 ` [PATCH 02/12] i2c: core: use I2C locking behaviour also for SMBUS Wolfram Sang
2019-04-03 12:40   ` Wolfram Sang
2019-04-03 12:40   ` Wolfram Sang
2019-04-15 12:39   ` Andy Shevchenko
2019-04-15 12:39     ` Andy Shevchenko
2019-04-15 12:39     ` Andy Shevchenko
2019-04-03 12:40 ` [PATCH 03/12] i2c: core: introduce callbacks for atomic transfers Wolfram Sang
2019-04-03 12:40   ` Wolfram Sang
2019-04-03 12:40   ` Wolfram Sang
2019-04-15 12:39   ` Andy Shevchenko
2019-04-15 12:39     ` Andy Shevchenko
2019-04-15 21:57   ` Stefan Lengfeld
2019-04-15 21:57     ` Stefan Lengfeld
2019-04-03 12:40 ` [PATCH 04/12] i2c: mux: populate the new *_atomic callbacks Wolfram Sang
2019-04-03 12:40   ` Wolfram Sang
2019-04-03 12:40   ` Wolfram Sang
2019-04-03 15:17   ` Peter Rosin
2019-04-03 15:17     ` Peter Rosin
2019-04-03 15:17     ` Peter Rosin
2019-04-15 12:04     ` Wolfram Sang
2019-04-15 12:04       ` Wolfram Sang
2019-04-15 12:04       ` Wolfram Sang
2019-04-15 12:44   ` Andy Shevchenko
2019-04-15 12:44     ` Andy Shevchenko
2019-04-03 12:40 ` [PATCH 05/12] i2c: demux: handle the new atomic callbacks Wolfram Sang
2019-04-03 12:40   ` Wolfram Sang
2019-04-15 12:37   ` Andy Shevchenko
2019-04-15 12:37     ` Andy Shevchenko
2019-04-03 12:40 ` [PATCH 06/12] i2c: omap: Add the master_xfer_irqless hook Wolfram Sang
2019-04-03 12:40   ` Wolfram Sang
2019-04-15 22:05   ` Stefan Lengfeld [this message]
2019-04-15 22:05     ` Stefan Lengfeld
2019-04-16 10:52     ` Wolfram Sang
2019-04-16 10:52       ` Wolfram Sang
2019-04-03 12:40 ` [PATCH 07/12] i2c: tegra-bpmp: convert to use new atomic callbacks Wolfram Sang
2019-04-03 12:40   ` Wolfram Sang
2019-04-03 12:40 ` [PATCH 08/12] i2c: ocores: refactor setup for polling Wolfram Sang
2019-04-03 12:40   ` Wolfram Sang
2019-04-05 15:09   ` Peter Korsgaard
2019-04-05 15:09     ` Peter Korsgaard
2019-04-05 19:00   ` Andrew Lunn
2019-04-05 19:00     ` Andrew Lunn
2019-04-03 12:40 ` [PATCH 09/12] i2c: ocores: enable atomic xfers Wolfram Sang
2019-04-03 12:40   ` Wolfram Sang
2019-04-05 19:20   ` Andrew Lunn
2019-04-05 19:20     ` Andrew Lunn
2019-04-03 12:40 ` [PATCH 10/12] i2c: stu300: use xfer_atomic callback to bail out early Wolfram Sang
2019-04-03 12:40   ` Wolfram Sang
2019-04-04 15:38   ` Linus Walleij
2019-04-04 15:38     ` Linus Walleij
2019-04-03 12:40 ` [PATCH 11/12] i2c: algo: bit: add flag to whitelist atomic transfers Wolfram Sang
2019-04-03 12:40   ` Wolfram Sang
2019-04-03 12:40 ` [PATCH 12/12] i2c: gpio: flag atomic capability if possible Wolfram Sang
2019-04-03 12:40   ` Wolfram Sang
2019-04-04 15:40   ` Linus Walleij
2019-04-04 15:40     ` Linus Walleij
2019-04-15 12:38   ` Andy Shevchenko
2019-04-15 12:38     ` Andy Shevchenko
2019-04-03 13:15 ` [PATCH 00/12] i2c: core: introduce atomic transfers Andy Shevchenko
2019-04-03 13:15   ` Andy Shevchenko
2019-04-15 12:06   ` Wolfram Sang
2019-04-15 12:06     ` Wolfram Sang
2019-04-15 12:35     ` Andy Shevchenko
2019-04-15 12:35       ` Andy Shevchenko
2019-04-15 12:48       ` Andy Shevchenko
2019-04-15 12:48         ` Andy Shevchenko
2019-04-15 12:50         ` Wolfram Sang
2019-04-15 12:50           ` Wolfram Sang
2019-04-15 12:10 ` Wolfram Sang
2019-04-15 12:10   ` 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=20190415220546.bvrp7jodgdq7phwg@porty \
    --to=contact@stefanchrist.eu \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=horms+renesas@verge.net.au \
    --cc=j-keerthy@ti.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=peda@axentia.se \
    --cc=t-kristo@ti.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 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.