From patchwork Fri Dec 30 15:21:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 9492259 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0B92262ABB for ; Fri, 30 Dec 2016 15:22:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1BE8203C0 for ; Fri, 30 Dec 2016 15:22:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E6B56223B2; Fri, 30 Dec 2016 15:22:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1E08120564 for ; Fri, 30 Dec 2016 15:22:42 +0000 (UTC) Received: from localhost ([::1]:40302 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cMz0z-0002ID-3Y for patchwork-qemu-devel@patchwork.kernel.org; Fri, 30 Dec 2016 10:22:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43249) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cMz0O-0002Gn-SR for qemu-devel@nongnu.org; Fri, 30 Dec 2016 10:22:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cMz0L-0000Ct-Ri for qemu-devel@nongnu.org; Fri, 30 Dec 2016 10:22:04 -0500 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]:35905) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cMz0L-0000CQ-MA for qemu-devel@nongnu.org; Fri, 30 Dec 2016 10:22:01 -0500 Received: by mail-pg0-x242.google.com with SMTP id n5so22380567pgh.3 for ; Fri, 30 Dec 2016 07:22:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Sz7pWgbt0zf9Kw4KRNTiFw4T3hyQuLbSF9XQA8aRO+I=; b=QxiUdfjBJrt/8cfpGLQWSJj6XC2x/fTflj6gVZgt+FkENJFE5l9gsnxjUkm9ys8Rih fgXnNVDTSqC6NYPfSfXdFOGHj81H0Lpje9H4T/wG5eq/xKh/RIGSLdO7gIlz6IsS9gFX i4NtlZxCt8RMbp+Ufms2wVbXY2nq/3imAyPZ+0G3Bl8mtBUTQmQzMpdrs8hKeF+olLGp VJugIehoZ4XVMmcDfz6xVeRXIMM15q5squ/9N4gyh4jp3opVb/5EqKvcvvZQ8uY/06KP WJCRmWkClqa1IB3Myjr07i6caW+zqNAwH+x6by0ZFDtgHWvV1ED2pf31mfLkFhkdEQ3I tA/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Sz7pWgbt0zf9Kw4KRNTiFw4T3hyQuLbSF9XQA8aRO+I=; b=HiG3PpoCRD+CFW973p6OhqQ6fGc9n/HVG8XMUPAaNUThmmbvR0cRTeSuZuUv4Pliz6 lXrS2OisuLeQGHJZ3Yi0ZMcrw/W8paJnTBGiNqKnhOu1NXMwTPE0AUpbwq0adWBoUAjH Tu6kJ/nZF7wl0awkggFj2I6Z5xaf1nW3uPTDOnfLZNHxoFyh2hWOU9LEEtmF6PzevRRR OA/lvNzx5ax3LU6sIkfZf22r/o0XiE1rfZNpyVmbZRwCS3eBLX7FLtsbpsaK61x44YXe WFPZqIDoNXzprITCKOxNEXD5wILYPbN8JuQXd3tVfYqR71jUoI/vZ7eybNfLwLM/efJo 9uUw== X-Gm-Message-State: AIkVDXL97S6LbLZoc+d3Z85AhVs3Ifqzyx5QAZRNoeZHCpZsxKNnr+XN/rFWUSAJ1ZfNwQ== X-Received: by 10.84.209.204 with SMTP id y70mr90404175plh.180.1483111319570; Fri, 30 Dec 2016 07:21:59 -0800 (PST) Received: from serve.minyard.net ([47.184.183.230]) by smtp.gmail.com with ESMTPSA id a26sm2243055pgd.27.2016.12.30.07.21.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Dec 2016 07:21:58 -0800 (PST) Received: from t430.minyard.net (t430m.minyard.net [192.168.27.3]) by serve.minyard.net (Postfix) with ESMTPA id 95B38F80; Fri, 30 Dec 2016 09:21:55 -0600 (CST) Received: by t430.minyard.net (Postfix, from userid 1000) id BD51230000E; Fri, 30 Dec 2016 09:21:52 -0600 (CST) From: minyard@acm.org To: qemu-devel@nongnu.org Date: Fri, 30 Dec 2016 09:21:36 -0600 Message-Id: <1483111310-24808-6-git-send-email-minyard@acm.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1483111310-24808-1-git-send-email-minyard@acm.org> References: <1483111310-24808-1-git-send-email-minyard@acm.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c05::242 Subject: [Qemu-devel] [PATCH 05/19] i2c:pm_smbus: Make the I2C block read command read-only X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Corey Minyard , minyard@acm.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Corey Minyard It did have write capability, but the manual says the behavior with write enabled is undefined. So just set an error in this case. Signed-off-by: Corey Minyard --- hw/i2c/pm_smbus.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/i2c/pm_smbus.c b/hw/i2c/pm_smbus.c index 679edbc..e7a8e92 100644 --- a/hw/i2c/pm_smbus.c +++ b/hw/i2c/pm_smbus.c @@ -56,7 +56,7 @@ #define PROT_WORD_DATA 3 #define PROT_PROC_CALL 4 #define PROT_BLOCK_DATA 5 -#define PROT_I2C_BLOCK_DATA 6 +#define PROT_I2C_BLOCK_READ 6 /*#define DEBUG*/ @@ -113,7 +113,7 @@ static void smb_transaction(PMSMBus *s) goto done; } break; - case PROT_I2C_BLOCK_DATA: + case PROT_I2C_BLOCK_READ: if (read) { int xfersize = s->smb_data0; if (xfersize > sizeof(s->smb_data)) { @@ -123,9 +123,8 @@ static void smb_transaction(PMSMBus *s) xfersize, false, true); goto data8; } else { - ret = smbus_write_block(bus, addr, cmd, s->smb_data, s->smb_data0, - false); - goto done; + /* The manual says the behavior is undefined, just set DEV_ERR. */ + goto error; } break; default: