From patchwork Thu Aug 29 20:00:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 172652 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp2717772ily; Thu, 29 Aug 2019 13:00:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqymV0N8kyUGH+1um+QWHaGFEYGQobUrmu8gL5xq5gmppmZYatqb67vWNr3+gV1PrydBzVYJ X-Received: by 2002:a17:902:26f:: with SMTP id 102mr12159446plc.189.1567108812573; Thu, 29 Aug 2019 13:00:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567108812; cv=none; d=google.com; s=arc-20160816; b=z/I+C3bZ2Oe0QsrKqIMr/BU9iCv32K+enA0rNkEH3C6b0MYWaB2oJo/oXMV3NiNgQg h/q7rQS1lHoZBktVPYl/dfTRmvvRLXyGSnYFIY0u54zuFPdtcT/MiknCGfdu4ryw5b/2 R394CKHj+k0BnZOYBf2FYsKtbweq4CLthe1bN3nKcza5wgokUIo/MTxv8pyf0TbrjITo 8z9FYvlaPfvvjqOfSGBYSUcPNAt1DS+clqijIH8QuKzGos8ojfaWdg+HlXCKvV2XbS9+ GXpr+vrpK6LVeOKtxuY10GfxN/TWYXeL0CZZcwXbVb8+yU5KMqHshTYf3T+LndPMOb0D XmmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=LnwOSHW+qkIfwX+CEo6pre2vAtIHSJHM7Ipb0uTKcN8=; b=1KMhgf9YoHhQthIzXHuTvfJFWAwXUnWw7/lFBGX1N8Kq3WJJ/oShyxN+PFr4KnUXgX DZfzIRR9PqiPtFgtLh+DjH3OOG5yjYsviLylgekGR914q9/r3w70i12MosOltxGX1xLE irlNeOpaSXSo+RkQ+Kz0rn2kCrPNgoJErPf0cdn29Um83xzcVHq6EzyWWRMHqp3ZoWnI I7tbpAlOvmF7OnKGPYQdlbywVUyZplgq3xOPd/FuRq40DaiAsF4Ml1gII8c+B7cme/Nf XI2Dpxa4PLuORNwD/DpvtBRjBjb3JCIgb//1jiV7T0eE3mgksJKTZ7bieOBw35npPTQA Qxvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ljvhUTB5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v184si3842299pfc.90.2019.08.29.13.00.12; Thu, 29 Aug 2019 13:00:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ljvhUTB5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728187AbfH2UAL (ORCPT + 28 others); Thu, 29 Aug 2019 16:00:11 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:39964 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728116AbfH2UAJ (ORCPT ); Thu, 29 Aug 2019 16:00:09 -0400 Received: by mail-pl1-f193.google.com with SMTP id h3so2080447pls.7 for ; Thu, 29 Aug 2019 13:00:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LnwOSHW+qkIfwX+CEo6pre2vAtIHSJHM7Ipb0uTKcN8=; b=ljvhUTB5kgie6mZn/Katfok8X2WrFwgXFmGKAsJBCEExxJK+Nxf6/5JnDHhk1LxGzy GYRAppVUeZ1sd1GoWZIlw7jgdNHty21ipU5Xwbsjv2pDu76zTUuu2M0TYKjBIGiG+5/U z01+UGUU35QOWpFRzt7fPcfbQ99aFBb2fmxT0/oIwQsg9/ldDduJhzRqeDTeL/2cT+fn xZEkAhbQh16HdO3N3dLit2heuBIRhD2aWB6bocU4JidBTKhPZUvGLVHHMbcSP5Om8Rkn fjF4IfC7pe9zuVYT61BgDPYNoG1OUc1oLDYMoO1xaeTde3LKzueqjrs2vOyE7CXBh8Pc jvRQ== 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:in-reply-to :references; bh=LnwOSHW+qkIfwX+CEo6pre2vAtIHSJHM7Ipb0uTKcN8=; b=joRug1EdC34Qk69nMtL1a3jtw1mgJspAXsmXppBagAssm8/ZHtcZ2gxr4Z3i7q3RYv q9HncXAGo8/MYjcYV0XUl+ndXVLjZCI072owmUzX9rimpPNqcaRYqTe6yFHpABXxNPt8 PjgvMWKoaVmb18d/2pq6qg0J/7mp2EhaMyTeVsCVFpfyo2dLRtB8kLwJ3cE5WRaE96u4 NcI/6P7PM1xKe4BSU1py9LHlDC11+hZh4KX4TAS5fOhubLCTcz6u79ZvhyXdo6x+sv14 HYbS8GZ6f9GtvUGOIykGUbAijWlgHXRVmfCuCX/stZxCgB47adGXWY36e04OYwVA6VNl biIA== X-Gm-Message-State: APjAAAVb82oCQTA1dAxgrDrbp4McdattkPqu1CpuuzQDRdq0ybimRW2v 1SbLKFWGmOu6NbNtcvJk/mOPCw== X-Received: by 2002:a17:902:9a07:: with SMTP id v7mr12015218plp.245.1567108808730; Thu, 29 Aug 2019 13:00:08 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id u7sm3053766pgr.94.2019.08.29.13.00.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 13:00:08 -0700 (PDT) From: Mathieu Poirier To: stable@vger.kernel.org Cc: architt@codeaurora.org, a.hajda@samsung.com, Laurent.pinchart@ideasonboard.com, airlied@linux.ie, jsarha@ti.com, tomi.valkeinen@ti.com, vinholikatti@gmail.com, jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org Subject: [BACKPORT 4.19.y 3/3] drm/tilcdc: Register cpufreq notifier after we have initialized crtc Date: Thu, 29 Aug 2019 14:00:01 -0600 Message-Id: <20190829200001.17092-4-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190829200001.17092-1-mathieu.poirier@linaro.org> References: <20190829200001.17092-1-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jyri Sarha commit 432973fd3a20102840d5f7e61af9f1a03c217a4c upstream Register cpufreq notifier after we have initialized the crtc and unregister it before we remove the ctrc. Receiving a cpufreq notify without crtc causes a crash. Reported-by: Peter Ujfalusi Signed-off-by: Jyri Sarha Signed-off-by: Mathieu Poirier --- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 34 ++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index 0fb300d41a09..e1868776da25 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c @@ -184,6 +184,12 @@ static void tilcdc_fini(struct drm_device *dev) { struct tilcdc_drm_private *priv = dev->dev_private; +#ifdef CONFIG_CPU_FREQ + if (priv->freq_transition.notifier_call) + cpufreq_unregister_notifier(&priv->freq_transition, + CPUFREQ_TRANSITION_NOTIFIER); +#endif + if (priv->crtc) tilcdc_crtc_shutdown(priv->crtc); @@ -198,12 +204,6 @@ static void tilcdc_fini(struct drm_device *dev) drm_mode_config_cleanup(dev); tilcdc_remove_external_device(dev); -#ifdef CONFIG_CPU_FREQ - if (priv->freq_transition.notifier_call) - cpufreq_unregister_notifier(&priv->freq_transition, - CPUFREQ_TRANSITION_NOTIFIER); -#endif - if (priv->clk) clk_put(priv->clk); @@ -274,17 +274,6 @@ static int tilcdc_init(struct drm_driver *ddrv, struct device *dev) goto init_failed; } -#ifdef CONFIG_CPU_FREQ - priv->freq_transition.notifier_call = cpufreq_transition; - ret = cpufreq_register_notifier(&priv->freq_transition, - CPUFREQ_TRANSITION_NOTIFIER); - if (ret) { - dev_err(dev, "failed to register cpufreq notifier\n"); - priv->freq_transition.notifier_call = NULL; - goto init_failed; - } -#endif - if (of_property_read_u32(node, "max-bandwidth", &priv->max_bandwidth)) priv->max_bandwidth = TILCDC_DEFAULT_MAX_BANDWIDTH; @@ -361,6 +350,17 @@ static int tilcdc_init(struct drm_driver *ddrv, struct device *dev) } modeset_init(ddev); +#ifdef CONFIG_CPU_FREQ + priv->freq_transition.notifier_call = cpufreq_transition; + ret = cpufreq_register_notifier(&priv->freq_transition, + CPUFREQ_TRANSITION_NOTIFIER); + if (ret) { + dev_err(dev, "failed to register cpufreq notifier\n"); + priv->freq_transition.notifier_call = NULL; + goto init_failed; + } +#endif + if (priv->is_componentized) { ret = component_bind_all(dev, ddev); if (ret < 0)