Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3911572rwb; Tue, 20 Sep 2022 06:30:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM48jfNEdE4YP0+NnD6zStJ7MCxxlz90HS3c10CyfVugmBA2WOiMdPcOZBK3HLwl8NIGgsmn X-Received: by 2002:a05:6a00:1581:b0:546:1c27:6541 with SMTP id u1-20020a056a00158100b005461c276541mr24359979pfk.64.1663680617068; Tue, 20 Sep 2022 06:30:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663680617; cv=none; d=google.com; s=arc-20160816; b=XiuHpHVvcvBEAG9uNpZ/HY7/yTLeCxDAc9W/xdDGnfAdy0vGxG6XRdl07h6cEBWZ0o HbQugROHsz2DmgfhIExt4VCodSj9gewA7IPnyLGxSz6oV5NmfN1D1jYWfx6zPiJz6z62 tX/m7nGkq/suDIhJ0oN1xepT2ILayNrPDfZHHw4bBP2DKI9UkkPFJfPXXMBcwnnq5Hec rjaLN/PsZntMa75vc/BNqsVRZUJ+LfN1wojct3cod42SbWH0pWXpLelVHjcxrKHgLd1R YRe5id38gUaDY5JIr1Bc5eaI59zsp4heqmV0IpsJ7ik0jLaNlZhueZJH85UKdHBxoaJb DRlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=MKTz1ItMojZ/N0Urx2JVYqPKMNNrdZli2kR33+1hBLc=; b=HiWXVNhKAEY/VszYb18ZUqRvRJQUnr7BCo7qRVmBVQdpfZ3qzp1hh6Ck2W+6b5JFBe zZQWACdpDjNvVICsu7XvqPhLU/kmK+Giy6Wc2/6rftOIuWIuh9Qv5IttiIV34AkG59mr JgHFMb1N3xVGO7mA+MEyfUCJOFC5e1TOktGmXqN5213ExR4446YlqRPgDfwSACnnmst3 U4T8TKSD6JZ4O1si6WmhcQ7KPNQuzZzWfDgOHkdy2PQWCuNJK2ZV+kewEdGbNbTiZ/QA AOC4H5F3Egy7zjYvzKPEgcQ4L4y3b2X2rgOPYcnTexHYeISfvKbUifSqEI6xYt/M95PD /hvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NJJwDY+M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h17-20020a056a00231100b00536ee478380si2064889pfh.7.2022.09.20.06.30.04; Tue, 20 Sep 2022 06:30:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NJJwDY+M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231233AbiITMcZ (ORCPT + 99 others); Tue, 20 Sep 2022 08:32:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229689AbiITMcU (ORCPT ); Tue, 20 Sep 2022 08:32:20 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C0C1564CE; Tue, 20 Sep 2022 05:32:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663677139; x=1695213139; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=CbnaupBI0IcuRH5CP6ofyWOkuYX0WeuPr4HLdbRSrus=; b=NJJwDY+Mo+1fkpP6yLyCp4CWHJTb4rnWK9KZ748fo4KbjhHlm/Mx0sXP iPAehYgqCWhpUJ1Bjt5IcFwykBTQHLNvxJ3HfMl2QWN04+lxDMjBsEWXN O45KawAnIjCliha6tPsGME+P/qaovX2f/sYr2iWg0TXQsSQZnOahYEMt5 NmaJLNQDaIAzCouMXsUxGAJZPaoeQ/oLBBRShKHp8ee7C2pqEA5JDgkeW v6FajkVGc9ZBqlxZVuTBcGhdUaX/mmrhDPMg7vzoBcf40BtMK60KR+6jd dBiPUSxkx3GIjNXMzfn7TDpH9jO1st0MUf9c4BTZbjPjmskurbORlJv31 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10476"; a="325982203" X-IronPort-AV: E=Sophos;i="5.93,330,1654585200"; d="scan'208";a="325982203" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2022 05:32:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,330,1654585200"; d="scan'208";a="621245024" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga007.fm.intel.com with ESMTP; 20 Sep 2022 05:32:15 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1oacQ9-004zO7-2u; Tue, 20 Sep 2022 15:32:13 +0300 Date: Tue, 20 Sep 2022 15:32:13 +0300 From: Andy Shevchenko To: Raul E Rangel Cc: linux-acpi@vger.kernel.org, linux-input@vger.kernel.org, timvp@google.com, hdegoede@redhat.com, rafael@kernel.org, mario.limonciello@amd.com, jingle.wu@emc.com.tw, mika.westerberg@linux.intel.com, dmitry.torokhov@gmail.com, linus.walleij@linaro.org, Wolfram Sang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 07/13] i2c: acpi: Use ACPI wake capability bit to set wake_irq Message-ID: References: <20220919155916.1044219-1-rrangel@chromium.org> <20220919095504.v4.7.I8af4282adc72eb9f247adcd03676a43893a020a6@changeid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220919095504.v4.7.I8af4282adc72eb9f247adcd03676a43893a020a6@changeid> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 19, 2022 at 09:59:09AM -0600, Raul E Rangel wrote: > Device tree already has a mechanism to pass the wake_irq. It does this > by looking for the wakeup-source property and setting the > I2C_CLIENT_WAKE flag. This CL adds the ACPI equivalent. It uses the > ACPI interrupt wake flag to determine if the interrupt can be used to > wake the system. Previously the i2c drivers had to make assumptions and > blindly enable the wake IRQ. This can cause spurious wake events. e.g., > If there is a device with an Active Low interrupt and the device gets > powered off while suspending, the interrupt line will go low since it's > no longer powered and wakes the system. For this reason we should > respect the board designers wishes and honor the wake bit defined on the > interrupt. ... > + if (irq_ctx.irq == -ENOENT) > + irq_ctx.irq = acpi_dev_gpio_irq_wake_get(adev, 0, &irq_ctx.wake_capable); I just realized, that there is an inconsistency on how we fill the wake_capable parameter. In some cases we check for IRQ for an error condition (IRQ not found) and in some the wake_capable still be filled. Here the best approach I believe is to add if (irq_ctx.irq < 0) return irq_ctx.irq; I.o.w. we apply the rule "do not fill the output parameters when it's known to be an error condition". > + if (wake_capable) > + *wake_capable = irq_ctx.wake_capable; > + return irq_ctx.irq; -- With Best Regards, Andy Shevchenko