From: Hans de Goede <hdegoede@redhat.com>
To: Mark Gross <mgross@linux.intel.com>,
Andy Shevchenko <andy@infradead.org>,
Wolfram Sang <wsa@the-dreams.de>,
Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
platform-driver-x86@vger.kernel.org, linux-i2c@vger.kernel.org,
linux-acpi@vger.kernel.org
Subject: [PATCH 3/4] platform/x86: i2c-multi-instantiate: Use the new i2c_acpi_client_count() helper
Date: Tue, 3 Aug 2021 18:00:43 +0200 [thread overview]
Message-ID: <20210803160044.158802-4-hdegoede@redhat.com> (raw)
In-Reply-To: <20210803160044.158802-1-hdegoede@redhat.com>
Use the new i2c_acpi_client_count() helper, this
results in a nice cleanup.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/platform/x86/i2c-multi-instantiate.c | 27 +-------------------
1 file changed, 1 insertion(+), 26 deletions(-)
diff --git a/drivers/platform/x86/i2c-multi-instantiate.c b/drivers/platform/x86/i2c-multi-instantiate.c
index 2cce82579d09..a50153ecd560 100644
--- a/drivers/platform/x86/i2c-multi-instantiate.c
+++ b/drivers/platform/x86/i2c-multi-instantiate.c
@@ -32,31 +32,6 @@ struct i2c_multi_inst_data {
struct i2c_client *clients[];
};
-static int i2c_multi_inst_count(struct acpi_resource *ares, void *data)
-{
- struct acpi_resource_i2c_serialbus *sb;
- int *count = data;
-
- if (i2c_acpi_get_i2c_resource(ares, &sb))
- *count = *count + 1;
-
- return 1;
-}
-
-static int i2c_multi_inst_count_resources(struct acpi_device *adev)
-{
- LIST_HEAD(r);
- int count = 0;
- int ret;
-
- ret = acpi_dev_get_resources(adev, &r, i2c_multi_inst_count, &count);
- if (ret < 0)
- return ret;
-
- acpi_dev_free_resource_list(&r);
- return count;
-}
-
static int i2c_multi_inst_probe(struct platform_device *pdev)
{
struct i2c_multi_inst_data *multi;
@@ -76,7 +51,7 @@ static int i2c_multi_inst_probe(struct platform_device *pdev)
adev = ACPI_COMPANION(dev);
/* Count number of clients to instantiate */
- ret = i2c_multi_inst_count_resources(adev);
+ ret = i2c_acpi_client_count(adev);
if (ret < 0)
return ret;
--
2.31.1
next prev parent reply other threads:[~2021-08-03 16:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-03 16:00 [PATCH 0/4] i2c/pdx86: Add an i2c_acpi_client_count() helper function Hans de Goede
2021-08-03 16:00 ` [PATCH 1/4] i2c: acpi: " Hans de Goede
2021-08-03 16:50 ` Mika Westerberg
2021-08-06 13:44 ` Hans de Goede
2021-08-10 20:44 ` Wolfram Sang
2021-08-12 15:27 ` Hans de Goede
2021-08-03 16:00 ` [PATCH 2/4] platform/x86: dual_accel_detect: Use the new i2c_acpi_client_count() helper Hans de Goede
2021-08-03 16:00 ` Hans de Goede [this message]
2021-08-03 16:00 ` [PATCH 4/4] platform/x86: intel_cht_int33fe: " Hans de Goede
2021-08-03 16:14 ` [PATCH 0/4] i2c/pdx86: Add an i2c_acpi_client_count() helper function Andy Shevchenko
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=20210803160044.158802-4-hdegoede@redhat.com \
--to=hdegoede@redhat.com \
--cc=andy@infradead.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=mgross@linux.intel.com \
--cc=mika.westerberg@linux.intel.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=wsa@the-dreams.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.