From mboxrd@z Thu Jan 1 00:00:00 1970 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) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="A17rYsN1" 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. ?