From patchwork Tue Oct 26 00:00:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12583587 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9259AC43217 for ; Tue, 26 Oct 2021 00:01:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7CFCA6105A for ; Tue, 26 Oct 2021 00:01:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235857AbhJZADn (ORCPT ); Mon, 25 Oct 2021 20:03:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235671AbhJZADX (ORCPT ); Mon, 25 Oct 2021 20:03:23 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06F36C061227 for ; Mon, 25 Oct 2021 17:01:00 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id q187so12309526pgq.2 for ; Mon, 25 Oct 2021 17:01:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xbBIA2S7VMXOXCQu3Vr82oQpSXn2i51a0ZJRtaPISIs=; b=IFB7bXnzVvlVX81TcMP9+qq+2LS6XC8kvLUolA0a9EiVRRhI9h5HOH8CYlQMBkyZtF w1M1dJ4099haRG17Kbgw/c/Hsi08G5NXG224TvF1tLfU6uN4bQCMLs9fL2cgkX0PsshI WqofS2DtMsrWBcKMWVeAUZkp00CFd7c/5aFXk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xbBIA2S7VMXOXCQu3Vr82oQpSXn2i51a0ZJRtaPISIs=; b=EBHVEbr0GyCipzIrQdXfHJTQ16jJYeq3gBOTWzqtz+1xkcA9ZLapEm5tyZUDSqVGHP Zn2mBvRinaFD2nFH9w64Qudb+VpDwpPPlxQCKgaLMS6gorXeL3J0RXN/7olVWtAeeyRk 3tf6kzM10svix1+4FsnllPrJlqCH9wz5S3BxIFwd8vvbaNMKDIdexS2eR0+B9Xhy/dGj cs7bqricsoBTBgq06B3NXn3/gZH1ul1fGn6a9vZu3A43XxlMrmrSdINexc8ifu8kkozP Hx0CBLkxYqpw4YQygrM6JVPHiyDlX8xQF8TXq7+ld2obKsh2RBQfwccY4tNHtBL7g+K9 ydEw== X-Gm-Message-State: AOAM531Vo7N9zaLs4YPFWl/mQYbBqZcgLENXjfGI3nG1N5xfiwYe1ri0 mZJvfYNW8RyvxX1Jp4HPMa4vFw== X-Google-Smtp-Source: ABdhPJy63RfcmCTa6T5K9FSh3Xplj6tXo3FnRfv91xfWXns90oFaTHq8SBpUXMcbH2vqEPmjKkOotA== X-Received: by 2002:a63:230c:: with SMTP id j12mr16437201pgj.1.1635206459577; Mon, 25 Oct 2021 17:00:59 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:f5e3:5eb1:d5ee:6893]) by smtp.gmail.com with ESMTPSA id b7sm9900747pfm.28.2021.10.25.17.00.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Oct 2021 17:00:59 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Philipp Zabel , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v3 15/34] drm/imx: Migrate to aggregate driver Date: Mon, 25 Oct 2021 17:00:25 -0700 Message-Id: <20211026000044.885195-16-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.1079.g6e70778dc9-goog In-Reply-To: <20211026000044.885195-1-swboyd@chromium.org> References: <20211026000044.885195-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Philipp Zabel Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/imx/imx-drm-core.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c index 9558e9e1b431..dbf5cca5201d 100644 --- a/drivers/gpu/drm/imx/imx-drm-core.c +++ b/drivers/gpu/drm/imx/imx-drm-core.c @@ -198,8 +198,9 @@ static int compare_of(struct device *dev, void *data) return dev->of_node == np; } -static int imx_drm_bind(struct device *dev) +static int imx_drm_bind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct drm_device *drm; int ret; @@ -266,8 +267,9 @@ static int imx_drm_bind(struct device *dev) return ret; } -static void imx_drm_unbind(struct device *dev) +static void imx_drm_unbind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct drm_device *drm = dev_get_drvdata(dev); drm_dev_unregister(drm); @@ -281,14 +283,18 @@ static void imx_drm_unbind(struct device *dev) dev_set_drvdata(dev, NULL); } -static const struct component_master_ops imx_drm_ops = { - .bind = imx_drm_bind, - .unbind = imx_drm_unbind, +static struct aggregate_driver imx_drm_aggregate_driver = { + .probe = imx_drm_bind, + .remove = imx_drm_unbind, + .driver = { + .name = "imx_drm", + .owner = THIS_MODULE, + }, }; static int imx_drm_platform_probe(struct platform_device *pdev) { - int ret = drm_of_component_probe(&pdev->dev, compare_of, &imx_drm_ops); + int ret = drm_of_aggregate_probe(&pdev->dev, compare_of, &imx_drm_aggregate_driver); if (!ret) ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); @@ -298,7 +304,7 @@ static int imx_drm_platform_probe(struct platform_device *pdev) static int imx_drm_platform_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &imx_drm_ops); + component_aggregate_unregister(&pdev->dev, &imx_drm_aggregate_driver); return 0; }