From: Daniel Golle <daniel@makrotopia.org>
To: Neil Armstrong <neil.armstrong@linaro.org>,
Dmitry Baryshkov <lumag@kernel.org>,
Robert Foss <rfoss@kernel.org>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Luca Ceresoli <luca.ceresoli@bootlin.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Hermes Wu <hermes.wu@ite.com.tw>,
Pin-yen Lin <treapking@chromium.org>
Cc: Chen-Yu Tsai <wenst@chromium.org>,
Jiaxin Yu <jiaxin.yu@mediatek.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org
Subject: [PATCH v9 06/14] drm/bridge: it6505: bail out of the IRQ handler when status reads fail
Date: Fri, 20 Nov 2026 00:02:59 +0000 [thread overview]
Message-ID: <ce2a90cbb7a9de693d0b260dcc90572a473c9aab.1795132452.git.daniel@makrotopia.org> (raw)
In-Reply-To: <cover.1795132452.git.daniel@makrotopia.org>
When reading the interrupt status registers fails, the negative error
codes end up in int_status[], where it6505_test_bit() sees almost all
bits set: every interrupt sub-handler runs on garbage and the error
values are even written back to the status registers.
Read the three contiguous status registers with a single
regmap_bulk_read() and return IRQ_NONE if it fails. it6505_read()
only adds the powered check on top of regmap_read(), which the
handler has already done. Acknowledge them with a single
regmap_bulk_write() as well, and switch int_status[] and its users to
u8, dropping the casts.
Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
drivers/gpu/drm/bridge/ite-it6505.c | 37 +++++++++++++++--------------
1 file changed, 19 insertions(+), 18 deletions(-)
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
index 249c616300fde..434a4fa39a911 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -2639,12 +2639,13 @@ static void it6505_irq_link_train_fail(struct it6505 *it6505)
schedule_work(&it6505->link_works);
}
-static bool it6505_test_bit(unsigned int bit, const unsigned int *addr)
+static bool it6505_test_bit(unsigned int bit, const u8 *addr)
{
return 1 & (addr[bit / BITS_PER_BYTE] >> (bit % BITS_PER_BYTE));
}
-static void it6505_irq_video_handler(struct it6505 *it6505, const int *int_status)
+static void it6505_irq_video_handler(struct it6505 *it6505,
+ const u8 *int_status)
{
struct device *dev = it6505->dev;
int reg_0d, reg_int03;
@@ -2655,11 +2656,9 @@ static void it6505_irq_video_handler(struct it6505 *it6505, const int *int_statu
*/
if ((!it6505_get_video_status(it6505) &&
- (it6505_test_bit(INT_SCDT_CHANGE, (unsigned int *)int_status))) ||
- (it6505_test_bit(BIT_INT_IO_FIFO_OVERFLOW,
- (unsigned int *)int_status)) ||
- (it6505_test_bit(BIT_INT_VID_FIFO_ERROR,
- (unsigned int *)int_status))) {
+ (it6505_test_bit(INT_SCDT_CHANGE, int_status))) ||
+ (it6505_test_bit(BIT_INT_IO_FIFO_OVERFLOW, int_status)) ||
+ (it6505_test_bit(BIT_INT_VID_FIFO_ERROR, int_status))) {
it6505->auto_train_retry = AUTO_TRAIN_RETRY;
flush_work(&it6505->link_works);
it6505_stop_hdcp(it6505);
@@ -2684,7 +2683,7 @@ static void it6505_irq_video_handler(struct it6505 *it6505, const int *int_statu
return;
}
- if (it6505_test_bit(INT_SCDT_CHANGE, (unsigned int *)int_status))
+ if (it6505_test_bit(INT_SCDT_CHANGE, int_status))
it6505_irq_scdt(it6505);
}
@@ -2705,35 +2704,37 @@ static irqreturn_t it6505_int_threaded_handler(int unused, void *data)
{ BIT_INT_AUDIO_FIFO_ERROR, it6505_irq_audio_fifo_error },
{ BIT_INT_LINK_TRAIN_FAIL, it6505_irq_link_train_fail },
};
- int int_status[3], i;
+ u8 int_status[3];
+ int i;
if (it6505->enable_drv_hold || !it6505->powered)
return IRQ_HANDLED;
pm_runtime_get_sync(dev);
- int_status[0] = it6505_read(it6505, INT_STATUS_01);
- int_status[1] = it6505_read(it6505, INT_STATUS_02);
- int_status[2] = it6505_read(it6505, INT_STATUS_03);
+ if (regmap_bulk_read(it6505->regmap, INT_STATUS_01, int_status,
+ ARRAY_SIZE(int_status))) {
+ pm_runtime_put_sync(dev);
+ return IRQ_NONE;
+ }
- it6505_write(it6505, INT_STATUS_01, int_status[0]);
- it6505_write(it6505, INT_STATUS_02, int_status[1]);
- it6505_write(it6505, INT_STATUS_03, int_status[2]);
+ regmap_bulk_write(it6505->regmap, INT_STATUS_01, int_status,
+ ARRAY_SIZE(int_status));
DRM_DEV_DEBUG_DRIVER(dev, "reg06 = 0x%02x", int_status[0]);
DRM_DEV_DEBUG_DRIVER(dev, "reg07 = 0x%02x", int_status[1]);
DRM_DEV_DEBUG_DRIVER(dev, "reg08 = 0x%02x", int_status[2]);
it6505_debug_print(it6505, REG_SYSTEM_STS, "");
- if (it6505_test_bit(irq_vec[0].bit, (unsigned int *)int_status))
+ if (it6505_test_bit(irq_vec[0].bit, int_status))
irq_vec[0].handler(it6505);
if (it6505->hpd_state) {
for (i = 1; i < ARRAY_SIZE(irq_vec); i++) {
- if (it6505_test_bit(irq_vec[i].bit, (unsigned int *)int_status))
+ if (it6505_test_bit(irq_vec[i].bit, int_status))
irq_vec[i].handler(it6505);
}
- it6505_irq_video_handler(it6505, (unsigned int *)int_status);
+ it6505_irq_video_handler(it6505, int_status);
}
pm_runtime_put_sync(dev);
--
2.56.1
next prev parent reply other threads:[~2026-11-20 0:03 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 23:58 [PATCH v9 00/14] drm/bridge: it6505: DP audio support + shared-DAI hw_params fix Daniel Golle
2026-11-19 23:58 ` [PATCH v9 01/14] drm/bridge: it6505: quiesce event sources and work on remove() Daniel Golle
2026-11-19 23:59 ` [PATCH v9 02/14] drm/bridge: it6505: quiesce work items before powering off Daniel Golle
2026-11-19 23:59 ` [PATCH v9 03/14] drm/bridge: it6505: balance and disable runtime PM on remove Daniel Golle
2026-11-19 23:59 ` [PATCH v9 04/14] drm/bridge: it6505: unregister DP AUX adapter on bridge detach Daniel Golle
2026-11-19 23:59 ` [PATCH v9 05/14] drm/bridge: it6505: complete poweroff even if disabling regulators fails Daniel Golle
2026-11-20 0:02 ` Daniel Golle [this message]
2026-11-20 0:03 ` [PATCH v9 07/14] drm/bridge: it6505: avoid division by zero in pixel clock calculation Daniel Golle
2026-11-20 0:03 ` [PATCH v9 08/14] drm/bridge: it6505: drop the audio input FS debug print Daniel Golle
2026-11-20 0:04 ` [PATCH v9 09/14] drm/bridge: it6505: guard against zero channel count in audio infoframe Daniel Golle
2026-11-20 0:04 ` [PATCH v9 10/14] drm/bridge: it6505: hold endpoint OF node reference while parsing it Daniel Golle
2026-11-20 0:05 ` [PATCH v9 11/14] drm/bridge: it6505: reject a too short link-frequencies property Daniel Golle
2026-11-20 0:05 ` [PATCH v9 12/14] drm/bridge: it6505: don't write an error code back to the reset register Daniel Golle
2026-11-20 0:06 ` [PATCH v9 13/14] drm/bridge: it6505: Add audio support Daniel Golle
2026-11-20 0:06 ` [PATCH v9 14/14] drm/bridge: it6505: Don't reject audio hw_params without an encoder Daniel Golle
2026-11-20 0:12 ` [PATCH v9 00/14] drm/bridge: it6505: DP audio support + shared-DAI hw_params fix Daniel Golle
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=ce2a90cbb7a9de693d0b260dcc90572a473c9aab.1795132452.git.daniel@makrotopia.org \
--to=daniel@makrotopia.org \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=hermes.wu@ite.com.tw \
--cc=jernej.skrabec@gmail.com \
--cc=jiaxin.yu@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=luca.ceresoli@bootlin.com \
--cc=lumag@kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=matthias.bgg@gmail.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=rfoss@kernel.org \
--cc=simona@ffwll.ch \
--cc=treapking@chromium.org \
--cc=tzimmermann@suse.de \
--cc=wenst@chromium.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
all inboxes | Powered by JetHome®