All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa@kernel.org>
To: "linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Pierre Yves MORDRET <pierre-yves.mordret@st.com>,
	Alexandre TORGUE <alexandre.torgue@st.com>,
	"linux-stm32@st-md-mailman.stormreply.com" 
	<linux-stm32@st-md-mailman.stormreply.com>,
	Fabrice GASNIER <fabrice.gasnier@st.com>
Subject: Re: [PATCH v2 1/2] i2c: smbus: add core function handling SMBus host-notify
Date: Sun, 2 Aug 2020 21:15:23 +0200	[thread overview]
Message-ID: <20200802191523.GA13339@kunai> (raw)
In-Reply-To: <20200728121050.GC8715@gnbcxd0016.gnb.st.com>

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

> I've simplified the index handling as you suggested. The only impact is that
> finally we do not consider anymore the I2C_SLAVE_WRITE_REQUESTED event as the
> beginning of the transaction since we don't perform the "reset" of the
> handling upon this event.

One more comment on this one because I had to update the testunit, too.
To be robust against multiple write messages in one transfer, we need to
reset both, after STOP and when I2C_SLAVE_WRITE_REQUESTED. See here:

 96         case I2C_SLAVE_STOP:
 97                 if (tu->reg_idx == TU_NUM_REGS)
 98                         queue_delayed_work(system_long_wq, &tu->worker,
 99                                            msecs_to_jiffies(100 * tu->regs[TU_REG_DELAY]));
100                 fallthrough;
101 
102         case I2C_SLAVE_WRITE_REQUESTED:
103                 tu->reg_idx = 0;
104                 break;

As you see, I used 'fallthrough' to avoid code duplication and that only
one reset part will be updated.

Dunno if you really need it, too, as I haven't seen your latest code yet.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Wolfram Sang <wsa@kernel.org>
To: "linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	 "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Fabrice GASNIER <fabrice.gasnier@st.com>,
	Alexandre TORGUE <alexandre.torgue@st.com>,
	Pierre Yves MORDRET <pierre-yves.mordret@st.com>,
	"linux-stm32@st-md-mailman.stormreply.com"
	<linux-stm32@st-md-mailman.stormreply.com>
Subject: Re: [PATCH v2 1/2] i2c: smbus: add core function handling SMBus host-notify
Date: Sun, 2 Aug 2020 21:15:23 +0200	[thread overview]
Message-ID: <20200802191523.GA13339@kunai> (raw)
In-Reply-To: <20200728121050.GC8715@gnbcxd0016.gnb.st.com>


[-- Attachment #1.1: Type: text/plain, Size: 1085 bytes --]

> I've simplified the index handling as you suggested. The only impact is that
> finally we do not consider anymore the I2C_SLAVE_WRITE_REQUESTED event as the
> beginning of the transaction since we don't perform the "reset" of the
> handling upon this event.

One more comment on this one because I had to update the testunit, too.
To be robust against multiple write messages in one transfer, we need to
reset both, after STOP and when I2C_SLAVE_WRITE_REQUESTED. See here:

 96         case I2C_SLAVE_STOP:
 97                 if (tu->reg_idx == TU_NUM_REGS)
 98                         queue_delayed_work(system_long_wq, &tu->worker,
 99                                            msecs_to_jiffies(100 * tu->regs[TU_REG_DELAY]));
100                 fallthrough;
101 
102         case I2C_SLAVE_WRITE_REQUESTED:
103                 tu->reg_idx = 0;
104                 break;

As you see, I used 'fallthrough' to avoid code duplication and that only
one reset part will be updated.

Dunno if you really need it, too, as I haven't seen your latest code yet.


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

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

  parent reply	other threads:[~2020-08-02 19:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-03 11:36 [PATCH v2 0/2] i2c: stm32: add host-notify support via i2c slave Alain Volmat
2020-07-03 11:36 ` Alain Volmat
2020-07-03 11:36 ` [PATCH v2 1/2] i2c: smbus: add core function handling SMBus host-notify Alain Volmat
2020-07-03 11:36   ` Alain Volmat
2020-07-25 20:27   ` Wolfram Sang
2020-07-25 20:27     ` Wolfram Sang
2020-07-26 13:35     ` Wolfram Sang
2020-07-26 13:35       ` Wolfram Sang
2020-07-28 12:10     ` Alain Volmat
2020-07-28 12:10       ` Alain Volmat
2020-07-28 16:36       ` Wolfram Sang
2020-07-28 16:36         ` Wolfram Sang
2020-08-02 19:15       ` Wolfram Sang [this message]
2020-08-02 19:15         ` Wolfram Sang
2020-07-03 11:36 ` [PATCH v2 2/2] i2c: stm32f7: Add SMBus Host-Notify protocol support Alain Volmat
2020-07-03 11:36   ` Alain Volmat

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=20200802191523.GA13339@kunai \
    --to=wsa@kernel.org \
    --cc=alexandre.torgue@st.com \
    --cc=fabrice.gasnier@st.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=pierre-yves.mordret@st.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.