From patchwork Thu Jan 6 21:45:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 530378 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 EC444C4321E for ; Thu, 6 Jan 2022 21:46:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244508AbiAFVq3 (ORCPT ); Thu, 6 Jan 2022 16:46:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244462AbiAFVqK (ORCPT ); Thu, 6 Jan 2022 16:46:10 -0500 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B018C061245 for ; Thu, 6 Jan 2022 13:46:10 -0800 (PST) Received: by mail-pf1-x42c.google.com with SMTP id 205so3641854pfu.0 for ; Thu, 06 Jan 2022 13:46:10 -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=udX8aXVKtCgorZpoo7KBRMV9fl84l0zJ44mq5nPYnXQ=; b=Ya34FDKNKfvN1GQNsIj3/YHoOtnFnJomMP0x3sM6wb4AAXA5x9zxx14WIoBs2wHRpl 5mmvuYveL7LaSK9Yk07qPV6mwXvVreJp+RooagLKp0wjaY/HM5JCJP3uneRREyTMpbKx FmHW9pECA68YpJ3Xkz0I+ztn1d48xxPPPMBZs= 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=udX8aXVKtCgorZpoo7KBRMV9fl84l0zJ44mq5nPYnXQ=; b=OK2pBZAWViFV6kvoXNy5n/R2C2BDm2rBJJp62mHuIL1y+nV2U8ACt3Wd+IvdYzdiqI ckHlFg+I51B26HnHQCjhzzqTE3l6T2Q+9tdGvt1XSL/3Ws+9xct6G5XPc8kDTycaPaYi +jj4DN2ZnIjwBiPBii3ZnDPy/aBelXgxTacOawpByB1cPozkMHuhd3LjW9bmfjvtQRij GcB1jjJeHe1b8zJUpThTUhlFfk9EG1Y7qQ1+bpNec9i+sdgZyaxcEqsKatoiK7bnK4MT sxappXLGm/THC4MzKMuWT6ElxXI3w6vf7q7H3sbsnv7HL/kPFs5liH2FrH/L/sbAV2Fs qkVA== X-Gm-Message-State: AOAM531nbuDv5sVPLuwO+Rj/FkUJyQJmIVfpEKwH7EBehybhnQFma2CG Tgg5dYe/n0UwekK2v9bOmyJZ4Q== X-Google-Smtp-Source: ABdhPJwqM87G59xgRPi2C4DOO/wTX46XQXKwKNWtQf+08DlJeYiicq+R6L9sPwm8+CM6PygK176Kkw== X-Received: by 2002:a63:b20f:: with SMTP id x15mr16095753pge.82.1641505569883; Thu, 06 Jan 2022 13:46:09 -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.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:09 -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, Liviu Dudau , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 08/32] drm/arm/hdlcd: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:31 -0800 Message-Id: <20220106214556.2461363-9-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. Cc: Liviu Dudau Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/arm/hdlcd_drv.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c index 479c2422a2e0..5c03eb98d814 100644 --- a/drivers/gpu/drm/arm/hdlcd_drv.c +++ b/drivers/gpu/drm/arm/hdlcd_drv.c @@ -270,8 +270,9 @@ static const struct drm_driver hdlcd_driver = { .minor = 0, }; -static int hdlcd_drm_bind(struct device *dev) +static int hdlcd_drm_bind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct drm_device *drm; struct hdlcd_drm_private *hdlcd; int ret; @@ -344,8 +345,9 @@ static int hdlcd_drm_bind(struct device *dev) return ret; } -static void hdlcd_drm_unbind(struct device *dev) +static void hdlcd_drm_unbind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct drm_device *drm = dev_get_drvdata(dev); struct hdlcd_drm_private *hdlcd = drm->dev_private; @@ -367,9 +369,13 @@ static void hdlcd_drm_unbind(struct device *dev) drm_dev_put(drm); } -static const struct component_master_ops hdlcd_master_ops = { - .bind = hdlcd_drm_bind, - .unbind = hdlcd_drm_unbind, +static struct aggregate_driver hdlcd_aggregate_driver = { + .probe = hdlcd_drm_bind, + .remove = hdlcd_drm_unbind, + .driver = { + .name = "hdlcd_drm", + .owner = THIS_MODULE, + }, }; static int compare_dev(struct device *dev, void *data) @@ -390,13 +396,12 @@ static int hdlcd_probe(struct platform_device *pdev) drm_of_component_match_add(&pdev->dev, &match, compare_dev, port); of_node_put(port); - return component_master_add_with_match(&pdev->dev, &hdlcd_master_ops, - match); + return component_aggregate_register(&pdev->dev, &hdlcd_aggregate_driver, match); } static int hdlcd_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &hdlcd_master_ops); + component_aggregate_unregister(&pdev->dev, &hdlcd_aggregate_driver); return 0; }