From: Maksim Ratnikov <m.o.ratnikov@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Extend support of SMBUS(module pm_smbus.c) HST_STS register.
Date: Tue, 30 Apr 2013 02:39:22 +0400 [thread overview]
Message-ID: <517EF69A.8000709@gmail.com> (raw)
In-Reply-To: <CAFEAcA-kSx_AqqX2ZxMakcv+wPyTz=Si64kF95Jj+JH6GLCScg@mail.gmail.com>
29.04.2013 00:03, Peter Maydell пишет:
> On 28 April 2013 19:26, Maksim Ratnikov <m.o.ratnikov@gmail.com> wrote:
>> Previous realization doesn't consider flags in the status register.
>> Add DS and INTR bits of HST_STS register set after transaction execution.
>> Update bits resetting in HST_STS register. Update error processing: if
>> DEV_ERR bit are set
>> transaction isn't execution.
> Hi; thanks for this patch. A minor comment below...
>
>> Signed-off-by: Maksim_Ratnikov <m.o.ratnikov@gmail.com>
>> ---
>> hw/i2c/pm_smbus.c | 13 ++++++++++++-
>> 1 files changed, 12 insertions(+), 1 deletions(-)
>>
>> diff --git a/hw/i2c/pm_smbus.c b/hw/i2c/pm_smbus.c
>> index 0b5bb89..d5f5c56 100644
>> --- a/hw/i2c/pm_smbus.c
>> +++ b/hw/i2c/pm_smbus.c
>> @@ -50,9 +50,16 @@ static void smb_transaction(PMSMBus *s)
>> i2c_bus *bus = s->smbus;
>>
>> SMBUS_DPRINTF("SMBus trans addr=0x%02x prot=0x%02x\n", addr, prot);
>> + /* Transaction isn't exec if DEV_ERR bit set */
>> + if ((s->smb_stat & 0x04) != 0)
>> + goto error;
> QEMU coding style requires braces on this if(). (You can run
> your patch through scripts/codingstyle.pl to check for this
> kind of thing.)
>
>> switch(prot) {
>> case 0x0:
>> smbus_quick_command(bus, addr, read);
>> + /* Set successfully transaction end:
>> + * ByteDoneStatus = 1 (HST_STS bit #7) and INTR = 1 (HST_STS bit
>> #1)
>> + */
>> + s->smb_stat |= 0x82;
> I think it would be nicer to define some constants for the
> HST_STS bits. Then you could write
> s->smb_stat |= STS_BYTE_DONE | STS_INTR;
>
> and you wouldn't need to have the comment here explaining
> the magic numbers. (feel free to pick better constant names,
> ideally ones matching whatever the datasheet uses.)
> (then you can use the constants for all the smb_stat uses).
>
> thanks
> -- PMM
Thank you for your answer. I made some correction and sent new version
of patch. I can't find script codingstyle.pl, but I use checkpatch.pl .
It shows 0 error and 0 warning.
next prev parent reply other threads:[~2013-04-29 22:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-28 18:26 [Qemu-devel] [PATCH] Extend support of SMBUS(module pm_smbus.c) HST_STS register Maksim Ratnikov
2013-04-28 20:03 ` Peter Maydell
2013-04-29 22:29 ` Maksim Ratnikov
2013-04-29 22:39 ` Maksim Ratnikov [this message]
[not found] <51CC3B2C.9070406@gmail.com>
2013-06-27 16:33 ` Peter Maydell
2013-06-27 21:07 ` Maksim Ratnikov
2013-06-27 21:48 ` Anthony Liguori
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=517EF69A.8000709@gmail.com \
--to=m.o.ratnikov@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.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).