From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Baojun Xu <baojun.xu@ti.com>,
linux-i2c@vger.kernel.org, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org,
platform-driver-x86@vger.kernel.org
Cc: "Wolfram Sang" <wsa+renesas@sang-engineering.com>,
"Mika Westerberg" <westeri@kernel.org>,
"Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Subject: [PATCH v1 1/2] i2c: acpi: Return -ENOENT when no resources found in i2c_acpi_client_count()
Date: Tue, 25 Nov 2025 10:40:11 +0100 [thread overview]
Message-ID: <20251125094249.1627498-2-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20251125094249.1627498-1-andriy.shevchenko@linux.intel.com>
Some users want to return an error to the upper layers when
i2c_acpi_client_count() returns 0. Follow the common pattern
in such cases, i.e. return -ENOENT instead of 0.
While at it, fix the kernel-doc warning about missing return value
description.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/i2c/i2c-core-acpi.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c
index ed90858a27b7..a7d36f8d7f2f 100644
--- a/drivers/i2c/i2c-core-acpi.c
+++ b/drivers/i2c/i2c-core-acpi.c
@@ -84,8 +84,11 @@ static int i2c_acpi_resource_count(struct acpi_resource *ares, void *data)
* i2c_acpi_client_count - Count the number of I2cSerialBus resources
* @adev: ACPI device
*
- * Returns the number of I2cSerialBus resources in the ACPI-device's
+ * Return:
+ * The number of I2cSerialBus resources in the ACPI-device's
* resource-list; or a negative error code.
+ *
+ * Specifically returns -ENOENT when no resources found.
*/
int i2c_acpi_client_count(struct acpi_device *adev)
{
@@ -97,7 +100,7 @@ int i2c_acpi_client_count(struct acpi_device *adev)
return ret;
acpi_dev_free_resource_list(&r);
- return count;
+ return count ?: -ENOENT;
}
EXPORT_SYMBOL_GPL(i2c_acpi_client_count);
--
2.50.1
next prev parent reply other threads:[~2025-11-25 9:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-25 9:40 [PATCH v1 0/2] i2c: acpi: Ad-hoc cleanup and kernel-doc fix Andy Shevchenko
2025-11-25 9:40 ` Andy Shevchenko [this message]
2025-11-25 9:50 ` [PATCH v1 1/2] i2c: acpi: Return -ENOENT when no resources found in i2c_acpi_client_count() Mika Westerberg
2025-11-25 10:10 ` Andy Shevchenko
2025-11-25 9:40 ` [PATCH v1 2/2] platform/x86: serial-multi-instantiate: Remove duplicate check Andy Shevchenko
2025-11-27 9:54 ` Ilpo Järvinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251125094249.1627498-2-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=baojun.xu@ti.com \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=westeri@kernel.org \
--cc=wsa+renesas@sang-engineering.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox