From patchwork Thu Jan 27 20:01:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727240 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 26DC3C433F5 for ; Thu, 27 Jan 2022 20:01:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234736AbiA0UBt (ORCPT ); Thu, 27 Jan 2022 15:01:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240127AbiA0UBr (ORCPT ); Thu, 27 Jan 2022 15:01:47 -0500 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0E8BC061748 for ; Thu, 27 Jan 2022 12:01:47 -0800 (PST) Received: by mail-pf1-x432.google.com with SMTP id d187so3772619pfa.10 for ; Thu, 27 Jan 2022 12:01:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=o/2oSSYmQiFhdwKpwnUwhIjRZt1gkWQnLZey0tUdQ3Q=; b=F2EZsXHtz8SY1s6hx5bMUnrUGUyghuTmxSBrXDoJVX3NTp3Q7IiXCqTwdEcRuFf6H1 iQqiH246et5NpTO8gqkGw+DJ7/sopjh34P/Eqv5n2kM+N7ULCvH7rtdaafLc7ZYaKq3a YQET0v2gDkhKyzZUvE/14z3q4yZTF0zwfEo1Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=o/2oSSYmQiFhdwKpwnUwhIjRZt1gkWQnLZey0tUdQ3Q=; b=OWtTyKrDRNoHhWUI74oLqghCeXuBkM728Y21DvRXu4LBXWBJBzYc449RayYRky5etq lnTxLsdy0jwsu2oCJi6mrenukKvhVLtO7E/s01m0qgOL4glUANtHAPZ4H9X99EYQO76T NXli7Y2jidCpIoh2m3buIBZeQWHK6l+TvWxlWfzCwp46Zz8BonRgQFbiZxDZljqit96k FzET6Ay1s+rw/JXqEwk+4dV35ssAWryowxq07FuarpCsxAgcJPpBXI7dgCt3AyeYqqTz U64gg7ko13q1r/UpqYKgnM/KCpzHnL4xKVCJPzPpVCG4LEMsyJz1K25CKSB4zZX3uov5 OsyA== X-Gm-Message-State: AOAM533N2NUyDofhifXeIeho24AH8icrpED4GLywe2ctMRE3nbS4sXZ9 1XGUeb2MLP/3oMmHebmKQjFFug== X-Google-Smtp-Source: ABdhPJxNTd8UpqkCqSFPMqr5dnF5oOl6x1wJ8ztUhPI3BDZAPgxlL+ALaR+FXHt4B/tPwO2icIFh5g== X-Received: by 2002:a63:dd0f:: with SMTP id t15mr3909390pgg.12.1643313707077; Thu, 27 Jan 2022 12:01:47 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.01.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:01:46 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Daniel Vetter , Laurent Pinchart , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 01/35] component: Replace most references to 'master' with 'aggregate device' Date: Thu, 27 Jan 2022 12:01:07 -0800 Message-Id: <20220127200141.1295328-2-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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 --- drivers/base/component.c | 242 +++++++++++++++++++------------------- include/linux/component.h | 18 +-- 2 files changed, 128 insertions(+), 132 deletions(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index 2d25a6416587..34f9e0802719 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -1,11 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* * Componentized device handling. - * - * This is work in progress. We gather up the component devices into a list, - * 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; }; -struct master { +struct aggregate_device { struct list_head node; bool bound; @@ -68,7 +63,7 @@ struct master { struct component { struct list_head node; - struct master *master; + struct aggregate_device *adev; bool bound; const struct component_ops *ops; @@ -78,7 +73,7 @@ struct component { static DEFINE_MUTEX(component_mutex); static LIST_HEAD(component_list); -static LIST_HEAD(masters); +static LIST_HEAD(aggregate_devices); #ifdef CONFIG_DEBUG_FS @@ -86,12 +81,12 @@ static struct dentry *component_debugfs_dir; static int component_devices_show(struct seq_file *s, void *data) { - struct master *m = s->private; + struct aggregate_device *m = s->private; struct component_match *match = m->match; size_t i; 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) core_initcall(component_debug_init); -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); } -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)); } #else -static void component_master_debugfs_add(struct master *m) +static void component_debugfs_add(struct aggregate_device *m) { } -static void component_master_debugfs_del(struct master *m) +static void component_debugfs_del(struct aggregate_device *m) { } #endif -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; - list_for_each_entry(m, &masters, node) + list_for_each_entry(m, &aggregate_devices, node) if (m->parent == parent && (!ops || m->ops == ops)) return m; return NULL; } -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; list_for_each_entry(c, &component_list, node) { - if (c->master && c->master != master) + if (c->adev && c->adev != adev) continue; if (mc->compare && mc->compare(c->dev, mc->data)) @@ -174,102 +169,103 @@ static struct component *find_component(struct master *master, return NULL; } -static int find_components(struct master *master) +static int find_components(struct aggregate_device *adev) { - struct component_match *match = master->match; + struct component_match *match = adev->match; size_t i; int ret = 0; /* * 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 = 0; i < match->num; i++) { struct component_match_array *mc = &match->compare[i]; struct component *c; - dev_dbg(master->parent, "Looking for component %zu\n", i); + dev_dbg(adev->parent, "Looking for component %zu\n", i); if (match->compare[i].component) continue; - c = find_component(master, mc); + c = find_component(adev, mc); if (!c) { ret = -ENXIO; break; } - 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); - /* Attach this component to the master */ - match->compare[i].duplicate = !!c->master; + /* Attach this component to the adev */ + match->compare[i].duplicate = !!c->adev; match->compare[i].component = c; - c->master = master; + c->adev = adev; } return ret; } -/* 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 component *c) { size_t i; - /* Detach the component from this master. */ - for (i = 0; i < master->match->num; i++) - if (master->match->compare[i].component == c) - master->match->compare[i].component = NULL; + /* Detach the component from this adev. */ + for (i = 0; i < adev->match->num; i++) + if (adev->match->compare[i].component == c) + adev->match->compare[i].component = NULL; } /* - * 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 interested + * in this aggregate device, otherwise it's a component which must be present + * 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; - dev_dbg(master->parent, "trying to bring up master\n"); + dev_dbg(adev->parent, "trying to bring up adev\n"); - 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; } - if (component && component->master != master) { - dev_dbg(master->parent, "master is not for this component (%s)\n", + if (component && component->adev != adev) { + dev_dbg(adev->parent, "master is not for this component (%s)\n", dev_name(component->dev)); return 0; } - if (!devres_open_group(master->parent, master, GFP_KERNEL)) + if (!devres_open_group(adev->parent, adev, GFP_KERNEL)) return -ENOMEM; /* Found all components */ - ret = master->ops->bind(master->parent); + ret = adev->ops->bind(adev->parent); if (ret < 0) { - devres_release_group(master->parent, NULL); + devres_release_group(adev->parent, NULL); if (ret != -EPROBE_DEFER) - dev_info(master->parent, "master bind failed: %d\n", ret); + dev_info(adev->parent, "adev bind failed: %d\n", ret); return ret; } - devres_close_group(master->parent, NULL); - master->bound = true; + devres_close_group(adev->parent, NULL); + adev->bound = true; return 1; } static int try_to_bring_up_masters(struct component *component) { - struct master *m; + struct aggregate_device *adev; int ret = 0; - list_for_each_entry(m, &masters, node) { - if (!m->bound) { - ret = try_to_bring_up_master(m, component); + list_for_each_entry(adev, &aggregate_devices, node) { + if (!adev->bound) { + ret = try_to_bring_up_aggregate_device(adev, component); if (ret != 0) break; } @@ -278,12 +274,12 @@ static int try_to_bring_up_masters(struct component *component) return ret; } -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 = false; + if (adev->bound) { + adev->ops->unbind(adev->parent); + devres_release_group(adev->parent, adev); + adev->bound = false; } } @@ -324,7 +320,7 @@ static int component_match_realloc(struct component_match *match, size_t num) return 0; } -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; } - devres_add(master, match); + devres_add(parent, match); *matchptr = match; } @@ -370,13 +366,13 @@ static void __component_match_add(struct device *master, /** * 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 pointed 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 *master, * * 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); /** * component_match_add_typed - add a component match entry for a typed component - * @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 pointed 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); -static void free_master(struct master *master) +static void free_aggregate_device(struct aggregate_device *adev) { - struct component_match *match = master->match; + struct component_match *match = adev->match; int i; - component_master_debugfs_del(master); - list_del(&master->node); + component_debugfs_del(adev); + list_del(&adev->node); if (match) { for (i = 0; i < match->num; i++) { struct component *c = match->compare[i].component; if (c) - c->master = NULL; + c->adev = NULL; } } - kfree(master); + kfree(adev); } /** @@ -459,7 +455,7 @@ int component_master_add_with_match(struct device *parent, const struct component_master_ops *ops, struct component_match *match) { - struct master *master; + struct aggregate_device *adev; int ret; /* Reallocate the match array for its true size */ @@ -467,23 +463,23 @@ int component_master_add_with_match(struct device *parent, if (ret) return ret; - master = kzalloc(sizeof(*master), GFP_KERNEL); - if (!master) + adev = kzalloc(sizeof(*adev), GFP_KERNEL); + if (!adev) return -ENOMEM; - master->parent = parent; - master->ops = ops; - master->match = match; + adev->parent = parent; + adev->ops = ops; + adev->match = match; - 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); - ret = try_to_bring_up_master(master, NULL); + ret = try_to_bring_up_aggregate_device(adev, NULL); if (ret < 0) - free_master(master); + free_aggregate_device(adev); mutex_unlock(&component_mutex); @@ -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; mutex_lock(&component_mutex); - master = __master_find(parent, ops); - if (master) { - take_down_master(master); - free_master(master); + adev = __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); static void component_unbind(struct component *component, - struct master *master, void *data) + struct aggregate_device *adev, void *data) { WARN_ON(!component->bound); if (component->ops && component->ops->unbind) - component->ops->unbind(component->dev, master->parent, data); + component->ops->unbind(component->dev, adev->parent, data); component->bound = false; /* Release all resources claimed in the binding of this component */ @@ -539,26 +535,26 @@ static void component_unbind(struct component *component, */ void component_unbind_all(struct device *parent, void *data) { - struct master *master; + struct aggregate_device *adev; struct component *c; size_t i; WARN_ON(!mutex_is_locked(&component_mutex)); - master = __master_find(parent, NULL); - if (!master) + adev = __aggregate_find(parent, NULL); + if (!adev) return; /* Unbind components in reverse order */ - for (i = master->match->num; i--; ) - if (!master->match->compare[i].duplicate) { - c = master->match->compare[i].component; - component_unbind(c, master, data); + for (i = adev->match->num; i--; ) + if (!adev->match->compare[i].duplicate) { + c = adev->match->compare[i].component; + component_unbind(c, adev, data); } } EXPORT_SYMBOL_GPL(component_unbind_all); -static int component_bind(struct component *component, struct master *master, +static int component_bind(struct component *component, struct aggregate_device *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; /* @@ -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; } - dev_dbg(master->parent, "binding %s (ops %ps)\n", + dev_dbg(adev->parent, "binding %s (ops %ps)\n", dev_name(component->dev), component->ops); - ret = component->ops->bind(component->dev, master->parent, data); + ret = component->ops->bind(component->dev, adev->parent, data); if (!ret) { component->bound = true; @@ -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); - 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); if (ret != -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); } @@ -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 = 0; WARN_ON(!mutex_is_locked(&component_mutex)); - master = __master_find(parent, NULL); - if (!master) + adev = __aggregate_find(parent, NULL); + if (!adev) return -EINVAL; /* Bind components in match order */ - for (i = 0; i < master->match->num; i++) - if (!master->match->compare[i].duplicate) { - c = master->match->compare[i].component; - ret = component_bind(c, master, data); + for (i = 0; i < adev->match->num; i++) + if (!adev->match->compare[i].duplicate) { + c = adev->match->compare[i].component; + ret = component_bind(c, adev, data); if (ret) break; } if (ret != 0) { for (; i > 0; i--) - if (!master->match->compare[i - 1].duplicate) { - c = master->match->compare[i - 1].component; - component_unbind(c, master, data); + if (!adev->match->compare[i - 1].duplicate) { + c = adev->match->compare[i - 1].component; + component_unbind(c, adev, data); } } @@ -675,8 +671,8 @@ static int __component_add(struct device *dev, const struct component_ops *ops, ret = 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); kfree(component); @@ -757,9 +753,9 @@ void component_del(struct device *dev, const struct component_ops *ops) break; } - 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); } mutex_unlock(&component_mutex); diff --git a/include/linux/component.h b/include/linux/component.h index 16de18f473d7..7012569c6546 100644 --- a/include/linux/component.h +++ b/include/linux/component.h @@ -38,10 +38,10 @@ int component_add_typed(struct device *dev, const struct component_ops *ops, int subcomponent); void component_del(struct device *, const struct component_ops *); -int component_bind_all(struct device *master, void *master_data); -void component_unbind_all(struct device *master, void *master_data); +int component_bind_all(struct device *parent, void *data); +void component_unbind_all(struct device *parent, void *data); -struct master; +struct aggregate_device; /** * struct component_master_ops - callback for the aggregate driver @@ -89,22 +89,22 @@ 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, +void component_match_add_release(struct device *parent, struct component_match **matchptr, void (*release)(struct device *, void *), int (*compare)(struct device *, void *), void *compare_data); -void component_match_add_typed(struct device *master, +void component_match_add_typed(struct device *parent, struct component_match **matchptr, int (*compare_typed)(struct device *, int, void *), void *compare_data); /** * component_match_add - add a component match entry - * @master: device with the aggregate driver + * @parent: device with the aggregate driver * @matchptr: pointer to the list of component matches * @compare: compare function to match against all components * @compare_data: opaque pointer passed to the @compare function * - * Adds a new component match to the list stored in @matchptr, which the @master + * Adds a new component match to the list stored in @matchptr, which the @parent * aggregate driver needs to function. The list of component matches pointed to * by @matchptr must be initialized to NULL before adding the first match. This * only matches against components added with component_add(). @@ -114,11 +114,11 @@ void component_match_add_typed(struct device *master, * * See also component_match_add_release() and component_match_add_typed(). */ -static inline void component_match_add(struct device *master, +static inline void component_match_add(struct device *parent, struct component_match **matchptr, int (*compare)(struct device *, void *), void *compare_data) { - component_match_add_release(master, matchptr, NULL, compare, + component_match_add_release(parent, matchptr, NULL, compare, compare_data); } From patchwork Thu Jan 27 20:01:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727242 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 BACA5C433F5 for ; Thu, 27 Jan 2022 20:01:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240141AbiA0UB5 (ORCPT ); Thu, 27 Jan 2022 15:01:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240127AbiA0UB5 (ORCPT ); Thu, 27 Jan 2022 15:01:57 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EA8DC06173B for ; Thu, 27 Jan 2022 12:01:57 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id c9so3659547plg.11 for ; Thu, 27 Jan 2022 12:01:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IR4AISD83LJCSYg29NOuQaaPTjOL0HsWAiGACvsgSGo=; b=ncKjtei93vb1zHLPl1WczIhVUiOMUHxsILhIlnZB0H1nP8/WyqZnoYUGiUcs8LBbSo 7Pnnv0eBLXiLnw08Lhy/ARASwLqkCcO0ww9SGvnvCxIcUtC8P6DypqeVOCU6jWkXgw9Y enSTzkob6k3B75rRWxiUk4mMIHAtnEvJk0O9g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IR4AISD83LJCSYg29NOuQaaPTjOL0HsWAiGACvsgSGo=; b=symJiGKgo548uf+VU2S7AL6n0o7wosrc37WKG71TRcQM4a4nvBHW5/fwB9UK1x8N0O sIaODMyAL0qVQh6yjC6JIcuanbE/95PKgzCH3i/QEVKGyBFDdOmq2kYzbcYUPcpqa5Mq fi9DLfex7t392paJHXmyRgDB31zGD4FgvsAWq+2ViSGM/QuyvPFiv66tAXQ3N64jDQ97 jV+i42Ew144fjUjyStKEziSAqBx2kacffQEFnl5flvv7I/QgR7NdpNR5mZdFNM0upaJd xHlSIULYi0mKP3xzkD4gTa9wA1lCb4Cf4YbUw+GZF3pDNpuK8NACBQW5MvMeNwB4I7gn Iqqg== X-Gm-Message-State: AOAM531Z6VshOLNuZp1OTTa+m8mafuhHLS0fF2fRGRjKajKn3MaKqH5T g3N3DecoXChlUkmK8ALm8iL0oA== X-Google-Smtp-Source: ABdhPJxdnzgjCBU0e9yqMVsm3M9xQMx+59TGzEYS+bWrR/7z1bqY+AIXep7vka7f7D5Qlq2UC6GXCg== X-Received: by 2002:a17:902:9b96:: with SMTP id y22mr1276979plp.100.1643313716712; Thu, 27 Jan 2022 12:01:56 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.01.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:01:48 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Daniel Vetter , Laurent Pinchart , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 02/35] component: Introduce the aggregate bus_type Date: Thu, 27 Jan 2022 12:01:08 -0800 Message-Id: <20220127200141.1295328-3-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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 --- drivers/base/component.c | 486 ++++++++++++++++++++++++++++---------- include/linux/component.h | 58 ++++- 2 files changed, 417 insertions(+), 127 deletions(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index 34f9e0802719..dc748ef0b23b 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -4,10 +4,14 @@ */ #include #include +#include #include #include #include #include +#include + +#include "base.h" /** * DOC: overview @@ -31,8 +35,8 @@ * * Aggregate drivers first assemble a component match list of what they need * using component_match_add(). This is then registered as an aggregate driver - * using component_master_add_with_match(), and unregistered using - * component_master_del(). + * using component_aggregate_register(), and unregistered using + * component_aggregate_unregister(). */ struct component; @@ -53,14 +57,20 @@ struct component_match { }; 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; }; +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; }; static DEFINE_MUTEX(component_mutex); static LIST_HEAD(component_list); -static LIST_HEAD(aggregate_devices); +static DEFINE_IDA(aggregate_ida); #ifdef CONFIG_DEBUG_FS @@ -89,7 +100,7 @@ static int component_devices_show(struct seq_file *s, void *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"); seq_printf(s, "%-40s %20s\n", "device name", "status"); seq_puts(s, "-------------------------------------------------------------\n"); @@ -137,16 +148,21 @@ static void component_debugfs_del(struct aggregate_device *m) #endif -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 = to_aggregate_device(dev); + const struct aggregate_bus_find_data *data = _data; - list_for_each_entry(m, &aggregate_devices, node) - if (m->parent == parent && (!ops || m->ops == ops)) - return m; + if (adev->parent == data->parent && + (!data->ops || adev->ops == data->ops)) + return 1; - return NULL; + return 0; } static struct component *find_component(struct aggregate_device *adev, @@ -173,7 +189,6 @@ static int find_components(struct aggregate_device *adev) { struct component_match *match = adev->match; size_t i; - int ret = 0; /* * Scan the array of match functions and attach @@ -182,6 +197,7 @@ static int find_components(struct aggregate_device *adev) for (i = 0; i < match->num; i++) { struct component_match_array *mc = &match->compare[i]; struct component *c; + bool duplicate; dev_dbg(adev->parent, "Looking for component %zu\n", i); @@ -189,20 +205,27 @@ static int find_components(struct aggregate_device *adev) continue; c = find_component(adev, mc); - if (!c) { - ret = -ENXIO; - break; - } + if (!c) + return 0; + duplicate = !!c->adev; dev_dbg(adev->parent, "found component %s, duplicate %u\n", - dev_name(c->dev), !!c->adev); + dev_name(c->dev), duplicate); /* Attach this component to the adev */ - match->compare[i].duplicate = !!c->adev; + match->compare[i].duplicate = duplicate; match->compare[i].component = c; + if (duplicate) + continue; + + /* Matches put in component_del() */ + get_device(&adev->dev); + c->link = device_link_add(&adev->dev, c->dev, + DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME); c->adev = adev; } - return ret; + + return 1; } /* 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 = NULL; } -/* - * Try to bring up an aggregate device. If component is NULL, we're interested - * in this aggregate device, otherwise it's a component which must be present - * 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 != 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 = adev->ops->bind(adev->parent); - if (ret < 0) { - devres_release_group(adev->parent, NULL); - if (ret != -EPROBE_DEFER) - dev_info(adev->parent, "adev bind failed: %d\n", ret); - return ret; - } - - devres_close_group(adev->parent, NULL); - adev->bound = true; - return 1; -} - -static int try_to_bring_up_masters(struct component *component) -{ - struct aggregate_device *adev; - int ret = 0; - - list_for_each_entry(adev, &aggregate_devices, node) { - if (!adev->bound) { - ret = try_to_bring_up_aggregate_device(adev, component); - if (ret != 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 = false; - } -} - static void devm_component_match_release(struct device *parent, void *res) { struct component_match *match = res; @@ -426,7 +382,6 @@ static void free_aggregate_device(struct aggregate_device *adev) int i; component_debugfs_del(adev); - list_del(&adev->node); if (match) { for (i = 0; i < match->num; i++) { @@ -436,9 +391,201 @@ static void free_aggregate_device(struct aggregate_device *adev) } } + ida_free(&aggregate_ida, adev->id); kfree(adev); } +static void aggregate_device_release(struct device *dev) +{ + struct aggregate_device *adev = 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 = to_aggregate_driver(drv); + struct aggregate_device *adev = to_aggregate_device(dev); + int ret; + + /* Is this driver associated with this device */ + if (adrv != adev->adrv) + return 0; + + /* Should we start to assemble? */ + mutex_lock(&component_mutex); + ret = find_components(adev); + mutex_unlock(&component_mutex); + + return ret; +} + +/* TODO: Remove once all aggregate drivers use component_aggregate_register() */ +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 = to_aggregate_driver(dev->driver); + struct aggregate_device *adev = to_aggregate_device(dev); + bool modern = adrv->probe != 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 = adrv->probe(adev); + if (ret) + devres_release_group(adev->parent, NULL); + } else { + ret = -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 = to_aggregate_driver(dev->driver); + struct aggregate_device *adev = to_aggregate_device(dev); + bool modern = adrv->remove != 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 = to_aggregate_driver(dev->driver); + + if (adrv && adrv->shutdown) + adrv->shutdown(to_aggregate_device(dev)); +} + +static struct bus_type aggregate_bus_type = { + .name = "aggregate", + .match = aggregate_device_match, + .probe = aggregate_driver_probe, + .remove = aggregate_driver_remove, + .shutdown = 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 = { + .ops = ops, + .parent = parent, + }; + + dev = bus_find_device(&aggregate_bus_type, NULL, &data, + aggregate_bus_find_match); + + return dev ? to_aggregate_device(dev) : NULL; +} + +static DEFINE_MUTEX(aggregate_mutex); + +static int aggregate_driver_register(struct aggregate_driver *adrv) +{ + int ret = 0; + + mutex_lock(&aggregate_mutex); + if (!refcount_inc_not_zero(&adrv->count)) { + adrv->driver.bus = &aggregate_bus_type; + ret = driver_register(&adrv->driver); + if (!ret) + refcount_set(&adrv->count, 1); + } + mutex_unlock(&aggregate_mutex); + + return ret; +} + +static void aggregate_driver_unregister(struct aggregate_driver *adrv) +{ + if (refcount_dec_and_mutex_lock(&adrv->count, &aggregate_mutex)) { + driver_unregister(&adrv->driver); + mutex_unlock(&aggregate_mutex); + } +} + +static struct aggregate_device *aggregate_device_add(struct device *parent, + const struct component_master_ops *ops, struct aggregate_driver *adrv, + struct component_match *match) +{ + struct aggregate_device *adev; + int ret, id; + + /* Reallocate the match array for its true size */ + ret = component_match_realloc(match, match->num); + if (ret) + return ERR_PTR(ret); + + adev = kzalloc(sizeof(*adev), GFP_KERNEL); + if (!adev) + return ERR_PTR(-ENOMEM); + + id = ida_alloc(&aggregate_ida, GFP_KERNEL); + if (id < 0) { + kfree(adev); + return ERR_PTR(id); + } + + adev->id = id; + adev->parent = parent; + adev->dev.bus = &aggregate_bus_type; + adev->dev.release = aggregate_device_release; + adev->ops = ops; + adev->match = match; + adev->adrv = adrv; + dev_set_name(&adev->dev, "aggregate%d", id); + + ret = device_register(&adev->dev); + if (ret) { + put_device(&adev->dev); + return ERR_PTR(ret); + } + + component_debugfs_add(adev); + + return adev; +} + /** * component_master_add_with_match - register an aggregate driver * @parent: parent device of the aggregate driver @@ -450,42 +597,70 @@ static void free_aggregate_device(struct aggregate_device *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 = component_match_realloc(match, match->num); - if (ret) - return ret; + int ret = 0; - adev = kzalloc(sizeof(*adev), GFP_KERNEL); - if (!adev) + adrv = kzalloc(sizeof(*adrv), GFP_KERNEL); + if (!adrv) return -ENOMEM; - adev->parent = parent; - adev->ops = ops; - adev->match = match; + adev = aggregate_device_add(parent, ops, adrv, match); + if (IS_ERR(adev)) { + ret = PTR_ERR(adev); + goto err; + } - component_debugfs_add(adev); - /* Add to the list of available aggregate devices. */ - mutex_lock(&component_mutex); - list_add(&adev->node, &aggregate_devices); + adrv->probe = component_probe_bind; + adrv->remove = component_remove_unbind; + adrv->driver.owner = THIS_MODULE; + adrv->driver.name = dev_name(&adev->dev); - ret = try_to_bring_up_aggregate_device(adev, NULL); + ret = aggregate_driver_register(adrv); + if (!ret) + return 0; - if (ret < 0) - free_aggregate_device(adev); + put_device(&adev->dev); +err: + kfree(adrv); + return ret; +} +EXPORT_SYMBOL_GPL(component_master_add_with_match); - 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 components in + * @match are available, the aggregate driver will be assembled by calling + * &adrv.bind. Must be unregistered by calling component_aggregate_unregister(). + */ +int component_aggregate_register(struct device *parent, + struct aggregate_driver *adrv, struct component_match *match) +{ + struct aggregate_device *adev; + int ret; + + adev = aggregate_device_add(parent, NULL, adrv, match); + if (IS_ERR(adev)) + return PTR_ERR(adev); + + ret = aggregate_driver_register(adrv); + if (ret) + put_device(&adev->dev); - return ret < 0 ? ret : 0; + return ret; } -EXPORT_SYMBOL_GPL(component_master_add_with_match); +EXPORT_SYMBOL_GPL(component_aggregate_register); /** * component_master_del - unregister an aggregate driver @@ -495,22 +670,60 @@ EXPORT_SYMBOL_GPL(component_master_add_with_match); * Unregisters an aggregate driver registered with * component_master_add_with_match(). If necessary the aggregate driver is first * disassembled by calling &component_master_ops.unbind from @ops. + * + * Deprecated: Use component_aggregate_unregister() instead. */ void component_master_del(struct device *parent, const struct component_master_ops *ops) { struct aggregate_device *adev; + struct aggregate_driver *adrv; + struct device_driver *drv; mutex_lock(&component_mutex); adev = __aggregate_find(parent, ops); + mutex_unlock(&component_mutex); + if (adev) { - take_down_aggregate_device(adev); - free_aggregate_device(adev); + drv = adev->dev.driver; + if (drv) { + adrv = 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); +/** + * 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 first + * disassembled. + */ +void component_aggregate_unregister(struct device *parent, + struct aggregate_driver *adrv) +{ + struct aggregate_device *adev; + + mutex_lock(&component_mutex); + adev = __aggregate_find(parent, NULL); + mutex_unlock(&component_mutex); + + if (adev) + device_unregister(&adev->dev); + put_device(&adev->dev); + + aggregate_driver_unregister(adrv); +} +EXPORT_SYMBOL_GPL(component_aggregate_unregister); + static void component_unbind(struct component *component, struct aggregate_device *adev, void *data) { @@ -551,6 +764,8 @@ void component_unbind_all(struct device *parent, void *data) c = adev->match->compare[i].component; component_unbind(c, adev, data); } + + put_device(&adev->dev); } EXPORT_SYMBOL_GPL(component_unbind_all); @@ -645,6 +860,7 @@ int component_bind_all(struct device *parent, void *data) component_unbind(c, adev, data); } } + put_device(&adev->dev); return ret; } @@ -668,18 +884,22 @@ static int __component_add(struct device *dev, const struct component_ops *ops, mutex_lock(&component_mutex); list_add_tail(&component->node, &component_list); - - ret = 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); - 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 = bus_rescan_devices(&aggregate_bus_type); + if (ret) + dev_dbg(dev, "rescan returned %d\n", ret); + + return 0; } /** @@ -743,6 +963,7 @@ EXPORT_SYMBOL_GPL(component_add); */ void component_del(struct device *dev, const struct component_ops *ops) { + struct aggregate_device *adev = NULL; struct component *c, *component = NULL; mutex_lock(&component_mutex); @@ -754,13 +975,26 @@ void component_del(struct device *dev, const struct component_ops *ops) } if (component && component->adev) { - take_down_aggregate_device(component->adev); - remove_component(component->adev, component); + adev = component->adev; + remove_component(adev, component); } mutex_unlock(&component_mutex); + if (adev) { + /* Force unbind */ + device_driver_detach(&adev->dev); + device_link_del(component->link); + put_device(&adev->dev); + } + WARN_ON(!component); kfree(component); } EXPORT_SYMBOL_GPL(component_del); + +static int __init aggregate_bus_init(void) +{ + return bus_register(&aggregate_bus_type); +} +postcore_initcall(aggregate_bus_init); diff --git a/include/linux/component.h b/include/linux/component.h index 7012569c6546..aa69ea0401d3 100644 --- a/include/linux/component.h +++ b/include/linux/component.h @@ -3,7 +3,8 @@ #define COMPONENT_H #include - +#include +#include struct device; @@ -82,11 +83,66 @@ struct component_master_ops { void (*unbind)(struct device *master); }; +/** + * struct aggregate_driver - Aggregate driver (made up of other drivers) + * @count: driver registration refcount + * @driver: device driver + */ +struct aggregate_driver { + /** + * @probe: + * + * Called when all components or the aggregate driver, as specified in + * the aggregate_device's match list are + * ready. Usually there are 3 steps to bind an aggregate driver: + * + * 1. Allocate a struct aggregate_driver. + * + * 2. Bind all components to the aggregate driver by calling + * component_bind_all() with the aggregate driver structure as opaque + * pointer data. + * + * 3. Register the aggregate driver with the subsystem to publish its + * interfaces. + */ + int (*probe)(struct aggregate_device *adev); + /** + * @remove: + * + * Called when either the aggregate driver, using + * component_aggregate_unregister(), or one of its components, using + * component_del(), is unregistered. + */ + void (*remove)(struct aggregate_device *adev); + /** + * @shutdown: + * + * Called when the system is shutting down. + */ + void (*shutdown)(struct aggregate_device *adev); + + refcount_t count; + struct device_driver driver; +}; + +static inline struct aggregate_driver *to_aggregate_driver(struct device_driver *d) +{ + if (!d) + return NULL; + + return container_of(d, struct aggregate_driver, driver); +} + void component_master_del(struct device *, const struct component_master_ops *); struct component_match; +int component_aggregate_register(struct device *parent, + struct aggregate_driver *adrv, struct component_match *match); +void component_aggregate_unregister(struct device *parent, + struct aggregate_driver *adrv); + int component_master_add_with_match(struct device *, const struct component_master_ops *, struct component_match *); void component_match_add_release(struct device *parent, From patchwork Thu Jan 27 20:01:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727241 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 802CFC433FE for ; Thu, 27 Jan 2022 20:01:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240090AbiA0UB6 (ORCPT ); Thu, 27 Jan 2022 15:01:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240257AbiA0UB6 (ORCPT ); Thu, 27 Jan 2022 15:01:58 -0500 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61626C06173B for ; Thu, 27 Jan 2022 12:01:58 -0800 (PST) Received: by mail-pl1-x62d.google.com with SMTP id c3so3697708pls.5 for ; Thu, 27 Jan 2022 12:01:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mlOjEQaGgQJEWexKeIDPB6ZywfuO0Krhl/6WTCAgp1U=; b=eyrrZkbzPEVq72Z6fNYVKdNXOMuVYUB7XGcmAelArR/eBBTm4qv34sUVGHRw2+3Xjb qxYlvdBkbnSilPXGvWPCeiDXV+5AgRyZ6rpwDbyu6pszvNmM2d966CHxA1CXRr6njd4o N75g5GBD63J2h2qcjJmsi51wKmNMAMIts0FjU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mlOjEQaGgQJEWexKeIDPB6ZywfuO0Krhl/6WTCAgp1U=; b=MhdRXUuoiQP552DDsY7h/UOR/6O2iTcgIeodf7QsuyKfg+hUsxcUqsWBHbiO7fMKQb zN0eBKehdxlBtGHFxz/oQaIOHv7XF8S0L3kZsNF0Y2KL4+pYHgb5Sx3TOpGvi3vbEWSX bbjAEDMvcn1jOUcv9kvCpuUBsXGGasGlDes4DoUzItbD2YCo3j86BfkzGWIiCSbmfbfx jVdwUpzk2GyTjs4lIFGlgxeGiQWBYgXkEiTEQL3nCb9O1NHGALLkHLPF2ppaUBQV+1Eu /iRbMf4C1XDitOZ5jdQfqK87w6594GY2dbOd2C+klQ+8JhkmypVxAZ74C2o6x/mG1FUK UwJQ== X-Gm-Message-State: AOAM533E9BrV5VSjLvQCcr2aciabRY+q9o7URsQauEU93s1uuu85sFks /vsx3wf3my3utqq0gww3fRo7hg== X-Google-Smtp-Source: ABdhPJw9tnBKTD10bdf8LXuHDZN29rkJYFCfmvP96l1VR5CM/34SWpZehvfM/GsxZluqGTjuFM522g== X-Received: by 2002:a17:902:f68e:: with SMTP id l14mr4800119plg.164.1643313717953; Thu, 27 Jan 2022 12:01:57 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.01.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:01:57 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Jani Nikula , Daniel Vetter , Laurent Pinchart , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 03/35] component: Add aggregate_device_parent() for driver use Date: Thu, 27 Jan 2022 12:01:09 -0800 Message-Id: <20220127200141.1295328-4-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org This allows aggregate driver writers to get the parent of the aggregate device passed to their probe/remove/shutdown functions. Suggested-by: Jani Nikula Cc: Daniel Vetter Cc: Greg Kroah-Hartman Cc: Laurent Pinchart Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/base/component.c | 6 ++++++ include/linux/component.h | 1 + 2 files changed, 7 insertions(+) diff --git a/drivers/base/component.c b/drivers/base/component.c index dc748ef0b23b..13ac2004a913 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -71,6 +71,12 @@ static inline struct aggregate_device *to_aggregate_device(struct device *d) return container_of(d, struct aggregate_device, dev); } +struct device *aggregate_device_parent(const struct aggregate_device *adev) +{ + return adev->parent; +} +EXPORT_SYMBOL_GPL(aggregate_device_parent); + struct component { struct list_head node; struct aggregate_device *adev; diff --git a/include/linux/component.h b/include/linux/component.h index aa69ea0401d3..c39dea7824af 100644 --- a/include/linux/component.h +++ b/include/linux/component.h @@ -43,6 +43,7 @@ int component_bind_all(struct device *parent, void *data); void component_unbind_all(struct device *parent, void *data); struct aggregate_device; +struct device *aggregate_device_parent(const struct aggregate_device *adev); /** * struct component_master_ops - callback for the aggregate driver From patchwork Thu Jan 27 20:01:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727243 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 A7450C433F5 for ; Thu, 27 Jan 2022 20:02:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240198AbiA0UCA (ORCPT ); Thu, 27 Jan 2022 15:02:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343641AbiA0UB7 (ORCPT ); Thu, 27 Jan 2022 15:01:59 -0500 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EB0DC06173B for ; Thu, 27 Jan 2022 12:01:59 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id d15-20020a17090a110f00b001b4e7d27474so4145346pja.2 for ; Thu, 27 Jan 2022 12:01:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mnLXiJbCUaC6XTZzeAM0x5jkp+ZwTQGnS1QkwL8Pb08=; b=lWqllZqrDcVmSKuLBzM5NetfRm+wmp9lMVdzziEYwXfKf4DloUdfa+Hdk0K+m5nRv5 08JmDvKm12bU1zd+uSV5KyJxyXHDBz0ytGNa5+M+uSId9nA4tL0CF53rTjg3W9Pgts8F CKDmILXBrnN/1i89gLb87AXvEofiPkb6aj2jo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mnLXiJbCUaC6XTZzeAM0x5jkp+ZwTQGnS1QkwL8Pb08=; b=KF5rH0+Ii6KsIv2sqO7htRgQf1TSvv0Wp9xsGgFd9I2hDcof4xOiBiWTopZfQxzD2+ c+6AIFbmatx9zc3NJeHf3VKH1OjsUKJ6wnx6f99CvBQ15ZKaP/oPcnJzUaXu9J11SjJV dx3cAT6DWc0x3YSELyCBcNDRKqHCiUSrtlbSHCqUXBfHshvsfZ+Vf+oT3RH3pbBPpkcU 2KnwW3JYJQBLkw+xQgGzdJWjORtXAEQ9VgqMWcODDxcJoweeKopCNItFOdyEAN3481wz OP4tCvwl1hlxfXmlmorrM3jr7sJTJI9E9vvZjfscb7roABcocva3PEJ5ZtkO1jAQPNGF Dxzw== X-Gm-Message-State: AOAM530z6RhHQdk34792OtdGfihC47N7iuXq/NbLuIUy3Y35fpi3qEt2 sJwco5ncPUIbXgBWbHZhPy3eGw== X-Google-Smtp-Source: ABdhPJwELBm2hJJkKCHCGDWi0uz0RH9y0pifltZnK5CSGFtfaIxRrrrZ6UAYfSEjLNlhVwuFfkr4HQ== X-Received: by 2002:a17:90b:3b46:: with SMTP id ot6mr9864097pjb.179.1643313719206; Thu, 27 Jan 2022 12:01:59 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.01.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:01:58 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Daniel Vetter , Daniel Vetter , Laurent Pinchart , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 04/35] component: Add {bind,unbind}_component() ops that take aggregate device Date: Thu, 27 Jan 2022 12:01:10 -0800 Message-Id: <20220127200141.1295328-5-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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 --- drivers/base/component.c | 14 +++++++++++--- include/linux/component.h | 23 ++++++++++++++++++++++- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index 13ac2004a913..5b91a114786d 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -735,8 +735,13 @@ static void component_unbind(struct component *component, { WARN_ON(!component->bound); - 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 = false; /* Release all resources claimed in the binding of this component */ @@ -801,7 +806,10 @@ static int component_bind(struct component *component, struct aggregate_device * dev_dbg(adev->parent, "binding %s (ops %ps)\n", dev_name(component->dev), component->ops); - ret = component->ops->bind(component->dev, adev->parent, data); + if (component->ops->bind_component) + ret = component->ops->bind_component(component->dev, adev, data); + else + ret = component->ops->bind(component->dev, adev->parent, data); if (!ret) { component->bound = true; diff --git a/include/linux/component.h b/include/linux/component.h index c39dea7824af..073cbe9fea32 100644 --- a/include/linux/component.h +++ b/include/linux/component.h @@ -6,6 +6,7 @@ #include #include +struct aggregate_device; struct device; /** @@ -20,18 +21,39 @@ struct component_ops { * * Called through component_bind_all() when the aggregate driver is * ready to bind the overall driver. + * + * Deprecated: Use bind_component() instead. */ int (*bind)(struct device *comp, struct device *master, void *master_data); + /** + * @bind_component: + * + * Called through component_bind_all() when the aggregate driver is + * ready to bind the overall driver. + */ + int (*bind_component)(struct device *comp, struct aggregate_device *adev, + void *aggregate_data); /** * @unbind: * * Called through component_unbind_all() when the aggregate driver is * ready to bind the overall driver, or when component_bind_all() fails * part-ways through and needs to unbind some already bound components. + * + * Deprecated: Use unbind_component() instead. */ void (*unbind)(struct device *comp, struct device *master, void *master_data); + /** + * @unbind_component: + * + * Called through component_unbind_all() when the aggregate driver is + * ready to unbind the overall driver, or when component_bind_all() fails + * part-ways through and needs to unbind some already bound components. + */ + int (*unbind_component)(struct device *comp, struct aggregate_device *adev, + void *aggregate_data); }; int component_add(struct device *, const struct component_ops *); @@ -42,7 +64,6 @@ void component_del(struct device *, const struct component_ops *); int component_bind_all(struct device *parent, void *data); void component_unbind_all(struct device *parent, void *data); -struct aggregate_device; struct device *aggregate_device_parent(const struct aggregate_device *adev); /** From patchwork Thu Jan 27 20:01:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727244 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 33AA9C433F5 for ; Thu, 27 Jan 2022 20:02:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343683AbiA0UCH (ORCPT ); Thu, 27 Jan 2022 15:02:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343651AbiA0UCB (ORCPT ); Thu, 27 Jan 2022 15:02:01 -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 F202DC061748 for ; Thu, 27 Jan 2022 12:02:00 -0800 (PST) Received: by mail-pj1-x102d.google.com with SMTP id nn16-20020a17090b38d000b001b56b2bce31so4122839pjb.3 for ; Thu, 27 Jan 2022 12:02:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VhuBKYUydW/oAiCUL39yB0AWYBKOWjvjaMBQaeNTygM=; b=JTAhu45HjLrGN1796BA+tTBKdZIZpsx5QiysdWprNrAbi58xzewJb434XsoCmY5lZo 2icc8mot+qjYU3QPcf1TCDXdsDcWFn8RD/waujc1pge5siUAzBrhPvTWqhWVDw8zYIOs pkYsKKCxqQufaYfH19vEp8rPBJlN1Oat/78Fo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VhuBKYUydW/oAiCUL39yB0AWYBKOWjvjaMBQaeNTygM=; b=52NLjMfV/BB9E5S1agLZvawWSpy5HCCHA8UfzPZ5tkIom5RbLz6ugr9NCzHkmDigQH bE8GtUTRs0AYyNJ1BLOTSXHy+bSAatGbLBIW2BfFuFBBoBzPnQxSyBu4sefV05CpcQIq BhGGGE6kmWXxtgGsmaYG5BiuU1OIdFCYTn1zzbFbJBCqTxnftnRPaNc6O1gfXgv1k255 c0WvEJJtu0snk7e2gNyPUnznbXKF7NGt6fDM6cXSYSFW0eH0K2mQXTnaO8705jLeA17O wz1LtDtDUNtA32X9PETmDYcWseFSP3TDSpMQLs9deXg1HRjCdGXGvWpWTwcZ1QG+SbkM EyBg== X-Gm-Message-State: AOAM532np+p0epFWLlEgp7fKfa489tyFxmzaSY+8kAdUHbWBHy89Oa5T KhDewrZZlDgBU9Zv3x5Cj3MPGA== X-Google-Smtp-Source: ABdhPJxi2R1QyEM0RMEH1SPhkr28S9ztrw3wamvODzzAyi5rCnC4N/AyF0SlT/c4nduP8mKx2Vhr/w== X-Received: by 2002:a17:90b:1b08:: with SMTP id nu8mr5856603pjb.82.1643313720505; Thu, 27 Jan 2022 12:02:00 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.01.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:00 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Laurent Pinchart , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 05/35] drm/of: Add a drm_of_aggregate_probe() API Date: Thu, 27 Jan 2022 12:01:11 -0800 Message-Id: <20220127200141.1295328-6-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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 --- drivers/gpu/drm/drm_of.c | 85 +++++++++++++++++++++++++++++++--------- include/drm/drm_of.h | 12 ++++++ 2 files changed, 78 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 59d368ea006b..0fe822319aae 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -99,30 +99,18 @@ void drm_of_component_match_add(struct device *master, } EXPORT_SYMBOL_GPL(drm_of_component_match_add); -/** - * drm_of_component_probe - Generic probe function for a component based master - * @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 fails. - */ -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 = NULL; int i; if (!dev->of_node) return -EINVAL; + *matchptr = 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; 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); of_node_put(port); @@ -144,7 +132,7 @@ int drm_of_component_probe(struct device *dev, return -ENODEV; } - 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; } - 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); } + return 0; +} + +/** + * drm_of_component_probe - Generic probe function for a component based master + * @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 fails. + */ +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 = _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 aggregate 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 encoders 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 fails. + */ +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 = _drm_of_component_probe(dev, compare_of, &match); + if (ret) + return ret; + + return component_aggregate_register(dev, adrv, match); +} +EXPORT_SYMBOL(drm_of_aggregate_probe); + /* * drm_of_encoder_active_endpoint - return the active encoder endpoint * @node: device tree node containing encoder input ports diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h index 99f79ac8b4cd..7c7b0d8377a7 100644 --- a/include/drm/drm_of.h +++ b/include/drm/drm_of.h @@ -7,6 +7,7 @@ #include #endif +struct aggregate_driver; struct component_master_ops; struct component_match; struct device; @@ -40,6 +41,9 @@ void drm_of_component_match_add(struct device *master, int drm_of_component_probe(struct device *dev, int (*compare_of)(struct device *, void *), const struct component_master_ops *m_ops); +int drm_of_aggregate_probe(struct device *dev, + int (*compare_of)(struct device *, void *), + struct aggregate_driver *adrv); int drm_of_encoder_active_endpoint(struct device_node *node, struct drm_encoder *encoder, struct of_endpoint *endpoint); @@ -79,6 +83,14 @@ drm_of_component_probe(struct device *dev, return -EINVAL; } +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) From patchwork Thu Jan 27 20:01:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727251 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 6FF23C4167E for ; Thu, 27 Jan 2022 20:02:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343693AbiA0UCM (ORCPT ); Thu, 27 Jan 2022 15:02:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343669AbiA0UCG (ORCPT ); Thu, 27 Jan 2022 15:02:06 -0500 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3CBFC06174A for ; Thu, 27 Jan 2022 12:02:02 -0800 (PST) Received: by mail-pj1-x102e.google.com with SMTP id oa14-20020a17090b1bce00b001b61aed4a03so2803904pjb.5 for ; Thu, 27 Jan 2022 12:02:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Zwidypq4Go5OKqz8SmfacxJttUeteOhXrn3UaB5BhXk=; b=REahsmFv7SO2EJS19EQED429NY5ulcBzeS591w9Qh4Pq6DIrlxU+tNgz/zgHk4ndaQ WmxeguS5tRm+SlE5GaCWn5j2DmkfC+5tNTZZ21cjQj5J5I9mkVRp+aiMLbedeIhp/GB+ UotSKyXeCFEAFddTD58EeLeO4HL6mIql/DJrg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Zwidypq4Go5OKqz8SmfacxJttUeteOhXrn3UaB5BhXk=; b=hmS4wbUwN2J2RRbYUla+oAVbKfzQyrm1LM/PagJNYTLGnT/N1WziRu/OJO1YuQEBMv ME66aGugtKITqZY+g6Cb1X9Bhsz7uciJog5veyXZ2NUmxx3FB9kP9Z7nvTFb3FBYDuNa tVyrsX7QpjjvcCwhh1314wEWi2eqQSkr5EiCNPABVQt28zy85skl1IjBmSoc4mtS7iTp Ao61Y8wRtdMXiMPMMWP8CUfE4bEkyyudccfPFSunSCzn/GXSxOqGIT0W/uc4ITSp5ksO yomhzol5OKNl0IJ+KuRzQnHhm+N9VwenI4iqGD24FbHGP0ZioGb0I11Qh+v4AVZNMbiX o2jQ== X-Gm-Message-State: AOAM531JP849hLWFIGSDbIG/7AJKq95acFei2iXgQbKVYeV3TGbI17QE aeUZTTHD3fKWQtIuThQkVSlrCA== X-Google-Smtp-Source: ABdhPJyWAZjfirfkH7ymqHsj2L9OtTZWs6HiPoJtXWaYoR1/GX3EP0aYSGVsGYHdsaRFZkClJbP2WQ== X-Received: by 2002:a17:902:8c84:: with SMTP id t4mr2394992plo.78.1643313722210; Thu, 27 Jan 2022 12:02:02 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:01 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 06/35] drm/msm: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:12 -0800 Message-Id: <20220127200141.1295328-7-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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 --- drivers/gpu/drm/msm/msm_drv.c | 48 ++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index ad35a5d94053..32107e5cb547 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -1331,19 +1331,37 @@ static int add_gpu_components(struct device *dev, return 0; } -static int msm_drm_bind(struct device *dev) +static int msm_drm_bind(struct aggregate_device *adev) { - return msm_drm_init(dev, &msm_driver); + return msm_drm_init(aggregate_device_parent(adev), &msm_driver); } -static void msm_drm_unbind(struct device *dev) +static void msm_drm_unbind(struct aggregate_device *adev) { - msm_drm_uninit(dev); + msm_drm_uninit(aggregate_device_parent(adev)); +} + +static void msm_drm_shutdown(struct aggregate_device *adev) +{ + const struct device *parent = aggregate_device_parent(adev); + const struct platform_device *pdev = to_platform_device(parent); + struct msm_drm_private *priv = platform_get_drvdata(pdev); + struct drm_device *drm = priv ? priv->dev : NULL; + + if (!priv || !priv->kms) + return; + + drm_atomic_helper_shutdown(drm); } -static const struct component_master_ops msm_drm_ops = { - .bind = msm_drm_bind, - .unbind = msm_drm_unbind, +static struct aggregate_driver msm_drm_aggregate_driver = { + .probe = msm_drm_bind, + .remove = msm_drm_unbind, + .shutdown = msm_drm_shutdown, + .driver = { + .name = "msm_drm", + .owner = THIS_MODULE, + }, }; /* @@ -1395,7 +1413,7 @@ static int msm_pdev_probe(struct platform_device *pdev) if (ret) goto fail; - ret = component_master_add_with_match(&pdev->dev, &msm_drm_ops, match); + ret = component_aggregate_register(&pdev->dev, &msm_drm_aggregate_driver, match); if (ret) goto fail; @@ -1415,7 +1433,7 @@ static int msm_pdev_remove(struct platform_device *pdev) struct msm_drm_private *priv = platform_get_drvdata(pdev); struct msm_mdss *mdss = priv->mdss; - component_master_del(&pdev->dev, &msm_drm_ops); + component_aggregate_unregister(&pdev->dev, &msm_drm_aggregate_driver); of_platform_depopulate(&pdev->dev); if (mdss && mdss->funcs) @@ -1424,17 +1442,6 @@ static int msm_pdev_remove(struct platform_device *pdev) return 0; } -static void msm_pdev_shutdown(struct platform_device *pdev) -{ - struct msm_drm_private *priv = platform_get_drvdata(pdev); - struct drm_device *drm = priv ? priv->dev : NULL; - - if (!priv || !priv->kms) - return; - - drm_atomic_helper_shutdown(drm); -} - static const struct of_device_id dt_match[] = { { .compatible = "qcom,mdp4", .data = (void *)KMS_MDP4 }, { .compatible = "qcom,mdss", .data = (void *)KMS_MDP5 }, @@ -1450,7 +1457,6 @@ MODULE_DEVICE_TABLE(of, dt_match); static struct platform_driver msm_platform_driver = { .probe = msm_pdev_probe, .remove = msm_pdev_remove, - .shutdown = msm_pdev_shutdown, .driver = { .name = "msm", .of_match_table = dt_match, From patchwork Thu Jan 27 20:01:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727245 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 4D9AEC433FE for ; Thu, 27 Jan 2022 20:02:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343688AbiA0UCI (ORCPT ); Thu, 27 Jan 2022 15:02:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343671AbiA0UCG (ORCPT ); Thu, 27 Jan 2022 15:02:06 -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 2A826C061753 for ; Thu, 27 Jan 2022 12:02:04 -0800 (PST) Received: by mail-pj1-x1035.google.com with SMTP id o64so4154514pjo.2 for ; Thu, 27 Jan 2022 12:02:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DfnjF41HCOKigUHHElQ1GWXWlBxR3YM46STsN/SgFFM=; b=en86y2AOvAbg2KTFCVhSEXO0TVrdu/a0fKOWve2IDJGmOj4mSxrtVbnmRB71KDWpGx VEIgrT5qyGLia2WBCKyjZHkR9ucg+9WsVSjZ7iZAUPaUm+Rx5mLoumInbyK36EQolOF+ t095Yti2absn0BK8arUaVtgk6mouD51F/h+Qc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DfnjF41HCOKigUHHElQ1GWXWlBxR3YM46STsN/SgFFM=; b=I4KueBrJGw83W0QldZM6Hji3XIgWCMYbTziEQCLQ355ekKrTWG5Yv3aBUi5ydfC82f 4IoSogEC+F6XQS+3djRqz3pqu8j3IgbadkQ2WjsOE9o/73LOTW8Lhp7a9gAxR6PJd/z4 YIXVHw1ZyHJPWwu3BiTXXekzvqgMZ+H2KePr9SuiJ9gRWJoIPUkhi701pWCNcC2VyGKw UbzfTM3H53SziLAzW8yBD9mubHednsmFlm1xC+sK63yYeeb+bhWFdnkS+uAhLIWq83PI VHvsJ36q5UcVct9jgyw9UPkE2shmztnLvoL4Eci8eEd8+m2lqKo2519xRx4LqR1w64S/ eXMw== X-Gm-Message-State: AOAM5329wa8xqsMtkCmRwWn09DjFAAGYgpQqVR3ubfEMrysjqK/IPoW3 fRueo39p4fDgEWMJFKzb+yxDcA== X-Google-Smtp-Source: ABdhPJxcmmgspiZnHqRE8o1xWmcD3EypXwnytICOWnAqTR5UOd3FVpRwkmHOZpNcjLcOVKt7R7lLrQ== X-Received: by 2002:a17:902:7ec1:: with SMTP id p1mr4547318plb.159.1643313723638; Thu, 27 Jan 2022 12:02:03 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:03 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, James Qian Wang , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 07/35] drm/komeda: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:13 -0800 Message-Id: <20220127200141.1295328-8-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: 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 --- .../gpu/drm/arm/display/komeda/komeda_drv.c | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c index e7933930a657..5fa868cf9825 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c @@ -25,8 +25,9 @@ struct komeda_dev *dev_to_mdev(struct device *dev) return mdrv ? mdrv->mdev : NULL; } -static void komeda_unbind(struct device *dev) +static void komeda_unbind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct komeda_drv *mdrv = dev_get_drvdata(dev); if (!mdrv) @@ -45,8 +46,9 @@ static void komeda_unbind(struct device *dev) devm_kfree(dev, mdrv); } -static int komeda_bind(struct device *dev) +static int komeda_bind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct komeda_drv *mdrv; int err; @@ -87,9 +89,13 @@ static int komeda_bind(struct device *dev) return err; } -static const struct component_master_ops komeda_master_ops = { - .bind = komeda_bind, - .unbind = komeda_unbind, +static struct aggregate_driver komeda_aggregate_driver = { + .probe = komeda_bind, + .remove = komeda_unbind, + .driver = { + .name = "komeda_drm", + .owner = THIS_MODULE, + }, }; static int compare_of(struct device *dev, void *data) @@ -129,12 +135,12 @@ static int komeda_platform_probe(struct platform_device *pdev) komeda_add_slave(dev, &match, child, KOMEDA_OF_PORT_OUTPUT, 1); } - return component_master_add_with_match(dev, &komeda_master_ops, match); + return component_aggregate_register(dev, &komeda_aggregate_driver, match); } 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; } From patchwork Thu Jan 27 20:01:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727250 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 60FE6C43217 for ; Thu, 27 Jan 2022 20:02:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240157AbiA0UCM (ORCPT ); Thu, 27 Jan 2022 15:02:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343673AbiA0UCG (ORCPT ); Thu, 27 Jan 2022 15:02:06 -0500 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEEC6C061756 for ; Thu, 27 Jan 2022 12:02:05 -0800 (PST) Received: by mail-pl1-x62e.google.com with SMTP id c9so3660200plg.11 for ; Thu, 27 Jan 2022 12:02:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iMJcZepLim/YpIi7Y7hIab1z+GE+IIU8h9QgrFmMU/0=; b=OZNuVGwmg+5DpXtgxq+BMEkKae3EDK19392kSo4/J2z3xPzFGcdXFvJ1uC38LmN+lD RCdoVkHQwjCTjT9aJVj8uGSKfPaj4VhZ6b3P8SwCCKGRNX03bgKzXtD2isYFr1AFNjHr VPrC3gXCOEEDHIF0ibxT9aiOAQxnq9XdvcSRI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iMJcZepLim/YpIi7Y7hIab1z+GE+IIU8h9QgrFmMU/0=; b=KLB+c8TAg8L4PFbbuNzHgIjxhxw6xEyn+Vr7iEPzUzytRqPAo2WgJ661nmQMBeFcHq 2YixpHDhFFi0VUKMLKCt/1OVYFr9TV46W/LB/aoDexiLYcPGadEnKnYOYrk9F3lJOUZP n3klWOx9X5RPH2NP0Jp3ZsSYB5GmRZdijCC7OvkksU/L35OqKxnqbgKREzUkPGwoCRf2 UCL3nCsg+nJKch4vIjDve4CPJCmdlDji7R0UYX3PH2r0VAkspUzSc+bSdCdtgMSfkCOO WaL2C3d3s+Hvh1nRE4gs7T5EopoieLSDfy0u+Eb+Tthy//IhyUKVGjlJ3vWXq3XYrtDi OfLA== X-Gm-Message-State: AOAM531PsE7IDtJLwXT+ov7UnhcYAkj1M91CaPPP+Ztu+a764koeaKbF m+pNyF8CHtwz3uDcxS9/nr0MZA== X-Google-Smtp-Source: ABdhPJy5iEP9ZiYeQrh0T9dMlgNgumKZeRB+e4a/VBs0O8cCc+ML1Kugu6geT3ueGmazrHLnrAbX+A== X-Received: by 2002:a17:902:ab49:: with SMTP id ij9mr4763950plb.1.1643313725021; Thu, 27 Jan 2022 12:02:05 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:04 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Liviu Dudau , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 08/35] drm/arm/hdlcd: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:14 -0800 Message-Id: <20220127200141.1295328-9-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Liviu Dudau Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/arm/hdlcd_drv.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c index 479c2422a2e0..e3ed925797d5 100644 --- a/drivers/gpu/drm/arm/hdlcd_drv.c +++ b/drivers/gpu/drm/arm/hdlcd_drv.c @@ -270,8 +270,9 @@ static const struct drm_driver hdlcd_driver = { .minor = 0, }; -static int hdlcd_drm_bind(struct device *dev) +static int hdlcd_drm_bind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct drm_device *drm; struct hdlcd_drm_private *hdlcd; int ret; @@ -344,8 +345,9 @@ static int hdlcd_drm_bind(struct device *dev) return ret; } -static void hdlcd_drm_unbind(struct device *dev) +static void hdlcd_drm_unbind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct drm_device *drm = dev_get_drvdata(dev); struct hdlcd_drm_private *hdlcd = drm->dev_private; @@ -367,9 +369,13 @@ static void hdlcd_drm_unbind(struct device *dev) drm_dev_put(drm); } -static const struct component_master_ops hdlcd_master_ops = { - .bind = hdlcd_drm_bind, - .unbind = hdlcd_drm_unbind, +static struct aggregate_driver hdlcd_aggregate_driver = { + .probe = hdlcd_drm_bind, + .remove = hdlcd_drm_unbind, + .driver = { + .name = "hdlcd_drm", + .owner = THIS_MODULE, + }, }; static int compare_dev(struct device *dev, void *data) @@ -390,13 +396,12 @@ static int hdlcd_probe(struct platform_device *pdev) drm_of_component_match_add(&pdev->dev, &match, compare_dev, port); of_node_put(port); - return component_master_add_with_match(&pdev->dev, &hdlcd_master_ops, - match); + return component_aggregate_register(&pdev->dev, &hdlcd_aggregate_driver, match); } static int hdlcd_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &hdlcd_master_ops); + component_aggregate_unregister(&pdev->dev, &hdlcd_aggregate_driver); return 0; } From patchwork Thu Jan 27 20:01:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727249 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 8E45BC43219 for ; Thu, 27 Jan 2022 20:02:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343686AbiA0UCL (ORCPT ); Thu, 27 Jan 2022 15:02:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343648AbiA0UCH (ORCPT ); Thu, 27 Jan 2022 15:02:07 -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 B24C0C061759 for ; Thu, 27 Jan 2022 12:02:06 -0800 (PST) Received: by mail-pj1-x102c.google.com with SMTP id s2-20020a17090ad48200b001b501977b23so8675066pju.2 for ; Thu, 27 Jan 2022 12:02:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eLJCnI04jLKqZN/UJPBzqXUPWPAN0XVbPbOc1ZGY6qU=; b=DEFDTqec9EAgV78bsUSeeOgUOjpE2PZ60LrfxDPd0F5Ja1M7OoSVPixyF9mPpGTYtf jDiBonceMAplYpEW7lO1v2w1ka+CKtfuNKfnSqfu7r99b6ZRRYkUYkRbmv4w107O6IXe dtjVxyY/6RMgJRiJxYVUfSw9pUyxA8ZXMi1S4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eLJCnI04jLKqZN/UJPBzqXUPWPAN0XVbPbOc1ZGY6qU=; b=NzFjLqFOdGB1XjSrJZCMnQDAbPnKPdBi5mtNMg16lrD8sWn+pYwqYrhBDufHLf/lYt F+IVexF1bl8nYc9qSS+v4grd0enKqVHTh/A2bT72QsSufYlb8sqm5Zh06N/dhG0QZ1LW M2XRLvLK9N/OdxPhul6m48Pg0gum38pm9OCDL/YchzIK9SW0AyMnYVQZqn60bPfUX3CG KpwR54dEuDYqZUHr1+4rbbO6gjp2HZ/ibENCsCIJH/iX6fk6MPTRVrV8u6/Sxac28g6a G1UebkXpfvYobBlFyGpKt2AfwwCAeqRful31pWTJCoZ9fBXuk/UlBQwND1Ch2aWPG1xL c4PA== X-Gm-Message-State: AOAM531KeMftBe+ZsglZjOYgou3vQx5LpvxU3lSd1cbDM/N4hRHrKF7r zrCaCANBPbUgjSpV++OFT3RKug== X-Google-Smtp-Source: ABdhPJxUhucSYGodBqok8FGY5LN8HvAR2Eonn35ksEJ0ihq+SzWXGbQnXNaKnSR7JAD8OdQGRJ77xw== X-Received: by 2002:a17:902:ab43:: with SMTP id ij3mr1259523plb.102.1643313726269; Thu, 27 Jan 2022 12:02:06 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:05 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Laurent Pinchart , Liviu Dudau , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 09/35] drm/malidp: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:15 -0800 Message-Id: <20220127200141.1295328-10-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. 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 --- drivers/gpu/drm/arm/malidp_drv.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c index 78d15b04b105..7b946b962b22 100644 --- a/drivers/gpu/drm/arm/malidp_drv.c +++ b/drivers/gpu/drm/arm/malidp_drv.c @@ -702,8 +702,9 @@ static int malidp_runtime_pm_resume(struct device *dev) return 0; } -static int malidp_bind(struct device *dev) +static int malidp_bind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct resource *res; struct drm_device *drm; struct malidp_drm *malidp; @@ -894,8 +895,9 @@ static int malidp_bind(struct device *dev) return ret; } -static void malidp_unbind(struct device *dev) +static void malidp_unbind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct drm_device *drm = dev_get_drvdata(dev); struct malidp_drm *malidp = drm->dev_private; struct malidp_hw_device *hwdev = malidp->dev; @@ -921,9 +923,13 @@ static void malidp_unbind(struct device *dev) of_reserved_mem_device_release(dev); } -static const struct component_master_ops malidp_master_ops = { - .bind = malidp_bind, - .unbind = malidp_unbind, +static struct aggregate_driver malidp_aggregate_driver = { + .probe = malidp_bind, + .remove = malidp_unbind, + .driver = { + .name = "malidp_drm", + .owner = THIS_MODULE, + }, }; static int malidp_compare_dev(struct device *dev, void *data) @@ -949,13 +955,12 @@ static int malidp_platform_probe(struct platform_device *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); } 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; } From patchwork Thu Jan 27 20:01:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727246 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C0DBC43217 for ; Thu, 27 Jan 2022 20:02:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343682AbiA0UCJ (ORCPT ); Thu, 27 Jan 2022 15:02:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343666AbiA0UCI (ORCPT ); Thu, 27 Jan 2022 15:02:08 -0500 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16620C061747 for ; Thu, 27 Jan 2022 12:02:08 -0800 (PST) Received: by mail-pg1-x52e.google.com with SMTP id s16so3142197pgs.13 for ; Thu, 27 Jan 2022 12:02:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GBNCJskYdXfAX+d+IFXzB6ZhhAWcTNbUgQAvepRmgjg=; b=IxzF42BjOO2pquMk+0gv8AzrZphAavGJ0aSqJSR5mXo5r+dj56dPmYBUR0QILo7roS IXbnzV04OSgJkuxMxw54ooixm26YyHaYSuds9oMqzxbEb4y68B4fLJ0gM/lxcXafBprZ CSnK/dN9IGo4ps4eOLhOUWlUi5F2xJhNpB2K0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GBNCJskYdXfAX+d+IFXzB6ZhhAWcTNbUgQAvepRmgjg=; b=VAM9gN5WX6YmNYbXz0Dm3BKQtctWAN9uUmhTe6tuLvAtn3QVWRn8vqg8rMF5/ss3XW oZzdFFL6B2KSoNLJ5PVIo9n+ZZv6PfMQQbxk7oJ+9BJRW/wGypcS6hczo/Nxpd/zW+5l vHhhijZZ001AAqqnxpo8c5ezPuEvzA7vM2fNUtmFjLmVodWins1TLhU3crzNu4/+jrBl NveSHuBYxKuDIgjpj0YB/E4Jltr3yeGB2lPHKMkqxQahxZonKOOILpEPn9c7V4AOtjxJ uX6s/mA/3mx5+pfzxJdiDQiU2C+/0onnBDIRghjT139NkFG5vJebEbwpYmgd6GAfp0dF VMUg== X-Gm-Message-State: AOAM5313syuCeGDsHwznaRBOvkFpuCxgRKnTeB7nJBRN7hk8Kkc/kqxc qZYR4GsjzVlMssk9ahDPs2kDrg== X-Google-Smtp-Source: ABdhPJzMu2DT+wvnxujTHMVmyjXUqKBftpEoNz8zexEJYQkFqpbXavgbA3bJRklbVF0Xo3qXAUn7Nw== X-Received: by 2002:a62:e409:: with SMTP id r9mr4463825pfh.44.1643313727593; Thu, 27 Jan 2022 12:02:07 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:07 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Russell King , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Saravana Kannan Subject: [PATCH v6 10/35] drm/armada: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:16 -0800 Message-Id: <20220127200141.1295328-11-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Russell King Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/armada/armada_drv.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c index 8e3e98f13db4..27739cbe2291 100644 --- a/drivers/gpu/drm/armada/armada_drv.c +++ b/drivers/gpu/drm/armada/armada_drv.c @@ -60,8 +60,9 @@ static const struct drm_mode_config_funcs armada_drm_mode_config_funcs = { .atomic_commit = drm_atomic_helper_commit, }; -static int armada_drm_bind(struct device *dev) +static int armada_drm_bind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct armada_private *priv; struct resource *mem = NULL; int ret, n; @@ -159,8 +160,9 @@ static int armada_drm_bind(struct device *dev) return ret; } -static void armada_drm_unbind(struct device *dev) +static void armada_drm_unbind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct drm_device *drm = dev_get_drvdata(dev); struct armada_private *priv = drm_to_armada_dev(drm); @@ -202,9 +204,13 @@ static void armada_add_endpoints(struct device *dev, } } -static const struct component_master_ops armada_master_ops = { - .bind = armada_drm_bind, - .unbind = armada_drm_unbind, +static struct aggregate_driver armada_aggregate_driver = { + .probe = armada_drm_bind, + .remove = armada_drm_unbind, + .driver = { + .name = "armada_drm", + .owner = THIS_MODULE, + }, }; static int armada_drm_probe(struct platform_device *pdev) @@ -213,7 +219,7 @@ static int armada_drm_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; int ret; - ret = drm_of_component_probe(dev, compare_dev_name, &armada_master_ops); + ret = drm_of_aggregate_probe(dev, compare_dev_name, &armada_aggregate_driver); if (ret != -EINVAL) return ret; @@ -240,13 +246,12 @@ static int armada_drm_probe(struct platform_device *pdev) } } - return component_master_add_with_match(&pdev->dev, &armada_master_ops, - match); + return component_aggregate_register(&pdev->dev, &armada_aggregate_driver, match); } static int armada_drm_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &armada_master_ops); + component_aggregate_unregister(&pdev->dev, &armada_aggregate_driver); return 0; } From patchwork Thu Jan 27 20:01:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727248 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 6B283C433EF for ; Thu, 27 Jan 2022 20:02:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343649AbiA0UCK (ORCPT ); Thu, 27 Jan 2022 15:02:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343694AbiA0UCJ (ORCPT ); Thu, 27 Jan 2022 15:02:09 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E7A0C061748 for ; Thu, 27 Jan 2022 12:02:09 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id c3so3698498pls.5 for ; Thu, 27 Jan 2022 12:02:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qNjVi/dtor3YPPis15U918Dv8DbZI7rkWw2W0PoTyLw=; b=MbLWsQKtzqMdB6TR92CWX09HwWAVICVRUPQdGnE8qtwEt55hq1VEqji+rp8vrVgl/d DRHLMSEBAVQb3vSzBApvM3+l3ud49iQqe1JUvkQnDPH1XQHU3KLL2iBCm7lPVoTrf/hM KFpAvbmSKcOKdTOm9dEmOVr1LcIQUUKQDKVHo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qNjVi/dtor3YPPis15U918Dv8DbZI7rkWw2W0PoTyLw=; b=fXLuNCvmUbw451W7GFlIWoKRbCfwISbyY2bePmUQxdt94RaWB++aLXLchW5lH7sjyF Q2lwLedegU1+1tE/118iEfKh+s6FBodkhdoObJXgOQtjImOvqYpMp4WjBhWMh+EJZQuk jZb3TYmtbgqJ/Kox+iBIXWjQszhUVNBhnlwOyW9R0U2vEFi5/fl1iRXu9p+BjvT1aWbd FBmB4VNTHCE0ncH02GQK1nXNKrwXOrX8BNZxhnqYi6WBLjqMwxCGpSIE8N/bDClu2Kbo 4cITOQYPr9pRKHy+/Ca0byEMwrDi59RCLE53Z+Fmei5VB7O7KfPEPQyH8gG2xsZGXSnT A0VQ== X-Gm-Message-State: AOAM532yNkoOPXLgKW2QdRNDeX9P711ckuFsAzy42K43TTW2Wlf5+zvN vPle69JqxTRg5/nuA+3cqT2QjQ== X-Google-Smtp-Source: ABdhPJz+tPk8d+x+q2ZjVwxtYt5rjYPWT3YY5moMRA+Ipjppy+sGlcAobZY5/oFUFrZAy6t+oNlz4A== X-Received: by 2002:a17:902:d509:: with SMTP id b9mr4718199plg.42.1643313728886; Thu, 27 Jan 2022 12:02:08 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:08 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Lucas Stach , Russell King , Christian Gmeiner , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Saravana Kannan Subject: [PATCH v6 11/35] drm/etnaviv: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:17 -0800 Message-Id: <20220127200141.1295328-12-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: 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 --- 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/etnaviv/etnaviv_drv.c index 0b756ecb1bc2..5d1cc3953204 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c @@ -494,8 +494,9 @@ static const struct drm_driver etnaviv_drm_driver = { /* * Platform driver: */ -static int etnaviv_bind(struct device *dev) +static int etnaviv_bind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct etnaviv_drm_private *priv; struct drm_device *drm; int ret; @@ -552,8 +553,9 @@ static int etnaviv_bind(struct device *dev) return ret; } -static void etnaviv_unbind(struct device *dev) +static void etnaviv_unbind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct drm_device *drm = dev_get_drvdata(dev); struct etnaviv_drm_private *priv = drm->dev_private; @@ -569,9 +571,13 @@ static void etnaviv_unbind(struct device *dev) drm_dev_put(drm); } -static const struct component_master_ops etnaviv_master_ops = { - .bind = etnaviv_bind, - .unbind = etnaviv_unbind, +static struct aggregate_driver etnaviv_aggregate_driver = { + .probe = etnaviv_bind, + .remove = etnaviv_unbind, + .driver = { + .name = "etnaviv_drm", + .owner = THIS_MODULE, + }, }; static int compare_of(struct device *dev, void *data) @@ -639,12 +645,12 @@ static int etnaviv_pdev_probe(struct platform_device *pdev) if (first_node) of_dma_configure(&pdev->dev, first_node, true); - return component_master_add_with_match(dev, &etnaviv_master_ops, match); + return component_aggregate_register(dev, &etnaviv_aggregate_driver, match); } 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); return 0; } From patchwork Thu Jan 27 20:01:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727247 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 15C2FC4167B for ; Thu, 27 Jan 2022 20:02:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343674AbiA0UCL (ORCPT ); Thu, 27 Jan 2022 15:02:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343668AbiA0UCK (ORCPT ); Thu, 27 Jan 2022 15:02:10 -0500 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B442CC061747 for ; Thu, 27 Jan 2022 12:02:10 -0800 (PST) Received: by mail-pf1-x42b.google.com with SMTP id a8so3788709pfa.6 for ; Thu, 27 Jan 2022 12:02:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=V5D9W8mLQzBapDg8PfAl6xWrk61L3pMoLZNoKlrReQc=; b=Us8nN6E0hRmknbgfLO6sMIk5lgb5byWV5VYlILdj0cELP44JPjS1NfL65N4JRWx0QC K6x4pocN37foE0fWEh2I1lYGaMQGu/zv05JQ3yV/nV2eiCpDakPJ9HIV/R/pnz1ushah JXw1+0lpLlh7MSHzawG+YdhOzUbpm/ktDsNnw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=V5D9W8mLQzBapDg8PfAl6xWrk61L3pMoLZNoKlrReQc=; b=D/F4uypqdEvekh7yFckXB1ERbYzREhGd29T1j3ICfPC+pwqc/elSjY/TQ/uDWHnG4e YNh8a1SPvtSrYJcGGOYR6rKk0V96sFP08sdvMoY64dE9dbYWWNWAn4BlcWLKcihfcRYo xwjdypNCL/SugL/3F2i6J5xg8kVinAiGMSVZ1sKkTWxvl+sW0iwDOAG8ri5xsjNZ8r1X HcTQ5O0D31qqAgOrBQ1ofGu8MYmjOfLoNBClO81SJm9NG2QO6l0K+X59bA85SY9ChdQN lGNtRvShJC+QrtKzT+f21X3C5qpLylTkOBU0qsmLeliRvjplBx6L/kK2lvjA+xVGoqiG 8/Gg== X-Gm-Message-State: AOAM531VO8Luifx6NBOpTNjt/PdLvSjusbDnBFaNkY+suPL1Y9l1UR9u Cfec7EbUjfW38GR18IlhmUKEeg== X-Google-Smtp-Source: ABdhPJxXtbjlaVenB3yzOYY0uagjNycGvBicVRVVV0S8pQIqcpwlB0Y7yF6gDT8i/RK6UDO8P4+ylw== X-Received: by 2002:aa7:8484:: with SMTP id u4mr4344004pfn.70.1643313730286; Thu, 27 Jan 2022 12:02:10 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:09 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Xinliang Liu , Tian Tao , John Stultz , Xinwei Kong , Chen Feng , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 12/35] drm/kirin: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:18 -0800 Message-Id: <20220127200141.1295328-13-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Xinliang Liu Cc: Tian Tao Cc: John Stultz Cc: Xinwei Kong Cc: Chen Feng Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- .../gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index 98ae9a48f3fe..338077908177 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -217,8 +217,9 @@ static int kirin_drm_kms_cleanup(struct drm_device *dev) return 0; } -static int kirin_drm_bind(struct device *dev) +static int kirin_drm_bind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct kirin_drm_data *driver_data; struct drm_device *drm_dev; int ret; @@ -253,8 +254,9 @@ static int kirin_drm_bind(struct device *dev) return ret; } -static void kirin_drm_unbind(struct device *dev) +static void kirin_drm_unbind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct drm_device *drm_dev = dev_get_drvdata(dev); drm_dev_unregister(drm_dev); @@ -262,9 +264,13 @@ static void kirin_drm_unbind(struct device *dev) drm_dev_put(drm_dev); } -static const struct component_master_ops kirin_drm_ops = { - .bind = kirin_drm_bind, - .unbind = kirin_drm_unbind, +static struct aggregate_driver kirin_drm_aggregate_driver = { + .probe = kirin_drm_bind, + .remove = kirin_drm_unbind, + .driver = { + .name = "kirin_drm", + .owner = THIS_MODULE, + }, }; static int kirin_drm_platform_probe(struct platform_device *pdev) @@ -281,12 +287,12 @@ static int kirin_drm_platform_probe(struct platform_device *pdev) drm_of_component_match_add(dev, &match, compare_of, remote); of_node_put(remote); - return component_master_add_with_match(dev, &kirin_drm_ops, match); + return component_aggregate_register(dev, &kirin_drm_aggregate_driver, match); } static int kirin_drm_platform_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &kirin_drm_ops); + component_aggregate_unregister(&pdev->dev, &kirin_drm_aggregate_driver); return 0; } From patchwork Thu Jan 27 20:01:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727252 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 45598C433F5 for ; Thu, 27 Jan 2022 20:02:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343720AbiA0UCQ (ORCPT ); Thu, 27 Jan 2022 15:02:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343690AbiA0UCM (ORCPT ); Thu, 27 Jan 2022 15:02:12 -0500 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 245D3C06173B for ; Thu, 27 Jan 2022 12:02:12 -0800 (PST) Received: by mail-pf1-x433.google.com with SMTP id d187so3774244pfa.10 for ; Thu, 27 Jan 2022 12:02:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=p0aVwrwMtPKI+Zw3p14aaTjDl64C47sBEcl9anDi+5w=; b=kwn63WCLro2pEoW3NUZStHAHthYrQFBO+1kqeg7vZ8cjmQFS4RPcurvo1UPCUI+Zu8 DCf3dOakK6x7VObPCC2Q4M9xUJzgL5Td/24BIsWeDVcKmXGpiAVsawi7ymo0ynrlFQ+W ZYTQlHIHGczG/PxwdFJuVlHEKV6iuElGTDXfU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=p0aVwrwMtPKI+Zw3p14aaTjDl64C47sBEcl9anDi+5w=; b=yivOQH2RezHdycQdO6XpneJJ/yaiujIEDgb/lKpeNRcedZINcDS/2BH6zM6ebVzYeC +c7wc1Cwe9dK3AtVbBLr8eWoXlY7F5xOgZKk5sSIO0WTKlFCw5KLMHZA7P7Grux23zX+ kVoCPOo8SHlLI3Jjg2ZIVonjqyxXRmKMcqObn76ffQqDW4JXBbCGPcW7L/cN3jAd4K3x A0o5QHH2ki1tI1mBb1h7ZfSdau7r/h0LswLPU4b5wKtgwIANrvecZruN6QaDpRuBTDn6 yMf/02LyJpegxubsreDdqCDd+fRYNqS7oTPCpS2na3I7UTaWhroKxsRIu0N9DKFenF84 hV+A== X-Gm-Message-State: AOAM531fTWO7GLqt04NG2tCHEoNoV9aPgcRLEDFOWYvbEY6pzMECeKNZ /PDnRzpbhZyekXhw7vIQIc7NXPzQLJy24w== X-Google-Smtp-Source: ABdhPJyTdj2Y9H1zXEx5aZHrVW5+2vFsseg434LApAeWM0b1LjcrFdbsVgv1CpDt9kWrjMPypwnnEA== X-Received: by 2002:a65:6743:: with SMTP id c3mr3974983pgu.306.1643313731691; Thu, 27 Jan 2022 12:02:11 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:11 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 13/35] drm/exynos: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:19 -0800 Message-Id: <20220127200141.1295328-14-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: 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 --- 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/exynos/exynos_drm_drv.c index 9743b6b17447..f9a3e7041254 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -244,8 +244,9 @@ static struct component_match *exynos_drm_match_add(struct device *dev) return match ?: ERR_PTR(-ENODEV); } -static int exynos_drm_bind(struct device *dev) +static int exynos_drm_bind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct exynos_drm_private *private; struct drm_encoder *encoder; struct drm_device *drm; @@ -321,8 +322,9 @@ static int exynos_drm_bind(struct device *dev) return ret; } -static void exynos_drm_unbind(struct device *dev) +static void exynos_drm_unbind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct drm_device *drm = dev_get_drvdata(dev); drm_dev_unregister(drm); @@ -341,9 +343,13 @@ static void exynos_drm_unbind(struct device *dev) drm_dev_put(drm); } -static const struct component_master_ops exynos_drm_ops = { - .bind = exynos_drm_bind, - .unbind = exynos_drm_unbind, +static struct aggregate_driver exynos_drm_aggregate_driver = { + .probe = exynos_drm_bind, + .remove = exynos_drm_unbind, + .driver = { + .name = "exynos_drm", + .owner = THIS_MODULE, + }, }; static int exynos_drm_platform_probe(struct platform_device *pdev) @@ -356,13 +362,12 @@ static int exynos_drm_platform_probe(struct platform_device *pdev) if (IS_ERR(match)) return PTR_ERR(match); - return component_master_add_with_match(&pdev->dev, &exynos_drm_ops, - match); + return component_aggregate_register(&pdev->dev, &exynos_drm_aggregate_driver, match); } 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; } From patchwork Thu Jan 27 20:01:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727253 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 9CAB4C433FE for ; Thu, 27 Jan 2022 20:02:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343727AbiA0UCR (ORCPT ); Thu, 27 Jan 2022 15:02:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343699AbiA0UCN (ORCPT ); Thu, 27 Jan 2022 15:02:13 -0500 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C7BFC061749 for ; Thu, 27 Jan 2022 12:02:13 -0800 (PST) Received: by mail-pf1-x430.google.com with SMTP id v74so3808527pfc.1 for ; Thu, 27 Jan 2022 12:02:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jvZVmrWmp26tHtV/xiUrxR2MIRDqBUgzND7wS5OXNzU=; b=Bu/x2wm+DigW2JkVo+zDM2QAK9Lh8Lzi7VQRjJWQQjpG5TztXs0H13hQM2D+/X1afo F/CZqb3T2TwiS2OBBiEi612vc8lapJ2aK7gIt8pyAQrdw+v+7we61eZhP/USER4FIKc2 BG1pnFxhjATM9z47bzqsrsQz0U2Se0uYrH80Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jvZVmrWmp26tHtV/xiUrxR2MIRDqBUgzND7wS5OXNzU=; b=7nKPXAGIoEU9aLF6ibrnyAImx5bzeqbpeBT0OO1E/WhR7MZue9iMoc3swiraM/LZ8T aHLeDfcLG9x/Ey+Qywu4wvyhKZb60Q0OyXXUu4a4i+3VLbz/O6hHhggih80OXF0UMJBL gsNjk4QSdcldz2N60XgJNJ0CmTRvXv16t6WfkbtQ2vHt2BDyMOowY9x+gS64weVKqGPF Q9ltDI0w9b0TWnd34y8xRytCnXrmr2I7sd8pxiCl0IvzDqQhSekeY5zJeOHRXSfYaNfD 7pGDDe6MjwMM/QrMpEHn9+sY9iysteuhCTsIEE4fNDqIeYGMmS4xa9be3temkubgfNoi 8UjA== X-Gm-Message-State: AOAM530Wo6sE7GaB1LZ+QVIBOd9aw9xtJgjhVDVJBrsjvKrIoHOINsIX M0GuwIXFPHmx0oi+FUVQSfuLpw== X-Google-Smtp-Source: ABdhPJzgdo2xIvKWNBWJJ7FN2cYeL3DThlERus72aPFfW2Op1TpxXhf3bZPVZCrr2lRRpYJldojIjA== X-Received: by 2002:a63:fb4a:: with SMTP id w10mr3821171pgj.615.1643313732918; Thu, 27 Jan 2022 12:02:12 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:12 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Philipp Zabel , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 14/35] drm/imx: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:20 -0800 Message-Id: <20220127200141.1295328-15-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Philipp Zabel Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- 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-drm-core.c index cb685fe2039b..82645e42b7d3 100644 --- a/drivers/gpu/drm/imx/imx-drm-core.c +++ b/drivers/gpu/drm/imx/imx-drm-core.c @@ -196,8 +196,9 @@ static int compare_of(struct device *dev, void *data) return dev->of_node == np; } -static int imx_drm_bind(struct device *dev) +static int imx_drm_bind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct drm_device *drm; int ret; @@ -264,8 +265,9 @@ static int imx_drm_bind(struct device *dev) return ret; } -static void imx_drm_unbind(struct device *dev) +static void imx_drm_unbind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct drm_device *drm = dev_get_drvdata(dev); drm_dev_unregister(drm); @@ -279,14 +281,18 @@ static void imx_drm_unbind(struct device *dev) dev_set_drvdata(dev, NULL); } -static const struct component_master_ops imx_drm_ops = { - .bind = imx_drm_bind, - .unbind = imx_drm_unbind, +static struct aggregate_driver imx_drm_aggregate_driver = { + .probe = imx_drm_bind, + .remove = imx_drm_unbind, + .driver = { + .name = "imx_drm", + .owner = THIS_MODULE, + }, }; static int imx_drm_platform_probe(struct platform_device *pdev) { - int ret = drm_of_component_probe(&pdev->dev, compare_of, &imx_drm_ops); + int ret = drm_of_aggregate_probe(&pdev->dev, compare_of, &imx_drm_aggregate_driver); if (!ret) ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); @@ -296,7 +302,7 @@ static int imx_drm_platform_probe(struct platform_device *pdev) 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; } From patchwork Thu Jan 27 20:01:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727254 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 DABA4C433FE for ; Thu, 27 Jan 2022 20:02:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240093AbiA0UCX (ORCPT ); Thu, 27 Jan 2022 15:02:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343712AbiA0UCO (ORCPT ); Thu, 27 Jan 2022 15:02:14 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C94E4C06173B for ; Thu, 27 Jan 2022 12:02:14 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id k17so3764188plk.0 for ; Thu, 27 Jan 2022 12:02:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=14tXiFXD9g15QAgF752Bjks0tTvAFdkYAmJeNpUGDFE=; b=UJ3pWRNzqmBr5jjMWL3C1NCDOyzHTVGRBEEV5Qjr0RTHka8AG1QzIcMnCpxlWvVMRF l6qJLOapBxSEL5K/iiTXohEi3SbvC6S4Yl/qitYDN8qOWC1FARr7XcHB5d6bOo4QbiDy CO6UTVN3O9ByQaeACCXxYwSkKyp5A5fA4DqX8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=14tXiFXD9g15QAgF752Bjks0tTvAFdkYAmJeNpUGDFE=; b=EwbbtMQ6pOxroxfDvZTDmA3XaK3Pvr8iwE1V7sVmR6EDvFn1vBthD0P2tVDk2Xj0ty TXONPaY/bYTL5EaDSY04lT8+MjZrqKcHtoBlodEwBVLVDGhNY3iDY4bD69+97VN1YQPh F7JVRNu7V9VVs8I4ct9Y4wqVFCwD1uJnx21iR/0aMWeAk+oFtg/1Wr2U8QFioQ+Gy/2p 5M3fAlxTycWoKFmd5pSlm0B73triweSsMYBaNpTS4ftYCDleUchQUgnCNHuvUjcpyb9R +LU8qVK7r9L/g04QW8XQDzZAecxQEw3vD5XRqjbL9ZMmEqyfhQtRJ52CYslRoh0fr34d K/Pw== X-Gm-Message-State: AOAM532wK/EoUETYQBZD4xx4vrW3Pvn7Uhz22bJTqnS6uq8Di/FBIUiN xb/ntp09o+qW/OlgMyUsPHLd5g== X-Google-Smtp-Source: ABdhPJxj4NhIFULjjnOa82Bd+Ch/aLmNdqwZmV0dOkYUhrIX9rdCJEi2YGis8heu+ZpwIFq0oEXBhw== X-Received: by 2002:a17:90b:3a90:: with SMTP id om16mr5800717pjb.123.1643313734317; Thu, 27 Jan 2022 12:02:14 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:13 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Paul Cercueil , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 15/35] drm/ingenic: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:21 -0800 Message-Id: <20220127200141.1295328-16-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. 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 --- 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/ingenic/ingenic-drm-drv.c index b4943a56be09..c094f9917874 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c @@ -1317,8 +1317,10 @@ static int ingenic_drm_bind(struct device *dev, bool has_components) return ret; } -static int ingenic_drm_bind_with_components(struct device *dev) +static int ingenic_drm_bind_with_components(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); + return ingenic_drm_bind(dev, true); } @@ -1341,9 +1343,20 @@ static void ingenic_drm_unbind(struct device *dev) drm_atomic_helper_shutdown(&priv->drm); } -static const struct component_master_ops ingenic_master_ops = { - .bind = ingenic_drm_bind_with_components, - .unbind = ingenic_drm_unbind, +static void ingenic_aggregate_remove(struct aggregate_device *adev) +{ + struct device *dev = aggregate_device_parent(adev); + + ingenic_drm_unbind(dev); +} + +static struct aggregate_driver ingenic_aggregate_driver = { + .probe = ingenic_drm_bind_with_components, + .remove = ingenic_aggregate_remove, + .driver = { + .name = "ingenic_drm", + .owner = THIS_MODULE, + }, }; static int ingenic_drm_probe(struct platform_device *pdev) @@ -1363,7 +1376,7 @@ static int ingenic_drm_probe(struct platform_device *pdev) drm_of_component_match_add(dev, &match, compare_of, np); of_node_put(np); - return component_master_add_with_match(dev, &ingenic_master_ops, match); + return component_aggregate_register(dev, &ingenic_aggregate_driver, match); } static int ingenic_drm_remove(struct platform_device *pdev) @@ -1373,7 +1386,7 @@ static int ingenic_drm_remove(struct platform_device *pdev) if (!IS_ENABLED(CONFIG_DRM_INGENIC_IPU)) ingenic_drm_unbind(dev); else - component_master_del(dev, &ingenic_master_ops); + component_aggregate_unregister(dev, &ingenic_aggregate_driver); return 0; } From patchwork Thu Jan 27 20:01:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727256 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 1E894C4332F for ; Thu, 27 Jan 2022 20:02:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343839AbiA0UCd (ORCPT ); Thu, 27 Jan 2022 15:02:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343726AbiA0UCR (ORCPT ); Thu, 27 Jan 2022 15:02:17 -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 2F81BC061749 for ; Thu, 27 Jan 2022 12:02:16 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id b1-20020a17090a990100b001b14bd47532so4174732pjp.0 for ; Thu, 27 Jan 2022 12:02:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=m9a8zcSwcpladoTNvW+Mx8bO+UU4CpffIWXmtXe0Ndo=; b=X5ktv8lLpf+IELlZ3g3ez+/s2Mg1qsxtLoUl7oUREs6OxUk7pRfz3KrRj4laK6MZsJ rlPqF8raj9oFQiIAKqoNkqum2trbRgRBfAeKg2Mj8IQZD1i5xV+LgsrXqEpNEjAAYJgO LjwLv5Bx+fNXpHWa33uWdM5Vv444CSvs1Hz3Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=m9a8zcSwcpladoTNvW+Mx8bO+UU4CpffIWXmtXe0Ndo=; b=OR/3SovWP34qughxaSVbtgGlov3cg9/eIhVd8OXFZPoSIWB5OPW2UwccBvSSTz0muw NQIuALpcP1ghcB5h3Y6JJ652bUgLYJU9Y1MQ/qpCHY7/8EedskwtbUbvIHmDUZn5QO4s pE+u2rZqTlEBlOaMKfSo/E4uC0lwSS/RRw4C2HMohTdZpYlguXnRlDffUZvS92JfZIi5 aZGvA79G7LPFRepzU+lZA+Jny3AcW9ZPgVDKzPxiV5d0u8125Ftf+JHyVNYAmqX1orbT 6YanF3Ep2zgODA11dABOl0NOFEfCHIDu2QDNgRY9KH9MsTH8I4UwZn4PnoZ7ZPr2qiaC fLHw== X-Gm-Message-State: AOAM532vxE4X13K49bLnZ2vjSL8qc2b81NrXDIc5cgpQQ6ge9C7CKA1o DXtfq8ordrJ81tAvN9mgcNWwrw== X-Google-Smtp-Source: ABdhPJwhwwSoScMQGXENh1vbCzHG8zEwuePWTRvR/QDNk3tl3wOiOJIi3bcWWIfqw+HtCoBAtt+CIQ== X-Received: by 2002:a17:90b:4f4e:: with SMTP id pj14mr5917665pjb.220.1643313735720; Thu, 27 Jan 2022 12:02:15 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:15 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan , Linus Walleij Subject: [PATCH v6 16/35] drm/mcde: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:22 -0800 Message-Id: <20220127200141.1295328-17-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Tested-by: Linus Walleij Signed-off-by: Stephen Boyd --- 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_drv.c index 5b5afc6aaf8e..b8479355844e 100644 --- a/drivers/gpu/drm/mcde/mcde_drv.c +++ b/drivers/gpu/drm/mcde/mcde_drv.c @@ -215,8 +215,9 @@ static const struct drm_driver mcde_drm_driver = { DRM_GEM_CMA_DRIVER_OPS, }; -static int mcde_drm_bind(struct device *dev) +static int mcde_drm_bind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct drm_device *drm = dev_get_drvdata(dev); int ret; @@ -247,8 +248,9 @@ static int mcde_drm_bind(struct device *dev) return ret; } -static void mcde_drm_unbind(struct device *dev) +static void mcde_drm_unbind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct drm_device *drm = dev_get_drvdata(dev); drm_dev_unregister(drm); @@ -256,9 +258,13 @@ static void mcde_drm_unbind(struct device *dev) component_unbind_all(drm->dev, drm); } -static const struct component_master_ops mcde_drm_comp_ops = { - .bind = mcde_drm_bind, - .unbind = mcde_drm_unbind, +static struct aggregate_driver mcde_drm_comp_driver = { + .probe = mcde_drm_bind, + .remove = mcde_drm_unbind, + .driver = { + .name = "mcde_drm", + .owner = THIS_MODULE, + }, }; static struct platform_driver *const mcde_component_drivers[] = { @@ -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 = 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); - ret = component_master_add_with_match(&pdev->dev, &mcde_drm_comp_ops, - match); + ret = component_aggregate_register(&pdev->dev, &mcde_drm_comp_driver, match); 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 = platform_get_drvdata(pdev); struct mcde *mcde = to_mcde(drm); - 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); From patchwork Thu Jan 27 20:01:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727255 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 BA3A7C433FE for ; Thu, 27 Jan 2022 20:02:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343721AbiA0UCd (ORCPT ); Thu, 27 Jan 2022 15:02:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343669AbiA0UCR (ORCPT ); Thu, 27 Jan 2022 15:02:17 -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 5DB8DC061757 for ; Thu, 27 Jan 2022 12:02:17 -0800 (PST) Received: by mail-pj1-x102c.google.com with SMTP id r59so4135352pjg.4 for ; Thu, 27 Jan 2022 12:02:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5nHsB00jtundOhkCVDWS5TBuSGtd2+UB36XQklCAGT4=; b=EAPzMHqfta1nmc6u+9Lz9Pg6102ho3xcaQ0U7gHOVeh/7b1Y70gnQahXl4F8vZwb31 vmNDp4HH13iMO7nVsGIQmuOMCJmPL2XQTGmVOBYhIDww/Ty5WgBFNioiYZQymIEd9BcH hEsTcdMeWg/p03KnJHevUNINE8XesrzNa0HBQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5nHsB00jtundOhkCVDWS5TBuSGtd2+UB36XQklCAGT4=; b=zEsu/HZILchrx4xAH/sU9jC2rUTJogZKNbfZ4TAqPsqRAUJq0ndL/xi5qPyoS64/5Y tL5eiBKwIayoKQKIbGtNxHkKYyk+4sbaOJIkKjIyM2QZFfd7zMdgR3BizOMj2rbQqCI2 p/AJ8OLFvIdticXRD0+75ld/j/RxQOgIqHIZtXQk7+MVx/bWh+iOI+74sUre8CWBTRCV MwnwvPbRm3w5dfUx20IMXInFz8eY68Cy7KjP+RYF3gDj0h4byHyuDUo8PdGDr7rRfiY7 dgcgZ7RcREif4nYBPMOyT6V8BKoysRxQ9J0a9u+IRaWqEfuFGgPF9YeYuC8PLufPM4P9 RLRA== X-Gm-Message-State: AOAM533LIVbxuFfdoCHixSSZW9Lb61RmtbGQEaYFyfw5fZBRSwOSLvdo 6ghvVEFw0Ig+ONAIDc9CbVMt2A== X-Google-Smtp-Source: ABdhPJzAgFOIdFDf3XTRUBFIzS7iQ6d3J1G2j6LVj19GOwcMvSsXue1RzG2Hk4lmi4hswUqUzBKqNQ== X-Received: by 2002:a17:902:c40b:: with SMTP id k11mr4550482plk.48.1643313736945; Thu, 27 Jan 2022 12:02:16 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:16 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Chun-Kuang Hu , Philipp Zabel , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 17/35] drm/mediatek: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:23 -0800 Message-Id: <20220127200141.1295328-18-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: 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 --- 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/mediatek/mtk_drm_drv.c index 56ff8c57ef8f..b486e98bf8d9 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -374,8 +374,9 @@ static int compare_of(struct device *dev, void *data) return dev->of_node == data; } -static int mtk_drm_bind(struct device *dev) +static int mtk_drm_bind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct mtk_drm_private *private = dev_get_drvdata(dev); struct drm_device *drm; int ret; @@ -406,8 +407,9 @@ static int mtk_drm_bind(struct device *dev) return ret; } -static void mtk_drm_unbind(struct device *dev) +static void mtk_drm_unbind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct mtk_drm_private *private = dev_get_drvdata(dev); drm_dev_unregister(private->drm); @@ -417,9 +419,13 @@ static void mtk_drm_unbind(struct device *dev) private->drm = NULL; } -static const struct component_master_ops mtk_drm_ops = { - .bind = mtk_drm_bind, - .unbind = mtk_drm_unbind, +static struct aggregate_driver mtk_drm_aggregate_driver = { + .probe = mtk_drm_bind, + .remove = mtk_drm_unbind, + .driver = { + .name = "mtk_drm", + .owner = THIS_MODULE, + }, }; static const struct of_device_id mtk_ddp_comp_dt_ids[] = { @@ -635,7 +641,7 @@ static int mtk_drm_probe(struct platform_device *pdev) platform_set_drvdata(pdev, private); - ret = component_master_add_with_match(dev, &mtk_drm_ops, match); + ret = component_aggregate_register(dev, &mtk_drm_aggregate_driver, match); if (ret) goto err_pm; @@ -658,7 +664,7 @@ static int mtk_drm_remove(struct platform_device *pdev) struct mtk_drm_private *private = platform_get_drvdata(pdev); int i; - 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 = 0; i < DDP_COMPONENT_ID_MAX; i++) From patchwork Thu Jan 27 20:01:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727257 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 85445C433F5 for ; Thu, 27 Jan 2022 20:02:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343855AbiA0UCe (ORCPT ); Thu, 27 Jan 2022 15:02:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343749AbiA0UCW (ORCPT ); Thu, 27 Jan 2022 15:02:22 -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 8F5D5C061758 for ; Thu, 27 Jan 2022 12:02:18 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id my12-20020a17090b4c8c00b001b528ba1cd7so4148023pjb.1 for ; Thu, 27 Jan 2022 12:02:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tKM5wKimMvZrAKvGy1t7H+N3RMdb/rkm3Tm4lDXJEMA=; b=XUA+m1YsSZShroTZxfw39Qf7S7B1mW7M+xw0s6IqXclDbYYmVnWy+Ltexawu32I40i SZdmr0pz3HmsdbVQcfZ/V4B7woFqglI8B4G8TpywXFwHGjG3A3tCniZTF+Fg5dgU0QFM SRmxEWIy2hA9dTzCtAUaHb/6famrkeiHYK5WM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tKM5wKimMvZrAKvGy1t7H+N3RMdb/rkm3Tm4lDXJEMA=; b=AdXONSh1+r2slYU08hOk0zNvXU505OXVrSjb1mUOBv+8J5Ohio3bAvfFpfuuDOiHFN SBP9EiBWSNdR5hvTAUFYDAo7JQ9taooYb3o7RMFmAEoCC9gwSgf7trE1QGzLxKJsLndv 58lJl6UJFhB2Z3iKWQ/ef7k22oPDYzAmhpeg3HieAMLfO7wzHAAry/knN1lUVw4aE18b LarfBRxcQrTFSpvWDK4kAmIOrIS0215gRvwHvwLM8h/tCMpyP+RXutSRf6y/UJVPoOIU CNobISiuuDDrqB3LVMjipDtpewcbuqXdNAlYRNycNwu/IXdIpXexjDZwzixTGZcSgvXc FIKA== X-Gm-Message-State: AOAM533B4wIWJOlXFcA4eBWsZj8+HykTjB43glfxrrU35LpHUjtMk0ZO gTX3ssDTjLsM2qHsDH25XTNt/Q== X-Google-Smtp-Source: ABdhPJzt+Sz+dY3sN15K0S3lh3rhsQZdiGkdCkL9I2zth8eNN++n1IHK4TSncBJrfWf1JT2jGXzfuA== X-Received: by 2002:a17:902:ed82:: with SMTP id e2mr5198385plj.55.1643313738116; Thu, 27 Jan 2022 12:02:18 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:17 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Neil Armstrong , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 18/35] drm/meson: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:24 -0800 Message-Id: <20220127200141.1295328-19-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Neil Armstrong Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- 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/meson_drv.c index 80f1d439841a..2add29b347a8 100644 --- a/drivers/gpu/drm/meson/meson_drv.c +++ b/drivers/gpu/drm/meson/meson_drv.c @@ -361,13 +361,16 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) return ret; } -static int meson_drv_bind(struct device *dev) +static int meson_drv_bind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); + return meson_drv_bind_master(dev, true); } -static void meson_drv_unbind(struct device *dev) +static void meson_drv_unbind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct meson_drm *priv = dev_get_drvdata(dev); struct drm_device *drm = priv->drm; @@ -391,9 +394,13 @@ static void meson_drv_unbind(struct device *dev) } } -static const struct component_master_ops meson_drv_master_ops = { - .bind = meson_drv_bind, - .unbind = meson_drv_unbind, +static struct aggregate_driver meson_aggregate_drv = { + .probe = meson_drv_bind, + .remove = meson_drv_unbind, + .driver = { + .name = "meson_drm", + .owner = THIS_MODULE, + }, }; static int __maybe_unused meson_drv_pm_suspend(struct device *dev) @@ -487,9 +494,7 @@ static int meson_drv_probe(struct platform_device *pdev) if (count) { dev_info(&pdev->dev, "Queued %d outputs on vpu\n", count); - return component_master_add_with_match(&pdev->dev, - &meson_drv_master_ops, - match); + return component_aggregate_register(&pdev->dev, &meson_aggregate_drv, match); } /* If no output endpoints were available, simply bail out */ From patchwork Thu Jan 27 20:01:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727258 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 D678DC4321E for ; Thu, 27 Jan 2022 20:02:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343749AbiA0UCf (ORCPT ); Thu, 27 Jan 2022 15:02:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343757AbiA0UCW (ORCPT ); Thu, 27 Jan 2022 15:02:22 -0500 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEB31C06175D for ; Thu, 27 Jan 2022 12:02:19 -0800 (PST) Received: by mail-pj1-x1029.google.com with SMTP id o64so4156037pjo.2 for ; Thu, 27 Jan 2022 12:02:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cGCYteteinr61zPnRrp4oGl0a47ZYXq3HmBJU43ZKkM=; b=k1sf94SonpGpLzpc1eZgA1C/aa+5bazFQmE3BqTBpHJIhPTVql2l5ddtWUYF0w2amf xglsb43JXD9he1Z6Lxg3FS8Mv9yHCSn7eNZo/7dJohdzh70qL8bvwWxSUMBvwRaJQvrW T/LIMTGmPZC8er6bC0A63ZUFrWWtFwytLjG8Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cGCYteteinr61zPnRrp4oGl0a47ZYXq3HmBJU43ZKkM=; b=L4t/ommiPf9VBDVveJQ/j6KrwbQe/MDLOXpAJ9hayQRlWWaUVko/mg/xmDHpWvCsyE SqITTWSeMHucCyN4UgsRjbx1VE5A0jAPh2mWR3pcQ2yIcMt0og4weJMIPKrtZ9kajW3Q JJ044lVKG4gGUWVFonLk3VjGKYt03oRBqkQjdANADY2GjQK4/jPKKdySMQTRBvTtIJB/ 6NBm5YzGsWnzs9hMTt48kCft1Srr1YVEYEHEtwaXc/1d3idoDwSb65ri4iKIbVW7Xps5 rELjrqy+lEuqMWhI1kRf42eaXwFDfysLXPj961Q/gaQysNLIdKn+BWF589XCQ7RiWhVx v70g== X-Gm-Message-State: AOAM531FpSPFeLAH2Unuk4ENk6Ga7BHj/Kr5ljrhDxX1XuEiNsFsS6o1 lM5TOnPQqfbHO53dfUX64y5CNg== X-Google-Smtp-Source: ABdhPJw9/AERVJn/DWVhf7xxY/0tKAxYCNg3kYQRZkczeiE7EyDOGTbC8tRqk37+MKPkwel0JA2hBA== X-Received: by 2002:a17:903:2352:: with SMTP id c18mr5295494plh.104.1643313739361; Thu, 27 Jan 2022 12:02:19 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:19 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Tomi Valkeinen , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 19/35] drm/omap: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:25 -0800 Message-Id: <20220127200141.1295328-20-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Tomi Valkeinen Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- 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/dss/dss.c index 69b3e15b9356..96a290a7bd68 100644 --- a/drivers/gpu/drm/omapdrm/dss/dss.c +++ b/drivers/gpu/drm/omapdrm/dss/dss.c @@ -1304,8 +1304,9 @@ static const struct soc_device_attribute dss_soc_devices[] = { { /* sentinel */ } }; -static int dss_bind(struct device *dev) +static int dss_bind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct dss_device *dss = 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; } -static void dss_unbind(struct device *dev) +static void dss_unbind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct dss_device *dss = dev_get_drvdata(dev); platform_device_unregister(dss->drm_pdev); @@ -1339,9 +1341,13 @@ static void dss_unbind(struct device *dev) component_unbind_all(dev, NULL); } -static const struct component_master_ops dss_component_ops = { - .bind = dss_bind, - .unbind = dss_unbind, +static struct aggregate_driver dss_aggregate_driver = { + .probe = dss_bind, + .remove = dss_unbind, + .driver = { + .name = "dss_drm", + .owner = THIS_MODULE, + }, }; static int dss_component_compare(struct device *dev, void *data) @@ -1502,7 +1508,7 @@ static int dss_probe(struct platform_device *pdev) cmatch.match = &match; device_for_each_child(&pdev->dev, &cmatch, dss_add_child_component); - r = component_master_add_with_match(&pdev->dev, &dss_component_ops, match); + r = component_aggregate_register(&pdev->dev, &dss_aggregate_driver, match); if (r) goto err_of_depopulate; @@ -1541,7 +1547,7 @@ static int dss_remove(struct platform_device *pdev) of_platform_depopulate(&pdev->dev); - component_master_del(&pdev->dev, &dss_component_ops); + component_aggregate_unregister(&pdev->dev, &dss_aggregate_driver); dss_debugfs_remove_file(dss->debugfs.clk); dss_debugfs_remove_file(dss->debugfs.dss); From patchwork Thu Jan 27 20:01:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727326 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 97B38C4321E for ; Thu, 27 Jan 2022 20:03:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343784AbiA0UDk (ORCPT ); Thu, 27 Jan 2022 15:03:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343767AbiA0UCY (ORCPT ); Thu, 27 Jan 2022 15:02:24 -0500 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E442C061763 for ; Thu, 27 Jan 2022 12:02:21 -0800 (PST) Received: by mail-pl1-x631.google.com with SMTP id j16so3704467plx.4 for ; Thu, 27 Jan 2022 12:02:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IW/8Y9aTwhLOwEb2xP1btnAgZlqJiVoA25E4MQ0ztlM=; b=Orc/8SO3R+dEVDvMgPCjrMtDqLFJ0Q6HS0V1upmPpUW4kXr9C4iejmRDOGbRV9iW4j k9loF01QGaULZ1/ixZXpaAmhKNCK4M8hIxc3gWmGet47QcH0vvkYz42DwlJvJdht3Dnv tqIWTsf24/eGXmaKQV4HRtIrBwUEtqhRo9dI4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IW/8Y9aTwhLOwEb2xP1btnAgZlqJiVoA25E4MQ0ztlM=; b=QeubNZ8hNZbqSxxmPUllkCKOsFnV7fk5mGwq2NS/WiTym/KM0sA1zwTdcGhXkN0I6Y drRDpW5TrUGa3R+NQdjb63BHOQpoj12rQCw7W/BWD+KD85uPoBzVgSrnT/1EIcNqGTff Mg1B+56PR0NMHMIC+ImqkYqXagy80NUrMGfZy4oCfn1ifgPD5HRgRr6mUdOQUcRWV7Bv gS7CcJg79JM3RYCYbwTxgseTFsQ8Sg/45aijojTEgBnWb5YKHfkaFSgnFft906Bgzv1O hGs9wkC3nbM4XB2h7gGglNXM7KrxOV6oCbCrzvOUJ+WXYJ0FfolW5+7r1IK22u8D4QYd AOyw== X-Gm-Message-State: AOAM531q0drjor5TxqYhLpvjKNcP21GJwkREZeh/FSYM30t4YgxI+3nq 19gmzP8AaXYW2Do/ur/kExWMOA== X-Google-Smtp-Source: ABdhPJwbPVI8xDeM1NWvY0IzOnQ+E4h23xnsQ0RPm+d8WXJjw8YoUnpfi1pwRQVIiRppcVlDbKUIrA== X-Received: by 2002:a17:902:da90:: with SMTP id j16mr4907623plx.101.1643313740669; Thu, 27 Jan 2022 12:02:20 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:20 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 20/35] drm/rockchip: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:26 -0800 Message-Id: <20220127200141.1295328-21-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Sandy Huang Cc: "Heiko Stübner" Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index bec207de4544..6a6ed293d7a0 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -108,8 +108,9 @@ static void rockchip_iommu_cleanup(struct drm_device *drm_dev) iommu_domain_free(private->domain); } -static int rockchip_drm_bind(struct device *dev) +static int rockchip_drm_bind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct drm_device *drm_dev; struct rockchip_drm_private *private; int ret; @@ -179,8 +180,9 @@ static int rockchip_drm_bind(struct device *dev) return ret; } -static void rockchip_drm_unbind(struct device *dev) +static void rockchip_drm_unbind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct drm_device *drm_dev = dev_get_drvdata(dev); drm_dev_unregister(drm_dev); @@ -331,9 +333,13 @@ static struct component_match *rockchip_drm_match_add(struct device *dev) return match ?: ERR_PTR(-ENODEV); } -static const struct component_master_ops rockchip_drm_ops = { - .bind = rockchip_drm_bind, - .unbind = rockchip_drm_unbind, +static struct aggregate_driver rockchip_aggregate_driver = { + .probe = rockchip_drm_bind, + .remove = rockchip_drm_unbind, + .driver = { + .name = "rockchip_drm", + .owner = THIS_MODULE, + }, }; static int rockchip_drm_platform_of_probe(struct device *dev) @@ -404,7 +410,7 @@ static int rockchip_drm_platform_probe(struct platform_device *pdev) if (IS_ERR(match)) return PTR_ERR(match); - ret = component_master_add_with_match(dev, &rockchip_drm_ops, match); + ret = component_aggregate_register(dev, &rockchip_aggregate_driver, match); if (ret < 0) { rockchip_drm_match_remove(dev); return ret; @@ -415,7 +421,7 @@ static int rockchip_drm_platform_probe(struct platform_device *pdev) 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); rockchip_drm_match_remove(&pdev->dev); From patchwork Thu Jan 27 20:01:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727324 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 3CBF4C43219 for ; Thu, 27 Jan 2022 20:03:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343772AbiA0UDk (ORCPT ); Thu, 27 Jan 2022 15:03:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343829AbiA0UCd (ORCPT ); Thu, 27 Jan 2022 15:02:33 -0500 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E937C06173B for ; Thu, 27 Jan 2022 12:02:22 -0800 (PST) Received: by mail-pj1-x1035.google.com with SMTP id h20-20020a17090adb9400b001b518bf99ffso8674520pjv.1 for ; Thu, 27 Jan 2022 12:02:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=km10INCJaOtDHcOHVEwChqxOVacq/jIckMelDPfId8g=; b=J8JG6dKaTSgfj58AmDZpi6NnG+1JvETfnLcowzBO0x3Qy6rq53OG3iQ8SC2QccH5or kmgbyTIrVRw0FWOwvHltipYgDOSZF7UsNLQJmt8RPYt7bZEC1QEFqPorauhu3o+T5eYP kfOEQHep0THj6hqQ1LSBWSiaqR3ifg2OFHhXo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=km10INCJaOtDHcOHVEwChqxOVacq/jIckMelDPfId8g=; b=akcEvpBUnUjc5EeSUwnP5+T0zJrtNB5/P+WedALH9NbSnK2J/u21hsVtNFJ690fxl+ EUCi01LxW/XqUYAV8FTEf7+2dTL2wLzhO66JZs8E+L7uPRj5mDXkUPGU5ZdfnKF78mqx pfDuKT2ZRQ5wCQuyLMc0Irce7sOgScx77/BAbzf6r8FOVdkDkXE/winK+lwr4wC6KI0X OoDAYOP0AOuigjJ93mNl9qdaF9ISQeoynOeZvAteMYW6BgUlErejcEv6T2byHgNYzTsh X5sfS6V0hKaOlqUlxyDoy7Fsf6YFv8zpg85NpT5kY1HMOGsemDfP7MXPQryt8eoZWTQq DDpA== X-Gm-Message-State: AOAM530pZkmJIjGIe/537Xk0AXzIY1KjuwpO2KsEEOwFHzVxlIkgK1g1 zq/xgG7HpAc9THChIbuVt1J+Aw== X-Google-Smtp-Source: ABdhPJwyogmHpshiG/xBbuQWcVBd4OG6Znv+GNEvLhn4iDt5WgBHGlQonK0bd4e81r4GQLgrtX2nyA== X-Received: by 2002:a17:90b:1d91:: with SMTP id pf17mr15477568pjb.160.1643313741993; Thu, 27 Jan 2022 12:02:21 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:21 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 21/35] drm/sti: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:27 -0800 Message-Id: <20220127200141.1295328-22-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/sti/sti_drv.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c index c7efb43b83ee..958db315d547 100644 --- a/drivers/gpu/drm/sti/sti_drv.c +++ b/drivers/gpu/drm/sti/sti_drv.c @@ -182,8 +182,9 @@ static void sti_cleanup(struct drm_device *ddev) ddev->dev_private = NULL; } -static int sti_bind(struct device *dev) +static int sti_bind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct drm_device *ddev; int ret; @@ -216,8 +217,9 @@ static int sti_bind(struct device *dev) return ret; } -static void sti_unbind(struct device *dev) +static void sti_unbind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct drm_device *ddev = dev_get_drvdata(dev); drm_dev_unregister(ddev); @@ -225,9 +227,13 @@ static void sti_unbind(struct device *dev) drm_dev_put(ddev); } -static const struct component_master_ops sti_ops = { - .bind = sti_bind, - .unbind = sti_unbind, +static struct aggregate_driver sti_aggregate_driver = { + .probe = sti_bind, + .remove = sti_unbind, + .driver = { + .name = "sti_drm", + .owner = THIS_MODULE, + }, }; static int sti_platform_probe(struct platform_device *pdev) @@ -249,12 +255,12 @@ static int sti_platform_probe(struct platform_device *pdev) child_np = of_get_next_available_child(node, child_np); } - return component_master_add_with_match(dev, &sti_ops, match); + return component_aggregate_register(dev, &sti_aggregate_driver, match); } static int sti_platform_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &sti_ops); + component_aggregate_unregister(&pdev->dev, &sti_aggregate_driver); return 0; } From patchwork Thu Jan 27 20:01:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727261 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 5ACAEC433FE for ; Thu, 27 Jan 2022 20:03:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230217AbiA0UC4 (ORCPT ); Thu, 27 Jan 2022 15:02:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343830AbiA0UCd (ORCPT ); Thu, 27 Jan 2022 15:02:33 -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 AF1EBC061753 for ; Thu, 27 Jan 2022 12:02:23 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id d15-20020a17090a110f00b001b4e7d27474so4146937pja.2 for ; Thu, 27 Jan 2022 12:02:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WZZOtrHonizJg96tLMp/t5Fsa0Q7P0xuTO1TufH5G0g=; b=JtASTOgjliVzgUuDAEkW0Ir5wrdjaMJtLwikgtGfArBmRuX33OZG0aepVuJRx2P4EY K5Jj7OesE+FqfW5gq9Ay8XCHtB7gY/xTVO9TMH8Moi/hdtqH5YekBCbOK8iwI9v0qKx2 u1JKO+JV8tJOVYIHoSfVA+SwgZ2Vh34t89+2Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WZZOtrHonizJg96tLMp/t5Fsa0Q7P0xuTO1TufH5G0g=; b=FxnNzoPPU2LvrTGutqG42J+/ZQVfBvHbWGEW3br/3PEPV4V7AolCVp41mYvKhKawj4 Kys504xNIBIcK+Ca2VCEjnMjuUUA+SBUUxwQK3m+PA+c++xbGkufoRLIUREvf8+mwNpk omlrxYmD9igXq1DQXxkR0fYD2bSGodOVIDQc6UuN2ZxRmi0cn8YryGKIAyBb+Y2u1IvY dPEPEU32vJwqluPGttrl2jkkiNsp1+IMXiEhCnttcOjrJzqYrfG28KDuLgDDQA28pral ZaGcyDDuk+TKlWKQFxIjcUyKs6Wei6wugRNmMy+CDPlZshTShIqMjA4BwkonNibHbbrL +KYA== X-Gm-Message-State: AOAM530c/LkwVEs6ue/jmWt0kTgCH09egCoZ7KWrrSL4Piir/Nvvup5G 4R3Y6Ehm9w/+h6S/vWMCrAy/FA== X-Google-Smtp-Source: ABdhPJwmi+gC9GIk+mPiD3jpNbRlfOIDByFSs57GlbKAx7rEbL4+ShWkEE9cxHVpUb+UV2YhHX+FQA== X-Received: by 2002:a17:90b:38d1:: with SMTP id nn17mr5880056pjb.58.1643313743266; Thu, 27 Jan 2022 12:02:23 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:22 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Maxime Ripard , Chen-Yu Tsai , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 22/35] drm/sun4i: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:28 -0800 Message-Id: <20220127200141.1295328-23-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: 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 --- 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/sun4i_drv.c index b630614b3d72..9f20c3f0f93e 100644 --- a/drivers/gpu/drm/sun4i/sun4i_drv.c +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c @@ -56,8 +56,9 @@ static const struct drm_driver sun4i_drv_driver = { DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(drm_sun4i_gem_dumb_create), }; -static int sun4i_drv_bind(struct device *dev) +static int sun4i_drv_bind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct drm_device *drm; struct sun4i_drv *drv; int ret; @@ -125,8 +126,9 @@ static int sun4i_drv_bind(struct device *dev) return ret; } -static void sun4i_drv_unbind(struct device *dev) +static void sun4i_drv_unbind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct drm_device *drm = dev_get_drvdata(dev); drm_dev_unregister(drm); @@ -140,9 +142,13 @@ static void sun4i_drv_unbind(struct device *dev) drm_dev_put(drm); } -static const struct component_master_ops sun4i_drv_master_ops = { - .bind = sun4i_drv_bind, - .unbind = sun4i_drv_unbind, +static struct aggregate_driver sun4i_aggregate_driver = { + .probe = sun4i_drv_bind, + .remove = sun4i_drv_unbind, + .driver = { + .name = "sun4i_drm", + .owner = THIS_MODULE, + }, }; static bool sun4i_drv_node_is_connector(struct device_node *node) @@ -398,16 +404,14 @@ static int sun4i_drv_probe(struct platform_device *pdev) } 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; } 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); return 0; } From patchwork Thu Jan 27 20:01:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727259 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 1082AC433EF for ; Thu, 27 Jan 2022 20:03:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344050AbiA0UCz (ORCPT ); Thu, 27 Jan 2022 15:02:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343832AbiA0UCd (ORCPT ); Thu, 27 Jan 2022 15:02:33 -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 54FA5C06176C for ; Thu, 27 Jan 2022 12:02:25 -0800 (PST) Received: by mail-pj1-x1034.google.com with SMTP id o64so4156535pjo.2 for ; Thu, 27 Jan 2022 12:02:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Bh1F2H75iE3V27brrpMBVo1PNF+smDK9eKi3jTHA3NU=; b=gBKI7blbHBCAqe/knpU0g1G0b00mGDxRkbOl8V2KlrayGyInp0tb8zKjsSLCC9ba+B 6txoAVtYIwGp0wJWz0h5GuwHFrsX9EJiYKEomLmWAvMba/VOdsiRGqAPMfw6JL64I3K0 aBC4w7Eku4mmFe1Gk8VnGwVPT0vOj9wX53kac= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Bh1F2H75iE3V27brrpMBVo1PNF+smDK9eKi3jTHA3NU=; b=1eDjPrC6Bj3wBZ7G/ZszxKOVrXYrhEuixzci1cBaiNvHJpJFOVNeBBCknohN6yX/H3 vW9bCIMjtBk6P0WrWbKhf7rcwgSRU0GaRYEZ68bszlnFOp+AzrzbjO+YEMpADc+tYejJ C53o+S+zUnPBolitnTVfpQCEUsn13jZ9bURgZep5sz9KW5KnNbzdbK+hgtcqdyTJzF/G NGLV/hACYe54d7TsymRv0u/N9UBPx6W4dquvgnR4HnPFRlTl69g8mgs6T3hQxJ5KSqAp w/Tk3gw//2w28bLlhSaalEM6cUWlmgFH/ErGfD8urv4tXEgyFzNebRHDnoKvEhK8waUW zqoQ== X-Gm-Message-State: AOAM531p+QBScadTGvEALnmU81I76yITBYbx49ozjYdylKuy/AEZiqcr VTWXkmDzNQ4vemZZlwpnBsrZsA== X-Google-Smtp-Source: ABdhPJzxet8MofwljRD08XsFu9WsvUyEhN8qPVrflK9qDEebKLMf9x4c3sDMbaNHei4PnCArHyeJbw== X-Received: by 2002:a17:90a:d58d:: with SMTP id v13mr5855255pju.210.1643313744767; Thu, 27 Jan 2022 12:02:24 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:24 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Jyri Sarha , Tomi Valkeinen , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 23/35] drm/tilcdc: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:29 -0800 Message-Id: <20220127200141.1295328-24-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. 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 --- 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/tilcdc_drv.c index 3ddb7c710a3d..c12c579ce66f 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c @@ -529,13 +529,16 @@ static const struct dev_pm_ops tilcdc_pm_ops = { /* * Platform driver: */ -static int tilcdc_bind(struct device *dev) +static int tilcdc_bind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); + return tilcdc_init(&tilcdc_driver, dev); } -static void tilcdc_unbind(struct device *dev) +static void tilcdc_unbind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct drm_device *ddev = dev_get_drvdata(dev); /* 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)); } -static const struct component_master_ops tilcdc_comp_ops = { - .bind = tilcdc_bind, - .unbind = tilcdc_unbind, +static struct aggregate_driver tilcdc_aggregate_driver = { + .probe = tilcdc_bind, + .remove = tilcdc_unbind, + .driver = { + .name = "tilcdc_drm", + .owner = THIS_MODULE, + }, }; static int tilcdc_pdev_probe(struct platform_device *pdev) @@ -564,12 +571,9 @@ static int tilcdc_pdev_probe(struct platform_device *pdev) ret = tilcdc_get_external_components(&pdev->dev, &match); if (ret < 0) return ret; - else if (ret == 0) + if (ret == 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); } static int tilcdc_pdev_remove(struct platform_device *pdev) @@ -579,10 +583,10 @@ static int tilcdc_pdev_remove(struct platform_device *pdev) ret = tilcdc_get_external_components(&pdev->dev, NULL); if (ret < 0) return ret; - else if (ret == 0) + if (ret == 0) tilcdc_fini(platform_get_drvdata(pdev)); else - component_master_del(&pdev->dev, &tilcdc_comp_ops); + component_aggregate_unregister(&pdev->dev, &tilcdc_aggregate_driver); return 0; } From patchwork Thu Jan 27 20:01:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727266 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 288CDC433FE for ; Thu, 27 Jan 2022 20:03:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240324AbiA0UDi (ORCPT ); Thu, 27 Jan 2022 15:03:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343847AbiA0UCe (ORCPT ); Thu, 27 Jan 2022 15:02:34 -0500 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83364C061771 for ; Thu, 27 Jan 2022 12:02:26 -0800 (PST) Received: by mail-pj1-x1036.google.com with SMTP id s2-20020a17090ad48200b001b501977b23so8676591pju.2 for ; Thu, 27 Jan 2022 12:02:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=w0WjtZCiA2Izv5LYYNS4nUlyXyc0y53v4Rvk7s0pbe0=; b=N1+WfbFdWfFWm8JZDkISDKtq8PppgDmD79xW8tNVglUX7OWvRmJS2Wh8sMT5FI3vAy tsKqmQ0M8qIAp054xQUwpCGIaNg9cIbGxzzwfhBal7cAk2vj8DKOZGPx05QoCOH+i7Eq moKrr1lTYTcMvhTnoQwPjc8fbcGK4uzBIFz24= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=w0WjtZCiA2Izv5LYYNS4nUlyXyc0y53v4Rvk7s0pbe0=; b=tDGnwP7CT3BAGoAlOTEYJf27lnl/3ftZoqvZ9vOZKUCaxj+jYTKstOD05g03PeMSzI IHqLfmEtPNB8YMI0r7paBOh2oV782bxC5OEXQEm1eZ+bdmK2n4GhzKMIEEdIr3xRPks7 NisnYEHnJlHA9XqoGdhc00ZpyZCxanfpnfPogzeZamuzNf3F/y9G/nPobWO/EavgPeGs 6mUBukBqafVQac1jiSKyysiIEW3Z4hAGznApCHDwrS7dZCp8/euUFsVH8M8nlbCurDmr cSMqBALFRg+4rXIQns2LLa85rrQd1XUk8oTtgezn/IfoDTU5X+hblAzSSaTSSs0rntZ8 2R4A== X-Gm-Message-State: AOAM533aQybtfmXAgDqX/+AuHF9Ns+zBA3hUnv2oXg7NHh3S5ArAslUr HAW4FT2qH7jomvSzmvJMogCBXw== X-Google-Smtp-Source: ABdhPJzgzcKDYSY6QDkCMyGRcUuonDiSsTyh/el8NoU7HL3yzfQZ3ufK+XGi3zh1Oa5ipMLqxteAAw== X-Received: by 2002:a17:90b:4d0e:: with SMTP id mw14mr3383117pjb.133.1643313746070; Thu, 27 Jan 2022 12:02:26 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:25 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Emma Anholt , Maxime Ripard , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 24/35] drm/vc4: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:30 -0800 Message-Id: <20220127200141.1295328-25-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: 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 --- drivers/gpu/drm/vc4/vc4_drv.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c index 16abc3a3d601..297ecddea5fb 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c @@ -212,8 +212,9 @@ static void vc4_match_add_drivers(struct device *dev, } } -static int vc4_drm_bind(struct device *dev) +static int vc4_drm_bind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct platform_device *pdev = 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; } -static void vc4_drm_unbind(struct device *dev) +static void vc4_drm_unbind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct drm_device *drm = dev_get_drvdata(dev); drm_dev_unregister(drm); @@ -293,9 +295,13 @@ static void vc4_drm_unbind(struct device *dev) drm_atomic_helper_shutdown(drm); } -static const struct component_master_ops vc4_drm_ops = { - .bind = vc4_drm_bind, - .unbind = vc4_drm_unbind, +static struct aggregate_driver vc4_aggregate_driver = { + .probe = vc4_drm_bind, + .remove = vc4_drm_unbind, + .driver = { + .name = "vc4_drm", + .owner = THIS_MODULE, + }, }; /* @@ -326,12 +332,12 @@ static int vc4_platform_drm_probe(struct platform_device *pdev) vc4_match_add_drivers(dev, &match, component_drivers, ARRAY_SIZE(component_drivers)); - return component_master_add_with_match(dev, &vc4_drm_ops, match); + return component_aggregate_register(dev, &vc4_aggregate_driver, match); } 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); return 0; } From patchwork Thu Jan 27 20:01:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727262 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 95261C4167D for ; Thu, 27 Jan 2022 20:03:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343790AbiA0UDC (ORCPT ); Thu, 27 Jan 2022 15:03:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343849AbiA0UCe (ORCPT ); Thu, 27 Jan 2022 15:02:34 -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 E608DC061773 for ; Thu, 27 Jan 2022 12:02:27 -0800 (PST) Received: by mail-pl1-x62f.google.com with SMTP id c9so3661515plg.11 for ; Thu, 27 Jan 2022 12:02:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hov3M21BNOijyyw82jqhUyYJ3iOp1dSjLPKTic1j8JE=; b=VMsZK3TTX6nLCzP+QIThzR82VyYJZwgX+oSGgv7vQeKlBpWdrOdF5o/L0jF7Use+vW hYXUpG6CD1574W6Y5VAuN0nNNVU4CNnR8VlJhVJ8coM7vZQ3lREpM89oF2wV3eu9k+6t XZp2CZnAvvASdrOdWMe4363IqUvAvHMDJfKzM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hov3M21BNOijyyw82jqhUyYJ3iOp1dSjLPKTic1j8JE=; b=lSgoV0ItauGqRXHkO3+R3G5N7BWw10mlGcCUqcU0/nMJehLG8xx6zsIcZ2uZIVXIdU hmTAt8j1PlHG5IINg2/KgvcXfv4GkhkE4kDedMu6fX6HoeyXTJlcM/bCclZEjBQ/YKZD dKh06PoUyHts/WukP1SPKM+uZkAdwzot4tbynIlRiH8gHa19M8r/svRMWTRBQoHeB7G5 7EUapgRL0xX8zaGTh2fgxdiTKzqK6D1T3swZ7Q5TmPPsSz/gSUQa84BlngbO5/78EXLu SDSgS6rIVEtblwornIdq/IjsGA034vdQ9szxZ58zdji7VWfbE3/fJrTxsqDAMhMmLou0 2voQ== X-Gm-Message-State: AOAM53223xOOmb6EDVzmjxCeGDGA578l02XVMowi6bVzmZB2KrPrt4zO GyMTv2ckdK9rW73SSyk3JL7oJw== X-Google-Smtp-Source: ABdhPJysVFTcTdgm/lMydDDYZ6zTCeNgLlXta+hSXw7T/WuJ7H1b65YtFfhvLzWyiAUU1prxaf3uoA== X-Received: by 2002:a17:902:9b96:: with SMTP id y22mr1279071plp.100.1643313747465; Thu, 27 Jan 2022 12:02:27 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:27 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Yong Wu , Joerg Roedel , Will Deacon , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 25/35] iommu/mediatek: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:31 -0800 Message-Id: <20220127200141.1295328-26-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: 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: Yong Wu --- drivers/iommu/mtk_iommu.c | 14 +++++++++----- drivers/iommu/mtk_iommu.h | 6 ++++-- drivers/iommu/mtk_iommu_v1.c | 14 +++++++++----- drivers/memory/mtk-smi.c | 10 ++++------ 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 25b834104790..8e722898cbe2 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -752,9 +752,13 @@ static int mtk_iommu_hw_init(const struct mtk_iommu_data *data) return 0; } -static const struct component_master_ops mtk_iommu_com_ops = { - .bind = mtk_iommu_bind, - .unbind = mtk_iommu_unbind, +static struct aggregate_driver mtk_iommu_aggregate_driver = { + .probe = mtk_iommu_bind, + .remove = mtk_iommu_unbind, + .driver = { + .name = "mtk_iommu_agg", + .owner = THIS_MODULE, + }, }; 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; } - ret = component_master_add_with_match(dev, &mtk_iommu_com_ops, match); + ret = component_aggregate_register(dev, &mtk_iommu_aggregate_driver, match); if (ret) goto out_bus_set_null; return ret; @@ -928,7 +932,7 @@ static int mtk_iommu_remove(struct platform_device *pdev) 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; } diff --git a/drivers/iommu/mtk_iommu.h b/drivers/iommu/mtk_iommu.h index f81fa8862ed0..125be5819c42 100644 --- a/drivers/iommu/mtk_iommu.h +++ b/drivers/iommu/mtk_iommu.h @@ -94,15 +94,17 @@ static inline void release_of(struct device *dev, void *data) of_node_put(data); } -static inline int mtk_iommu_bind(struct device *dev) +static inline int mtk_iommu_bind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct mtk_iommu_data *data = dev_get_drvdata(dev); return component_bind_all(dev, &data->larb_imu); } -static inline void mtk_iommu_unbind(struct device *dev) +static inline void mtk_iommu_unbind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct mtk_iommu_data *data = dev_get_drvdata(dev); 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[] = { {} }; -static const struct component_master_ops mtk_iommu_com_ops = { - .bind = mtk_iommu_bind, - .unbind = mtk_iommu_unbind, +static struct aggregate_driver mtk_iommu_aggregate_driver = { + .probe = mtk_iommu_bind, + .remove = mtk_iommu_unbind, + .driver = { + .name = "mtk_iommu_agg", + .owner = THIS_MODULE, + }, }; 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; } - ret = component_master_add_with_match(dev, &mtk_iommu_com_ops, match); + ret = component_aggregate_register(dev, &mtk_iommu_aggregate_driver, match); if (ret) goto out_bus_set_null; return ret; @@ -650,7 +654,7 @@ static int mtk_iommu_remove(struct platform_device *pdev) 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; } diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c index e201e5976f34..0910fe109f53 100644 --- a/drivers/memory/mtk-smi.c +++ b/drivers/memory/mtk-smi.c @@ -175,6 +175,8 @@ mtk_smi_larb_bind(struct device *dev, struct device *master, void *data) larb->larbid = i; larb->mmu = &larb_mmu[i].mmu; larb->bank = larb_mmu[i].bank; + + pm_runtime_enable(dev); return 0; } } @@ -450,15 +452,11 @@ static int mtk_smi_larb_probe(struct platform_device *pdev) if (ret < 0) return ret; - pm_runtime_enable(dev); platform_set_drvdata(pdev, larb); ret = component_add(dev, &mtk_smi_larb_component_ops); - if (ret) - goto err_pm_disable; - return 0; + if (!ret) + return 0; -err_pm_disable: - pm_runtime_disable(dev); device_link_remove(dev, larb->smi_common_dev); return ret; } From patchwork Thu Jan 27 20:01:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727260 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 29543C43217 for ; Thu, 27 Jan 2022 20:03:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240446AbiA0UDC (ORCPT ); Thu, 27 Jan 2022 15:03:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343624AbiA0UCe (ORCPT ); Thu, 27 Jan 2022 15:02:34 -0500 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7758C061775 for ; Thu, 27 Jan 2022 12:02:29 -0800 (PST) Received: by mail-pl1-x62d.google.com with SMTP id c3so3699709pls.5 for ; Thu, 27 Jan 2022 12:02:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=g623/C18UKVOGP0jeG3P9XoZ0hRTRdI8bxCTdme+ZDc=; b=UjXyKQ27u9ktmyUhlabtrzpM184jAnjXIW63DCf85unRcMTX6v/Xs4Fw8lX6VtLkrG 0i0Rpg4QPjonKcYKL/d7xYdgHlEeoHJrADQdyIWZWCeqxWps1f0ssg+phw6p/LB4XTD9 1x4mXefiju1VsB+cP1wQ3Ej679uZCdIZ8uomc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=g623/C18UKVOGP0jeG3P9XoZ0hRTRdI8bxCTdme+ZDc=; b=IRlimvtOgJ79/n/1d5PkycguAtMVF6QBasRIEOdiKDpRp2zQofp5eEAuNSgfFZ2B7b oCO+V/YXUVO4EXSmtI66CFbhNdencFn4Q6D7OcTG+k3xooM7HBRdPQN2EZ4afCBr8xky oe+dWLoBkwTnnnymfyneTEni9besn01Wj5qBX7GELUwALXETzzdtlLWZUVhyCBCQmKG6 VaV8ORYVxgoyA9P25Egl1CrC8bsGJGgRrOeiBM4wLhINqAdN+p1eRjGg9sCa2bAHT74e 2okJ9V1ywEWGC8SRv0MkXi/eiuHnJzhN/B/bTLB/ZgpG3kvYrRp/V51mdXUA/E6WgX3v Cp7A== X-Gm-Message-State: AOAM531gdMqntuP7M3HYf6zKCl3b4nDpajiYP77uXq/vg6LpQvLyHrmE F2xxvoxFFWkt51Av9GxbaO8vNg== X-Google-Smtp-Source: ABdhPJyaGm/XG8xRvxwiAz5T8R45IbJcC1YnZiE695jmz59Zq5cjk/F0goVL7OumDWNu0N2Qqr17jg== X-Received: by 2002:a17:902:b40b:: with SMTP id x11mr296131plr.75.1643313749462; Thu, 27 Jan 2022 12:02:29 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:29 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Tomas Winkler , Vitaly Lubart , Daniele Ceraolo Spurio , Rodrigo Vivi , Arnd Bergmann , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan , Alexander Usyskin Subject: [PATCH v6 26/35] mei: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:32 -0800 Message-Id: <20220127200141.1295328-27-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: 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 --- 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_hdcp.c index ec2a4fce8581..3c6e4e3bf212 100644 --- a/drivers/misc/mei/hdcp/mei_hdcp.c +++ b/drivers/misc/mei/hdcp/mei_hdcp.c @@ -732,8 +732,9 @@ static const struct i915_hdcp_component_ops mei_hdcp_ops = { .close_hdcp_session = mei_hdcp_close_session, }; -static int mei_component_master_bind(struct device *dev) +static int mei_hdcp_aggregate_bind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct mei_cl_device *cldev = to_mei_cl_device(dev); struct i915_hdcp_comp_master *comp_master = mei_cldev_get_drvdata(cldev); @@ -749,8 +750,9 @@ static int mei_component_master_bind(struct device *dev) return 0; } -static void mei_component_master_unbind(struct device *dev) +static void mei_hdcp_aggregate_unbind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct mei_cl_device *cldev = to_mei_cl_device(dev); struct i915_hdcp_comp_master *comp_master = mei_cldev_get_drvdata(cldev); @@ -759,9 +761,13 @@ static void mei_component_master_unbind(struct device *dev) component_unbind_all(dev, comp_master); } -static const struct component_master_ops mei_component_master_ops = { - .bind = mei_component_master_bind, - .unbind = mei_component_master_unbind, +static struct aggregate_driver mei_aggregate_driver = { + .probe = mei_hdcp_aggregate_bind, + .remove = mei_hdcp_aggregate_unbind, + .driver = { + .name = "mei_hdcp_agg", + .owner = THIS_MODULE, + }, }; /** @@ -826,9 +832,7 @@ static int mei_hdcp_probe(struct mei_cl_device *cldev, } mei_cldev_set_drvdata(cldev, comp_master); - ret = component_master_add_with_match(&cldev->dev, - &mei_component_master_ops, - master_match); + ret = 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; - 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); diff --git a/drivers/misc/mei/pxp/mei_pxp.c b/drivers/misc/mei/pxp/mei_pxp.c index f7380d387bab..887e43e6ba5f 100644 --- a/drivers/misc/mei/pxp/mei_pxp.c +++ b/drivers/misc/mei/pxp/mei_pxp.c @@ -83,8 +83,9 @@ static const struct i915_pxp_component_ops mei_pxp_ops = { .recv = mei_pxp_receive_message, }; -static int mei_component_master_bind(struct device *dev) +static int mei_pxp_aggregate_bind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct mei_cl_device *cldev = to_mei_cl_device(dev); struct i915_pxp_component *comp_master = mei_cldev_get_drvdata(cldev); int ret; @@ -98,17 +99,22 @@ static int mei_component_master_bind(struct device *dev) return 0; } -static void mei_component_master_unbind(struct device *dev) +static void mei_pxp_aggregate_unbind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct mei_cl_device *cldev = to_mei_cl_device(dev); struct i915_pxp_component *comp_master = mei_cldev_get_drvdata(cldev); component_unbind_all(dev, comp_master); } -static const struct component_master_ops mei_component_master_ops = { - .bind = mei_component_master_bind, - .unbind = mei_component_master_unbind, +static struct aggregate_driver mei_aggregate_driver = { + .probe = mei_pxp_aggregate_bind, + .remove = mei_pxp_aggregate_unbind, + .driver = { + .name = "mei_pxp_agg", + .owner = THIS_MODULE, + } }; /** @@ -173,9 +179,7 @@ static int mei_pxp_probe(struct mei_cl_device *cldev, } mei_cldev_set_drvdata(cldev, comp_master); - ret = component_master_add_with_match(&cldev->dev, - &mei_component_master_ops, - master_match); + ret = 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 = mei_cldev_get_drvdata(cldev); int ret; - 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); From patchwork Thu Jan 27 20:01:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727323 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 1E863C43217 for ; Thu, 27 Jan 2022 20:03:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343763AbiA0UDk (ORCPT ); Thu, 27 Jan 2022 15:03:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343752AbiA0UCe (ORCPT ); Thu, 27 Jan 2022 15:02:34 -0500 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BACDC061778 for ; Thu, 27 Jan 2022 12:02:31 -0800 (PST) Received: by mail-pl1-x630.google.com with SMTP id d18so3719177plg.2 for ; Thu, 27 Jan 2022 12:02:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=riumb/7yMkcFbw4RrpVGufoj0gjKUJSuK0Qg2XknZ7c=; b=NpYO5ID7f28ORexqnHkzZ0M54adxGnU0hRqq3qMqQyrYGblQq3T7AbkbyeSwkleWwX 1tdKASzL3lfB1QiEImyl7I5sFgEJAzg5lhJ31c07BZMxspqw1wEXyCWCACCBDKj4GvBM Mku2sKRUm6mYUtIPaoIcno6DGaPIftBeAqDeo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=riumb/7yMkcFbw4RrpVGufoj0gjKUJSuK0Qg2XknZ7c=; b=QOmbIndbMDQToEXcfaqxz88AB0Xy5HKeLJtZFZSNBbbF4gisAr7Kiiu8rmrzHNnyWp cxknqofhS0agndKZd9Ldy//0fSQlENUW9887qgBKlBb1oeuB7F0h3xR5YCxp7miC3W2+ K/QOuETlam0hhVUusRgJVImOWnEQzgl7GYnYzS67pqBNXW8H+SO+1wXfaYuvYsZz0Hu1 D/rn5SVyd9MsUVMF3EhK/mG+HwHz5sAj4xY//zD6UEUIur3dtKQw4QiMEZEiCYmyPImp 7AlGGsUbrcreZrOZntFhvpXBIACgi9HFi0npf6xbQAcLS+4/lzzJuik7BxH0dEji6IV4 t+5A== X-Gm-Message-State: AOAM531A+Aiq2Njnt1o52CEHU7PWDBmRpKb9C6VCXrVYP9ZbL791dzM0 qtLTHfq2DF5jIImYtwRbVwbpAw== X-Google-Smtp-Source: ABdhPJwWoTTDM63H2gCdds/RxYfOFR7pmlktYW6DhFTALTQitolMZJK4DIvXjvtcObjDsy8ZXAWysA== X-Received: by 2002:a17:902:7ec1:: with SMTP id p1mr4549151plb.159.1643313750817; Thu, 27 Jan 2022 12:02:30 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:30 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Sebastian Reichel , Linus Walleij , linux-pm@vger.kernel.org, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 27/35] power: supply: ab8500: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:33 -0800 Message-Id: <20220127200141.1295328-28-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. 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 --- 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/ab8500_charger.c index ce074c018dcb..e3164e8335ca 100644 --- a/drivers/power/supply/ab8500_charger.c +++ b/drivers/power/supply/ab8500_charger.c @@ -3335,8 +3335,9 @@ static const struct power_supply_desc ab8500_usb_chg_desc = { .get_property = ab8500_charger_usb_get_property, }; -static int ab8500_charger_bind(struct device *dev) +static int ab8500_charger_bind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct ab8500_charger *di = dev_get_drvdata(dev); int ch_stat; int ret; @@ -3377,8 +3378,9 @@ static int ab8500_charger_bind(struct device *dev) return 0; } -static void ab8500_charger_unbind(struct device *dev) +static void ab8500_charger_unbind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct ab8500_charger *di = dev_get_drvdata(dev); int ret; @@ -3403,9 +3405,13 @@ static void ab8500_charger_unbind(struct device *dev) component_unbind_all(dev, di); } -static const struct component_master_ops ab8500_charger_comp_ops = { - .bind = ab8500_charger_bind, - .unbind = ab8500_charger_unbind, +static struct aggregate_driver ab8500_charger_aggregate_driver = { + .probe = ab8500_charger_bind, + .remove = ab8500_charger_unbind, + .driver = { + .name = "ab8500_charger_agg", + .owner = THIS_MODULE, + }, }; static struct platform_driver *const ab8500_charger_component_drivers[] = { @@ -3694,9 +3700,7 @@ static int ab8500_charger_probe(struct platform_device *pdev) } - ret = component_master_add_with_match(&pdev->dev, - &ab8500_charger_comp_ops, - match); + ret = component_aggregate_register(&pdev->dev, &ab8500_charger_aggregate_driver, match); if (ret) { dev_err(dev, "failed to add component master\n"); goto free_notifier; @@ -3721,7 +3725,7 @@ static int ab8500_charger_remove(struct platform_device *pdev) { struct ab8500_charger *di = platform_get_drvdata(pdev); - component_master_del(&pdev->dev, &ab8500_charger_comp_ops); + component_aggregate_unregister(&pdev->dev, &ab8500_charger_aggregate_driver); usb_unregister_notifier(di->usb_phy, &di->nb); ab8500_bm_of_remove(di->usb_chg.psy, di->bm); From patchwork Thu Jan 27 20:01:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727322 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 770D7C4332F for ; Thu, 27 Jan 2022 20:03:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343692AbiA0UDj (ORCPT ); Thu, 27 Jan 2022 15:03:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343753AbiA0UCe (ORCPT ); Thu, 27 Jan 2022 15:02:34 -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 874BEC06177C for ; Thu, 27 Jan 2022 12:02:32 -0800 (PST) Received: by mail-pf1-x435.google.com with SMTP id i186so1322847pfe.0 for ; Thu, 27 Jan 2022 12:02:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=91Z2d0mjHlreqpecJ7pSmgXY2IVlH38FqXsuAjWZmko=; b=azXGQXgKkiXx9Hrb2SvK5M/d+nnYVFTKHAAmgUFanjAJD8SmcK8n3rWARtQsmdzh1w uT0oNhth/wwX7p41tikgOyhpCmwn7PJgfgI7N8EJxphlXwshQpQiPh+AyY1cRqwxa6YN fLmW6iHObG4gITceNhHTVVf1OF7Mysd4CU0IY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=91Z2d0mjHlreqpecJ7pSmgXY2IVlH38FqXsuAjWZmko=; b=RrnFFqABfO3hBzise8f17ev7IAB4drBTdq4DWKf/UmSaeokzXB4drVh1oAZ8B4ZhpE QEPZ521fPRvPuhjNvYoQ2tCZW37dq33Rtkzoc7fzqxKzgTEK0C821muBX+PFxYX907Ey hrjQ9qaLFLAMMb0y1od/R5l8+5UuRSrbhBhcPhN/FO9QyDw4/DusFRvsGgJ57x8HOs1k 8tlFAF7Gb6eSy1MRC5MOQP0VPZ0Gxlx6YAhK37OpjnhvRdbibEU0Q3XQWIG+4DEB2ROr VpNFASF3/gdzEvIL6PYGje6N/Lrv7dKaXQYRQRCr6bj2GB5iJyJUmRIFnjLeHajtd5Cx PZ6g== X-Gm-Message-State: AOAM5322zokYZl+ItTWjNQR+/s0pxbAaEoH3BP3Xvn9mc0rVkF/4ztIy pqUilZ+ynCLmaTXz5mBjSEjfRQ== X-Google-Smtp-Source: ABdhPJxqGqvR7cwrQBut5IHmzB0xhFmu1buz49cWUzx4Hg9ZdT83OqiQnqJ+DRrh0+GRK3FZyg7Hzw== X-Received: by 2002:a65:6041:: with SMTP id a1mr3876357pgp.231.1643313752060; Thu, 27 Jan 2022 12:02:32 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:31 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 28/35] fbdev: omap2: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:34 -0800 Message-Id: <20220127200141.1295328-29-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Cc: Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- 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/fbdev/omap2/omapfb/dss/dss.c index a6b1c1598040..0bdb9f909992 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/dss.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/dss.c @@ -1067,8 +1067,9 @@ static int dss_video_pll_probe(struct platform_device *pdev) } /* DSS HW IP initialisation */ -static int dss_bind(struct device *dev) +static int dss_bind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct platform_device *pdev = to_platform_device(dev); struct resource *dss_mem; u32 rev; @@ -1167,8 +1168,9 @@ static int dss_bind(struct device *dev) return r; } -static void dss_unbind(struct device *dev) +static void dss_unbind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct platform_device *pdev = to_platform_device(dev); dss_initialized = false; @@ -1188,9 +1190,13 @@ static void dss_unbind(struct device *dev) dss_put_clocks(); } -static const struct component_master_ops dss_component_ops = { - .bind = dss_bind, - .unbind = dss_unbind, +static struct aggregate_driver dss_aggregate_driver = { + .probe = dss_bind, + .remove = dss_unbind, + .driver = { + .name = "dss_fbdev", + .owner = THIS_MODULE, + }, }; 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); - r = component_master_add_with_match(&pdev->dev, &dss_component_ops, match); + r = component_aggregate_register(&pdev->dev, &dss_aggregate_driver, match); if (r) return r; @@ -1234,7 +1240,7 @@ static int dss_probe(struct platform_device *pdev) 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; } From patchwork Thu Jan 27 20:01:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727263 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 72E85C433F5 for ; Thu, 27 Jan 2022 20:03:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343828AbiA0UDD (ORCPT ); Thu, 27 Jan 2022 15:03:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343760AbiA0UCe (ORCPT ); Thu, 27 Jan 2022 15:02:34 -0500 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D774DC061749 for ; Thu, 27 Jan 2022 12:02:33 -0800 (PST) Received: by mail-pg1-x535.google.com with SMTP id j10so3234744pgc.6 for ; Thu, 27 Jan 2022 12:02:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ka5n0VIFlCANZbv+1O6BEaBIrpT2TSivDZEr/FN1kY8=; b=MXoXAgK1oy6andcq7Ev9jdik2AL8qv5c3I8xi0/e6YDPc830v2J7hy32iT3ICQBJ8J xy09VzT9Yn29S+RdgW2+6hsABDgU6UyFNOGBLRCszHxFQFq6dKmKLilaT6sUw4r9sdt7 c29EGPbcTtzKRF4KZrDHS+Z347DLhk07qht9s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ka5n0VIFlCANZbv+1O6BEaBIrpT2TSivDZEr/FN1kY8=; b=sb86Z2voM1RnsXHxtGvcRwc7IYAa5pDMs9IoAQVmduVMSPICD9GPmXkDKQeM2WzrFx DUpYVyrkn0dhCnzs55zrTSCtyeeWAo9q7FQbyif6+Q39w9SdF3eO48TKiehDNFvDfzUH 3D0CZVucKXWDAVdr6HM9h107egEQyQmCIBldIA95pWfp0FGIUFU/vJELtYNo+2vG6jNy UqHxhizUwengC1U99KJwYjfU+CyJm89ibXqAr58o4JGD6uqauAwP5uQIEG79R8FMWKoK Nr3eIsUo/AUmFnvpKExdpOTKwi4RQxUika9QScx0UH6YRtGkPEquHsxv428PUeSugNiM iIkA== X-Gm-Message-State: AOAM5335nXnbydD9ys40/tvE+2bnrxr5Q7PWXPx5q1lGfIOosLbBTRl0 RnBVokDiWG6BTL3kUq9fBcVHgSrme1vH3A== X-Google-Smtp-Source: ABdhPJzXSmoe1y40KU/53VBe7HVzxX6p0Ykdxtz/+cL6TFf9tO0wg6o7nu36+L3nnJbpQJ7nrONYcg== X-Received: by 2002:a63:2d86:: with SMTP id t128mr3994596pgt.200.1643313753420; Thu, 27 Jan 2022 12:02:33 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:33 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Jaroslav Kysela , Takashi Iwai , Kai Vehmanen , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 29/35] sound: hdac: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:35 -0800 Message-Id: <20220127200141.1295328-30-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: 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 Acked-by: Takashi Iwai --- sound/hda/hdac_component.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/sound/hda/hdac_component.c b/sound/hda/hdac_component.c index bb37e7e0bd79..4ec5d9bf8533 100644 --- a/sound/hda/hdac_component.c +++ b/sound/hda/hdac_component.c @@ -181,8 +181,9 @@ int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, int dev_id, } EXPORT_SYMBOL_GPL(snd_hdac_acomp_get_eld); -static int hdac_component_master_bind(struct device *dev) +static int hdac_component_master_bind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct drm_audio_component *acomp = hdac_get_acomp(dev); int ret; @@ -222,8 +223,9 @@ static int hdac_component_master_bind(struct device *dev) return ret; } -static void hdac_component_master_unbind(struct device *dev) +static void hdac_component_master_unbind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct drm_audio_component *acomp = hdac_get_acomp(dev); 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); } -static const struct component_master_ops hdac_component_master_ops = { - .bind = hdac_component_master_bind, - .unbind = hdac_component_master_unbind, +static struct aggregate_driver hdac_aggregate_driver = { + .probe = hdac_component_master_bind, + .remove = hdac_component_master_unbind, + .driver = { + .name = "hdac_agg", + .owner = THIS_MODULE, + }, }; /** @@ -303,8 +309,7 @@ int snd_hdac_acomp_init(struct hdac_bus *bus, devres_add(dev, acomp); component_match_add_typed(dev, &match, match_master, bus); - ret = component_master_add_with_match(dev, &hdac_component_master_ops, - match); + ret = component_aggregate_register(dev, &hdac_aggregate_driver, match); if (ret < 0) goto out_err; @@ -344,7 +349,7 @@ int snd_hdac_acomp_exit(struct hdac_bus *bus) bus->display_power_active = 0; bus->display_power_status = 0; - component_master_del(dev, &hdac_component_master_ops); + component_aggregate_unregister(dev, &hdac_aggregate_driver); bus->audio_component = NULL; devres_destroy(dev, hdac_acomp_release, NULL, NULL); From patchwork Thu Jan 27 20:01:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727264 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 52DB8C4167B for ; Thu, 27 Jan 2022 20:03:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343821AbiA0UDD (ORCPT ); Thu, 27 Jan 2022 15:03:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343666AbiA0UCg (ORCPT ); Thu, 27 Jan 2022 15:02:36 -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 28E30C061758 for ; Thu, 27 Jan 2022 12:02:35 -0800 (PST) Received: by mail-pg1-x536.google.com with SMTP id j10so3234805pgc.6 for ; Thu, 27 Jan 2022 12:02:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uoYkWU8ZYG31h//2O3CYJPowjGxvjjH2b6ZF0p9sQps=; b=Npdvqs3dgVEFL7SvLzWbajP/ltLnMywE5OL4sdVwIATKFbTuobWdTSdnjQGKqw+P3Q z4BL7Whjg+87X0sbFCE+X5hflua22Oq7YC76P11dk4ptrikhRbSZ2i7ugYtYodwBP3vb cjJ0P0mq6X5+92CpBNqeR6xJuk6b6giXEsfqQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uoYkWU8ZYG31h//2O3CYJPowjGxvjjH2b6ZF0p9sQps=; b=bFdYmABsSkTyAz7Qz2fudx1BMcnly6pgqE1cEk5yy+o5+8/aLP64Qt6QhvTsB7ZHgi M9NTMPWm1CuSjFO++EisEhmwkc66KqAqKclBycIywsZXCHogbJUX1CySJoFCw2XwD/+H WVSjdWKAzlHbWb0V9mKu6a7X6Tcw6Y1ADQg53seQp0f6obD51Dtvt5CBpAXTqnL8EBkU BGyORr+kOjeO2zGAjiRl88fOFarZt84QEhzB/3K6rRY1jvXz47NBz258ZDdy/T7nZZUH aLXE7B+W8IP1CzR/zZHw2/2+UZC9Z2xTNURB+Hu3pyFG3B+1XsnLcqjFmcgjz22Zen4S It0g== X-Gm-Message-State: AOAM533iBxNU+nBc1uuLL+s4bHJSKuMmkAsQzAHSRAnkzYlF8LPXnL1c uixXkj84cqArEUGyCR57IeHzSQ== X-Google-Smtp-Source: ABdhPJx6qf0FRtjUDt7e569xeRU9IhaGc6sCbZg7DZ1PWIGIEEYIMaZDXyPgkgC77gUh4nAd8RysXw== X-Received: by 2002:a63:4b0b:: with SMTP id y11mr3862310pga.342.1643313754673; Thu, 27 Jan 2022 12:02:34 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:34 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Mark Brown , Jaroslav Kysela , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 30/35] ASoC: codecs: wcd938x: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:36 -0800 Message-Id: <20220127200141.1295328-31-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. 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 --- sound/soc/codecs/wcd938x.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c index eff200a07d9f..6e1c9f93c819 100644 --- a/sound/soc/codecs/wcd938x.c +++ b/sound/soc/codecs/wcd938x.c @@ -4317,8 +4317,9 @@ static struct snd_soc_dai_driver wcd938x_dais[] = { }, }; -static int wcd938x_bind(struct device *dev) +static int wcd938x_bind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct wcd938x_priv *wcd938x = dev_get_drvdata(dev); int ret; @@ -4401,8 +4402,9 @@ static int wcd938x_bind(struct device *dev) } -static void wcd938x_unbind(struct device *dev) +static void wcd938x_unbind(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct wcd938x_priv *wcd938x = dev_get_drvdata(dev); device_link_remove(dev, wcd938x->txdev); @@ -4412,9 +4414,13 @@ static void wcd938x_unbind(struct device *dev) component_unbind_all(dev, wcd938x); } -static const struct component_master_ops wcd938x_comp_ops = { - .bind = wcd938x_bind, - .unbind = wcd938x_unbind, +static struct aggregate_driver wcd938x_aggregate_driver = { + .probe = wcd938x_bind, + .remove = wcd938x_unbind, + .driver = { + .name = "wcd938x_snd", + .owner = THIS_MODULE, + }, }; static int wcd938x_compare_of(struct device *dev, void *data) @@ -4483,7 +4489,7 @@ static int wcd938x_probe(struct platform_device *pdev) wcd938x_reset(wcd938x); - ret = component_master_add_with_match(dev, &wcd938x_comp_ops, match); + ret = component_aggregate_register(dev, &wcd938x_aggregate_driver, match); if (ret) return ret; @@ -4499,7 +4505,7 @@ static int wcd938x_probe(struct platform_device *pdev) static int wcd938x_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &wcd938x_comp_ops); + component_aggregate_unregister(&pdev->dev, &wcd938x_aggregate_driver); return 0; } From patchwork Thu Jan 27 20:01:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727325 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 347F4C433F5 for ; Thu, 27 Jan 2022 20:03:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343807AbiA0UDl (ORCPT ); Thu, 27 Jan 2022 15:03:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343886AbiA0UCm (ORCPT ); Thu, 27 Jan 2022 15:02:42 -0500 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12B84C061760 for ; Thu, 27 Jan 2022 12:02:37 -0800 (PST) Received: by mail-pg1-x531.google.com with SMTP id f8so3223897pgf.8 for ; Thu, 27 Jan 2022 12:02: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=ZPdM2UZRVqO2e0C8ICFRT9vqGkS5bJAyu59fLH+Uvcs=; b=Gl4OTjqsqgynBhjQVr0J0vK/Y4lnurULqWtCsHyQOkEHqf7pCYHQI81VfLe0ELPBsG 0SYrju/lR6J6HE43y4rKJGyo6/G5xD8lVQyH6+Ijf/swy2beLa8NcG5FgN9KTJwKHXGo bQsVmN6a58G5hTr/ZwYaIyIU2zcLLGHUCcPIM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZPdM2UZRVqO2e0C8ICFRT9vqGkS5bJAyu59fLH+Uvcs=; b=YYIObeUQrjisOOCeFn2h2rVx4NtDhLI/nGxeTBFJ3+WYc6xzinmJ/rs7Sj9CnbcNyb nhz12Dg27911WghB1ZVKMps3QfCyXMz+wD0P8UA0Avw7vIHNJzgXwYFMw5X442UFSQi+ KHlYNd6Hzj/0XvB2AYl5z2YKVZndi23r82wLcqwSKBkaVt3ul4KVVXRbmxiW0ffNRhj/ CGIKjbBsFqBjG2pr4HVBCfEhsJhApSvNmKzNMSYcxVEgCGC8JjwJY4xPqxEtHnZmWr4l 9YIikCMF/ci8bK2TGA/2BNTYEw5dVgaUSKpNtlfZNyyoDARbO1MMSgzoeV1AyzL6qwM1 TBmw== X-Gm-Message-State: AOAM5313KLL2QzBYJdbONhqX+ya6mTTyZ2ouM8tMn6Dp9gGIMMsw12Gx S5sqkTa/MhnQ+04dwhL5unnEwQ== X-Google-Smtp-Source: ABdhPJwB8j2u/cujHRi6C9hFkNiVFW4PLGhDjL/+Uzw5oKliGwBjASBtEEumzc2+wCCT+0M/ofqccg== X-Received: by 2002:a05:6a00:14d1:: with SMTP id w17mr4787164pfu.46.1643313756502; Thu, 27 Jan 2022 12:02:36 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:36 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Orson Zhai , Baolin Wang , Chunyan Zhang , Maarten Lankhorst , Kevin Tang , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 31/35] drm/sprd: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:37 -0800 Message-Id: <20220127200141.1295328-32-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Orson Zhai Cc: Baolin Wang Cc: Chunyan Zhang Cc: Maarten Lankhorst Cc: Kevin Tang Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/sprd/sprd_drm.c | 48 +++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/sprd/sprd_drm.c b/drivers/gpu/drm/sprd/sprd_drm.c index a077e2d4d721..ff39b32b20c0 100644 --- a/drivers/gpu/drm/sprd/sprd_drm.c +++ b/drivers/gpu/drm/sprd/sprd_drm.c @@ -65,8 +65,9 @@ static struct drm_driver sprd_drm_drv = { .minor = DRIVER_MINOR, }; -static int sprd_drm_bind(struct device *dev) +static int sprd_drm_aggregate_probe(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct platform_device *pdev = to_platform_device(dev); struct drm_device *drm; struct sprd_drm *sprd; @@ -118,8 +119,9 @@ static int sprd_drm_bind(struct device *dev) return ret; } -static void sprd_drm_unbind(struct device *dev) +static void sprd_drm_aggregate_remove(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct drm_device *drm = dev_get_drvdata(dev); drm_dev_unregister(drm); @@ -129,9 +131,28 @@ static void sprd_drm_unbind(struct device *dev) component_unbind_all(drm->dev, drm); } -static const struct component_master_ops drm_component_ops = { - .bind = sprd_drm_bind, - .unbind = sprd_drm_unbind, +static void sprd_drm_aggregate_shutdown(struct aggregate_device *adev) +{ + struct device *dev = aggregate_device_parent(adev); + struct platform_device *pdev = to_platform_device(dev); + struct drm_device *drm = platform_get_drvdata(pdev); + + if (!drm) { + drm_warn(drm, "drm device is not available, no shutdown\n"); + return; + } + + drm_atomic_helper_shutdown(drm); +} + +static struct aggregate_driver sprd_drm_aggregate_driver = { + .probe = sprd_drm_aggregate_probe, + .remove = sprd_drm_aggregate_remove, + .shutdown = sprd_drm_aggregate_shutdown, + .driver = { + .name = "sprd_drm", + .owner = THIS_MODULE, + }, }; static int compare_of(struct device *dev, void *data) @@ -141,27 +162,15 @@ static int compare_of(struct device *dev, void *data) static int sprd_drm_probe(struct platform_device *pdev) { - return drm_of_component_probe(&pdev->dev, compare_of, &drm_component_ops); + return drm_of_aggregate_probe(&pdev->dev, compare_of, &sprd_drm_aggregate_driver); } static int sprd_drm_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &drm_component_ops); + component_aggregate_unregister(&pdev->dev, &sprd_drm_aggregate_driver); return 0; } -static void sprd_drm_shutdown(struct platform_device *pdev) -{ - struct drm_device *drm = platform_get_drvdata(pdev); - - if (!drm) { - drm_warn(drm, "drm device is not available, no shutdown\n"); - return; - } - - drm_atomic_helper_shutdown(drm); -} - static const struct of_device_id drm_match_table[] = { { .compatible = "sprd,display-subsystem", }, { /* sentinel */ }, @@ -171,7 +180,6 @@ MODULE_DEVICE_TABLE(of, drm_match_table); static struct platform_driver sprd_drm_driver = { .probe = sprd_drm_probe, .remove = sprd_drm_remove, - .shutdown = sprd_drm_shutdown, .driver = { .name = "sprd-drm-drv", .of_match_table = drm_match_table, From patchwork Thu Jan 27 20:01:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727327 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 A0904C433FE for ; Thu, 27 Jan 2022 20:03:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343819AbiA0UDl (ORCPT ); Thu, 27 Jan 2022 15:03:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343892AbiA0UCm (ORCPT ); Thu, 27 Jan 2022 15:02:42 -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 3837BC061765 for ; Thu, 27 Jan 2022 12:02:38 -0800 (PST) Received: by mail-pg1-x52c.google.com with SMTP id e9so3251903pgb.3 for ; Thu, 27 Jan 2022 12:02:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ckuMr+Ncb/jcw9TvP8N13lANp/qUitpt+atxz271bCg=; b=VCDCJ2XXoEo5R2boVBxoQIPLBYXRZ4ygF5m58BNpDlZWi0b2RKflooEmM0NvSKn47v M8K2o4X4DejnrnAjIJ9q3+1sECxzMIDHOFpFmOMgT91R+rXZdeyhn45ubWI9MY4y+lGt LQpRvpFof698nsHlX6PxiqwGND/FxZPe/vWmk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ckuMr+Ncb/jcw9TvP8N13lANp/qUitpt+atxz271bCg=; b=su1zcyub7gESimP2qTus59EQ0Iw9B6cJxKM4oK1gT0arm9/ewHH6HvHoeZiluNZlfP VDi3DShP/TkyU7nGEna9JPIHlqKSBWrgy7tJlzSvVG4UKwS0oA9EZ+MtgnJ3O/WHS5P2 TLkUAopKem7DXvyZGJqyQJJteS4mHFQcrGzjqj8Bng7eRWiFgy5TrcyMAQDukA3OBiqh aHC3gtgvvndULx59AwzyjlYi0Ag7oYok+JCHmLSMyKC2nUCtWdTfxDnjJauPPZPOXJ2V ppFRIjq/azuOAxolutgn6vSz0ukq5R+BWU9J7seYlxoFHSdvb3B/DZpTX66h3U2x3s9Y aqjw== X-Gm-Message-State: AOAM53074uQJA8Tf83vs2+O/CMnPgUa+eDIDoJipB3QkUgkpsPmN3LeI LSTH6ZcYOh1rPFAL720F3XNMjQ== X-Google-Smtp-Source: ABdhPJzi7TeBcTmXGNEgo6gqdKnb0pcCN6RMeqZ8Q6M/Rim3Xa3q76WIvhpg51Dhu0lKrNyj5S5Unw== X-Received: by 2002:a62:e116:: with SMTP id q22mr4473788pfh.48.1643313757782; Thu, 27 Jan 2022 12:02:37 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:37 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Heikki Krogerus , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 32/35] usb: typec: port-mapper: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:38 -0800 Message-Id: <20220127200141.1295328-33-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Heikki Krogerus Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/usb/typec/port-mapper.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/usb/typec/port-mapper.c b/drivers/usb/typec/port-mapper.c index 07d307418b47..33fbebc6a85b 100644 --- a/drivers/usb/typec/port-mapper.c +++ b/drivers/usb/typec/port-mapper.c @@ -11,19 +11,27 @@ #include "class.h" -static int typec_aggregate_bind(struct device *dev) +static int typec_aggregate_probe(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); + return component_bind_all(dev, NULL); } -static void typec_aggregate_unbind(struct device *dev) +static void typec_aggregate_remove(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); + component_unbind_all(dev, NULL); } -static const struct component_master_ops typec_aggregate_ops = { - .bind = typec_aggregate_bind, - .unbind = typec_aggregate_unbind, +static struct aggregate_driver typec_aggregate_driver = { + .probe = typec_aggregate_probe, + .remove = typec_aggregate_remove, + .driver = { + .name = "typec_aggregate", + .owner = THIS_MODULE, + }, }; struct each_port_arg { @@ -69,10 +77,10 @@ int typec_link_ports(struct typec_port *con) * improvements to the component framework. Right now you can only have * one master per device. */ - return component_master_add_with_match(&con->dev, &typec_aggregate_ops, arg.match); + return component_aggregate_register(&con->dev, &typec_aggregate_driver, arg.match); } void typec_unlink_ports(struct typec_port *con) { - component_master_del(&con->dev, &typec_aggregate_ops); + component_aggregate_unregister(&con->dev, &typec_aggregate_driver); } From patchwork Thu Jan 27 20:01:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727329 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 7CE58C3525C for ; Thu, 27 Jan 2022 20:03:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343837AbiA0UDm (ORCPT ); Thu, 27 Jan 2022 15:03:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343900AbiA0UCm (ORCPT ); Thu, 27 Jan 2022 15:02:42 -0500 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC789C0613E4 for ; Thu, 27 Jan 2022 12:02:39 -0800 (PST) Received: by mail-pf1-x430.google.com with SMTP id d187so3776193pfa.10 for ; Thu, 27 Jan 2022 12:02:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pg7u1QgES9vvilydf87u7mbX9H+V1JXmTaOjVr3A4N4=; b=SNb6+UtCldRo3C3aKKuH53pJUKPR1QoOvhja2fFrdIZAqK2pC8avjHvs2QWwdAqY2L iDTt5Ev8TK1FUPlXG0GLJg90OtWzYd58L9jGhUvwTScxXTgeVD59clQ/6ruqJGZsIDtb VzKFMzhSCdtxWvtOoLilyZS6Je3BqrKogxJuI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pg7u1QgES9vvilydf87u7mbX9H+V1JXmTaOjVr3A4N4=; b=P+eH/xiUWd7NxYfJtKxM+6sIegpyfFkibIfP9/vyPrnzdbH7tiXj2Wvt+Rc811OGSF Ayf3HA1a67TeMnSLtBtfGgQWdBr50rj5x4DvVOAEYL6zjvpqe+1IGa82HoFHSAggc3Vr cU9xgu8+G5QJPa/KOAyCwAQovCafILdJl6tYBRz5IKHh3OhtXkW9Hw+dnp/QfzS2W1Aa 0tBJbzNUXanvYdeohhJs8JRFPkg0bNtFr4Pp1QBlSBuJAyKOTQRLLSr2CWCe4H86VVOu ogXmS+Eo1D1XwnEaBFi+S718BrbzYfE4HHTcLbo414aEFsUj79aSv7dpNM1wuEhgZ02q GZUw== X-Gm-Message-State: AOAM532iSmPHKoRZsJiKQbWwubdAcWbmApV9nIK8EzIOsAH2PG+hK6jc 4IDcc0WxIjo6npSlF44eV1qPTg== X-Google-Smtp-Source: ABdhPJyWS6wiSowTLsVHpFT26f9C2DJENr9ONfoQ93NBCznOznrI8TRNbMCesKj30yy09FTDuZLACA== X-Received: by 2002:a63:dd0f:: with SMTP id t15mr3912064pgg.12.1643313759139; Thu, 27 Jan 2022 12:02:39 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:38 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Stefan Binding , Lucas Tanure , Takashi Iwai , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 33/35] ALSA: hda/realtek: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:39 -0800 Message-Id: <20220127200141.1295328-34-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Stefan Binding Cc: Lucas Tanure Cc: Takashi Iwai Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by: Stefan Binding --- sound/pci/hda/patch_realtek.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 668274e52674..80a2164c99b6 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -6547,25 +6547,31 @@ static int find_comp_by_dev_name(struct alc_spec *spec, const char *name) return -ENODEV; } -static int comp_bind(struct device *dev) +static int realtek_aggregate_probe(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct hda_codec *cdc = dev_to_hda_codec(dev); struct alc_spec *spec = cdc->spec; return component_bind_all(dev, spec->comps); } -static void comp_unbind(struct device *dev) +static void realtek_aggregate_remove(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct hda_codec *cdc = dev_to_hda_codec(dev); struct alc_spec *spec = cdc->spec; component_unbind_all(dev, spec->comps); } -static const struct component_master_ops comp_master_ops = { - .bind = comp_bind, - .unbind = comp_unbind, +static struct aggregate_driver realtek_aggregate_driver = { + .probe = realtek_aggregate_probe, + .remove = realtek_aggregate_remove, + .driver = { + .name = "realtek_aggregate", + .owner = THIS_MODULE, + }, }; static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc, @@ -6597,7 +6603,7 @@ static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char return; component_match_add(dev, &spec->match, comp_match_dev_name, name); } - ret = component_master_add_with_match(dev, &comp_master_ops, spec->match); + ret = component_aggregate_register(dev, &realtek_aggregate_driver, spec->match); if (ret) codec_err(cdc, "Fail to register component aggregator %d\n", ret); else @@ -6648,7 +6654,7 @@ static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const st "i2c-CLSA0100:00-cs35l41-hda.0"); component_match_add(dev, &spec->match, comp_match_dev_name, "i2c-CLSA0100:00-cs35l41-hda.1"); - ret = component_master_add_with_match(dev, &comp_master_ops, spec->match); + ret = component_aggregate_register(dev, &realtek_aggregate_driver, spec->match); if (ret) codec_err(cdc, "Fail to register component aggregator %d\n", ret); else From patchwork Thu Jan 27 20:01:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727328 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 D196EC4167E for ; Thu, 27 Jan 2022 20:03:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343735AbiA0UDm (ORCPT ); Thu, 27 Jan 2022 15:03:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343910AbiA0UCm (ORCPT ); Thu, 27 Jan 2022 15:02:42 -0500 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01E2AC0613E9 for ; Thu, 27 Jan 2022 12:02:41 -0800 (PST) Received: by mail-pf1-x42b.google.com with SMTP id i30so3782673pfk.8 for ; Thu, 27 Jan 2022 12:02:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NWPDgDUwRl+84SzwunIQASVSIexCRProBcGwEVA3ZyQ=; b=oCNz3/TyoOC1Z4L+TGEGzc242VDcV1zOa2+4KpqoSchL9yglQa3dROPnlnWmSgibm6 6FdcJLI6inymZ9YaC5K+b7GNCEgYSqJfiA0drHN9+5GRKTc6wlUr9xF8D4rI3iPKD07E +51WbfkKJVTDAand07akDTPtzYj2zVO+3ThYk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NWPDgDUwRl+84SzwunIQASVSIexCRProBcGwEVA3ZyQ=; b=bstP26qzvTKARNuhSpUyVu4Vo8vOqzVZ7uSnFG22mRtnzWgA+ZChOkVq6JGrX248Qu iNdQS/K71jTP1GPXSAooWLrVOOUbMX3dX6ebleUiYZVK8s/VX5u72nva/AaEalIfby60 q/bbnvvHCLb1PFjwRAvcFEQixoENn/3Z5wCtl84P4bTiWi4x4FedCdLahztaUEa7IWFE v2OZfTbW8qMcTmkKENbS4HzBLb9r2n6hmrRioam8HqUR3FbLJtyRzkaDRqEm82MTrAX9 uG6nQ8RPREvszsRQn5rU5t02qVyHS680gOIdmAnTh68Uf5CZzr+4WH6TiPlcBRW8LkW/ Zx3A== X-Gm-Message-State: AOAM533REd5P5Z3V3xpmSsxuipX72H22ecciOWeLpvKdBxaXSvY2a935 yFzH6p5ZeWoyJP4wTj7QlAgAGw== X-Google-Smtp-Source: ABdhPJyZ+yxlFIH/w2575esD0A9Z3uwPXwkVYGsPiBy9KXIh12HY0oxwuUFjhhYoIin6PRGU1PyxnQ== X-Received: by 2002:a62:e704:: with SMTP id s4mr4171414pfh.25.1643313760477; Thu, 27 Jan 2022 12:02:40 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:40 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Laurent Pinchart , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 34/35] component: Get rid of drm_of_component_probe() Date: Thu, 27 Jan 2022 12:01:40 -0800 Message-Id: <20220127200141.1295328-35-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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 --- drivers/gpu/drm/drm_of.c | 85 +++++++++------------------------------- include/drm/drm_of.h | 12 ------ 2 files changed, 19 insertions(+), 78 deletions(-) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 0fe822319aae..84e285432d13 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -99,18 +99,30 @@ void drm_of_component_match_add(struct device *master, } EXPORT_SYMBOL_GPL(drm_of_component_match_add); -static int _drm_of_component_probe(struct device *dev, +/** + * drm_of_aggregate_probe - Generic probe function for a component based aggregate 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 encoders 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 fails. + */ +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 = NULL; int i; if (!dev->of_node) return -EINVAL; - *matchptr = 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; 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); of_node_put(port); @@ -132,7 +144,7 @@ static int _drm_of_component_probe(struct device *dev, return -ENODEV; } - 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; } - 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); } - return 0; -} - -/** - * drm_of_component_probe - Generic probe function for a component based master - * @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 fails. - */ -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 = _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 aggregate 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 encoders 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 fails. - */ -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 = _drm_of_component_probe(dev, compare_of, &match); - if (ret) - return ret; - return component_aggregate_register(dev, adrv, match); } EXPORT_SYMBOL(drm_of_aggregate_probe); diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h index 7c7b0d8377a7..4709ff2f04eb 100644 --- a/include/drm/drm_of.h +++ b/include/drm/drm_of.h @@ -8,7 +8,6 @@ #endif struct aggregate_driver; -struct component_master_ops; struct component_match; struct device; struct drm_device; @@ -38,9 +37,6 @@ void drm_of_component_match_add(struct device *master, struct component_match **matchptr, int (*compare)(struct device *, void *), struct device_node *node); -int drm_of_component_probe(struct device *dev, - int (*compare_of)(struct device *, void *), - const struct component_master_ops *m_ops); int drm_of_aggregate_probe(struct device *dev, int (*compare_of)(struct device *, void *), struct aggregate_driver *adrv); @@ -75,14 +71,6 @@ drm_of_component_match_add(struct device *master, { } -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 *), From patchwork Thu Jan 27 20:01:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12727265 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 C0CD4C4167E for ; Thu, 27 Jan 2022 20:03:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343851AbiA0UDE (ORCPT ); Thu, 27 Jan 2022 15:03:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343916AbiA0UCm (ORCPT ); Thu, 27 Jan 2022 15:02:42 -0500 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AFCCC06173B for ; Thu, 27 Jan 2022 12:02:42 -0800 (PST) Received: by mail-pf1-x42d.google.com with SMTP id p37so3795298pfh.4 for ; Thu, 27 Jan 2022 12:02:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mLJ9aQQKbi1McTKiTASuJ60v0WUfyMH6zYoZx7mCGow=; b=GS6Seq4+r80IcpAK74Q0pIsNJzAevgaT0sITaMFeTt1iLsIVo95O0DpX+9ePAak60Y Pbj93EvACJdFc8YsdQJ1VJgi2OAS1EjPUiPnsGMiic9C6jZzWo0VoUgGUqv9pTeMlKDv L8y88I4dBISVRWlkC8KOWzx3pVizjdgbpcck8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mLJ9aQQKbi1McTKiTASuJ60v0WUfyMH6zYoZx7mCGow=; b=xynKTXk+CmTFzDh7eedPRnkvq43NFWULH0RtVkxTrqKClXh+izleZ0Q62i4m4LYC9P pdfv8e8U++oSNJ4hdu2DwKgVTc/keHJ2nQblnrl8HrGdxxhEtq4FSfDnWr+JYMkgr65w tlwWuwCrEkG9/z/Ogwub2Ky+62rAL/T2US3jUMAhAWFDz+8YExSX+KARf9i/yZ0N/T+P btY9E+hWAINWrxS285/8FWAuFYz7VPioRWpHn0DfySaIgR4olvw4bTUN2X3a3344cEoh MqzsuL+2HBfdiaZDNxcTMQdr7l97G+LPsSgqFTMrgtkcdwcCtba6j4nYW9uGCI/ion67 pCUw== X-Gm-Message-State: AOAM531rsgvwXEBAfWs/z4+Cj9mqyIxLBqnqVlyQo1Ig+ZGbhZAbDY3o Jca5J4Zdid0UDOV3H7YwaQutJg== X-Google-Smtp-Source: ABdhPJznxlCbRpVhFUcGQYIzq2wotjTAZfj6r+uVXxNad6g9Gp5KhhaxnkuYEMMc+Fj26avh47h6qA== X-Received: by 2002:a63:4c1c:: with SMTP id z28mr3981920pga.14.1643313761743; Thu, 27 Jan 2022 12:02:41 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:41 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v6 35/35] component: Remove component_master_ops and friends Date: Thu, 27 Jan 2022 12:01:41 -0800 Message-Id: <20220127200141.1295328-36-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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 --- drivers/base/component.c | 149 ++++---------------------------------- drivers/gpu/drm/drm_drv.c | 2 +- include/linux/component.h | 44 ----------- 3 files changed, 17 insertions(+), 178 deletions(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index 5b91a114786d..c9d17ea64226 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -57,7 +57,6 @@ struct component_match { }; struct aggregate_device { - const struct component_master_ops *ops; struct device *parent; struct device dev; struct component_match *match; @@ -154,18 +153,12 @@ static void component_debugfs_del(struct aggregate_device *m) #endif -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 = to_aggregate_device(dev); - const struct aggregate_bus_find_data *data = _data; + const struct device *parent = _data; - if (adev->parent == data->parent && - (!data->ops || adev->ops == data->ops)) + if (adev->parent == parent) return 1; return 0; @@ -426,30 +419,15 @@ static int aggregate_device_match(struct device *dev, struct device_driver *drv) return ret; } -/* TODO: Remove once all aggregate drivers use component_aggregate_register() */ -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 = to_aggregate_driver(dev->driver); struct aggregate_device *adev = to_aggregate_device(dev); - bool modern = adrv->probe != 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); - } + 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)) { @@ -462,7 +440,7 @@ static int aggregate_driver_probe(struct device *dev) devres_close_group(adev->parent, NULL); mutex_unlock(&component_mutex); - if (ret && modern) { + if (ret) { pm_runtime_disable(dev); pm_runtime_set_suspended(dev); pm_runtime_put_noidle(dev); @@ -475,15 +453,10 @@ static void aggregate_driver_remove(struct device *dev) { const struct aggregate_driver *adrv = to_aggregate_driver(dev->driver); struct aggregate_device *adev = to_aggregate_device(dev); - bool modern = adrv->remove != component_remove_unbind; - /* 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; pm_runtime_put_noidle(dev); @@ -509,16 +482,11 @@ static struct bus_type aggregate_bus_type = { }; /* 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 = { - .ops = ops, - .parent = parent, - }; - dev = bus_find_device(&aggregate_bus_type, NULL, &data, + dev = bus_find_device(&aggregate_bus_type, NULL, parent, aggregate_bus_find_match); return dev ? to_aggregate_device(dev) : NULL; @@ -551,7 +519,7 @@ static void aggregate_driver_unregister(struct aggregate_driver *adrv) } static struct aggregate_device *aggregate_device_add(struct device *parent, - const struct component_master_ops *ops, struct aggregate_driver *adrv, + struct aggregate_driver *adrv, struct component_match *match) { struct aggregate_device *adev; @@ -576,7 +544,6 @@ static struct aggregate_device *aggregate_device_add(struct device *parent, adev->parent = parent; adev->dev.bus = &aggregate_bus_type; adev->dev.release = aggregate_device_release; - adev->ops = ops; adev->match = match; adev->adrv = adrv; dev_set_name(&adev->dev, "aggregate%d", id); @@ -592,54 +559,6 @@ static struct aggregate_device *aggregate_device_add(struct device *parent, return adev; } -/** - * 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 components 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 = 0; - - adrv = kzalloc(sizeof(*adrv), GFP_KERNEL); - if (!adrv) - return -ENOMEM; - - adev = aggregate_device_add(parent, ops, adrv, match); - if (IS_ERR(adev)) { - ret = PTR_ERR(adev); - goto err; - } - - adrv->probe = component_probe_bind; - adrv->remove = component_remove_unbind; - adrv->driver.owner = THIS_MODULE; - adrv->driver.name = dev_name(&adev->dev); - - ret = aggregate_driver_register(adrv); - if (!ret) - return 0; - - put_device(&adev->dev); -err: - kfree(adrv); - return ret; -} -EXPORT_SYMBOL_GPL(component_master_add_with_match); - /** * component_aggregate_register - register an aggregate driver * @parent: parent device of the aggregate driver @@ -656,7 +575,7 @@ int component_aggregate_register(struct device *parent, struct aggregate_device *adev; int ret; - adev = aggregate_device_add(parent, NULL, adrv, match); + adev = aggregate_device_add(parent, adrv, match); if (IS_ERR(adev)) return PTR_ERR(adev); @@ -668,42 +587,6 @@ int component_aggregate_register(struct device *parent, } EXPORT_SYMBOL_GPL(component_aggregate_register); -/** - * 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 = __aggregate_find(parent, ops); - mutex_unlock(&component_mutex); - - if (adev) { - drv = adev->dev.driver; - if (drv) { - adrv = to_aggregate_driver(drv); - aggregate_driver_unregister(adrv); - kfree(adrv); - } - - device_unregister(&adev->dev); - } - put_device(&adev->dev); -} -EXPORT_SYMBOL_GPL(component_master_del); - /** * component_aggregate_unregister - unregister an aggregate driver * @parent: parent device of the aggregate driver @@ -719,7 +602,7 @@ void component_aggregate_unregister(struct device *parent, struct aggregate_device *adev; mutex_lock(&component_mutex); - adev = __aggregate_find(parent, NULL); + adev = __aggregate_find(parent); mutex_unlock(&component_mutex); if (adev) @@ -755,7 +638,7 @@ static void component_unbind(struct component *component, * * Unbinds all components of the aggregate device by passing @data to their * &component_ops.unbind functions. Should be called from - * &component_master_ops.unbind. + * &aggregate_driver.remove. */ void component_unbind_all(struct device *parent, void *data) { @@ -765,7 +648,7 @@ void component_unbind_all(struct device *parent, void *data) WARN_ON(!mutex_is_locked(&component_mutex)); - adev = __aggregate_find(parent, NULL); + adev = __aggregate_find(parent); if (!adev) return; @@ -843,7 +726,7 @@ static int component_bind(struct component *component, struct aggregate_device * * * Binds all components of the aggregate @dev by passing @data to their * &component_ops.bind functions. Should be called from - * &component_master_ops.bind. + * &aggregate_driver.probe. */ int component_bind_all(struct device *parent, void *data) { @@ -854,7 +737,7 @@ int component_bind_all(struct device *parent, void *data) WARN_ON(!mutex_is_locked(&component_mutex)); - adev = __aggregate_find(parent, NULL); + adev = __aggregate_find(parent); if (!adev) return -EINVAL; diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 8214a0b1ab7f..902287bbcaba 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -545,7 +545,7 @@ static void drm_fs_inode_free(struct inode *inode) * following guidelines apply: * * - The entire device initialization procedure should be run from the - * &component_master_ops.master_bind callback, starting with + * &aggregate_driver.probe callback, starting with * devm_drm_dev_alloc(), then binding all components with * component_bind_all() and finishing with drm_dev_register(). * diff --git a/include/linux/component.h b/include/linux/component.h index 073cbe9fea32..36ce0997f213 100644 --- a/include/linux/component.h +++ b/include/linux/component.h @@ -66,45 +66,6 @@ void component_unbind_all(struct device *parent, void *data); struct device *aggregate_device_parent(const struct aggregate_device *adev); -/** - * struct component_master_ops - callback for the aggregate driver - * - * Aggregate drivers are registered with component_master_add_with_match() and - * unregistered with component_master_del(). - */ -struct component_master_ops { - /** - * @bind: - * - * Called when all components or the aggregate driver, as specified in - * the match list passed to component_master_add_with_match(), are - * ready. Usually there are 3 steps to bind an aggregate driver: - * - * 1. Allocate a structure for the aggregate driver. - * - * 2. Bind all components to the aggregate driver by calling - * component_bind_all() with the aggregate driver structure as opaque - * pointer data. - * - * 3. Register the aggregate driver with the subsystem to publish its - * interfaces. - * - * Note that the lifetime of the aggregate driver does not align with - * any of the underlying &struct device instances. Therefore devm cannot - * be used and all resources acquired or allocated in this callback must - * be explicitly released in the @unbind callback. - */ - int (*bind)(struct device *master); - /** - * @unbind: - * - * Called when either the aggregate driver, using - * component_master_del(), or one of its components, using - * component_del(), is unregistered. - */ - void (*unbind)(struct device *master); -}; - /** * struct aggregate_driver - Aggregate driver (made up of other drivers) * @count: driver registration refcount @@ -155,9 +116,6 @@ static inline struct aggregate_driver *to_aggregate_driver(struct device_driver return container_of(d, struct aggregate_driver, driver); } -void component_master_del(struct device *, - const struct component_master_ops *); - struct component_match; int component_aggregate_register(struct device *parent, @@ -165,8 +123,6 @@ int component_aggregate_register(struct device *parent, void component_aggregate_unregister(struct device *parent, struct aggregate_driver *adrv); -int component_master_add_with_match(struct device *, - const struct component_master_ops *, struct component_match *); void component_match_add_release(struct device *parent, struct component_match **matchptr, void (*release)(struct device *, void *),