Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1270863pxu; Mon, 23 Nov 2020 16:37:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJyGF1E+Y8SqPSpmCQj7q0Fmsghs/40Caa2q6KbulKySf52GhKOp/p2frLxQlJlLutwbv3zZ X-Received: by 2002:aa7:d709:: with SMTP id t9mr1726001edq.305.1606178262812; Mon, 23 Nov 2020 16:37:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606178262; cv=none; d=google.com; s=arc-20160816; b=cSbp37PJPY301JHsusm5XZmL5BwOJORVWTuQK7ZXaw5+l0q/SJHnrc0wLzF30uTBIR tmdNS4CqgN7dETdFszBtdZeHLQuIOfGvhNbX/cGLzfz3OCOjFBZYudZxuDQ3u/xxhdrR Mu2XMLRA5E8b8UdxNC//ZHbxy151f7KfFzuBc6mRB4xwpotAV1fyY4JiuRJqNsaRgre4 1avnAPj2a7ehwsDhyecSAzXWTCXjPjBnf1VZfErP8F8I+/wyPzI3233dJ6TdGh9/aFEM 8ucWSL+w1TTH1gxQMx3jP37S7G/EwBMTgsunbCQwuhOg5Sqh7XPj858nRplPsybDeGIJ jM5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=guwakeGqYvZqCwL8HLKuaI88GszqR/fNcoE2U1uC1Ak=; b=ld6NHm+bKdCCdw4NVm0Yg3qeTBGhSv4VmLmMm9eSKljiGQKdMMRjShsRzeM3FWrKK9 1cvGyjz+S0kcstUncTo0GsYV8PHEyZXhvv0y2CrhlUyBSj8B/Yb4/ptzFsts8YVEKWAa QsnYIiY3p1MiVCmOKa44/jvu1GCt3HwprTuLo5yY8ZA+RMQXxdWOJv0TJZacZrb/KkEY 4dKYBz8J1Cm7eVihK6wqbPMWdhQOJEyHeOpa8smjtMn/qQr+3eSyslgWIS80Gucn1/Gr oO6o5Esgilu8701WdjwYj6oNnnDFQChUfVRHxTid38Dv0opz37+FkKnM3uM0uJIqk1lQ 1aCQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id go10si8217954ejc.656.2020.11.23.16.37.20; Mon, 23 Nov 2020 16:37:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730795AbgKWTlG (ORCPT + 99 others); Mon, 23 Nov 2020 14:41:06 -0500 Received: from cloudserver094114.home.pl ([79.96.170.134]:60006 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730205AbgKWTlG (ORCPT ); Mon, 23 Nov 2020 14:41:06 -0500 Received: from 89-64-88-191.dynamic.chello.pl (89.64.88.191) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.520) id 62d924656228e836; Mon, 23 Nov 2020 20:41:03 +0100 From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML Subject: [PATCH 5/5] ACPI: EC: Clean up status flags checks in advance_transaction() Date: Mon, 23 Nov 2020 20:40:53 +0100 Message-ID: <5941029.rKP6mmzaN7@kreacher> In-Reply-To: <3259005.CeRvrUlyd7@kreacher> References: <3259005.CeRvrUlyd7@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Rafael J. Wysocki" Eliminate comparisons from the status flags checks in advance_transaction() (especially from the one that is only correct, because the value of the flag checked in there is 1) and rearrange the code for more clarity while at it. No intentional functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/acpi/ec.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 091f0e9f37a0..13565629ce0a 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -667,25 +667,24 @@ static void advance_transaction(struct acpi_ec *ec, bool interrupt) if (t->flags & ACPI_EC_COMMAND_POLL) { if (t->wlen > t->wi) { - if ((status & ACPI_EC_FLAG_IBF) == 0) + if (!(status & ACPI_EC_FLAG_IBF)) acpi_ec_write_data(ec, t->wdata[t->wi++]); else if (interrupt && !(status & ACPI_EC_FLAG_SCI)) acpi_ec_spurious_interrupt(ec, t); } else if (t->rlen > t->ri) { - if ((status & ACPI_EC_FLAG_OBF) == 1) { + if (status & ACPI_EC_FLAG_OBF) { t->rdata[t->ri++] = acpi_ec_read_data(ec); if (t->rlen == t->ri) { ec_transaction_transition(ec, ACPI_EC_COMMAND_COMPLETE); + wakeup = true; if (t->command == ACPI_EC_COMMAND_QUERY) ec_dbg_evt("Command(%s) completed by hardware", acpi_ec_cmd_string(ACPI_EC_COMMAND_QUERY)); - wakeup = true; } } else if (interrupt && !(status & ACPI_EC_FLAG_SCI)) { acpi_ec_spurious_interrupt(ec, t); } - } else if (t->wlen == t->wi && - (status & ACPI_EC_FLAG_IBF) == 0) { + } else if (t->wlen == t->wi && !(status & ACPI_EC_FLAG_IBF)) { ec_transaction_transition(ec, ACPI_EC_COMMAND_COMPLETE); wakeup = true; } @@ -697,6 +696,7 @@ static void advance_transaction(struct acpi_ec *ec, bool interrupt) out: if (status & ACPI_EC_FLAG_SCI) acpi_ec_submit_query(ec); + if (wakeup && interrupt) wake_up(&ec->wait); } -- 2.26.2