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 47092C433EF for ; Thu, 6 Jan 2022 21:46:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244483AbiAFVqk (ORCPT ); Thu, 6 Jan 2022 16:46:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244504AbiAFVqQ (ORCPT ); Thu, 6 Jan 2022 16:46:16 -0500 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 764FDC061245 for ; Thu, 6 Jan 2022 13:46:15 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id m13so3557305pji.3 for ; Thu, 06 Jan 2022 13:46:15 -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=9+fM2dIjOxE0hdJ7o5inMEoSl4k+Dtn8hCQbdOli+o8=; b=WMHlwmVoo1ow1wofjzv++KabJgE5A6EpO98LpbSnWXIy+DtxgACpsY6fIhJHEKp4Bd W+/v2FNvE3U3LbDMGYS3WkdtPvljEpVfgIA6g7AmLK3pZtGtdL0WDNRxlHud8Ao9Elb2 aXXS4XgNXK4ewetP2amhDNnmvvcOWnwPPzCEQ= 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=9+fM2dIjOxE0hdJ7o5inMEoSl4k+Dtn8hCQbdOli+o8=; b=YGfcu8slE1ihPn+R5L+yDXMJ5RnHQwkOUsUBzR5BeMEQC4lkoiUjntXhleJhfOxBRg mPQF+8ZmPant6zoW3N2uY6QcOROjes2e/VGZNzKEFfW+SCipIfP5xePZ1GeIWkG03acg pxVyicVTeabK9Rte8s59XquU+VGldHksqDt3S30gnQ1tAc5uTtqUgBkOMgjXZfip3M5t qll+P5p9njvGFVKeu9EamVP0S0qWS419o+JvZzC4gZByqx2kyL0vFrsNhpXLasuZPFDt A9eRVBAmAHBtGB5HTnkn4wvzNvc4h6yNAbkEwaVkwE5+ijyWnmQir2jp7d6udNlp7Yq7 rxwA== X-Gm-Message-State: AOAM533Aajm/4BjNH4muq7K17RXsRBYV7ZgQ6jWY4IXVMb2ohh+xgVp6 2TPnsz1Gtfbc46g1KWTmmaGuww== X-Google-Smtp-Source: ABdhPJwpQFHrvpwt076C/B60hfpgIoYWieUUFNJrKvBbE5BuNSwKXiWe++ylmqtUWZXuGmGRj9RTqg== X-Received: by 2002:a17:90b:3808:: with SMTP id mq8mr12220192pjb.85.1641505574987; Thu, 06 Jan 2022 13:46:14 -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.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:14 -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, Xinliang Liu , Tian Tao , John Stultz , Xinwei Kong , Chen Feng , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 12/32] drm/kirin: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:35 -0800 Message-Id: <20220106214556.2461363-13-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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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: Xinliang Liu Cc: Tian Tao Cc: John Stultz Cc: Xinwei Kong Cc: Chen Feng Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- .../gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index 98ae9a48f3fe..00d47c784cbb 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -217,8 +217,9 @@ static int kirin_drm_kms_cleanup(struct drm_device *dev) return 0; } -static int kirin_drm_bind(struct device *dev) +static int kirin_drm_bind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct kirin_drm_data *driver_data; struct drm_device *drm_dev; int ret; @@ -253,8 +254,9 @@ static int kirin_drm_bind(struct device *dev) return ret; } -static void kirin_drm_unbind(struct device *dev) +static void kirin_drm_unbind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct drm_device *drm_dev = dev_get_drvdata(dev); drm_dev_unregister(drm_dev); @@ -262,9 +264,13 @@ static void kirin_drm_unbind(struct device *dev) drm_dev_put(drm_dev); } -static const struct component_master_ops kirin_drm_ops = { - .bind = kirin_drm_bind, - .unbind = kirin_drm_unbind, +static struct aggregate_driver kirin_drm_aggregate_driver = { + .probe = kirin_drm_bind, + .remove = kirin_drm_unbind, + .driver = { + .name = "kirin_drm", + .owner = THIS_MODULE, + }, }; static int kirin_drm_platform_probe(struct platform_device *pdev) @@ -281,12 +287,12 @@ static int kirin_drm_platform_probe(struct platform_device *pdev) drm_of_component_match_add(dev, &match, compare_of, remote); of_node_put(remote); - return component_master_add_with_match(dev, &kirin_drm_ops, match); + return component_aggregate_register(dev, &kirin_drm_aggregate_driver, match); } static int kirin_drm_platform_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &kirin_drm_ops); + component_aggregate_unregister(&pdev->dev, &kirin_drm_aggregate_driver); return 0; } -- https://chromeos.dev