From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:42943) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWwjN-0004TW-6W for qemu-devel@nongnu.org; Mon, 29 Apr 2013 18:39:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UWwjG-0001Su-UL for qemu-devel@nongnu.org; Mon, 29 Apr 2013 18:39:33 -0400 Received: from mail-lb0-f178.google.com ([209.85.217.178]:42856) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWwjG-0001Sh-MM for qemu-devel@nongnu.org; Mon, 29 Apr 2013 18:39:26 -0400 Received: by mail-lb0-f178.google.com with SMTP id w10so6165258lbi.37 for ; Mon, 29 Apr 2013 15:39:25 -0700 (PDT) Message-ID: <517EF69A.8000709@gmail.com> Date: Tue, 30 Apr 2013 02:39:22 +0400 From: Maksim Ratnikov MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] Extend support of SMBUS(module pm_smbus.c) HST_STS register. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-devel@nongnu.org 29.04.2013 00:03, Peter Maydell пишет: > On 28 April 2013 19:26, Maksim Ratnikov 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 >> --- >> 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.