linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chen-Yu Tsai <wenst@chromium.org>
To: Wim Van Sebroeck <wim@linux-watchdog.org>,
	Guenter Roeck <linux@roeck-us.net>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Philipp Zabel <p.zabel@pengutronix.de>
Cc: AngeloGioacchino Del Regno 
	<angelogioacchino.delregno@collabora.com>,
	Chen-Yu Tsai <wenst@chromium.org>,
	linux-watchdog@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH] watchdog: mtk_wdt: Move mt6589-wdt fallback compatible to end of list
Date: Tue, 26 Jul 2022 14:20:57 +0800	[thread overview]
Message-ID: <20220726062057.320342-1-wenst@chromium.org> (raw)

The watchdog facility in the MediaTek SoCs are all the same, but the
hardware block also contains a reset controller, which differs in the
number of resets used between different SoCs. This difference is
supported with of_device_get_match_data() supplying the number of reset
lines for the newer compatible strings. The original mt6589-wdt only
covers the watchdog facility.

of_device_is_compatible(), and by extension of_device_get_match_data(),
works by going through the given list of compatible strings sequentially,
and checks if any of the device node's compatible strings match.

To avoid early matching on the "mediatek,mt6589-wdt" fallback compatible,
which only provides watchdog functionality and no reset controller, move
the fallback entry to the end of the list, so that other, more specific
compatible strings have a chance at getting matched.

Fixes: c254e103082b ("watchdog: mtk_wdt: mt8183: Add reset controller")
Fixes: adc318a34066 ("watchdog: mt8192: add wdt support")
Fixes: 8c6b5ea6ac68 ("watchdog: mediatek: mt8195: add wdt support")
Fixes: 4dbabc4d9e8c ("watchdog: mediatek: mt8186: add wdt support")
Fixes: 711a5b25bac9 ("watchdog: mtk_wdt: mt7986: Add toprgu reset controller support")
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---

This change complements the removal of the fallback compatible from the
bindings and DTSI files [1].

[1] https://lore.kernel.org/linux-mediatek/20220721014845.19044-1-allen-kh.cheng@mediatek.com/

 drivers/watchdog/mtk_wdt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
index e97787536792..3d5a239b93ba 100644
--- a/drivers/watchdog/mtk_wdt.c
+++ b/drivers/watchdog/mtk_wdt.c
@@ -425,12 +425,13 @@ static int mtk_wdt_resume(struct device *dev)
 
 static const struct of_device_id mtk_wdt_dt_ids[] = {
 	{ .compatible = "mediatek,mt2712-wdt", .data = &mt2712_data },
-	{ .compatible = "mediatek,mt6589-wdt" },
 	{ .compatible = "mediatek,mt7986-wdt", .data = &mt7986_data },
 	{ .compatible = "mediatek,mt8183-wdt", .data = &mt8183_data },
 	{ .compatible = "mediatek,mt8186-wdt", .data = &mt8186_data },
 	{ .compatible = "mediatek,mt8192-wdt", .data = &mt8192_data },
 	{ .compatible = "mediatek,mt8195-wdt", .data = &mt8195_data },
+	/* Fallback compatible string must be last entry */
+	{ .compatible = "mediatek,mt6589-wdt" },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, mtk_wdt_dt_ids);
-- 
2.37.1.359.gd136c6c3e2-goog


             reply	other threads:[~2022-07-26  6:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-26  6:20 Chen-Yu Tsai [this message]
2022-07-26  8:37 ` [PATCH] watchdog: mtk_wdt: Move mt6589-wdt fallback compatible to end of list AngeloGioacchino Del Regno
2022-07-26 13:25   ` Guenter Roeck
2022-08-01  9:31     ` Chen-Yu Tsai

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=20220726062057.320342-1-wenst@chromium.org \
    --to=wenst@chromium.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=matthias.bgg@gmail.com \
    --cc=p.zabel@pengutronix.de \
    --cc=wim@linux-watchdog.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;
as well as URLs for NNTP newsgroup(s).