From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
To: Corey Minyard <minyard@acm.org>
Cc: Jean Delvare <jdelvare@suse.com>,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
Corey Minyard <cminyard@mvista.com>
Subject: Re: [v2,04/10] i2c-i801: Consolidate calls to i801_check_pre()
Date: Thu, 9 Jun 2016 11:44:02 +0200 [thread overview]
Message-ID: <20160609094402.GF24234@mail.corp.redhat.com> (raw)
In-Reply-To: <1464570544-975-5-git-send-email-minyard@acm.org>
On May 29 2016 or thereabouts, Corey Minyard wrote:
> From: Corey Minyard <cminyard@mvista.com>
>
> It was always done before starting the transaction, so do it
> in common code before the transaction start.
>
> Signed-off-by: Corey Minyard <cminyard@mvista.com>
> ---
> drivers/i2c/busses/i2c-i801.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
> index 222be9c..8794e70 100644
> --- a/drivers/i2c/busses/i2c-i801.c
> +++ b/drivers/i2c/busses/i2c-i801.c
> @@ -402,10 +402,6 @@ static int i801_transaction(struct i801_priv *priv, int xact)
> int result;
> const struct i2c_adapter *adap = &priv->adapter;
>
> - result = i801_check_pre(priv);
> - if (result < 0)
> - return result;
> -
> if (priv->features & FEATURE_IRQ) {
> outb_p(xact | SMBHSTCNT_INTREN | SMBHSTCNT_START,
> SMBHSTCNT(priv));
> @@ -562,10 +558,6 @@ static int i801_block_transaction_byte_by_byte(struct i801_priv *priv,
> int result;
> const struct i2c_adapter *adap = &priv->adapter;
>
> - result = i801_check_pre(priv);
> - if (result < 0)
> - return result;
> -
> len = data->block[0];
>
> if (read_write == I2C_SMBUS_WRITE) {
> @@ -789,6 +781,10 @@ static s32 i801_access(struct i2c_adapter *adap, u16 addr,
> goto out;
> }
>
> + ret = i801_check_pre(priv);
> + if (ret < 0)
> + goto out;
> +
The calls looks identical (it gets called before each transaction), but
given that this is a status register, I wonder if this should not be
checked once the setup has been done, and not at the very early
beginning.
Cheers,
Benjamin
> if (block)
> ret = i801_block_transaction(priv, flags, data, read_write,
> size);
next prev parent reply other threads:[~2016-06-09 9:44 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-30 1:08 [PATCH v2 00/10] i2c-i801: Various cleanups minyard
2016-05-30 1:08 ` [PATCH v2 01/10] i2c-i801: Remove hwpec from block byte-by-byte function minyard
2016-06-09 9:36 ` [v2,01/10] " Benjamin Tissoires
2016-05-30 1:08 ` [PATCH v2 02/10] i2c-i801: Move hostcfg set/reset to i801_access() minyard
2016-06-09 9:39 ` [v2,02/10] " Benjamin Tissoires
2016-06-10 10:43 ` Corey Minyard
2016-05-30 1:08 ` [PATCH v2 03/10] i2c-i801: Move hwpec handling into block transaction minyard
2016-06-09 9:42 ` [v2,03/10] " Benjamin Tissoires
2016-05-30 1:08 ` [PATCH v2 04/10] i2c-i801: Consolidate calls to i801_check_pre() minyard
2016-06-09 9:44 ` Benjamin Tissoires [this message]
2016-06-10 10:52 ` [v2,04/10] " Corey Minyard
2016-05-30 1:08 ` [PATCH v2 05/10] i2c-i801: Consolidate calls to i801_check_post minyard
2016-06-09 10:03 ` [v2,05/10] " Benjamin Tissoires
2016-06-10 11:09 ` Corey Minyard
2016-05-30 1:09 ` [PATCH v2 06/10] i2c-i801: Pass around a boolean read/write variable minyard
2016-06-09 10:05 ` [v2,06/10] " Benjamin Tissoires
2016-05-30 1:09 ` [PATCH v2 07/10] i2c-i801: Fix some inconsistent variable names minyard
2016-06-09 14:01 ` [v2,07/10] " Benjamin Tissoires
2016-06-10 11:12 ` Corey Minyard
2016-05-30 1:09 ` [PATCH v2 08/10] i2c-i801: Handle a protocol error in byte-by-byte isr minyard
2016-06-09 14:07 ` [v2,08/10] " Benjamin Tissoires
2016-05-30 1:09 ` [PATCH v2 09/10] i2c-i801: Null isr data buffer when done with it minyard
2016-06-09 14:14 ` [v2,09/10] " Benjamin Tissoires
2016-05-30 1:09 ` [PATCH v2 10/10] i2c-i801: Only write the host control reg when necessary minyard
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=20160609094402.GF24234@mail.corp.redhat.com \
--to=benjamin.tissoires@redhat.com \
--cc=cminyard@mvista.com \
--cc=jdelvare@suse.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=minyard@acm.org \
/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).