From patchwork Thu Jan 6 21:45:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705784 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F2ECC4167B for ; Thu, 6 Jan 2022 21:47:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245147AbiAFVrJ (ORCPT ); Thu, 6 Jan 2022 16:47:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244752AbiAFVqk (ORCPT ); Thu, 6 Jan 2022 16:46:40 -0500 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8C05C033271 for ; Thu, 6 Jan 2022 13:46:29 -0800 (PST) Received: by mail-pg1-x530.google.com with SMTP id s1so3737138pga.5 for ; Thu, 06 Jan 2022 13:46:29 -0800 (PST) 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=wlRODoqLGygqE0LYiWEnBFh9kz/XzAvDsSAOOxu5peY=; b=GzZNEOZnJdx2UbmWqTs91g8v1Ek0T36tb8wTW6K2/HuA2Ir6bJylKpR1VTJD3+cT7V RR8lNKHT3YDRZdKc5H88k1lnvbdSlpls0QxgraRDcDW1uAlIThvxYrNqx4dC/ptFAYRc JoQKpeNyqCvuEgmtHzLaPPcwVTKqyhbnb66KA= 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=wlRODoqLGygqE0LYiWEnBFh9kz/XzAvDsSAOOxu5peY=; b=KWMmk9OFLiz8lp9ivUI0c7BvxggvYORs4YRyYMkAm6P2L1tYGHc//Q6MgxNgSewFVy YryUg46ALo45k+aCPgHA3jFOpz6WpywtJQM/vgV/Rip4L6JugOH5kTVuKwQAZtCoAZ5G cRBgeemkI6zRoFaWXlAArIlhn97tIyDeJ/QoJFnu9ksOiYrmhAOgpnFn6cyK053hraPZ DzQHrlC6oiJwH1KrplDuyicbTN0HuLdOZFg8Db4pgcxageFmuLYVHg+TrK9gtbovOYqO OkduAKMmacgs1k7KaZF516un+cnkxmu3OysfFEAqIBjVuaAt3NhNH3vg7YQz+hnv0XNR waRg== X-Gm-Message-State: AOAM533sJ/V1g/98zBOFJeWZ6emurNpCv57V/JZEBrqEOFa52rzaAraY Y382aZgMOP6aW5x2N0ljItInXQ== X-Google-Smtp-Source: ABdhPJzQWO1uToj3tzBAQVjFHovHCVWrij+0CQbi4cIY9ccyePU+NaIcQKFL9LXXbASfdxbaDHhvhA== X-Received: by 2002:a63:8042:: with SMTP id j63mr53527969pgd.454.1641505589406; Thu, 06 Jan 2022 13:46:29 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:29 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Jyri Sarha , Tomi Valkeinen , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 23/32] drm/tilcdc: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:46 -0800 Message-Id: <20220106214556.2461363-24-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-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. Tested-by: Jyri Sarha Cc: Tomi Valkeinen Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index 3ddb7c710a3d..92ff516fb6de 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c @@ -529,13 +529,16 @@ static const struct dev_pm_ops tilcdc_pm_ops = { /* * Platform driver: */ -static int tilcdc_bind(struct device *dev) +static int tilcdc_bind(struct aggregate_device *adev) { + struct device *dev = adev->parent; + return tilcdc_init(&tilcdc_driver, dev); } -static void tilcdc_unbind(struct device *dev) +static void tilcdc_unbind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct drm_device *ddev = dev_get_drvdata(dev); /* Check if a subcomponent has already triggered the unloading. */ @@ -545,9 +548,13 @@ static void tilcdc_unbind(struct device *dev) tilcdc_fini(dev_get_drvdata(dev)); } -static const struct component_master_ops tilcdc_comp_ops = { - .bind = tilcdc_bind, - .unbind = tilcdc_unbind, +static struct aggregate_driver tilcdc_aggregate_driver = { + .probe = tilcdc_bind, + .remove = tilcdc_unbind, + .driver = { + .name = "tilcdc_drm", + .owner = THIS_MODULE, + }, }; static int tilcdc_pdev_probe(struct platform_device *pdev) @@ -564,12 +571,9 @@ static int tilcdc_pdev_probe(struct platform_device *pdev) ret = tilcdc_get_external_components(&pdev->dev, &match); if (ret < 0) return ret; - else if (ret == 0) + if (ret == 0) return tilcdc_init(&tilcdc_driver, &pdev->dev); - else - return component_master_add_with_match(&pdev->dev, - &tilcdc_comp_ops, - match); + return component_aggregate_register(&pdev->dev, &tilcdc_aggregate_driver, match); } static int tilcdc_pdev_remove(struct platform_device *pdev) @@ -579,10 +583,10 @@ static int tilcdc_pdev_remove(struct platform_device *pdev) ret = tilcdc_get_external_components(&pdev->dev, NULL); if (ret < 0) return ret; - else if (ret == 0) + if (ret == 0) tilcdc_fini(platform_get_drvdata(pdev)); else - component_master_del(&pdev->dev, &tilcdc_comp_ops); + component_aggregate_unregister(&pdev->dev, &tilcdc_aggregate_driver); return 0; }