From patchwork Thu Jan 27 20:01:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 537680 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 7C0DBC43217 for ; Thu, 27 Jan 2022 20:02:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343682AbiA0UCJ (ORCPT ); Thu, 27 Jan 2022 15:02:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343666AbiA0UCI (ORCPT ); Thu, 27 Jan 2022 15:02:08 -0500 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16620C061747 for ; Thu, 27 Jan 2022 12:02:08 -0800 (PST) Received: by mail-pg1-x52e.google.com with SMTP id s16so3142197pgs.13 for ; Thu, 27 Jan 2022 12:02:08 -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=GBNCJskYdXfAX+d+IFXzB6ZhhAWcTNbUgQAvepRmgjg=; b=IxzF42BjOO2pquMk+0gv8AzrZphAavGJ0aSqJSR5mXo5r+dj56dPmYBUR0QILo7roS IXbnzV04OSgJkuxMxw54ooixm26YyHaYSuds9oMqzxbEb4y68B4fLJ0gM/lxcXafBprZ CSnK/dN9IGo4ps4eOLhOUWlUi5F2xJhNpB2K0= 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=GBNCJskYdXfAX+d+IFXzB6ZhhAWcTNbUgQAvepRmgjg=; b=VAM9gN5WX6YmNYbXz0Dm3BKQtctWAN9uUmhTe6tuLvAtn3QVWRn8vqg8rMF5/ss3XW oZzdFFL6B2KSoNLJ5PVIo9n+ZZv6PfMQQbxk7oJ+9BJRW/wGypcS6hczo/Nxpd/zW+5l vHhhijZZ001AAqqnxpo8c5ezPuEvzA7vM2fNUtmFjLmVodWins1TLhU3crzNu4/+jrBl NveSHuBYxKuDIgjpj0YB/E4Jltr3yeGB2lPHKMkqxQahxZonKOOILpEPn9c7V4AOtjxJ uX6s/mA/3mx5+pfzxJdiDQiU2C+/0onnBDIRghjT139NkFG5vJebEbwpYmgd6GAfp0dF VMUg== X-Gm-Message-State: AOAM5313syuCeGDsHwznaRBOvkFpuCxgRKnTeB7nJBRN7hk8Kkc/kqxc qZYR4GsjzVlMssk9ahDPs2kDrg== X-Google-Smtp-Source: ABdhPJzMu2DT+wvnxujTHMVmyjXUqKBftpEoNz8zexEJYQkFqpbXavgbA3bJRklbVF0Xo3qXAUn7Nw== X-Received: by 2002:a62:e409:: with SMTP id r9mr4463825pfh.44.1643313727593; Thu, 27 Jan 2022 12:02:07 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:07 -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, Russell King , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Saravana Kannan Subject: [PATCH v6 10/35] drm/armada: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:16 -0800 Message-Id: <20220127200141.1295328-11-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-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: Russell King Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/armada/armada_drv.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c index 8e3e98f13db4..27739cbe2291 100644 --- a/drivers/gpu/drm/armada/armada_drv.c +++ b/drivers/gpu/drm/armada/armada_drv.c @@ -60,8 +60,9 @@ static const struct drm_mode_config_funcs armada_drm_mode_config_funcs = { .atomic_commit = drm_atomic_helper_commit, }; -static int armada_drm_bind(struct device *dev) +static int armada_drm_bind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct armada_private *priv; struct resource *mem = NULL; int ret, n; @@ -159,8 +160,9 @@ static int armada_drm_bind(struct device *dev) return ret; } -static void armada_drm_unbind(struct device *dev) +static void armada_drm_unbind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct drm_device *drm = dev_get_drvdata(dev); struct armada_private *priv = drm_to_armada_dev(drm); @@ -202,9 +204,13 @@ static void armada_add_endpoints(struct device *dev, } } -static const struct component_master_ops armada_master_ops = { - .bind = armada_drm_bind, - .unbind = armada_drm_unbind, +static struct aggregate_driver armada_aggregate_driver = { + .probe = armada_drm_bind, + .remove = armada_drm_unbind, + .driver = { + .name = "armada_drm", + .owner = THIS_MODULE, + }, }; static int armada_drm_probe(struct platform_device *pdev) @@ -213,7 +219,7 @@ static int armada_drm_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - ret = drm_of_component_probe(dev, compare_dev_name, &armada_master_ops); + ret = drm_of_aggregate_probe(dev, compare_dev_name, &armada_aggregate_driver); if (ret != -EINVAL) return ret; @@ -240,13 +246,12 @@ static int armada_drm_probe(struct platform_device *pdev) } } - return component_master_add_with_match(&pdev->dev, &armada_master_ops, - match); + return component_aggregate_register(&pdev->dev, &armada_aggregate_driver, match); } static int armada_drm_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &armada_master_ops); + component_aggregate_unregister(&pdev->dev, &armada_aggregate_driver); return 0; }