Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1105247pxu; Mon, 23 Nov 2020 11:45:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJxFo8FY7nvnw+XfRAbfRySDhRduxudOSvCV9D4iCvBfKnykcYKM6U4uxbeG9mPz9r5f3NT4 X-Received: by 2002:a50:ec86:: with SMTP id e6mr748527edr.111.1606160731863; Mon, 23 Nov 2020 11:45:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606160731; cv=none; d=google.com; s=arc-20160816; b=rkY8nUEDkGzuNcvGDszl7s8v26NNNlD0ht8k46GJ8F0h22JrufosFrRv15PNznM9Sy /lrBaPIkRxjord4gXyHwnNVr5Gq0uAodlMidpbLTrO8e/OsUCNzmFO1hXdn+MPi088Xu m1wKU9ZZT8qoumm/ZiOIbLNQwYx3BckqEea6ujh+lZT5En+ND3OIBgHOzdMdN87h9ASZ QmfgjLlWe/Rsr/nbzj4UStVGRD4Qdp3KTq1cYElWbSn6WS9DIpuun3znnzJtbIFv8HuD HB47kxSBFoaERn27Wd0eekwatQjTG+34XS6Wxu7Q/ie1ub8BYlMnVOMENLNtRfyDYE9u 43dA== 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=1AkU9odOGhsYhX0XPjvW1Ru6ZhZMcIRYbJRmHWXwO60=; b=nAcX30YXi9cqBczDvhzXaOcwcCmu2R8nMm0Yk4ZqgBU2zP1uGzt+hEVT5oHGu74PLY 5hizCUoZWn1iNriTk/T+iaQHzLLCsUnr6NJuf01Sae9avMS8Gr/CychWBOUr1C1dH5ly FkIg2vWvRtPXOd+TPImPEq52m9JeqPp14kNXhdaOo3t7oltrouvTZH9/pASLwtsYlOlf zViToBlT9PRiGCH9C1ag6CdpKrB0oK96lEetX0eaQY8FxTaPYCy6227Xm81g7GqivB12 hQnDYw7dCIL4JveKAhSgmLgkLGfEEfR7gU84oka1g6bgcpTu/7b/jic29Nu2H70vYdWd zWuA== 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 u2si7307155edo.406.2020.11.23.11.45.08; Mon, 23 Nov 2020 11:45:31 -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 S1731065AbgKWTlK (ORCPT + 99 others); Mon, 23 Nov 2020 14:41:10 -0500 Received: from cloudserver094114.home.pl ([79.96.170.134]:61294 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730878AbgKWTlJ (ORCPT ); Mon, 23 Nov 2020 14:41:09 -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 64c4579c018f95d1; Mon, 23 Nov 2020 20:41:07 +0100 From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML Subject: [PATCH 1/5] ACPI: EC: Fold acpi_ec_clear_gpe() into its caller Date: Mon, 23 Nov 2020 20:37:06 +0100 Message-ID: <8467712.e8rTiVh5pU@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" Fold acpi_ec_clear_gpe() which is only used in one place into its caller and clean up comments related to that function while at it. No intentional functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/acpi/ec.c | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 0caf5ca1fc07..97e595238a8c 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -372,23 +372,6 @@ static inline void acpi_ec_disable_gpe(struct acpi_ec *ec, bool close) } } -static inline void acpi_ec_clear_gpe(struct acpi_ec *ec) -{ - /* - * GPE STS is a W1C register, which means: - * 1. Software can clear it without worrying about clearing other - * GPEs' STS bits when the hardware sets them in parallel. - * 2. As long as software can ensure only clearing it when it is - * set, hardware won't set it in parallel. - * So software can clear GPE in any contexts. - * Warning: do not move the check into advance_transaction() as the - * EC commands will be sent without GPE raised. - */ - if (!acpi_ec_is_gpe_raised(ec)) - return; - acpi_clear_gpe(NULL, ec->gpe); -} - /* -------------------------------------------------------------------------- * Transaction Management * -------------------------------------------------------------------------- */ @@ -639,13 +622,21 @@ static void advance_transaction(struct acpi_ec *ec, bool interrupt) bool wakeup = false; ec_dbg_stm("%s (%d)", interrupt ? "IRQ" : "TASK", smp_processor_id()); + /* - * By always clearing STS before handling all indications, we can - * ensure a hardware STS 0->1 change after this clearing can always - * trigger a GPE interrupt. + * Clear GPE_STS upfront to allow subsequent hardware GPE_STS 0->1 + * changes to always trigger a GPE interrupt. + * + * GPE STS is a W1C register, which means: + * + * 1. Software can clear it without worrying about clearing the other + * GPEs' STS bits when the hardware sets them in parallel. + * + * 2. As long as software can ensure only clearing it when it is set, + * hardware won't set it in parallel. */ - if (ec->gpe >= 0) - acpi_ec_clear_gpe(ec); + if (ec->gpe >= 0 && acpi_ec_is_gpe_raised(ec)) + acpi_clear_gpe(NULL, ec->gpe); status = acpi_ec_read_status(ec); t = ec->curr; -- 2.26.2