From nobody Tue Jun 30 01:43:45 2026 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 E1345C433FE for ; Thu, 27 Jan 2022 20:01:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343621AbiA0UBw (ORCPT ); Thu, 27 Jan 2022 15:01:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240141AbiA0UBr (ORCPT ); Thu, 27 Jan 2022 15:01:47 -0500 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B011DC061747 for ; Thu, 27 Jan 2022 12:01:47 -0800 (PST) Received: by mail-pf1-x431.google.com with SMTP id n32so3762591pfv.11 for ; Thu, 27 Jan 2022 12:01:47 -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=o/2oSSYmQiFhdwKpwnUwhIjRZt1gkWQnLZey0tUdQ3Q=; b=F2EZsXHtz8SY1s6hx5bMUnrUGUyghuTmxSBrXDoJVX3NTp3Q7IiXCqTwdEcRuFf6H1 iQqiH246et5NpTO8gqkGw+DJ7/sopjh34P/Eqv5n2kM+N7ULCvH7rtdaafLc7ZYaKq3a YQET0v2gDkhKyzZUvE/14z3q4yZTF0zwfEo1Q= 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=o/2oSSYmQiFhdwKpwnUwhIjRZt1gkWQnLZey0tUdQ3Q=; b=dUbAwO7LFGe2kVo95MEZyQLI8I/L79pWsulV4spo60iYcQAjNBLu5umM3zdiBgKOkY 1uf7afsCkaklFW8pm843GcaKcd/ICSYZNLpymExgr3gW/jixuDEvwK9m63hvVU0qwnob Ri/TnIW3nF+GCnvCiLv7gUUFaZ3dhVHYe3+2ljxKzHKGiu2hOdvZ7dwUVcaeoSDkUpF6 F4AgC/plI2IkY7lfLjsFCLJ36cSgUm1r1WBUcN2AKaE0QUgGIZFYOTpOcEhOaIXeDAgu Y/wVAFEy5yBnQpC6wOdWZCF+OoK50wNbmatZrnNKchkOj93qaPUXPAwLCx2rQ3eN5yEs wIGg== X-Gm-Message-State: AOAM530rU+b5ZKEIYLr6L6jGneN7iHNawXVqy9J/ldSs2YlDBZVE4Y5e rHayhElob2pk8UgLGzdVZ2OH+g== X-Google-Smtp-Source: ABdhPJxNTd8UpqkCqSFPMqr5dnF5oOl6x1wJ8ztUhPI3BDZAPgxlL+ALaR+FXHt4B/tPwO2icIFh5g== X-Received: by 2002:a63:dd0f:: with SMTP id t15mr3909390pgg.12.1643313707077; Thu, 27 Jan 2022 12:01:47 -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.01.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:01:46 -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, Daniel Vetter , Laurent Pinchart , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 01/35] component: Replace most references to 'master' with 'aggregate device' Date: Thu, 27 Jan 2022 12:01:07 -0800 Message-Id: <20220127200141.1295328-2-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Remove most references to 'master' in the code and replace them with some form of 'aggregate device'. This better reflects the reality of what this code does, i.e. an aggregate device that represents a device like a GPU card once some set of devices that make up the aggregate device probe and register with the component framework. Cc: Daniel Vetter Cc: Greg Kroah-Hartman Cc: Laurent Pinchart Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- drivers/base/component.c | 242 +++++++++++++++++++------------------- include/linux/component.h | 18 +-- 2 files changed, 128 insertions(+), 132 deletions(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index 2d25a6416587..34f9e0802719 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -1,11 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* * Componentized device handling. - * - * This is work in progress. We gather up the component devices into a li= st, - * and bind them when instructed. At the moment, we're specific to the DRM - * subsystem, and only handles one master device, but this doesn't have to= be - * the case. */ #include #include @@ -57,7 +52,7 @@ struct component_match { struct component_match_array *compare; }; =20 -struct master { +struct aggregate_device { struct list_head node; bool bound; =20 @@ -68,7 +63,7 @@ struct master { =20 struct component { struct list_head node; - struct master *master; + struct aggregate_device *adev; bool bound; =20 const struct component_ops *ops; @@ -78,7 +73,7 @@ struct component { =20 static DEFINE_MUTEX(component_mutex); static LIST_HEAD(component_list); -static LIST_HEAD(masters); +static LIST_HEAD(aggregate_devices); =20 #ifdef CONFIG_DEBUG_FS =20 @@ -86,12 +81,12 @@ static struct dentry *component_debugfs_dir; =20 static int component_devices_show(struct seq_file *s, void *data) { - struct master *m =3D s->private; + struct aggregate_device *m =3D s->private; struct component_match *match =3D m->match; size_t i; =20 mutex_lock(&component_mutex); - seq_printf(s, "%-40s %20s\n", "master name", "status"); + seq_printf(s, "%-40s %20s\n", "aggregate_device name", "status"); seq_puts(s, "------------------------------------------------------------= -\n"); seq_printf(s, "%-40s %20s\n\n", dev_name(m->parent), m->bound ? "bound" : "not bound"); @@ -121,46 +116,46 @@ static int __init component_debug_init(void) =20 core_initcall(component_debug_init); =20 -static void component_master_debugfs_add(struct master *m) +static void component_debugfs_add(struct aggregate_device *m) { debugfs_create_file(dev_name(m->parent), 0444, component_debugfs_dir, m, &component_devices_fops); } =20 -static void component_master_debugfs_del(struct master *m) +static void component_debugfs_del(struct aggregate_device *m) { debugfs_remove(debugfs_lookup(dev_name(m->parent), component_debugfs_dir)= ); } =20 #else =20 -static void component_master_debugfs_add(struct master *m) +static void component_debugfs_add(struct aggregate_device *m) { } =20 -static void component_master_debugfs_del(struct master *m) +static void component_debugfs_del(struct aggregate_device *m) { } =20 #endif =20 -static struct master *__master_find(struct device *parent, +static struct aggregate_device *__aggregate_find(struct device *parent, const struct component_master_ops *ops) { - struct master *m; + struct aggregate_device *m; =20 - list_for_each_entry(m, &masters, node) + list_for_each_entry(m, &aggregate_devices, node) if (m->parent =3D=3D parent && (!ops || m->ops =3D=3D ops)) return m; =20 return NULL; } =20 -static struct component *find_component(struct master *master, +static struct component *find_component(struct aggregate_device *adev, struct component_match_array *mc) { struct component *c; =20 list_for_each_entry(c, &component_list, node) { - if (c->master && c->master !=3D master) + if (c->adev && c->adev !=3D adev) continue; =20 if (mc->compare && mc->compare(c->dev, mc->data)) @@ -174,102 +169,103 @@ static struct component *find_component(struct mast= er *master, return NULL; } =20 -static int find_components(struct master *master) +static int find_components(struct aggregate_device *adev) { - struct component_match *match =3D master->match; + struct component_match *match =3D adev->match; size_t i; int ret =3D 0; =20 /* * Scan the array of match functions and attach - * any components which are found to this master. + * any components which are found to this adev. */ for (i =3D 0; i < match->num; i++) { struct component_match_array *mc =3D &match->compare[i]; struct component *c; =20 - dev_dbg(master->parent, "Looking for component %zu\n", i); + dev_dbg(adev->parent, "Looking for component %zu\n", i); =20 if (match->compare[i].component) continue; =20 - c =3D find_component(master, mc); + c =3D find_component(adev, mc); if (!c) { ret =3D -ENXIO; break; } =20 - dev_dbg(master->parent, "found component %s, duplicate %u\n", dev_name(c= ->dev), !!c->master); + dev_dbg(adev->parent, "found component %s, duplicate %u\n", + dev_name(c->dev), !!c->adev); =20 - /* Attach this component to the master */ - match->compare[i].duplicate =3D !!c->master; + /* Attach this component to the adev */ + match->compare[i].duplicate =3D !!c->adev; match->compare[i].component =3D c; - c->master =3D master; + c->adev =3D adev; } return ret; } =20 -/* Detach component from associated master */ -static void remove_component(struct master *master, struct component *c) +/* Detach component from associated aggregate_device */ +static void remove_component(struct aggregate_device *adev, struct compone= nt *c) { size_t i; =20 - /* Detach the component from this master. */ - for (i =3D 0; i < master->match->num; i++) - if (master->match->compare[i].component =3D=3D c) - master->match->compare[i].component =3D NULL; + /* Detach the component from this adev. */ + for (i =3D 0; i < adev->match->num; i++) + if (adev->match->compare[i].component =3D=3D c) + adev->match->compare[i].component =3D NULL; } =20 /* - * Try to bring up a master. If component is NULL, we're interested in - * this master, otherwise it's a component which must be present to try - * and bring up the master. + * Try to bring up an aggregate device. If component is NULL, we're inter= ested + * in this aggregate device, otherwise it's a component which must be pres= ent + * to try and bring up the aggregate device. * * Returns 1 for successful bringup, 0 if not ready, or -ve errno. */ -static int try_to_bring_up_master(struct master *master, +static int try_to_bring_up_aggregate_device(struct aggregate_device *adev, struct component *component) { int ret; =20 - dev_dbg(master->parent, "trying to bring up master\n"); + dev_dbg(adev->parent, "trying to bring up adev\n"); =20 - if (find_components(master)) { - dev_dbg(master->parent, "master has incomplete components\n"); + if (find_components(adev)) { + dev_dbg(adev->parent, "master has incomplete components\n"); return 0; } =20 - if (component && component->master !=3D master) { - dev_dbg(master->parent, "master is not for this component (%s)\n", + if (component && component->adev !=3D adev) { + dev_dbg(adev->parent, "master is not for this component (%s)\n", dev_name(component->dev)); return 0; } =20 - if (!devres_open_group(master->parent, master, GFP_KERNEL)) + if (!devres_open_group(adev->parent, adev, GFP_KERNEL)) return -ENOMEM; =20 /* Found all components */ - ret =3D master->ops->bind(master->parent); + ret =3D adev->ops->bind(adev->parent); if (ret < 0) { - devres_release_group(master->parent, NULL); + devres_release_group(adev->parent, NULL); if (ret !=3D -EPROBE_DEFER) - dev_info(master->parent, "master bind failed: %d\n", ret); + dev_info(adev->parent, "adev bind failed: %d\n", ret); return ret; } =20 - devres_close_group(master->parent, NULL); - master->bound =3D true; + devres_close_group(adev->parent, NULL); + adev->bound =3D true; return 1; } =20 static int try_to_bring_up_masters(struct component *component) { - struct master *m; + struct aggregate_device *adev; int ret =3D 0; =20 - list_for_each_entry(m, &masters, node) { - if (!m->bound) { - ret =3D try_to_bring_up_master(m, component); + list_for_each_entry(adev, &aggregate_devices, node) { + if (!adev->bound) { + ret =3D try_to_bring_up_aggregate_device(adev, component); if (ret !=3D 0) break; } @@ -278,12 +274,12 @@ static int try_to_bring_up_masters(struct component *= component) return ret; } =20 -static void take_down_master(struct master *master) +static void take_down_aggregate_device(struct aggregate_device *adev) { - if (master->bound) { - master->ops->unbind(master->parent); - devres_release_group(master->parent, master); - master->bound =3D false; + if (adev->bound) { + adev->ops->unbind(adev->parent); + devres_release_group(adev->parent, adev); + adev->bound =3D false; } } =20 @@ -324,7 +320,7 @@ static int component_match_realloc(struct component_mat= ch *match, size_t num) return 0; } =20 -static void __component_match_add(struct device *master, +static void __component_match_add(struct device *parent, struct component_match **matchptr, void (*release)(struct device *, void *), int (*compare)(struct device *, void *), @@ -344,7 +340,7 @@ static void __component_match_add(struct device *master, return; } =20 - devres_add(master, match); + devres_add(parent, match); =20 *matchptr =3D match; } @@ -370,13 +366,13 @@ static void __component_match_add(struct device *mast= er, =20 /** * component_match_add_release - add a component match entry with release = callback - * @master: device with the aggregate driver + * @parent: parent device of the aggregate driver * @matchptr: pointer to the list of component matches * @release: release function for @compare_data * @compare: compare function to match against all components * @compare_data: opaque pointer passed to the @compare function * - * Adds a new component match to the list stored in @matchptr, which the @= master + * Adds a new component match to the list stored in @matchptr, which the * aggregate driver needs to function. The list of component matches point= ed to * by @matchptr must be initialized to NULL before adding the first match.= This * only matches against components added with component_add(). @@ -388,24 +384,24 @@ static void __component_match_add(struct device *mast= er, * * See also component_match_add() and component_match_add_typed(). */ -void component_match_add_release(struct device *master, +void component_match_add_release(struct device *parent, struct component_match **matchptr, void (*release)(struct device *, void *), int (*compare)(struct device *, void *), void *compare_data) { - __component_match_add(master, matchptr, release, compare, NULL, + __component_match_add(parent, matchptr, release, compare, NULL, compare_data); } EXPORT_SYMBOL(component_match_add_release); =20 /** * component_match_add_typed - add a component match entry for a typed com= ponent - * @master: device with the aggregate driver + * @parent: parent device of the aggregate driver * @matchptr: pointer to the list of component matches * @compare_typed: compare function to match against all typed components * @compare_data: opaque pointer passed to the @compare function * - * Adds a new component match to the list stored in @matchptr, which the @= master + * Adds a new component match to the list stored in @matchptr, which the * aggregate driver needs to function. The list of component matches point= ed to * by @matchptr must be initialized to NULL before adding the first match.= This * only matches against components added with component_add_typed(). @@ -415,32 +411,32 @@ EXPORT_SYMBOL(component_match_add_release); * * See also component_match_add_release() and component_match_add_typed(). */ -void component_match_add_typed(struct device *master, +void component_match_add_typed(struct device *parent, struct component_match **matchptr, int (*compare_typed)(struct device *, int, void *), void *compare_data) { - __component_match_add(master, matchptr, NULL, NULL, compare_typed, + __component_match_add(parent, matchptr, NULL, NULL, compare_typed, compare_data); } EXPORT_SYMBOL(component_match_add_typed); =20 -static void free_master(struct master *master) +static void free_aggregate_device(struct aggregate_device *adev) { - struct component_match *match =3D master->match; + struct component_match *match =3D adev->match; int i; =20 - component_master_debugfs_del(master); - list_del(&master->node); + component_debugfs_del(adev); + list_del(&adev->node); =20 if (match) { for (i =3D 0; i < match->num; i++) { struct component *c =3D match->compare[i].component; if (c) - c->master =3D NULL; + c->adev =3D NULL; } } =20 - kfree(master); + kfree(adev); } =20 /** @@ -459,7 +455,7 @@ int component_master_add_with_match(struct device *pare= nt, const struct component_master_ops *ops, struct component_match *match) { - struct master *master; + struct aggregate_device *adev; int ret; =20 /* Reallocate the match array for its true size */ @@ -467,23 +463,23 @@ int component_master_add_with_match(struct device *pa= rent, if (ret) return ret; =20 - master =3D kzalloc(sizeof(*master), GFP_KERNEL); - if (!master) + adev =3D kzalloc(sizeof(*adev), GFP_KERNEL); + if (!adev) return -ENOMEM; =20 - master->parent =3D parent; - master->ops =3D ops; - master->match =3D match; + adev->parent =3D parent; + adev->ops =3D ops; + adev->match =3D match; =20 - component_master_debugfs_add(master); - /* Add to the list of available masters. */ + component_debugfs_add(adev); + /* Add to the list of available aggregate devices. */ mutex_lock(&component_mutex); - list_add(&master->node, &masters); + list_add(&adev->node, &aggregate_devices); =20 - ret =3D try_to_bring_up_master(master, NULL); + ret =3D try_to_bring_up_aggregate_device(adev, NULL); =20 if (ret < 0) - free_master(master); + free_aggregate_device(adev); =20 mutex_unlock(&component_mutex); =20 @@ -503,25 +499,25 @@ EXPORT_SYMBOL_GPL(component_master_add_with_match); void component_master_del(struct device *parent, const struct component_master_ops *ops) { - struct master *master; + struct aggregate_device *adev; =20 mutex_lock(&component_mutex); - master =3D __master_find(parent, ops); - if (master) { - take_down_master(master); - free_master(master); + adev =3D __aggregate_find(parent, ops); + if (adev) { + take_down_aggregate_device(adev); + free_aggregate_device(adev); } mutex_unlock(&component_mutex); } EXPORT_SYMBOL_GPL(component_master_del); =20 static void component_unbind(struct component *component, - struct master *master, void *data) + struct aggregate_device *adev, void *data) { WARN_ON(!component->bound); =20 if (component->ops && component->ops->unbind) - component->ops->unbind(component->dev, master->parent, data); + component->ops->unbind(component->dev, adev->parent, data); component->bound =3D false; =20 /* Release all resources claimed in the binding of this component */ @@ -539,26 +535,26 @@ static void component_unbind(struct component *compon= ent, */ void component_unbind_all(struct device *parent, void *data) { - struct master *master; + struct aggregate_device *adev; struct component *c; size_t i; =20 WARN_ON(!mutex_is_locked(&component_mutex)); =20 - master =3D __master_find(parent, NULL); - if (!master) + adev =3D __aggregate_find(parent, NULL); + if (!adev) return; =20 /* Unbind components in reverse order */ - for (i =3D master->match->num; i--; ) - if (!master->match->compare[i].duplicate) { - c =3D master->match->compare[i].component; - component_unbind(c, master, data); + for (i =3D adev->match->num; i--; ) + if (!adev->match->compare[i].duplicate) { + c =3D adev->match->compare[i].component; + component_unbind(c, adev, data); } } EXPORT_SYMBOL_GPL(component_unbind_all); =20 -static int component_bind(struct component *component, struct master *mast= er, +static int component_bind(struct component *component, struct aggregate_de= vice *adev, void *data) { int ret; @@ -568,7 +564,7 @@ static int component_bind(struct component *component, = struct master *master, * This allows us to roll-back a failed component without * affecting anything else. */ - if (!devres_open_group(master->parent, NULL, GFP_KERNEL)) + if (!devres_open_group(adev->parent, NULL, GFP_KERNEL)) return -ENOMEM; =20 /* @@ -577,14 +573,14 @@ static int component_bind(struct component *component= , struct master *master, * at the appropriate moment. */ if (!devres_open_group(component->dev, component, GFP_KERNEL)) { - devres_release_group(master->parent, NULL); + devres_release_group(adev->parent, NULL); return -ENOMEM; } =20 - dev_dbg(master->parent, "binding %s (ops %ps)\n", + dev_dbg(adev->parent, "binding %s (ops %ps)\n", dev_name(component->dev), component->ops); =20 - ret =3D component->ops->bind(component->dev, master->parent, data); + ret =3D component->ops->bind(component->dev, adev->parent, data); if (!ret) { component->bound =3D true; =20 @@ -595,16 +591,16 @@ static int component_bind(struct component *component= , struct master *master, * can clean those resources up independently. */ devres_close_group(component->dev, NULL); - devres_remove_group(master->parent, NULL); + devres_remove_group(adev->parent, NULL); =20 - dev_info(master->parent, "bound %s (ops %ps)\n", + dev_info(adev->parent, "bound %s (ops %ps)\n", dev_name(component->dev), component->ops); } else { devres_release_group(component->dev, NULL); - devres_release_group(master->parent, NULL); + devres_release_group(adev->parent, NULL); =20 if (ret !=3D -EPROBE_DEFER) - dev_err(master->parent, "failed to bind %s (ops %ps): %d\n", + dev_err(adev->parent, "failed to bind %s (ops %ps): %d\n", dev_name(component->dev), component->ops, ret); } =20 @@ -622,31 +618,31 @@ static int component_bind(struct component *component= , struct master *master, */ int component_bind_all(struct device *parent, void *data) { - struct master *master; + struct aggregate_device *adev; struct component *c; size_t i; int ret =3D 0; =20 WARN_ON(!mutex_is_locked(&component_mutex)); =20 - master =3D __master_find(parent, NULL); - if (!master) + adev =3D __aggregate_find(parent, NULL); + if (!adev) return -EINVAL; =20 /* Bind components in match order */ - for (i =3D 0; i < master->match->num; i++) - if (!master->match->compare[i].duplicate) { - c =3D master->match->compare[i].component; - ret =3D component_bind(c, master, data); + for (i =3D 0; i < adev->match->num; i++) + if (!adev->match->compare[i].duplicate) { + c =3D adev->match->compare[i].component; + ret =3D component_bind(c, adev, data); if (ret) break; } =20 if (ret !=3D 0) { for (; i > 0; i--) - if (!master->match->compare[i - 1].duplicate) { - c =3D master->match->compare[i - 1].component; - component_unbind(c, master, data); + if (!adev->match->compare[i - 1].duplicate) { + c =3D adev->match->compare[i - 1].component; + component_unbind(c, adev, data); } } =20 @@ -675,8 +671,8 @@ static int __component_add(struct device *dev, const st= ruct component_ops *ops, =20 ret =3D try_to_bring_up_masters(component); if (ret < 0) { - if (component->master) - remove_component(component->master, component); + if (component->adev) + remove_component(component->adev, component); list_del(&component->node); =20 kfree(component); @@ -757,9 +753,9 @@ void component_del(struct device *dev, const struct com= ponent_ops *ops) break; } =20 - if (component && component->master) { - take_down_master(component->master); - remove_component(component->master, component); + if (component && component->adev) { + take_down_aggregate_device(component->adev); + remove_component(component->adev, component); } =20 mutex_unlock(&component_mutex); diff --git a/include/linux/component.h b/include/linux/component.h index 16de18f473d7..7012569c6546 100644 --- a/include/linux/component.h +++ b/include/linux/component.h @@ -38,10 +38,10 @@ int component_add_typed(struct device *dev, const struc= t component_ops *ops, int subcomponent); void component_del(struct device *, const struct component_ops *); =20 -int component_bind_all(struct device *master, void *master_data); -void component_unbind_all(struct device *master, void *master_data); +int component_bind_all(struct device *parent, void *data); +void component_unbind_all(struct device *parent, void *data); =20 -struct master; +struct aggregate_device; =20 /** * struct component_master_ops - callback for the aggregate driver @@ -89,22 +89,22 @@ struct component_match; =20 int component_master_add_with_match(struct device *, const struct component_master_ops *, struct component_match *); -void component_match_add_release(struct device *master, +void component_match_add_release(struct device *parent, struct component_match **matchptr, void (*release)(struct device *, void *), int (*compare)(struct device *, void *), void *compare_data); -void component_match_add_typed(struct device *master, +void component_match_add_typed(struct device *parent, struct component_match **matchptr, int (*compare_typed)(struct device *, int, void *), void *compare_data); =20 /** * component_match_add - add a component match entry - * @master: device with the aggregate driver + * @parent: device with the aggregate driver * @matchptr: pointer to the list of component matches * @compare: compare function to match against all components * @compare_data: opaque pointer passed to the @compare function * - * Adds a new component match to the list stored in @matchptr, which the @= master + * Adds a new component match to the list stored in @matchptr, which the @= parent * aggregate driver needs to function. The list of component matches point= ed to * by @matchptr must be initialized to NULL before adding the first match.= This * only matches against components added with component_add(). @@ -114,11 +114,11 @@ void component_match_add_typed(struct device *master, * * See also component_match_add_release() and component_match_add_typed(). */ -static inline void component_match_add(struct device *master, +static inline void component_match_add(struct device *parent, struct component_match **matchptr, int (*compare)(struct device *, void *), void *compare_data) { - component_match_add_release(master, matchptr, NULL, compare, + component_match_add_release(parent, matchptr, NULL, compare, compare_data); } =20 --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 D818DC433EF for ; Thu, 27 Jan 2022 20:01:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343640AbiA0UB7 (ORCPT ); Thu, 27 Jan 2022 15:01:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240074AbiA0UB5 (ORCPT ); Thu, 27 Jan 2022 15:01:57 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E502C061714 for ; Thu, 27 Jan 2022 12:01:57 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id d1so3664272plh.10 for ; Thu, 27 Jan 2022 12:01:57 -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=IR4AISD83LJCSYg29NOuQaaPTjOL0HsWAiGACvsgSGo=; b=ncKjtei93vb1zHLPl1WczIhVUiOMUHxsILhIlnZB0H1nP8/WyqZnoYUGiUcs8LBbSo 7Pnnv0eBLXiLnw08Lhy/ARASwLqkCcO0ww9SGvnvCxIcUtC8P6DypqeVOCU6jWkXgw9Y enSTzkob6k3B75rRWxiUk4mMIHAtnEvJk0O9g= 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=IR4AISD83LJCSYg29NOuQaaPTjOL0HsWAiGACvsgSGo=; b=OUxp2fo/Zo6Og0OF8iDIlFx4FyjJJAXLhvRqLlq4Sda9onfZaM0UfYDa6DURmyhqTa RW8UjsXaBL9BGXYs6Lre5j7NPcGIyvK0E+7/m96YhiRk1fYzdlUs2ja3GdKHv7vW1J+A iAXtbbXWMRRGX1FSUPRWVZJIFYzsk+8dXQhG6b+IrNQZVZoVlS4qvPYpts3fRUF2Akhv GoaT0DrE+aumV4xAnQhNapFtitPK/lFy5SPZvoMU+ZIqww+hXCpcXUwNzcLwB1zSz4uI 3Iaaw5FPispf6PT6g7CGJ0GyK5RTdaDe57UCaOEQmWXffDN+XoS90DH8vyKNYZMVEbwU 9bQg== X-Gm-Message-State: AOAM530LYjt+N3gtatgmtmlNyI1LiS7aHh9WqFnuqg/MixCg81aBFNi1 cjn/yva6GVi8n7yyD2zUlxm8JA== X-Google-Smtp-Source: ABdhPJxdnzgjCBU0e9yqMVsm3M9xQMx+59TGzEYS+bWrR/7z1bqY+AIXep7vka7f7D5Qlq2UC6GXCg== X-Received: by 2002:a17:902:9b96:: with SMTP id y22mr1276979plp.100.1643313716712; Thu, 27 Jan 2022 12:01:56 -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.01.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:01:48 -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, Daniel Vetter , Laurent Pinchart , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 02/35] component: Introduce the aggregate bus_type Date: Thu, 27 Jan 2022 12:01:08 -0800 Message-Id: <20220127200141.1295328-3-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The component framework only provides 'bind' and 'unbind' callbacks to tell the host driver that it is time to assemble the aggregate driver now that all the components have probed. The component framework doesn't attempt to resolve runtime PM or suspend/resume ordering, and explicitly mentions this in the code. This lack of support leads to some pretty gnarly usages of the 'prepare' and 'complete' power management hooks in drivers that host the aggregate device, and it fully breaks down when faced with ordering shutdown between the various components, the aggregate driver, and the host driver that registers the whole thing. In a concrete example, the MSM display driver at drivers/gpu/drm/msm is using 'prepare' and 'complete' to call the drm helpers drm_mode_config_helper_suspend() and drm_mode_config_helper_resume() respectively, so that it can move the aggregate driver suspend/resume callbacks to be before and after the components that make up the drm device call any suspend/resume hooks they have. This only works as long as the component devices don't do anything in their own 'prepare' and 'complete' callbacks. If they did, then the ordering would be incorrect and we would be doing something in the component drivers before the aggregate driver could do anything. Yuck! Similarly, when trying to add shutdown support to the MSM driver we run across a problem where we're trying to shutdown the drm device via drm_atomic_helper_shutdown(), but some of the devices in the encoder chain have already been shutdown. This time, the component devices aren't the problem (although they could be if they did anything in their shutdown callbacks), but there's a DSI to eDP bridge in the encoder chain that has already been shutdown before the driver hosting the aggregate device runs shutdown. The ordering of driver probe is like this: 1. msm_pdev_probe() (host driver) 2. DSI bridge 3. aggregate bind When it comes to shutdown we have this order: 1. DSI bridge 2. msm_pdev_shutdown() (host driver) and so the bridge is already off, but we want to communicate to it to turn things off on the display during msm_pdev_shutdown(). Double yuck! Unfortunately, this time we can't split shutdown into multiple phases and swap msm_pdev_shutdown() with the DSI bridge. Let's make the component_master_ops into an actual device driver that has probe/remove/shutdown functions. The driver will only be bound to the aggregate device once all component drivers have called component_add() to indicate they're ready to assemble the aggregate driver. This allows us to attach shutdown logic (and in the future runtime PM logic) to the aggregate driver so that it runs the hooks in the correct order. Cc: Daniel Vetter Cc: Greg Kroah-Hartman Cc: Laurent Pinchart Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- drivers/base/component.c | 486 ++++++++++++++++++++++++++++---------- include/linux/component.h | 58 ++++- 2 files changed, 417 insertions(+), 127 deletions(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index 34f9e0802719..dc748ef0b23b 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -4,10 +4,14 @@ */ #include #include +#include #include #include #include #include +#include + +#include "base.h" =20 /** * DOC: overview @@ -31,8 +35,8 @@ * * Aggregate drivers first assemble a component match list of what they ne= ed * using component_match_add(). This is then registered as an aggregate dr= iver - * using component_master_add_with_match(), and unregistered using - * component_master_del(). + * using component_aggregate_register(), and unregistered using + * component_aggregate_unregister(). */ =20 struct component; @@ -53,14 +57,20 @@ struct component_match { }; =20 struct aggregate_device { - struct list_head node; - bool bound; - const struct component_master_ops *ops; struct device *parent; + struct device dev; struct component_match *match; + struct aggregate_driver *adrv; + + int id; }; =20 +static inline struct aggregate_device *to_aggregate_device(struct device *= d) +{ + return container_of(d, struct aggregate_device, dev); +} + struct component { struct list_head node; struct aggregate_device *adev; @@ -69,11 +79,12 @@ struct component { const struct component_ops *ops; int subcomponent; struct device *dev; + struct device_link *link; }; =20 static DEFINE_MUTEX(component_mutex); static LIST_HEAD(component_list); -static LIST_HEAD(aggregate_devices); +static DEFINE_IDA(aggregate_ida); =20 #ifdef CONFIG_DEBUG_FS =20 @@ -89,7 +100,7 @@ static int component_devices_show(struct seq_file *s, vo= id *data) seq_printf(s, "%-40s %20s\n", "aggregate_device name", "status"); seq_puts(s, "------------------------------------------------------------= -\n"); seq_printf(s, "%-40s %20s\n\n", - dev_name(m->parent), m->bound ? "bound" : "not bound"); + dev_name(m->parent), m->dev.driver ? "bound" : "not bound"); =20 seq_printf(s, "%-40s %20s\n", "device name", "status"); seq_puts(s, "------------------------------------------------------------= -\n"); @@ -137,16 +148,21 @@ static void component_debugfs_del(struct aggregate_de= vice *m) =20 #endif =20 -static struct aggregate_device *__aggregate_find(struct device *parent, - const struct component_master_ops *ops) +struct aggregate_bus_find_data { + const struct component_master_ops *ops; + struct device *parent; +}; + +static int aggregate_bus_find_match(struct device *dev, const void *_data) { - struct aggregate_device *m; + struct aggregate_device *adev =3D to_aggregate_device(dev); + const struct aggregate_bus_find_data *data =3D _data; =20 - list_for_each_entry(m, &aggregate_devices, node) - if (m->parent =3D=3D parent && (!ops || m->ops =3D=3D ops)) - return m; + if (adev->parent =3D=3D data->parent && + (!data->ops || adev->ops =3D=3D data->ops)) + return 1; =20 - return NULL; + return 0; } =20 static struct component *find_component(struct aggregate_device *adev, @@ -173,7 +189,6 @@ static int find_components(struct aggregate_device *ade= v) { struct component_match *match =3D adev->match; size_t i; - int ret =3D 0; =20 /* * Scan the array of match functions and attach @@ -182,6 +197,7 @@ static int find_components(struct aggregate_device *ade= v) for (i =3D 0; i < match->num; i++) { struct component_match_array *mc =3D &match->compare[i]; struct component *c; + bool duplicate; =20 dev_dbg(adev->parent, "Looking for component %zu\n", i); =20 @@ -189,20 +205,27 @@ static int find_components(struct aggregate_device *a= dev) continue; =20 c =3D find_component(adev, mc); - if (!c) { - ret =3D -ENXIO; - break; - } + if (!c) + return 0; =20 + duplicate =3D !!c->adev; dev_dbg(adev->parent, "found component %s, duplicate %u\n", - dev_name(c->dev), !!c->adev); + dev_name(c->dev), duplicate); =20 /* Attach this component to the adev */ - match->compare[i].duplicate =3D !!c->adev; + match->compare[i].duplicate =3D duplicate; match->compare[i].component =3D c; + if (duplicate) + continue; + + /* Matches put in component_del() */ + get_device(&adev->dev); + c->link =3D device_link_add(&adev->dev, c->dev, + DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME); c->adev =3D adev; } - return ret; + + return 1; } =20 /* Detach component from associated aggregate_device */ @@ -216,73 +239,6 @@ static void remove_component(struct aggregate_device *= adev, struct component *c) adev->match->compare[i].component =3D NULL; } =20 -/* - * Try to bring up an aggregate device. If component is NULL, we're inter= ested - * in this aggregate device, otherwise it's a component which must be pres= ent - * to try and bring up the aggregate device. - * - * Returns 1 for successful bringup, 0 if not ready, or -ve errno. - */ -static int try_to_bring_up_aggregate_device(struct aggregate_device *adev, - struct component *component) -{ - int ret; - - dev_dbg(adev->parent, "trying to bring up adev\n"); - - if (find_components(adev)) { - dev_dbg(adev->parent, "master has incomplete components\n"); - return 0; - } - - if (component && component->adev !=3D adev) { - dev_dbg(adev->parent, "master is not for this component (%s)\n", - dev_name(component->dev)); - return 0; - } - - if (!devres_open_group(adev->parent, adev, GFP_KERNEL)) - return -ENOMEM; - - /* Found all components */ - ret =3D adev->ops->bind(adev->parent); - if (ret < 0) { - devres_release_group(adev->parent, NULL); - if (ret !=3D -EPROBE_DEFER) - dev_info(adev->parent, "adev bind failed: %d\n", ret); - return ret; - } - - devres_close_group(adev->parent, NULL); - adev->bound =3D true; - return 1; -} - -static int try_to_bring_up_masters(struct component *component) -{ - struct aggregate_device *adev; - int ret =3D 0; - - list_for_each_entry(adev, &aggregate_devices, node) { - if (!adev->bound) { - ret =3D try_to_bring_up_aggregate_device(adev, component); - if (ret !=3D 0) - break; - } - } - - return ret; -} - -static void take_down_aggregate_device(struct aggregate_device *adev) -{ - if (adev->bound) { - adev->ops->unbind(adev->parent); - devres_release_group(adev->parent, adev); - adev->bound =3D false; - } -} - static void devm_component_match_release(struct device *parent, void *res) { struct component_match *match =3D res; @@ -426,7 +382,6 @@ static void free_aggregate_device(struct aggregate_devi= ce *adev) int i; =20 component_debugfs_del(adev); - list_del(&adev->node); =20 if (match) { for (i =3D 0; i < match->num; i++) { @@ -436,9 +391,201 @@ static void free_aggregate_device(struct aggregate_de= vice *adev) } } =20 + ida_free(&aggregate_ida, adev->id); kfree(adev); } =20 +static void aggregate_device_release(struct device *dev) +{ + struct aggregate_device *adev =3D to_aggregate_device(dev); + + free_aggregate_device(adev); +} + +static int aggregate_device_match(struct device *dev, struct device_driver= *drv) +{ + const struct aggregate_driver *adrv =3D to_aggregate_driver(drv); + struct aggregate_device *adev =3D to_aggregate_device(dev); + int ret; + + /* Is this driver associated with this device */ + if (adrv !=3D adev->adrv) + return 0; + + /* Should we start to assemble? */ + mutex_lock(&component_mutex); + ret =3D find_components(adev); + mutex_unlock(&component_mutex); + + return ret; +} + +/* TODO: Remove once all aggregate drivers use component_aggregate_registe= r() */ +static int component_probe_bind(struct aggregate_device *adev) +{ + return adev->ops->bind(adev->parent); +} + +static void component_remove_unbind(struct aggregate_device *adev) +{ + adev->ops->unbind(adev->parent); +} + +static int aggregate_driver_probe(struct device *dev) +{ + const struct aggregate_driver *adrv =3D to_aggregate_driver(dev->driver); + struct aggregate_device *adev =3D to_aggregate_device(dev); + bool modern =3D adrv->probe !=3D component_probe_bind; + int ret; + + /* Only do runtime PM when drivers migrate */ + if (modern) { + pm_runtime_get_noresume(dev); + pm_runtime_set_active(dev); + pm_runtime_enable(dev); + } + + mutex_lock(&component_mutex); + if (devres_open_group(adev->parent, adev, GFP_KERNEL)) { + ret =3D adrv->probe(adev); + if (ret) + devres_release_group(adev->parent, NULL); + } else { + ret =3D -ENOMEM; + } + devres_close_group(adev->parent, NULL); + mutex_unlock(&component_mutex); + + if (ret && modern) { + pm_runtime_disable(dev); + pm_runtime_set_suspended(dev); + pm_runtime_put_noidle(dev); + } + + return ret; +} + +static void aggregate_driver_remove(struct device *dev) +{ + const struct aggregate_driver *adrv =3D to_aggregate_driver(dev->driver); + struct aggregate_device *adev =3D to_aggregate_device(dev); + bool modern =3D adrv->remove !=3D component_remove_unbind; + + /* Only do runtime PM when drivers migrate */ + if (modern) + pm_runtime_get_sync(dev); + adrv->remove(to_aggregate_device(dev)); + devres_release_group(adev->parent, adev); + if (!modern) + return; + + pm_runtime_put_noidle(dev); + + pm_runtime_disable(dev); + pm_runtime_set_suspended(dev); + pm_runtime_put_noidle(dev); +} + +static void aggregate_driver_shutdown(struct device *dev) +{ + const struct aggregate_driver *adrv =3D to_aggregate_driver(dev->driver); + + if (adrv && adrv->shutdown) + adrv->shutdown(to_aggregate_device(dev)); +} + +static struct bus_type aggregate_bus_type =3D { + .name =3D "aggregate", + .match =3D aggregate_device_match, + .probe =3D aggregate_driver_probe, + .remove =3D aggregate_driver_remove, + .shutdown =3D aggregate_driver_shutdown, +}; + +/* Callers take ownership of return value, should call put_device() */ +static struct aggregate_device *__aggregate_find(struct device *parent, + const struct component_master_ops *ops) +{ + struct device *dev; + struct aggregate_bus_find_data data =3D { + .ops =3D ops, + .parent =3D parent, + }; + + dev =3D bus_find_device(&aggregate_bus_type, NULL, &data, + aggregate_bus_find_match); + + return dev ? to_aggregate_device(dev) : NULL; +} + +static DEFINE_MUTEX(aggregate_mutex); + +static int aggregate_driver_register(struct aggregate_driver *adrv) +{ + int ret =3D 0; + + mutex_lock(&aggregate_mutex); + if (!refcount_inc_not_zero(&adrv->count)) { + adrv->driver.bus =3D &aggregate_bus_type; + ret =3D driver_register(&adrv->driver); + if (!ret) + refcount_set(&adrv->count, 1); + } + mutex_unlock(&aggregate_mutex); + + return ret; +} + +static void aggregate_driver_unregister(struct aggregate_driver *adrv) +{ + if (refcount_dec_and_mutex_lock(&adrv->count, &aggregate_mutex)) { + driver_unregister(&adrv->driver); + mutex_unlock(&aggregate_mutex); + } +} + +static struct aggregate_device *aggregate_device_add(struct device *parent, + const struct component_master_ops *ops, struct aggregate_driver *adrv, + struct component_match *match) +{ + struct aggregate_device *adev; + int ret, id; + + /* Reallocate the match array for its true size */ + ret =3D component_match_realloc(match, match->num); + if (ret) + return ERR_PTR(ret); + + adev =3D kzalloc(sizeof(*adev), GFP_KERNEL); + if (!adev) + return ERR_PTR(-ENOMEM); + + id =3D ida_alloc(&aggregate_ida, GFP_KERNEL); + if (id < 0) { + kfree(adev); + return ERR_PTR(id); + } + + adev->id =3D id; + adev->parent =3D parent; + adev->dev.bus =3D &aggregate_bus_type; + adev->dev.release =3D aggregate_device_release; + adev->ops =3D ops; + adev->match =3D match; + adev->adrv =3D adrv; + dev_set_name(&adev->dev, "aggregate%d", id); + + ret =3D device_register(&adev->dev); + if (ret) { + put_device(&adev->dev); + return ERR_PTR(ret); + } + + component_debugfs_add(adev); + + return adev; +} + /** * component_master_add_with_match - register an aggregate driver * @parent: parent device of the aggregate driver @@ -450,42 +597,70 @@ static void free_aggregate_device(struct aggregate_de= vice *adev) * @match are available, it will be assembled by calling * &component_master_ops.bind from @ops. Must be unregistered by calling * component_master_del(). + * + * Deprecated: Use component_aggregate_register() instead. */ int component_master_add_with_match(struct device *parent, const struct component_master_ops *ops, struct component_match *match) { + struct aggregate_driver *adrv; struct aggregate_device *adev; - int ret; - - /* Reallocate the match array for its true size */ - ret =3D component_match_realloc(match, match->num); - if (ret) - return ret; + int ret =3D 0; =20 - adev =3D kzalloc(sizeof(*adev), GFP_KERNEL); - if (!adev) + adrv =3D kzalloc(sizeof(*adrv), GFP_KERNEL); + if (!adrv) return -ENOMEM; =20 - adev->parent =3D parent; - adev->ops =3D ops; - adev->match =3D match; + adev =3D aggregate_device_add(parent, ops, adrv, match); + if (IS_ERR(adev)) { + ret =3D PTR_ERR(adev); + goto err; + } =20 - component_debugfs_add(adev); - /* Add to the list of available aggregate devices. */ - mutex_lock(&component_mutex); - list_add(&adev->node, &aggregate_devices); + adrv->probe =3D component_probe_bind; + adrv->remove =3D component_remove_unbind; + adrv->driver.owner =3D THIS_MODULE; + adrv->driver.name =3D dev_name(&adev->dev); =20 - ret =3D try_to_bring_up_aggregate_device(adev, NULL); + ret =3D aggregate_driver_register(adrv); + if (!ret) + return 0; =20 - if (ret < 0) - free_aggregate_device(adev); + put_device(&adev->dev); +err: + kfree(adrv); + return ret; +} +EXPORT_SYMBOL_GPL(component_master_add_with_match); =20 - mutex_unlock(&component_mutex); +/** + * component_aggregate_register - register an aggregate driver + * @parent: parent device of the aggregate driver + * @adrv: aggregate driver to register + * + * Registers a new aggregate driver consisting of the components added to = @adrv.match + * by calling one of the component_match_add() functions. Once all compone= nts in + * @match are available, the aggregate driver will be assembled by calling + * &adrv.bind. Must be unregistered by calling component_aggregate_unregis= ter(). + */ +int component_aggregate_register(struct device *parent, + struct aggregate_driver *adrv, struct component_match *match) +{ + struct aggregate_device *adev; + int ret; + + adev =3D aggregate_device_add(parent, NULL, adrv, match); + if (IS_ERR(adev)) + return PTR_ERR(adev); + + ret =3D aggregate_driver_register(adrv); + if (ret) + put_device(&adev->dev); =20 - return ret < 0 ? ret : 0; + return ret; } -EXPORT_SYMBOL_GPL(component_master_add_with_match); +EXPORT_SYMBOL_GPL(component_aggregate_register); =20 /** * component_master_del - unregister an aggregate driver @@ -495,22 +670,60 @@ EXPORT_SYMBOL_GPL(component_master_add_with_match); * Unregisters an aggregate driver registered with * component_master_add_with_match(). If necessary the aggregate driver is= first * disassembled by calling &component_master_ops.unbind from @ops. + * + * Deprecated: Use component_aggregate_unregister() instead. */ void component_master_del(struct device *parent, const struct component_master_ops *ops) { struct aggregate_device *adev; + struct aggregate_driver *adrv; + struct device_driver *drv; =20 mutex_lock(&component_mutex); adev =3D __aggregate_find(parent, ops); + mutex_unlock(&component_mutex); + if (adev) { - take_down_aggregate_device(adev); - free_aggregate_device(adev); + drv =3D adev->dev.driver; + if (drv) { + adrv =3D to_aggregate_driver(drv); + aggregate_driver_unregister(adrv); + kfree(adrv); + } + + device_unregister(&adev->dev); } - mutex_unlock(&component_mutex); + put_device(&adev->dev); } EXPORT_SYMBOL_GPL(component_master_del); =20 +/** + * component_aggregate_unregister - unregister an aggregate driver + * @parent: parent device of the aggregate driver + * @adrv: registered aggregate driver + * + * Unregisters an aggregate driver registered with + * component_aggregate_register(). If necessary the aggregate driver is fi= rst + * disassembled. + */ +void component_aggregate_unregister(struct device *parent, + struct aggregate_driver *adrv) +{ + struct aggregate_device *adev; + + mutex_lock(&component_mutex); + adev =3D __aggregate_find(parent, NULL); + mutex_unlock(&component_mutex); + + if (adev) + device_unregister(&adev->dev); + put_device(&adev->dev); + + aggregate_driver_unregister(adrv); +} +EXPORT_SYMBOL_GPL(component_aggregate_unregister); + static void component_unbind(struct component *component, struct aggregate_device *adev, void *data) { @@ -551,6 +764,8 @@ void component_unbind_all(struct device *parent, void *= data) c =3D adev->match->compare[i].component; component_unbind(c, adev, data); } + + put_device(&adev->dev); } EXPORT_SYMBOL_GPL(component_unbind_all); =20 @@ -645,6 +860,7 @@ int component_bind_all(struct device *parent, void *dat= a) component_unbind(c, adev, data); } } + put_device(&adev->dev); =20 return ret; } @@ -668,18 +884,22 @@ static int __component_add(struct device *dev, const = struct component_ops *ops, =20 mutex_lock(&component_mutex); list_add_tail(&component->node, &component_list); - - ret =3D try_to_bring_up_masters(component); - if (ret < 0) { - if (component->adev) - remove_component(component->adev, component); - list_del(&component->node); - - kfree(component); - } mutex_unlock(&component_mutex); =20 - return ret < 0 ? ret : 0; + /* + * Try to bind. + * + * Note: we don't check the return value here because component devices + * don't care that the aggregate device can actually probe or not. They + * only care about adding themselves to the component_list and then + * waiting for their component_ops::bind_component callback to be + * called. + */ + ret =3D bus_rescan_devices(&aggregate_bus_type); + if (ret) + dev_dbg(dev, "rescan returned %d\n", ret); + + return 0; } =20 /** @@ -743,6 +963,7 @@ EXPORT_SYMBOL_GPL(component_add); */ void component_del(struct device *dev, const struct component_ops *ops) { + struct aggregate_device *adev =3D NULL; struct component *c, *component =3D NULL; =20 mutex_lock(&component_mutex); @@ -754,13 +975,26 @@ void component_del(struct device *dev, const struct c= omponent_ops *ops) } =20 if (component && component->adev) { - take_down_aggregate_device(component->adev); - remove_component(component->adev, component); + adev =3D component->adev; + remove_component(adev, component); } =20 mutex_unlock(&component_mutex); =20 + if (adev) { + /* Force unbind */ + device_driver_detach(&adev->dev); + device_link_del(component->link); + put_device(&adev->dev); + } + WARN_ON(!component); kfree(component); } EXPORT_SYMBOL_GPL(component_del); + +static int __init aggregate_bus_init(void) +{ + return bus_register(&aggregate_bus_type); +} +postcore_initcall(aggregate_bus_init); diff --git a/include/linux/component.h b/include/linux/component.h index 7012569c6546..aa69ea0401d3 100644 --- a/include/linux/component.h +++ b/include/linux/component.h @@ -3,7 +3,8 @@ #define COMPONENT_H =20 #include - +#include +#include =20 struct device; =20 @@ -82,11 +83,66 @@ struct component_master_ops { void (*unbind)(struct device *master); }; =20 +/** + * struct aggregate_driver - Aggregate driver (made up of other drivers) + * @count: driver registration refcount + * @driver: device driver + */ +struct aggregate_driver { + /** + * @probe: + * + * Called when all components or the aggregate driver, as specified in + * the aggregate_device's match list are + * ready. Usually there are 3 steps to bind an aggregate driver: + * + * 1. Allocate a struct aggregate_driver. + * + * 2. Bind all components to the aggregate driver by calling + * component_bind_all() with the aggregate driver structure as opaque + * pointer data. + * + * 3. Register the aggregate driver with the subsystem to publish its + * interfaces. + */ + int (*probe)(struct aggregate_device *adev); + /** + * @remove: + * + * Called when either the aggregate driver, using + * component_aggregate_unregister(), or one of its components, using + * component_del(), is unregistered. + */ + void (*remove)(struct aggregate_device *adev); + /** + * @shutdown: + * + * Called when the system is shutting down. + */ + void (*shutdown)(struct aggregate_device *adev); + + refcount_t count; + struct device_driver driver; +}; + +static inline struct aggregate_driver *to_aggregate_driver(struct device_d= river *d) +{ + if (!d) + return NULL; + + return container_of(d, struct aggregate_driver, driver); +} + void component_master_del(struct device *, const struct component_master_ops *); =20 struct component_match; =20 +int component_aggregate_register(struct device *parent, + struct aggregate_driver *adrv, struct component_match *match); +void component_aggregate_unregister(struct device *parent, + struct aggregate_driver *adrv); + int component_master_add_with_match(struct device *, const struct component_master_ops *, struct component_match *); void component_match_add_release(struct device *parent, --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 6584CC433FE for ; Thu, 27 Jan 2022 20:02:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343655AbiA0UCC (ORCPT ); Thu, 27 Jan 2022 15:02:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343622AbiA0UB6 (ORCPT ); Thu, 27 Jan 2022 15:01:58 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6031EC061714 for ; Thu, 27 Jan 2022 12:01:58 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id j16so3702986plx.4 for ; Thu, 27 Jan 2022 12:01:58 -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=mlOjEQaGgQJEWexKeIDPB6ZywfuO0Krhl/6WTCAgp1U=; b=eyrrZkbzPEVq72Z6fNYVKdNXOMuVYUB7XGcmAelArR/eBBTm4qv34sUVGHRw2+3Xjb qxYlvdBkbnSilPXGvWPCeiDXV+5AgRyZ6rpwDbyu6pszvNmM2d966CHxA1CXRr6njd4o N75g5GBD63J2h2qcjJmsi51wKmNMAMIts0FjU= 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=mlOjEQaGgQJEWexKeIDPB6ZywfuO0Krhl/6WTCAgp1U=; b=CfZUghf71Gxzmx9HZXWtcICX/uod69NPP5lHxJZNJFoh9rfOrTjNszksQxJ45pNy4e zzKVg+QitzwMwhEZBmu7T0OC4+RcZKiuXSX1uCbotWELyfdrI7BakRoIIGHZKYHsA231 BovWc4N2CcOKw91NA36ZhzaFXvNOPIn95F5L3agYhdcrqpC8AXNePzADSkhornqfyCrH 5WSsBF/txfdSTqv1X1Mm2oxYMEIqhQ7Uynu+WhwqdAk1NUstlQmgKGgvLQ2tTcQ1ZJui VNRZsBrqPmrqoae9VMY9CQm6/0ql46OFDX2uos6I7nKi28mYPprP/p+VIOUEf3At0xXn PX4w== X-Gm-Message-State: AOAM530oFX5P8di7pkMVTLxv/Zw6P+aRTAxb1UTPBNOtJFwHTfIPXiYw biJbYovLbeeRKjd0wcblAe1hxQ== X-Google-Smtp-Source: ABdhPJw9tnBKTD10bdf8LXuHDZN29rkJYFCfmvP96l1VR5CM/34SWpZehvfM/GsxZluqGTjuFM522g== X-Received: by 2002:a17:902:f68e:: with SMTP id l14mr4800119plg.164.1643313717953; Thu, 27 Jan 2022 12:01:57 -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.01.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:01:57 -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, Jani Nikula , Daniel Vetter , Laurent Pinchart , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 03/35] component: Add aggregate_device_parent() for driver use Date: Thu, 27 Jan 2022 12:01:09 -0800 Message-Id: <20220127200141.1295328-4-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This allows aggregate driver writers to get the parent of the aggregate device passed to their probe/remove/shutdown functions. Suggested-by: Jani Nikula Cc: Daniel Vetter Cc: Greg Kroah-Hartman Cc: Laurent Pinchart Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- drivers/base/component.c | 6 ++++++ include/linux/component.h | 1 + 2 files changed, 7 insertions(+) diff --git a/drivers/base/component.c b/drivers/base/component.c index dc748ef0b23b..13ac2004a913 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -71,6 +71,12 @@ static inline struct aggregate_device *to_aggregate_devi= ce(struct device *d) return container_of(d, struct aggregate_device, dev); } =20 +struct device *aggregate_device_parent(const struct aggregate_device *adev) +{ + return adev->parent; +} +EXPORT_SYMBOL_GPL(aggregate_device_parent); + struct component { struct list_head node; struct aggregate_device *adev; diff --git a/include/linux/component.h b/include/linux/component.h index aa69ea0401d3..c39dea7824af 100644 --- a/include/linux/component.h +++ b/include/linux/component.h @@ -43,6 +43,7 @@ int component_bind_all(struct device *parent, void *data); void component_unbind_all(struct device *parent, void *data); =20 struct aggregate_device; +struct device *aggregate_device_parent(const struct aggregate_device *adev= ); =20 /** * struct component_master_ops - callback for the aggregate driver --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 DB67AC433EF for ; Thu, 27 Jan 2022 20:02:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343665AbiA0UCE (ORCPT ); Thu, 27 Jan 2022 15:02:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343642AbiA0UB7 (ORCPT ); Thu, 27 Jan 2022 15:01:59 -0500 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F407C061747 for ; Thu, 27 Jan 2022 12:01:59 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id s2-20020a17090ad48200b001b501977b23so8674534pju.2 for ; Thu, 27 Jan 2022 12:01:59 -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=mnLXiJbCUaC6XTZzeAM0x5jkp+ZwTQGnS1QkwL8Pb08=; b=lWqllZqrDcVmSKuLBzM5NetfRm+wmp9lMVdzziEYwXfKf4DloUdfa+Hdk0K+m5nRv5 08JmDvKm12bU1zd+uSV5KyJxyXHDBz0ytGNa5+M+uSId9nA4tL0CF53rTjg3W9Pgts8F CKDmILXBrnN/1i89gLb87AXvEofiPkb6aj2jo= 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=mnLXiJbCUaC6XTZzeAM0x5jkp+ZwTQGnS1QkwL8Pb08=; b=TUCoKi1L5Fx+aBcMgVDvduhY51gHkEJcwBoLxKT+kGS2rAfyJW12kUUpemyjWq97rg WsneUaTrF8TRT49XXKtZsWnerkP59hH/q3BMZJvwlg7I4FIp7IS6a1YnB9k1zE2ZQGIZ 1+UZQkK6W/brzKgdFzSEvhYrn+XJKYcCWoQL2hqme3plBiqYiAk1TAOBtOl9Wwa6vmbq u1S6BszAOVPKYwM4iKJqAvOCRJVYAJiYkykdJALdoYPvRfM5+uwoF183tTOY8uA5JesZ q/C/L3UMgksaSNAgaUX1otnMRtSvoe1G3jRvp7XzjIAC/5AUGePRvV/7OgbamBroqw41 zN7A== X-Gm-Message-State: AOAM532VjIjHUkxBQo0gasib/DaHh6h75bFngx81pBq5/yxthLSGw7ew XIWaSIDKe88AjmGL//gThMenpg== X-Google-Smtp-Source: ABdhPJwELBm2hJJkKCHCGDWi0uz0RH9y0pifltZnK5CSGFtfaIxRrrrZ6UAYfSEjLNlhVwuFfkr4HQ== X-Received: by 2002:a17:90b:3b46:: with SMTP id ot6mr9864097pjb.179.1643313719206; Thu, 27 Jan 2022 12:01:59 -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.01.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:01:58 -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, Daniel Vetter , Daniel Vetter , Laurent Pinchart , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 04/35] component: Add {bind,unbind}_component() ops that take aggregate device Date: Thu, 27 Jan 2022 12:01:10 -0800 Message-Id: <20220127200141.1295328-5-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" We'd like to get more device model features in the component framework so let's pass the struct aggregate_device pointer instead of the parent device pointer to the component binding functions. This will allow drivers to inspect and control things related to the aggregate device in case they need it, and they'll always be able to get back to the device they were using before by using the 'parent' member of the aggregate device struct. Suggested-by: Daniel Vetter Cc: Daniel Vetter Cc: Greg Kroah-Hartman Cc: Laurent Pinchart Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- drivers/base/component.c | 14 +++++++++++--- include/linux/component.h | 23 ++++++++++++++++++++++- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index 13ac2004a913..5b91a114786d 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -735,8 +735,13 @@ static void component_unbind(struct component *compone= nt, { WARN_ON(!component->bound); =20 - if (component->ops && component->ops->unbind) - component->ops->unbind(component->dev, adev->parent, data); + if (component->ops) { + if (component->ops->unbind) + component->ops->unbind(component->dev, adev->parent, data); + else if (component->ops->unbind_component) + component->ops->unbind_component(component->dev, adev, data); + } + component->bound =3D false; =20 /* Release all resources claimed in the binding of this component */ @@ -801,7 +806,10 @@ static int component_bind(struct component *component,= struct aggregate_device * dev_dbg(adev->parent, "binding %s (ops %ps)\n", dev_name(component->dev), component->ops); =20 - ret =3D component->ops->bind(component->dev, adev->parent, data); + if (component->ops->bind_component) + ret =3D component->ops->bind_component(component->dev, adev, data); + else + ret =3D component->ops->bind(component->dev, adev->parent, data); if (!ret) { component->bound =3D true; =20 diff --git a/include/linux/component.h b/include/linux/component.h index c39dea7824af..073cbe9fea32 100644 --- a/include/linux/component.h +++ b/include/linux/component.h @@ -6,6 +6,7 @@ #include #include =20 +struct aggregate_device; struct device; =20 /** @@ -20,18 +21,39 @@ struct component_ops { * * Called through component_bind_all() when the aggregate driver is * ready to bind the overall driver. + * + * Deprecated: Use bind_component() instead. */ int (*bind)(struct device *comp, struct device *master, void *master_data); + /** + * @bind_component: + * + * Called through component_bind_all() when the aggregate driver is + * ready to bind the overall driver. + */ + int (*bind_component)(struct device *comp, struct aggregate_device *adev, + void *aggregate_data); /** * @unbind: * * Called through component_unbind_all() when the aggregate driver is * ready to bind the overall driver, or when component_bind_all() fails * part-ways through and needs to unbind some already bound components. + * + * Deprecated: Use unbind_component() instead. */ void (*unbind)(struct device *comp, struct device *master, void *master_data); + /** + * @unbind_component: + * + * Called through component_unbind_all() when the aggregate driver is + * ready to unbind the overall driver, or when component_bind_all() fails + * part-ways through and needs to unbind some already bound components. + */ + int (*unbind_component)(struct device *comp, struct aggregate_device *ade= v, + void *aggregate_data); }; =20 int component_add(struct device *, const struct component_ops *); @@ -42,7 +64,6 @@ void component_del(struct device *, const struct componen= t_ops *); int component_bind_all(struct device *parent, void *data); void component_unbind_all(struct device *parent, void *data); =20 -struct aggregate_device; struct device *aggregate_device_parent(const struct aggregate_device *adev= ); =20 /** --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 3E089C4332F for ; Thu, 27 Jan 2022 20:02:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343657AbiA0UCI (ORCPT ); Thu, 27 Jan 2022 15:02:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343650AbiA0UCB (ORCPT ); Thu, 27 Jan 2022 15:02:01 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED798C061747 for ; Thu, 27 Jan 2022 12:02:00 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id i1so3668237pla.9 for ; Thu, 27 Jan 2022 12:02:00 -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=VhuBKYUydW/oAiCUL39yB0AWYBKOWjvjaMBQaeNTygM=; b=JTAhu45HjLrGN1796BA+tTBKdZIZpsx5QiysdWprNrAbi58xzewJb434XsoCmY5lZo 2icc8mot+qjYU3QPcf1TCDXdsDcWFn8RD/waujc1pge5siUAzBrhPvTWqhWVDw8zYIOs pkYsKKCxqQufaYfH19vEp8rPBJlN1Oat/78Fo= 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=VhuBKYUydW/oAiCUL39yB0AWYBKOWjvjaMBQaeNTygM=; b=4LQNNbnKbQLTcsU6zs35tkFolE+fsQNKWZtTBrxp1rxeLwfj8oB3hW6wZhFcmoWW+V 6DLMI6zBV3zMou2FEl8aQc0/YpiFW9MjZBN4cEO3pbyedYDsW8gs//aSPUlMGxdSMoJN LbTh5hbEETHFS+PSi8CRKh3OfLSWqHrAvPkbilFEfcMg8Z/P0PLrlDteRjC1wMbXhbxE asfSif5zGC4zqzVs2yFpIeT4nQC3lWA3Pp0Nq6Jcf6SlJOdlsSZvmVKutICNTpnCI7xu kIBMCnyi0o0SFfyn7jTxk5lr/XXePAjRhFijNF+EREdKaOaVZGIfFs+ziv2P9jdl3ujC 8tJw== X-Gm-Message-State: AOAM531K3B01yYri8TR/X8fqneos51t1Ug/JiCG2vGoK+TO+MfRGKMDA I0XWLih2wAAt8LWrl00iLvF2Fg== X-Google-Smtp-Source: ABdhPJxi2R1QyEM0RMEH1SPhkr28S9ztrw3wamvODzzAyi5rCnC4N/AyF0SlT/c4nduP8mKx2Vhr/w== X-Received: by 2002:a17:90b:1b08:: with SMTP id nu8mr5856603pjb.82.1643313720505; Thu, 27 Jan 2022 12:02:00 -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.01.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:00 -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, Laurent Pinchart , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 05/35] drm/of: Add a drm_of_aggregate_probe() API Date: Thu, 27 Jan 2022 12:01:11 -0800 Message-Id: <20220127200141.1295328-6-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Similar to drm_of_component_probe() but using the new API that registers a driver instead of an ops struct. This allows us to migrate the users of drm_of_component_probe() to the new way of doing things. Cc: Laurent Pinchart Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- drivers/gpu/drm/drm_of.c | 85 +++++++++++++++++++++++++++++++--------- include/drm/drm_of.h | 12 ++++++ 2 files changed, 78 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 59d368ea006b..0fe822319aae 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -99,30 +99,18 @@ void drm_of_component_match_add(struct device *master, } EXPORT_SYMBOL_GPL(drm_of_component_match_add); =20 -/** - * drm_of_component_probe - Generic probe function for a component based m= aster - * @dev: master device containing the OF node - * @compare_of: compare function used for matching components - * @m_ops: component master ops to be used - * - * Parse the platform device OF node and bind all the components associated - * with the master. Interface ports are added before the encoders in order= to - * satisfy their .bind requirements - * See Documentation/devicetree/bindings/graph.txt for the bindings. - * - * Returns zero if successful, or one of the standard error codes if it fa= ils. - */ -int drm_of_component_probe(struct device *dev, +static int _drm_of_component_probe(struct device *dev, int (*compare_of)(struct device *, void *), - const struct component_master_ops *m_ops) + struct component_match **matchptr) { struct device_node *ep, *port, *remote; - struct component_match *match =3D NULL; int i; =20 if (!dev->of_node) return -EINVAL; =20 + *matchptr =3D NULL; + /* * Bind the crtc's ports first, so that drm_of_find_possible_crtcs() * called from encoder's .bind callbacks works as expected @@ -133,7 +121,7 @@ int drm_of_component_probe(struct device *dev, break; =20 if (of_device_is_available(port->parent)) - drm_of_component_match_add(dev, &match, compare_of, + drm_of_component_match_add(dev, matchptr, compare_of, port); =20 of_node_put(port); @@ -144,7 +132,7 @@ int drm_of_component_probe(struct device *dev, return -ENODEV; } =20 - if (!match) { + if (!*matchptr) { dev_err(dev, "no available port\n"); return -ENODEV; } @@ -174,17 +162,76 @@ int drm_of_component_probe(struct device *dev, continue; } =20 - drm_of_component_match_add(dev, &match, compare_of, + drm_of_component_match_add(dev, matchptr, compare_of, remote); of_node_put(remote); } of_node_put(port); } =20 + return 0; +} + +/** + * drm_of_component_probe - Generic probe function for a component based m= aster + * @dev: master device containing the OF node + * @compare_of: compare function used for matching components + * @m_ops: component master ops to be used + * + * Parse the platform device OF node and bind all the components associated + * with the master. Interface ports are added before the encoders in order= to + * satisfy their .bind requirements + * See Documentation/devicetree/bindings/graph.txt for the bindings. + * + * Deprecated: Use drm_of_aggregate_probe() instead. + * + * Returns zero if successful, or one of the standard error codes if it fa= ils. + */ +int drm_of_component_probe(struct device *dev, + int (*compare_of)(struct device *, void *), + const struct component_master_ops *m_ops) +{ + + struct component_match *match; + int ret; + + ret =3D _drm_of_component_probe(dev, compare_of, &match); + if (ret) + return ret; + return component_master_add_with_match(dev, m_ops, match); } EXPORT_SYMBOL(drm_of_component_probe); =20 + +/** + * drm_of_aggregate_probe - Generic probe function for a component based a= ggregate host + * @dev: device containing the OF node + * @compare_of: compare function used for matching components + * @adrv: aggregate driver to be used + * + * Parse the platform device OF node and bind all the components associated + * with the aggregate device. Interface ports are added before the encoder= s in + * order to satisfy their .bind_component requirements + * See Documentation/devicetree/bindings/graph.txt for the bindings. + * + * Returns zero if successful, or one of the standard error codes if it fa= ils. + */ +int drm_of_aggregate_probe(struct device *dev, + int (*compare_of)(struct device *, void *), + struct aggregate_driver *adrv) +{ + struct component_match *match; + int ret; + + ret =3D _drm_of_component_probe(dev, compare_of, &match); + if (ret) + return ret; + + return component_aggregate_register(dev, adrv, match); +} +EXPORT_SYMBOL(drm_of_aggregate_probe); + /* * drm_of_encoder_active_endpoint - return the active encoder endpoint * @node: device tree node containing encoder input ports diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h index 99f79ac8b4cd..7c7b0d8377a7 100644 --- a/include/drm/drm_of.h +++ b/include/drm/drm_of.h @@ -7,6 +7,7 @@ #include #endif =20 +struct aggregate_driver; struct component_master_ops; struct component_match; struct device; @@ -40,6 +41,9 @@ void drm_of_component_match_add(struct device *master, int drm_of_component_probe(struct device *dev, int (*compare_of)(struct device *, void *), const struct component_master_ops *m_ops); +int drm_of_aggregate_probe(struct device *dev, + int (*compare_of)(struct device *, void *), + struct aggregate_driver *adrv); int drm_of_encoder_active_endpoint(struct device_node *node, struct drm_encoder *encoder, struct of_endpoint *endpoint); @@ -79,6 +83,14 @@ drm_of_component_probe(struct device *dev, return -EINVAL; } =20 +static inline int +drm_of_aggregate_probe(struct device *dev, + int (*compare_of)(struct device *, void *), + struct aggregate_driver *adrv) +{ + return -EINVAL; +} + static inline int drm_of_encoder_active_endpoint(struct device_node *node, struct drm_encoder *encoder, struct of_endpoint *endpoint) --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 AF773C433F5 for ; Thu, 27 Jan 2022 20:02:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343751AbiA0UCW (ORCPT ); Thu, 27 Jan 2022 15:02:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240093AbiA0UCG (ORCPT ); Thu, 27 Jan 2022 15:02:06 -0500 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4B2DC06174E for ; Thu, 27 Jan 2022 12:02:02 -0800 (PST) Received: by mail-pl1-x636.google.com with SMTP id k17so3763423plk.0 for ; Thu, 27 Jan 2022 12:02:02 -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=Zwidypq4Go5OKqz8SmfacxJttUeteOhXrn3UaB5BhXk=; b=REahsmFv7SO2EJS19EQED429NY5ulcBzeS591w9Qh4Pq6DIrlxU+tNgz/zgHk4ndaQ WmxeguS5tRm+SlE5GaCWn5j2DmkfC+5tNTZZ21cjQj5J5I9mkVRp+aiMLbedeIhp/GB+ UotSKyXeCFEAFddTD58EeLeO4HL6mIql/DJrg= 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=Zwidypq4Go5OKqz8SmfacxJttUeteOhXrn3UaB5BhXk=; b=bQ4xMEZibPlU2NUDHKNCNmWnoFTHGIVdtlBmBOUzxHtwd13JYuA7m4ePbuhXd4svcJ Ysf6y/A9NHjNr2x1BjlfagKQpO/+Xb3vDTqGk0Uo4u21+c0nIbU+T3tfY/ochFLpg0jr mxYcy1KsdPqKmLDaMB9ohqPfYo/B4A4yIQ9rwoL/vmETjUXmG7vOgLfazTJeo3MGD1PL SnJ8AXuFcP55STD4w7IXCQfd+qY81jKkJsPB6QotRdWZiqSGVlRzTAi7BHvL0vkjEARK mimXqybRK3QSkgo2mCiM5Wqkpa42LPmERne66UP1YtrxV/5ZO04Mj2YTP5QfW/atAWDY p7yw== X-Gm-Message-State: AOAM531+2YlrTInsmA7E/srILPR3flbVK9+R5yonUQEPIAmPwvUvb+rj bX/b614QbGp+1hc7O6/3l/RLZA== X-Google-Smtp-Source: ABdhPJyWAZjfirfkH7ymqHsj2L9OtTZWs6HiPoJtXWaYoR1/GX3EP0aYSGVsGYHdsaRFZkClJbP2WQ== X-Received: by 2002:a17:902:8c84:: with SMTP id t4mr2394992plo.78.1643313722210; Thu, 27 Jan 2022 12:02:02 -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.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:01 -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, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 06/35] drm/msm: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:12 -0800 Message-Id: <20220127200141.1295328-7-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The device lists are poorly ordered when the component device code is used. This is because component_master_add_with_match() returns 0 regardless of component devices calling component_add() first. It can really only fail if an allocation fails, in which case everything is going bad and we're out of memory. The driver that registers the aggregate driver, can succeed at probe and put the attached device on the DPM lists before any of the component devices are probed and put on the lists. Within the component device framework this usually isn't that bad because the real driver work is done at bind time via component{,master}_ops::bind(). It becomes a problem when the driver core, or host driver, wants to operate on the component device outside of the bind/unbind functions, e.g. via 'remove' or 'shutdown'. The driver core doesn't understand the relationship between the host device and the component devices and could possibly try to operate on component devices when they're already removed from the system or shut down. Normally, device links or probe defer would reorder the lists and put devices that depend on other devices in the lists at the correct location, but with component devices this doesn't happen because this information isn't expressed anywhere. Drivers simply succeed at registering their component or the aggregate driver with the component framework and wait for their bind() callback to be called once the other components are ready. In summary, the drivers that make up the aggregate driver can probe in any order. This ordering problem becomes fairly obvious when shutting down the device with a DSI controller connected to a DSI bridge that is controlled via i2c. In this case, the msm display driver wants to tear down the display pipeline on shutdown via msm_pdev_shutdown() by calling drm_atomic_helper_shutdown(), and it can't do that unless the whole display chain is still probed and active in the system. When a display bridge is on i2c, the i2c device for the bridge will be created whenever the i2c controller probes, which could be before or after the msm display driver probes. If the i2c controller probes after the display driver, then the i2c controller will be shutdown before the display controller during system wide shutdown and thus i2c transactions will stop working before the display pipeline is shut down. This means we'll have the display bridge trying to access an i2c bus that's shut down because drm_atomic_helper_shutdown() is trying to disable the bridge after the bridge is off. The solution is to make the aggregate driver into a real struct driver that is bound to a device when the other component devices have all probed. Now that the component driver code is a proper bus, we can simply register an aggregate driver with that bus via component_aggregate_register() and then attach the shutdown hook to that driver to be sure that the shutdown for the display pipeline is called before any of the component device driver shutdown hooks are called. Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- drivers/gpu/drm/msm/msm_drv.c | 48 ++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index ad35a5d94053..32107e5cb547 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -1331,19 +1331,37 @@ static int add_gpu_components(struct device *dev, return 0; } =20 -static int msm_drm_bind(struct device *dev) +static int msm_drm_bind(struct aggregate_device *adev) { - return msm_drm_init(dev, &msm_driver); + return msm_drm_init(aggregate_device_parent(adev), &msm_driver); } =20 -static void msm_drm_unbind(struct device *dev) +static void msm_drm_unbind(struct aggregate_device *adev) { - msm_drm_uninit(dev); + msm_drm_uninit(aggregate_device_parent(adev)); +} + +static void msm_drm_shutdown(struct aggregate_device *adev) +{ + const struct device *parent =3D aggregate_device_parent(adev); + const struct platform_device *pdev =3D to_platform_device(parent); + struct msm_drm_private *priv =3D platform_get_drvdata(pdev); + struct drm_device *drm =3D priv ? priv->dev : NULL; + + if (!priv || !priv->kms) + return; + + drm_atomic_helper_shutdown(drm); } =20 -static const struct component_master_ops msm_drm_ops =3D { - .bind =3D msm_drm_bind, - .unbind =3D msm_drm_unbind, +static struct aggregate_driver msm_drm_aggregate_driver =3D { + .probe =3D msm_drm_bind, + .remove =3D msm_drm_unbind, + .shutdown =3D msm_drm_shutdown, + .driver =3D { + .name =3D "msm_drm", + .owner =3D THIS_MODULE, + }, }; =20 /* @@ -1395,7 +1413,7 @@ static int msm_pdev_probe(struct platform_device *pde= v) if (ret) goto fail; =20 - ret =3D component_master_add_with_match(&pdev->dev, &msm_drm_ops, match); + ret =3D component_aggregate_register(&pdev->dev, &msm_drm_aggregate_drive= r, match); if (ret) goto fail; =20 @@ -1415,7 +1433,7 @@ static int msm_pdev_remove(struct platform_device *pd= ev) struct msm_drm_private *priv =3D platform_get_drvdata(pdev); struct msm_mdss *mdss =3D priv->mdss; =20 - component_master_del(&pdev->dev, &msm_drm_ops); + component_aggregate_unregister(&pdev->dev, &msm_drm_aggregate_driver); of_platform_depopulate(&pdev->dev); =20 if (mdss && mdss->funcs) @@ -1424,17 +1442,6 @@ static int msm_pdev_remove(struct platform_device *p= dev) return 0; } =20 -static void msm_pdev_shutdown(struct platform_device *pdev) -{ - struct msm_drm_private *priv =3D platform_get_drvdata(pdev); - struct drm_device *drm =3D priv ? priv->dev : NULL; - - if (!priv || !priv->kms) - return; - - drm_atomic_helper_shutdown(drm); -} - static const struct of_device_id dt_match[] =3D { { .compatible =3D "qcom,mdp4", .data =3D (void *)KMS_MDP4 }, { .compatible =3D "qcom,mdss", .data =3D (void *)KMS_MDP5 }, @@ -1450,7 +1457,6 @@ MODULE_DEVICE_TABLE(of, dt_match); static struct platform_driver msm_platform_driver =3D { .probe =3D msm_pdev_probe, .remove =3D msm_pdev_remove, - .shutdown =3D msm_pdev_shutdown, .driver =3D { .name =3D "msm", .of_match_table =3D dt_match, --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 07487C433FE for ; Thu, 27 Jan 2022 20:02:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343799AbiA0UCa (ORCPT ); Thu, 27 Jan 2022 15:02:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343670AbiA0UCG (ORCPT ); Thu, 27 Jan 2022 15:02:06 -0500 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 279B1C061751 for ; Thu, 27 Jan 2022 12:02:04 -0800 (PST) Received: by mail-pj1-x1034.google.com with SMTP id r59so4134081pjg.4 for ; Thu, 27 Jan 2022 12:02:04 -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=DfnjF41HCOKigUHHElQ1GWXWlBxR3YM46STsN/SgFFM=; b=en86y2AOvAbg2KTFCVhSEXO0TVrdu/a0fKOWve2IDJGmOj4mSxrtVbnmRB71KDWpGx VEIgrT5qyGLia2WBCKyjZHkR9ucg+9WsVSjZ7iZAUPaUm+Rx5mLoumInbyK36EQolOF+ t095Yti2absn0BK8arUaVtgk6mouD51F/h+Qc= 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=DfnjF41HCOKigUHHElQ1GWXWlBxR3YM46STsN/SgFFM=; b=POMs9ywyT4MXufPZyPnbzDkxOKa2BC7V8EmutTkZrtiMgH+uwjKDCIhSyxWK/Wozvc jdhun68nHT9ZaCM5v8gQAlYjgKlg3AWDvrhQlolvN8UbxI4e4wHu6lEBKPXXoWsZGNEZ ST5dqW0z8kGaKWKtzVRHyQPNRKsIlXHXaEuxRhIJ0FBHgig0vegJzH4eqq35CsBnAmEp xQLsjNiIMlbsYYtvz1LkQIZHAtGlxIJuI2opO0a1RO8rqwXH3YFH2gbRGSV+s9L9+OVN 2DfQIXOexVcLtYXIUazDx3hDaJ+f3tkF67AFep71LJe7D2FpFYTfDZfRl+hpmWh4CzaI X6Iw== X-Gm-Message-State: AOAM53326uYiZngz49KSL82xLodAyS5jQa6G3C5EX4a2rzMH8INx+z6W T9iPcG8dnxBuK8iZlRasCVf9DQ== X-Google-Smtp-Source: ABdhPJxcmmgspiZnHqRE8o1xWmcD3EypXwnytICOWnAqTR5UOd3FVpRwkmHOZpNcjLcOVKt7R7lLrQ== X-Received: by 2002:a17:902:7ec1:: with SMTP id p1mr4547318plb.159.1643313723638; Thu, 27 Jan 2022 12:02:03 -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.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:03 -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, James Qian Wang , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 07/35] drm/komeda: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:13 -0800 Message-Id: <20220127200141.1295328-8-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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: James Qian Wang (Arm Technology China) Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- .../gpu/drm/arm/display/komeda/komeda_drv.c | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c b/drivers/gpu/= drm/arm/display/komeda/komeda_drv.c index e7933930a657..5fa868cf9825 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c @@ -25,8 +25,9 @@ struct komeda_dev *dev_to_mdev(struct device *dev) return mdrv ? mdrv->mdev : NULL; } =20 -static void komeda_unbind(struct device *dev) +static void komeda_unbind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct komeda_drv *mdrv =3D dev_get_drvdata(dev); =20 if (!mdrv) @@ -45,8 +46,9 @@ static void komeda_unbind(struct device *dev) devm_kfree(dev, mdrv); } =20 -static int komeda_bind(struct device *dev) +static int komeda_bind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct komeda_drv *mdrv; int err; =20 @@ -87,9 +89,13 @@ static int komeda_bind(struct device *dev) return err; } =20 -static const struct component_master_ops komeda_master_ops =3D { - .bind =3D komeda_bind, - .unbind =3D komeda_unbind, +static struct aggregate_driver komeda_aggregate_driver =3D { + .probe =3D komeda_bind, + .remove =3D komeda_unbind, + .driver =3D { + .name =3D "komeda_drm", + .owner =3D THIS_MODULE, + }, }; =20 static int compare_of(struct device *dev, void *data) @@ -129,12 +135,12 @@ static int komeda_platform_probe(struct platform_devi= ce *pdev) komeda_add_slave(dev, &match, child, KOMEDA_OF_PORT_OUTPUT, 1); } =20 - return component_master_add_with_match(dev, &komeda_master_ops, match); + return component_aggregate_register(dev, &komeda_aggregate_driver, match); } =20 static int komeda_platform_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &komeda_master_ops); + component_aggregate_unregister(&pdev->dev, &komeda_aggregate_driver); return 0; } =20 --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 1C46FC433EF for ; Thu, 27 Jan 2022 20:02:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343742AbiA0UCU (ORCPT ); Thu, 27 Jan 2022 15:02:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343672AbiA0UCG (ORCPT ); Thu, 27 Jan 2022 15:02:06 -0500 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCD9FC061755 for ; Thu, 27 Jan 2022 12:02:05 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id h20-20020a17090adb9400b001b518bf99ffso8673251pjv.1 for ; Thu, 27 Jan 2022 12:02:05 -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=iMJcZepLim/YpIi7Y7hIab1z+GE+IIU8h9QgrFmMU/0=; b=OZNuVGwmg+5DpXtgxq+BMEkKae3EDK19392kSo4/J2z3xPzFGcdXFvJ1uC38LmN+lD RCdoVkHQwjCTjT9aJVj8uGSKfPaj4VhZ6b3P8SwCCKGRNX03bgKzXtD2isYFr1AFNjHr VPrC3gXCOEEDHIF0ibxT9aiOAQxnq9XdvcSRI= 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=iMJcZepLim/YpIi7Y7hIab1z+GE+IIU8h9QgrFmMU/0=; b=V05IvajxqwTlOm4egtz5KXeQpu42lyZzK2yP0UJr/QXjedWUX/PdtUeBBp5+nVXEon gvXXjRfR8RKJPd979ZrT+Vp5gTnNI3rT1yIq0QiFyKfe6PIRrM7dgpLg3tacjN0p0Zyj 4CmRjwUWmWs2eQfAQXvMKRzWt46rLVBmUNpdSH04AwY1yEhA7K/Li+jmnOTs8RLHKak1 oOna/5f2V9MTjRfmAgN95upA6tz8N9B+lQcwtOA1aSQy8wlI0K36umZk0popPzWKoI8o zTGDpMXeYBekwT6UKLylJCaraEnrcHLkK+9a4k6GBtfch0V00ifeoShmJaA66Jp6c6mw fRrA== X-Gm-Message-State: AOAM532tb5AwF3QdXTGBnZWg9i11G3CH2+8sl/hkTWyTxepwbQDFjzqJ LMAWbb1ScOivcTODro9S5M2ai/sBncohLA== X-Google-Smtp-Source: ABdhPJy5iEP9ZiYeQrh0T9dMlgNgumKZeRB+e4a/VBs0O8cCc+ML1Kugu6geT3ueGmazrHLnrAbX+A== X-Received: by 2002:a17:902:ab49:: with SMTP id ij9mr4763950plb.1.1643313725021; Thu, 27 Jan 2022 12:02:05 -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.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:04 -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 v6 08/35] drm/arm/hdlcd: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:14 -0800 Message-Id: <20220127200141.1295328-9-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- 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_dr= v.c index 479c2422a2e0..e3ed925797d5 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 =3D { .minor =3D 0, }; =20 -static int hdlcd_drm_bind(struct device *dev) +static int hdlcd_drm_bind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); 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; } =20 -static void hdlcd_drm_unbind(struct device *dev) +static void hdlcd_drm_unbind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct drm_device *drm =3D dev_get_drvdata(dev); struct hdlcd_drm_private *hdlcd =3D drm->dev_private; =20 @@ -367,9 +369,13 @@ static void hdlcd_drm_unbind(struct device *dev) drm_dev_put(drm); } =20 -static const struct component_master_ops hdlcd_master_ops =3D { - .bind =3D hdlcd_drm_bind, - .unbind =3D hdlcd_drm_unbind, +static struct aggregate_driver hdlcd_aggregate_driver =3D { + .probe =3D hdlcd_drm_bind, + .remove =3D hdlcd_drm_unbind, + .driver =3D { + .name =3D "hdlcd_drm", + .owner =3D THIS_MODULE, + }, }; =20 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); =20 - return component_master_add_with_match(&pdev->dev, &hdlcd_master_ops, - match); + return component_aggregate_register(&pdev->dev, &hdlcd_aggregate_driver, = match); } =20 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; } =20 --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 792E8C433EF for ; Thu, 27 Jan 2022 20:02:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240311AbiA0UCO (ORCPT ); Thu, 27 Jan 2022 15:02:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343677AbiA0UCH (ORCPT ); Thu, 27 Jan 2022 15:02:07 -0500 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B498EC06175A for ; Thu, 27 Jan 2022 12:02:06 -0800 (PST) Received: by mail-pj1-x1031.google.com with SMTP id s61-20020a17090a69c300b001b4d0427ea2so8655052pjj.4 for ; Thu, 27 Jan 2022 12:02:06 -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=eLJCnI04jLKqZN/UJPBzqXUPWPAN0XVbPbOc1ZGY6qU=; b=DEFDTqec9EAgV78bsUSeeOgUOjpE2PZ60LrfxDPd0F5Ja1M7OoSVPixyF9mPpGTYtf jDiBonceMAplYpEW7lO1v2w1ka+CKtfuNKfnSqfu7r99b6ZRRYkUYkRbmv4w107O6IXe dtjVxyY/6RMgJRiJxYVUfSw9pUyxA8ZXMi1S4= 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=eLJCnI04jLKqZN/UJPBzqXUPWPAN0XVbPbOc1ZGY6qU=; b=K4AZEMWvUl3G7e12XIf1VyFGZmhKJRQw9MtxfsGm5mHFir/+OUxcsGf7kROCi1S6wi NBkwM0Uy6uTmw5XS+NaYHT6rX/zxLxYsoBH1OuS/nVRHDT1/vmBQ/I1oXqzMGn6iYxkv uKZwAvrIEanDnSF8dhU67IqcZ/ehk/i8SVtmA5SuAiaS4JMvgNnIYA923dPaGXgs5OWW sfyur+KC4qb+FUHVKPQBEt3gUbVYq7QjiBUH/s0/o3XXoOecTEOJ2LUSEz0Me+LeFHUk 6xllk1Zm5GVlMLVGt6X0U3Bw6/7P0NcN5Nq+NFKIxsB46qcIf9YpXsrKNCxoZttDXenQ Inmg== X-Gm-Message-State: AOAM531b4gzQUTbiHuwMfo3bRQkdnWRS/dmTkfuf97lK8WYO/6xhsMuV r5z9905Tzm6qI98WIGsHN7hI0Q== X-Google-Smtp-Source: ABdhPJxUhucSYGodBqok8FGY5LN8HvAR2Eonn35ksEJ0ihq+SzWXGbQnXNaKnSR7JAD8OdQGRJ77xw== X-Received: by 2002:a17:902:ab43:: with SMTP id ij3mr1259523plb.102.1643313726269; Thu, 27 Jan 2022 12:02:06 -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.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:05 -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, Laurent Pinchart , Liviu Dudau , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 09/35] drm/malidp: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:15 -0800 Message-Id: <20220127200141.1295328-10-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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. TODO: This can be updated to move the drm helper logic into the aggregate driver shutdown op. Cc: Laurent Pinchart Cc: Liviu Dudau Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- drivers/gpu/drm/arm/malidp_drv.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_= drv.c index 78d15b04b105..7b946b962b22 100644 --- a/drivers/gpu/drm/arm/malidp_drv.c +++ b/drivers/gpu/drm/arm/malidp_drv.c @@ -702,8 +702,9 @@ static int malidp_runtime_pm_resume(struct device *dev) return 0; } =20 -static int malidp_bind(struct device *dev) +static int malidp_bind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct resource *res; struct drm_device *drm; struct malidp_drm *malidp; @@ -894,8 +895,9 @@ static int malidp_bind(struct device *dev) return ret; } =20 -static void malidp_unbind(struct device *dev) +static void malidp_unbind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct drm_device *drm =3D dev_get_drvdata(dev); struct malidp_drm *malidp =3D drm->dev_private; struct malidp_hw_device *hwdev =3D malidp->dev; @@ -921,9 +923,13 @@ static void malidp_unbind(struct device *dev) of_reserved_mem_device_release(dev); } =20 -static const struct component_master_ops malidp_master_ops =3D { - .bind =3D malidp_bind, - .unbind =3D malidp_unbind, +static struct aggregate_driver malidp_aggregate_driver =3D { + .probe =3D malidp_bind, + .remove =3D malidp_unbind, + .driver =3D { + .name =3D "malidp_drm", + .owner =3D THIS_MODULE, + }, }; =20 static int malidp_compare_dev(struct device *dev, void *data) @@ -949,13 +955,12 @@ static int malidp_platform_probe(struct platform_devi= ce *pdev) drm_of_component_match_add(&pdev->dev, &match, malidp_compare_dev, port); of_node_put(port); - return component_master_add_with_match(&pdev->dev, &malidp_master_ops, - match); + return component_aggregate_register(&pdev->dev, &malidp_aggregate_driver,= match); } =20 static int malidp_platform_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &malidp_master_ops); + component_aggregate_unregister(&pdev->dev, &malidp_aggregate_driver); return 0; } =20 --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 EE52DC4321E for ; Thu, 27 Jan 2022 20:02:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343652AbiA0UCK (ORCPT ); Thu, 27 Jan 2022 15:02:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343646AbiA0UCI (ORCPT ); Thu, 27 Jan 2022 15:02:08 -0500 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 155FBC06173B for ; Thu, 27 Jan 2022 12:02:08 -0800 (PST) Received: by mail-pg1-x52b.google.com with SMTP id e16so3238366pgn.4 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=frU0ZHtabkatuZn9trI20T8OMPuNgIy7zyV8smOWYYN+8bIm7keQg6/SiYki9fmC3x D7zUtXf7LUaSz9VAiX6risfIqFlAwmb1l/VJeD/OnC5bvLZ1KfQC4lxcUUF4TO/CEYmM aH8KXCTk9hP0V8TIbyzIE7B6oaMKIqDGpoZlP3CopdtGfHLxOSXBmfECLy7ESmJnybXC +VMMsG86/JX2UJKiNfEo9U8VUi88mFGs2UB7wTEtYxxz0FGah1ezTsSh0PCTtrMbZHYH fhyt62lVbWDpkJ54SksCyhfY6lvZDOeyndpANmZYCSBr3ufHPtluAArL6RgyNnSjCi+e LxpA== X-Gm-Message-State: AOAM533UiwwYq42Qsg4Vu/Bqi2fTjtoAPOlSdCv0vijw2lhd0gBMPCCd 2sXI+XCfurjJBTChhvyQqjNguw== 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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- 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/a= rmada_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 =3D { .atomic_commit =3D drm_atomic_helper_commit, }; =20 -static int armada_drm_bind(struct device *dev) +static int armada_drm_bind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct armada_private *priv; struct resource *mem =3D NULL; int ret, n; @@ -159,8 +160,9 @@ static int armada_drm_bind(struct device *dev) return ret; } =20 -static void armada_drm_unbind(struct device *dev) +static void armada_drm_unbind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct drm_device *drm =3D dev_get_drvdata(dev); struct armada_private *priv =3D drm_to_armada_dev(drm); =20 @@ -202,9 +204,13 @@ static void armada_add_endpoints(struct device *dev, } } =20 -static const struct component_master_ops armada_master_ops =3D { - .bind =3D armada_drm_bind, - .unbind =3D armada_drm_unbind, +static struct aggregate_driver armada_aggregate_driver =3D { + .probe =3D armada_drm_bind, + .remove =3D armada_drm_unbind, + .driver =3D { + .name =3D "armada_drm", + .owner =3D THIS_MODULE, + }, }; =20 static int armada_drm_probe(struct platform_device *pdev) @@ -213,7 +219,7 @@ static int armada_drm_probe(struct platform_device *pde= v) struct device *dev =3D &pdev->dev; int ret; =20 - ret =3D drm_of_component_probe(dev, compare_dev_name, &armada_master_ops); + ret =3D drm_of_aggregate_probe(dev, compare_dev_name, &armada_aggregate_d= river); if (ret !=3D -EINVAL) return ret; =20 @@ -240,13 +246,12 @@ static int armada_drm_probe(struct platform_device *p= dev) } } =20 - return component_master_add_with_match(&pdev->dev, &armada_master_ops, - match); + return component_aggregate_register(&pdev->dev, &armada_aggregate_driver,= match); } =20 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; } =20 --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 0EA3EC433FE for ; Thu, 27 Jan 2022 20:02:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343648AbiA0UCM (ORCPT ); Thu, 27 Jan 2022 15:02:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343693AbiA0UCJ (ORCPT ); Thu, 27 Jan 2022 15:02:09 -0500 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B792C061747 for ; Thu, 27 Jan 2022 12:02:09 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id o16-20020a17090aac1000b001b62f629953so1212873pjq.3 for ; Thu, 27 Jan 2022 12:02:09 -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=qNjVi/dtor3YPPis15U918Dv8DbZI7rkWw2W0PoTyLw=; b=MbLWsQKtzqMdB6TR92CWX09HwWAVICVRUPQdGnE8qtwEt55hq1VEqji+rp8vrVgl/d DRHLMSEBAVQb3vSzBApvM3+l3ud49iQqe1JUvkQnDPH1XQHU3KLL2iBCm7lPVoTrf/hM KFpAvbmSKcOKdTOm9dEmOVr1LcIQUUKQDKVHo= 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=qNjVi/dtor3YPPis15U918Dv8DbZI7rkWw2W0PoTyLw=; b=YhH+LZqC2D+Yduth7WmELXAoqihuCs8Fg1ROdro9Q/MiZH2rrWSHliqj5RoPXjs/OL FpuDT38wSjiQZqizzBrtbmyxsve9YF308HyQjoa0yKyrKJog77t+/yGv773kjIXvZK+M mZyXq+QP8t3fnUsgM2QssWkypeN6RT4pNTktYJ8YiK6XcrCDx4+/nf5lVYf1AxrxgjZn jKmKCFs5sRqFErP6tF3M3ABxYvuewi6NIz5nzOXX2NfZnraOvxPFJ653EnALh4zAEkns /yJJl4u4dlVXSxz003EfvtoDi1bauPpukRlOGhhNZZexeb75wxvA4EIt/i+iH4HxerG8 f7Eg== X-Gm-Message-State: AOAM5317wlwWbH1EzN5P4iBBEayexKltmWKKPEloyamaSTEk8KkFyuMx hgiJaIeFfwTqGHIK1NqMbpIh7w== X-Google-Smtp-Source: ABdhPJz+tPk8d+x+q2ZjVwxtYt5rjYPWT3YY5moMRA+Ipjppy+sGlcAobZY5/oFUFrZAy6t+oNlz4A== X-Received: by 2002:a17:902:d509:: with SMTP id b9mr4718199plg.42.1643313728886; Thu, 27 Jan 2022 12:02:08 -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.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:08 -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, Lucas Stach , Russell King , Christian Gmeiner , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Saravana Kannan Subject: [PATCH v6 11/35] drm/etnaviv: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:17 -0800 Message-Id: <20220127200141.1295328-12-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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: Lucas Stach Cc: Russell King Cc: Christian Gmeiner Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- drivers/gpu/drm/etnaviv/etnaviv_drv.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnavi= v/etnaviv_drv.c index 0b756ecb1bc2..5d1cc3953204 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c @@ -494,8 +494,9 @@ static const struct drm_driver etnaviv_drm_driver =3D { /* * Platform driver: */ -static int etnaviv_bind(struct device *dev) +static int etnaviv_bind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct etnaviv_drm_private *priv; struct drm_device *drm; int ret; @@ -552,8 +553,9 @@ static int etnaviv_bind(struct device *dev) return ret; } =20 -static void etnaviv_unbind(struct device *dev) +static void etnaviv_unbind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct drm_device *drm =3D dev_get_drvdata(dev); struct etnaviv_drm_private *priv =3D drm->dev_private; =20 @@ -569,9 +571,13 @@ static void etnaviv_unbind(struct device *dev) drm_dev_put(drm); } =20 -static const struct component_master_ops etnaviv_master_ops =3D { - .bind =3D etnaviv_bind, - .unbind =3D etnaviv_unbind, +static struct aggregate_driver etnaviv_aggregate_driver =3D { + .probe =3D etnaviv_bind, + .remove =3D etnaviv_unbind, + .driver =3D { + .name =3D "etnaviv_drm", + .owner =3D THIS_MODULE, + }, }; =20 static int compare_of(struct device *dev, void *data) @@ -639,12 +645,12 @@ static int etnaviv_pdev_probe(struct platform_device = *pdev) if (first_node) of_dma_configure(&pdev->dev, first_node, true); =20 - return component_master_add_with_match(dev, &etnaviv_master_ops, match); + return component_aggregate_register(dev, &etnaviv_aggregate_driver, match= ); } =20 static int etnaviv_pdev_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &etnaviv_master_ops); + component_aggregate_unregister(&pdev->dev, &etnaviv_aggregate_driver); =20 return 0; } --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 3DBD6C4332F for ; Thu, 27 Jan 2022 20:02:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343696AbiA0UCS (ORCPT ); Thu, 27 Jan 2022 15:02:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343671AbiA0UCK (ORCPT ); Thu, 27 Jan 2022 15:02:10 -0500 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B36A2C06173B for ; Thu, 27 Jan 2022 12:02:10 -0800 (PST) Received: by mail-pf1-x429.google.com with SMTP id 128so3758034pfe.12 for ; Thu, 27 Jan 2022 12:02: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=V5D9W8mLQzBapDg8PfAl6xWrk61L3pMoLZNoKlrReQc=; b=Us8nN6E0hRmknbgfLO6sMIk5lgb5byWV5VYlILdj0cELP44JPjS1NfL65N4JRWx0QC K6x4pocN37foE0fWEh2I1lYGaMQGu/zv05JQ3yV/nV2eiCpDakPJ9HIV/R/pnz1ushah JXw1+0lpLlh7MSHzawG+YdhOzUbpm/ktDsNnw= 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=V5D9W8mLQzBapDg8PfAl6xWrk61L3pMoLZNoKlrReQc=; b=ciFzByEiGV/lP65rjI4f97CDcvflFhL3XUI3QxsKQlYtRtNMTqd9iJ5Xt3GMMvg1iy Qi6zxs1NaFZzxUrBGu3DLRTS0mU3PcyXAhZspXbLzbTVGINVKP+Y5knMOUbI3wV9qeeF xq2IHO9chjFUoEUbE7pfm1CBWYlNW6Eylz8pyCHoD8Y2+AYCIfKxRuyGX/w97tiLE1/4 gTdAUhqc5/aQc/DSWGv/yhx3+ry/GfoDVjm/lmUEKR5sxdEHy7Sp7Ksx8HE3Lc42RvZB fK9z5of4F4hZTVymPC1ce71GZLfTV4Q5+R+4V4Ygbr7c58/Xo3DXH9CS/yUd4SoWUQLY s2RA== X-Gm-Message-State: AOAM532FDHsViOj0bl2vfiUTiaPOuuqFsrDpR7A2p9VikBp+0cUsyLpn zCXWJeA0KnGhCe+0o/aK3nWvww== X-Google-Smtp-Source: ABdhPJxXtbjlaVenB3yzOYY0uagjNycGvBicVRVVV0S8pQIqcpwlB0Y7yF6gDT8i/RK6UDO8P4+ylw== X-Received: by 2002:aa7:8484:: with SMTP id u4mr4344004pfn.70.1643313730286; Thu, 27 Jan 2022 12:02:10 -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.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02: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, Xinliang Liu , Tian Tao , John Stultz , Xinwei Kong , Chen Feng , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 12/35] drm/kirin: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:18 -0800 Message-Id: <20220127200141.1295328-13-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- .../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..338077908177 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; } =20 -static int kirin_drm_bind(struct device *dev) +static int kirin_drm_bind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); 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; } =20 -static void kirin_drm_unbind(struct device *dev) +static void kirin_drm_unbind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct drm_device *drm_dev =3D dev_get_drvdata(dev); =20 drm_dev_unregister(drm_dev); @@ -262,9 +264,13 @@ static void kirin_drm_unbind(struct device *dev) drm_dev_put(drm_dev); } =20 -static const struct component_master_ops kirin_drm_ops =3D { - .bind =3D kirin_drm_bind, - .unbind =3D kirin_drm_unbind, +static struct aggregate_driver kirin_drm_aggregate_driver =3D { + .probe =3D kirin_drm_bind, + .remove =3D kirin_drm_unbind, + .driver =3D { + .name =3D "kirin_drm", + .owner =3D THIS_MODULE, + }, }; =20 static int kirin_drm_platform_probe(struct platform_device *pdev) @@ -281,12 +287,12 @@ static int kirin_drm_platform_probe(struct platform_d= evice *pdev) drm_of_component_match_add(dev, &match, compare_of, remote); of_node_put(remote); =20 - return component_master_add_with_match(dev, &kirin_drm_ops, match); + return component_aggregate_register(dev, &kirin_drm_aggregate_driver, mat= ch); } =20 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; } =20 --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 2066AC433F5 for ; Thu, 27 Jan 2022 20:02:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235637AbiA0UCc (ORCPT ); Thu, 27 Jan 2022 15:02:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343689AbiA0UCM (ORCPT ); Thu, 27 Jan 2022 15:02:12 -0500 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 273E3C061747 for ; Thu, 27 Jan 2022 12:02:12 -0800 (PST) Received: by mail-pf1-x430.google.com with SMTP id u130so3793309pfc.2 for ; Thu, 27 Jan 2022 12:02:12 -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=p0aVwrwMtPKI+Zw3p14aaTjDl64C47sBEcl9anDi+5w=; b=kwn63WCLro2pEoW3NUZStHAHthYrQFBO+1kqeg7vZ8cjmQFS4RPcurvo1UPCUI+Zu8 DCf3dOakK6x7VObPCC2Q4M9xUJzgL5Td/24BIsWeDVcKmXGpiAVsawi7ymo0ynrlFQ+W ZYTQlHIHGczG/PxwdFJuVlHEKV6iuElGTDXfU= 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=p0aVwrwMtPKI+Zw3p14aaTjDl64C47sBEcl9anDi+5w=; b=gVzGd1+K10HSJ3YucXpQ1W8bit7n29rsvWWRm0BV916Ims8He2miL0wpxIBNHepyFI IiHhKMGvavTmKR4ULYbClYezvR9cZ9/lycgS+Gcscr5XeKdLLUsK7uacLuwV7wnlMFax 4eDXc+D4Or6svHI4kp8nCxur6K8pRcGQnZPh/u1SlIPJTyTMbfTl2xBBoTPfPeeU5caX hIxDWkSH2zo+OYJGkujBNWJuD4wc04IFVQajCnhrd5oWspc/ZBXQHOr4rJMZwakvJ7CM htVUXsPvadSWcAnhBth0LADaJWk9bQZNs2U23LNvNqk+LI6vD363md1b8ZfZXxVaAIqS rx1A== X-Gm-Message-State: AOAM533pitgP7UVeVD8Py9So1tzT+EQl9YqUN6Lk9gnmXA9jgJkoBiao RAki46WAtXjQXME0uTrxUnxToQ== X-Google-Smtp-Source: ABdhPJyTdj2Y9H1zXEx5aZHrVW5+2vFsseg434LApAeWM0b1LjcrFdbsVgv1CpDt9kWrjMPypwnnEA== X-Received: by 2002:a65:6743:: with SMTP id c3mr3974983pgu.306.1643313731691; Thu, 27 Jan 2022 12:02:11 -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.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:11 -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, Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 13/35] drm/exynos: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:19 -0800 Message-Id: <20220127200141.1295328-14-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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: Inki Dae Cc: Joonyoung Shim Cc: Seung-Woo Kim Cc: Kyungmin Park Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- drivers/gpu/drm/exynos/exynos_drm_drv.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exyn= os/exynos_drm_drv.c index 9743b6b17447..f9a3e7041254 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -244,8 +244,9 @@ static struct component_match *exynos_drm_match_add(str= uct device *dev) return match ?: ERR_PTR(-ENODEV); } =20 -static int exynos_drm_bind(struct device *dev) +static int exynos_drm_bind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct exynos_drm_private *private; struct drm_encoder *encoder; struct drm_device *drm; @@ -321,8 +322,9 @@ static int exynos_drm_bind(struct device *dev) return ret; } =20 -static void exynos_drm_unbind(struct device *dev) +static void exynos_drm_unbind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct drm_device *drm =3D dev_get_drvdata(dev); =20 drm_dev_unregister(drm); @@ -341,9 +343,13 @@ static void exynos_drm_unbind(struct device *dev) drm_dev_put(drm); } =20 -static const struct component_master_ops exynos_drm_ops =3D { - .bind =3D exynos_drm_bind, - .unbind =3D exynos_drm_unbind, +static struct aggregate_driver exynos_drm_aggregate_driver =3D { + .probe =3D exynos_drm_bind, + .remove =3D exynos_drm_unbind, + .driver =3D { + .name =3D "exynos_drm", + .owner =3D THIS_MODULE, + }, }; =20 static int exynos_drm_platform_probe(struct platform_device *pdev) @@ -356,13 +362,12 @@ static int exynos_drm_platform_probe(struct platform_= device *pdev) if (IS_ERR(match)) return PTR_ERR(match); =20 - return component_master_add_with_match(&pdev->dev, &exynos_drm_ops, - match); + return component_aggregate_register(&pdev->dev, &exynos_drm_aggregate_dri= ver, match); } =20 static int exynos_drm_platform_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &exynos_drm_ops); + component_aggregate_unregister(&pdev->dev, &exynos_drm_aggregate_driver); return 0; } =20 --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 CE36BC43219 for ; Thu, 27 Jan 2022 20:02:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343706AbiA0UCe (ORCPT ); Thu, 27 Jan 2022 15:02:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343624AbiA0UCO (ORCPT ); Thu, 27 Jan 2022 15:02:14 -0500 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C9DEC06174A for ; Thu, 27 Jan 2022 12:02:13 -0800 (PST) Received: by mail-pf1-x42f.google.com with SMTP id i186so1321525pfe.0 for ; Thu, 27 Jan 2022 12:02:13 -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=jvZVmrWmp26tHtV/xiUrxR2MIRDqBUgzND7wS5OXNzU=; b=Bu/x2wm+DigW2JkVo+zDM2QAK9Lh8Lzi7VQRjJWQQjpG5TztXs0H13hQM2D+/X1afo F/CZqb3T2TwiS2OBBiEi612vc8lapJ2aK7gIt8pyAQrdw+v+7we61eZhP/USER4FIKc2 BG1pnFxhjATM9z47bzqsrsQz0U2Se0uYrH80Y= 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=jvZVmrWmp26tHtV/xiUrxR2MIRDqBUgzND7wS5OXNzU=; b=i0MZUl8MqhCynYIcKhFNdTyEG0a9FT7s8+5gD0kD3+glI4fiIaCk3gBVRtUkUOA810 cFC4McB0zN9wH85sVCGjjlslx9ibMB37b3X5YStUF/RrZONTcrTqMLoxk+nljVGhAClE 31+KfUMy3/Eid7Kmiu4bJRjxaQqMl0N8Qn8EsDqnVHKI5FBGRUjNB1cSeGpHg5y0dol9 4BkSD7cTKe3UIGR5Vx8l3DdqlIdvr6gqGi+HodLkkDpywTYOpRqVRkXP6rU6fG3aRbat bopKiNi6rnKc6rLR6XQJERXnLoi/IWQTkW4d67TTJSOkbCJB33m0MyFphcObjmG9/cUx ejJQ== X-Gm-Message-State: AOAM531MZ1IhM/+gFGVAd6cnmCCbxkg4LKQp6TSoqxzxdgzoqOeZ5z83 6BM/hkV/1zEQJnTV3xrATEgIkw== X-Google-Smtp-Source: ABdhPJzgdo2xIvKWNBWJJ7FN2cYeL3DThlERus72aPFfW2Op1TpxXhf3bZPVZCrr2lRRpYJldojIjA== X-Received: by 2002:a63:fb4a:: with SMTP id w10mr3821171pgj.615.1643313732918; Thu, 27 Jan 2022 12:02:12 -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.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:12 -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, Philipp Zabel , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 14/35] drm/imx: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:20 -0800 Message-Id: <20220127200141.1295328-15-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- 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-d= rm-core.c index cb685fe2039b..82645e42b7d3 100644 --- a/drivers/gpu/drm/imx/imx-drm-core.c +++ b/drivers/gpu/drm/imx/imx-drm-core.c @@ -196,8 +196,9 @@ static int compare_of(struct device *dev, void *data) return dev->of_node =3D=3D np; } =20 -static int imx_drm_bind(struct device *dev) +static int imx_drm_bind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct drm_device *drm; int ret; =20 @@ -264,8 +265,9 @@ static int imx_drm_bind(struct device *dev) return ret; } =20 -static void imx_drm_unbind(struct device *dev) +static void imx_drm_unbind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct drm_device *drm =3D dev_get_drvdata(dev); =20 drm_dev_unregister(drm); @@ -279,14 +281,18 @@ static void imx_drm_unbind(struct device *dev) dev_set_drvdata(dev, NULL); } =20 -static const struct component_master_ops imx_drm_ops =3D { - .bind =3D imx_drm_bind, - .unbind =3D imx_drm_unbind, +static struct aggregate_driver imx_drm_aggregate_driver =3D { + .probe =3D imx_drm_bind, + .remove =3D imx_drm_unbind, + .driver =3D { + .name =3D "imx_drm", + .owner =3D THIS_MODULE, + }, }; =20 static int imx_drm_platform_probe(struct platform_device *pdev) { - int ret =3D drm_of_component_probe(&pdev->dev, compare_of, &imx_drm_ops); + int ret =3D drm_of_aggregate_probe(&pdev->dev, compare_of, &imx_drm_aggre= gate_driver); =20 if (!ret) ret =3D dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); @@ -296,7 +302,7 @@ static int imx_drm_platform_probe(struct platform_devic= e *pdev) =20 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; } =20 --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 617DEC433FE for ; Thu, 27 Jan 2022 20:02:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239896AbiA0UCg (ORCPT ); Thu, 27 Jan 2022 15:02:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343715AbiA0UCP (ORCPT ); Thu, 27 Jan 2022 15:02:15 -0500 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDFEAC061747 for ; Thu, 27 Jan 2022 12:02:14 -0800 (PST) Received: by mail-pj1-x1030.google.com with SMTP id b1-20020a17090a990100b001b14bd47532so4174671pjp.0 for ; Thu, 27 Jan 2022 12:02:14 -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=14tXiFXD9g15QAgF752Bjks0tTvAFdkYAmJeNpUGDFE=; b=UJ3pWRNzqmBr5jjMWL3C1NCDOyzHTVGRBEEV5Qjr0RTHka8AG1QzIcMnCpxlWvVMRF l6qJLOapBxSEL5K/iiTXohEi3SbvC6S4Yl/qitYDN8qOWC1FARr7XcHB5d6bOo4QbiDy CO6UTVN3O9ByQaeACCXxYwSkKyp5A5fA4DqX8= 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=14tXiFXD9g15QAgF752Bjks0tTvAFdkYAmJeNpUGDFE=; b=6AonbnYaDbvsfemiT5d4QuphkiebXwN9pRf2fwV37e6oKzbLZbcGppxV9G+vlWcZFP bF7rexFl1HcQOc5Ip1uhreRrN9MO3pEQZX2vTrMZyq7Ncg8bysXmOeEhTwEDMR4HbxHk SGwysSlmNhijtatNtUj0aVymCwjZcrz6lpXtB+Z94UdMTjrjwsus1RkSgRoXoYpep5lI UmM/AD9Rca6p1Q5wFzE4OjFOLIDfEKixotywyX7sW+bvbw7kziKGRRQUvVZyze+SmUTb HAjTk1J4SA7XpNjTz5/VrH8ZLd9hLh3bQd2I1Xo41jNPmdCEuxyy3C/Lnzav/lklsdLj YPZg== X-Gm-Message-State: AOAM530PXgmglRVc15GhZIVFChX3PeC17nFyBtCwdNy3iQwucDM0dWq8 kT2aXcuHimGW5sZLkBx+9SaARQ== X-Google-Smtp-Source: ABdhPJxj4NhIFULjjnOa82Bd+Ch/aLmNdqwZmV0dOkYUhrIX9rdCJEi2YGis8heu+ZpwIFq0oEXBhw== X-Received: by 2002:a17:90b:3a90:: with SMTP id om16mr5800717pjb.123.1643313734317; Thu, 27 Jan 2022 12:02:14 -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.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:13 -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, Paul Cercueil , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 15/35] drm/ingenic: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:21 -0800 Message-Id: <20220127200141.1295328-16-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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. TODO: Move the helpers to PM in aggregate driver hooks. Acked-by: Paul Cercueil Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 25 +++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/in= genic/ingenic-drm-drv.c index b4943a56be09..c094f9917874 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c @@ -1317,8 +1317,10 @@ static int ingenic_drm_bind(struct device *dev, bool= has_components) return ret; } =20 -static int ingenic_drm_bind_with_components(struct device *dev) +static int ingenic_drm_bind_with_components(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); + return ingenic_drm_bind(dev, true); } =20 @@ -1341,9 +1343,20 @@ static void ingenic_drm_unbind(struct device *dev) drm_atomic_helper_shutdown(&priv->drm); } =20 -static const struct component_master_ops ingenic_master_ops =3D { - .bind =3D ingenic_drm_bind_with_components, - .unbind =3D ingenic_drm_unbind, +static void ingenic_aggregate_remove(struct aggregate_device *adev) +{ + struct device *dev =3D aggregate_device_parent(adev); + + ingenic_drm_unbind(dev); +} + +static struct aggregate_driver ingenic_aggregate_driver =3D { + .probe =3D ingenic_drm_bind_with_components, + .remove =3D ingenic_aggregate_remove, + .driver =3D { + .name =3D "ingenic_drm", + .owner =3D THIS_MODULE, + }, }; =20 static int ingenic_drm_probe(struct platform_device *pdev) @@ -1363,7 +1376,7 @@ static int ingenic_drm_probe(struct platform_device *= pdev) drm_of_component_match_add(dev, &match, compare_of, np); of_node_put(np); =20 - return component_master_add_with_match(dev, &ingenic_master_ops, match); + return component_aggregate_register(dev, &ingenic_aggregate_driver, match= ); } =20 static int ingenic_drm_remove(struct platform_device *pdev) @@ -1373,7 +1386,7 @@ static int ingenic_drm_remove(struct platform_device = *pdev) if (!IS_ENABLED(CONFIG_DRM_INGENIC_IPU)) ingenic_drm_unbind(dev); else - component_master_del(dev, &ingenic_master_ops); + component_aggregate_unregister(dev, &ingenic_aggregate_driver); =20 return 0; } --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 AA0E3C433EF for ; Thu, 27 Jan 2022 20:02:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343783AbiA0UCi (ORCPT ); Thu, 27 Jan 2022 15:02:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343725AbiA0UCR (ORCPT ); Thu, 27 Jan 2022 15:02:17 -0500 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30DE7C06174A for ; Thu, 27 Jan 2022 12:02:16 -0800 (PST) Received: by mail-pj1-x102a.google.com with SMTP id d15-20020a17090a110f00b001b4e7d27474so4146471pja.2 for ; Thu, 27 Jan 2022 12:02:16 -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=m9a8zcSwcpladoTNvW+Mx8bO+UU4CpffIWXmtXe0Ndo=; b=X5ktv8lLpf+IELlZ3g3ez+/s2Mg1qsxtLoUl7oUREs6OxUk7pRfz3KrRj4laK6MZsJ rlPqF8raj9oFQiIAKqoNkqum2trbRgRBfAeKg2Mj8IQZD1i5xV+LgsrXqEpNEjAAYJgO LjwLv5Bx+fNXpHWa33uWdM5Vv444CSvs1Hz3Y= 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=m9a8zcSwcpladoTNvW+Mx8bO+UU4CpffIWXmtXe0Ndo=; b=zjYz7BhtIdyNQ55T7Porm/BXb6QQ1FIMl/QrabAxsXTEl9CoESplEog9rog/cjypeb T+PPhqdIq3MQEXBvy8GFta9TRlpnO6gzkZwNPNgHX82L+p5sWzPtyFueXYzAWncvUzub Wh86ypwXl2oHphguErAducBoaUP/iGI2ZVywjYvVggTLZbxLTvZOZG734k5ZWnIUXoTN 0y7eGcvG3uoQZFSa4qf3uXmrgyABBpCGc63iJLvNgAmdKrAtrUTyO4a1eX8vVFklEIOC Jjr5bkb9iFaku0ZfPydf8fXjbLjv7nht8c98CwRF/Ire3xOXfXHiCFdRgZHcP7CIfIU2 nT2g== X-Gm-Message-State: AOAM5317BEziCRSTNEYyjaREEBo1drb0gvwNrSrzdeTNAW7xOF/wZ10N EuYpXuojGZXKhnOa+PHWpMJV05WNXubbcg== X-Google-Smtp-Source: ABdhPJwhwwSoScMQGXENh1vbCzHG8zEwuePWTRvR/QDNk3tl3wOiOJIi3bcWWIfqw+HtCoBAtt+CIQ== X-Received: by 2002:a17:90b:4f4e:: with SMTP id pj14mr5917665pjb.220.1643313735720; Thu, 27 Jan 2022 12:02:15 -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.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:15 -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, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan , Linus Walleij Subject: [PATCH v6 16/35] drm/mcde: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:22 -0800 Message-Id: <20220127200141.1295328-17-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Tested-by: Linus Walleij Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- drivers/gpu/drm/mcde/mcde_drv.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/mcde/mcde_drv.c b/drivers/gpu/drm/mcde/mcde_dr= v.c index 5b5afc6aaf8e..b8479355844e 100644 --- a/drivers/gpu/drm/mcde/mcde_drv.c +++ b/drivers/gpu/drm/mcde/mcde_drv.c @@ -215,8 +215,9 @@ static const struct drm_driver mcde_drm_driver =3D { DRM_GEM_CMA_DRIVER_OPS, }; =20 -static int mcde_drm_bind(struct device *dev) +static int mcde_drm_bind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct drm_device *drm =3D dev_get_drvdata(dev); int ret; =20 @@ -247,8 +248,9 @@ static int mcde_drm_bind(struct device *dev) return ret; } =20 -static void mcde_drm_unbind(struct device *dev) +static void mcde_drm_unbind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct drm_device *drm =3D dev_get_drvdata(dev); =20 drm_dev_unregister(drm); @@ -256,9 +258,13 @@ static void mcde_drm_unbind(struct device *dev) component_unbind_all(drm->dev, drm); } =20 -static const struct component_master_ops mcde_drm_comp_ops =3D { - .bind =3D mcde_drm_bind, - .unbind =3D mcde_drm_unbind, +static struct aggregate_driver mcde_drm_comp_driver =3D { + .probe =3D mcde_drm_bind, + .remove =3D mcde_drm_unbind, + .driver =3D { + .name =3D "mcde_drm", + .owner =3D THIS_MODULE, + }, }; =20 static struct platform_driver *const mcde_component_drivers[] =3D { @@ -419,7 +425,7 @@ static int mcde_probe(struct platform_device *pdev) * Perform an invasive reset of the MCDE and all blocks by * cutting the power to the subsystem, then bring it back up * later when we enable the display as a result of - * component_master_add_with_match(). + * component_aggregate_register(). */ ret =3D regulator_disable(mcde->epod); if (ret) { @@ -429,8 +435,7 @@ static int mcde_probe(struct platform_device *pdev) /* Wait 50 ms so we are sure we cut the power */ usleep_range(50000, 70000); =20 - ret =3D component_master_add_with_match(&pdev->dev, &mcde_drm_comp_ops, - match); + ret =3D component_aggregate_register(&pdev->dev, &mcde_drm_comp_driver, m= atch); if (ret) { dev_err(dev, "failed to add component master\n"); /* @@ -459,7 +464,7 @@ static int mcde_remove(struct platform_device *pdev) struct drm_device *drm =3D platform_get_drvdata(pdev); struct mcde *mcde =3D to_mcde(drm); =20 - component_master_del(&pdev->dev, &mcde_drm_comp_ops); + component_aggregate_unregister(&pdev->dev, &mcde_drm_comp_driver); clk_disable_unprepare(mcde->mcde_clk); regulator_disable(mcde->vana); regulator_disable(mcde->epod); --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 DECB8C433FE for ; Thu, 27 Jan 2022 20:02:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343905AbiA0UCm (ORCPT ); Thu, 27 Jan 2022 15:02:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343710AbiA0UCR (ORCPT ); Thu, 27 Jan 2022 15:02:17 -0500 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B934C061756 for ; Thu, 27 Jan 2022 12:02:17 -0800 (PST) Received: by mail-pj1-x1035.google.com with SMTP id d5so4130660pjk.5 for ; Thu, 27 Jan 2022 12:02:17 -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=5nHsB00jtundOhkCVDWS5TBuSGtd2+UB36XQklCAGT4=; b=EAPzMHqfta1nmc6u+9Lz9Pg6102ho3xcaQ0U7gHOVeh/7b1Y70gnQahXl4F8vZwb31 vmNDp4HH13iMO7nVsGIQmuOMCJmPL2XQTGmVOBYhIDww/Ty5WgBFNioiYZQymIEd9BcH hEsTcdMeWg/p03KnJHevUNINE8XesrzNa0HBQ= 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=5nHsB00jtundOhkCVDWS5TBuSGtd2+UB36XQklCAGT4=; b=oO4T0uuj3sCn0F/5lFGkZlbT1eqF3pS/B43i9saQ8fL+ssLzMdbBMfhXYtTjD7KrUO +voTDKE0TZ2guoV+LrtXwRq2fvsGxp6CXnyuFkp0FgyL78ELnjoCyLLSGOMWFWbEEoPz zUe+h7VKR5x/hIvznU5kqB2N7WyiRmHILh8WBuBMSxTecYFvu/KYkQE76vm0RozR25XW nN1Wip4aNRO/qLVF/jluWqezKSZ1Jql6aAD4XlFig8/PKJzrPdUPPFlytzPmYXLlylpL iHyjVlc+7ga3+kczMPtgRi36nBYaGMWG1NLPyn0/WffLbe1KhvsQmxYp3qM9RpfEk29h C5eQ== X-Gm-Message-State: AOAM530y4bntE7J/HAoA0QmTLVfuehmDFKQR/RjyHbF5zMpubTLcwdW2 L07V5ZE4Xdqo2Z6lRj/X21vnLw== X-Google-Smtp-Source: ABdhPJzAgFOIdFDf3XTRUBFIzS7iQ6d3J1G2j6LVj19GOwcMvSsXue1RzG2Hk4lmi4hswUqUzBKqNQ== X-Received: by 2002:a17:902:c40b:: with SMTP id k11mr4550482plk.48.1643313736945; Thu, 27 Jan 2022 12:02:16 -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.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:16 -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, Chun-Kuang Hu , Philipp Zabel , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 17/35] drm/mediatek: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:23 -0800 Message-Id: <20220127200141.1295328-18-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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: Chun-Kuang Hu Cc: Philipp Zabel Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/media= tek/mtk_drm_drv.c index 56ff8c57ef8f..b486e98bf8d9 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -374,8 +374,9 @@ static int compare_of(struct device *dev, void *data) return dev->of_node =3D=3D data; } =20 -static int mtk_drm_bind(struct device *dev) +static int mtk_drm_bind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct mtk_drm_private *private =3D dev_get_drvdata(dev); struct drm_device *drm; int ret; @@ -406,8 +407,9 @@ static int mtk_drm_bind(struct device *dev) return ret; } =20 -static void mtk_drm_unbind(struct device *dev) +static void mtk_drm_unbind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct mtk_drm_private *private =3D dev_get_drvdata(dev); =20 drm_dev_unregister(private->drm); @@ -417,9 +419,13 @@ static void mtk_drm_unbind(struct device *dev) private->drm =3D NULL; } =20 -static const struct component_master_ops mtk_drm_ops =3D { - .bind =3D mtk_drm_bind, - .unbind =3D mtk_drm_unbind, +static struct aggregate_driver mtk_drm_aggregate_driver =3D { + .probe =3D mtk_drm_bind, + .remove =3D mtk_drm_unbind, + .driver =3D { + .name =3D "mtk_drm", + .owner =3D THIS_MODULE, + }, }; =20 static const struct of_device_id mtk_ddp_comp_dt_ids[] =3D { @@ -635,7 +641,7 @@ static int mtk_drm_probe(struct platform_device *pdev) =20 platform_set_drvdata(pdev, private); =20 - ret =3D component_master_add_with_match(dev, &mtk_drm_ops, match); + ret =3D component_aggregate_register(dev, &mtk_drm_aggregate_driver, matc= h); if (ret) goto err_pm; =20 @@ -658,7 +664,7 @@ static int mtk_drm_remove(struct platform_device *pdev) struct mtk_drm_private *private =3D platform_get_drvdata(pdev); int i; =20 - component_master_del(&pdev->dev, &mtk_drm_ops); + component_aggregate_unregister(&pdev->dev, &mtk_drm_aggregate_driver); pm_runtime_disable(&pdev->dev); of_node_put(private->mutex_node); for (i =3D 0; i < DDP_COMPONENT_ID_MAX; i++) --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 02EB1C4332F for ; Thu, 27 Jan 2022 20:02:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343936AbiA0UCo (ORCPT ); Thu, 27 Jan 2022 15:02:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343680AbiA0UCW (ORCPT ); Thu, 27 Jan 2022 15:02:22 -0500 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4210C061759 for ; Thu, 27 Jan 2022 12:02:18 -0800 (PST) Received: by mail-pl1-x62e.google.com with SMTP id c9so3661012plg.11 for ; Thu, 27 Jan 2022 12:02:18 -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=tKM5wKimMvZrAKvGy1t7H+N3RMdb/rkm3Tm4lDXJEMA=; b=XUA+m1YsSZShroTZxfw39Qf7S7B1mW7M+xw0s6IqXclDbYYmVnWy+Ltexawu32I40i SZdmr0pz3HmsdbVQcfZ/V4B7woFqglI8B4G8TpywXFwHGjG3A3tCniZTF+Fg5dgU0QFM SRmxEWIy2hA9dTzCtAUaHb/6famrkeiHYK5WM= 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=tKM5wKimMvZrAKvGy1t7H+N3RMdb/rkm3Tm4lDXJEMA=; b=c5eowcygRtxfF15y9MwN7JQ1DcvIqoYYPkQ8qpvz1cRLQ7+MgxL70pctakOBuHdwx6 li7rfLGYnCB4WwEhwZOskhZvHglvYi89C3N9TKv1GRDZTpS2/JBMj7wHsxQnbhenHhBf lpW3Xq0MC1I4LCsAduPt6cl6HnrVbmIkzKA83gVWINI/RiW2KdVImrz6+//mVPPHjeep lIYI+v6rNPzB65eHZecoPCyIpGIe8LKTTEd6HANce74adlCphWzczwfReaCqk4RsuVVQ GTKzLgsLuyLR9IPGHzJX39SAJFbohURwYaeIWzUPtnDnqjIM/qbH150d6kOO/xarckAr VKbQ== X-Gm-Message-State: AOAM532dFPHeO7T+JfTt20Dsl2bX7yDlmy7yqZqzSI4UPJ6ADc1XlH8I MYVMhq7/symJDAhfqvn8ae28VA== X-Google-Smtp-Source: ABdhPJzt+Sz+dY3sN15K0S3lh3rhsQZdiGkdCkL9I2zth8eNN++n1IHK4TSncBJrfWf1JT2jGXzfuA== X-Received: by 2002:a17:902:ed82:: with SMTP id e2mr5198385plj.55.1643313738116; Thu, 27 Jan 2022 12:02:18 -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.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:17 -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, Neil Armstrong , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 18/35] drm/meson: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:24 -0800 Message-Id: <20220127200141.1295328-19-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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: Neil Armstrong Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- drivers/gpu/drm/meson/meson_drv.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meso= n_drv.c index 80f1d439841a..2add29b347a8 100644 --- a/drivers/gpu/drm/meson/meson_drv.c +++ b/drivers/gpu/drm/meson/meson_drv.c @@ -361,13 +361,16 @@ static int meson_drv_bind_master(struct device *dev, = bool has_components) return ret; } =20 -static int meson_drv_bind(struct device *dev) +static int meson_drv_bind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); + return meson_drv_bind_master(dev, true); } =20 -static void meson_drv_unbind(struct device *dev) +static void meson_drv_unbind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct meson_drm *priv =3D dev_get_drvdata(dev); struct drm_device *drm =3D priv->drm; =20 @@ -391,9 +394,13 @@ static void meson_drv_unbind(struct device *dev) } } =20 -static const struct component_master_ops meson_drv_master_ops =3D { - .bind =3D meson_drv_bind, - .unbind =3D meson_drv_unbind, +static struct aggregate_driver meson_aggregate_drv =3D { + .probe =3D meson_drv_bind, + .remove =3D meson_drv_unbind, + .driver =3D { + .name =3D "meson_drm", + .owner =3D THIS_MODULE, + }, }; =20 static int __maybe_unused meson_drv_pm_suspend(struct device *dev) @@ -487,9 +494,7 @@ static int meson_drv_probe(struct platform_device *pdev) if (count) { dev_info(&pdev->dev, "Queued %d outputs on vpu\n", count); =20 - return component_master_add_with_match(&pdev->dev, - &meson_drv_master_ops, - match); + return component_aggregate_register(&pdev->dev, &meson_aggregate_drv, ma= tch); } =20 /* If no output endpoints were available, simply bail out */ --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 12822C433F5 for ; Thu, 27 Jan 2022 20:02:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343959AbiA0UCp (ORCPT ); Thu, 27 Jan 2022 15:02:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343756AbiA0UCW (ORCPT ); Thu, 27 Jan 2022 15:02:22 -0500 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCEE7C06175C for ; Thu, 27 Jan 2022 12:02:19 -0800 (PST) Received: by mail-pl1-x62d.google.com with SMTP id i1so3669381pla.9 for ; Thu, 27 Jan 2022 12:02:19 -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=cGCYteteinr61zPnRrp4oGl0a47ZYXq3HmBJU43ZKkM=; b=k1sf94SonpGpLzpc1eZgA1C/aa+5bazFQmE3BqTBpHJIhPTVql2l5ddtWUYF0w2amf xglsb43JXD9he1Z6Lxg3FS8Mv9yHCSn7eNZo/7dJohdzh70qL8bvwWxSUMBvwRaJQvrW T/LIMTGmPZC8er6bC0A63ZUFrWWtFwytLjG8Q= 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=cGCYteteinr61zPnRrp4oGl0a47ZYXq3HmBJU43ZKkM=; b=0f1GoxTGNJWgUDFhNFjGYfKsh0Iy8dWYHnuBQ71B/7tU/HR+nSmdbxQlTOd7BYSQeC RziQInF05HwELpqZmxDLSZ5+c+GgH3Adgd8RPb6KegutuQF2cymWnRoqC4sfunHK9Xoh eIlBZMpBhoX1Rn3Ss0U5SFIKJ+qLMJPNJTPLZNEsXbU22ESyVWBUC1p6lRrTT6Ft5bu8 5R4l7lSWBXhfTiBPnSRW0aJ4gX6mu72iJdNPR3jyIHah3w/XmiEual39GN7JIJuYtWKU eWbzupR9QE47d/PXwh6nEVi5qrj5jsvztbK/7G3Wmbu9ShxuF+aJFhRTNMjjoW0R8owG 3jsQ== X-Gm-Message-State: AOAM53052b8jO+hd/kZmkKTqbE32jty5eqvm683K2Vrcpvgj1JPyoD1K 1po00aV8FOYCw+zkOlpdxM/Gvg== X-Google-Smtp-Source: ABdhPJw9/AERVJn/DWVhf7xxY/0tKAxYCNg3kYQRZkczeiE7EyDOGTbC8tRqk37+MKPkwel0JA2hBA== X-Received: by 2002:a17:903:2352:: with SMTP id c18mr5295494plh.104.1643313739361; Thu, 27 Jan 2022 12:02:19 -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.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:19 -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, Tomi Valkeinen , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 19/35] drm/omap: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:25 -0800 Message-Id: <20220127200141.1295328-20-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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: Tomi Valkeinen Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- drivers/gpu/drm/omapdrm/dss/dss.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/ds= s/dss.c index 69b3e15b9356..96a290a7bd68 100644 --- a/drivers/gpu/drm/omapdrm/dss/dss.c +++ b/drivers/gpu/drm/omapdrm/dss/dss.c @@ -1304,8 +1304,9 @@ static const struct soc_device_attribute dss_soc_devi= ces[] =3D { { /* sentinel */ } }; =20 -static int dss_bind(struct device *dev) +static int dss_bind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct dss_device *dss =3D dev_get_drvdata(dev); struct platform_device *drm_pdev; struct dss_pdata pdata; @@ -1330,8 +1331,9 @@ static int dss_bind(struct device *dev) return 0; } =20 -static void dss_unbind(struct device *dev) +static void dss_unbind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct dss_device *dss =3D dev_get_drvdata(dev); =20 platform_device_unregister(dss->drm_pdev); @@ -1339,9 +1341,13 @@ static void dss_unbind(struct device *dev) component_unbind_all(dev, NULL); } =20 -static const struct component_master_ops dss_component_ops =3D { - .bind =3D dss_bind, - .unbind =3D dss_unbind, +static struct aggregate_driver dss_aggregate_driver =3D { + .probe =3D dss_bind, + .remove =3D dss_unbind, + .driver =3D { + .name =3D "dss_drm", + .owner =3D THIS_MODULE, + }, }; =20 static int dss_component_compare(struct device *dev, void *data) @@ -1502,7 +1508,7 @@ static int dss_probe(struct platform_device *pdev) cmatch.match =3D &match; device_for_each_child(&pdev->dev, &cmatch, dss_add_child_component); =20 - r =3D component_master_add_with_match(&pdev->dev, &dss_component_ops, mat= ch); + r =3D component_aggregate_register(&pdev->dev, &dss_aggregate_driver, mat= ch); if (r) goto err_of_depopulate; =20 @@ -1541,7 +1547,7 @@ static int dss_remove(struct platform_device *pdev) =20 of_platform_depopulate(&pdev->dev); =20 - component_master_del(&pdev->dev, &dss_component_ops); + component_aggregate_unregister(&pdev->dev, &dss_aggregate_driver); =20 dss_debugfs_remove_file(dss->debugfs.clk); dss_debugfs_remove_file(dss->debugfs.dss); --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 A93A4C433EF for ; Thu, 27 Jan 2022 20:03:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343952AbiA0UD6 (ORCPT ); Thu, 27 Jan 2022 15:03:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343765AbiA0UCY (ORCPT ); Thu, 27 Jan 2022 15:02:24 -0500 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B965C061762 for ; Thu, 27 Jan 2022 12:02:21 -0800 (PST) Received: by mail-pj1-x102d.google.com with SMTP id h12so4142692pjq.3 for ; Thu, 27 Jan 2022 12:02:21 -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=IW/8Y9aTwhLOwEb2xP1btnAgZlqJiVoA25E4MQ0ztlM=; b=Orc/8SO3R+dEVDvMgPCjrMtDqLFJ0Q6HS0V1upmPpUW4kXr9C4iejmRDOGbRV9iW4j k9loF01QGaULZ1/ixZXpaAmhKNCK4M8hIxc3gWmGet47QcH0vvkYz42DwlJvJdht3Dnv tqIWTsf24/eGXmaKQV4HRtIrBwUEtqhRo9dI4= 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=IW/8Y9aTwhLOwEb2xP1btnAgZlqJiVoA25E4MQ0ztlM=; b=vY3epaw7reVpjFV/se+niUuNdhVCaAIP1nBRurUgTN3MOV9XvxsjxMvYDceS0UHueI H5P0jvJn1tSvxUcSTV2w6lEVSAyPbyTd2z9SxQLXb6Vm7GEmjF9CKlhFBEPGbrHzdV9t RbncPf8iTKqyMoz3RIPAkv8X3lsLQ0tIiFlZvSJXccilrZJ4PdxRjZMxNz23xU+Fm4tZ /LHuoW4kaaalMCnERAOEKvrT/qgkmBTQHN1Os/JDNNcIl73v4M5NbIGaR9L+ReEy9UzY ZrGCFZa3VnP9jxWF7pongsUBDVLpmhKGmXajf/0XxaSzPJ+i+pkjuVATEoH4tZ5mJhIE 7VTQ== X-Gm-Message-State: AOAM532u5qjA7o+0bf7mnRAHJ+c6eoNFqhQJFV1015q1M9Ur7lkOoG9E hxnYrvqPlXvWGmOqV8MbTKn1og== X-Google-Smtp-Source: ABdhPJwbPVI8xDeM1NWvY0IzOnQ+E4h23xnsQ0RPm+d8WXJjw8YoUnpfi1pwRQVIiRppcVlDbKUIrA== X-Received: by 2002:a17:902:da90:: with SMTP id j16mr4907623plx.101.1643313740669; Thu, 27 Jan 2022 12:02:20 -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.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:20 -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, Sandy Huang , =?UTF-8?q?Heiko=20St=C3=BCbner?= , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 20/35] drm/rockchip: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:26 -0800 Message-Id: <20220127200141.1295328-21-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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: Sandy Huang Cc: "Heiko St=C3=BCbner" Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/= rockchip/rockchip_drm_drv.c index bec207de4544..6a6ed293d7a0 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -108,8 +108,9 @@ static void rockchip_iommu_cleanup(struct drm_device *d= rm_dev) iommu_domain_free(private->domain); } =20 -static int rockchip_drm_bind(struct device *dev) +static int rockchip_drm_bind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct drm_device *drm_dev; struct rockchip_drm_private *private; int ret; @@ -179,8 +180,9 @@ static int rockchip_drm_bind(struct device *dev) return ret; } =20 -static void rockchip_drm_unbind(struct device *dev) +static void rockchip_drm_unbind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct drm_device *drm_dev =3D dev_get_drvdata(dev); =20 drm_dev_unregister(drm_dev); @@ -331,9 +333,13 @@ static struct component_match *rockchip_drm_match_add(= struct device *dev) return match ?: ERR_PTR(-ENODEV); } =20 -static const struct component_master_ops rockchip_drm_ops =3D { - .bind =3D rockchip_drm_bind, - .unbind =3D rockchip_drm_unbind, +static struct aggregate_driver rockchip_aggregate_driver =3D { + .probe =3D rockchip_drm_bind, + .remove =3D rockchip_drm_unbind, + .driver =3D { + .name =3D "rockchip_drm", + .owner =3D THIS_MODULE, + }, }; =20 static int rockchip_drm_platform_of_probe(struct device *dev) @@ -404,7 +410,7 @@ static int rockchip_drm_platform_probe(struct platform_= device *pdev) if (IS_ERR(match)) return PTR_ERR(match); =20 - ret =3D component_master_add_with_match(dev, &rockchip_drm_ops, match); + ret =3D component_aggregate_register(dev, &rockchip_aggregate_driver, mat= ch); if (ret < 0) { rockchip_drm_match_remove(dev); return ret; @@ -415,7 +421,7 @@ static int rockchip_drm_platform_probe(struct platform_= device *pdev) =20 static int rockchip_drm_platform_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &rockchip_drm_ops); + component_aggregate_unregister(&pdev->dev, &rockchip_aggregate_driver); =20 rockchip_drm_match_remove(&pdev->dev); =20 --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 8D66DC433F5 for ; Thu, 27 Jan 2022 20:03:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343925AbiA0UD4 (ORCPT ); Thu, 27 Jan 2022 15:03:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343827AbiA0UCc (ORCPT ); Thu, 27 Jan 2022 15:02:32 -0500 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E3C6C061714 for ; Thu, 27 Jan 2022 12:02:22 -0800 (PST) Received: by mail-pj1-x1030.google.com with SMTP id o16-20020a17090aac1000b001b62f629953so1213859pjq.3 for ; Thu, 27 Jan 2022 12:02:22 -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=km10INCJaOtDHcOHVEwChqxOVacq/jIckMelDPfId8g=; b=J8JG6dKaTSgfj58AmDZpi6NnG+1JvETfnLcowzBO0x3Qy6rq53OG3iQ8SC2QccH5or kmgbyTIrVRw0FWOwvHltipYgDOSZF7UsNLQJmt8RPYt7bZEC1QEFqPorauhu3o+T5eYP kfOEQHep0THj6hqQ1LSBWSiaqR3ifg2OFHhXo= 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=km10INCJaOtDHcOHVEwChqxOVacq/jIckMelDPfId8g=; b=3+jSmePgQHnxikB9uCf6rARmcPSAzv+VdwSQ2p6kTBQRsirpwxmWqw9CZK3bCithbY 5pa4veECokE5rFaxdFiRfd59Sw89josVK7+pj1d4F4epgio8BKfHszmOYWA2FzR3prL1 qAXSc6QCucPWtZLKgIbSudx3O2WfVujWX/H7ky+cImPqYdnDJLyP8yzRnrnV44PQA8Qy sjg619anWRLu1W0MNeWllVrc5zt109PDm4uZY0PccE4KnKmjpmbc2OTQLCcm8q3DwjQz h53KzZQgWnJ33t05dBMX3Igq7YHKhTjlFrXGVDMDzOyhdIPYOy/jNeOVNwAWo5dc/a9V fHcg== X-Gm-Message-State: AOAM533DlsPHbrKCSwCSFHHdZpV59+XNxz/p7hoF0dYPoai7rUuUjAQr ChR0BNzF9fb27vdkexgY05g38g== X-Google-Smtp-Source: ABdhPJwyogmHpshiG/xBbuQWcVBd4OG6Znv+GNEvLhn4iDt5WgBHGlQonK0bd4e81r4GQLgrtX2nyA== X-Received: by 2002:a17:90b:1d91:: with SMTP id pf17mr15477568pjb.160.1643313741993; Thu, 27 Jan 2022 12:02:21 -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.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:21 -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, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 21/35] drm/sti: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:27 -0800 Message-Id: <20220127200141.1295328-22-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- drivers/gpu/drm/sti/sti_drv.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c index c7efb43b83ee..958db315d547 100644 --- a/drivers/gpu/drm/sti/sti_drv.c +++ b/drivers/gpu/drm/sti/sti_drv.c @@ -182,8 +182,9 @@ static void sti_cleanup(struct drm_device *ddev) ddev->dev_private =3D NULL; } =20 -static int sti_bind(struct device *dev) +static int sti_bind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct drm_device *ddev; int ret; =20 @@ -216,8 +217,9 @@ static int sti_bind(struct device *dev) return ret; } =20 -static void sti_unbind(struct device *dev) +static void sti_unbind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct drm_device *ddev =3D dev_get_drvdata(dev); =20 drm_dev_unregister(ddev); @@ -225,9 +227,13 @@ static void sti_unbind(struct device *dev) drm_dev_put(ddev); } =20 -static const struct component_master_ops sti_ops =3D { - .bind =3D sti_bind, - .unbind =3D sti_unbind, +static struct aggregate_driver sti_aggregate_driver =3D { + .probe =3D sti_bind, + .remove =3D sti_unbind, + .driver =3D { + .name =3D "sti_drm", + .owner =3D THIS_MODULE, + }, }; =20 static int sti_platform_probe(struct platform_device *pdev) @@ -249,12 +255,12 @@ static int sti_platform_probe(struct platform_device = *pdev) child_np =3D of_get_next_available_child(node, child_np); } =20 - return component_master_add_with_match(dev, &sti_ops, match); + return component_aggregate_register(dev, &sti_aggregate_driver, match); } =20 static int sti_platform_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &sti_ops); + component_aggregate_unregister(&pdev->dev, &sti_aggregate_driver); =20 return 0; } --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 EFC11C433EF for ; Thu, 27 Jan 2022 20:03:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343822AbiA0UDD (ORCPT ); Thu, 27 Jan 2022 15:03:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343831AbiA0UCd (ORCPT ); Thu, 27 Jan 2022 15:02:33 -0500 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF832C06176A for ; Thu, 27 Jan 2022 12:02:23 -0800 (PST) Received: by mail-pj1-x1035.google.com with SMTP id q63so4155903pja.1 for ; Thu, 27 Jan 2022 12:02:23 -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=WZZOtrHonizJg96tLMp/t5Fsa0Q7P0xuTO1TufH5G0g=; b=JtASTOgjliVzgUuDAEkW0Ir5wrdjaMJtLwikgtGfArBmRuX33OZG0aepVuJRx2P4EY K5Jj7OesE+FqfW5gq9Ay8XCHtB7gY/xTVO9TMH8Moi/hdtqH5YekBCbOK8iwI9v0qKx2 u1JKO+JV8tJOVYIHoSfVA+SwgZ2Vh34t89+2Y= 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=WZZOtrHonizJg96tLMp/t5Fsa0Q7P0xuTO1TufH5G0g=; b=1rkKVGSBx+KmrPdcvywZVlcMExkGSpetnFoL+Yo10U0HP1m5MW4WOmnQYbZZtJ/1VX r7SiqT4F9BMOvqB96h3GSBPn1vqHtka6dP+6kr9VM/c15Edh//doFvqYtHQuIhVpMc1/ UJ8hp5iFQy51x0f4Q5oQ+RLTA7j0AipzmxQYQisy0KrAghHmBfx+icAt7j9VMu7swhgg 7Qwcm9IRKrdQKlPAFE6WlZ0SFxVHXc6nU5NVuSwxqD+WvCRXKM2tdSxkxlteVQnK6Pr2 b54O0mspmAFw/a/ySIcVhCudU2PuEx1LwFB3VoRAKfk1e2XsAJQXtUhCxcxbQT5UBj3t b4BA== X-Gm-Message-State: AOAM532l56ZGC+UYHY9vnGcx+ZXy0nYwlfY07kjrIxGPYhsxNJQiQw4r FWCZPr7ZP46w0PnVoVDIf952JQ== X-Google-Smtp-Source: ABdhPJwmi+gC9GIk+mPiD3jpNbRlfOIDByFSs57GlbKAx7rEbL4+ShWkEE9cxHVpUb+UV2YhHX+FQA== X-Received: by 2002:a17:90b:38d1:: with SMTP id nn17mr5880056pjb.58.1643313743266; Thu, 27 Jan 2022 12:02:23 -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.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:22 -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, Maxime Ripard , Chen-Yu Tsai , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 22/35] drm/sun4i: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:28 -0800 Message-Id: <20220127200141.1295328-23-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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: Maxime Ripard Cc: Chen-Yu Tsai Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- drivers/gpu/drm/sun4i/sun4i_drv.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4= i_drv.c index b630614b3d72..9f20c3f0f93e 100644 --- a/drivers/gpu/drm/sun4i/sun4i_drv.c +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c @@ -56,8 +56,9 @@ static const struct drm_driver sun4i_drv_driver =3D { DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(drm_sun4i_gem_dumb_create), }; =20 -static int sun4i_drv_bind(struct device *dev) +static int sun4i_drv_bind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct drm_device *drm; struct sun4i_drv *drv; int ret; @@ -125,8 +126,9 @@ static int sun4i_drv_bind(struct device *dev) return ret; } =20 -static void sun4i_drv_unbind(struct device *dev) +static void sun4i_drv_unbind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct drm_device *drm =3D dev_get_drvdata(dev); =20 drm_dev_unregister(drm); @@ -140,9 +142,13 @@ static void sun4i_drv_unbind(struct device *dev) drm_dev_put(drm); } =20 -static const struct component_master_ops sun4i_drv_master_ops =3D { - .bind =3D sun4i_drv_bind, - .unbind =3D sun4i_drv_unbind, +static struct aggregate_driver sun4i_aggregate_driver =3D { + .probe =3D sun4i_drv_bind, + .remove =3D sun4i_drv_unbind, + .driver =3D { + .name =3D "sun4i_drm", + .owner =3D THIS_MODULE, + }, }; =20 static bool sun4i_drv_node_is_connector(struct device_node *node) @@ -398,16 +404,14 @@ static int sun4i_drv_probe(struct platform_device *pd= ev) } =20 if (count) - return component_master_add_with_match(&pdev->dev, - &sun4i_drv_master_ops, - match); - else - return 0; + return component_aggregate_register(&pdev->dev, &sun4i_aggregate_driver,= match); + + return 0; } =20 static int sun4i_drv_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &sun4i_drv_master_ops); + component_aggregate_unregister(&pdev->dev, &sun4i_aggregate_driver); =20 return 0; } --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 73BC3C433EF for ; Thu, 27 Jan 2022 20:03:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343780AbiA0UDx (ORCPT ); Thu, 27 Jan 2022 15:03:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343835AbiA0UCd (ORCPT ); Thu, 27 Jan 2022 15:02:33 -0500 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54FEBC06176D for ; Thu, 27 Jan 2022 12:02:25 -0800 (PST) Received: by mail-pl1-x636.google.com with SMTP id b15so3708037plg.3 for ; Thu, 27 Jan 2022 12:02:25 -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=Bh1F2H75iE3V27brrpMBVo1PNF+smDK9eKi3jTHA3NU=; b=gBKI7blbHBCAqe/knpU0g1G0b00mGDxRkbOl8V2KlrayGyInp0tb8zKjsSLCC9ba+B 6txoAVtYIwGp0wJWz0h5GuwHFrsX9EJiYKEomLmWAvMba/VOdsiRGqAPMfw6JL64I3K0 aBC4w7Eku4mmFe1Gk8VnGwVPT0vOj9wX53kac= 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=Bh1F2H75iE3V27brrpMBVo1PNF+smDK9eKi3jTHA3NU=; b=rB5432A2e0qDKbpEvCjYGi34oQgKWssUwgXoiVDT9c7i9pzEV80fG3JH3VFSbi9n6m fFylsB9sIvraN7MWjIQln2vpu64FzW3VyvlVtQJ1ueaED0ykfaaC3zV1nHZeMTlaq55C CWzh9AwUgHuGUFLsa0rvF8X7LKfdUDwy2zmkDno/NJ7baXceN1IFiq3VTAHuhbg/B9rq IQ4lAdKICeyRGVICsSIO+k4fRvMxxJR5Ye8RasBLQUEVojnr/aRWheoPslx6I3GeKytt 4s5odWqtvkqYTW4FxA7rPQl25p6PAix8bFB/o39u69DDqvRctiYy68IvShxRf+5H89NB H0Rw== X-Gm-Message-State: AOAM531aGbl3IRBDn9hOpF6+CM5+sb14F9NV7vRJdUjXF+Uw4T+TOF56 Qas2eDCq3xIz11Tnf/+MAP3vDw== X-Google-Smtp-Source: ABdhPJzxet8MofwljRD08XsFu9WsvUyEhN8qPVrflK9qDEebKLMf9x4c3sDMbaNHei4PnCArHyeJbw== X-Received: by 2002:a17:90a:d58d:: with SMTP id v13mr5855255pju.210.1643313744767; Thu, 27 Jan 2022 12:02:24 -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.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:24 -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 v6 23/35] drm/tilcdc: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:29 -0800 Message-Id: <20220127200141.1295328-24-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- 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/t= ilcdc_drv.c index 3ddb7c710a3d..c12c579ce66f 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 =3D { /* * Platform driver: */ -static int tilcdc_bind(struct device *dev) +static int tilcdc_bind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); + return tilcdc_init(&tilcdc_driver, dev); } =20 -static void tilcdc_unbind(struct device *dev) +static void tilcdc_unbind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct drm_device *ddev =3D dev_get_drvdata(dev); =20 /* 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)); } =20 -static const struct component_master_ops tilcdc_comp_ops =3D { - .bind =3D tilcdc_bind, - .unbind =3D tilcdc_unbind, +static struct aggregate_driver tilcdc_aggregate_driver =3D { + .probe =3D tilcdc_bind, + .remove =3D tilcdc_unbind, + .driver =3D { + .name =3D "tilcdc_drm", + .owner =3D THIS_MODULE, + }, }; =20 static int tilcdc_pdev_probe(struct platform_device *pdev) @@ -564,12 +571,9 @@ static int tilcdc_pdev_probe(struct platform_device *p= dev) ret =3D tilcdc_get_external_components(&pdev->dev, &match); if (ret < 0) return ret; - else if (ret =3D=3D 0) + if (ret =3D=3D 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); } =20 static int tilcdc_pdev_remove(struct platform_device *pdev) @@ -579,10 +583,10 @@ static int tilcdc_pdev_remove(struct platform_device = *pdev) ret =3D tilcdc_get_external_components(&pdev->dev, NULL); if (ret < 0) return ret; - else if (ret =3D=3D 0) + if (ret =3D=3D 0) tilcdc_fini(platform_get_drvdata(pdev)); else - component_master_del(&pdev->dev, &tilcdc_comp_ops); + component_aggregate_unregister(&pdev->dev, &tilcdc_aggregate_driver); =20 return 0; } --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 70665C433EF for ; Thu, 27 Jan 2022 20:03:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343847AbiA0UDn (ORCPT ); Thu, 27 Jan 2022 15:03:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343731AbiA0UCe (ORCPT ); Thu, 27 Jan 2022 15:02:34 -0500 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 831E6C061770 for ; Thu, 27 Jan 2022 12:02:26 -0800 (PST) Received: by mail-pj1-x102b.google.com with SMTP id z10-20020a17090acb0a00b001b520826011so8654505pjt.5 for ; Thu, 27 Jan 2022 12:02:26 -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=w0WjtZCiA2Izv5LYYNS4nUlyXyc0y53v4Rvk7s0pbe0=; b=N1+WfbFdWfFWm8JZDkISDKtq8PppgDmD79xW8tNVglUX7OWvRmJS2Wh8sMT5FI3vAy tsKqmQ0M8qIAp054xQUwpCGIaNg9cIbGxzzwfhBal7cAk2vj8DKOZGPx05QoCOH+i7Eq moKrr1lTYTcMvhTnoQwPjc8fbcGK4uzBIFz24= 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=w0WjtZCiA2Izv5LYYNS4nUlyXyc0y53v4Rvk7s0pbe0=; b=XnZVgJ0ANsOuyix8R4g0xyehIQxbgxp/f04ULejOoGhdG1oG4WBFrX0XQ8F/klMQKj ACOxPX2AkPtmqIjGNJNeuVG6ZT5/TScyjh8dHhwAYDDMr5MCcVXmfgC8disbase/qw6P 3fUxySrh5bK8UvV8VCO8qU/OICXAf9hlP0LH64UzRmTIUFsPaRjL2hCmWfUNnbFn3zP+ oeMgVFUGeBCQjYqQiJKg+Y1tRl/ieDebY9fdEs5eNH7qwIt1guopW+SzQc2E0d5p5bb1 0+Pu+HbKLPo433Q2ew0cfR5hWUWo7WTkSqEh29wDsY9y83cUAZCKE/X0NsXSl704Ih0H Rp2Q== X-Gm-Message-State: AOAM531Gih1Oh/PyXsfFV7wQp7fekgmFTg631IWd8uN1ATlDmZvOFNB5 camA6mcG1SHHgv0b6Hs+kTQZqQ== X-Google-Smtp-Source: ABdhPJzgzcKDYSY6QDkCMyGRcUuonDiSsTyh/el8NoU7HL3yzfQZ3ufK+XGi3zh1Oa5ipMLqxteAAw== X-Received: by 2002:a17:90b:4d0e:: with SMTP id mw14mr3383117pjb.133.1643313746070; Thu, 27 Jan 2022 12:02:26 -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.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:25 -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, Emma Anholt , Maxime Ripard , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 24/35] drm/vc4: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:30 -0800 Message-Id: <20220127200141.1295328-25-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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: Emma Anholt Cc: Maxime Ripard Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- drivers/gpu/drm/vc4/vc4_drv.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c index 16abc3a3d601..297ecddea5fb 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c @@ -212,8 +212,9 @@ static void vc4_match_add_drivers(struct device *dev, } } =20 -static int vc4_drm_bind(struct device *dev) +static int vc4_drm_bind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct platform_device *pdev =3D to_platform_device(dev); struct drm_device *drm; struct vc4_dev *vc4; @@ -284,8 +285,9 @@ static int vc4_drm_bind(struct device *dev) return ret; } =20 -static void vc4_drm_unbind(struct device *dev) +static void vc4_drm_unbind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct drm_device *drm =3D dev_get_drvdata(dev); =20 drm_dev_unregister(drm); @@ -293,9 +295,13 @@ static void vc4_drm_unbind(struct device *dev) drm_atomic_helper_shutdown(drm); } =20 -static const struct component_master_ops vc4_drm_ops =3D { - .bind =3D vc4_drm_bind, - .unbind =3D vc4_drm_unbind, +static struct aggregate_driver vc4_aggregate_driver =3D { + .probe =3D vc4_drm_bind, + .remove =3D vc4_drm_unbind, + .driver =3D { + .name =3D "vc4_drm", + .owner =3D THIS_MODULE, + }, }; =20 /* @@ -326,12 +332,12 @@ static int vc4_platform_drm_probe(struct platform_dev= ice *pdev) vc4_match_add_drivers(dev, &match, component_drivers, ARRAY_SIZE(component_drivers)); =20 - return component_master_add_with_match(dev, &vc4_drm_ops, match); + return component_aggregate_register(dev, &vc4_aggregate_driver, match); } =20 static int vc4_platform_drm_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &vc4_drm_ops); + component_aggregate_unregister(&pdev->dev, &vc4_aggregate_driver); =20 return 0; } --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 1BEADC433F5 for ; Thu, 27 Jan 2022 20:03:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343897AbiA0UDI (ORCPT ); Thu, 27 Jan 2022 15:03:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343848AbiA0UCe (ORCPT ); Thu, 27 Jan 2022 15:02:34 -0500 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E176CC061772 for ; Thu, 27 Jan 2022 12:02:27 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id h20-20020a17090adb9400b001b518bf99ffso8675005pjv.1 for ; Thu, 27 Jan 2022 12:02:27 -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=hov3M21BNOijyyw82jqhUyYJ3iOp1dSjLPKTic1j8JE=; b=VMsZK3TTX6nLCzP+QIThzR82VyYJZwgX+oSGgv7vQeKlBpWdrOdF5o/L0jF7Use+vW hYXUpG6CD1574W6Y5VAuN0nNNVU4CNnR8VlJhVJ8coM7vZQ3lREpM89oF2wV3eu9k+6t XZp2CZnAvvASdrOdWMe4363IqUvAvHMDJfKzM= 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=hov3M21BNOijyyw82jqhUyYJ3iOp1dSjLPKTic1j8JE=; b=IYt92TaBa9ksYSlaqDEt1DuwNP/84adWkBKTO8GBFplUyoQRkdly02mLNQqARNnYkZ fcM2YkwZ9QT1jvMXS2mpgUEeOVqEz57/0/1/AoIEKh+E/P73TC66FCK30mf4wwrqnyYG yKdsbF4OJvUiiP8goLWQ6pGfL0IP57E24tnaLpJmYG5/9vIPaynzq0BqMGtJm7uxydsb A90vo1HUd99q3GNNMPUvmSNX7O5nd+DI2nxEVJWfiy1Cjm6tkQYTy0WgKaGd6E3WLe2P w0VHz5sveLFeVtyEHtou3S0MZCGqvZeOWG+lwvtwBR15LxINybSM9WtsmAcVebe/Jeqi sCag== X-Gm-Message-State: AOAM530KchlQf61OmC7NumprFuqQTJ6j1RNP0CBAb5B+t3NwIDSvGu1P ataF79LR9e/XTFcdQBN6SnA0Uw== X-Google-Smtp-Source: ABdhPJysVFTcTdgm/lMydDDYZ6zTCeNgLlXta+hSXw7T/WuJ7H1b65YtFfhvLzWyiAUU1prxaf3uoA== X-Received: by 2002:a17:902:9b96:: with SMTP id y22mr1279071plp.100.1643313747465; Thu, 27 Jan 2022 12:02:27 -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.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:27 -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, Yong Wu , Joerg Roedel , Will Deacon , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 25/35] iommu/mediatek: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:31 -0800 Message-Id: <20220127200141.1295328-26-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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: Yong Wu Cc: Joerg Roedel Cc: Will Deacon Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- drivers/iommu/mtk_iommu.c | 14 +++++++++----- drivers/iommu/mtk_iommu.h | 6 ++++-- drivers/iommu/mtk_iommu_v1.c | 14 +++++++++----- drivers/memory/mtk-smi.c | 10 ++++------ 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 25b834104790..8e722898cbe2 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -752,9 +752,13 @@ static int mtk_iommu_hw_init(const struct mtk_iommu_da= ta *data) return 0; } =20 -static const struct component_master_ops mtk_iommu_com_ops =3D { - .bind =3D mtk_iommu_bind, - .unbind =3D mtk_iommu_unbind, +static struct aggregate_driver mtk_iommu_aggregate_driver =3D { + .probe =3D mtk_iommu_bind, + .remove =3D mtk_iommu_unbind, + .driver =3D { + .name =3D "mtk_iommu_agg", + .owner =3D THIS_MODULE, + }, }; =20 static int mtk_iommu_probe(struct platform_device *pdev) @@ -895,7 +899,7 @@ static int mtk_iommu_probe(struct platform_device *pdev) goto out_list_del; } =20 - ret =3D component_master_add_with_match(dev, &mtk_iommu_com_ops, match); + ret =3D component_aggregate_register(dev, &mtk_iommu_aggregate_driver, ma= tch); if (ret) goto out_bus_set_null; return ret; @@ -928,7 +932,7 @@ static int mtk_iommu_remove(struct platform_device *pde= v) device_link_remove(data->smicomm_dev, &pdev->dev); pm_runtime_disable(&pdev->dev); devm_free_irq(&pdev->dev, data->irq, data); - component_master_del(&pdev->dev, &mtk_iommu_com_ops); + component_aggregate_unregister(&pdev->dev, &mtk_iommu_aggregate_driver); return 0; } =20 diff --git a/drivers/iommu/mtk_iommu.h b/drivers/iommu/mtk_iommu.h index f81fa8862ed0..125be5819c42 100644 --- a/drivers/iommu/mtk_iommu.h +++ b/drivers/iommu/mtk_iommu.h @@ -94,15 +94,17 @@ static inline void release_of(struct device *dev, void = *data) of_node_put(data); } =20 -static inline int mtk_iommu_bind(struct device *dev) +static inline int mtk_iommu_bind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct mtk_iommu_data *data =3D dev_get_drvdata(dev); =20 return component_bind_all(dev, &data->larb_imu); } =20 -static inline void mtk_iommu_unbind(struct device *dev) +static inline void mtk_iommu_unbind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct mtk_iommu_data *data =3D dev_get_drvdata(dev); =20 component_unbind_all(dev, &data->larb_imu); diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c index be22fcf988ce..5fb29058a165 100644 --- a/drivers/iommu/mtk_iommu_v1.c +++ b/drivers/iommu/mtk_iommu_v1.c @@ -534,9 +534,13 @@ static const struct of_device_id mtk_iommu_of_ids[] = =3D { {} }; =20 -static const struct component_master_ops mtk_iommu_com_ops =3D { - .bind =3D mtk_iommu_bind, - .unbind =3D mtk_iommu_unbind, +static struct aggregate_driver mtk_iommu_aggregate_driver =3D { + .probe =3D mtk_iommu_bind, + .remove =3D mtk_iommu_unbind, + .driver =3D { + .name =3D "mtk_iommu_agg", + .owner =3D THIS_MODULE, + }, }; =20 static int mtk_iommu_probe(struct platform_device *pdev) @@ -624,7 +628,7 @@ static int mtk_iommu_probe(struct platform_device *pdev) goto out_dev_unreg; } =20 - ret =3D component_master_add_with_match(dev, &mtk_iommu_com_ops, match); + ret =3D component_aggregate_register(dev, &mtk_iommu_aggregate_driver, ma= tch); if (ret) goto out_bus_set_null; return ret; @@ -650,7 +654,7 @@ static int mtk_iommu_remove(struct platform_device *pde= v) =20 clk_disable_unprepare(data->bclk); devm_free_irq(&pdev->dev, data->irq, data); - component_master_del(&pdev->dev, &mtk_iommu_com_ops); + component_aggregate_unregister(&pdev->dev, &mtk_iommu_aggregate_driver); return 0; } =20 diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c index e201e5976f34..0910fe109f53 100644 --- a/drivers/memory/mtk-smi.c +++ b/drivers/memory/mtk-smi.c @@ -175,6 +175,8 @@ mtk_smi_larb_bind(struct device *dev, struct device *ma= ster, void *data) larb->larbid =3D i; larb->mmu =3D &larb_mmu[i].mmu; larb->bank =3D larb_mmu[i].bank; + + pm_runtime_enable(dev); return 0; } } @@ -450,15 +452,11 @@ static int mtk_smi_larb_probe(struct platform_device = *pdev) if (ret < 0) return ret; =20 - pm_runtime_enable(dev); platform_set_drvdata(pdev, larb); ret =3D component_add(dev, &mtk_smi_larb_component_ops); - if (ret) - goto err_pm_disable; - return 0; + if (!ret) + return 0; =20 -err_pm_disable: - pm_runtime_disable(dev); device_link_remove(dev, larb->smi_common_dev); return ret; } --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 E3555C4167D for ; Thu, 27 Jan 2022 20:03:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343826AbiA0UDm (ORCPT ); Thu, 27 Jan 2022 15:03:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343735AbiA0UCe (ORCPT ); Thu, 27 Jan 2022 15:02:34 -0500 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAFD8C061776 for ; Thu, 27 Jan 2022 12:02:29 -0800 (PST) Received: by mail-pl1-x634.google.com with SMTP id h14so3719145plf.1 for ; Thu, 27 Jan 2022 12:02: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=g623/C18UKVOGP0jeG3P9XoZ0hRTRdI8bxCTdme+ZDc=; b=UjXyKQ27u9ktmyUhlabtrzpM184jAnjXIW63DCf85unRcMTX6v/Xs4Fw8lX6VtLkrG 0i0Rpg4QPjonKcYKL/d7xYdgHlEeoHJrADQdyIWZWCeqxWps1f0ssg+phw6p/LB4XTD9 1x4mXefiju1VsB+cP1wQ3Ej679uZCdIZ8uomc= 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=g623/C18UKVOGP0jeG3P9XoZ0hRTRdI8bxCTdme+ZDc=; b=rFy8HhYP+bAdXmOrkDi6/uZcUXAcTwgjKWI5NlX+jxiE7Q90Zcxc3LiylnPeitXTHl WvZx1fNT672xPVM8Gy6SX0L8C1rJTI9+ok5QbRFLZqALkMEZHA72SqrlKpBTeuqmhSte R/+yOGm0lcmPsHfWqdWVpzX7T3wad7lhsZ9K4DVZIUh9jJ6iB9RemLD3KDC87JoFpIBT +D8Fc6TXTD41pyT5Dzs3Gr/FHtm9qpJ/7WZxGr9UghJu2BEciZrId5zqrpBNJEwOL6TY VZ2aWUFB6xedB7e+cesQd1lCNNpX+ZBj8Is1dSPu42yTWrTouZfM0BKdMJVxm6Id0Pum cFXA== X-Gm-Message-State: AOAM530yi1bU5KyxhzUTzm4mK0YL/HF+DRPTjNd8msEIMYNZYqL1UpuI KLcR5/LTSIPCBZlHCRAnMLjgyA== X-Google-Smtp-Source: ABdhPJyaGm/XG8xRvxwiAz5T8R45IbJcC1YnZiE695jmz59Zq5cjk/F0goVL7OumDWNu0N2Qqr17jg== X-Received: by 2002:a17:902:b40b:: with SMTP id x11mr296131plr.75.1643313749462; Thu, 27 Jan 2022 12:02:29 -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.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02: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, Tomas Winkler , Vitaly Lubart , Daniele Ceraolo Spurio , Rodrigo Vivi , Arnd Bergmann , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan , Alexander Usyskin Subject: [PATCH v6 26/35] mei: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:32 -0800 Message-Id: <20220127200141.1295328-27-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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: Tomas Winkler Cc: Vitaly Lubart Cc: Daniele Ceraolo Spurio Cc: Rodrigo Vivi Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Cc: Alexander Usyskin Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- drivers/misc/mei/hdcp/mei_hdcp.c | 22 +++++++++++++--------- drivers/misc/mei/pxp/mei_pxp.c | 22 +++++++++++++--------- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_h= dcp.c index ec2a4fce8581..3c6e4e3bf212 100644 --- a/drivers/misc/mei/hdcp/mei_hdcp.c +++ b/drivers/misc/mei/hdcp/mei_hdcp.c @@ -732,8 +732,9 @@ static const struct i915_hdcp_component_ops mei_hdcp_op= s =3D { .close_hdcp_session =3D mei_hdcp_close_session, }; =20 -static int mei_component_master_bind(struct device *dev) +static int mei_hdcp_aggregate_bind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct mei_cl_device *cldev =3D to_mei_cl_device(dev); struct i915_hdcp_comp_master *comp_master =3D mei_cldev_get_drvdata(cldev); @@ -749,8 +750,9 @@ static int mei_component_master_bind(struct device *dev) return 0; } =20 -static void mei_component_master_unbind(struct device *dev) +static void mei_hdcp_aggregate_unbind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct mei_cl_device *cldev =3D to_mei_cl_device(dev); struct i915_hdcp_comp_master *comp_master =3D mei_cldev_get_drvdata(cldev); @@ -759,9 +761,13 @@ static void mei_component_master_unbind(struct device = *dev) component_unbind_all(dev, comp_master); } =20 -static const struct component_master_ops mei_component_master_ops =3D { - .bind =3D mei_component_master_bind, - .unbind =3D mei_component_master_unbind, +static struct aggregate_driver mei_aggregate_driver =3D { + .probe =3D mei_hdcp_aggregate_bind, + .remove =3D mei_hdcp_aggregate_unbind, + .driver =3D { + .name =3D "mei_hdcp_agg", + .owner =3D THIS_MODULE, + }, }; =20 /** @@ -826,9 +832,7 @@ static int mei_hdcp_probe(struct mei_cl_device *cldev, } =20 mei_cldev_set_drvdata(cldev, comp_master); - ret =3D component_master_add_with_match(&cldev->dev, - &mei_component_master_ops, - master_match); + ret =3D component_aggregate_register(&cldev->dev, &mei_aggregate_driver, = master_match); if (ret < 0) { dev_err(&cldev->dev, "Master comp add failed %d\n", ret); goto err_exit; @@ -850,7 +854,7 @@ static void mei_hdcp_remove(struct mei_cl_device *cldev) mei_cldev_get_drvdata(cldev); int ret; =20 - component_master_del(&cldev->dev, &mei_component_master_ops); + component_aggregate_unregister(&cldev->dev, &mei_aggregate_driver); kfree(comp_master); mei_cldev_set_drvdata(cldev, NULL); =20 diff --git a/drivers/misc/mei/pxp/mei_pxp.c b/drivers/misc/mei/pxp/mei_pxp.c index f7380d387bab..887e43e6ba5f 100644 --- a/drivers/misc/mei/pxp/mei_pxp.c +++ b/drivers/misc/mei/pxp/mei_pxp.c @@ -83,8 +83,9 @@ static const struct i915_pxp_component_ops mei_pxp_ops = =3D { .recv =3D mei_pxp_receive_message, }; =20 -static int mei_component_master_bind(struct device *dev) +static int mei_pxp_aggregate_bind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct mei_cl_device *cldev =3D to_mei_cl_device(dev); struct i915_pxp_component *comp_master =3D mei_cldev_get_drvdata(cldev); int ret; @@ -98,17 +99,22 @@ static int mei_component_master_bind(struct device *dev) return 0; } =20 -static void mei_component_master_unbind(struct device *dev) +static void mei_pxp_aggregate_unbind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct mei_cl_device *cldev =3D to_mei_cl_device(dev); struct i915_pxp_component *comp_master =3D mei_cldev_get_drvdata(cldev); =20 component_unbind_all(dev, comp_master); } =20 -static const struct component_master_ops mei_component_master_ops =3D { - .bind =3D mei_component_master_bind, - .unbind =3D mei_component_master_unbind, +static struct aggregate_driver mei_aggregate_driver =3D { + .probe =3D mei_pxp_aggregate_bind, + .remove =3D mei_pxp_aggregate_unbind, + .driver =3D { + .name =3D "mei_pxp_agg", + .owner =3D THIS_MODULE, + } }; =20 /** @@ -173,9 +179,7 @@ static int mei_pxp_probe(struct mei_cl_device *cldev, } =20 mei_cldev_set_drvdata(cldev, comp_master); - ret =3D component_master_add_with_match(&cldev->dev, - &mei_component_master_ops, - master_match); + ret =3D component_aggregate_register(&cldev->dev, &mei_aggregate_driver, = master_match); if (ret < 0) { dev_err(&cldev->dev, "Master comp add failed %d\n", ret); goto err_exit; @@ -196,7 +200,7 @@ static void mei_pxp_remove(struct mei_cl_device *cldev) struct i915_pxp_component *comp_master =3D mei_cldev_get_drvdata(cldev); int ret; =20 - component_master_del(&cldev->dev, &mei_component_master_ops); + component_aggregate_unregister(&cldev->dev, &mei_aggregate_driver); kfree(comp_master); mei_cldev_set_drvdata(cldev, NULL); =20 --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 4BE76C4167B for ; Thu, 27 Jan 2022 20:03:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343752AbiA0UDk (ORCPT ); Thu, 27 Jan 2022 15:03:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343850AbiA0UCe (ORCPT ); Thu, 27 Jan 2022 15:02:34 -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 468AAC061748 for ; Thu, 27 Jan 2022 12:02:31 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id s61-20020a17090a69c300b001b4d0427ea2so8657041pjj.4 for ; Thu, 27 Jan 2022 12:02:31 -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=riumb/7yMkcFbw4RrpVGufoj0gjKUJSuK0Qg2XknZ7c=; b=NpYO5ID7f28ORexqnHkzZ0M54adxGnU0hRqq3qMqQyrYGblQq3T7AbkbyeSwkleWwX 1tdKASzL3lfB1QiEImyl7I5sFgEJAzg5lhJ31c07BZMxspqw1wEXyCWCACCBDKj4GvBM Mku2sKRUm6mYUtIPaoIcno6DGaPIftBeAqDeo= 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=riumb/7yMkcFbw4RrpVGufoj0gjKUJSuK0Qg2XknZ7c=; b=5bqk6jfiZoS5mqJQg5cBnEcrES66aQhpuPj0tfpBAj2CJLwpo8F0JRmIImM379/78M 5/NvwodzhJ0PkdKVq+SMAKPUG452jOf+WEH4Kut+c616A+vTMMqc9jG/TNm/wDxhBK8Q DKejdTpicMg/IFhfIzjvO1KmG98KkQCEKuhYB5NcFMk2o6ivxzzglZjR5+KOJdBJxRgc 4Nxn4tSb0SZdPg4sTwFSvmQe6k7LhBzx4QW9iTV9Q5hF0MTkNkeG9kt3gCQyg1UiHJhY L8agVpfqC2KnS4jmGmrNYSFn13af03sRvTl/8MWue6bRBythrCyE7Z3R25ViVUWHOclQ HCeg== X-Gm-Message-State: AOAM531z9i1rRr17VqkvHBEdpAqGl82kKXp0qHbkuu+hEdtCzJ9q7fQC bJVM/SUyn+Q+944BdMS7PUjslw== X-Google-Smtp-Source: ABdhPJwWoTTDM63H2gCdds/RxYfOFR7pmlktYW6DhFTALTQitolMZJK4DIvXjvtcObjDsy8ZXAWysA== X-Received: by 2002:a17:902:7ec1:: with SMTP id p1mr4549151plb.159.1643313750817; Thu, 27 Jan 2022 12:02:30 -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.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:30 -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, Sebastian Reichel , Linus Walleij , linux-pm@vger.kernel.org, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 27/35] power: supply: ab8500: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:33 -0800 Message-Id: <20220127200141.1295328-28-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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. Acked-by: Sebastian Reichel Tested-by: Linus Walleij Cc: Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- drivers/power/supply/ab8500_charger.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/power/supply/ab8500_charger.c b/drivers/power/supply/a= b8500_charger.c index ce074c018dcb..e3164e8335ca 100644 --- a/drivers/power/supply/ab8500_charger.c +++ b/drivers/power/supply/ab8500_charger.c @@ -3335,8 +3335,9 @@ static const struct power_supply_desc ab8500_usb_chg_= desc =3D { .get_property =3D ab8500_charger_usb_get_property, }; =20 -static int ab8500_charger_bind(struct device *dev) +static int ab8500_charger_bind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct ab8500_charger *di =3D dev_get_drvdata(dev); int ch_stat; int ret; @@ -3377,8 +3378,9 @@ static int ab8500_charger_bind(struct device *dev) return 0; } =20 -static void ab8500_charger_unbind(struct device *dev) +static void ab8500_charger_unbind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct ab8500_charger *di =3D dev_get_drvdata(dev); int ret; =20 @@ -3403,9 +3405,13 @@ static void ab8500_charger_unbind(struct device *dev) component_unbind_all(dev, di); } =20 -static const struct component_master_ops ab8500_charger_comp_ops =3D { - .bind =3D ab8500_charger_bind, - .unbind =3D ab8500_charger_unbind, +static struct aggregate_driver ab8500_charger_aggregate_driver =3D { + .probe =3D ab8500_charger_bind, + .remove =3D ab8500_charger_unbind, + .driver =3D { + .name =3D "ab8500_charger_agg", + .owner =3D THIS_MODULE, + }, }; =20 static struct platform_driver *const ab8500_charger_component_drivers[] = =3D { @@ -3694,9 +3700,7 @@ static int ab8500_charger_probe(struct platform_devic= e *pdev) } =20 =20 - ret =3D component_master_add_with_match(&pdev->dev, - &ab8500_charger_comp_ops, - match); + ret =3D component_aggregate_register(&pdev->dev, &ab8500_charger_aggregat= e_driver, match); if (ret) { dev_err(dev, "failed to add component master\n"); goto free_notifier; @@ -3721,7 +3725,7 @@ static int ab8500_charger_remove(struct platform_devi= ce *pdev) { struct ab8500_charger *di =3D platform_get_drvdata(pdev); =20 - component_master_del(&pdev->dev, &ab8500_charger_comp_ops); + component_aggregate_unregister(&pdev->dev, &ab8500_charger_aggregate_driv= er); =20 usb_unregister_notifier(di->usb_phy, &di->nb); ab8500_bm_of_remove(di->usb_chg.psy, di->bm); --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 29EC8C433F5 for ; Thu, 27 Jan 2022 20:03:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343896AbiA0UDv (ORCPT ); Thu, 27 Jan 2022 15:03:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343746AbiA0UCe (ORCPT ); Thu, 27 Jan 2022 15:02:34 -0500 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86503C06177A for ; Thu, 27 Jan 2022 12:02:32 -0800 (PST) Received: by mail-pf1-x431.google.com with SMTP id v74so3809828pfc.1 for ; Thu, 27 Jan 2022 12:02:32 -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=91Z2d0mjHlreqpecJ7pSmgXY2IVlH38FqXsuAjWZmko=; b=azXGQXgKkiXx9Hrb2SvK5M/d+nnYVFTKHAAmgUFanjAJD8SmcK8n3rWARtQsmdzh1w uT0oNhth/wwX7p41tikgOyhpCmwn7PJgfgI7N8EJxphlXwshQpQiPh+AyY1cRqwxa6YN fLmW6iHObG4gITceNhHTVVf1OF7Mysd4CU0IY= 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=91Z2d0mjHlreqpecJ7pSmgXY2IVlH38FqXsuAjWZmko=; b=3QM5RSVusFKoiCKgBBjo7P0DQGyZrcAVYDbDUVcoUtP2PWW8sjXMfPf7x6I3OXDdGc uR13ZVTDEL39RQgBzlY+aTbopN4nxjdNrqddrPK54cWCuzaeCZlpg0Ebnk1ZwaiMXFVJ 6fCK6LYbM1com2U01YioK25FxjCCUY2oRAztQEihKahJl9tSFZgQg/tpfRB1I+v+XPox 6LMpL2owfXqGeKOL1sxIjJo/m0/gjQp69YveRgkO1C5HYJxagjs8klbeGFhbAxYc8ETW buBMNRYnX60zDQEsju08nY8zIoUBgkNBPTVsRhqNPaFExyHYVABs59udq859xv1FG/J3 iNpQ== X-Gm-Message-State: AOAM531FLNhH82q71LPl5Pyg0Qp1u+sRdAZo9q+JV63W+7UJD4mOGIoZ s0ePXpg6MTXifbY0R7DAsHRSTg== X-Google-Smtp-Source: ABdhPJxqGqvR7cwrQBut5IHmzB0xhFmu1buz49cWUzx4Hg9ZdT83OqiQnqJ+DRrh0+GRK3FZyg7Hzw== X-Received: by 2002:a65:6041:: with SMTP id a1mr3876357pgp.231.1643313752060; Thu, 27 Jan 2022 12:02:32 -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.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:31 -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, linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 28/35] fbdev: omap2: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:34 -0800 Message-Id: <20220127200141.1295328-29-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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: Cc: Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- drivers/video/fbdev/omap2/omapfb/dss/dss.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dss.c b/drivers/video/fbd= ev/omap2/omapfb/dss/dss.c index a6b1c1598040..0bdb9f909992 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/dss.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/dss.c @@ -1067,8 +1067,9 @@ static int dss_video_pll_probe(struct platform_device= *pdev) } =20 /* DSS HW IP initialisation */ -static int dss_bind(struct device *dev) +static int dss_bind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct platform_device *pdev =3D to_platform_device(dev); struct resource *dss_mem; u32 rev; @@ -1167,8 +1168,9 @@ static int dss_bind(struct device *dev) return r; } =20 -static void dss_unbind(struct device *dev) +static void dss_unbind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct platform_device *pdev =3D to_platform_device(dev); =20 dss_initialized =3D false; @@ -1188,9 +1190,13 @@ static void dss_unbind(struct device *dev) dss_put_clocks(); } =20 -static const struct component_master_ops dss_component_ops =3D { - .bind =3D dss_bind, - .unbind =3D dss_unbind, +static struct aggregate_driver dss_aggregate_driver =3D { + .probe =3D dss_bind, + .remove =3D dss_unbind, + .driver =3D { + .name =3D "dss_fbdev", + .owner =3D THIS_MODULE, + }, }; =20 static int dss_component_compare(struct device *dev, void *data) @@ -1225,7 +1231,7 @@ static int dss_probe(struct platform_device *pdev) /* add all the child devices as components */ device_for_each_child(&pdev->dev, &match, dss_add_child_component); =20 - r =3D component_master_add_with_match(&pdev->dev, &dss_component_ops, mat= ch); + r =3D component_aggregate_register(&pdev->dev, &dss_aggregate_driver, mat= ch); if (r) return r; =20 @@ -1234,7 +1240,7 @@ static int dss_probe(struct platform_device *pdev) =20 static int dss_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &dss_component_ops); + component_aggregate_unregister(&pdev->dev, &dss_aggregate_driver); return 0; } =20 --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 13649C4332F for ; Thu, 27 Jan 2022 20:03:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240594AbiA0UDF (ORCPT ); Thu, 27 Jan 2022 15:03:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343856AbiA0UCf (ORCPT ); Thu, 27 Jan 2022 15:02:35 -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 D7B10C06174A for ; Thu, 27 Jan 2022 12:02:33 -0800 (PST) Received: by mail-pg1-x530.google.com with SMTP id 133so3283484pgb.0 for ; Thu, 27 Jan 2022 12:02:33 -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=ka5n0VIFlCANZbv+1O6BEaBIrpT2TSivDZEr/FN1kY8=; b=MXoXAgK1oy6andcq7Ev9jdik2AL8qv5c3I8xi0/e6YDPc830v2J7hy32iT3ICQBJ8J xy09VzT9Yn29S+RdgW2+6hsABDgU6UyFNOGBLRCszHxFQFq6dKmKLilaT6sUw4r9sdt7 c29EGPbcTtzKRF4KZrDHS+Z347DLhk07qht9s= 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=ka5n0VIFlCANZbv+1O6BEaBIrpT2TSivDZEr/FN1kY8=; b=SIS4uSpx0QmIC9JPvV0HpJ0qdEP7f0mcmMW1e6uNvTKQKcx1QgifP+3hKHfXmt9kaX NxDrat7RoJ4KRIB0iGLyQNAS1qjkJWCjSLjxLoIzjyn+iOKfy/jrU0+ZHkqs2Xqa8BSY SuEhBNRNy9TWKhMYQN+3EhDURZWyk/JgwYUSfQvXRalzkWVkR6EKLvYAIjtJOClu4XOe Ey06IbugX2paKQX2dRqR+RSEB0lJEUQXkNZTOtvurI3hK6Op4GL0QJihMfjZBVtAXcmx ekCYNcOcKth9nyQ0buvu2Uw10OJqsv71m3GPonvExFrVdfebvWNWTsFj8RiFNCEBqZND b85Q== X-Gm-Message-State: AOAM533vxivyzFdiScTCOsGCZQNY3fi9j747G80SJWCfOaclEpXCDSAw Xcy+azZRtSE2fUf0gyAHjBNRUQ== X-Google-Smtp-Source: ABdhPJzXSmoe1y40KU/53VBe7HVzxX6p0Ykdxtz/+cL6TFf9tO0wg6o7nu36+L3nnJbpQJ7nrONYcg== X-Received: by 2002:a63:2d86:: with SMTP id t128mr3994596pgt.200.1643313753420; Thu, 27 Jan 2022 12:02:33 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:33 -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, Jaroslav Kysela , Takashi Iwai , Kai Vehmanen , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 29/35] sound: hdac: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:35 -0800 Message-Id: <20220127200141.1295328-30-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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: Jaroslav Kysela Cc: Takashi Iwai Cc: Kai Vehmanen Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- sound/hda/hdac_component.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/sound/hda/hdac_component.c b/sound/hda/hdac_component.c index bb37e7e0bd79..4ec5d9bf8533 100644 --- a/sound/hda/hdac_component.c +++ b/sound/hda/hdac_component.c @@ -181,8 +181,9 @@ int snd_hdac_acomp_get_eld(struct hdac_device *codec, h= da_nid_t nid, int dev_id, } EXPORT_SYMBOL_GPL(snd_hdac_acomp_get_eld); =20 -static int hdac_component_master_bind(struct device *dev) +static int hdac_component_master_bind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct drm_audio_component *acomp =3D hdac_get_acomp(dev); int ret; =20 @@ -222,8 +223,9 @@ static int hdac_component_master_bind(struct device *de= v) return ret; } =20 -static void hdac_component_master_unbind(struct device *dev) +static void hdac_component_master_unbind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct drm_audio_component *acomp =3D hdac_get_acomp(dev); =20 if (acomp->audio_ops && acomp->audio_ops->master_unbind) @@ -233,9 +235,13 @@ static void hdac_component_master_unbind(struct device= *dev) WARN_ON(acomp->ops || acomp->dev); } =20 -static const struct component_master_ops hdac_component_master_ops =3D { - .bind =3D hdac_component_master_bind, - .unbind =3D hdac_component_master_unbind, +static struct aggregate_driver hdac_aggregate_driver =3D { + .probe =3D hdac_component_master_bind, + .remove =3D hdac_component_master_unbind, + .driver =3D { + .name =3D "hdac_agg", + .owner =3D THIS_MODULE, + }, }; =20 /** @@ -303,8 +309,7 @@ int snd_hdac_acomp_init(struct hdac_bus *bus, devres_add(dev, acomp); =20 component_match_add_typed(dev, &match, match_master, bus); - ret =3D component_master_add_with_match(dev, &hdac_component_master_ops, - match); + ret =3D component_aggregate_register(dev, &hdac_aggregate_driver, match); if (ret < 0) goto out_err; =20 @@ -344,7 +349,7 @@ int snd_hdac_acomp_exit(struct hdac_bus *bus) bus->display_power_active =3D 0; bus->display_power_status =3D 0; =20 - component_master_del(dev, &hdac_component_master_ops); + component_aggregate_unregister(dev, &hdac_aggregate_driver); =20 bus->audio_component =3D NULL; devres_destroy(dev, hdac_acomp_release, NULL, NULL); --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 24DB4C433F5 for ; Thu, 27 Jan 2022 20:03:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240672AbiA0UDq (ORCPT ); Thu, 27 Jan 2022 15:03:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343759AbiA0UCf (ORCPT ); Thu, 27 Jan 2022 15:02:35 -0500 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27630C061757 for ; Thu, 27 Jan 2022 12:02:35 -0800 (PST) Received: by mail-pf1-x431.google.com with SMTP id 192so3798099pfz.3 for ; Thu, 27 Jan 2022 12:02:35 -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=uoYkWU8ZYG31h//2O3CYJPowjGxvjjH2b6ZF0p9sQps=; b=Npdvqs3dgVEFL7SvLzWbajP/ltLnMywE5OL4sdVwIATKFbTuobWdTSdnjQGKqw+P3Q z4BL7Whjg+87X0sbFCE+X5hflua22Oq7YC76P11dk4ptrikhRbSZ2i7ugYtYodwBP3vb cjJ0P0mq6X5+92CpBNqeR6xJuk6b6giXEsfqQ= 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=uoYkWU8ZYG31h//2O3CYJPowjGxvjjH2b6ZF0p9sQps=; b=jl5I8/R0HtQ5WYVdzDy20v+RWGOaoqhTP8RVKNB4/BYvlVMjM3IaaAhBNsBwasQow2 ITCJdGM/CtKTp/0zs9914gVmVySodmoTEosuWWjwKMKiui21poVF936Rs+FAA44LXkeY 1xVtKLQji7Ln24RiqMumq77RcUoanQWQtVTjEGSFHL68qEqSxtLJOB03hFLkJpMju+lz 2wjS1L4KDs5PWUTAj/+PHqJBzgRisiB9i28Y/16DYV9sRMDZxnBxdL1/MU7QZLHVb0zR 1zOox/uX0AdzDQ3aulDEdhGaGgp6UelohxdGqmN2WbSsDZM3qYhKKHtuIS80zccaCYX9 olfg== X-Gm-Message-State: AOAM5322A/czXN0T/zkMJev8m4kY5i6PyX19cllRjsh2zAsD1KnrQcH+ tONuZ3Cy+K8fmVmnbigkmEUqWQ== X-Google-Smtp-Source: ABdhPJx6qf0FRtjUDt7e569xeRU9IhaGc6sCbZg7DZ1PWIGIEEYIMaZDXyPgkgC77gUh4nAd8RysXw== X-Received: by 2002:a63:4b0b:: with SMTP id y11mr3862310pga.342.1643313754673; Thu, 27 Jan 2022 12:02:34 -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.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:34 -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, Mark Brown , Jaroslav Kysela , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 30/35] ASoC: codecs: wcd938x: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:36 -0800 Message-Id: <20220127200141.1295328-31-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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. Acked-by: Mark Brown Cc: Jaroslav Kysela Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- sound/soc/codecs/wcd938x.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c index eff200a07d9f..6e1c9f93c819 100644 --- a/sound/soc/codecs/wcd938x.c +++ b/sound/soc/codecs/wcd938x.c @@ -4317,8 +4317,9 @@ static struct snd_soc_dai_driver wcd938x_dais[] =3D { }, }; =20 -static int wcd938x_bind(struct device *dev) +static int wcd938x_bind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct wcd938x_priv *wcd938x =3D dev_get_drvdata(dev); int ret; =20 @@ -4401,8 +4402,9 @@ static int wcd938x_bind(struct device *dev) =20 } =20 -static void wcd938x_unbind(struct device *dev) +static void wcd938x_unbind(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct wcd938x_priv *wcd938x =3D dev_get_drvdata(dev); =20 device_link_remove(dev, wcd938x->txdev); @@ -4412,9 +4414,13 @@ static void wcd938x_unbind(struct device *dev) component_unbind_all(dev, wcd938x); } =20 -static const struct component_master_ops wcd938x_comp_ops =3D { - .bind =3D wcd938x_bind, - .unbind =3D wcd938x_unbind, +static struct aggregate_driver wcd938x_aggregate_driver =3D { + .probe =3D wcd938x_bind, + .remove =3D wcd938x_unbind, + .driver =3D { + .name =3D "wcd938x_snd", + .owner =3D THIS_MODULE, + }, }; =20 static int wcd938x_compare_of(struct device *dev, void *data) @@ -4483,7 +4489,7 @@ static int wcd938x_probe(struct platform_device *pdev) =20 wcd938x_reset(wcd938x); =20 - ret =3D component_master_add_with_match(dev, &wcd938x_comp_ops, match); + ret =3D component_aggregate_register(dev, &wcd938x_aggregate_driver, matc= h); if (ret) return ret; =20 @@ -4499,7 +4505,7 @@ static int wcd938x_probe(struct platform_device *pdev) =20 static int wcd938x_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &wcd938x_comp_ops); + component_aggregate_unregister(&pdev->dev, &wcd938x_aggregate_driver); =20 return 0; } --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 206D5C433F5 for ; Thu, 27 Jan 2022 20:04:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343987AbiA0UD7 (ORCPT ); Thu, 27 Jan 2022 15:03:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343810AbiA0UCm (ORCPT ); Thu, 27 Jan 2022 15:02:42 -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 029C4C06175E for ; Thu, 27 Jan 2022 12:02:37 -0800 (PST) Received: by mail-pg1-x52e.google.com with SMTP id z131so3205115pgz.12 for ; Thu, 27 Jan 2022 12:02:36 -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=ZPdM2UZRVqO2e0C8ICFRT9vqGkS5bJAyu59fLH+Uvcs=; b=Gl4OTjqsqgynBhjQVr0J0vK/Y4lnurULqWtCsHyQOkEHqf7pCYHQI81VfLe0ELPBsG 0SYrju/lR6J6HE43y4rKJGyo6/G5xD8lVQyH6+Ijf/swy2beLa8NcG5FgN9KTJwKHXGo bQsVmN6a58G5hTr/ZwYaIyIU2zcLLGHUCcPIM= 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=ZPdM2UZRVqO2e0C8ICFRT9vqGkS5bJAyu59fLH+Uvcs=; b=XZEsIwDCrs3Fw/IQJ1g+stKc1jmwzhoKwdJuLkcBN/gbGRwrUyP2Br343342emj27u yjSYWpTok4/K68s3M5Lai9L5Aq/h+oZoRwIN6ySOiTpgIlYyjNxfXHFxdKSDjDuTZImy qk6uEolEET1gCOHf3QqfKppVdWgxexl/P120NST5O3PNNDEruGhvL67k163LuYd2WsaD TVg8ZSELHR/dyPvb3A9odlNy3CG/SFSUTHqVdOJNDuo+QJoJAkag6Mwxwk/HM6aTwXYE pujT4BEaVXpetziNE00kagEbJtY/BdFe5bIiLycv7uQJb8bJdLqUvgS2md95Wb9Y2wQ2 xqiQ== X-Gm-Message-State: AOAM531uzp0mxVZBIR6re+2KQV8kUMR4uFcJJyro9Og46GSnDQQJKVDK kZRKSQo4H6A1CEEqNfoKVabFHQ== X-Google-Smtp-Source: ABdhPJwB8j2u/cujHRi6C9hFkNiVFW4PLGhDjL/+Uzw5oKliGwBjASBtEEumzc2+wCCT+0M/ofqccg== X-Received: by 2002:a05:6a00:14d1:: with SMTP id w17mr4787164pfu.46.1643313756502; Thu, 27 Jan 2022 12:02:36 -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.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:36 -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, Orson Zhai , Baolin Wang , Chunyan Zhang , Maarten Lankhorst , Kevin Tang , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 31/35] drm/sprd: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:37 -0800 Message-Id: <20220127200141.1295328-32-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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: Orson Zhai Cc: Baolin Wang Cc: Chunyan Zhang Cc: Maarten Lankhorst Cc: Kevin Tang Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- drivers/gpu/drm/sprd/sprd_drm.c | 48 +++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/sprd/sprd_drm.c b/drivers/gpu/drm/sprd/sprd_dr= m.c index a077e2d4d721..ff39b32b20c0 100644 --- a/drivers/gpu/drm/sprd/sprd_drm.c +++ b/drivers/gpu/drm/sprd/sprd_drm.c @@ -65,8 +65,9 @@ static struct drm_driver sprd_drm_drv =3D { .minor =3D DRIVER_MINOR, }; =20 -static int sprd_drm_bind(struct device *dev) +static int sprd_drm_aggregate_probe(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct platform_device *pdev =3D to_platform_device(dev); struct drm_device *drm; struct sprd_drm *sprd; @@ -118,8 +119,9 @@ static int sprd_drm_bind(struct device *dev) return ret; } =20 -static void sprd_drm_unbind(struct device *dev) +static void sprd_drm_aggregate_remove(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct drm_device *drm =3D dev_get_drvdata(dev); =20 drm_dev_unregister(drm); @@ -129,9 +131,28 @@ static void sprd_drm_unbind(struct device *dev) component_unbind_all(drm->dev, drm); } =20 -static const struct component_master_ops drm_component_ops =3D { - .bind =3D sprd_drm_bind, - .unbind =3D sprd_drm_unbind, +static void sprd_drm_aggregate_shutdown(struct aggregate_device *adev) +{ + struct device *dev =3D aggregate_device_parent(adev); + struct platform_device *pdev =3D to_platform_device(dev); + struct drm_device *drm =3D platform_get_drvdata(pdev); + + if (!drm) { + drm_warn(drm, "drm device is not available, no shutdown\n"); + return; + } + + drm_atomic_helper_shutdown(drm); +} + +static struct aggregate_driver sprd_drm_aggregate_driver =3D { + .probe =3D sprd_drm_aggregate_probe, + .remove =3D sprd_drm_aggregate_remove, + .shutdown =3D sprd_drm_aggregate_shutdown, + .driver =3D { + .name =3D "sprd_drm", + .owner =3D THIS_MODULE, + }, }; =20 static int compare_of(struct device *dev, void *data) @@ -141,27 +162,15 @@ static int compare_of(struct device *dev, void *data) =20 static int sprd_drm_probe(struct platform_device *pdev) { - return drm_of_component_probe(&pdev->dev, compare_of, &drm_component_ops); + return drm_of_aggregate_probe(&pdev->dev, compare_of, &sprd_drm_aggregate= _driver); } =20 static int sprd_drm_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &drm_component_ops); + component_aggregate_unregister(&pdev->dev, &sprd_drm_aggregate_driver); return 0; } =20 -static void sprd_drm_shutdown(struct platform_device *pdev) -{ - struct drm_device *drm =3D platform_get_drvdata(pdev); - - if (!drm) { - drm_warn(drm, "drm device is not available, no shutdown\n"); - return; - } - - drm_atomic_helper_shutdown(drm); -} - static const struct of_device_id drm_match_table[] =3D { { .compatible =3D "sprd,display-subsystem", }, { /* sentinel */ }, @@ -171,7 +180,6 @@ MODULE_DEVICE_TABLE(of, drm_match_table); static struct platform_driver sprd_drm_driver =3D { .probe =3D sprd_drm_probe, .remove =3D sprd_drm_remove, - .shutdown =3D sprd_drm_shutdown, .driver =3D { .name =3D "sprd-drm-drv", .of_match_table =3D drm_match_table, --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 BDD5AC4332F for ; Thu, 27 Jan 2022 20:03:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343793AbiA0UDN (ORCPT ); Thu, 27 Jan 2022 15:03:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343894AbiA0UCm (ORCPT ); Thu, 27 Jan 2022 15:02:42 -0500 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A1DFC06177D for ; Thu, 27 Jan 2022 12:02:38 -0800 (PST) Received: by mail-pg1-x52f.google.com with SMTP id g2so3219055pgo.9 for ; Thu, 27 Jan 2022 12:02:38 -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=ckuMr+Ncb/jcw9TvP8N13lANp/qUitpt+atxz271bCg=; b=VCDCJ2XXoEo5R2boVBxoQIPLBYXRZ4ygF5m58BNpDlZWi0b2RKflooEmM0NvSKn47v M8K2o4X4DejnrnAjIJ9q3+1sECxzMIDHOFpFmOMgT91R+rXZdeyhn45ubWI9MY4y+lGt LQpRvpFof698nsHlX6PxiqwGND/FxZPe/vWmk= 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=ckuMr+Ncb/jcw9TvP8N13lANp/qUitpt+atxz271bCg=; b=RP8Ntov9hl6odgiIATU5ATORlm+TgnlQxlaEFXrZYoFbOtfiJPAVxdO+CSTuKKykCh 8Q635EEKiOl7p7lRATnIEV90ezNww/vjR0fG1G8CWW5SKHuAHhPMx6ikrLY1OTGov6n7 V5Vz279H+bPe2nQ4XECAq4Jtw30ClfhNyyGkEPri2Plq+CPvP/TJHcpLUzKPGBXfyEmZ BPgpxK63yu/NeGXceZO47vELEp9uk68OBBM1yZwi8oe9V2PaY0yckvC349zasiqRLOh/ MncKn71XSU/chzvXtvgWuM3DkabbqIt5nM/pci1ms6mk2qztZp3ks6X4TxRUN14lRVEl Hqrw== X-Gm-Message-State: AOAM530D0g8atGX2LJNGGAPFvQ4n9/a7YbgWVCII6f76YqGZ07gNhPDC o8/6JAzmlkq8dfOjKBpFDP2rEQ== X-Google-Smtp-Source: ABdhPJzi7TeBcTmXGNEgo6gqdKnb0pcCN6RMeqZ8Q6M/Rim3Xa3q76WIvhpg51Dhu0lKrNyj5S5Unw== X-Received: by 2002:a62:e116:: with SMTP id q22mr4473788pfh.48.1643313757782; Thu, 27 Jan 2022 12:02:37 -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.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:37 -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, Heikki Krogerus , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 32/35] usb: typec: port-mapper: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:38 -0800 Message-Id: <20220127200141.1295328-33-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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: Heikki Krogerus Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- drivers/usb/typec/port-mapper.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/usb/typec/port-mapper.c b/drivers/usb/typec/port-mappe= r.c index 07d307418b47..33fbebc6a85b 100644 --- a/drivers/usb/typec/port-mapper.c +++ b/drivers/usb/typec/port-mapper.c @@ -11,19 +11,27 @@ =20 #include "class.h" =20 -static int typec_aggregate_bind(struct device *dev) +static int typec_aggregate_probe(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); + return component_bind_all(dev, NULL); } =20 -static void typec_aggregate_unbind(struct device *dev) +static void typec_aggregate_remove(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); + component_unbind_all(dev, NULL); } =20 -static const struct component_master_ops typec_aggregate_ops =3D { - .bind =3D typec_aggregate_bind, - .unbind =3D typec_aggregate_unbind, +static struct aggregate_driver typec_aggregate_driver =3D { + .probe =3D typec_aggregate_probe, + .remove =3D typec_aggregate_remove, + .driver =3D { + .name =3D "typec_aggregate", + .owner =3D THIS_MODULE, + }, }; =20 struct each_port_arg { @@ -69,10 +77,10 @@ int typec_link_ports(struct typec_port *con) * improvements to the component framework. Right now you can only have * one master per device. */ - return component_master_add_with_match(&con->dev, &typec_aggregate_ops, a= rg.match); + return component_aggregate_register(&con->dev, &typec_aggregate_driver, a= rg.match); } =20 void typec_unlink_ports(struct typec_port *con) { - component_master_del(&con->dev, &typec_aggregate_ops); + component_aggregate_unregister(&con->dev, &typec_aggregate_driver); } --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 6961AC433EF for ; Thu, 27 Jan 2022 20:04:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344024AbiA0UEB (ORCPT ); Thu, 27 Jan 2022 15:04:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343899AbiA0UCm (ORCPT ); Thu, 27 Jan 2022 15:02:42 -0500 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9D47C0613DE for ; Thu, 27 Jan 2022 12:02:39 -0800 (PST) Received: by mail-pf1-x42f.google.com with SMTP id 192so3798405pfz.3 for ; Thu, 27 Jan 2022 12:02:39 -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=pg7u1QgES9vvilydf87u7mbX9H+V1JXmTaOjVr3A4N4=; b=SNb6+UtCldRo3C3aKKuH53pJUKPR1QoOvhja2fFrdIZAqK2pC8avjHvs2QWwdAqY2L iDTt5Ev8TK1FUPlXG0GLJg90OtWzYd58L9jGhUvwTScxXTgeVD59clQ/6ruqJGZsIDtb VzKFMzhSCdtxWvtOoLilyZS6Je3BqrKogxJuI= 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=pg7u1QgES9vvilydf87u7mbX9H+V1JXmTaOjVr3A4N4=; b=ijLvCe+eVe+2KU/NIA3i4mBC9WOhwJfrvAu3m0rBHXwhBXWQjMx1YOfilYK2X1Y2/f DVKwp9CNRugi/rpF2RThjCFJ3F0h9VsewNphLnmYkwME5LpdMXJ5ETSoPEMGJ4km+RCM zgcLQ0movumb/mYBHpwjwrMMxPFo7qj7DkfovG9eSolgzKeEUHmMdO3BxUF8ypIQCbVg /cCw2VhaVKNeMu0KsT044bvyyXh+5XFmSywZwJOB302mXkUrIvyV30xW3BncsZrBkHec W5sy78e/aF5IXgbc40DUZHFY9TqOfINb2bIcnN0bLzAAPX06ijx2/ncdCXPVNvwfCJAZ 2peA== X-Gm-Message-State: AOAM531em430r0lqZYZN68x9UHU84D7DVzho3uLcU3b2P8tzkHTJxVmy ozphcjR0cUC02SwsLko6zXIFOhGLjaSF3Q== X-Google-Smtp-Source: ABdhPJyWS6wiSowTLsVHpFT26f9C2DJENr9ONfoQ93NBCznOznrI8TRNbMCesKj30yy09FTDuZLACA== X-Received: by 2002:a63:dd0f:: with SMTP id t15mr3912064pgg.12.1643313759139; Thu, 27 Jan 2022 12:02:39 -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.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:38 -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, Stefan Binding , Lucas Tanure , Takashi Iwai , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 33/35] ALSA: hda/realtek: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:39 -0800 Message-Id: <20220127200141.1295328-34-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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: Stefan Binding Cc: Lucas Tanure Cc: Takashi Iwai Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- sound/pci/hda/patch_realtek.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 668274e52674..80a2164c99b6 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -6547,25 +6547,31 @@ static int find_comp_by_dev_name(struct alc_spec *s= pec, const char *name) return -ENODEV; } =20 -static int comp_bind(struct device *dev) +static int realtek_aggregate_probe(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct hda_codec *cdc =3D dev_to_hda_codec(dev); struct alc_spec *spec =3D cdc->spec; =20 return component_bind_all(dev, spec->comps); } =20 -static void comp_unbind(struct device *dev) +static void realtek_aggregate_remove(struct aggregate_device *adev) { + struct device *dev =3D aggregate_device_parent(adev); struct hda_codec *cdc =3D dev_to_hda_codec(dev); struct alc_spec *spec =3D cdc->spec; =20 component_unbind_all(dev, spec->comps); } =20 -static const struct component_master_ops comp_master_ops =3D { - .bind =3D comp_bind, - .unbind =3D comp_unbind, +static struct aggregate_driver realtek_aggregate_driver =3D { + .probe =3D realtek_aggregate_probe, + .remove =3D realtek_aggregate_remove, + .driver =3D { + .name =3D "realtek_aggregate", + .owner =3D THIS_MODULE, + }, }; =20 static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struc= t hda_codec *cdc, @@ -6597,7 +6603,7 @@ static void cs35l41_generic_fixup(struct hda_codec *c= dc, int action, const char return; component_match_add(dev, &spec->match, comp_match_dev_name, name); } - ret =3D component_master_add_with_match(dev, &comp_master_ops, spec->mat= ch); + ret =3D component_aggregate_register(dev, &realtek_aggregate_driver, spe= c->match); if (ret) codec_err(cdc, "Fail to register component aggregator %d\n", ret); else @@ -6648,7 +6654,7 @@ static void alc287_fixup_legion_16achg6_speakers(stru= ct hda_codec *cdc, const st "i2c-CLSA0100:00-cs35l41-hda.0"); component_match_add(dev, &spec->match, comp_match_dev_name, "i2c-CLSA0100:00-cs35l41-hda.1"); - ret =3D component_master_add_with_match(dev, &comp_master_ops, spec->mat= ch); + ret =3D component_aggregate_register(dev, &realtek_aggregate_driver, spe= c->match); if (ret) codec_err(cdc, "Fail to register component aggregator %d\n", ret); else --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 95634C433EF for ; Thu, 27 Jan 2022 20:03:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344004AbiA0UDP (ORCPT ); Thu, 27 Jan 2022 15:03:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343909AbiA0UCm (ORCPT ); Thu, 27 Jan 2022 15:02:42 -0500 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01E6CC0613EB for ; Thu, 27 Jan 2022 12:02:41 -0800 (PST) Received: by mail-pf1-x435.google.com with SMTP id i186so1323397pfe.0 for ; Thu, 27 Jan 2022 12:02:40 -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=NWPDgDUwRl+84SzwunIQASVSIexCRProBcGwEVA3ZyQ=; b=oCNz3/TyoOC1Z4L+TGEGzc242VDcV1zOa2+4KpqoSchL9yglQa3dROPnlnWmSgibm6 6FdcJLI6inymZ9YaC5K+b7GNCEgYSqJfiA0drHN9+5GRKTc6wlUr9xF8D4rI3iPKD07E +51WbfkKJVTDAand07akDTPtzYj2zVO+3ThYk= 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=NWPDgDUwRl+84SzwunIQASVSIexCRProBcGwEVA3ZyQ=; b=nNcaF2LeM9vJspsvdZTQUhzXXLa5N/V2Ps6wRFdZeh0Fcm7L/ZY5eKn3c5UMr26/u3 Kbc4sT5DBJLjNmw9ClQ4Bh2KyRYLXxS/8YDg8WwCyslyBGtt+BbMMFxxy5ImhNMepxBm msIaBu81aalnZvh/r0bPGmEGvbTimUTTxOOWchICzNFsn0hb3dNw9iuevZSoUhMs9BJC DoYZ+43onGB3QcBVmoVDXZmr5Ni0qlq8rmbiVpybzPDgSvBHxBHtzKCdanklX9vRELw3 jg6NpYRFt/+v3ZV9sRnHYMMCNlhJe6A9LOgGWrQZnY+1lf6XZ7Dkx4CkUwP1clCvsQ3N l1wQ== X-Gm-Message-State: AOAM533VKK19rUxM8+7VpUJguIMUkojfWANI2cte7Qxj2YBZAVWAUPgA KEgvnlJleh/8/yUtGI+IalS8Yg== X-Google-Smtp-Source: ABdhPJyZ+yxlFIH/w2575esD0A9Z3uwPXwkVYGsPiBy9KXIh12HY0oxwuUFjhhYoIin6PRGU1PyxnQ== X-Received: by 2002:a62:e704:: with SMTP id s4mr4171414pfh.25.1643313760477; Thu, 27 Jan 2022 12:02:40 -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.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:40 -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, Laurent Pinchart , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 34/35] component: Get rid of drm_of_component_probe() Date: Thu, 27 Jan 2022 12:01:40 -0800 Message-Id: <20220127200141.1295328-35-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" There aren't any users anymore so drop it. Cc: Laurent Pinchart Cc: Daniel Vetter Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- drivers/gpu/drm/drm_of.c | 85 +++++++++------------------------------- include/drm/drm_of.h | 12 ------ 2 files changed, 19 insertions(+), 78 deletions(-) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 0fe822319aae..84e285432d13 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -99,18 +99,30 @@ void drm_of_component_match_add(struct device *master, } EXPORT_SYMBOL_GPL(drm_of_component_match_add); =20 -static int _drm_of_component_probe(struct device *dev, +/** + * drm_of_aggregate_probe - Generic probe function for a component based a= ggregate host + * @dev: device containing the OF node + * @compare_of: compare function used for matching components + * @adrv: aggregate driver to be used + * + * Parse the platform device OF node and bind all the components associated + * with the aggregate device. Interface ports are added before the encoder= s in + * order to satisfy their .bind_component requirements + * See Documentation/devicetree/bindings/graph.txt for the bindings. + * + * Returns zero if successful, or one of the standard error codes if it fa= ils. + */ +int drm_of_aggregate_probe(struct device *dev, int (*compare_of)(struct device *, void *), - struct component_match **matchptr) + struct aggregate_driver *adrv) { struct device_node *ep, *port, *remote; + struct component_match *match =3D NULL; int i; =20 if (!dev->of_node) return -EINVAL; =20 - *matchptr =3D NULL; - /* * Bind the crtc's ports first, so that drm_of_find_possible_crtcs() * called from encoder's .bind callbacks works as expected @@ -121,7 +133,7 @@ static int _drm_of_component_probe(struct device *dev, break; =20 if (of_device_is_available(port->parent)) - drm_of_component_match_add(dev, matchptr, compare_of, + drm_of_component_match_add(dev, &match, compare_of, port); =20 of_node_put(port); @@ -132,7 +144,7 @@ static int _drm_of_component_probe(struct device *dev, return -ENODEV; } =20 - if (!*matchptr) { + if (!match) { dev_err(dev, "no available port\n"); return -ENODEV; } @@ -162,72 +174,13 @@ static int _drm_of_component_probe(struct device *dev, continue; } =20 - drm_of_component_match_add(dev, matchptr, compare_of, + drm_of_component_match_add(dev, &match, compare_of, remote); of_node_put(remote); } of_node_put(port); } =20 - return 0; -} - -/** - * drm_of_component_probe - Generic probe function for a component based m= aster - * @dev: master device containing the OF node - * @compare_of: compare function used for matching components - * @m_ops: component master ops to be used - * - * Parse the platform device OF node and bind all the components associated - * with the master. Interface ports are added before the encoders in order= to - * satisfy their .bind requirements - * See Documentation/devicetree/bindings/graph.txt for the bindings. - * - * Deprecated: Use drm_of_aggregate_probe() instead. - * - * Returns zero if successful, or one of the standard error codes if it fa= ils. - */ -int drm_of_component_probe(struct device *dev, - int (*compare_of)(struct device *, void *), - const struct component_master_ops *m_ops) -{ - - struct component_match *match; - int ret; - - ret =3D _drm_of_component_probe(dev, compare_of, &match); - if (ret) - return ret; - - return component_master_add_with_match(dev, m_ops, match); -} -EXPORT_SYMBOL(drm_of_component_probe); - - -/** - * drm_of_aggregate_probe - Generic probe function for a component based a= ggregate host - * @dev: device containing the OF node - * @compare_of: compare function used for matching components - * @adrv: aggregate driver to be used - * - * Parse the platform device OF node and bind all the components associated - * with the aggregate device. Interface ports are added before the encoder= s in - * order to satisfy their .bind_component requirements - * See Documentation/devicetree/bindings/graph.txt for the bindings. - * - * Returns zero if successful, or one of the standard error codes if it fa= ils. - */ -int drm_of_aggregate_probe(struct device *dev, - int (*compare_of)(struct device *, void *), - struct aggregate_driver *adrv) -{ - struct component_match *match; - int ret; - - ret =3D _drm_of_component_probe(dev, compare_of, &match); - if (ret) - return ret; - return component_aggregate_register(dev, adrv, match); } EXPORT_SYMBOL(drm_of_aggregate_probe); diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h index 7c7b0d8377a7..4709ff2f04eb 100644 --- a/include/drm/drm_of.h +++ b/include/drm/drm_of.h @@ -8,7 +8,6 @@ #endif =20 struct aggregate_driver; -struct component_master_ops; struct component_match; struct device; struct drm_device; @@ -38,9 +37,6 @@ void drm_of_component_match_add(struct device *master, struct component_match **matchptr, int (*compare)(struct device *, void *), struct device_node *node); -int drm_of_component_probe(struct device *dev, - int (*compare_of)(struct device *, void *), - const struct component_master_ops *m_ops); int drm_of_aggregate_probe(struct device *dev, int (*compare_of)(struct device *, void *), struct aggregate_driver *adrv); @@ -75,14 +71,6 @@ drm_of_component_match_add(struct device *master, { } =20 -static inline int -drm_of_component_probe(struct device *dev, - int (*compare_of)(struct device *, void *), - const struct component_master_ops *m_ops) -{ - return -EINVAL; -} - static inline int drm_of_aggregate_probe(struct device *dev, int (*compare_of)(struct device *, void *), --=20 https://chromeos.dev From nobody Tue Jun 30 01:43:45 2026 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 7056FC433FE for ; Thu, 27 Jan 2022 20:03:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343967AbiA0UDL (ORCPT ); Thu, 27 Jan 2022 15:03:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343917AbiA0UCn (ORCPT ); Thu, 27 Jan 2022 15:02:43 -0500 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61005C061753 for ; Thu, 27 Jan 2022 12:02:42 -0800 (PST) Received: by mail-pf1-x42a.google.com with SMTP id i186so1323540pfe.0 for ; Thu, 27 Jan 2022 12:02:42 -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=mLJ9aQQKbi1McTKiTASuJ60v0WUfyMH6zYoZx7mCGow=; b=GS6Seq4+r80IcpAK74Q0pIsNJzAevgaT0sITaMFeTt1iLsIVo95O0DpX+9ePAak60Y Pbj93EvACJdFc8YsdQJ1VJgi2OAS1EjPUiPnsGMiic9C6jZzWo0VoUgGUqv9pTeMlKDv L8y88I4dBISVRWlkC8KOWzx3pVizjdgbpcck8= 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=mLJ9aQQKbi1McTKiTASuJ60v0WUfyMH6zYoZx7mCGow=; b=5of3zeM321p3ecQSikU6R/fBhcuT+y8T/yXOAp0AaAU82KTwsVxjnOehXCtx/NY1XG 4Gr0ZRF61U6DH2+xz47qYL2Acx5GY4onUOHsJA51G25jJUXDvKNE0T0ceG09V356YK+U A9M9b6cSoAwZc69I43/A2Wpr2szfXSA26WdxHKpm2EuzAKj43b1UeefnR/DEGL8CfbtJ EgXvX2/X0vi7YM7LtjNDuUKYWKDx7O67xkYYoSUS+JJASxaTc9+hTE0ZhnnEgjM48Hsr aLCbuN+8Ki9vw9LhUiZCdXxs9yP/4aYgQdBN9NUiaH45IR0ebe+w/AJ+AsXaI5HS1bED uGBw== X-Gm-Message-State: AOAM530l5E5F747O/mudrgpKAJLhiylMrMAivdMe1HPa23Kr1cQDWPpq Hc9kpYGCxVzU5xLEAUUBptUdVQ== X-Google-Smtp-Source: ABdhPJznxlCbRpVhFUcGQYIzq2wotjTAZfj6r+uVXxNad6g9Gp5KhhaxnkuYEMMc+Fj26avh47h6qA== X-Received: by 2002:a63:4c1c:: with SMTP id z28mr3981920pga.14.1643313761743; Thu, 27 Jan 2022 12:02:41 -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.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:41 -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, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 35/35] component: Remove component_master_ops and friends Date: Thu, 27 Jan 2022 12:01:41 -0800 Message-Id: <20220127200141.1295328-36-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The struct is unused now so drop it along with the functions that use it. Cc: Daniel Vetter Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by tags would be appreciated, and Acked-by/Reviewed-by tags too. --- drivers/base/component.c | 149 ++++---------------------------------- drivers/gpu/drm/drm_drv.c | 2 +- include/linux/component.h | 44 ----------- 3 files changed, 17 insertions(+), 178 deletions(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index 5b91a114786d..c9d17ea64226 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -57,7 +57,6 @@ struct component_match { }; =20 struct aggregate_device { - const struct component_master_ops *ops; struct device *parent; struct device dev; struct component_match *match; @@ -154,18 +153,12 @@ static void component_debugfs_del(struct aggregate_de= vice *m) =20 #endif =20 -struct aggregate_bus_find_data { - const struct component_master_ops *ops; - struct device *parent; -}; - static int aggregate_bus_find_match(struct device *dev, const void *_data) { struct aggregate_device *adev =3D to_aggregate_device(dev); - const struct aggregate_bus_find_data *data =3D _data; + const struct device *parent =3D _data; =20 - if (adev->parent =3D=3D data->parent && - (!data->ops || adev->ops =3D=3D data->ops)) + if (adev->parent =3D=3D parent) return 1; =20 return 0; @@ -426,30 +419,15 @@ static int aggregate_device_match(struct device *dev,= struct device_driver *drv) return ret; } =20 -/* TODO: Remove once all aggregate drivers use component_aggregate_registe= r() */ -static int component_probe_bind(struct aggregate_device *adev) -{ - return adev->ops->bind(adev->parent); -} - -static void component_remove_unbind(struct aggregate_device *adev) -{ - adev->ops->unbind(adev->parent); -} - static int aggregate_driver_probe(struct device *dev) { const struct aggregate_driver *adrv =3D to_aggregate_driver(dev->driver); struct aggregate_device *adev =3D to_aggregate_device(dev); - bool modern =3D adrv->probe !=3D component_probe_bind; int ret; =20 - /* Only do runtime PM when drivers migrate */ - if (modern) { - pm_runtime_get_noresume(dev); - pm_runtime_set_active(dev); - pm_runtime_enable(dev); - } + pm_runtime_get_noresume(dev); + pm_runtime_set_active(dev); + pm_runtime_enable(dev); =20 mutex_lock(&component_mutex); if (devres_open_group(adev->parent, adev, GFP_KERNEL)) { @@ -462,7 +440,7 @@ static int aggregate_driver_probe(struct device *dev) devres_close_group(adev->parent, NULL); mutex_unlock(&component_mutex); =20 - if (ret && modern) { + if (ret) { pm_runtime_disable(dev); pm_runtime_set_suspended(dev); pm_runtime_put_noidle(dev); @@ -475,15 +453,10 @@ static void aggregate_driver_remove(struct device *de= v) { const struct aggregate_driver *adrv =3D to_aggregate_driver(dev->driver); struct aggregate_device *adev =3D to_aggregate_device(dev); - bool modern =3D adrv->remove !=3D component_remove_unbind; =20 - /* Only do runtime PM when drivers migrate */ - if (modern) - pm_runtime_get_sync(dev); + pm_runtime_get_sync(dev); adrv->remove(to_aggregate_device(dev)); devres_release_group(adev->parent, adev); - if (!modern) - return; =20 pm_runtime_put_noidle(dev); =20 @@ -509,16 +482,11 @@ static struct bus_type aggregate_bus_type =3D { }; =20 /* Callers take ownership of return value, should call put_device() */ -static struct aggregate_device *__aggregate_find(struct device *parent, - const struct component_master_ops *ops) +static struct aggregate_device *__aggregate_find(struct device *parent) { struct device *dev; - struct aggregate_bus_find_data data =3D { - .ops =3D ops, - .parent =3D parent, - }; =20 - dev =3D bus_find_device(&aggregate_bus_type, NULL, &data, + dev =3D bus_find_device(&aggregate_bus_type, NULL, parent, aggregate_bus_find_match); =20 return dev ? to_aggregate_device(dev) : NULL; @@ -551,7 +519,7 @@ static void aggregate_driver_unregister(struct aggregat= e_driver *adrv) } =20 static struct aggregate_device *aggregate_device_add(struct device *parent, - const struct component_master_ops *ops, struct aggregate_driver *adrv, + struct aggregate_driver *adrv, struct component_match *match) { struct aggregate_device *adev; @@ -576,7 +544,6 @@ static struct aggregate_device *aggregate_device_add(st= ruct device *parent, adev->parent =3D parent; adev->dev.bus =3D &aggregate_bus_type; adev->dev.release =3D aggregate_device_release; - adev->ops =3D ops; adev->match =3D match; adev->adrv =3D adrv; dev_set_name(&adev->dev, "aggregate%d", id); @@ -592,54 +559,6 @@ static struct aggregate_device *aggregate_device_add(s= truct device *parent, return adev; } =20 -/** - * component_master_add_with_match - register an aggregate driver - * @parent: parent device of the aggregate driver - * @ops: callbacks for the aggregate driver - * @match: component match list for the aggregate driver - * - * Registers a new aggregate driver consisting of the components added to = @match - * by calling one of the component_match_add() functions. Once all compone= nts in - * @match are available, it will be assembled by calling - * &component_master_ops.bind from @ops. Must be unregistered by calling - * component_master_del(). - * - * Deprecated: Use component_aggregate_register() instead. - */ -int component_master_add_with_match(struct device *parent, - const struct component_master_ops *ops, - struct component_match *match) -{ - struct aggregate_driver *adrv; - struct aggregate_device *adev; - int ret =3D 0; - - adrv =3D kzalloc(sizeof(*adrv), GFP_KERNEL); - if (!adrv) - return -ENOMEM; - - adev =3D aggregate_device_add(parent, ops, adrv, match); - if (IS_ERR(adev)) { - ret =3D PTR_ERR(adev); - goto err; - } - - adrv->probe =3D component_probe_bind; - adrv->remove =3D component_remove_unbind; - adrv->driver.owner =3D THIS_MODULE; - adrv->driver.name =3D dev_name(&adev->dev); - - ret =3D aggregate_driver_register(adrv); - if (!ret) - return 0; - - put_device(&adev->dev); -err: - kfree(adrv); - return ret; -} -EXPORT_SYMBOL_GPL(component_master_add_with_match); - /** * component_aggregate_register - register an aggregate driver * @parent: parent device of the aggregate driver @@ -656,7 +575,7 @@ int component_aggregate_register(struct device *parent, struct aggregate_device *adev; int ret; =20 - adev =3D aggregate_device_add(parent, NULL, adrv, match); + adev =3D aggregate_device_add(parent, adrv, match); if (IS_ERR(adev)) return PTR_ERR(adev); =20 @@ -668,42 +587,6 @@ int component_aggregate_register(struct device *parent, } EXPORT_SYMBOL_GPL(component_aggregate_register); =20 -/** - * component_master_del - unregister an aggregate driver - * @parent: parent device of the aggregate driver - * @ops: callbacks for the aggregate driver - * - * Unregisters an aggregate driver registered with - * component_master_add_with_match(). If necessary the aggregate driver is= first - * disassembled by calling &component_master_ops.unbind from @ops. - * - * Deprecated: Use component_aggregate_unregister() instead. - */ -void component_master_del(struct device *parent, - const struct component_master_ops *ops) -{ - struct aggregate_device *adev; - struct aggregate_driver *adrv; - struct device_driver *drv; - - mutex_lock(&component_mutex); - adev =3D __aggregate_find(parent, ops); - mutex_unlock(&component_mutex); - - if (adev) { - drv =3D adev->dev.driver; - if (drv) { - adrv =3D to_aggregate_driver(drv); - aggregate_driver_unregister(adrv); - kfree(adrv); - } - - device_unregister(&adev->dev); - } - put_device(&adev->dev); -} -EXPORT_SYMBOL_GPL(component_master_del); - /** * component_aggregate_unregister - unregister an aggregate driver * @parent: parent device of the aggregate driver @@ -719,7 +602,7 @@ void component_aggregate_unregister(struct device *pare= nt, struct aggregate_device *adev; =20 mutex_lock(&component_mutex); - adev =3D __aggregate_find(parent, NULL); + adev =3D __aggregate_find(parent); mutex_unlock(&component_mutex); =20 if (adev) @@ -755,7 +638,7 @@ static void component_unbind(struct component *componen= t, * * Unbinds all components of the aggregate device by passing @data to their * &component_ops.unbind functions. Should be called from - * &component_master_ops.unbind. + * &aggregate_driver.remove. */ void component_unbind_all(struct device *parent, void *data) { @@ -765,7 +648,7 @@ void component_unbind_all(struct device *parent, void *= data) =20 WARN_ON(!mutex_is_locked(&component_mutex)); =20 - adev =3D __aggregate_find(parent, NULL); + adev =3D __aggregate_find(parent); if (!adev) return; =20 @@ -843,7 +726,7 @@ static int component_bind(struct component *component, = struct aggregate_device * * * Binds all components of the aggregate @dev by passing @data to their * &component_ops.bind functions. Should be called from - * &component_master_ops.bind. + * &aggregate_driver.probe. */ int component_bind_all(struct device *parent, void *data) { @@ -854,7 +737,7 @@ int component_bind_all(struct device *parent, void *dat= a) =20 WARN_ON(!mutex_is_locked(&component_mutex)); =20 - adev =3D __aggregate_find(parent, NULL); + adev =3D __aggregate_find(parent); if (!adev) return -EINVAL; =20 diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 8214a0b1ab7f..902287bbcaba 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -545,7 +545,7 @@ static void drm_fs_inode_free(struct inode *inode) * following guidelines apply: * * - The entire device initialization procedure should be run from the - * &component_master_ops.master_bind callback, starting with + * &aggregate_driver.probe callback, starting with * devm_drm_dev_alloc(), then binding all components with * component_bind_all() and finishing with drm_dev_register(). * diff --git a/include/linux/component.h b/include/linux/component.h index 073cbe9fea32..36ce0997f213 100644 --- a/include/linux/component.h +++ b/include/linux/component.h @@ -66,45 +66,6 @@ void component_unbind_all(struct device *parent, void *d= ata); =20 struct device *aggregate_device_parent(const struct aggregate_device *adev= ); =20 -/** - * struct component_master_ops - callback for the aggregate driver - * - * Aggregate drivers are registered with component_master_add_with_match()= and - * unregistered with component_master_del(). - */ -struct component_master_ops { - /** - * @bind: - * - * Called when all components or the aggregate driver, as specified in - * the match list passed to component_master_add_with_match(), are - * ready. Usually there are 3 steps to bind an aggregate driver: - * - * 1. Allocate a structure for the aggregate driver. - * - * 2. Bind all components to the aggregate driver by calling - * component_bind_all() with the aggregate driver structure as opaque - * pointer data. - * - * 3. Register the aggregate driver with the subsystem to publish its - * interfaces. - * - * Note that the lifetime of the aggregate driver does not align with - * any of the underlying &struct device instances. Therefore devm cannot - * be used and all resources acquired or allocated in this callback must - * be explicitly released in the @unbind callback. - */ - int (*bind)(struct device *master); - /** - * @unbind: - * - * Called when either the aggregate driver, using - * component_master_del(), or one of its components, using - * component_del(), is unregistered. - */ - void (*unbind)(struct device *master); -}; - /** * struct aggregate_driver - Aggregate driver (made up of other drivers) * @count: driver registration refcount @@ -155,9 +116,6 @@ static inline struct aggregate_driver *to_aggregate_dri= ver(struct device_driver return container_of(d, struct aggregate_driver, driver); } =20 -void component_master_del(struct device *, - const struct component_master_ops *); - struct component_match; =20 int component_aggregate_register(struct device *parent, @@ -165,8 +123,6 @@ int component_aggregate_register(struct device *parent, void component_aggregate_unregister(struct device *parent, struct aggregate_driver *adrv); =20 -int component_master_add_with_match(struct device *, - const struct component_master_ops *, struct component_match *); void component_match_add_release(struct device *parent, struct component_match **matchptr, void (*release)(struct device *, void *), --=20 https://chromeos.dev