Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp3712867rdb; Wed, 27 Dec 2023 18:18:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IGArdUYdwomFkvTmhnDMzEL51ndW5C7mx4vQYYehiyOdrzxsOiH+tl/iJPBspYf5K/aJVd1 X-Received: by 2002:a17:906:253:b0:a23:57fa:1b9d with SMTP id 19-20020a170906025300b00a2357fa1b9dmr2270225ejl.144.1703729933294; Wed, 27 Dec 2023 18:18:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703729933; cv=none; d=google.com; s=arc-20160816; b=QQGq+bQg8So6ghUWxk1G/xmM8v+QweeOUs6aeZqdXxjBdmfsufbXzvq/6M1ltgG5eL 54KiY1QwLg5nEivJOjHbkwDvhA6vJ6AGY2N5YRVO6ZF3VQR+mrjyOE0I1UTqX6NX+tgK AGV7tcOzPxnO9JLAkOkUE+YrxEXWNZSnUZgJUbwuSfnWi4RNqbk6lwGr21vl2432zi32 cG2fIUSALPyxL3TYZRDD0mWLJO0xB4woFM2X+9YjD7s72eMLFEGR6/2R6Tilwy/V1J1u PoUQAHPvJqvhdhrlikw14nm5vBVQPr1NHKoMMLlzUgD5zwL+yl3vNFnRNCxfMu5P0Vf4 63Eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=7yeVmDd0cl5x8IWDoZE6Gr/4pMOVXi6t8+KR/non7oM=; fh=nj9mDxEJew/qjryk+r6XAeLMqDk2podO75bfWyAJnbM=; b=P8v5+SSdh7rUZ770CQQBqmj/veh1aVIROhWiUxKiKNSFo/b3JGx5Kufk5IMh55xHrj FxrBq5dauhAzNaMa4fuUp3U0/94f9fQrkY6/dQ8yDTLWOfASZnVFN+AD+d3YP9tLdt3I OpF/dAPjfz1hK7CpxlFOKtnL59TKIHpW3C7yScndqKCHzqMDRYvMsCPFUqPlLSQke+M6 qo12WCP9OeHB/0+8fjDIySPnl9reYUOjZ/c7mvb0JXSj9w98/CRXAY5QSzA0rQI/lvq2 kWE9JE8vBCS1lH6P5UKwDdGgP67F8XxOJ7IhxDJUP8J1WifeXZX7AI6YCfH7sNtlKbUT g0IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=A17rYsN1; spf=pass (google.com: domain of linux-kernel+bounces-12390-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12390-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id mz12-20020a1709071b8c00b00a26f5b16fe8si2601740ejc.288.2023.12.27.18.18.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 18:18:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-12390-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=A17rYsN1; spf=pass (google.com: domain of linux-kernel+bounces-12390-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12390-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 0BD8E1F217D5 for ; Thu, 28 Dec 2023 02:18:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D3201106; Thu, 28 Dec 2023 02:18:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="A17rYsN1" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A992EDB; Thu, 28 Dec 2023 02:18:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FC27C433C7; Thu, 28 Dec 2023 02:18:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703729925; bh=ICAwhWKhehGd9vTcF3nvOWXD/lnnob/w5a+Pw7RVLdM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=A17rYsN1fPklVSK2EvGIWyMWX8PsKzd//HE+0ueCjMHwmbBTppTPXL+DEvEtCl45c yKZXqanh6uYjmLNu/nzVnbAkWJ+K6HUnpRiJpzM0XEVS1c/QnSoeTtSeAzWKkW5uLe EhKMuHm3iwHPyELp4dNTBYfmTwaSCZS2ecU7c+mxIG8pV8vQm4P9yLmDYNZP1BmNV2 5wMoaPdOKDsry6/7iLtZDhVmmvSzIS0RML5Uf07i+Dh6o82Av0vU4b3jMt5uZ8lmE2 GaOM6Fsy+R03nW5jlPPZBUdnPoQbRoc0ZJH02Iot86Af6S0ynA9710K+T531cDQhJJ 78KHUPhKtmKUw== Date: Thu, 28 Dec 2023 10:18:40 +0800 From: Tzung-Bi Shih To: Andy Shevchenko Cc: Mark Hasemeyer , LKML , AngeloGioacchino Del Regno , Krzysztof Kozlowski , Rob Herring , Konrad Dybcio , Sudeep Holla , Raul Rangel , Benson Leung , Bhanu Prakash Maiya , Chen-Yu Tsai , Guenter Roeck , Lee Jones , Prashant Malani , Rob Barnes , Stephen Boyd , chrome-platform@lists.linux.dev Subject: Re: [PATCH v3 24/24] platform/chrome: cros_ec: Use PM subsystem to manage wakeirq Message-ID: References: <20231226192149.1830592-1-markhas@chromium.org> <20231226122113.v3.24.Ieee574a0e94fbaae01fd6883ffe2ceeb98d7df28@changeid> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Dec 27, 2023 at 07:34:58PM +0200, Andy Shevchenko wrote: > On Tue, Dec 26, 2023 at 12:21:28PM -0700, Mark Hasemeyer wrote: > > - irq = platform_get_irq_optional(pdev, 0); > > - if (irq > 0) > > + irq = platform_get_irq_resource_optional(pdev, 0, &irqres); > > + if (irq > 0) { > > ec_dev->irq = irq; > > - else if (irq != -ENXIO) { > > + if (should_force_irq_wake_capable()) > > + ec_dev->irq_wake = true; > > + else > > + ec_dev->irq_wake = irqres.flags & IORESOURCE_IRQ_WAKECAPABLE; > > + } else if (irq != -ENXIO) { > > dev_err(dev, "couldn't retrieve IRQ number (%d)\n", irq); > > return irq; > > } > > Still I do not like ambiguity behind irq > 0 vs. irqres.start. > > For this, and if needed others, return plain error. > Seems I gave the tag for the previous patch, consider > that tag conditional (it seems I missed this). On a related note, I was confusing a while because of the differences: platform_get_irq_optional() and platform_get_irq_resource_optional(): Return: non-zero IRQ number on success, negative error number on failure. acpi_dev_get_gpio_irq_resource(): Return: 0 on success, negative errno on failure. acpi_dev_gpio_irq_get(): Return: Linux IRQ number (> %0) on success, negative errno on failure. How about let platform_get_irq_resource_optional(): - Return 0 on success and negative errno on failure. - The callee needs to retrieve the IRQ number from irqres.start. ?