From patchwork Wed May 30 09:43:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 10438041 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A3AC5602CC for ; Wed, 30 May 2018 09:44:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 91D8C28898 for ; Wed, 30 May 2018 09:44:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 853D1288F1; Wed, 30 May 2018 09:44:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2453C2888B for ; Wed, 30 May 2018 09:44:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=kc4REN9HG/5bxLIwUPTPL3i2wqgdbY0S6gYXu5IPf4g=; b=BeW vuX8wWoXlsVhUDgXWj3UJnf5/b0FKm4LIK/1bB822aAwKY3VSVomWwhzo0Xi3RSqvC851w0m3tnM+ b+Y9QnZP6fXzDsuhI3w05+7/ufB9tF9doQEU3WAEAFGi55GqIoI1juz2g7fTcS1i+nOzlDvWFC4dA 3FYziI76iW6lL1VwC0vXUBfJaBSHqcL1T8mM2dk2bD0NZoYcmmzhn9ggvRm5LmmyM4aLaJAtMvLsF ad7Dmtqf6l39Rif1ZOAxLqUytXJVzvMQv97h3+yaemMSvu+zLF4kNxG4NeKYh0YmTZ4rm58oD7Mof dAaq9IY2BiQP7+uFJ1yP7sqU+ykLsIw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fNxea-0006J9-QO; Wed, 30 May 2018 09:44:24 +0000 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fNxeQ-0006CA-C0 for linux-arm-kernel@lists.infradead.org; Wed, 30 May 2018 09:44:18 +0000 Received: by mail-wr0-x242.google.com with SMTP id 94-v6so28809410wrf.5 for ; Wed, 30 May 2018 02:44:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=WTx2LYIONvvv+6i2Jq2cMpW30+S6nBMV/wBCGZQHiK4=; b=fp3bgK0r2CU/3ClXwNb8NlULAw30cjtTam8Don0EVyKAx9rwqINu2lZz315FV4Ta7+ 3AwgfXb+7I0NmNXfKAAhSwQStWKVF49E39cCHTDiOtf54ci/qFaFakUP2YYHeN2171lJ TigXhAcefF3ck9vEMK822yTrQsH3fdCs/r0NuG6ML2vr3iyXnN8VfF1gnjBAAZTzS+kN BC4tHVyIllhh0/fzo26pTgpkhCGopfZjqdSq+1+UeOAPZ7I+xlvaI9RrmdjeaKsR+elv kdYhHKIMQlDPOfoNgKlLl9LWnB37wIzoNvbBvUJfL/yUv2mdjj4hGxGxNRV4iPuX4yq/ vksg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=WTx2LYIONvvv+6i2Jq2cMpW30+S6nBMV/wBCGZQHiK4=; b=BB+K1GLDYuVK2Vg93yPH+CpcUJmppZRnSknzbm0U3Fe2bI0VFeQrrcbzs3E1BUd1ea 1Z9kr5ak53wnI4dSrMdfuc4Np2pp3Gz+xxZMYnkuUBms9cF3mXgG73UjvpVzG0hVMLtO N2RW0o9nn258joel7/axk3JvEPUKqS37g7+/m3yCxZQWp8Bp1HXP1ZlO9ob425tTVins OMomaGVk9SiRj6MEPjUvo5l0kg7rcG0Lv1yzp0Fr3O3DFtCX+CdtVs++flfBvpoIKDq7 a8NOcA3cE/ubXT0xzb/d6bJ/LaoWY458IqC1F4HqpLYlH4xpfN9aUMAa5kP50vwMY/RH Dhkw== X-Gm-Message-State: ALKqPwcIbl9hfVcQUqQW5ybAVoQ/wTM19i/x9AtRJBtAGI5Knc/9IoDg OisJKtnnbSh16HsXUy667iO2Kg== X-Google-Smtp-Source: ADUXVKLoEZGOmGvNy3Jmo1zoiQOVEtIExYi8eJgyLLo3FYkPy10+FqXOhKDeqMDqaF1YGqzRI5BgPA== X-Received: by 2002:adf:9025:: with SMTP id h34-v6mr1611275wrh.123.1527673440863; Wed, 30 May 2018 02:44:00 -0700 (PDT) Received: from bender.baylibre.local ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id b15-v6sm31000437wri.14.2018.05.30.02.43.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 May 2018 02:44:00 -0700 (PDT) From: Neil Armstrong To: architt@codeaurora.org, a.hajda@samsung.com, jernej.skrabec@siol.net Subject: [PATCH] drm/bridge/synopsys: dw-hdmi: fix dw_hdmi_setup_rx_sense Date: Wed, 30 May 2018 11:43:58 +0200 Message-Id: <1527673438-20643-1-git-send-email-narmstrong@baylibre.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180530_024414_597327_B37A5558 X-CRM114-Status: GOOD ( 13.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, Neil Armstrong MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The dw_hdmi_setup_rx_sense exported function should not use struct device to recover the dw-hdmi context using drvdata, but take struct dw_hdmi directly like other exported functions. This caused a regression using Meson DRM on S905X since v4.17-rc1 : Internal error: Oops: 96000007 [#1] PREEMPT SMP [...] CPU: 0 PID: 124 Comm: irq/32-dw_hdmi_ Not tainted 4.17.0-rc7 #2 Hardware name: Libre Technology CC (DT) [...] pc : osq_lock+0x54/0x188 lr : __mutex_lock.isra.0+0x74/0x530 [...] Process irq/32-dw_hdmi_ (pid: 124, stack limit = 0x00000000adf418cb) Call trace: osq_lock+0x54/0x188 __mutex_lock_slowpath+0x10/0x18 mutex_lock+0x30/0x38 __dw_hdmi_setup_rx_sense+0x28/0x98 dw_hdmi_setup_rx_sense+0x10/0x18 dw_hdmi_top_thread_irq+0x2c/0x50 irq_thread_fn+0x28/0x68 irq_thread+0x10c/0x1a0 kthread+0x128/0x130 ret_from_fork+0x10/0x18 Code: 34000964 d00050a2 51000484 9135c042 (f864d844) ---[ end trace 945641e1fbbc07da ]--- note: irq/32-dw_hdmi_[124] exited with preempt_count 1 genirq: exiting task "irq/32-dw_hdmi_" (124) is an active IRQ thread (irq 32) Fixes: eea034af90c6 ("drm/bridge/synopsys: dw-hdmi: don't clobber drvdata") Signed-off-by: Neil Armstrong Tested-by: Koen Kooi Reviewed-by: Archit Taneja --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 15 ++++----------- drivers/gpu/drm/meson/meson_dw_hdmi.c | 2 +- include/drm/bridge/dw_hdmi.h | 2 +- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index ec8d000..3c136f2b 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2077,7 +2077,7 @@ static irqreturn_t dw_hdmi_hardirq(int irq, void *dev_id) return ret; } -void __dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense) +void dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense) { mutex_lock(&hdmi->mutex); @@ -2103,13 +2103,6 @@ void __dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense) } mutex_unlock(&hdmi->mutex); } - -void dw_hdmi_setup_rx_sense(struct device *dev, bool hpd, bool rx_sense) -{ - struct dw_hdmi *hdmi = dev_get_drvdata(dev); - - __dw_hdmi_setup_rx_sense(hdmi, hpd, rx_sense); -} EXPORT_SYMBOL_GPL(dw_hdmi_setup_rx_sense); static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) @@ -2145,9 +2138,9 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) */ if (intr_stat & (HDMI_IH_PHY_STAT0_RX_SENSE | HDMI_IH_PHY_STAT0_HPD)) { - __dw_hdmi_setup_rx_sense(hdmi, - phy_stat & HDMI_PHY_HPD, - phy_stat & HDMI_PHY_RX_SENSE); + dw_hdmi_setup_rx_sense(hdmi, + phy_stat & HDMI_PHY_HPD, + phy_stat & HDMI_PHY_RX_SENSE); if ((phy_stat & (HDMI_PHY_RX_SENSE | HDMI_PHY_HPD)) == 0) cec_notifier_set_phys_addr(hdmi->cec_notifier, diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c index a393095..c9ad456 100644 --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c @@ -529,7 +529,7 @@ static irqreturn_t dw_hdmi_top_thread_irq(int irq, void *dev_id) if (stat & HDMITX_TOP_INTR_HPD_RISE) hpd_connected = true; - dw_hdmi_setup_rx_sense(dw_hdmi->dev, hpd_connected, + dw_hdmi_setup_rx_sense(dw_hdmi->hdmi, hpd_connected, hpd_connected); drm_helper_hpd_irq_event(dw_hdmi->encoder.dev); diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h index dd2a8cf..ccb5aa8 100644 --- a/include/drm/bridge/dw_hdmi.h +++ b/include/drm/bridge/dw_hdmi.h @@ -151,7 +151,7 @@ struct dw_hdmi *dw_hdmi_bind(struct platform_device *pdev, struct drm_encoder *encoder, const struct dw_hdmi_plat_data *plat_data); -void dw_hdmi_setup_rx_sense(struct device *dev, bool hpd, bool rx_sense); +void dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense); void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate); void dw_hdmi_audio_enable(struct dw_hdmi *hdmi);