From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
Andi Shyti <andi.shyti@kernel.org>, Jan Dabros <jsd@semihalf.com>
Subject: Re: [PATCH v1 2/2] i2c: designware: Use device_is_compatible() instead of custom approach
Date: Wed, 14 Jan 2026 12:53:04 +0100 [thread overview]
Message-ID: <20260114115304.GC2275908@black.igk.intel.com> (raw)
In-Reply-To: <20260114081954.252160-3-andriy.shevchenko@linux.intel.com>
On Wed, Jan 14, 2026 at 09:17:51AM +0100, Andy Shevchenko wrote:
> We use MODEL_MSCC_OCELOT effectively is a flag for comparing against
as a flag?
> "compatible" property. Use device_is_compatible() directly to make it
> clear.
Okay but if something else ever needs this same quirk then we would need to
add new entry here and also to the IDs list.
With the flag you can have the IDs in a single place not all over the
driver.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/i2c/busses/i2c-designware-common.c | 6 +-----
> drivers/i2c/busses/i2c-designware-core.h | 1 -
> drivers/i2c/busses/i2c-designware-platdrv.c | 2 +-
> 3 files changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-designware-common.c b/drivers/i2c/busses/i2c-designware-common.c
> index 5b1e8f74c4ac..c766d9821975 100644
> --- a/drivers/i2c/busses/i2c-designware-common.c
> +++ b/drivers/i2c/busses/i2c-designware-common.c
> @@ -238,14 +238,10 @@ static void i2c_dw_of_configure(struct device *device)
> struct platform_device *pdev = to_platform_device(device);
> struct dw_i2c_dev *dev = dev_get_drvdata(device);
>
> - switch (dev->flags & MODEL_MASK) {
> - case MODEL_MSCC_OCELOT:
> + if (device_is_compatible(dev->dev, "mscc,ocelot-i2c")) {
> dev->ext = devm_platform_ioremap_resource(pdev, 1);
> if (!IS_ERR(dev->ext))
> dev->set_sda_hold_time = mscc_twi_set_sda_hold_time;
> - break;
> - default:
> - break;
> }
> }
>
> diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h
> index cf0364079b55..10055f0e0ec3 100644
> --- a/drivers/i2c/busses/i2c-designware-core.h
> +++ b/drivers/i2c/busses/i2c-designware-core.h
> @@ -313,7 +313,6 @@ struct dw_i2c_dev {
> #define ARBITRATION_SEMAPHORE BIT(2)
> #define ACCESS_POLLING BIT(3)
>
> -#define MODEL_MSCC_OCELOT BIT(8)
> #define MODEL_AMD_NAVI_GPU BIT(10)
> #define MODEL_WANGXUN_SP BIT(11)
> #define MODEL_MASK GENMASK(11, 8)
> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
> index 2e532f16691b..4e6fe3b55322 100644
> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -267,7 +267,7 @@ static void dw_i2c_plat_remove(struct platform_device *pdev)
> }
>
> static const struct of_device_id dw_i2c_of_match[] = {
> - { .compatible = "mscc,ocelot-i2c", .data = (void *)MODEL_MSCC_OCELOT },
> + { .compatible = "mscc,ocelot-i2c" },
> { .compatible = "snps,designware-i2c" },
> {}
> };
> --
> 2.50.1
next prev parent reply other threads:[~2026-01-14 11:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-14 8:17 [PATCH v1 0/2] i2c: designware: Clean up MODEL_* definitions Andy Shevchenko
2026-01-14 8:17 ` [PATCH v1 1/2] i2c: designware: Remove not-going-to-be-supported code for Baikal SoC Andy Shevchenko
2026-01-14 11:50 ` Mika Westerberg
2026-01-15 15:23 ` Andi Shyti
2026-01-14 8:17 ` [PATCH v1 2/2] i2c: designware: Use device_is_compatible() instead of custom approach Andy Shevchenko
2026-01-14 11:53 ` Mika Westerberg [this message]
2026-01-14 16:09 ` Andy Shevchenko
2026-01-15 5:39 ` Mika Westerberg
2026-01-15 7:41 ` Andy Shevchenko
2026-01-15 10:06 ` Mika Westerberg
2026-01-22 11:10 ` Andi Shyti
2026-01-22 11:49 ` 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=20260114115304.GC2275908@black.igk.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=andi.shyti@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=jsd@semihalf.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.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