From patchwork Fri Feb 16 11:25:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jyri Sarha X-Patchwork-Id: 128543 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp453530ljc; Fri, 16 Feb 2018 03:25:34 -0800 (PST) X-Google-Smtp-Source: AH8x225x8R4dCAudgNp6WvGFphcTyz25ibyps7HWj/jcTQG/nLbO7c8663R8EvUR+isWbef7jYHr X-Received: by 2002:a17:902:6b82:: with SMTP id p2-v6mr5678799plk.30.1518780334795; Fri, 16 Feb 2018 03:25:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518780334; cv=none; d=google.com; s=arc-20160816; b=VI/CovWv38Aam261Ck4F/v1+lit4g/wvsIQoi1ggyWT5ag9icdOFmxpjLBwo80mHDN PwuG3/F638zYwtvuw1Ib0v2H/jo4MTgc4fBMebpD06gjRS4NKKmVLa8BiV5IKh+ak5S7 ALMLXwWIza/pDWcwZdTplJ4/biGcl+TpbGW6RzEwXYue3Hy8FaUHMpxybQs74qLvIfeL GCFRgHj3uEPhAeM5y+/E1guvRHXKLfySVdZoG9fJ7A+5j0WaLfaJrTAtrvvdW6UpM12y jJ8RIJtkUVHFKa/kjBYCz9PAILjMUw4+J2azYIxiclxsAld8dalJC47pvVJnHbnhkYS6 nSNA== 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:dkim-signature:delivered-to :arc-authentication-results; bh=7wo96fC5zptCbZmclUB8FzueYwZVWMaXogEKnO9KSsk=; b=n6awT0mEUYvYjGPouIyFen0OTLJtivIXv1ympuVxAc2Jf+Klxyu4LgaNLcCjV7U7cl 7n9ch2V4k0ymWHtGIQkF7l+AHJ9Avbl3LsBn+N2kKngR+tqQCRuVnWoo0l0XFc4SJ+SU uXazHAhavlC0WbzcvsJjquh2uzhd5YVxWyRKhgetiR9ZuioPVywuC0YFb26cdaen7OV5 RJixpxP/OOVZfg87KNxFnY8/Eet8IIZXwf5t4aLd5XqyBp01OVnXkDWrn2LTz3QsOxXg owun/6smKd8NntUIhtgFT+WwtBdPmLlvKZuvrFA8byzXDptUdr9rX5HQInmOX6+Qu65q mwjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=ILPgcUCE; 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 s25si5231412pge.187.2018.02.16.03.25.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Feb 2018 03:25:34 -0800 (PST) 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; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=ILPgcUCE; 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 513F56E61B; Fri, 16 Feb 2018 11:25:28 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllnx210.ext.ti.com (fllnx210.ext.ti.com [198.47.19.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 59E666E616 for ; Fri, 16 Feb 2018 11:25:25 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1GBPNg6025118; Fri, 16 Feb 2018 05:25:23 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518780323; bh=SMNAYBhS64O83tv4lPoULUTVPbYis39Sp508ptFT4mo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ILPgcUCEAg2SWlxDVwCxj4HKHUwx9K/sgosO22HICTlSDljPVEo0gVXRP1yhG2Eks SRXW6PzlMNZbR4Ym6vDTPf5Wwj3rILNIjDUAj9tQV46P+IEEVmmY3N0maOeGtNtXh6 SXP5QwM6opFB7e8E4IOLE+GF1ik/byM3H2x4taLk= Received: from DFLE106.ent.ti.com (dfle106.ent.ti.com [10.64.6.27]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1GBPNS3003681; Fri, 16 Feb 2018 05:25:23 -0600 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Fri, 16 Feb 2018 05:25:22 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Fri, 16 Feb 2018 05:25:22 -0600 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 w1GBPCii028841; Fri, 16 Feb 2018 05:25:21 -0600 From: Jyri Sarha To: , , Subject: [PATCH RFC 6/9] drm/omap: dss: Move platform_device_register from core.c to dss.c probe Date: Fri, 16 Feb 2018 13:25:07 +0200 Message-ID: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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: Jyri Sarha Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Register the omapdrm device when we know that dss device probe going to succeed. This avoids DSS6 and DSS2 omapdrm device registration from colliding with each other. Signed-off-by: Jyri Sarha --- drivers/gpu/drm/omapdrm/dss/core.c | 26 ++------------------------ drivers/gpu/drm/omapdrm/dss/dss.c | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/core.c b/drivers/gpu/drm/omapdrm/dss/core.c index acef7ec..6c9f667 100644 --- a/drivers/gpu/drm/omapdrm/dss/core.c +++ b/drivers/gpu/drm/omapdrm/dss/core.c @@ -45,36 +45,14 @@ static struct platform_driver * const omap_dss_drivers[] = { #endif }; -static struct platform_device *omap_drm_device; - static int __init omap_dss_init(void) { - int r; - - r = platform_register_drivers(omap_dss_drivers, - ARRAY_SIZE(omap_dss_drivers)); - if (r) - goto err_reg; - - omap_drm_device = platform_device_register_simple("omapdrm", 0, NULL, 0); - if (IS_ERR(omap_drm_device)) { - r = PTR_ERR(omap_drm_device); - goto err_reg; - } - - return 0; - -err_reg: - platform_unregister_drivers(omap_dss_drivers, - ARRAY_SIZE(omap_dss_drivers)); - - return r; + return platform_register_drivers(omap_dss_drivers, + ARRAY_SIZE(omap_dss_drivers)); } static void __exit omap_dss_exit(void) { - platform_device_unregister(omap_drm_device); - platform_unregister_drivers(omap_dss_drivers, ARRAY_SIZE(omap_dss_drivers)); } diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c index 5752328..dda3237 100644 --- a/drivers/gpu/drm/omapdrm/dss/dss.c +++ b/drivers/gpu/drm/omapdrm/dss/dss.c @@ -1314,6 +1314,17 @@ static const struct soc_device_attribute dss_soc_devices[] = { { /* sentinel */ } }; +static struct platform_device *omap_drm_device; + +static int initialize_omapdrm_device(void) +{ + omap_drm_device = platform_device_register_simple("omapdrm", 0, NULL, 0); + if (IS_ERR(omap_drm_device)) + return PTR_ERR(omap_drm_device); + + return 0; +} + static int dss_bind(struct device *dev) { struct dss_device *dss = dev_get_drvdata(dev); @@ -1323,6 +1334,12 @@ static int dss_bind(struct device *dev) if (r) return r; + r = initialize_omapdrm_device(); + if (r) { + component_unbind_all(dev, NULL); + return r; + } + pm_set_vt_switch(0); omapdss_gather_components(dev); @@ -1335,6 +1352,8 @@ static void dss_unbind(struct device *dev) { omapdss_set_dss(NULL); + platform_device_unregister(omap_drm_device); + component_unbind_all(dev, NULL); }