From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58350) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUjmN-0000MN-NG for qemu-devel@nongnu.org; Mon, 31 Mar 2014 17:30:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WUjmC-0004cB-PS for qemu-devel@nongnu.org; Mon, 31 Mar 2014 17:30:03 -0400 Received: from cantor2.suse.de ([195.135.220.15]:49661 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUjmC-0004bq-Jo for qemu-devel@nongnu.org; Mon, 31 Mar 2014 17:29:52 -0400 Message-ID: <5339DE4E.3010900@suse.de> Date: Mon, 31 Mar 2014 23:29:50 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1396283195-6819-1-git-send-email-pbonzini@redhat.com> <1396283195-6819-3-git-send-email-pbonzini@redhat.com> In-Reply-To: <1396283195-6819-3-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH for-2.0 2/7] smbus: return -1 if nothing found at the given address List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Am 31.03.2014 18:26, schrieb Paolo Bonzini: > Signed-off-by: Paolo Bonzini > --- > hw/i2c/smbus.c | 62 +++++++++++++++++++++++++++++++++++-------= -------- > include/hw/i2c/smbus.h | 12 +++++----- > 2 files changed, 50 insertions(+), 24 deletions(-) >=20 > diff --git a/hw/i2c/smbus.c b/hw/i2c/smbus.c > index 190f08e..6e27ae8 100644 > --- a/hw/i2c/smbus.c > +++ b/hw/i2c/smbus.c > @@ -208,34 +208,44 @@ static int smbus_device_init(I2CSlave *i2c) > } > =20 > /* Master device commands. */ > -void smbus_quick_command(I2CBus *bus, uint8_t addr, int read) > +int smbus_quick_command(I2CBus *bus, uint8_t addr, int read) > { > - i2c_start_transfer(bus, addr, read); > + if (i2c_start_transfer(bus, addr, read)) { For anyone else who wondered about this condition: i2c_start_transfer() returns 1 if slave device is not found and 0 on success, so no normal return codes interfering here. > + return -1; > + } > i2c_end_transfer(bus); > + return 0; > } [snip] Reviewed-by: Andreas F=E4rber Might have mentioned also doing some adjacent Coding Style cleanups. Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg