From patchwork Fri Mar 15 13:05:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jyri Sarha X-Patchwork-Id: 160418 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp16740562jad; Fri, 15 Mar 2019 06:06:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqxfPU3D+70ax46XV1bGNCeis408O4aUTnEysvA/RL8zxe1JJD6YouLlzKnihlhnMFvNA9zE X-Received: by 2002:a63:4563:: with SMTP id u35mr3317825pgk.417.1552655168260; Fri, 15 Mar 2019 06:06:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552655168; cv=none; d=google.com; s=arc-20160816; b=FTn89zpZrnOebpiAb+1bbZB0UowjzW2WsZzaEcKYFDziWK1KKjctSQysq1heW/ioI3 hScfhvZi1qQ8tk8/Qp8/+UXLKgK19Hjm9PQgL0DlEpZvjFDzfxVWUhFKtnnkjTP6yNsj 1vTBFdMrj9bbJ8oI3KkxD1yVLhekwAyz0P+J6SIc1l3FVW9E0K6TVjhO5GARjht3aJol KLZLrCZffygJg7CuJt5vkNprtJlXJJLdJX+hGwHnx+4ztgIhXRXCeC5XDNzgU2Oqum1L rkYoT0QTheaDFTIqh3s2JeYXekuJ9noPgPQFy2kTcaerXKLkOA0ic/Q3E21vpiJ+sgHB YXIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:delivered-to; bh=NjKgToec6OAZ3zEtjZ26wvRLkfcNzF1uvELAYruGZo4=; b=eqFPjusNxgkNC5SVJ6IizExXsD/R13SORTydXqgVL65RabPyQpTUwm5r/ZWB76ynUL WpMgithvsDsQNylT5qXNo0Cl882JGMm5qrGaQOKZgqTlg2CDJO/hSSjWUpUZG9qcNJHu pEyemvpU7dwWADOZabp2FdZkYFyA1+oBkUGzSL0gnRPB8FJo+kmDregutznmmVPnog0d yyQL+VNAr6CsVidKxskStZ+zJHsfJUuk2/8mwj8PVXkGANdFacFdoGWLwMXEJ1OZwewn FMmppVY2eSqjHBLri7DPU4Pf8sIbD32WUjC1M6WU9SWAJdC0jALr/YSwh/NUbW/o2P4W iDBw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id 75si1783860pgb.230.2019.03.15.06.06.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Mar 2019 06:06:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1331F6E405; Fri, 15 Mar 2019 13:06:06 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3B99F6E405 for ; Fri, 15 Mar 2019 13:06:05 +0000 (UTC) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x2FD61DY128571; Fri, 15 Mar 2019 08:06:01 -0500 Received: from DFLE102.ent.ti.com (dfle102.ent.ti.com [10.64.6.23]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2FD618q014250 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 15 Mar 2019 08:06:01 -0500 Received: from DFLE102.ent.ti.com (10.64.6.23) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Fri, 15 Mar 2019 08:05:59 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1713.5 via Frontend Transport; Fri, 15 Mar 2019 08:05:59 -0500 Received: from jadmar.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id x2FD5vIY028090; Fri, 15 Mar 2019 08:05:58 -0500 From: Jyri Sarha To: Subject: [PATCH v2 1/1] drm/tilcdc: Register cpufreq notifier after we have initialized crtc Date: Fri, 15 Mar 2019 15:05:57 +0200 Message-ID: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1552655161; bh=+HUyvm/WevxOU8ETd0LTh1NnqpY4AxNshKM2RJ98cUE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=W4/R4GhJ3iJs4KkCoM+aEguy1jV0GaMfP/6TS2CxEV9ecgdVRS0bJGtg3n4scxUD9 ekkNqfobkAxMoAMYiIyqoC8oomP8Jj0DFmwup4CqpVX2QYeDTIknDJ2/SCZqJFVb6t IyamKNshySl0cdOLarJWvIh8TbCTpOxcSuvwZsSg= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.ujfalusi@ti.com, tomi.valkeinen@ti.com, laurent.pinchart@ideasonboard.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- Couple of minor changes: - Add forgotten Reported-by: - While moving cpufreq_register_notifier-call, fix indentation to dim's liking drivers/gpu/drm/tilcdc/tilcdc_drv.c | 34 ++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index 36fd05b145a4..a5d5d5ae3287 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c @@ -183,6 +183,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); @@ -193,12 +199,6 @@ static void tilcdc_fini(struct drm_device *dev) drm_irq_uninstall(dev); drm_mode_config_cleanup(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); @@ -269,17 +269,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; @@ -356,6 +345,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)