From nobody Tue Jun 30 23:30:34 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 C9CA8C433EF for ; Thu, 6 Jan 2022 21:46:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244490AbiAFVqN (ORCPT ); Thu, 6 Jan 2022 16:46:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244424AbiAFVqC (ORCPT ); Thu, 6 Jan 2022 16:46:02 -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 A59C7C06118A for ; Thu, 6 Jan 2022 13:46:01 -0800 (PST) Received: by mail-pf1-x42f.google.com with SMTP id c2so3602570pfc.1 for ; Thu, 06 Jan 2022 13:46:01 -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=RmY1cenK39LeXHZdxikBLMAMQ0a1qm+zsJMLAmvgrDU=; b=f8YEJU69thyg9l1prrNVdACbNhPVwDnYPAvsWZQCfxuGCEnOXLapoRPPa9nO4t1NKS MQHKjftCulwgmqiKja59+9XQrMcVo4BDLWTnrCMCaWPKIGn8taUOwUWakXEyluRga50t 6VDe7o4C2A8erXxa9aDjEh/Sv+4oRE5+XBEss= 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=RmY1cenK39LeXHZdxikBLMAMQ0a1qm+zsJMLAmvgrDU=; b=CCX/Ytn6sECyrsArslKhA2vVHmU6JHhIuB+YSi2SgT7usmlfWc2jDOQO/phmaBagan rrE8z8EcMaE3DJ4RzwTAOTFAM8RkJ/BTwBfHuLK6n8grW660wnJix+U2X6D7pMrGb9lb gF3IFwHRBMdw1oWEGhnqk6nIYJHFrVh+JKk2Ty1eoxviXrzZAc2QNi0KYZH1XbrFq86B rh5GQyPi1OO1+2aHrReOnAT39bD6UD75U2GkdQb+3Tq6u1hLnT6xOvziGR3Rcal74VjZ cPZtXKGh4JvWrmLryuFI0c+CiBge0bLAVf0vwFR8JFnelpCILrvPx9S27Ug5gAdz3t42 qCYw== X-Gm-Message-State: AOAM533BCjpUEI6PhRW98WAWn/qSiIVkRPgq9ey3J0X/NU/2wxsFMwem O6VUCsEPqdFboaUAvMqp71xxtA== X-Google-Smtp-Source: ABdhPJxGPujK12u8lFN4IcocU1zebcj8bRCGY4K+kr0OZzOMaAuSgL5xV6Isj1Sd2sBfbPsvKoMRoQ== X-Received: by 2002:a63:3704:: with SMTP id e4mr54745338pga.551.1641505561201; Thu, 06 Jan 2022 13:46:01 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46: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, Daniel Vetter , Laurent Pinchart , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 01/32] component: Replace most references to 'master' with 'aggregate device' Date: Thu, 6 Jan 2022 13:45:24 -0800 Message-Id: <20220106214556.2461363-2-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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 | 2 +- 2 files changed, 120 insertions(+), 124 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..71bfc3862633 100644 --- a/include/linux/component.h +++ b/include/linux/component.h @@ -41,7 +41,7 @@ void component_del(struct device *, const struct componen= t_ops *); int component_bind_all(struct device *master, void *master_data); void component_unbind_all(struct device *master, void *master_data); =20 -struct master; +struct aggregate_device; =20 /** * struct component_master_ops - callback for the aggregate driver --=20 https://chromeos.dev From nobody Tue Jun 30 23:30:34 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 C47B0C43219 for ; Thu, 6 Jan 2022 21:46:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244501AbiAFVqP (ORCPT ); Thu, 6 Jan 2022 16:46:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244413AbiAFVqD (ORCPT ); Thu, 6 Jan 2022 16:46:03 -0500 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0822C061201 for ; Thu, 6 Jan 2022 13:46:02 -0800 (PST) Received: by mail-pg1-x529.google.com with SMTP id t32so3732200pgm.7 for ; Thu, 06 Jan 2022 13:46: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=ihieeriyE8UG3RZG4+pkuf1VTaWA2lHg2OnygIPLIw8=; b=aq/xKBP+WtsO6raoZRDAqa2CrfA+mQwOme4XqFwKmWlVIxQvarv9I00Q96a8FQmmGG yR7RBwi4B6T3u2QYNOFO1P2XEt6q8hH5Z6EgzxFvhj6PG2VrQ+L5UCWy9Fgy85iDBsIr 1tjtn8/V+/Mu1PNXnMrGyPhNT1TJic/s+SvwE= 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=ihieeriyE8UG3RZG4+pkuf1VTaWA2lHg2OnygIPLIw8=; b=rIDvmyBwmk6Hw8VSfxG/zr/Q+u/1eRP0xIP7dCVP0U5rJ5zWdaoQGmBt3zaS4D8kDB 6lu+xksNHwVej0SVa3enblVCWrpGYbtNGJRLuVDLE4MtccuTkZ7gaUcJ8QPAyQNxc1qU fH6vGEgPcZyAQ8pbz5lNbkyIhuUtv9oqNJc3XklpOsoXmbsBGkUojJojGGqjbz103tHQ O5g961RX83mIOybv4VM+YolhgEXvCTHLbXGLBZ3rK4iCG5pNrmhtxxqlt9akmEIr9/ox knvWFIopHUhvDoBVXxEt5zki8c8D7toK7muKLyp4as5LGKsg4u3qGCUY2CEHqzoUFRJg 5eZQ== X-Gm-Message-State: AOAM532aVHxNqAbiG3Tn1Kz249tdMNw1Gt+pV+6BSdoxDYo5vyPuKIHn QrWo9I0MBvkpedrEaJ0tcwTYxQ== X-Google-Smtp-Source: ABdhPJwjE6tLJSuGMa5iYMELWPSTxueifiS36w0Y1ypl18Khz9RpepmFmn17k8A+TXDeeUNUum5B+g== X-Received: by 2002:aa7:9681:0:b0:4ba:98c6:8fc3 with SMTP id f1-20020aa79681000000b004ba98c68fc3mr62688363pfk.78.1641505562443; Thu, 06 Jan 2022 13:46:02 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:02 -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 v5 02/32] component: Introduce the aggregate bus_type Date: Thu, 6 Jan 2022 13:45:25 -0800 Message-Id: <20220106214556.2461363-3-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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 | 471 ++++++++++++++++++++++++++++---------- include/linux/component.h | 62 ++++- 2 files changed, 402 insertions(+), 131 deletions(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index 34f9e0802719..eec82caeae5e 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,186 @@ 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 int aggregate_driver_register(struct aggregate_driver *adrv) +{ + adrv->driver.bus =3D &aggregate_bus_type; + return driver_register(&adrv->driver); +} + +static void aggregate_driver_unregister(struct aggregate_driver *adrv) +{ + driver_unregister(&adrv->driver); +} + +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 +582,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); =20 - return ret < 0 ? ret : 0; + ret =3D aggregate_driver_register(adrv); + if (ret) + put_device(&adev->dev); + + 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 +655,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 +749,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 +845,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 +869,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 +948,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 +960,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 71bfc3862633..95d1b23ede8a 100644 --- a/include/linux/component.h +++ b/include/linux/component.h @@ -3,9 +3,7 @@ #define COMPONENT_H =20 #include - - -struct device; +#include =20 /** * struct component_ops - callbacks for component drivers @@ -82,11 +80,65 @@ struct component_master_ops { void (*unbind)(struct device *master); }; =20 +struct component_match; + +/** + * struct aggregate_driver - Aggregate driver (made up of other drivers) + * @driver: device driver + * @match: component match list + */ +struct aggregate_driver { + /** + * @probe: + * + * Called when all components or the aggregate driver, as specified in + * the @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); + + 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); +} + +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); + void component_master_del(struct device *, const struct component_master_ops *); =20 -struct component_match; - int component_master_add_with_match(struct device *, const struct component_master_ops *, struct component_match *); void component_match_add_release(struct device *master, --=20 https://chromeos.dev From nobody Tue Jun 30 23:30:34 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 ECDE7C433FE for ; Thu, 6 Jan 2022 21:46:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244511AbiAFVqR (ORCPT ); Thu, 6 Jan 2022 16:46:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244363AbiAFVqE (ORCPT ); Thu, 6 Jan 2022 16:46:04 -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 1577FC061245 for ; Thu, 6 Jan 2022 13:46:04 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id rj2-20020a17090b3e8200b001b1944bad25so4539986pjb.5 for ; Thu, 06 Jan 2022 13:46: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=+OZEUzbJkhEl2ueO+0tubjfHfZwZ/3lRZTTLw8nIUe4=; b=QdNjIAobt/derYc6c3Gs9KGKe+gcE2F48axRhJXhDfWd037tfkRhiOvU+6INALe1xW l0X9pnu/3HJXfqPLowTbh129vmKQPv4Yba8RdqPUG4CGzbjJgcRNO4VLW6C4/gLrecXc hkmq4B3C/LNmQfiTrtbuw0RBZRXj4anmUvV3k= 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=+OZEUzbJkhEl2ueO+0tubjfHfZwZ/3lRZTTLw8nIUe4=; b=q97ypanW3DGEEpQo8L1JAjaAs+QLsZ6SqvBuGrBZBpMsnBP+TLEeYPdPLOYdKmXITV AIO2y/8VjuDeQqvbLvIf4dcUZAS/W8NM9vfmZ9cOmUuOxZY5k2xY6+bKhv71ZRa0rgAW a1smdG4Okt9EhgwujKe7Saz37vbpBgzhqlAH9XIv8SL7o82WgWaayrWQZLE9KxZFcApg AVmCnLFlA25os9jFCGENCnXJ3spVxPn0YCdW7fFmGjDaSpVMNSYv8fb01D6zI0lZciiU 5BjiNMGVVCxMuR8VFPfyy/5CW1TISBrpJy9tf/Q8s+1ImfOUGKSXFeEncF4kfzWjLOnz mt3A== X-Gm-Message-State: AOAM532e+MryMXL3C13kgl7mFUvtY+pW90GhMiq3Y0rY9gs+Do4vcfHH ktRHL47AAuJ3EAlDyEODUTkZKA== X-Google-Smtp-Source: ABdhPJx2Rn+if/ljePBBBfU5FyTBFf4xXawEJ++3znnA8VPOwm/9Zu1BwYB/KNJZYwq/dJQOifJsIA== X-Received: by 2002:a17:90b:384a:: with SMTP id nl10mr12390792pjb.203.1641505563694; Thu, 06 Jan 2022 13:46:03 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46: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, Daniel Vetter , Laurent Pinchart , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 03/32] component: Move struct aggregate_device out to header file Date: Thu, 6 Jan 2022 13:45:26 -0800 Message-Id: <20220106214556.2461363-4-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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 use the device passed to their probe/remove/shutdown functions properly instead of treating it as an opaque pointer. 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 | 15 --------------- include/linux/component.h | 19 ++++++++++++++++--- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index eec82caeae5e..dc38a8939ae6 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -56,21 +56,6 @@ struct component_match { struct component_match_array *compare; }; =20 -struct aggregate_device { - const struct component_master_ops *ops; - struct device *parent; - struct device dev; - struct component_match *match; - struct aggregate_driver *adrv; - - int id; -}; - -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; diff --git a/include/linux/component.h b/include/linux/component.h index 95d1b23ede8a..e99cf8e910f0 100644 --- a/include/linux/component.h +++ b/include/linux/component.h @@ -5,6 +5,8 @@ #include #include =20 +struct component_match; + /** * struct component_ops - callbacks for component drivers * @@ -39,8 +41,6 @@ void component_del(struct device *, const struct componen= t_ops *); int component_bind_all(struct device *master, void *master_data); void component_unbind_all(struct device *master, void *master_data); =20 -struct aggregate_device; - /** * struct component_master_ops - callback for the aggregate driver * @@ -80,7 +80,20 @@ struct component_master_ops { void (*unbind)(struct device *master); }; =20 -struct component_match; +struct aggregate_device { + const struct component_master_ops *ops; + struct device *parent; + struct device dev; + struct component_match *match; + struct aggregate_driver *adrv; + + int id; +}; + +static inline struct aggregate_device *to_aggregate_device(struct device *= d) +{ + return container_of(d, struct aggregate_device, dev); +} =20 /** * struct aggregate_driver - Aggregate driver (made up of other drivers) --=20 https://chromeos.dev From nobody Tue Jun 30 23:30:34 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 AEC78C433F5 for ; Thu, 6 Jan 2022 21:46:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244460AbiAFVq3 (ORCPT ); Thu, 6 Jan 2022 16:46:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244436AbiAFVqH (ORCPT ); Thu, 6 Jan 2022 16:46:07 -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 A96BEC034002 for ; Thu, 6 Jan 2022 13:46:06 -0800 (PST) Received: by mail-pj1-x1034.google.com with SMTP id n30-20020a17090a5aa100b001b2b6509685so4545454pji.3 for ; Thu, 06 Jan 2022 13:46: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=wHTGmIfG7F9SDIRewz7zNR4I/bW/soPNx1fVWL7SSqg=; b=jYXk75wBy5JTKs0io9za+IJePm5iRhd7PFw86GocJ/ZOIe8Q6PyOQEn/CB2Cc+TLm3 2ZhD/R0KNvDY8/P18/zqcaiUA0Yx/ifq5S5qwkg8S+P1l8gL0SUCzPhIdPJk901WtDca M3+Gli2Px1dUVedOgR1fVqZIO2cdFooC+y2hk= 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=wHTGmIfG7F9SDIRewz7zNR4I/bW/soPNx1fVWL7SSqg=; b=0z8ukP2/d26eTC+xwtQspf1cRVitStU0TaGSweI2JKK8hZ6X5qCePWKQpyVBSAePOF YFf1/Z/DBUbVAMVnYaiFUliQDLiBgujMpeA5bIigWf7mmKq3aBvjJvy1sJW01zrg4/W+ vO199f9+byfRAYRyD742uAty6lDfUFY37MIKdHAlb0QVA3nW0m0M4ZZSt+/HNwRd0pwH iu0BiwZf0eUrKop+9fnLzGxpXGcaPFjmSjKcS1/JN6YiUKkUL6NTWr5Y8qJQAxYOYxJr leT8VazOUOSSazL61mz/hOUxlfxvNd+I/Dwo2NR9cS9vwmCacGVScFsXNPspfN85rT0x FkBQ== X-Gm-Message-State: AOAM531UVnLo43pCFLaadD2PsD/YDrZraLdLT47GhZ3jBYyjXbX/tAa7 4B85hsJj+NX1vSnfsyIReFZ+Hg== X-Google-Smtp-Source: ABdhPJyrZfgLqySabEnQeFQoN6950iKcXddByevHgRq0wc/gtN1aTk6rss1QjaXFw4vTw780Dtn9OQ== X-Received: by 2002:a17:902:7681:b0:149:bb15:c53f with SMTP id m1-20020a170902768100b00149bb15c53fmr21842657pll.159.1641505564986; Thu, 06 Jan 2022 13:46:04 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46: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, Daniel Vetter , Daniel Vetter , Laurent Pinchart , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 04/32] component: Add {bind,unbind}_component() ops that take aggregate device Date: Thu, 6 Jan 2022 13:45:27 -0800 Message-Id: <20220106214556.2461363-5-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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 | 22 ++++++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index dc38a8939ae6..e9e58b56cda4 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -699,8 +699,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 */ @@ -765,7 +770,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 e99cf8e910f0..d8dcbf9733da 100644 --- a/include/linux/component.h +++ b/include/linux/component.h @@ -6,6 +6,7 @@ #include =20 struct component_match; +struct aggregate_device; =20 /** * struct component_ops - callbacks for component drivers @@ -19,18 +20,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 *); --=20 https://chromeos.dev From nobody Tue Jun 30 23:30:34 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 E1996C433F5 for ; Thu, 6 Jan 2022 21:46:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244410AbiAFVqX (ORCPT ); Thu, 6 Jan 2022 16:46:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244409AbiAFVqH (ORCPT ); Thu, 6 Jan 2022 16:46:07 -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 9892CC0611FD for ; Thu, 6 Jan 2022 13:46:06 -0800 (PST) Received: by mail-pg1-x52f.google.com with SMTP id v25so3741998pge.2 for ; Thu, 06 Jan 2022 13:46: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=pT87OQ3egRwLpYLDnQ//DolOVTqHrwpGRKkmvVo/d+g=; b=ZY+Nh2Jaf/gEt7FazNbuSiJJOpmRXaMrnwnXMY++Gzp8bEiutUOA/xuGgWKH0w3FNj OvuDFllSXCjoLNf40OxYW+uizrfamdf3bQ+OYVFx0fzfZrEfHW/TAxdJRkypJSwOilex jGG6Y4vrFV0UEo7xUu1iVTyCivDxwO9Qeze5U= 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=pT87OQ3egRwLpYLDnQ//DolOVTqHrwpGRKkmvVo/d+g=; b=nvavEvx8LRA4s1/zo6vUMQEtaIBCQYPW5pli7qma7bpXnUkdUbfFR3o0gG5pssw1FW MzQW44TTKYx+fZICg2uRoiXx1du0xSw8bSD8M4RiukY5G8fDN28gBv5R2zShLBAT6dwt crjWWzqGHzfnPKq9smBi2qxBOy41RqNaa1JHyjVFKgW04XqatKFueHYQUYUBW2jEmOZe a33eG87T0TY9uvgrPwkH0HwwjSOPa3r6seZuJpqhT7RZQWXfkO7bg70h0DkY9CtF7Knn K4azox34LpH/MBJfRZ5+w826eKZvLOShcLirQcAMNi+7WwCGr/fwQj16TMGWucr8SMAt wK0Q== X-Gm-Message-State: AOAM532VzXp+0/bh0stdJIqzn8xC8xRo4kO6gaXywWOdQZxn4Xwj2Xev oJEan8hp2CK2lX1MmiyqRDNYHA== X-Google-Smtp-Source: ABdhPJw5gtA5umryoXrWlTZ0DfdJiTAJSoZT5EbxDy0C+cY+TwaU7Ljz9BCSoRQeGO2Yx2fucyE3cg== X-Received: by 2002:a05:6a00:2304:b0:4ba:4cbb:8289 with SMTP id h4-20020a056a00230400b004ba4cbb8289mr61476292pfh.79.1641505566182; Thu, 06 Jan 2022 13:46:06 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46: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 , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 05/32] drm/of: Add a drm_of_aggregate_probe() API Date: Thu, 6 Jan 2022 13:45:28 -0800 Message-Id: <20220106214556.2461363-6-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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 37c34146eea8..008d6b7d2283 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 b9b093add92e..9d35a141f888 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); @@ -78,6 +82,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 23:30:34 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 EBCBBC433FE for ; Thu, 6 Jan 2022 21:46:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244494AbiAFVq0 (ORCPT ); Thu, 6 Jan 2022 16:46:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244442AbiAFVqI (ORCPT ); Thu, 6 Jan 2022 16:46:08 -0500 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4213C034003 for ; Thu, 6 Jan 2022 13:46:07 -0800 (PST) Received: by mail-pl1-x629.google.com with SMTP id q14so3416127plx.4 for ; Thu, 06 Jan 2022 13:46:07 -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=MLFo5uJ88/q78BTGkhEJmKSkKMysd8HwfQglPXTN2wU=; b=nglDE8QY9t5hdSAJx4+V4q37ClBOabpxxFLIHDIl6b0J46Y4aM7i5LRT8JyqwRd/GR /dlRGYshMif/788W7Cbe1ePX91QrDYEuSqLmhtUQ/Rn7UEuXvBeE28dA6qmUpch4oWe1 /663ZKSP2KxNRXEUAPmX2A93rjrDVp/KOHSKI= 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=MLFo5uJ88/q78BTGkhEJmKSkKMysd8HwfQglPXTN2wU=; b=daKYVm6iltyabQbuggaq3hWwMLWuv3U57pwn+M6fnwvbh8i8bc9d3Si8pogzHrikyn /T3HI0zjMw6Zvpjb+xAWLxE5xhzy+/+eZHsFzczeebSfaVJemwjQ9DK/7Qabd1Q0gxH1 UM5UKfR9J5078lBpItUBoEaH0H3UbydCVszGTOfUDorlNrqvIfolBlE6OxnlvzPYhEIa SuMP2VCV+w+IgQzv/1fqx6aeul/IyEkDlX0n8ekZdKJbYfEU/rC5iIaxaXagqEwKNcbs vbsyiIjwgQn05AMIAJ9IGEvc/8KxJ7/zDeSv7DLTHf58srt1jzrRfk1RW1w4PaI/DiC/ qQ6A== X-Gm-Message-State: AOAM533YF16dcf3uIPC5oM8Pw51sbSHUWjuk4d285ulVDcL+TFydIEUt XGlxQSTliortnJgt4O14kPR5kYxNHs+hUQ== X-Google-Smtp-Source: ABdhPJxKPNiQbLhCjMWfO6s24aaY/aGv9aYyqnVU0SdXtFDVXaiu2l9rIuGYklh4MYLASJomWl2L2Q== X-Received: by 2002:a17:90b:3ece:: with SMTP id rm14mr12322633pjb.6.1641505567437; Thu, 06 Jan 2022 13:46:07 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46: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, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 06/32] drm/msm: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:29 -0800 Message-Id: <20220106214556.2461363-7-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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 | 46 +++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 7936e8d498dd..f6e9b0d318f5 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -1360,19 +1360,35 @@ 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(adev->parent, &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(adev->parent); +} + +static void msm_drm_shutdown(struct aggregate_device *adev) +{ + struct drm_device *drm =3D platform_get_drvdata(to_platform_device(adev->= parent)); + struct msm_drm_private *priv =3D drm ? drm->dev_private : 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 /* @@ -1401,7 +1417,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 @@ -1414,23 +1430,12 @@ static int msm_pdev_probe(struct platform_device *p= dev) =20 static int msm_pdev_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &msm_drm_ops); + component_aggregate_unregister(&pdev->dev, &msm_drm_aggregate_driver); of_platform_depopulate(&pdev->dev); =20 return 0; } =20 -static void msm_pdev_shutdown(struct platform_device *pdev) -{ - struct drm_device *drm =3D platform_get_drvdata(pdev); - struct msm_drm_private *priv =3D drm ? drm->dev_private : 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 }, @@ -1446,7 +1451,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 23:30:34 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 8B13DC433FE for ; Thu, 6 Jan 2022 21:46:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244399AbiAFVqx (ORCPT ); Thu, 6 Jan 2022 16:46:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244452AbiAFVqJ (ORCPT ); Thu, 6 Jan 2022 16:46:09 -0500 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D17BC034004 for ; Thu, 6 Jan 2022 13:46:09 -0800 (PST) Received: by mail-pf1-x42e.google.com with SMTP id q3so3582256pfs.7 for ; Thu, 06 Jan 2022 13:46: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=QdKC3RDnWMeVhqBKuTAcfq/eZBHYEe2Kb+X7ix5SdpY=; b=IcaBfWVygHDNB6C8LkFxsWDgsRiQvHr6RF8HBCSc8kKeIzuGmKt6X6QMGLS4D8+pBO irbkBZrK9VdODT76096dKX1fUVhxrt6DZfbKHR2KJbI2wpIcsg4+hotoJ66bXLb8rWfq QM+viogiXHi5P8VefoPXVvE8N/Cic8ZmjsZKc= 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=QdKC3RDnWMeVhqBKuTAcfq/eZBHYEe2Kb+X7ix5SdpY=; b=3pSoo413tGVUG/ege2OGO/jqJdWK0HgIX9GxhSFKxB+ZXwmrmtHtwe2++h/Ke+wBSW UVYRn9qb/Vvcbp1MG68Dk+TZ6ZlX19f/0qO+j854+ojFJXcVFB+F37etLh0P2H6kyjL6 8zf8iBqg2q0+w+thV9GhUcpPnSoF0aqfgpHIM0x4zG9O0/wj4ZFCiteHiqIHBYMZcIK/ 9ggYhDVAH7EspdtzzMMmkRHdOlv6O9KZqqYH8OiW+i7X+8VczIF/6xfkSjkQA277fn/e 9Gowp2rooEwMJAfF0NrHRMm73VjZy1MLsAWU8xlfARzxl8K1BZYh6foeLmca+P6Bygxy 1bpA== X-Gm-Message-State: AOAM531NECTazkOKbdw2Irqpw8o1z9G8kHJv5UIrP4KGDvwkwvcm7Jf2 7gwwueOB3bxN3cAgLyz0OluKSA== X-Google-Smtp-Source: ABdhPJxWvdamkm9BbUfP5bbx8cClxJTqWYMaUw5Takg8Yhy/ubQOstHCKsaqxVAG6NtjkwEGXyIWHw== X-Received: by 2002:a65:5589:: with SMTP id j9mr54673150pgs.119.1641505568659; Thu, 06 Jan 2022 13:46:08 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46: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, James Qian Wang , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 07/32] drm/komeda: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:30 -0800 Message-Id: <20220106214556.2461363-8-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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..0463386a6ed2 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 adev->parent; 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 adev->parent; 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 23:30:34 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 80569C433F5 for ; Thu, 6 Jan 2022 21:46:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244662AbiAFVqw (ORCPT ); Thu, 6 Jan 2022 16:46:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244463AbiAFVqK (ORCPT ); Thu, 6 Jan 2022 16:46:10 -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 4DF2CC034000 for ; Thu, 6 Jan 2022 13:46:10 -0800 (PST) Received: by mail-pf1-x431.google.com with SMTP id m1so3574567pfk.8 for ; Thu, 06 Jan 2022 13:46:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=udX8aXVKtCgorZpoo7KBRMV9fl84l0zJ44mq5nPYnXQ=; b=Ya34FDKNKfvN1GQNsIj3/YHoOtnFnJomMP0x3sM6wb4AAXA5x9zxx14WIoBs2wHRpl 5mmvuYveL7LaSK9Yk07qPV6mwXvVreJp+RooagLKp0wjaY/HM5JCJP3uneRREyTMpbKx FmHW9pECA68YpJ3Xkz0I+ztn1d48xxPPPMBZs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=udX8aXVKtCgorZpoo7KBRMV9fl84l0zJ44mq5nPYnXQ=; b=YGq/dL+xY0YRswiLOyTgZUxiyeLrlSgJg554T0cVMuWT+t102pecBwkHNfuRGTin4f WnDMClT/bgJP7SjglcmVYo9pWxuyKNYz1bhRsIXyzhKtCP6N/6aV06atXVS3fRX2lX9l ABb86RKMGyq93exdrFgTKHRrqwqeuy9FKlGA17sor4EonrqUdc+ujGXU2wZm3nyaA7yt ++rGOQ5ZDGYDhC/4oTQS8d2P+9WQgrzKJgi0Vn9AiwKbGKVdfouBQGCCj/yhfElKUj40 EHHTYXIFgEcTNd6ycRBhDdSx/6NbJBIdcXHxSKNC9LXTCfWNtgB0c6au0rGmnLzqFJzT 4v1g== X-Gm-Message-State: AOAM5318uglzel0VhbYSMhdJja5ePnu7XC2c4m9EMoLFE/4yMSyMWXww juJjt49OKF6cNHHFliL7Hv/6wA== X-Google-Smtp-Source: ABdhPJwqM87G59xgRPi2C4DOO/wTX46XQXKwKNWtQf+08DlJeYiicq+R6L9sPwm8+CM6PygK176Kkw== X-Received: by 2002:a63:b20f:: with SMTP id x15mr16095753pge.82.1641505569883; Thu, 06 Jan 2022 13:46:09 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:09 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Liviu Dudau , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 08/32] drm/arm/hdlcd: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:31 -0800 Message-Id: <20220106214556.2461363-9-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 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..5c03eb98d814 100644 --- a/drivers/gpu/drm/arm/hdlcd_drv.c +++ b/drivers/gpu/drm/arm/hdlcd_drv.c @@ -270,8 +270,9 @@ static const struct drm_driver hdlcd_driver =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 adev->parent; struct drm_device *drm; struct hdlcd_drm_private *hdlcd; int ret; @@ -344,8 +345,9 @@ static int hdlcd_drm_bind(struct device *dev) return ret; } =20 -static void hdlcd_drm_unbind(struct device *dev) +static void hdlcd_drm_unbind(struct aggregate_device *adev) { + struct device *dev =3D adev->parent; 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 23:30:34 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 3B2B4C433F5 for ; Thu, 6 Jan 2022 21:46:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244711AbiAFVqj (ORCPT ); Thu, 6 Jan 2022 16:46:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244474AbiAFVqN (ORCPT ); Thu, 6 Jan 2022 16:46:13 -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 A8174C061212 for ; Thu, 6 Jan 2022 13:46:11 -0800 (PST) Received: by mail-pj1-x102a.google.com with SMTP id g11-20020a17090a7d0b00b001b2c12c7273so5406402pjl.0 for ; Thu, 06 Jan 2022 13:46:11 -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=tyFhWuo5Hgtey/EJ0ER9SojRROyEQ1lmEqqEKYabFj8=; b=LLJLmS+EadBgDQ+Aos6iptCIFgGQZC4BhHifui4nHYr+soQbQCsuRZf8eUfhEXakUF dCR3ZG3GODKgQD6iIPo9rc4CpzlKlxMLQQeuKOmYu2NLvK1RZzv62Y8acfrUkVf786px 6GNKOfhOa4RrRJZPK8de4dHA9uZuSsO3EcRSE= 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=tyFhWuo5Hgtey/EJ0ER9SojRROyEQ1lmEqqEKYabFj8=; b=Z+3m5dzhOUQ58StaFzoz5GTouSewZf/YyPi3+9Kh/bMEsU2a+Zr/6+P1hfaEQ0XaqO fEI1GyvJO27mK7rJB6azcJK9vPKE+29Kj6M8gaAj9X8gEFIfDmpqizIsiiXUlfb9aVj7 QmqaFiu7UNcybwefex9mWEgKbccoZq5Y5cQVRETuGCC15gZW4+BHWsI1erRjdu/ULsEP MMBj3qIuqOfKHDR2jetuwc5EeJvNy6OMa9AfLVPu3+IYTiQC1OViNz3ifF1crjvSL03R ivI+8wLJDmkYMrsTJwEv1rlCaeqNBEGy1Uxjqhpf09qr14LL7fTJjmX91udZH+iLqB+5 2TxA== X-Gm-Message-State: AOAM531a4Ut79Eb0DAi3Z/z8+ET1OmziVLP4G+0EM4EiIet9QrK3CNFH tD4tEkJKtCkHh5SRcTZVnRaUyg== X-Google-Smtp-Source: ABdhPJyyF7cPL+yI9hyzDjsYLKeK8/7opWbfS9Q9aFqPjk9CLzLHOaxee/DCuNvQMK+M3j2T3mtM3A== X-Received: by 2002:a17:90b:3143:: with SMTP id ip3mr12288271pjb.58.1641505571119; Thu, 06 Jan 2022 13:46:11 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:10 -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 v5 09/32] drm/malidp: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:32 -0800 Message-Id: <20220106214556.2461363-10-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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..e6ee4d1e3bb8 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 adev->parent; 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 adev->parent; 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 23:30:34 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 20A5AC433F5 for ; Thu, 6 Jan 2022 21:46:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244664AbiAFVqf (ORCPT ); Thu, 6 Jan 2022 16:46:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244484AbiAFVqN (ORCPT ); Thu, 6 Jan 2022 16:46:13 -0500 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8FEDC034001 for ; Thu, 6 Jan 2022 13:46:12 -0800 (PST) Received: by mail-pg1-x529.google.com with SMTP id i30so3769070pgl.0 for ; Thu, 06 Jan 2022 13:46: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=g366T6z/wDv+u0z2UhkHLqZZ67YI06zaB4um2FhnwRI=; b=hMzRCsm85BzTseZgCckSwAtxGaQ6AwGKmpMBLS/VovB3h2UykhAOfX8IJg4bI+Przl +hVQ4fMopnz0l091lu3Xx9mRGBiLNG23xThYMrNM8Ofdiw6LWwc/hI+hwty7lC7UtgNN OqQ0vT+Q4Q1vqf95QgPtaETz8S+UHWY6u4ZlA= 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=g366T6z/wDv+u0z2UhkHLqZZ67YI06zaB4um2FhnwRI=; b=BfNF8X7G2nuBa2veNfttmvngKkvwPdIB4hXgTYfmCfZopmY8HNTrdSSGWQavzsLBQX 23HmXYq52Q2noKPbbE46Te01DLdiwZ0zjvjqmQrz5v6ftOgIBRkqxJNPJem+BVOoeQAH Y+3FCAV80rPuaGSPnhkiluwAVQjH+rkWLnZu4sZex1vJz+quVN6qvm2ilx1YxtlJZ5/N lPbocJqZvuKNdwOGSWjkRZza0hZH2P7EAVoNP60fvfvl7E4niWeXb3ZCXb5C1XgK8s2v vkL+kjxSLDZTwjVzmo3mE5SOB+n7FwHLAYIL6AVcjp4dGJiH3VoNrUixMj6qln67x2dg ONwQ== X-Gm-Message-State: AOAM530ElNuPaXL/udWvCP64qaLbVq3Pi/23RCz5esGdj4uMCyyr9P27 ZjR94mZ0kngiHJ6S+fxGI7q8pA== X-Google-Smtp-Source: ABdhPJyLrhaeJQJp2viy5oBwJ2SLs74cYyQ+2SgkPuLbpAA6wOupAp3ggrLPzlQxYpAOTb8xeL3g8w== X-Received: by 2002:a63:7110:: with SMTP id m16mr38503368pgc.621.1641505572311; Thu, 06 Jan 2022 13:46:12 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46: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, Russell King , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Saravana Kannan Subject: [PATCH v5 10/32] drm/armada: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:33 -0800 Message-Id: <20220106214556.2461363-11-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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..b3559363ea43 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 adev->parent; 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 adev->parent; 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 23:30:34 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 80091C433EF for ; Thu, 6 Jan 2022 21:46:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244522AbiAFVqd (ORCPT ); Thu, 6 Jan 2022 16:46:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244435AbiAFVqO (ORCPT ); Thu, 6 Jan 2022 16:46:14 -0500 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07AB7C06118A for ; Thu, 6 Jan 2022 13:46:14 -0800 (PST) Received: by mail-pj1-x102c.google.com with SMTP id y16-20020a17090a6c9000b001b13ffaa625so10051410pjj.2 for ; Thu, 06 Jan 2022 13:46: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=NsjwfsQuiDMEQ+TXne3j17pwDv7xto97Rnhld6OcLgM=; b=UfX8IpxE7Xm8m0THPaEOlj7kVL2i9xBXvepNNTPjRZ4zlKvYKJEDRvcbsFMFQ/irYV 5Bf5aVv5JZ7qUuUqHXTUO8t1mGACN+ojn2ZDY0bM3Mg0eKxbkx7xhxdycW9FfTTWdHZo 3UM63Knx5hZTA/deRQPpqN0cu4ZGbjK9i0N+s= 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=NsjwfsQuiDMEQ+TXne3j17pwDv7xto97Rnhld6OcLgM=; b=FLc9k0xM3Ks+o3dqEudO22kEKIeenBKXTHKOL0UKvvqCTsZlp/UedAQkM9iibaWzBv g/0m9CRpNvmcO1XwKGQBzB0KPay1qvemPqK1itTmACuHqR7aIP7M4VXZzaqcrJ+a8bAG FcebJwvvucPIuwZi0CS01uF5AOmzGkG6wZHczH3H83JR/IkiOG6AcNqGogrU+yqdals5 6d/aR/wKdrqyVuMYIsb2C0yz6L1HPdCRlqzYnzscHg1Yc+Q5KSlkG6utZzmLL1UZebMS m1GbeWtxv4eHtF7zPdIsBEgK24aQrQ6DWbryBPK/CivhcYMcfLFaNp9PnLiA4fPqwIlD ObEA== X-Gm-Message-State: AOAM531arzCxPoISFnKofJJ/ABqaIuBCcTHbaw6NOjre57zHWpLRMWvI n5EP8GTHWVH5f5rXcFN7etxZvw== X-Google-Smtp-Source: ABdhPJyk/M15t+lyhtoh1b/2CEQ3pV+TQZFLl1SvsJLFKiODwyiIibw9MBABprRy3lEFWknjr9AaqA== X-Received: by 2002:a17:90b:1d8b:: with SMTP id pf11mr6100787pjb.119.1641505573602; Thu, 06 Jan 2022 13:46:13 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46: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, Lucas Stach , Russell King , Christian Gmeiner , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Saravana Kannan Subject: [PATCH v5 11/32] drm/etnaviv: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:34 -0800 Message-Id: <20220106214556.2461363-12-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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 7dcc6392792d..95d1e518ff13 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 adev->parent; 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 adev->parent; 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) @@ -609,12 +615,12 @@ static int etnaviv_pdev_probe(struct platform_device = *pdev) component_match_add(dev, &match, compare_str, names[i]); } =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 23:30:34 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 47092C433EF for ; Thu, 6 Jan 2022 21:46:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244483AbiAFVqk (ORCPT ); Thu, 6 Jan 2022 16:46:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244504AbiAFVqQ (ORCPT ); Thu, 6 Jan 2022 16:46:16 -0500 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 764FDC061245 for ; Thu, 6 Jan 2022 13:46:15 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id m13so3557305pji.3 for ; Thu, 06 Jan 2022 13:46:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9+fM2dIjOxE0hdJ7o5inMEoSl4k+Dtn8hCQbdOli+o8=; b=WMHlwmVoo1ow1wofjzv++KabJgE5A6EpO98LpbSnWXIy+DtxgACpsY6fIhJHEKp4Bd W+/v2FNvE3U3LbDMGYS3WkdtPvljEpVfgIA6g7AmLK3pZtGtdL0WDNRxlHud8Ao9Elb2 aXXS4XgNXK4ewetP2amhDNnmvvcOWnwPPzCEQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9+fM2dIjOxE0hdJ7o5inMEoSl4k+Dtn8hCQbdOli+o8=; b=YGfcu8slE1ihPn+R5L+yDXMJ5RnHQwkOUsUBzR5BeMEQC4lkoiUjntXhleJhfOxBRg mPQF+8ZmPant6zoW3N2uY6QcOROjes2e/VGZNzKEFfW+SCipIfP5xePZ1GeIWkG03acg pxVyicVTeabK9Rte8s59XquU+VGldHksqDt3S30gnQ1tAc5uTtqUgBkOMgjXZfip3M5t qll+P5p9njvGFVKeu9EamVP0S0qWS419o+JvZzC4gZByqx2kyL0vFrsNhpXLasuZPFDt A9eRVBAmAHBtGB5HTnkn4wvzNvc4h6yNAbkEwaVkwE5+ijyWnmQir2jp7d6udNlp7Yq7 rxwA== X-Gm-Message-State: AOAM533Aajm/4BjNH4muq7K17RXsRBYV7ZgQ6jWY4IXVMb2ohh+xgVp6 2TPnsz1Gtfbc46g1KWTmmaGuww== X-Google-Smtp-Source: ABdhPJwpQFHrvpwt076C/B60hfpgIoYWieUUFNJrKvBbE5BuNSwKXiWe++ylmqtUWZXuGmGRj9RTqg== X-Received: by 2002:a17:90b:3808:: with SMTP id mq8mr12220192pjb.85.1641505574987; Thu, 06 Jan 2022 13:46:14 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:14 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Xinliang Liu , Tian Tao , John Stultz , Xinwei Kong , Chen Feng , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 12/32] drm/kirin: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:35 -0800 Message-Id: <20220106214556.2461363-13-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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..00d47c784cbb 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -217,8 +217,9 @@ static int kirin_drm_kms_cleanup(struct drm_device *dev) return 0; } =20 -static int kirin_drm_bind(struct device *dev) +static int kirin_drm_bind(struct aggregate_device *adev) { + struct device *dev =3D adev->parent; struct kirin_drm_data *driver_data; struct drm_device *drm_dev; int ret; @@ -253,8 +254,9 @@ static int kirin_drm_bind(struct device *dev) return ret; } =20 -static void kirin_drm_unbind(struct device *dev) +static void kirin_drm_unbind(struct aggregate_device *adev) { + struct device *dev =3D adev->parent; 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 23:30:34 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 CCEC2C433EF for ; Thu, 6 Jan 2022 21:46:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244817AbiAFVqo (ORCPT ); Thu, 6 Jan 2022 16:46:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244509AbiAFVqR (ORCPT ); Thu, 6 Jan 2022 16:46:17 -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 0CF0DC061201 for ; Thu, 6 Jan 2022 13:46:17 -0800 (PST) Received: by mail-pf1-x435.google.com with SMTP id u20so3559315pfi.12 for ; Thu, 06 Jan 2022 13:46: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=FPtGNMfzlxXubKgayi75A1lRD5p2YHP9GYCHjNIhA04=; b=F/n1S4F8s3kPZEe2GW35Eidb0SesLDzR2YqgAQAZIHrdsevP1q9bknfHQTxF6SqGJm Nfl9MQ9rGKoXrK+IFOpOOh3SAwv6F1KaWuQD7pffTOrkiJO/cXpEdVGWkZZkJ3dX53Xr AdWLpJwFpppBOInDDUOP4omGqDFxmR1REDYFY= 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=FPtGNMfzlxXubKgayi75A1lRD5p2YHP9GYCHjNIhA04=; b=X9JxeHMKcT3K5BTiOAS2qQhKrrgLrobloq99epe/W4zR45EeOgo2kRbrADYWvEjJnp tm/7+4RA2s8+hr457g0teaNXOo0N5U5eS/QS2LygZ0A3hnr6XowHxOz7lSpLksbr8IS6 vtLMKSq9PtmZtTT/KHwAuaIzhUCP0jOA3G3Y/rhBwKaTesocmBzgjLETAGipfZaAI4H1 2tEAQHBVwCEtnp9QFolOyJ+fCl+1+2VwsOITK2WivqpxjUSv5m7YPW4QdS6E9H0qDrtq nWWpu5SzuVO+msqBQnhrLsP54XU2xVbZVamEMrrqmSFVqt1r64mKN1Kjlilp0XUMu7ac im7Q== X-Gm-Message-State: AOAM533RdbXJ7zOoyrnF0JqenDqBu30P0SBdaLaPBsWgxMcqJjKEidMi /2+6mEziHEdFYD3pSh+N6JavVw== X-Google-Smtp-Source: ABdhPJzDyXbJ5oiJeJM1+1uFcXWrB43YEPXT+ZHV9hULBBomq9G68oQkCiEkLjlw9Juc82HcneKgAw== X-Received: by 2002:a62:1642:0:b0:4bb:b3b6:c037 with SMTP id 63-20020a621642000000b004bbb3b6c037mr56659975pfw.50.1641505576581; Thu, 06 Jan 2022 13:46:16 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46: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, Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 13/32] drm/exynos: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:36 -0800 Message-Id: <20220106214556.2461363-14-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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 d8f1cf4d6b69..dcb52ec2bd35 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -253,8 +253,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 adev->parent; struct exynos_drm_private *private; struct drm_encoder *encoder; struct drm_device *drm; @@ -330,8 +331,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 adev->parent; struct drm_device *drm =3D dev_get_drvdata(dev); =20 drm_dev_unregister(drm); @@ -350,9 +352,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) @@ -365,13 +371,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 23:30:34 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 153FFC433F5 for ; Thu, 6 Jan 2022 21:46:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244610AbiAFVqu (ORCPT ); Thu, 6 Jan 2022 16:46:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244517AbiAFVqS (ORCPT ); Thu, 6 Jan 2022 16:46:18 -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 3BB60C06118C for ; Thu, 6 Jan 2022 13:46:18 -0800 (PST) Received: by mail-pl1-x636.google.com with SMTP id h1so3388651pls.11 for ; Thu, 06 Jan 2022 13:46: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=aOJT4e2/QJLKFjWixGXmSkqLgf4Tc1N8aTB3xOsamvQ=; b=ILyUjL86PabuV9iHfi1owzAuxjRlH7hKmctefUf5iFSmxQ8yCo6Qxg6zuq8+cH5t8y 8J0ddJ4qudUuoIlluaf9tgrxEAF9hlHaJrFhw3EfweYx2L4UlcukINHY/jfEMiup7Ohq 9Op19HAyziojbD0kXGY/lhxAXsVKWhFs600dQ= 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=aOJT4e2/QJLKFjWixGXmSkqLgf4Tc1N8aTB3xOsamvQ=; b=CzAYs3BnUdLgch64SGgdlUdhNbAscSLiMwEMKyg9VQxK5cSESa+JTkPwdGcfJMZQzq Yq8pwM+WvmegVrt6k6Ez1wTZyd/oXWD/1VkCBhZ4e855YO1j3C5PuXpV/eVsGOCapAUw D4HTOW3lipZKMrwU7rohJ70Id+FSMgwcwDpEFEXm7k/vdeY/dk4Hgu9v/V9s3/EGlOCp R7Gky0yODRZcRcpFg+fMy4fLF5412XIRS+zWN5jCJPELPUsLp6SZQ/dvHvpwgRLHhXRb hPzznDPHf3KBZ8J2ZBAlR4EA95cEjupLOZe+GFeuP/AlBTEeIrRFK7zXnqfvaRQTa400 JOaQ== X-Gm-Message-State: AOAM533pMiiEBrRo6pVw3S6WNJb9ASccssOZU8ZC69ac8KDYOSb+c87B RHgkU9EsZot2b65+L5vA0tOnOw== X-Google-Smtp-Source: ABdhPJwN2qnfcJ9KhRSA5B219O9Th4wHo5ZTmhjZ5kL2M3+vwlyvS8V9GWpKXf0xhxdnHdYNhmKZuA== X-Received: by 2002:a17:90a:ccb:: with SMTP id 11mr7745818pjt.135.1641505577797; Thu, 06 Jan 2022 13:46:17 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46: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, Philipp Zabel , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 14/32] drm/imx: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:37 -0800 Message-Id: <20220106214556.2461363-15-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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..9e28bb16364c 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 adev->parent; 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 adev->parent; 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 23:30:34 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 38541C4332F for ; Thu, 6 Jan 2022 21:46:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244533AbiAFVqq (ORCPT ); Thu, 6 Jan 2022 16:46:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244531AbiAFVqT (ORCPT ); Thu, 6 Jan 2022 16:46:19 -0500 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86256C034001 for ; Thu, 6 Jan 2022 13:46:19 -0800 (PST) Received: by mail-pl1-x62a.google.com with SMTP id s15so3382093plg.12 for ; Thu, 06 Jan 2022 13:46: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=InGYSc3cNsqSsbEpZp55brWuJhvXfCPzOPufF1ln430=; b=geLOtRrcQoNShAYeNnrLXdKjIYR/IyoWWTuGrcF1264GfVWBQDjYocRBDtHKboalxq NlTAMMOQOJWtQqd4AlM4yYS4LfOux498Qr26h5HftL/q+OXekddI/VN4Haa1FCK/z5RP gUcg6RWh+0P8My25yDkFJTmBsIp4LYuwUytzo= 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=InGYSc3cNsqSsbEpZp55brWuJhvXfCPzOPufF1ln430=; b=knNkOcp8HvYlQYIVJJ+oGkCCwWx4CdhJ0Q2LNjI5dY2FEp21d5WU43q5EbwpjF3a4F 7hKtoaKUkudXSgGNSYZvrSznByDT9oA1bhsdHuxLGg8CbGerZqZRhVZLCDzYFKQ8Bs2y +4sa/e1N5Ukf+iHoOqFwVR0L4MEnhTX79JGoqnda7A7CHjg3vsVKFaiiNpzO6HysfkiE X7BS4QIgx9MKEAnZotws2r0rNcNCdQtJ71ZVEt3Y4Vgh+4bTkjDp8nEnPYr8dw7D9+ZF 1sCELf7cujNaYwampaFomVsJr9nloULlp6pedwuIiBdHgWiC/h8TpN4tmfl3atWMa5Am QWrg== X-Gm-Message-State: AOAM530lXHQ2CrPudt1BjibtVBhMiSsONdo9HrOQsnkE/7XelzH89KEF ZedWMoVNNAuYF2D+RKn/hScf/Q== X-Google-Smtp-Source: ABdhPJwrShL+WZS7fPjcU075+enEcp4MYi8BqFoh3gQpuVLFA/IeRy1wIlVUMeG2vPpOi4h7WK1MRQ== X-Received: by 2002:a17:90a:4482:: with SMTP id t2mr12123132pjg.133.1641505579072; Thu, 06 Jan 2022 13:46:19 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:18 -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 v5 15/32] drm/ingenic: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:38 -0800 Message-Id: <20220106214556.2461363-16-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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 a5df1c8d34cd..d5330fb486e8 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c @@ -1150,8 +1150,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 adev->parent; + return ingenic_drm_bind(dev, true); } =20 @@ -1174,9 +1176,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 adev->parent; + + 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) @@ -1196,7 +1209,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) @@ -1206,7 +1219,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 23:30:34 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 84976C433F5 for ; Thu, 6 Jan 2022 21:46:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244876AbiAFVq6 (ORCPT ); Thu, 6 Jan 2022 16:46:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244545AbiAFVqX (ORCPT ); Thu, 6 Jan 2022 16:46:23 -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 D25DCC034003 for ; Thu, 6 Jan 2022 13:46:20 -0800 (PST) Received: by mail-pj1-x102b.google.com with SMTP id m13so3557443pji.3 for ; Thu, 06 Jan 2022 13:46:20 -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=RqazxdkkitgTin4SJ5P9dnD2fQGX/sBsDUPb6a/Agwo=; b=UF0V8/d2dqEfdB7HCgBN7DdYJT4+e8BJM+MYJD8k8/fO68+IUWBGZ6JkAsJJkh+FnD vaXLGgHFYVWFjjXVyQxkteffvW9U/hth0QeOEhOrAMeeMNR5ObgSOlPQix0JS2mt5/gW apV2grR0P52r0odyd0kdBpYKYJYhO3qZDpkHY= 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=RqazxdkkitgTin4SJ5P9dnD2fQGX/sBsDUPb6a/Agwo=; b=XcZmBnpleBW/bJjaPcTEJAXWHfgSC+p/sjT4w9XglZqux1c7Q/avkuzV61mwrtMdue YpwWM6q4W9z5BNWXECkCTzNQ0qX2A1oVXEY/NX9IN6ihFrP4w86bvmaH/vHuJTKPxx7c g+8sUTUPMc/KTnvdflg2iFDRKJYAIhRqXwxvEGET5+flRf3R+AheESMumqJPxvbG4I2r 6slTgEvMIsOeUMEc7Xxmk99tST9hE5JFSFHLr9sPdq1RBgeWDaWfpj1NXmQl2PVSd+6+ 35onylgeKME1Z5Cu11FAw/EzBailRJLOtAl2enIbHW3eP3GJwQWpuwM9+BtbTRz0WFBl 32vw== X-Gm-Message-State: AOAM5311rfsy9BggVYiLI4XtWKqLrULs0LjNdySnJqpeTVAa/x0e87cM 1v3li7UKbTTmTuy4G+TJp/b1ts19e5C89Q== X-Google-Smtp-Source: ABdhPJx3X6P0Se4Tp7Ye4XYdLYrIonMHZGBXV1H/Uf8y5UHsJsIHUkaZumNdcF/jAe2cmmNLHsWLzA== X-Received: by 2002:a17:90b:33cd:: with SMTP id lk13mr12189005pjb.35.1641505580410; Thu, 06 Jan 2022 13:46:20 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46: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, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan , Linus Walleij Subject: [PATCH v5 16/32] drm/mcde: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:39 -0800 Message-Id: <20220106214556.2461363-17-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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..1652f9e0601d 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 adev->parent; 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 adev->parent; 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 23:30:34 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 57205C4332F for ; Thu, 6 Jan 2022 21:46:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244690AbiAFVq4 (ORCPT ); Thu, 6 Jan 2022 16:46:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244557AbiAFVqX (ORCPT ); Thu, 6 Jan 2022 16:46:23 -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 1B308C034006 for ; Thu, 6 Jan 2022 13:46:22 -0800 (PST) Received: by mail-pf1-x429.google.com with SMTP id m1so3574865pfk.8 for ; Thu, 06 Jan 2022 13:46: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=SfmZAoSN1UYJWac68o+RmufoyphUhdu5prdrSebp+yc=; b=j12IJ9pTqCtVF88a8jspHlxmCl2AnRMMMJWTTo4mBdXh00MZSoo3H7jgEFsCOOVHmo 4W45zFTZyNZEgqpwY0w7aowWRRbTJfMxEqzMpB9QfIvvjZxRopqkP3lGZwAf4pCFaRTl 7KiNpYoUCCQ6P8ycDcCPsYHiST/atI3r4Xjr0= 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=SfmZAoSN1UYJWac68o+RmufoyphUhdu5prdrSebp+yc=; b=1gG4ZSt+15SSlUeVpmv9mFdllPKvRByimzkQce/skbiZRxQhPicmvnl4owXXwP6c9X pQXubm+2cFpEWpJ/4rlBA8MynCmOM/oBhwEsUZVKJaJvkFGe+AWTVdxMGm+6oWnDM63d kcaY2Tn/3RgFEVsKDzoPLdN/6URD87B5+iRcM0LZJcJ/0JsK4VeY5RKhTzwTjM8Gztmc +rapneZ55tfIpBllZtsLAQPVRaPk1GC+0OwYyhmmyqUaapSUc0J6adYW7imv0D0IC5zl csAtTBAmFMO/LlOa5Hoo+W4cffJ9YvkIbWJuf4n0IiygEkcCqINsV58v8gEwHaMk6Dso F3lA== X-Gm-Message-State: AOAM532LyPPZsYga6UD479Ybhy76EEUXdgG/NwGcjUmiJiPcsmSBJy8u 19dqKcfyOg4KNdwL1vGR1DSMvw== X-Google-Smtp-Source: ABdhPJwuXTdUklcvp9RqipfrZwSh8trfMd3qwsc0+IRabadi0IvcA1TEUJc1VlZWI75ylSNT1Qex5A== X-Received: by 2002:a05:6a00:1a43:b0:4bb:8507:9568 with SMTP id h3-20020a056a001a4300b004bb85079568mr61382924pfv.42.1641505581688; Thu, 06 Jan 2022 13:46:21 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46: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, Chun-Kuang Hu , Philipp Zabel , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 17/32] drm/mediatek: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:40 -0800 Message-Id: <20220106214556.2461363-18-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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 aec39724ebeb..a3f27b8c9769 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -348,8 +348,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 adev->parent; struct mtk_drm_private *private =3D dev_get_drvdata(dev); struct drm_device *drm; int ret; @@ -380,8 +381,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 adev->parent; struct mtk_drm_private *private =3D dev_get_drvdata(dev); =20 drm_dev_unregister(private->drm); @@ -391,9 +393,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 { @@ -593,7 +599,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 @@ -616,7 +622,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 23:30:34 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 B19E2C433EF for ; Thu, 6 Jan 2022 21:47:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245003AbiAFVrE (ORCPT ); Thu, 6 Jan 2022 16:47:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244424AbiAFVqX (ORCPT ); Thu, 6 Jan 2022 16:46:23 -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 49337C061201 for ; Thu, 6 Jan 2022 13:46:23 -0800 (PST) Received: by mail-pj1-x102d.google.com with SMTP id b1-20020a17090a990100b001b14bd47532so4590921pjp.0 for ; Thu, 06 Jan 2022 13:46: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=0P0B2t7jpcQb6RReBEhUJcwiQBX6wggU1M1usRBo/kI=; b=OMmriz8g6SqvUhC+jJKguXZPzeNbrMkAffwjErEk+CltWZ6StTRLM1QhiC5eJkz90c Z0YD413vMw0bVDIg90Vurus2guUNuLOOw7WxT2Ux27KNw3xAswtMH624dH2SEC/F2Yhx VcAd0TKcwWLB7s5I7sk8rCos61gT5buuj5b2Q= 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=0P0B2t7jpcQb6RReBEhUJcwiQBX6wggU1M1usRBo/kI=; b=sweeSJwfavW5OLd7XVEZX8JvRWIq/ip0myZ4wtq/RLADqPNg3JkjptOALs5M2JUESx BelILuvzDE+0fSK8YHqr41gD85HQgvqL8TuD9xnrL0aK4ombvILtH0uEeUhrrBz5FXf7 F5QSs9Njc0iHaKwHPLWFcUqR3c8BO4Lu5uGC5zq5vvqOgORWvUmer8KDEnHhp1lmrw17 RkuDnPMC+mU0CppLXg38i2Smh23UcRvcaiOoxuZgvX7Z87IkTKOoX3r9IczMB7EgpgB2 q3SZ/p/b7/gpR2Mb2L/IrsZ2O9g5fp+7bs4VJUJCwwQVK8HCMGgst/DZblx8rLY3epiA HEAw== X-Gm-Message-State: AOAM533hQBUy0SbtIWH8j+CWXExS2Tw32zPNjsL3kvGrKMXwd709C6yh kO4faOoTiJkX7rPhvguMH+vbaA== X-Google-Smtp-Source: ABdhPJwevDLAx3RQTtIwgYxJoTRsVhvDf16aEqPPEqco33SsVOKqwUE3w+uhW5OAbjFhWL2saEpvwQ== X-Received: by 2002:a17:902:d645:b0:149:b7bf:9932 with SMTP id y5-20020a170902d64500b00149b7bf9932mr22561186plh.48.1641505582894; Thu, 06 Jan 2022 13:46:22 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46: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, Neil Armstrong , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 18/32] drm/meson: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:41 -0800 Message-Id: <20220106214556.2461363-19-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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 7f41a33592c8..3028f2a45f66 100644 --- a/drivers/gpu/drm/meson/meson_drv.c +++ b/drivers/gpu/drm/meson/meson_drv.c @@ -356,13 +356,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 adev->parent; + 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 adev->parent; struct meson_drm *priv =3D dev_get_drvdata(dev); struct drm_device *drm =3D priv->drm; =20 @@ -386,9 +389,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) @@ -502,9 +509,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 23:30:34 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 E765DC433F5 for ; Thu, 6 Jan 2022 21:47:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244944AbiAFVrA (ORCPT ); Thu, 6 Jan 2022 16:47:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244569AbiAFVqY (ORCPT ); Thu, 6 Jan 2022 16:46:24 -0500 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95E3DC034000 for ; Thu, 6 Jan 2022 13:46:24 -0800 (PST) Received: by mail-pf1-x436.google.com with SMTP id v13so3593897pfi.3 for ; Thu, 06 Jan 2022 13:46:24 -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=6IAciPlNRPfkJgo3LSljGMR1t9yoWVxJAu5cqfoLKs8=; b=Ui8wQJEmkOFa0mFXYEgsE6oEWR64bOCZFpPJNPhPReKZqlNYesA2A+Uh5/rpMcQa0g GZqntZqMXJjU6tk3qMd7yAsZ4uJw2LAT9Atbjj4E2NVaZRSW1crPxLfyrCrUCAYjpM7K A9PajHMZd8Q4KNCfPqvbXO1U2yICRGXb1wWfE= 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=6IAciPlNRPfkJgo3LSljGMR1t9yoWVxJAu5cqfoLKs8=; b=0xNtDLLzHlOFhKIjapH0vhSvr7ubIKNFeYo5pno8cwBYZx1LdMFsZ9F06XLNrjtl+T jQxZeSanulbXd7I5IYVQhgjNsI7p0D9pkeRHFvrzwx1IXO2X4o7VJhLkWiWbjcRW4TUp cieZ6E/zfPKpJmJxJusX+S77p5I1F4ezCejLcpKlFPBykzxmmc8nfJ1ybY3ErLuY+3ZI 1jo8jYGss+B4C1NQERlLuVhCHcz+L2ybm2tvOB5EHmBEguIO+Xq+s6o2ml90bmLQenXT 39nshCQA5WIUsJk7LKl00oASdf0XtErqS0WTsWdGiyWhNOuiWgw79djRd8pr7wEbQyEN gy7A== X-Gm-Message-State: AOAM533Z4nydJ0fnsPRN0FfI+pc0NGLcy9LyuNANS37AcqE4y1DI82Di v1GeLSH8IugVb+m2/3Jkc3k0Pw== X-Google-Smtp-Source: ABdhPJzWq9RI710y90K8zf1uJwBYNts69ZS6HDcA6iBGlm/u3mYDFqh9Vm6XQfwp3ev4pTauXgTU0g== X-Received: by 2002:a63:d314:: with SMTP id b20mr54174333pgg.207.1641505584138; Thu, 06 Jan 2022 13:46:24 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:23 -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 v5 19/32] drm/omap: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:42 -0800 Message-Id: <20220106214556.2461363-20-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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 d6a5862b4dbf..9328d97f19ab 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 adev->parent; 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 adev->parent; 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) @@ -1504,7 +1510,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 @@ -1543,7 +1549,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 23:30:34 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 8AA02C433FE for ; Thu, 6 Jan 2022 21:47:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244735AbiAFVrH (ORCPT ); Thu, 6 Jan 2022 16:47:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244734AbiAFVqk (ORCPT ); Thu, 6 Jan 2022 16:46:40 -0500 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8BB2C03400A for ; Thu, 6 Jan 2022 13:46:25 -0800 (PST) Received: by mail-pl1-x62f.google.com with SMTP id l8so1196197plt.6 for ; Thu, 06 Jan 2022 13:46: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=44Qv1WEc4fBQtGQZgnR/7aRXBM5nSt7tXrgm1eHf/P0=; b=niK0EojGGWtp3v8hwFYBHDDVJkwIXfLIQ83lTuBY59xb19zCWoyJURj4sTcDU35y7Y KVZQW/BzuJ4V+wA8RKDZtqP+W7U1KDmr5r3VJ6uBw4qwiJiVqI2yQg3vB5On4T3wXRU8 OX+U4PjmZnhOgK4nAHA65avAkaz0oUHuqM3os= 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=44Qv1WEc4fBQtGQZgnR/7aRXBM5nSt7tXrgm1eHf/P0=; b=ffpHRTsUjmlLMmaxGypXj0JDUrB6lADGTjnhzlrcFJ2VhTbISv/9oMyp7uONAWc6nr HmSK2qTkejUjoaRIKA3mbo49El545LHwdrJCEtxRbxuA0x8aKNlQkSy0MXW9r6Xxuimc 6fBCf4pNDJQk44uwJrHeFx6z5Wyxe2Q1d8hxRlvJO5g8b+r+sXY4DSwQ/eRdakYMCFdX KNsN/r6gTYdDxVVHoFFqpSomAJOziewfN9NMkSUxTbSmvggSQ/tprwOlPK/Kv5iMHsjn 1G7cnDLd5DNqtWWHe1zzI++rMnYxRUOZwscpdAZ0wdsvBZg6xJENr4Mqukxqsa70/maV +mYw== X-Gm-Message-State: AOAM530xboBjWGxTtimUGeGufGhtpmPGFFxTo5og5gZO1ejhLWTP4yw+ /OgsuPv21i/22yDUEqU9M1Ip0w== X-Google-Smtp-Source: ABdhPJz2g3PjORGUq33Yccyh7naEWkhS7Y38LLqdLrUERFAXmoNOQLQqq3DhzN6ShCsGmaq/uSbn/Q== X-Received: by 2002:a17:90b:3c0c:: with SMTP id pb12mr12254066pjb.105.1641505585393; Thu, 06 Jan 2022 13:46:25 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46: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, Sandy Huang , =?UTF-8?q?Heiko=20St=C3=BCbner?= , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 20/32] drm/rockchip: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:43 -0800 Message-Id: <20220106214556.2461363-21-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-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 e4ebe60b3cc1..6c755361d376 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -109,8 +109,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 adev->parent; struct drm_device *drm_dev; struct rockchip_drm_private *private; int ret; @@ -183,8 +184,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 adev->parent; struct drm_device *drm_dev =3D dev_get_drvdata(dev); =20 drm_dev_unregister(drm_dev); @@ -346,9 +348,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) @@ -419,7 +425,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; @@ -430,7 +436,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 23:30:34 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 AE7AAC433F5 for ; Thu, 6 Jan 2022 21:47:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245394AbiAFVrQ (ORCPT ); Thu, 6 Jan 2022 16:47:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244738AbiAFVqk (ORCPT ); Thu, 6 Jan 2022 16:46:40 -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 360F0C03401F for ; Thu, 6 Jan 2022 13:46:27 -0800 (PST) Received: by mail-pj1-x1034.google.com with SMTP id c14-20020a17090a674e00b001b31e16749cso8543018pjm.4 for ; Thu, 06 Jan 2022 13:46: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=3a3i/nDaB8ZUdNqJ4VU8hWXyXTL7/wWiLoMS1h5NiSM=; b=fdvHO09XyrK1fRBMv6ZCuxZJEOBZEnRNlYv157RP6xvIBDI1KvxVfeWRIWISqNDWJy Mje3eRi4npSQNpDWJ9O/5uGZmlZQUlN1UZC4PK3FDQL/MgLM1GrU1WmJLfcElmnrOL1s 6sKDsY1CzavLw8ggHfgi4o17oPUIa2PeA1B94= 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=3a3i/nDaB8ZUdNqJ4VU8hWXyXTL7/wWiLoMS1h5NiSM=; b=YbIlFtH3DD/ev1q/ZIJkW5b78vgVmSyt4euvWXo7EeJFleBh1kSbfvO+A+NVkix4hu vOW+DsEAn/UZ8Njg8JTTH37Q0cuLkbvIz2pjv0EKPf7bzLhehI93vSLa2G/+rBA0Fepy DS6Q1ZpjqRs5dMR8mCNk4wn0u7U71LgU2fDqCbRe80fb4tHuq/bAGG2dbgRS6gkSSlaE zRomXKMp0N4jxTQo4EdocPqcSZtfgk6DlUTuofRUic7ENQm5poIaBJjZaV5pUtQNuLpW V1qi4OvME40v1nPqmVRJCCsqag4W9arNneob9X6tiplmpyhC1enS3oYGFWfs9XCTkM+S jwsQ== X-Gm-Message-State: AOAM532uMzkf7ArJUidIW8zJrNvEn5WxqXBR6/8zZgeh20k6YGJD432O rxckFhOAfi6wAi+R1nl+qx80rw== X-Google-Smtp-Source: ABdhPJwr1viR7RiIgdiNaWACG2FQzv9WC65+KPeGyqeBih/ukDD1zE8+KmCzZ5Vl/9CAHYBtTaRbIw== X-Received: by 2002:a17:902:ec85:b0:148:a8d2:91c0 with SMTP id x5-20020a170902ec8500b00148a8d291c0mr60254706plg.94.1641505586819; Thu, 06 Jan 2022 13:46:26 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:26 -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 v5 21/32] drm/sti: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:44 -0800 Message-Id: <20220106214556.2461363-22-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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..b277cc679154 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 adev->parent; 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 adev->parent; 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 23:30:34 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 00A31C433FE for ; Thu, 6 Jan 2022 21:47:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245139AbiAFVrJ (ORCPT ); Thu, 6 Jan 2022 16:47:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244740AbiAFVqk (ORCPT ); Thu, 6 Jan 2022 16:46:40 -0500 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82CA1C03325A for ; Thu, 6 Jan 2022 13:46:28 -0800 (PST) Received: by mail-pf1-x42c.google.com with SMTP id p37so3594007pfh.4 for ; Thu, 06 Jan 2022 13:46:28 -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=qrvKBJr+DUbrISc8WyZICnsdtffozhNCQiB3CMiYO5U=; b=YIm4yDL/DEzHEQ/KoisiGKXELBefTLgB6abDYKWPS//x1Mhw76BhF0i5M5H2ximQJJ Vr+KqieRuR4wHbR/hT46JfKeUSLg/gnc/Zpvg3isTAL8jjkmUUJNj1n7hA50mrOxpJIp aSKva71JsYpieNtNkDr58YeU8LeXNems3/iHg= 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=qrvKBJr+DUbrISc8WyZICnsdtffozhNCQiB3CMiYO5U=; b=WNpk7cewdg9nYZ8DpgEJoGLXlRyBfIlRFNNI1lb8Cu9YPNhzltvYkMJDF7g8+PWXBk /FXzva2mSVImsFen8dKFOEEJNc1hK5hisWE/Ose++4EFGfASbGlqSVWlSJWNVbdbArjb xZRw1IpwCWd+UYxm+j3lFtmjvot663229P8eiKAGQemTCRS7Ei7lZZoniZkFtn6BwoWl lQYuFjKrr73os4AVIc4II3HvOj2kvFKnj2N1NxoULeuQNbMo6uXhSTIxVR/7VKFsDUGU wgmGnHRhzO/D3Ul5Q3fTde2QTxiar+OtZSKh09JHcJrGOjVoSdfWgBrautL57YRsFmUy 8iIg== X-Gm-Message-State: AOAM532DiSnWZ071Y0TKI5bD9Dc1hfTGIPhCBNNmV0Lra8ghrpEFG3Tr COaw5kHNO8ykfBOKJdhz6QQL0w== X-Google-Smtp-Source: ABdhPJzb1OQ9XAYSMCSxVIyMkn4sVO7K/RXDTcJbr0zEftWLLjfJcqfaTtD8//YXtBqZkQi6QNLBPw== X-Received: by 2002:a63:b257:: with SMTP id t23mr292463pgo.335.1641505588077; Thu, 06 Jan 2022 13:46:28 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46: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, Maxime Ripard , Chen-Yu Tsai , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 22/32] drm/sun4i: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:45 -0800 Message-Id: <20220106214556.2461363-23-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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 54dd562e294c..700f5e32eaf7 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_VMAP_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 adev->parent; 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 adev->parent; 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 23:30:34 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 F372AC4332F for ; Thu, 6 Jan 2022 21:47:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244778AbiAFVrM (ORCPT ); Thu, 6 Jan 2022 16:47:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244753AbiAFVqk (ORCPT ); Thu, 6 Jan 2022 16:46:40 -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 CB111C033272 for ; Thu, 6 Jan 2022 13:46:29 -0800 (PST) Received: by mail-pf1-x429.google.com with SMTP id t19so3571634pfg.9 for ; Thu, 06 Jan 2022 13:46:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wlRODoqLGygqE0LYiWEnBFh9kz/XzAvDsSAOOxu5peY=; b=GzZNEOZnJdx2UbmWqTs91g8v1Ek0T36tb8wTW6K2/HuA2Ir6bJylKpR1VTJD3+cT7V RR8lNKHT3YDRZdKc5H88k1lnvbdSlpls0QxgraRDcDW1uAlIThvxYrNqx4dC/ptFAYRc JoQKpeNyqCvuEgmtHzLaPPcwVTKqyhbnb66KA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wlRODoqLGygqE0LYiWEnBFh9kz/XzAvDsSAOOxu5peY=; b=Rjc76YoJyhj1s0bVQz0/ntMbyCP8dgjxx39969PRuKCDeOl8pp2zOEaQOoLIi/fB7r 4D8IKsGLrKasCU0bmwzuuttvHm7cZBM0iAEeTvtrkLQnfdXf1ulEANXxztCJB/ewB9+y n+uKHwQyuRqm8VQn0VxTu/PGaCw2ekDxlOJoy0t6U1dE0tOqIebrMdQEJuNTTGQPGieb lBBeq/hnMbyLeFSXG+PSrey8+DhSoeeJ2gx15U1eofefHJnYc/dpvWGuHl8iDVCJ3M+z FNqM8gwEL2pdx3G7XPEIJplG1WJNUzZamajSe/sM7slMdc9rC5W/8yx9+Inx2mxfuXOx tnRw== X-Gm-Message-State: AOAM530W1Uj/GKJTLOQBirn3yNXXVQgiY1jBdxWpXc4Tompx3tl8aSS0 0tCK3GB0F9XG/bIejcgexEguWA== X-Google-Smtp-Source: ABdhPJzQWO1uToj3tzBAQVjFHovHCVWrij+0CQbi4cIY9ccyePU+NaIcQKFL9LXXbASfdxbaDHhvhA== X-Received: by 2002:a63:8042:: with SMTP id j63mr53527969pgd.454.1641505589406; Thu, 06 Jan 2022 13:46:29 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:29 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Jyri Sarha , Tomi Valkeinen , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 23/32] drm/tilcdc: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:46 -0800 Message-Id: <20220106214556.2461363-24-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 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..92ff516fb6de 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c @@ -529,13 +529,16 @@ static const struct dev_pm_ops tilcdc_pm_ops =3D { /* * Platform driver: */ -static int tilcdc_bind(struct device *dev) +static int tilcdc_bind(struct aggregate_device *adev) { + struct device *dev =3D adev->parent; + 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 adev->parent; 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 23:30:34 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 CA815C433F5 for ; Thu, 6 Jan 2022 21:47:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244485AbiAFVrW (ORCPT ); Thu, 6 Jan 2022 16:47:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244761AbiAFVql (ORCPT ); Thu, 6 Jan 2022 16:46:41 -0500 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12BF6C033276 for ; Thu, 6 Jan 2022 13:46:31 -0800 (PST) Received: by mail-pg1-x52c.google.com with SMTP id t32so3733002pgm.7 for ; Thu, 06 Jan 2022 13:46: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=pXQku93D/rC4XyQwRyjDG+Hw8yXvhZdjZb839YbIyVI=; b=XNFvfrQVoCRkJsg0UDXwhqksdjN1M3Wn/j+UApsuk0/AmeJfmXR3Fiu+2LJd/rRR2L shwEpidpjJPREQx8USWBQtSU/rpnGZD7n9Hcl3MmF+Fi8BrE8hW1b2fzsqkLDXryTfvX IgpGdRMknXm0EoelHiL4T0fIc56a2EyUJNVjA= 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=pXQku93D/rC4XyQwRyjDG+Hw8yXvhZdjZb839YbIyVI=; b=hZYPp0v4dkdulTmUHn0rhHE1aZFgftJj1/K4njaYyvJoMq5oiYWDOJTY/gTPpzfH7K eF61sS3ZSVxQKMSVzAUa4QWs5naxW6SAaJNBVfKAQE1LoFDNsUVHIFNcBQsaVP/m3PaH wupOw9GfGz6VjPTAksmFLtEcIZ4REVly6KEuMhSVwOtzamaG8yqZUOberCfqtVJhH9oI Ow70Qf1T5wKz+DznLuk2Q9j1qtWjx0UXg0RLdYFyzLYUDwFFXFeyF5jlG6+F1DIcaVpq UcPFOFiTbHr+pU/aj0wHvec2bQ2TrN2F/CyW7QtWNjcPED0xvi4JCaXHfewaz8Nq3jbR P2WQ== X-Gm-Message-State: AOAM531wHXeeFf+mgEYiNhM59Piw4VkY8JtrnGomNarX0JVM2czTuoSB uiaI6uA/eCZDqNL3snNudL6c4g== X-Google-Smtp-Source: ABdhPJzxEXPWmecqAT9M5vPs4YoQa9EQGMGNVPF/F/pdV8VYbPk2PnOFg0Jind+8jOkQzP/e2LpMfA== X-Received: by 2002:a63:7704:: with SMTP id s4mr7298509pgc.422.1641505590634; Thu, 06 Jan 2022 13:46:30 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46: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, Emma Anholt , Maxime Ripard , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 24/32] drm/vc4: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:47 -0800 Message-Id: <20220106214556.2461363-25-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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..82a44ebf9121 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 adev->parent; 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 adev->parent; 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 23:30:34 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 F2FDDC433EF for ; Thu, 6 Jan 2022 21:47:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244582AbiAFVrY (ORCPT ); Thu, 6 Jan 2022 16:47:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244765AbiAFVql (ORCPT ); Thu, 6 Jan 2022 16:46:41 -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 51BD4C03327A for ; Thu, 6 Jan 2022 13:46:32 -0800 (PST) Received: by mail-pf1-x435.google.com with SMTP id m1so3575132pfk.8 for ; Thu, 06 Jan 2022 13:46: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=Cp/sB0csPJfGnASpc4rymZ0PPQPzUhdhwUtGaGHpcvc=; b=hh951AuDm1lnuTY6Tg2bk0JqAZI+SXik/wKYCanK/9z21XaxR8dcVOq5HuTUHvXX+4 BA5DB+cYLOeFa4Yj/qhEHktwsW51FrcAvaCxu93fkpHy98KKRByaAlCqq3LMH6f2Yesv syDwoIVXJ+hcSDIJ+jirliEw4GXQyzkO5KEuA= 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=Cp/sB0csPJfGnASpc4rymZ0PPQPzUhdhwUtGaGHpcvc=; b=LBmeJfA4p3Bn/znDU6INtw5ZIH9q+2ljtSsY/pyuZl5rEjIGmWE52o8U5iXOqJHGFS u9yOT77YIpmn+RkNaQA8D0iqXgdBdKyTK5JxV7JOCOd8IvPjlMMtPLeWMo9FIVDGAwLT RhnnTiyGC5VhX4aD9h9zKaauDDG0Ii0Ygq3Fa9rWwHqqpkVH1wo3MxaMTy3R+d19PcQb MLAKlI8wK5RXsFIAObYmhaa3mp+Ltgq2E3YuGIWPfpKOMbJCKg1nE9vMC2mjXuCQOIOR wG+DpI5JAsuA2Yo5BB5cPK+RFcA/lTgbyTlEC0ZlpFY8HfNXq2RJX5Njzb14s5V1ECs2 ervw== X-Gm-Message-State: AOAM533f72wkWDKFVnRvL+RBnx+hQfz1SVU0UcSMQzl9xEv+XBf3TP4G Km8e1qmufVGAogNSUxc7SuK2TQ== X-Google-Smtp-Source: ABdhPJy9dQQssWkM2CNx3zabLk5PMLLArRIIl85gPr/Wn1u8evvprhCEN6jMJEhMiz/HIX7vMXU6aQ== X-Received: by 2002:a63:a744:: with SMTP id w4mr31926122pgo.142.1641505591920; Thu, 06 Jan 2022 13:46:31 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46: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, Yong Wu , Joerg Roedel , Will Deacon , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 25/32] iommu/mtk: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:48 -0800 Message-Id: <20220106214556.2461363-26-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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 +++++++++----- 3 files changed, 22 insertions(+), 12 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..064fd4f4eade 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 adev->parent; 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 adev->parent; 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 --=20 https://chromeos.dev From nobody Tue Jun 30 23:30:34 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 A406EC433F5 for ; Thu, 6 Jan 2022 21:47:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244843AbiAFVr0 (ORCPT ); Thu, 6 Jan 2022 16:47:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244785AbiAFVqm (ORCPT ); Thu, 6 Jan 2022 16:46:42 -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 C1152C03327F for ; Thu, 6 Jan 2022 13:46:33 -0800 (PST) Received: by mail-pj1-x1035.google.com with SMTP id y16-20020a17090a6c9000b001b13ffaa625so10052060pjj.2 for ; Thu, 06 Jan 2022 13:46: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=SY5czEkZfSXZIjPhPgnaI25Y4JCRgE9mkB7SIRIjEMg=; b=VxInkVCtolIWlq4R8QhvD/B10sn9O/njUd1llzYE5tSI1+64q39+wd0nI6koEltTwm IDPskNz5cPBuRF9OnIJ7STgOnfbM3jQ6hinmHIcfdplmICrQIXXrYOPRsup2vEApwWZK 9YE1KK8MCejGRFHSfn+968gZuTnXgOIy60/Pk= 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=SY5czEkZfSXZIjPhPgnaI25Y4JCRgE9mkB7SIRIjEMg=; b=rP0LhETQvPL5ssQhlhZQuUgKYdUQK/sTMQjJ34+q+3uVg/rROiL5IMvv8K2mhCc27m Ic4d3ZGYBok4dhKxTxMcKN0Y46ZBsCKfBvcsNGMisKVGzKipeGk7grwBaZU+Su1FutJw PWjyA3rvtr+ZBX8yV6EpMBVELjTD9OmF5R1nqPBlgmAkG1RSq2WP9D0CA4fu3aCC6aC4 UHB69hTcpftq4URfIf7deLRey2dmNFv4He9mbonL46pjoNbBO9YG0wVOEG5SocRkoiCf nO6Ma5AUPAuFVVh/OoaObd7hqWmM7faJgSvaWM4A+jisssi9RXwBcJb27Eqj2zOCI5DJ Pzug== X-Gm-Message-State: AOAM533s7PIY+iT7bYDGRf9NNfcxT/8PNOTYElRXF93sLta18qjNqtrO KfNio8TF2cB9rmElJvB0FUCvkQ== X-Google-Smtp-Source: ABdhPJwbg2UnIYpSvTBjjmfX8M65IZWtqUxOoJ5gDXa1KlR3zVKOJxoCt6FBFaaECG9hMQCbkgFNcw== X-Received: by 2002:a17:902:6bc9:b0:149:fdf1:f031 with SMTP id m9-20020a1709026bc900b00149fdf1f031mr2699589plt.58.1641505593321; Thu, 06 Jan 2022 13:46:33 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46: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, 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 v5 26/32] mei: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:49 -0800 Message-Id: <20220106214556.2461363-27-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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..ae903a09fb06 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 adev->parent; 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 adev->parent; 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..7b7bd7c0e8b1 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 adev->parent; 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 adev->parent; 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 23:30:34 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 9BD82C43219 for ; Thu, 6 Jan 2022 21:47:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244452AbiAFVri (ORCPT ); Thu, 6 Jan 2022 16:47:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244698AbiAFVqy (ORCPT ); Thu, 6 Jan 2022 16:46:54 -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 4346CC029822 for ; Thu, 6 Jan 2022 13:46:35 -0800 (PST) Received: by mail-pj1-x1031.google.com with SMTP id l16-20020a17090a409000b001b2e9628c9cso4538960pjg.4 for ; Thu, 06 Jan 2022 13:46: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=XGqq0UfufzgH1LXDtnLjAQyDmHk5g+0Lk09sKMzlfmI=; b=AOWN7v58HvJOqlZ6lHNZHE2A28mPb4zKe2Mj9bTZpwUh+HozXtTE3jJKFaw47lD3eY 5NtO2Oi1pTx6/Avl2BGK7Xwjzdc8hSPXzduFzhd2fF7rpBHqfzUQDhHs4/BcY7K7tS7F 0U4tA0tg9yLN38FNIeknPel3KIr+eOw+2+HBw= 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=XGqq0UfufzgH1LXDtnLjAQyDmHk5g+0Lk09sKMzlfmI=; b=a6Zwd7or8KfiZe8xz421Bq/RrWRjgNqJOAcD7sjdzDxOIj0Hcc6Q30DtLJLk4GYXjn BHYooR7eVbC0FP1kRpXXzGdUAvSP/kUpzDA0LAKW3nB7g9vzSMjkqsNzH7TLO7CBn8yJ zqS0XDgftjoyQGLVGA3uZyAD2psuDEj2p7kkhQ4nyglb+oF7ISPkqnuwMP7CxYX3Czs6 izY7Ni5McmHLrQVT7G6diCWi3oWzibNftelr5Xb/bXepIxpvsA24hyqAoGXtvz2jl0PZ 2Fl613+s+Rlrxdv39IgcIRg1UFbdXsTek55mD9WHR5izEnKuo6vdfRIInpWkkUJGsFXG +DzQ== X-Gm-Message-State: AOAM531gJRL4CeKT2kVr2BkYVpHG7ItvXcEiVpnsUcBmYZyCjyJKOzoV bmES3FtaX6uPYx4s8P9K22/yzQ== X-Google-Smtp-Source: ABdhPJxsrSp0V86crFp4pzNtzJwdoL0M0g2Krz5WE6X1drEmfa7npHt6A/QP0naMp9HjGxQ1EzBxtQ== X-Received: by 2002:a17:902:ce85:b0:148:d590:5734 with SMTP id f5-20020a170902ce8500b00148d5905734mr60400961plg.1.1641505594793; Thu, 06 Jan 2022 13:46:34 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46: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, Sebastian Reichel , Linus Walleij , linux-pm@vger.kernel.org, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 27/32] power: supply: ab8500: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:50 -0800 Message-Id: <20220106214556.2461363-28-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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 15eadaf46f14..52d4105e28f2 100644 --- a/drivers/power/supply/ab8500_charger.c +++ b/drivers/power/supply/ab8500_charger.c @@ -3312,8 +3312,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 adev->parent; struct ab8500_charger *di =3D dev_get_drvdata(dev); int ch_stat; int ret; @@ -3354,8 +3355,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 adev->parent; struct ab8500_charger *di =3D dev_get_drvdata(dev); int ret; =20 @@ -3380,9 +3382,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 { @@ -3663,9 +3669,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; @@ -3688,7 +3692,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); usb_put_phy(di->usb_phy); --=20 https://chromeos.dev From nobody Tue Jun 30 23:30:34 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 AB160C433FE for ; Thu, 6 Jan 2022 21:47:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245012AbiAFVru (ORCPT ); Thu, 6 Jan 2022 16:47:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245028AbiAFVrF (ORCPT ); Thu, 6 Jan 2022 16:47:05 -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 8F719C02982E for ; Thu, 6 Jan 2022 13:46:36 -0800 (PST) Received: by mail-pj1-x102b.google.com with SMTP id y16-20020a17090a6c9000b001b13ffaa625so10052175pjj.2 for ; Thu, 06 Jan 2022 13:46: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=7Yh3mBEg2nfQJzEtBIxus+8u5VcBe7iEDAWACHn4tN4=; b=bQgFVNcdsjnA7zW9FFXSITmcWjYkWGAB8wIRURyJ5ti0xuNPsSAy9ghoYEb1syKKJs CGLf/Q/oMrQcJwXU3CDgbPhlA20klKs2lFHi/PEmoc8VHgh96v1EkUV6JppBc9bUOpOY flarDI+B9t/W/Ty3wNZQQPlH80IiRnLiaJXmQ= 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=7Yh3mBEg2nfQJzEtBIxus+8u5VcBe7iEDAWACHn4tN4=; b=5y2mqkkIiY9b/b7P33vvYpdmWnAPIMLrLlngodKxignkacf51FvrrTTR+Q4Qko8pCa JfixgZaXUp59Wsr7kB+HNYE9ngmpImnvtKvyV+SyaHlqz3PE8hcRltbuO3caGzINhu7l PNP3R0/HmCf3VXB7fB33WsEmW9gBA4nGI5RxD0F3+9IS3ec+OKqJJt4I/Rk7IrDsOOkf /JShNpQN3fQGHxY06VGR5gLJZKn7yYwO+yOQpqRIIDYpi9NwV0026o1XE7H/kznXH8sV eB50B5mNSLfp7yCaN6yj/yOs4y3ZWx+OQBC/RhI/kVVb7CIMOsDma96HbsmUkRVZWUMI YKPg== X-Gm-Message-State: AOAM5333Zld1DLhzk1wVDZaUGb2/1Z6EUaMR4VHKpXShnUg2etxVm7DM mPcgljB8UpUHWMO0sBo+7TxXEA== X-Google-Smtp-Source: ABdhPJx3yLhPBYfq8wjRHSBRsuhDLs2BYE0BBSiTReIZmuvnjn2UxO8YtDDtwxw4qwXOdHpY78HYvw== X-Received: by 2002:a17:903:188:b0:149:512a:e69c with SMTP id z8-20020a170903018800b00149512ae69cmr60164734plg.40.1641505596109; Thu, 06 Jan 2022 13:46:36 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:35 -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 v5 28/32] fbdev: omap2: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:51 -0800 Message-Id: <20220106214556.2461363-29-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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..f12663c39ceb 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 adev->parent; 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 adev->parent; 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 23:30:34 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 AD436C433EF for ; Thu, 6 Jan 2022 21:47:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244725AbiAFVrx (ORCPT ); Thu, 6 Jan 2022 16:47:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245033AbiAFVrF (ORCPT ); Thu, 6 Jan 2022 16:47:05 -0500 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E380DC02983E for ; Thu, 6 Jan 2022 13:46:37 -0800 (PST) Received: by mail-pg1-x536.google.com with SMTP id f5so3714993pgk.12 for ; Thu, 06 Jan 2022 13:46:37 -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=8jRHJbzxJCo8C1IXTJW3KiTq5EwC3cp5SncHLYDZJzc=; b=eReuh+xB+HXBzjAmlsPahN/YBwZeiwW4QIPx8qKKvBXEEvys1EVlO9m8YzP72gI66e qReW+p/tESbPl3PSl0eoZtMZ/mshzo2n9jtYYWK++biQkqwv4ERl7RWDuKoAP8oc6i0Z MVoMd+DUtrBY0hMbbo04/s41zThIM8mqEE5DY= 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=8jRHJbzxJCo8C1IXTJW3KiTq5EwC3cp5SncHLYDZJzc=; b=IUzCalPCqtsp0nMC1ZKqGa9TRapfgnByiD2yf5l42zOB6yvO0KPncTQqA0/UcRe91e KtmuowBJaf2pTIQ2tQRQRwfWD5quw9Gc0t95PbYblBdADgUF9qi4sp0wuJTpHOJv3IF1 8GaBVzFs1VQgWqY1k8cy2UwEQ/IfwKBtus9Tbi6CGEqoty9+MFvHGVuW1TSPznNI3xAq feesbjYla7VR2U5amhxuoXs5eQMgcTn3E3kpktsvZzH0Whsg6nANzmDx5IHn4kxJD3JE 3tjZu2suAdKZDmYbQxX1LkYmNdDENQaMPboAEF9oHkAbyx8pOWARENbJ1LyfjGh6SPL9 B+Ig== X-Gm-Message-State: AOAM532DCdec6TJ19HdqaqEPJ8vYW+AybfbSVT+f0kDwQysO5ki12vWx ETCrDhG8tjboWQtPY/93msuQLg== X-Google-Smtp-Source: ABdhPJyHgT9qD3j5gx7eQngPsdPOyrFwzeyPSjZx8XO7m+E9g4eFWNl9gzOtJxE3QKVNLxFYLIS0aw== X-Received: by 2002:a05:6a00:1403:b0:4bc:80a3:19eb with SMTP id l3-20020a056a00140300b004bc80a319ebmr26380646pfu.1.1641505597456; Thu, 06 Jan 2022 13:46:37 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46: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, Jaroslav Kysela , Takashi Iwai , Kai Vehmanen , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 29/32] sound: hdac: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:52 -0800 Message-Id: <20220106214556.2461363-30-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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..9e4dab97f485 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 adev->parent; 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 adev->parent; 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 23:30:34 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 4A287C433F5 for ; Thu, 6 Jan 2022 21:48:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244567AbiAFVsG (ORCPT ); Thu, 6 Jan 2022 16:48:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245037AbiAFVrF (ORCPT ); Thu, 6 Jan 2022 16:47:05 -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 35CE6C028C17 for ; Thu, 6 Jan 2022 13:46:39 -0800 (PST) Received: by mail-pf1-x42f.google.com with SMTP id t187so3559690pfb.11 for ; Thu, 06 Jan 2022 13:46: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=N66rEkaY3Hcvo9L0yTqqS+dEsFgKt6MiGsAE0j7XsvA=; b=duTCpzs7Q9xBO5/jhvEz8d7dBWFz10UyRPM1+gs1MoWcr9Rjih5IN5nGhXwvevK79F LLH1VMRZRSRrbvBf8CSScTX1zcxPS5br+YawaCpH+p6G0YnWVaIEotrftZD5MdQGAOa4 FzTGm8fqHdWdHKUkrTNtlgHPLN8gG7IbLg8cg= 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=N66rEkaY3Hcvo9L0yTqqS+dEsFgKt6MiGsAE0j7XsvA=; b=OE734rzUyfTt6MnVSe4Dy2Q6A12iOX9pxH8Lgm/cXNTv+pbGgX8GgNc/mHkkE6g/3F SmCKWX5IlV+DlTzkHFWKS69Mmbk8uIYdovZSDeC0KY/D9MfscETCgmD04WeRo8mGO9ur 7t2NQDPS+jBfKbFLbhcP11R11wiKOIXi0CTLR4dk6YaUiBXrbBVaNVPBHCMQebDQ3YVH ouiHGFgL7QgYVrSDQjXXkuUDZVcrAKl6F0e5+6OJQ+BI8+PkgiIHfwFBW3w8MYwMwUYA eKj8IvaVWGpnvLxDQWoBBKjYViUW4spbcYl9o8mq5w8qETqd9w114d00uMvQU1gooRDp zUTg== X-Gm-Message-State: AOAM53028GIGF00p7RjC38P63xPBdOVQzzIWlsP8XhdQ/esefj3pco9L inSDPEC9Kisaw5/vT5iooOatyQ== X-Google-Smtp-Source: ABdhPJwMc7pXtV30yrUswG55aCMQDtvMJXNqLIxDsQ5YfePndNaTQa8QsvS1BLqjnpOZEiOenE8G+w== X-Received: by 2002:a05:6a00:1150:b0:4a2:7328:cce6 with SMTP id b16-20020a056a00115000b004a27328cce6mr62400254pfm.67.1641505598770; Thu, 06 Jan 2022 13:46:38 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46: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, Mark Brown , Jaroslav Kysela , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 30/32] ASoC: codecs: wcd938x: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:53 -0800 Message-Id: <20220106214556.2461363-31-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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 52de7d14b139..f44f5d41bfdb 100644 --- a/sound/soc/codecs/wcd938x.c +++ b/sound/soc/codecs/wcd938x.c @@ -4316,8 +4316,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 adev->parent; struct wcd938x_priv *wcd938x =3D dev_get_drvdata(dev); int ret; =20 @@ -4400,8 +4401,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 adev->parent; struct wcd938x_priv *wcd938x =3D dev_get_drvdata(dev); =20 device_link_remove(dev, wcd938x->txdev); @@ -4411,9 +4413,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) @@ -4482,7 +4488,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 @@ -4498,7 +4504,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 23:30:34 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 45D21C433F5 for ; Thu, 6 Jan 2022 21:48:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245679AbiAFVsC (ORCPT ); Thu, 6 Jan 2022 16:48:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245043AbiAFVrG (ORCPT ); Thu, 6 Jan 2022 16:47:06 -0500 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5486AC028C31 for ; Thu, 6 Jan 2022 13:46:40 -0800 (PST) Received: by mail-pg1-x52a.google.com with SMTP id t32so3733248pgm.7 for ; Thu, 06 Jan 2022 13:46: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=HmFwe71O6SgnJZrxVfyGwLakllS28Q6zlhd/maqZWnU=; b=oC+aBC1DvSyWs1byL8S+AMM9Zu/djXQvhnAeWjvOvlnZeTMYSqnmbERAdSpvGGNYLm tdgv+mY67LYuE2BD+8rhc7e7pjkRv4BqIyA7q84WzE8urLjsvcaMcjg4RasM6lZJLPsO wO14hLbGdiFL9b3CKehnp/G/BuUYpTXTgtc8E= 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=HmFwe71O6SgnJZrxVfyGwLakllS28Q6zlhd/maqZWnU=; b=UlmrvYBQTXfoAE/iodrP2W1lA/p2onpBEv+NBsIOPErfLwt4fKVdSxvLztEpgSx84t cgY76ITh5rYjuk9c5Q/ftqY+xzntNUMI+NwJYR4iLTJg1VKi9fC+wX9+qcOtltJxOyYO +jQWXJVzNtoXF+8WbRApoIpvV/6fXVMXMd+pyx/2DxEINGrzNHyfjdLvN2er0l2cGVAe D6UB4zQgnkQvrlcK1tCIBTisPi6zSDDxIIXpCgXwT9/dxmw6r6bFf/AFUoO+w6axVmsI bLmGdsBedixj+WVjSVYYKbDK1zHBVcI9CDrHzXfSsR0zgYVPTIiqWDfWS2HaHDtpwm7U PK8g== X-Gm-Message-State: AOAM530Z0zqGimINfwVT6mJxSYnquG4He9buXGuE4ct/3BMH/lCw4OtC 3GSg93n7sb2JyTLKeGTzgTPdHQ== X-Google-Smtp-Source: ABdhPJyHHiB/EXo8B0gxoZ3UvSHLGFDgF66NPCj3nIz0wmI71ULItFhSv5xHAWdhhG2PoRUUvjitlw== X-Received: by 2002:a63:350c:: with SMTP id c12mr45735439pga.568.1641505599934; Thu, 06 Jan 2022 13:46:39 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:39 -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 v5 31/32] component: Get rid of drm_of_component_probe() Date: Thu, 6 Jan 2022 13:45:54 -0800 Message-Id: <20220106214556.2461363-32-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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 008d6b7d2283..c57216e28b70 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 9d35a141f888..33fba4f8e304 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); @@ -74,14 +70,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 23:30:34 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 30414C433EF for ; Thu, 6 Jan 2022 21:48:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245141AbiAFVr7 (ORCPT ); Thu, 6 Jan 2022 16:47:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245058AbiAFVrG (ORCPT ); Thu, 6 Jan 2022 16:47:06 -0500 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84CF4C061245 for ; Thu, 6 Jan 2022 13:46:41 -0800 (PST) Received: by mail-pj1-x102c.google.com with SMTP id l10-20020a17090a384a00b001b22190e075so10013703pjf.3 for ; Thu, 06 Jan 2022 13:46:41 -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=lQPPjlrmfYNaZQJU5WpmjNJguM+Opu+iDFV373nUgEI=; b=HVIbZEzklAxMRu/3hS6qEUS2w9VQenVuylClk6HfQuPTHCrIy2ZAoQtPjHHAd7eW8L zwdlM1trt+idnLVgzDIOSxnYWCEtdLGphSOKjsCKItvcLCvsvXuVlQg5cxyQmwHQFS3h BWA/9Fi5cwr0LPWvXN+ZcRTGRl0XYr6C5fyZU= 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=lQPPjlrmfYNaZQJU5WpmjNJguM+Opu+iDFV373nUgEI=; b=JkUcmoOhBYgvKKKMyxiy3JywLgJHNAiEPM0OxIRm/xxgcvNeyTsvTsM6vNBo0ljdqv aFD82Ht+dHfcFFn/TSSGujQftpBorOajjATxzhtYsn/1ckpvOMybDF9nbASMd1qBgqVL twQXKK5KHRWRkJEl6QglDbmKvPublf3m9Tsmo58usHVNyv73XxHy7vakRPBweF93J+CL v0vXXxB91/9goN0uWTwU85SAEuyFVyWEtrrvOWxPGXHP0SYi823QJ5O8/g/UVfgSzMgN HUl4DzVUbQEDXsGLj1oZUqkFSUndkGQ4LREQIYN+kLCrZ4MAAfOaM2B6LmB0UY5PH8um myIg== X-Gm-Message-State: AOAM531hHwnFjSbFcZZLO4D1tCNTcBbuM0lbVDGSHnNDZ/PkgcOGxHMu YJ3E3zmVi7i2Fswd025TmuDb9A== X-Google-Smtp-Source: ABdhPJwWmmPVHvl582CArkqu+fGcEyz7mUGSem/oBOmpp4NV9QAX0PVmwc3fJoxhrAXvok7FSS9khg== X-Received: by 2002:a17:902:e5cf:b0:149:f5d0:5f0b with SMTP id u15-20020a170902e5cf00b00149f5d05f0bmr3715465plf.100.1641505601085; Thu, 06 Jan 2022 13:46:41 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46: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, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 32/32] component: Remove component_master_ops and friends Date: Thu, 6 Jan 2022 13:45:55 -0800 Message-Id: <20220106214556.2461363-33-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 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 | 148 +++++--------------------------------- drivers/gpu/drm/drm_drv.c | 2 +- include/linux/component.h | 45 ------------ 3 files changed, 17 insertions(+), 178 deletions(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index e9e58b56cda4..cd50137753b4 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -133,18 +133,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; @@ -405,30 +399,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)) { @@ -441,7 +420,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); @@ -454,15 +433,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 @@ -488,16 +462,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; @@ -515,7 +484,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; @@ -540,7 +509,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); @@ -556,54 +524,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 @@ -620,7 +540,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 @@ -632,42 +552,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 @@ -683,7 +567,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) @@ -719,7 +603,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) { @@ -729,7 +613,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 @@ -807,7 +691,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) { @@ -818,7 +702,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 7a5097467ba5..d188fa26bb1b 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -544,7 +544,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 d8dcbf9733da..07fe481d4e3b 100644 --- a/include/linux/component.h +++ b/include/linux/component.h @@ -63,47 +63,7 @@ void component_del(struct device *, const struct compone= nt_ops *); int component_bind_all(struct device *master, void *master_data); void component_unbind_all(struct device *master, void *master_data); =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_device { - const struct component_master_ops *ops; struct device *parent; struct device dev; struct component_match *match; @@ -171,11 +131,6 @@ int component_aggregate_register(struct device *parent, void component_aggregate_unregister(struct device *parent, struct aggregate_driver *adrv); =20 -void component_master_del(struct device *, - const struct component_master_ops *); - -int component_master_add_with_match(struct device *, - const struct component_master_ops *, struct component_match *); void component_match_add_release(struct device *master, struct component_match **matchptr, void (*release)(struct device *, void *), --=20 https://chromeos.dev