From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Jarkko Nikula <jarkko.nikula@linux.intel.com>,
Mario Limonciello <mario.limonciello@amd.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Wolfram Sang <wsa@kernel.org>,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>,
Jan Dabros <jsd@semihalf.com>, Andi Shyti <andi.shyti@kernel.org>
Subject: [PATCH v1 1/9] i2c: designware: Move has_acpi_companion() to common code
Date: Tue, 25 Jul 2023 17:30:15 +0300 [thread overview]
Message-ID: <20230725143023.86325-2-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20230725143023.86325-1-andriy.shevchenko@linux.intel.com>
Instead of checking in callers, move the call to the callee.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/i2c/busses/i2c-designware-common.c | 11 +++++++++--
drivers/i2c/busses/i2c-designware-pcidrv.c | 3 +--
drivers/i2c/busses/i2c-designware-platdrv.c | 3 +--
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/i2c/busses/i2c-designware-common.c b/drivers/i2c/busses/i2c-designware-common.c
index cdd8c67d9129..683f7a9beb46 100644
--- a/drivers/i2c/busses/i2c-designware-common.c
+++ b/drivers/i2c/busses/i2c-designware-common.c
@@ -255,9 +255,8 @@ static void i2c_dw_acpi_params(struct device *device, char method[],
kfree(buf.pointer);
}
-int i2c_dw_acpi_configure(struct device *device)
+static void i2c_dw_acpi_do_configure(struct dw_i2c_dev *dev, struct device *device)
{
- struct dw_i2c_dev *dev = dev_get_drvdata(device);
struct i2c_timings *t = &dev->timings;
u32 ss_ht = 0, fp_ht = 0, hs_ht = 0, fs_ht = 0;
@@ -285,6 +284,14 @@ int i2c_dw_acpi_configure(struct device *device)
dev->sda_hold_time = fs_ht;
break;
}
+}
+
+int i2c_dw_acpi_configure(struct device *device)
+{
+ struct dw_i2c_dev *dev = dev_get_drvdata(device);
+
+ if (has_acpi_companion(device))
+ i2c_dw_acpi_do_configure(dev, device);
return 0;
}
diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c
index 61d7a27aa070..d9d80650fbdc 100644
--- a/drivers/i2c/busses/i2c-designware-pcidrv.c
+++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
@@ -303,8 +303,7 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
i2c_dw_adjust_bus_speed(dev);
- if (has_acpi_companion(&pdev->dev))
- i2c_dw_acpi_configure(&pdev->dev);
+ i2c_dw_acpi_configure(&pdev->dev);
r = i2c_dw_validate_speed(dev);
if (r) {
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 970c1c3b0402..4eedb0734438 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -314,8 +314,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
if (pdev->dev.of_node)
dw_i2c_of_configure(pdev);
- if (has_acpi_companion(&pdev->dev))
- i2c_dw_acpi_configure(&pdev->dev);
+ i2c_dw_acpi_configure(&pdev->dev);
ret = i2c_dw_validate_speed(dev);
if (ret)
--
2.40.0.1.gaa8946217a0b
next prev parent reply other threads:[~2023-07-25 14:30 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-25 14:30 [PATCH v1 0/9] i2c: designware: code consolidation & cleanups Andy Shevchenko
2023-07-25 14:30 ` Andy Shevchenko [this message]
2023-07-25 21:45 ` [PATCH v1 1/9] i2c: designware: Move has_acpi_companion() to common code Andi Shyti
2023-07-28 11:33 ` Jarkko Nikula
2023-07-31 20:14 ` Andy Shevchenko
2023-08-03 13:43 ` Jarkko Nikula
2023-09-24 20:56 ` Wolfram Sang
2023-09-25 6:46 ` Andy Shevchenko
2023-09-25 6:55 ` Wolfram Sang
2023-07-25 14:30 ` [PATCH v1 2/9] i2c: designware: Change i2c_dw_acpi_configure() prototype Andy Shevchenko
2023-07-25 21:45 ` Andi Shyti
2023-07-25 14:30 ` [PATCH v1 3/9] i2c: designware: Align dw_i2c_of_configure() with i2c_dw_acpi_configure() Andy Shevchenko
2023-07-25 21:48 ` Andi Shyti
2023-07-26 14:48 ` Andy Shevchenko
2023-07-25 14:30 ` [PATCH v1 4/9] i2c: designware: Propagate firmware node Andy Shevchenko
2023-07-28 12:25 ` Jarkko Nikula
2023-07-31 20:09 ` Andy Shevchenko
2023-08-04 20:59 ` Andi Shyti
2023-08-07 14:32 ` Andy Shevchenko
2023-07-25 14:30 ` [PATCH v1 5/9] i2c: designware: Always provide ID tables Andy Shevchenko
2023-07-28 12:33 ` Jarkko Nikula
2023-07-31 20:05 ` Andy Shevchenko
2023-08-04 21:00 ` Andi Shyti
2023-08-07 14:34 ` Andy Shevchenko
2023-07-25 14:30 ` [PATCH v1 6/9] i2c: designware: Consolidate firmware parsing and configure code Andy Shevchenko
2023-08-04 21:22 ` Andi Shyti
2023-07-25 14:30 ` [PATCH v1 7/9] i2c: desingware: Unify firmware type checks Andy Shevchenko
2023-08-04 21:31 ` Andi Shyti
2023-07-25 14:30 ` [PATCH v1 8/9] i2c: designware: Get rid of redundant 'else' Andy Shevchenko
2023-08-04 21:33 ` Andi Shyti
2023-07-25 14:30 ` [PATCH v1 9/9] i2c: designware: Fix spelling and other issues in the comments Andy Shevchenko
2023-08-04 21:41 ` Andi Shyti
2023-08-07 14:37 ` Andy Shevchenko
2023-08-07 15:04 ` Andi Shyti
2023-07-25 15:22 ` [PATCH v1 0/9] i2c: designware: code consolidation & cleanups Limonciello, Mario
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=20230725143023.86325-2-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=andi.shyti@kernel.org \
--cc=jarkko.nikula@linux.intel.com \
--cc=jsd@semihalf.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=mika.westerberg@linux.intel.com \
--cc=wsa@kernel.org \
/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