public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <jdelvare-l3A5Bk7waGM@public.gmane.org>
To: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
Cc: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>,
	Randy Dunlap <rdunlap-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [RFC PATCH] i2c: stub: Add support for SMBus block commands
Date: Mon, 7 Jul 2014 16:04:40 +0200	[thread overview]
Message-ID: <20140707160440.042fda11@endymion.delvare> (raw)
In-Reply-To: <53BAA152.9040002-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>

On Mon, 07 Jul 2014 06:32:02 -0700, Guenter Roeck wrote:
> On 07/07/2014 01:27 AM, Jean Delvare wrote:
> > On Sun,  6 Jul 2014 20:55:12 -0700, Guenter Roeck wrote:
> >>   			chip->words[command] &= 0xff00;
> >>   			chip->words[command] |= data->byte;
> >>   			dev_dbg(&adap->dev,
> >>   				"smbus byte data - addr 0x%02x, wrote 0x%02x at 0x%02x.\n",
> >>   				addr, data->byte, command);
> >>   		} else {
> >> -			data->byte = chip->words[command] & 0xff;
> >> +			if (b)
> >> +				data->byte = b->len;
> >> +			else
> >> +				data->byte = chip->words[command] & 0xff;
> >
> > You could avoid this conditional (and the same below in case
> > I2C_SMBUS_WORD_DATA) by writing to chip->words at the same time you
> > write to b->block. Block transfers being rare and reads occurring more
> > frequently than writes, I think the performance benefit is clear.
>
> Makes sense, I'll do that. Great idea.
> 
> Question is if I should cover attempts to write a byte or word into block data.
> I don't think it is worth the effort, as drivers won't usually do that.
> My take is that we could add it later if really needed.
> What do you think ?

I agree. The i2c-stub driver can't possibly cover every use case
anyway, so let's keep it simple and only emulate behaviors we need for
real.

-- 
Jean Delvare
SUSE L3 Support

      parent reply	other threads:[~2014-07-07 14:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-07  3:55 [RFC PATCH] i2c: stub: Add support for SMBus block commands Guenter Roeck
2014-07-07  8:27 ` Jean Delvare
     [not found]   ` <20140707102711.1b630fe2-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2014-07-07 13:32     ` Guenter Roeck
     [not found]       ` <53BAA152.9040002-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2014-07-07 14:04         ` Jean Delvare [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=20140707160440.042fda11@endymion.delvare \
    --to=jdelvare-l3a5bk7wagm@public.gmane.org \
    --cc=linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org \
    --cc=linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=rdunlap-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.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