From patchwork Wed Oct 6 19:37:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540383 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4A4AC433FE for ; Wed, 6 Oct 2021 19:38:34 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B3FC8611C5 for ; Wed, 6 Oct 2021 19:38:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B3FC8611C5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 49FAA6EE23; Wed, 6 Oct 2021 19:38:27 +0000 (UTC) Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 306BE6EE21 for ; Wed, 6 Oct 2021 19:38:25 +0000 (UTC) Received: by mail-pj1-x102b.google.com with SMTP id cs11-20020a17090af50b00b0019fe3df3dddso4231421pjb.0 for ; Wed, 06 Oct 2021 12:38:25 -0700 (PDT) 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=j58dfbUBZwW/hmKRgo5vs/lRyzqUMHKsGPNMMLbunhU=; b=Y1wwuokx1MWQz4W2KC/uPsEkBd0g9c/plbqrfDvJtzWEc1aBfdoop1V0Dc2u9vOhPH hYvla/hDzcf2v0T/Ip27pxFOXrEMGFik/7TgNBcJiu7akqVTps/R0cyCwdokrPGgzJl9 t5Aitqjz35mb81s4dWcZM5M9hjNnjM87CHeCg= 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=j58dfbUBZwW/hmKRgo5vs/lRyzqUMHKsGPNMMLbunhU=; b=fcADojIR2CigcUrgQWa6Q7UdlpDxu9cdtgbMQFaAGQIC2B+HAMM8qn00Kx66xLSWZc ri8/CVXtfPZt6K6oZ7dz6de9wNNiwDHJZQXw1IGgHP//WFNKzXepciQlyY6e/14VkjGA GmNOhd6OYdt3BCyDC2z/bBF7fVm5LbPbsSv2bQCcPROtNrD7UDMvWvN8PJw3sLcmVYQv R3h1kVb2ST+SSwCJRU7TuNshkiuUmNH+JQRxLgl5sIQp8sBC7x20yunpId500BKZZmOw 2c9Ux8XvltD1iH1b+0KbCZIn5vzF0P1yoteckv9GM6dQAQLS2yv5hhXCCb1JhZ4aybJt wYoQ== X-Gm-Message-State: AOAM532qzmwZhaI3by904KYOtiYQtozrg6HIY21CCTibXAmBpevP48Be pnbfYQROFbq/IENWnENlqxQT7A== X-Google-Smtp-Source: ABdhPJxveN5+w6exJUG3HPrlzIcBU5i2978bNXQWxbzER8tpwo1BywzakGpB7P9r5NapUP9bUXzrIA== X-Received: by 2002:a17:903:18d:b0:13e:f1ef:d80c with SMTP id z13-20020a170903018d00b0013ef1efd80cmr58781plg.63.1633549104314; Wed, 06 Oct 2021 12:38:24 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:24 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 01/34] component: Introduce struct aggregate_device Date: Wed, 6 Oct 2021 12:37:46 -0700 Message-Id: <20211006193819.2654854-2-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Replace 'struct master' with 'struct aggregate_device' and then rename 'master' to 'adev' everywhere in the code. While we're here, put a struct device inside the aggregate device so that we can register it with a bus_type in the next patch. The diff is large but that's because this is mostly a rename, where sometimes 'master' is replaced with 'adev' and other times it is replaced with 'parent' to indicate that the struct device that was being used is actually the parent of the aggregate device and driver. Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/base/component.c | 250 ++++++++++++++++++++------------------ include/linux/component.h | 2 +- 2 files changed, 134 insertions(+), 118 deletions(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index 5e79299f6c3f..0a41bbe14981 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -9,6 +9,7 @@ */ #include #include +#include #include #include #include @@ -58,18 +59,21 @@ struct component_match { struct component_match_array *compare; }; -struct master { +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; + + int id; }; struct component { struct list_head node; - struct master *master; + struct aggregate_device *adev; bool bound; const struct component_ops *ops; @@ -79,7 +83,9 @@ struct component { static DEFINE_MUTEX(component_mutex); static LIST_HEAD(component_list); -static LIST_HEAD(masters); +static LIST_HEAD(aggregate_devices); + +static DEFINE_IDA(aggregate_ida); #ifdef CONFIG_DEBUG_FS @@ -87,12 +93,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"); @@ -122,46 +128,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_master_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_master_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_master_debugfs_add(struct aggregate_device *m) { } -static void component_master_debugfs_del(struct master *m) +static void component_master_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)) @@ -175,101 +181,102 @@ 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, NULL, GFP_KERNEL)) + if (!devres_open_group(adev->parent, NULL, 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; } - master->bound = true; + 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 +285,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, NULL); - master->bound = false; + if (adev->bound) { + adev->ops->unbind(adev->parent); + devres_release_group(adev->parent, NULL); + adev->bound = false; } } @@ -324,7 +331,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 +351,7 @@ static void __component_match_add(struct device *master, return; } - devres_add(master, match); + devres_add(parent, match); *matchptr = match; } @@ -370,13 +377,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,19 +395,19 @@ 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 @@ -415,32 +422,33 @@ 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_master_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); + ida_free(&aggregate_ida, adev->id); + kfree(adev); } /** @@ -459,31 +467,39 @@ int component_master_add_with_match(struct device *parent, const struct component_master_ops *ops, struct component_match *match) { - struct master *master; - int ret; + 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 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; + id = ida_alloc(&aggregate_ida, GFP_KERNEL); + if (id < 0) { + kfree(adev); + return id; + } + + adev->id = id; + adev->parent = parent; + adev->ops = ops; + adev->match = match; + dev_set_name(&adev->dev, "aggregate%d", id); - component_master_debugfs_add(master); - /* Add to the list of available masters. */ + component_master_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 +519,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 +555,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 +584,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 +593,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 +611,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 +638,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 +691,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 +773,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..71bfc3862633 100644 --- a/include/linux/component.h +++ b/include/linux/component.h @@ -41,7 +41,7 @@ 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); -struct master; +struct aggregate_device; /** * struct component_master_ops - callback for the aggregate driver From patchwork Wed Oct 6 19:37:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540385 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17A28C4332F for ; Wed, 6 Oct 2021 19:38:41 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DA1B261186 for ; Wed, 6 Oct 2021 19:38:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DA1B261186 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AB7F86EE27; Wed, 6 Oct 2021 19:38:27 +0000 (UTC) Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by gabe.freedesktop.org (Postfix) with ESMTPS id 026AC6EE23 for ; Wed, 6 Oct 2021 19:38:25 +0000 (UTC) Received: by mail-pj1-x1035.google.com with SMTP id np13so3000970pjb.4 for ; Wed, 06 Oct 2021 12:38:25 -0700 (PDT) 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=+Fh4eZ4nhLD6dey+QkqT8RQFJAmJG3+/mUvwCraPJo0=; b=D6ByiqYQEowAOeMD9tfU92iyZNu38wtprt9w3RsS9gc32lW38iEEyLMPm76g72X1OR 7z9NNrP+cqKgRtjtNz/3QYpluvfTw7YJmlnCVhXdjtLKgAoAeQ2bjJd8Jo52pqIVFQkE kKN4mmToNGea01iVGKe37rrRLAAuxYFKcxjrw= 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=+Fh4eZ4nhLD6dey+QkqT8RQFJAmJG3+/mUvwCraPJo0=; b=pQ8I+m5BG9Y/n5EgMpWYeNLV9jTncFSrnrPUYYCDPQndnm0n8B2eTYf+36vKBpq+BK eYzd1YuI2nyh0MRpV5lIn6jD33EsPaFzhJ/Sh1OJ5P/fsQVtEQr+L/6tIWwfyS7f26bo RNMHLxxfH/V24ENJErIIOvb5MHVOBRe5n9yWWkn1qlfAmlfZCsaJ5nMyBz9vQllcRAij wVeYjSd1llV2YkLiczwtLTfZGbzAEl5p+mxcYhZAT6QLaHGVvXqlJXziceieowanFFZs ciN8F/kpZkNVkntul086j7BmTuAteACHy8QRg0TIMPw6oqEoGFPOyePLvSPo2Q1HQGF/ edMg== X-Gm-Message-State: AOAM530jHQxP/PXd/tP6ERiBVQiyKX03/481D9tK4AuSi2tfZYfGjGc0 grIcqSpGwq+DzEguPd6FJoBgew== X-Google-Smtp-Source: ABdhPJzXE7em0C7M7X2aV04KXnms71d8d05kQYtaYvSDzEXtX2JJLSGg0XbLoBAK13zI+ShB1tDx/A== X-Received: by 2002:a17:90a:be14:: with SMTP id a20mr618372pjs.41.1633549105458; Wed, 06 Oct 2021 12:38:25 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:25 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 02/34] component: Introduce the aggregate bus_type Date: Wed, 6 Oct 2021 12:37:47 -0700 Message-Id: <20211006193819.2654854-3-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The component driver 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 driver model 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 driver 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: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Reported-by: kernel test robot --- drivers/base/component.c | 454 +++++++++++++++++++++++++++----------- include/linux/component.h | 62 +++++- 2 files changed, 381 insertions(+), 135 deletions(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index 0a41bbe14981..d99e99cabb99 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -15,6 +15,9 @@ #include #include #include +#include + +#include "base.h" /** * DOC: overview @@ -38,8 +41,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; @@ -60,17 +63,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; @@ -79,11 +85,11 @@ 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); @@ -101,7 +107,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"); @@ -149,16 +155,21 @@ static void component_master_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, @@ -185,7 +196,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 @@ -194,6 +204,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); @@ -201,20 +212,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 */ @@ -228,72 +246,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, NULL, 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; - } - - 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, NULL); - adev->bound = false; - } -} - static void devm_component_match_release(struct device *parent, void *res) { struct component_match *match = res; @@ -437,7 +389,6 @@ static void free_aggregate_device(struct aggregate_device *adev) int i; component_master_debugfs_del(adev); - list_del(&adev->node); if (match) { for (i = 0; i < match->num; i++) { @@ -451,20 +402,143 @@ static void free_aggregate_device(struct aggregate_device *adev) kfree(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(). - */ -int component_master_add_with_match(struct device *parent, - const struct component_master_ops *ops, +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, NULL, GFP_KERNEL)) { + ret = adrv->probe(adev); + if (ret) + devres_release_group(adev->parent, NULL); + } else { + ret = -ENOMEM; + } + mutex_unlock(&component_mutex); + + if (ret && modern) { + pm_runtime_disable(dev); + pm_runtime_set_suspended(dev); + pm_runtime_put_noidle(dev); + } + + return ret; +} + +static int 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, NULL); + if (!modern) + return 0; + + pm_runtime_put_noidle(dev); + + pm_runtime_disable(dev); + pm_runtime_set_suspended(dev); + pm_runtime_put_noidle(dev); + + return 0; +} + +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 int aggregate_driver_register(struct aggregate_driver *adrv) +{ + adrv->driver.bus = &aggregate_bus_type; + return driver_register(&adrv->driver); +} + +static void aggregate_driver_unregister(struct aggregate_driver *adrv) +{ + driver_unregister(&adrv->driver); +} + +static struct aggregate_device *aggregate_device_add(struct device *parent, + const struct component_master_ops *ops, struct aggregate_driver *adrv, struct component_match *match) { struct aggregate_device *adev; @@ -473,40 +547,114 @@ int component_master_add_with_match(struct device *parent, /* Reallocate the match array for its true size */ ret = component_match_realloc(match, match->num); if (ret) - return ret; + return ERR_PTR(ret); adev = kzalloc(sizeof(*adev), GFP_KERNEL); if (!adev) - return -ENOMEM; + return ERR_PTR(-ENOMEM); id = ida_alloc(&aggregate_ida, GFP_KERNEL); if (id < 0) { kfree(adev); - return id; + 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_master_debugfs_add(adev); - /* Add to the list of available aggregate devices. */ - mutex_lock(&component_mutex); - list_add(&adev->node, &aggregate_devices); - ret = try_to_bring_up_aggregate_device(adev, NULL); + 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; - if (ret < 0) - free_aggregate_device(adev); + adev = aggregate_device_add(parent, ops, adrv, match); + if (IS_ERR(adev)) { + ret = PTR_ERR(adev); + goto err; + } - mutex_unlock(&component_mutex); + 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; - return ret < 0 ? ret : 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 + * @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; +} +EXPORT_SYMBOL_GPL(component_aggregate_register); + /** * component_master_del - unregister an aggregate driver * @parent: parent device of the aggregate driver @@ -515,22 +663,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) { @@ -571,6 +757,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); @@ -665,6 +853,7 @@ int component_bind_all(struct device *parent, void *data) component_unbind(c, adev, data); } } + put_device(&adev->dev); return ret; } @@ -674,7 +863,6 @@ static int __component_add(struct device *dev, const struct component_ops *ops, int subcomponent) { struct component *component; - int ret; component = kzalloc(sizeof(*component), GFP_KERNEL); if (!component) @@ -688,18 +876,10 @@ 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 */ + return bus_rescan_devices(&aggregate_bus_type); } /** @@ -763,6 +943,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); @@ -774,13 +955,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 71bfc3862633..95d1b23ede8a 100644 --- a/include/linux/component.h +++ b/include/linux/component.h @@ -3,9 +3,7 @@ #define COMPONENT_H #include - - -struct device; +#include /** * struct component_ops - callbacks for component drivers @@ -82,11 +80,65 @@ struct component_master_ops { void (*unbind)(struct device *master); }; +struct component_match; + +/** + * struct aggregate_driver - Aggregate driver (made up of other drivers) + * @driver: device driver + * @match: component match list + */ +struct aggregate_driver { + /** + * @probe: + * + * Called when all components or the aggregate driver, as specified in + * the @match list are + * ready. Usually there are 3 steps to bind an aggregate driver: + * + * 1. Allocate a struct aggregate_driver. + * + * 2. Bind all components to the aggregate driver by calling + * component_bind_all() with the aggregate driver structure as opaque + * pointer data. + * + * 3. Register the aggregate driver with the subsystem to publish its + * interfaces. + */ + int (*probe)(struct aggregate_device *adev); + /** + * @remove: + * + * Called when either the aggregate driver, using + * component_aggregate_unregister(), or one of its components, using + * component_del(), is unregistered. + */ + void (*remove)(struct aggregate_device *adev); + /** + * @shutdown: + * + * Called when the system is shutting down. + */ + void (*shutdown)(struct aggregate_device *adev); + + struct device_driver driver; +}; + +static inline struct aggregate_driver *to_aggregate_driver(struct device_driver *d) +{ + if (!d) + return NULL; + + return container_of(d, struct aggregate_driver, driver); +} + +int component_aggregate_register(struct device *parent, + struct aggregate_driver *adrv, struct component_match *match); +void component_aggregate_unregister(struct device *parent, + struct aggregate_driver *adrv); + void component_master_del(struct device *, const struct component_master_ops *); -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, From patchwork Wed Oct 6 19:37:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540393 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77F5DC43217 for ; Wed, 6 Oct 2021 19:39:05 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4C651611C5 for ; Wed, 6 Oct 2021 19:39:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4C651611C5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C49A66EE30; Wed, 6 Oct 2021 19:38:34 +0000 (UTC) Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by gabe.freedesktop.org (Postfix) with ESMTPS id BAED76EE2D for ; Wed, 6 Oct 2021 19:38:31 +0000 (UTC) Received: by mail-pj1-x1035.google.com with SMTP id pf6-20020a17090b1d8600b0019fa884ab85so5183846pjb.5 for ; Wed, 06 Oct 2021 12:38:31 -0700 (PDT) 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=TrXWSXEHZSSe+ZNP0MEWDrKg7JGFcV3ZLPK0R/nqLBY=; b=BYGV2YJoDO3XYhcc2ImhdpJbxGgocl9uyQLt3U1WbZvj0WL1FshJVPAYJb1NRelDJX xSs8FKrvBjdPyW8re4vl4F7WY1oqMfj+MzapTE21WGwzZRESm3Pj2S10sX9mNELTef+/ tz9fcvBz3MaIYvACyA/0R/zTO0Xrz9+s4yWuk= 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=TrXWSXEHZSSe+ZNP0MEWDrKg7JGFcV3ZLPK0R/nqLBY=; b=7TWzWXw7flE8JO62/ucj2fsofVhNhzJnkcAx4KPkCY27PlQwv8wSCPVG4sHXL7MyZm DI96YDm3sZ3iAdUHKEownq+CPDdLsypryhS6+2wh+hsRfR+dK8n3Llamu07D9vei+6Rg GZ+0fCUiK8G4vm3kUIerfFcMdqQY7hFOaK72XfbhVkQPx6JgLMyusdEcTE0YfUd5Nnm7 5/H+QdAAcspgxfBwSJQUAE6uqkofzS/IHrvI+xXEutrTx9GhJnv522k0Cor3wU4/t8hp uHsKgowVyFTSbEVpOUAAaBGCGacIdpxkQweTzfz6J/D+u81+5dmuKOM552gNLgdVdQp0 33aA== X-Gm-Message-State: AOAM533TkEI9k6VXKyAQzyKBmLxw4v/mgxolX4RbHBlAijb+me01QugA Gr3NluzlAZ6mZQ6r1YIlK/nUhw== X-Google-Smtp-Source: ABdhPJzmaWGAcSqzevd1G0esgXTcACMs0ekVu6jIQ64fXf44o8eRUL2dBeO9lQ2MaAbCFARLQI3HAg== X-Received: by 2002:a17:902:bf07:b0:138:e32d:9f2e with SMTP id bi7-20020a170902bf0700b00138e32d9f2emr12466282plb.59.1633549106864; Wed, 06 Oct 2021 12:38:26 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:26 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 03/34] component: Move struct aggregate_device out to header file Date: Wed, 6 Oct 2021 12:37:48 -0700 Message-Id: <20211006193819.2654854-4-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This allows aggregate driver writers to use the device passed to their probe/remove/shutdown functions properly instead of treating it as an opaque pointer. Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/base/component.c | 15 --------------- include/linux/component.h | 19 ++++++++++++++++--- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index d99e99cabb99..f49b48695c8f 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -62,21 +62,6 @@ struct component_match { struct component_match_array *compare; }; -struct aggregate_device { - const struct component_master_ops *ops; - struct device *parent; - struct device dev; - struct component_match *match; - struct aggregate_driver *adrv; - - int id; -}; - -static inline struct aggregate_device *to_aggregate_device(struct device *d) -{ - return container_of(d, struct aggregate_device, dev); -} - struct component { struct list_head node; struct aggregate_device *adev; diff --git a/include/linux/component.h b/include/linux/component.h index 95d1b23ede8a..e99cf8e910f0 100644 --- a/include/linux/component.h +++ b/include/linux/component.h @@ -5,6 +5,8 @@ #include #include +struct component_match; + /** * struct component_ops - callbacks for component drivers * @@ -39,8 +41,6 @@ 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); -struct aggregate_device; - /** * struct component_master_ops - callback for the aggregate driver * @@ -80,7 +80,20 @@ struct component_master_ops { void (*unbind)(struct device *master); }; -struct component_match; +struct aggregate_device { + const struct component_master_ops *ops; + struct device *parent; + struct device dev; + struct component_match *match; + struct aggregate_driver *adrv; + + int id; +}; + +static inline struct aggregate_device *to_aggregate_device(struct device *d) +{ + return container_of(d, struct aggregate_device, dev); +} /** * struct aggregate_driver - Aggregate driver (made up of other drivers) From patchwork Wed Oct 6 19:37:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540391 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4BA7C433EF for ; Wed, 6 Oct 2021 19:39:01 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 88670611C1 for ; Wed, 6 Oct 2021 19:39:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 88670611C1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 371F96EE32; Wed, 6 Oct 2021 19:38:35 +0000 (UTC) Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6A1FD6EE29 for ; Wed, 6 Oct 2021 19:38:28 +0000 (UTC) Received: by mail-pg1-x52d.google.com with SMTP id q201so3370144pgq.12 for ; Wed, 06 Oct 2021 12:38:28 -0700 (PDT) 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=6Qz3MqVp4L66d3gQlwKw4vRvuaWChiqClLaMXKhYzGc=; b=l4e1FMOrywcfzM+upqvR//TWdKNKEaPy2i+GExt4kB7CT9ZY2TkuT5R4wwZ5N10r8Q aXzQLDrjqssJf2bGYdtCJIcX4ikGRYk0jYS1fW5nk405pe73/dlXecwp8sAQ+8z4mSR5 50almrqWAFn3KuNz8JwxteMdmdJjR/x6sLB8U= 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=6Qz3MqVp4L66d3gQlwKw4vRvuaWChiqClLaMXKhYzGc=; b=nVdnYpWWkFmEwqNETHuLG4T0Nd5znn1zgVglw/krQnr6gXWvC2+/gDc5Jz3yRS43TM 6q7REm3KUwK2BuJzTsvCIxG94i40OUcxWmk3PTLsqQ6BLx6rMvAXrcbnUc4LszfAycQo CKJKbH6QwJU6LfgyzfOjsd+tnK4uZ5DEVzs449vbKUdgYXhXIqFTvWwT0eO9hrprBVxx Fdo9TgPjtUQiJVLCLXCB6i587WRpm0/UBIbJJCof0bS3wB2oOVYGEvhUOqDVN93rqsQU Z65JF6xDIlagJyNV652VNx2PnqNAA9QZlncpLR1jeU3uwCSOmtDHoe3DXFAZ3WtrTjYI YHwg== X-Gm-Message-State: AOAM530iwg5442gMhQr2qHm0gntOE26ixiowehDSI9BCo7vADcOvE846 99oCm0DMJKvKrac++UnAa5R3FA== X-Google-Smtp-Source: ABdhPJz5eIxLoJaDCMkqk1dt9OZ5QOr8U4KJ9NKU93qoARaZKheLDyxaukIcyTx+GjZYTxVFRdWgPA== X-Received: by 2002:a63:cf44:: with SMTP id b4mr440896pgj.215.1633549107965; Wed, 06 Oct 2021 12:38:27 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:27 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 04/34] drm/msm: Migrate to aggregate driver Date: Wed, 6 Oct 2021 12:37:49 -0700 Message-Id: <20211006193819.2654854-5-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 | 46 +++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 2e6fc185e54d..efbcae6e585f 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -1324,19 +1324,35 @@ 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(adev->parent, &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(adev->parent); +} + +static void msm_drm_shutdown(struct aggregate_device *adev) +{ + struct drm_device *drm = platform_get_drvdata(to_platform_device(adev->parent)); + struct msm_drm_private *priv = drm ? drm->dev_private : 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, + }, }; /* @@ -1365,7 +1381,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; @@ -1378,23 +1394,12 @@ static int msm_pdev_probe(struct platform_device *pdev) static int msm_pdev_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &msm_drm_ops); + component_aggregate_unregister(&pdev->dev, &msm_drm_aggregate_driver); of_platform_depopulate(&pdev->dev); return 0; } -static void msm_pdev_shutdown(struct platform_device *pdev) -{ - struct drm_device *drm = platform_get_drvdata(pdev); - struct msm_drm_private *priv = drm ? drm->dev_private : 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 }, @@ -1410,7 +1415,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 Wed Oct 6 19:37:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540387 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11D00C433EF for ; Wed, 6 Oct 2021 19:38:49 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D6F12611C3 for ; Wed, 6 Oct 2021 19:38:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D6F12611C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EE6836EE24; Wed, 6 Oct 2021 19:38:30 +0000 (UTC) Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2472F6EE29 for ; Wed, 6 Oct 2021 19:38:29 +0000 (UTC) Received: by mail-pf1-x433.google.com with SMTP id p1so3269150pfh.8 for ; Wed, 06 Oct 2021 12:38:29 -0700 (PDT) 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=WSt66/qxaj+Yl6pIb1r8ArjDZRzSqERxTSL7e01cwWQ=; b=BmiI3LSyKjcVMkJ2gZd3LhPTHWfcmkydptEVQ9oiWWAFWzIe1MohWjx9bbawlzcH7q qetmyBf+RlGrk5ISWZRggAq3lthN3K/k4DISR3I5gMMLDXMXT8AzbWlWkmrgXro8h50I 0A+4VMPnY2FjF4u4slYiTPHpdBdGgrCNY66dA= 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=WSt66/qxaj+Yl6pIb1r8ArjDZRzSqERxTSL7e01cwWQ=; b=AVSUr5sKWF/JHmcx5JO5oRUy0ZlgZCbyuRIaozpS82g1+k71jWBmmhWBr8kADfXKiQ 9sgJVDnX8aWZiPzeM0Sq7l2PSaxqeBpUfOE+zPVluuCTUb2Az+fI87b+mnumcyRiTV/5 ZUgNuhADQMAZwPvB+XLIFbOLl6vXJcoEU4wq0DTzkc+yA44KmXmDo0mifyLLfTE+OpRy s+mOVJamlbOYnBWZ/UO40Dxvit1LI3cPlBvxsDBvIJluPiMNsKlvoLMYQ0lkeeE/D2a8 1t0ISHDWPk2zSUgnB5k7/5GutuZ9bE/EO9M+CVIWdl+dBZSm1H86EJLitvF3WwpIpbZG /M2Q== X-Gm-Message-State: AOAM533N3cqbUvrWbueX1MAt8K4xFozYxA7CYeKri9zKmJgGBWFeqAx/ ZBBuLZUkeail6NF7w3H6XxzmRw== X-Google-Smtp-Source: ABdhPJxNGoDafhlEh+0TsExPrHB7fqmUepOv8+MJYv9j+yZKMoyNAQ1lN9Vxlb31AxOrCCSdOAdpeg== X-Received: by 2002:a63:5717:: with SMTP id l23mr443433pgb.87.1633549108801; Wed, 06 Oct 2021 12:38:28 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:28 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Daniel Vetter Subject: [PATCH v2 05/34] component: Add {bind, unbind}_component() ops that take aggregate device Date: Wed, 6 Oct 2021 12:37:50 -0700 Message-Id: <20211006193819.2654854-6-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 Signed-off-by: Stephen Boyd --- drivers/base/component.c | 14 +++++++++++--- include/linux/component.h | 22 ++++++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index f49b48695c8f..a6dd33d0ddeb 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -707,8 +707,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 */ @@ -773,7 +778,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 e99cf8e910f0..d8dcbf9733da 100644 --- a/include/linux/component.h +++ b/include/linux/component.h @@ -6,6 +6,7 @@ #include struct component_match; +struct aggregate_device; /** * struct component_ops - callbacks for component drivers @@ -19,18 +20,39 @@ struct component_ops { * * Called through component_bind_all() when the aggregate driver is * ready to bind the overall driver. + * + * Deprecated: Use bind_component() instead. */ int (*bind)(struct device *comp, struct device *master, void *master_data); + /** + * @bind_component: + * + * Called through component_bind_all() when the aggregate driver is + * ready to bind the overall driver. + */ + int (*bind_component)(struct device *comp, struct aggregate_device *adev, + void *aggregate_data); /** * @unbind: * * Called through component_unbind_all() when the aggregate driver is * ready to bind the overall driver, or when component_bind_all() fails * part-ways through and needs to unbind some already bound components. + * + * Deprecated: Use unbind_component() instead. */ void (*unbind)(struct device *comp, struct device *master, void *master_data); + /** + * @unbind_component: + * + * Called through component_unbind_all() when the aggregate driver is + * ready to unbind the overall driver, or when component_bind_all() fails + * part-ways through and needs to unbind some already bound components. + */ + int (*unbind_component)(struct device *comp, struct aggregate_device *adev, + void *aggregate_data); }; int component_add(struct device *, const struct component_ops *); From patchwork Wed Oct 6 19:37:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540389 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B9DFC4332F for ; Wed, 6 Oct 2021 19:38:53 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E2B69611C5 for ; Wed, 6 Oct 2021 19:38:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E2B69611C5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 678C76EE25; Wed, 6 Oct 2021 19:38:31 +0000 (UTC) Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by gabe.freedesktop.org (Postfix) with ESMTPS id 57E716EE2D for ; Wed, 6 Oct 2021 19:38:30 +0000 (UTC) Received: by mail-pf1-x435.google.com with SMTP id 187so3257879pfc.10 for ; Wed, 06 Oct 2021 12:38:30 -0700 (PDT) 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=fRSGJsbcrSuo8/hCk8AH4Rju+QnPEjHdwHGnjiYpj+0=; b=aN+zbJy7ziqmUBmCYP38UAKUihmed+FYp84G9KznDRdiWV1uTzOqYVISExYpWNudP9 8Dc9Afor0eTRnSRj4DZvI35qEHwhtOqSMN1x3vINUIIW87cVGkpDaNrVIHbrScKtagE5 k7RFVoTVJwC7AnEUzRZokTQlMf88bLKgetc4E= 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=fRSGJsbcrSuo8/hCk8AH4Rju+QnPEjHdwHGnjiYpj+0=; b=UE/Y8E6e6TalFMs7EX2U4Xd64JSuESjdCu3nwa3nUPiNQqCwklSSG9bP+68VuvdDAI ckHJmZHtmUC37NiDqcVzv0P2o2HbLUGfuDkM3cx3n3n+Bnz4rr7e54MocJ4aJYIiRKMe aEhH7Jn7reP/P5MlVTp1s8hsGcw31Jfos5vqQdoEQvAaISpv/edFW+V0jgANKET3bzgR r/PyqmE4d6RqupU6pSw8u8HCBGsZ4cnrKUT6xV+uTUcaLsegZyect9+0QbFCVikiP5CQ iNDnPBDE5cfO+zSLHUE8H3bHCS+EwBTIXFe0rFkGOFUBLdRZEI1dupN6zL+hU49g0tZW s9jw== X-Gm-Message-State: AOAM532+05v9/vrvMDO0W9dr3x8ihDIlvAopute0JJR0MmIcM9ngvHqY 4zID87c7QTDUzv9pGxNisX2nkQ== X-Google-Smtp-Source: ABdhPJw2THsDae51farFvaMjtz9MkGLifCVXXxt8tCOU+bKfcMJ5VbxsHYXLHY80SLIp4mB4UkAkVQ== X-Received: by 2002:a65:620d:: with SMTP id d13mr483109pgv.36.1633549109943; Wed, 06 Oct 2021 12:38:29 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:29 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 06/34] drm/of: Add a drm_of_aggregate_probe() API Date: Wed, 6 Oct 2021 12:37:51 -0700 Message-Id: <20211006193819.2654854-7-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 Reported-by: kernel test robot Reported-by: kernel test robot --- drivers/gpu/drm/drm_of.c | 85 +++++++++++++++++++++++++++++++--------- include/drm/drm_of.h | 11 ++++++ 2 files changed, 77 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 997b8827fed2..58db65ad2770 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. + */ +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 *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. + */ +static 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 b9b093add92e..c3ec9b14df48 100644 --- a/include/drm/drm_of.h +++ b/include/drm/drm_of.h @@ -40,6 +40,9 @@ void drm_of_component_match_add(struct device *master, int drm_of_component_probe(struct device *dev, int (*compare_of)(struct device *, void *), const struct component_master_ops *m_ops); +int drm_of_aggregate_probe(struct device *dev, + int (*compare_of)(struct device *, void *), + struct aggregate_driver *adrv); int drm_of_encoder_active_endpoint(struct device_node *node, struct drm_encoder *encoder, struct of_endpoint *endpoint); @@ -78,6 +81,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 Wed Oct 6 19:37:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540399 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62E78C433FE for ; Wed, 6 Oct 2021 19:39:22 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 32586610A2 for ; Wed, 6 Oct 2021 19:39:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 32586610A2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0D86A6EE3B; Wed, 6 Oct 2021 19:38:41 +0000 (UTC) Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by gabe.freedesktop.org (Postfix) with ESMTPS id 728A46EE29 for ; Wed, 6 Oct 2021 19:38:31 +0000 (UTC) Received: by mail-pf1-x436.google.com with SMTP id 187so3257908pfc.10 for ; Wed, 06 Oct 2021 12:38:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QdKC3RDnWMeVhqBKuTAcfq/eZBHYEe2Kb+X7ix5SdpY=; b=bYXZrb2Mw0ygA/9KQUszZR0D4+fBHb1MS2IAeBPCv5THUvbkeF9CzMvcUArorOxTAK B1HrTvXihaUQeWiLQvL+0lEMneUWKCwMfy/POUvBJf8ELzE+zKDqutR6eEmcX2r97Guc Uv7Q5lG6rFPLy8WnQ5GTASLWbtTQ5A00scm0M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QdKC3RDnWMeVhqBKuTAcfq/eZBHYEe2Kb+X7ix5SdpY=; b=8OkuBMR2dn+5BS0UcUq3b6pvr290tKn7E/WXrraOFyAKDpgsRmpdCuJd9nWO9d4tZ2 u6PvpXWAHP/mDZUdvUGX4nGGZ52kgJDNFhTHne9WrFXbiUCULf0wXBfe3I5u1Mz7dDQp 1GFCg6PMjNplEvoPHt/Wh0G8FCrrnUOxZz+YPx+EIhKrGAU9zX1GWdmXOElwfWvZNxOy 0gH1TX/t8Pp5B6m8FrH8y9AbEOmhqJZP/g4lwCTjEqG4D26Nu125ABH7TtYpL4ptgBKk twQgCCIsofFy8KXAOg+h7ze4AhHEKv15tiF/TmoW4aFXgnYg3Io4wBQGsHCpaoxMnh4A 4KRQ== X-Gm-Message-State: AOAM532nlaA1Ia2rDihkd73B/jTfd7VDRHbllVMxgNmFNy7uWtV+IpWd 5aiN/UJl6Z5+BQKjVaAKa+/BVw== X-Google-Smtp-Source: ABdhPJyQxcu7a9c6zJ5OPG0sbw5QtjSSLjEp7prUkIluddBHbCR+Nhq+ATnHLHRc/o8nEL0u0iy0bg== X-Received: by 2002:a63:2022:: with SMTP id g34mr433631pgg.173.1633549111054; Wed, 06 Oct 2021 12:38:31 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:30 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 07/34] drm/komeda: Migrate to aggregate driver Date: Wed, 6 Oct 2021 12:37:52 -0700 Message-Id: <20211006193819.2654854-8-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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..0463386a6ed2 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c @@ -25,8 +25,9 @@ struct komeda_dev *dev_to_mdev(struct device *dev) return mdrv ? mdrv->mdev : NULL; } -static void komeda_unbind(struct device *dev) +static void komeda_unbind(struct aggregate_device *adev) { + struct device *dev = adev->parent; 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 = adev->parent; 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 Wed Oct 6 19:37:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540397 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 309D6C433FE for ; Wed, 6 Oct 2021 19:39:19 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 02DF2611C1 for ; Wed, 6 Oct 2021 19:39:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 02DF2611C1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 12AA66EE38; Wed, 6 Oct 2021 19:38:41 +0000 (UTC) Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7E7E66EE2B for ; Wed, 6 Oct 2021 19:38:32 +0000 (UTC) Received: by mail-pg1-x52d.google.com with SMTP id 75so3418241pga.3 for ; Wed, 06 Oct 2021 12:38:32 -0700 (PDT) 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=wZ50+nY6iKl4XzIgEo27g77S25bE2oAR00ZvAHfRl/s=; b=VAuNWWpXvcDIC0EtmclApgGs3mUgw132HiRjwqx6qFpK7airfdQxAgppizP53solsC sbfIgh3sZ8h1i4NGIbFxB7GpyHzj25lS+98cfdXkHV4mEv1BdzftynD+NrGP0EHv1v4W MvKJy3mJ1XO818T/sKGM0Xd/N6A9Jk7VquK7Y= 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=wZ50+nY6iKl4XzIgEo27g77S25bE2oAR00ZvAHfRl/s=; b=IONXRXANNvx04+3KSN3/buCyaaDustJ+xnQOXtsED7vMBFEgOP6B2TU/eWrs+lUlsY 3lUExLfolT05AvW04Y673IqREsE1RGFVq1fOjZzuIdXSkR3Nf8N/EjisVne8brEqC/Hd lLcMKnGmQPTtuNKUXaF2Y4/ED6pne6DRHDJUo01YDbRGQwBuwUJLu5ZqUpD5OsFJQECK 8yp7LPh1JoPdZDSnn/42BFI1xZoRWM7jfbyhSgEFOnujQIr4k25kJngoPPWnQ2WVfzs+ jC73yTflT5mazO7nqqq3ceeqLf22IyXsUfQL+28Zf6gAAAouax6zzaevhBLiUNC6JYcZ MVtQ== X-Gm-Message-State: AOAM532fY6+V5xDCGAaR5I5n7NOtekLvArBBuCcg4FO9u3tCKvTstto5 wAUF99cmlSSb/UtmOtH5FLgbtw== X-Google-Smtp-Source: ABdhPJxlVpTQwUTtDgr6C3JCHEPtvD3GPaVWT3EFo7FG/d0w7JfLy1mAQ6Kb40DgOcgVvm3myI73kQ== X-Received: by 2002:a63:c10b:: with SMTP id w11mr468986pgf.228.1633549112200; Wed, 06 Oct 2021 12:38:32 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:31 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 08/34] drm/arm/hdlcd: Migrate to aggregate driver Date: Wed, 6 Oct 2021 12:37:53 -0700 Message-Id: <20211006193819.2654854-9-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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..8f3e5924042a 100644 --- a/drivers/gpu/drm/arm/hdlcd_drv.c +++ b/drivers/gpu/drm/arm/hdlcd_drv.c @@ -270,8 +270,9 @@ static const struct drm_driver hdlcd_driver = { .minor = 0, }; -static int hdlcd_drm_bind(struct device *dev) +static int hdlcd_drm_bind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct drm_device *drm; struct hdlcd_drm_private *hdlcd; int ret; @@ -344,8 +345,9 @@ static int hdlcd_drm_bind(struct device *dev) return ret; } -static void hdlcd_drm_unbind(struct device *dev) +static void hdlcd_drm_unbind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct drm_device *drm = dev_get_drvdata(dev); struct hdlcd_drm_private *hdlcd = drm->dev_private; @@ -367,9 +369,13 @@ static void hdlcd_drm_unbind(struct device *dev) drm_dev_put(drm); } -static const struct component_master_ops hdlcd_master_ops = { - .bind = hdlcd_drm_bind, - .unbind = hdlcd_drm_unbind, +static struct aggregate_driver hdlcd_aggregate_driver = { + .probe = hdlcd_drm_bind, + .remove = hdlcd_drm_unbind, + .driver = { + .name = "hdlcd_drm", + .owner = THIS_MODULE, + }, }; static int compare_dev(struct device *dev, void *data) @@ -390,13 +396,12 @@ static int hdlcd_probe(struct platform_device *pdev) drm_of_component_match_add(&pdev->dev, &match, compare_dev, port); of_node_put(port); - return component_master_add_with_match(&pdev->dev, &hdlcd_master_ops, - match); + return component_aggregate_register(&pdev->dev, &hdlcd_aggregate_driver, match); } static int hdlcd_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &hdlcd_master_ops); + component_aggregate_unregister(&pdev->dev, &hdlcd_aggregate_driver); return 0; } From patchwork Wed Oct 6 19:37:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540395 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F383BC433F5 for ; Wed, 6 Oct 2021 19:39:11 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C87F461350 for ; Wed, 6 Oct 2021 19:39:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C87F461350 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C19486EE31; Wed, 6 Oct 2021 19:38:35 +0000 (UTC) Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by gabe.freedesktop.org (Postfix) with ESMTPS id CE1486EE2D for ; Wed, 6 Oct 2021 19:38:33 +0000 (UTC) Received: by mail-pg1-x52b.google.com with SMTP id a73so3456786pge.0 for ; Wed, 06 Oct 2021 12:38:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tyFhWuo5Hgtey/EJ0ER9SojRROyEQ1lmEqqEKYabFj8=; b=WbivjpxeeLzpbDhsokO1QAyB+XeHitmcvYdTvkg9A9dVGb5dDzGxavDwdHcpUlgwDU V8/p9ZJfFgtjFFTBIQCPzL9Jc4iZN4LdjP1xFwucOfErOWq5i7zqiM9yhCRiZAlMDOFp XVvHkDRFsICOg23ZGy7WLJVSYgKUKLIWw454A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tyFhWuo5Hgtey/EJ0ER9SojRROyEQ1lmEqqEKYabFj8=; b=2UwjD3/U4HRa9skr+hL1gkl/Yw3n/0BWVbuESX9i4NoCd9gdqguRoHfSIdt3QhfTxB PY06Cuzjtxaz7mE0FRJcd7xkWaYeDNUFV48wTj7wBe+B+qJIJ1vNuKS6U7O9K069zoW9 SlK0Cu56UxWrhn3U1HlRD/ZnZwUGwKjt0ChjZi56WusDxNL1OZjMdS2BpuwU/xye4hYb EpJYXtNSgMS2nlVuRX1iCgCELPzfLp17+sKS0FTytpxc+/KNgSqm2kuWRHTAQou3pwn1 8A6vmaV+5VUcOFnmrqyqpX3ZiGo8zgP8FcjYr4U3HmfpNQgkYRl4n6PLcHl9mB7jdYKq zj8w== X-Gm-Message-State: AOAM531tQrv7p9oAus8RdGX3TtsCerthefErTnWK5YwdMxF2832ynbIQ qgPfUNiVueD/SsjC3cK9/k9+vA== X-Google-Smtp-Source: ABdhPJznGJCOeCeyKq8Z/Qhtw8kvrQb8bZRBLDlNwr9nxrZXmfzjPyXz1pMYkJN8S5TO6MRfL6Q8fg== X-Received: by 2002:a05:6a00:1789:b0:43d:ea98:7ea8 with SMTP id s9-20020a056a00178900b0043dea987ea8mr39552269pfg.67.1633549113415; Wed, 06 Oct 2021 12:38:33 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:33 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 09/34] drm/malidp: Migrate to aggregate driver Date: Wed, 6 Oct 2021 12:37:54 -0700 Message-Id: <20211006193819.2654854-10-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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..e6ee4d1e3bb8 100644 --- a/drivers/gpu/drm/arm/malidp_drv.c +++ b/drivers/gpu/drm/arm/malidp_drv.c @@ -702,8 +702,9 @@ static int malidp_runtime_pm_resume(struct device *dev) return 0; } -static int malidp_bind(struct device *dev) +static int malidp_bind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct resource *res; struct drm_device *drm; struct malidp_drm *malidp; @@ -894,8 +895,9 @@ static int malidp_bind(struct device *dev) return ret; } -static void malidp_unbind(struct device *dev) +static void malidp_unbind(struct aggregate_device *adev) { + struct device *dev = adev->parent; 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 Wed Oct 6 19:37:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540407 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13FA3C433EF for ; Wed, 6 Oct 2021 19:39:32 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D2838610A2 for ; Wed, 6 Oct 2021 19:39:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D2838610A2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A87CA6EE35; Wed, 6 Oct 2021 19:38:41 +0000 (UTC) Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by gabe.freedesktop.org (Postfix) with ESMTPS id D914B6EE2D for ; Wed, 6 Oct 2021 19:38:34 +0000 (UTC) Received: by mail-pg1-x52d.google.com with SMTP id a73so3456831pge.0 for ; Wed, 06 Oct 2021 12:38:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=g366T6z/wDv+u0z2UhkHLqZZ67YI06zaB4um2FhnwRI=; b=OCjckHmgVomhirlm4yoY3Ii16VFEkoGpnVb/rg7YeA9Sjs5pjK51XrAmhnZUCGbp1/ rLuw8BarUAEtec6v5IBx/bM9/4DYawTek70dpAnQIfVDm1gxpDPo6TSS0cBAAUyed0XI Qi1hDriSwrnO6jbb9hK30iPFf3toj4LokQlbA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=g366T6z/wDv+u0z2UhkHLqZZ67YI06zaB4um2FhnwRI=; b=BCFklqTONH2ZGPlIRGNmOomYPz3TTtlKWTKAbpZN7GmZo6dmhb699qCfDFfqYYvqUZ xSnprt3NodA96765Oc1DzIxShXGZ3trf5xiBCmGFtc8K7P9qN+zgjkV8wTQVWcWqNjmz veuNdDd9KdCbn/o/4bf5jgMu6/bZKzHLW3uawg/RyhTh3iR11HpwjINJAl3tT/7ogn1Y zFc+grn5IhPf2zpbHubsILtO2kIJrndFG1JehK2z8gknK8Z3SHtePJxIVDPJkZKidJE1 Wb9OQJnny/pjuU0WjA46iJs1c519Sytt0Ua3beJ7OsIwC0/SwTZhBOFMDN48KSMLrhZJ f/Xw== X-Gm-Message-State: AOAM530teiLeI+KzNTRasiCICl+80xVcghwKTLtLjN0tycosPtMy5jf6 E7Qdxyjg077ewibQhV9fFqdkNg== X-Google-Smtp-Source: ABdhPJwlpdVfUHse1Xy2t9sgc+u/2pmr9Y0Keygn1AiwMH09mIKYOSQgDQcnSyQQly48RrXK1A/jQg== X-Received: by 2002:a63:2484:: with SMTP id k126mr420094pgk.297.1633549114473; Wed, 06 Oct 2021 12:38:34 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:34 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 10/34] drm/armada: Migrate to aggregate driver Date: Wed, 6 Oct 2021 12:37:55 -0700 Message-Id: <20211006193819.2654854-11-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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..b3559363ea43 100644 --- a/drivers/gpu/drm/armada/armada_drv.c +++ b/drivers/gpu/drm/armada/armada_drv.c @@ -60,8 +60,9 @@ static const struct drm_mode_config_funcs armada_drm_mode_config_funcs = { .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 = adev->parent; 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 = adev->parent; 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 Wed Oct 6 19:37:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540401 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BF93C433FE for ; Wed, 6 Oct 2021 19:39:25 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6792D611C3 for ; Wed, 6 Oct 2021 19:39:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6792D611C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 002C26EE3F; Wed, 6 Oct 2021 19:38:41 +0000 (UTC) Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by gabe.freedesktop.org (Postfix) with ESMTPS id 88A156EE37 for ; Wed, 6 Oct 2021 19:38:37 +0000 (UTC) Received: by mail-pf1-x42e.google.com with SMTP id m26so3295808pff.3 for ; Wed, 06 Oct 2021 12:38:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NsjwfsQuiDMEQ+TXne3j17pwDv7xto97Rnhld6OcLgM=; b=RQnUZaK4HxQnphoJXW6as0yGSWjlXhvXnKk+AXAljPiVIpUGiz4I0K0+45dWUmfvx5 rX/BpLn46/98Rs0+05XyBt6kqXq4npe9hapsSz9glTU/BzCsa8IcVEEnVSXnpLpHRv6M /ibYXGxPlo8ADqcHCj6LHymEoph0iAPQXJrW8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NsjwfsQuiDMEQ+TXne3j17pwDv7xto97Rnhld6OcLgM=; b=Xc/BO3hqpXJEoByJkMeTPfxL8PeoB2z6LFHZb2XlKc2RnqcMsmyZ33ixfo9o5k7mYJ JuSZfyMPWYSIVbymki3LVqfNqvF9i1EtaqUirJSIIHOhMULHaiBBM2PebfUY5mmxw6pJ xI6i//RJgIbGFQZqEgyabv3+ri3YunzX4qkV++bNvVpnVtk7FYdoCSj/tJcoDJjOMfNc 0qHxaQWhTyJLAEGe1zZpbF96yoz/+rxIo/pMfzoJAacniCzHOyKhCx5qe568gcaa7Ltf 5kTnDq1Hp70cpz6SrZ/Cb/Vp3oG/5LRehmQ1AlcxzPS8i8nyh2AuxrWNcrKQfPz4E/rz Cibw== X-Gm-Message-State: AOAM530oQSoKBjDBXrQ5B0eNU+u7iYys0ASMpOWk+rbMEc1ersNNz7fm AwRNWSKjtp/53kWioG8QS5zW+Q== X-Google-Smtp-Source: ABdhPJyigRY/kdJkeySf+So6JSWtIHmHimXCDJLCUi8ll0MtcU/hsAJs+xpo44TpQlmOU0W5j0qQ3g== X-Received: by 2002:a05:6a00:1509:b0:44c:84b2:513 with SMTP id q9-20020a056a00150900b0044c84b20513mr184177pfu.76.1633549115595; Wed, 06 Oct 2021 12:38:35 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:35 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 11/34] drm/etnaviv: Migrate to aggregate driver Date: Wed, 6 Oct 2021 12:37:56 -0700 Message-Id: <20211006193819.2654854-12-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 7dcc6392792d..95d1e518ff13 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c @@ -494,8 +494,9 @@ static const struct drm_driver etnaviv_drm_driver = { /* * Platform driver: */ -static int etnaviv_bind(struct device *dev) +static int etnaviv_bind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct etnaviv_drm_private *priv; struct drm_device *drm; int ret; @@ -552,8 +553,9 @@ static int etnaviv_bind(struct device *dev) return ret; } -static void etnaviv_unbind(struct device *dev) +static void etnaviv_unbind(struct aggregate_device *adev) { + struct device *dev = adev->parent; 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) @@ -609,12 +615,12 @@ static int etnaviv_pdev_probe(struct platform_device *pdev) component_match_add(dev, &match, compare_str, names[i]); } - 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 Wed Oct 6 19:37:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540403 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B73E9C433EF for ; Wed, 6 Oct 2021 19:39:27 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 86DEC610A2 for ; Wed, 6 Oct 2021 19:39:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 86DEC610A2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 598D36EE37; Wed, 6 Oct 2021 19:38:43 +0000 (UTC) Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5F9296EE2E for ; Wed, 6 Oct 2021 19:38:37 +0000 (UTC) Received: by mail-pg1-x52c.google.com with SMTP id e7so3420289pgk.2 for ; Wed, 06 Oct 2021 12:38:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9+fM2dIjOxE0hdJ7o5inMEoSl4k+Dtn8hCQbdOli+o8=; b=b2+d6v5GiMBhbiJlMh+JAYQaQMeU/omvkUDdtud02nMdmV4hwCTKs50xpU112kmzPR 4LJeio6+TPi+HssGosfu5UCJQikYz6lIxUr2HdBgDeZXpz/f2P9N0DrUrV+bqKTBe9Gr SX4Rv4QBT2wrlVmLtkusXR/E1BKN7Jr/0sk28= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9+fM2dIjOxE0hdJ7o5inMEoSl4k+Dtn8hCQbdOli+o8=; b=xZUEnNInx6auBcjn1QHAv0VRu5ILCx3GjPrWOOCz5f5Wwu/caf0C0OVr9kaA6pdTLd S/m8iGluKxfrqv6DBKzI0SoCfMjlFTD5sYdZWpR+WgDMPJgGHQlcFesNHK3Ly8VGEAIO YC5tmBSDp+lm9Oi3efgbIlk582TsHqrzXvxKDXVCxFyArQO/eN46gH80dQj7fdLm+7w3 o8iYzXuXtcdr4oIfOQ16+P9Ax7Q8T/FETJpTYU7N7SFIIQQPnm3zFeRKLRmt0bqP+J2E ZSNkjbX4hgQmJh0bX2cNSlz1Ru0253mGqxyJEmPFMw7uZui7bi9qN35TI3/hwkepOKYo GFQw== X-Gm-Message-State: AOAM533ISrBC+PjVd42NZWZVyhCeAk+Ktd2OP+VxpKnTfQijyiCDV93S Bgy0UFWosCXsafAnQbZnkYSKfQ== X-Google-Smtp-Source: ABdhPJz99Y3/C+3KVFvMey8niXgv4DZ1MOnb9PXtHq6lkwx+p1WIz0mk7yOyinDod6QymzuJ7iFpmA== X-Received: by 2002:a63:f749:: with SMTP id f9mr444188pgk.77.1633549116877; Wed, 06 Oct 2021 12:38:36 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:36 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 12/34] drm/kirin: Migrate to aggregate driver Date: Wed, 6 Oct 2021 12:37:57 -0700 Message-Id: <20211006193819.2654854-13-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Xinliang Liu Cc: Tian Tao Cc: John Stultz Cc: Xinwei Kong Cc: Chen Feng Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- .../gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index 98ae9a48f3fe..00d47c784cbb 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -217,8 +217,9 @@ static int kirin_drm_kms_cleanup(struct drm_device *dev) return 0; } -static int kirin_drm_bind(struct device *dev) +static int kirin_drm_bind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct kirin_drm_data *driver_data; struct drm_device *drm_dev; int ret; @@ -253,8 +254,9 @@ static int kirin_drm_bind(struct device *dev) return ret; } -static void kirin_drm_unbind(struct device *dev) +static void kirin_drm_unbind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct drm_device *drm_dev = dev_get_drvdata(dev); drm_dev_unregister(drm_dev); @@ -262,9 +264,13 @@ static void kirin_drm_unbind(struct device *dev) drm_dev_put(drm_dev); } -static const struct component_master_ops kirin_drm_ops = { - .bind = kirin_drm_bind, - .unbind = kirin_drm_unbind, +static struct aggregate_driver kirin_drm_aggregate_driver = { + .probe = kirin_drm_bind, + .remove = kirin_drm_unbind, + .driver = { + .name = "kirin_drm", + .owner = THIS_MODULE, + }, }; static int kirin_drm_platform_probe(struct platform_device *pdev) @@ -281,12 +287,12 @@ static int kirin_drm_platform_probe(struct platform_device *pdev) drm_of_component_match_add(dev, &match, compare_of, remote); of_node_put(remote); - return component_master_add_with_match(dev, &kirin_drm_ops, match); + return component_aggregate_register(dev, &kirin_drm_aggregate_driver, match); } static int kirin_drm_platform_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &kirin_drm_ops); + component_aggregate_unregister(&pdev->dev, &kirin_drm_aggregate_driver); return 0; } From patchwork Wed Oct 6 19:37:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540405 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F06BAC433F5 for ; Wed, 6 Oct 2021 19:39:29 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C3728610A2 for ; Wed, 6 Oct 2021 19:39:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C3728610A2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 77BE66EE42; Wed, 6 Oct 2021 19:38:43 +0000 (UTC) Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by gabe.freedesktop.org (Postfix) with ESMTPS id 719126EE35 for ; Wed, 6 Oct 2021 19:38:38 +0000 (UTC) Received: by mail-pj1-x1035.google.com with SMTP id np13so3001387pjb.4 for ; Wed, 06 Oct 2021 12:38:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FPtGNMfzlxXubKgayi75A1lRD5p2YHP9GYCHjNIhA04=; b=lgktmMjjwutaRqVnzLgl1r9ehNyUNBQm8Dwtki+fPhyCyirp9H3SqFGXwnZK1Rv63R iGvuD5m6e12TS9gr/7rv1rjb1lG1mBfPIvDXiAw4LEMMN9nYTmjQ3oJDiZYhoB1oxG/m 6C3EhT3iotku8pAe3fgxQwkBaek4+AODFQi+A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FPtGNMfzlxXubKgayi75A1lRD5p2YHP9GYCHjNIhA04=; b=IFK2fMIAruauYt4mGRTnWi14YwgJXtNka9BcbnJqhfJT6v9x3PKQy3RkTQfZfNBDCJ eBZURav/iHfULYB12+AfdKH6ID9MO450shHUMvltJX5FRfIYJplsARX/d25otLV9ND+E wYawx4+1Zucprn7C2LBKG9j0DBpV4LAAJgAUCNT/pbZMZgnhepKSMhFTaXJG9l9duDxE k36XIl3bGOamSCrIhdjzYmk/BRESfOZurdkHYwKBB362IlevPyKgroeiMO3MtKWgIZRT zIj8eQA0P8DLetCfTmIBrNt3UufjroL0orqKl6Ctw9vVTrfHT7RiHM97+5MbAiJUsmTY joyg== X-Gm-Message-State: AOAM530jD6Z92O6crCXUgusLGgF8yHX4ce/apXimOVEcVd/JFc/IFyyT 9794zqAkqZMFaXUtT2FkexiBzQ== X-Google-Smtp-Source: ABdhPJy9txS+XGL7X7PzCJ9TRN9p+y3nun6AHAKqpLccmPfyhiWV7IBN+l5+r/dgRKaauQfZpOog5w== X-Received: by 2002:a17:90a:1984:: with SMTP id 4mr83734pji.87.1633549118100; Wed, 06 Oct 2021 12:38:38 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:37 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 13/34] drm/exynos: Migrate to aggregate driver Date: Wed, 6 Oct 2021 12:37:58 -0700 Message-Id: <20211006193819.2654854-14-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 d8f1cf4d6b69..dcb52ec2bd35 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -253,8 +253,9 @@ static struct component_match *exynos_drm_match_add(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 = adev->parent; struct exynos_drm_private *private; struct drm_encoder *encoder; struct drm_device *drm; @@ -330,8 +331,9 @@ static int exynos_drm_bind(struct device *dev) return ret; } -static void exynos_drm_unbind(struct device *dev) +static void exynos_drm_unbind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct drm_device *drm = dev_get_drvdata(dev); drm_dev_unregister(drm); @@ -350,9 +352,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) @@ -365,13 +371,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 Wed Oct 6 19:37:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540409 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7034AC433EF for ; Wed, 6 Oct 2021 19:39:34 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3C1AB611C5 for ; Wed, 6 Oct 2021 19:39:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3C1AB611C5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E102D6EE3D; Wed, 6 Oct 2021 19:38:41 +0000 (UTC) Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by gabe.freedesktop.org (Postfix) with ESMTPS id 14B436EE38 for ; Wed, 6 Oct 2021 19:38:39 +0000 (UTC) Received: by mail-pl1-x635.google.com with SMTP id x4so2371652pln.5 for ; Wed, 06 Oct 2021 12:38:39 -0700 (PDT) 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=xbBIA2S7VMXOXCQu3Vr82oQpSXn2i51a0ZJRtaPISIs=; b=aN0RTzaXUPCNk+Z7SmH6pe2SeEIbUotZp5TdFO7V2VWXGU+0KZwohqj38kjI+GFn/K YXnd/NSMifjTnUK1IgGt/GE7okNm9POSZPSVKn2omkO8WH8sRHi8/rZVhF6IQ6Uz/EQ6 KNWrvLKUIPlxYo2xiow1LG1hapUFvaPz6OEZ4= 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=xbBIA2S7VMXOXCQu3Vr82oQpSXn2i51a0ZJRtaPISIs=; b=tVG2CZWG7PW4dgsCAHz2wuGL9H1R7SnRQwI3ve6c/59THlLEy3gX7yVRknUnNeLNrB 9wldSsXAPQSzbt0HgQvb4WTP3SjuoJMFUr54CRFeSaYz++Bo54U7OGA+AfOH3mXOVlKT zqyCYSweNEs/Vy9rU+hJtKYGgw7XmNy/CWxO4HU4SxFhr3OT+BwvUeNWf61VBu88gx43 0qLZIBaKTlA21q1X9bQfkY7T2E0RSwkEhb7A8sROyQbXZ4jv4Q5bD4fvoDse1tD0Wfil BY19yxc9DoB0oERVvq+XnHBKx1DkcMId7/dI5mJCi8f4N1EZlrt7vDuRuTV0Ph19zn5+ nD5Q== X-Gm-Message-State: AOAM533zAL4mR39J70rQiaxOX2IyEhQ4XersUvnlvimPkIn8uAtyAd4T uvBd4tTwnHtHgr70KQxbccKW6g== X-Google-Smtp-Source: ABdhPJw+gb0O8hLaQn2OkipXTFOr/jVxqa6vjQTWqWuW/U/h57JvAGWQEu5RxusKdo9t0nSMvN+smw== X-Received: by 2002:a17:90a:bd18:: with SMTP id y24mr631875pjr.83.1633549119266; Wed, 06 Oct 2021 12:38:39 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:38 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 14/34] drm/imx: Migrate to aggregate driver Date: Wed, 6 Oct 2021 12:37:59 -0700 Message-Id: <20211006193819.2654854-15-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 9558e9e1b431..dbf5cca5201d 100644 --- a/drivers/gpu/drm/imx/imx-drm-core.c +++ b/drivers/gpu/drm/imx/imx-drm-core.c @@ -198,8 +198,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 = adev->parent; struct drm_device *drm; int ret; @@ -266,8 +267,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 = adev->parent; struct drm_device *drm = dev_get_drvdata(dev); drm_dev_unregister(drm); @@ -281,14 +283,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)); @@ -298,7 +304,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 Wed Oct 6 19:38:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540423 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64C28C433EF for ; Wed, 6 Oct 2021 19:39:48 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3B8DC610A2 for ; Wed, 6 Oct 2021 19:39:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3B8DC610A2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 56F886EE46; Wed, 6 Oct 2021 19:38:55 +0000 (UTC) Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by gabe.freedesktop.org (Postfix) with ESMTPS id 59AC26EE47 for ; Wed, 6 Oct 2021 19:38:44 +0000 (UTC) Received: by mail-pl1-x631.google.com with SMTP id y1so2318568plk.10 for ; Wed, 06 Oct 2021 12:38:44 -0700 (PDT) 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=147voWq3MMP+9e/FHlW9BwNDYVhXK+csyUVXCf2NteA=; b=lXMvuiMq8hDBS+eQ9IBiLv4iJuQR01YqW14KeFdv2SXgBytisZYGSvdJDOtKmAOvN6 zHGcrOtWZJy2OF3sYPzw+EE113RKOnEEyhsFPAbJblehfwZ7X9lzddUqnE2biPWpGR3Y JaN+hKpdBTRkKMHUEyzFFh8LnkjEnkRDrdvSU= 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=147voWq3MMP+9e/FHlW9BwNDYVhXK+csyUVXCf2NteA=; b=V+Rmv/KeNngMkRKt1CMzVFcMPSwA5HK+5KGiWENGDvuUG4cH4E0vF7d+6B/2T4siVP PX5M8XI4kwjoFIw7hI2g6VWniaeu9A2kL5+jHpFk199KSqAedNH04VZGtEfhh3eGR0Tw imiJVYm4ZVNUX8VIdcfwoHZo2S6oytm1IYie3LdPX2UP0PIxqpOXIsLkHLhu6vAd0RV0 S4rzqpNOOXoNviPgWYWHP7d29TH7J+3dfWYw5uGFHGm9HUdXL1cUIgnRlLghe+93X9lg t/cVxukOYWWB/i4CPWgZZJFgrkhhB0RwJLbE37Fy2wzZwaoAe5erInH7YrAu6fsQQb0F IoJA== X-Gm-Message-State: AOAM530rQtQYqfbtJpGwJ3tyEQ04a92tfbR9iKNXbzVRdahE6X2Wi7lC +eXDFPidMHpFor0SQGhy8MtQTg== X-Google-Smtp-Source: ABdhPJxU4hwt50HoqlK3Qoo92SCidVgpLN3jBErzx1B92cxFcVEuvHUakr3eWkXCfblXgZvg0cGXVA== X-Received: by 2002:a17:902:9a06:b0:13c:86d8:ce0b with SMTP id v6-20020a1709029a0600b0013c86d8ce0bmr12674304plp.51.1633549120413; Wed, 06 Oct 2021 12:38:40 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:40 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 15/34] drm/ingenic: Migrate to aggregate driver Date: Wed, 6 Oct 2021 12:38:00 -0700 Message-Id: <20211006193819.2654854-16-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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. Cc: Paul Cercueil Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Acked-by: Paul Cercueil --- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 24 +++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c index a5df1c8d34cd..058b7bfe5610 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c @@ -1150,8 +1150,10 @@ static int ingenic_drm_bind(struct device *dev, bool has_components) return ret; } -static int ingenic_drm_bind_with_components(struct device *dev) +static int ingenic_drm_bind_with_components(struct aggregate_device *adev) { + struct device *dev = adev->parent; + return ingenic_drm_bind(dev, true); } @@ -1174,9 +1176,19 @@ 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 = adev->parent; + 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) @@ -1196,7 +1208,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) @@ -1206,7 +1218,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 Wed Oct 6 19:38:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540421 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8324AC433F5 for ; Wed, 6 Oct 2021 19:39:46 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5547461186 for ; Wed, 6 Oct 2021 19:39:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5547461186 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9D49989BFF; Wed, 6 Oct 2021 19:38:53 +0000 (UTC) Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 052186EE40 for ; Wed, 6 Oct 2021 19:38:41 +0000 (UTC) Received: by mail-pj1-x102a.google.com with SMTP id ls18-20020a17090b351200b001a00250584aso4710158pjb.4 for ; Wed, 06 Oct 2021 12:38:41 -0700 (PDT) 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=3+KKYOBNeMz4YDnDUwMm+dvq1TCGf0KiZpH7bEg1t3k=; b=cIlUCzUKbYKvFQHptHb/+1rEiCBTsA7YiOonN/yDYcHmuOxhI9UWnR+OH082NRPZLz hm6RrKXV48rvk1rg8EA+DZA/S+zzACinmylAqQX3bt/3kavhk739DEfoW4Y4chpquL8Z P3I++WJHYPBUAFicaqfanAqoYLuenzmAfhN4s= 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=3+KKYOBNeMz4YDnDUwMm+dvq1TCGf0KiZpH7bEg1t3k=; b=JBdkrJOrtJFHAS5BM48aBPx5kyGUHBLnhtbtQo+DrvGBa0iwU3+ApQvyWg8DMBL+KH QhWrr2RhWjbr4ycxCdA1N2EfFjkS5q+a/Nany0wUd1s2lNMB+8XnAasmdLv2PwhFkZuB 3/r4QyTNwvhl9oUHJnnZnNondyITzJGcHVx18zz33BF/Sl5uwljCOvNrryQ0eOsbKXH/ 7zK9SLOfVd0f+Q3GyaRAHVQqb4Yy1/6M6kPCaA7G0QOQPcqdsw7O/xKyCrp8E1W1OSuX sYa1dvYofyRDlwyoBDTFXC8VrwmOun4h79mi3z7Eskt9G+wlipxROovby+yFi4o0mqs1 6MkA== X-Gm-Message-State: AOAM5316m3yCK76BJTduFAYJKmQCvUlXDQvkiZqNsmx6aZvG6eaUtkft th9lIfBS1cgKzhnibYuRT2HJ+Q== X-Google-Smtp-Source: ABdhPJzLIboz6ak13hw4FyGymL+hdEvIt62t88kiZKW2shC6ECYiY2A2MZCcaBIHk8qK3kT2wspfbw== X-Received: by 2002:a17:902:dacf:b0:13e:ab53:87dc with SMTP id q15-20020a170902dacf00b0013eab5387dcmr12718666plx.78.1633549121440; Wed, 06 Oct 2021 12:38:41 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:41 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 16/34] drm/mcde: Migrate to aggregate driver Date: Wed, 6 Oct 2021 12:38:01 -0700 Message-Id: <20211006193819.2654854-17-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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/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 e60566a5739c..84fcfe77540e 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 = adev->parent; 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 = adev->parent; 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[] = { @@ -421,7 +427,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) { @@ -431,8 +437,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"); /* @@ -461,7 +466,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 Wed Oct 6 19:38:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540419 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A874AC433EF for ; Wed, 6 Oct 2021 19:39:44 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7C611610A2 for ; Wed, 6 Oct 2021 19:39:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7C611610A2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5D98B6EE3E; Wed, 6 Oct 2021 19:38:54 +0000 (UTC) Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by gabe.freedesktop.org (Postfix) with ESMTPS id D80FB6EE45 for ; Wed, 6 Oct 2021 19:38:43 +0000 (UTC) Received: by mail-pf1-x42d.google.com with SMTP id 187so3258390pfc.10 for ; Wed, 06 Oct 2021 12:38:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SfmZAoSN1UYJWac68o+RmufoyphUhdu5prdrSebp+yc=; b=lR3e60kqzXBHZaGkPwb7m2clNOWGIC+QK+xFUXxYnJHt3sM0RyuPMX6wjnWuSaVzz2 NxyBb8wWtv1OQrg57KHoILPMymCoO2tOyOSF30RTTikQtVbLQOMMuPsePdSSpz1rv6mm ausQyEld9rQoWpA0SskVIWd4YxGzAot9mIRts= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SfmZAoSN1UYJWac68o+RmufoyphUhdu5prdrSebp+yc=; b=hp7mYd+2ggnePFV9MoljsCoWyX3rY3vUlYRxXJTvglJf60XmpMPbu21FDaLfNPm60F fRM9taEsoJ/R/BiFwF7Qo0CnDawtmvliAE2Opi+FIV67lLRc//u472J+QqPezYx39TIS WwABo1bfoA2pqf8ozFHLbb70C5wD9V9J3ZdbNBbr0EeYeNtBHd3LDVaYxx2QchrHd4q/ HjGot53ydzNiY3+8m+fRGuT+ixMsFAvE1QKFBrVCme7/VeuksZyBr825e2bbeOxeiobg D61+Iv3lqLflXgeb/6NxHNam0Vg8X8/cFYtLZQ85Fy3w7FBu/0wILv8RKpVLC2NdYdSt OeGQ== X-Gm-Message-State: AOAM5309IP0YFZTzDgKggs4mwYih82dEVikUT7QsqF/ApDHBnAvIlR70 fRPXMWiT2UMjvXPD4feII7juRA== X-Google-Smtp-Source: ABdhPJw44Ec3f+jH8OkFad8w8eFVyZPk1n7UEbJlEfcA8OpFaIoDcOzpq0qUJoSQ0mCc4yj8scnFEg== X-Received: by 2002:aa7:9d0b:0:b0:44c:62a6:8679 with SMTP id k11-20020aa79d0b000000b0044c62a68679mr216264pfp.0.1633549122583; Wed, 06 Oct 2021 12:38:42 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:42 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 17/34] drm/mediatek: Migrate to aggregate driver Date: Wed, 6 Oct 2021 12:38:02 -0700 Message-Id: <20211006193819.2654854-18-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 aec39724ebeb..a3f27b8c9769 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -348,8 +348,9 @@ static int compare_of(struct device *dev, void *data) return dev->of_node == data; } -static int mtk_drm_bind(struct device *dev) +static int mtk_drm_bind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct mtk_drm_private *private = dev_get_drvdata(dev); struct drm_device *drm; int ret; @@ -380,8 +381,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 = adev->parent; struct mtk_drm_private *private = dev_get_drvdata(dev); drm_dev_unregister(private->drm); @@ -391,9 +393,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[] = { @@ -593,7 +599,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; @@ -616,7 +622,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 Wed Oct 6 19:38:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540427 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D94FC433FE for ; Wed, 6 Oct 2021 19:39:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 605E8610A2 for ; Wed, 6 Oct 2021 19:39:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 605E8610A2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8433F6EE45; Wed, 6 Oct 2021 19:39:04 +0000 (UTC) Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by gabe.freedesktop.org (Postfix) with ESMTPS id B63FA6EE49 for ; Wed, 6 Oct 2021 19:38:44 +0000 (UTC) Received: by mail-pg1-x52d.google.com with SMTP id 75so3418685pga.3 for ; Wed, 06 Oct 2021 12:38:44 -0700 (PDT) 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=5Xg9zrUyKFMa3ddbem3zPmmRQ2IkXwWBatRdclbFjwA=; b=kvwXt6r49WGoKov+1kI1YQK6kLMveUPCoAiuryNLL6xUFBMjdpH1ukw3oV2k5sLg6I dHeQY2F+HemCVFPE3sVuz6U0zd+8VMt9aRLOKI0S7NmYBQQMlsfJxyNxP7XJ2wmmDZEW 7MSIJ5B0mlWDqqFeK+H26hmoLDYHLgkSf6Ne8= 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=5Xg9zrUyKFMa3ddbem3zPmmRQ2IkXwWBatRdclbFjwA=; b=X1oWcbTAV9g8t6rOLmxxHaWWBOCb2E9sNKgaC1TeasKvLOs2RpI9CBh/Qh0WgKYi8o 99utVxnBbLqlki8cGt0bmyQJry89kuMY9e6qCzFv9pmIesv3EK8Bj7TUY/ugX16pYbMc T+OQOJZ1+c8Dh5D3jFWaWair4esLqvlPNXga0RVXBv2Qy/xbI4GodWI4OjBZn3HRs/dR vnST9XwaNx0dpUD9ed0TeBcGYBxV6SottBMBbxDMs44DtL21bxK/k6NxdA+Bk6oPCRJJ GcJMnscarDXi5hhv0hPOseJI0eLPVQMRVG4d+2yXutzOXIxPw3Z1l4oA/EBB18/+R5rN EBGA== X-Gm-Message-State: AOAM530a/Xs91/x+76ctZ1r9Gwv0TrCOOAfn0XlrW0sdnS8XGpYyc/pG VECzvpDxYy9DRLKyN9N5uuJ4Kg== X-Google-Smtp-Source: ABdhPJzVkIe0DAPOcORreiyVWMRdY6kKLr2qmge4E5lIHIpmMVTq5jsGVxJU0ygld5tw2RtEtmUK1g== X-Received: by 2002:a05:6a00:216f:b0:44b:6212:4967 with SMTP id r15-20020a056a00216f00b0044b62124967mr39153114pff.23.1633549123847; Wed, 06 Oct 2021 12:38:43 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:43 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 18/34] drm/meson: Migrate to aggregate driver Date: Wed, 6 Oct 2021 12:38:03 -0700 Message-Id: <20211006193819.2654854-19-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 bc0d60df04ae..109fb9d057e3 100644 --- a/drivers/gpu/drm/meson/meson_drv.c +++ b/drivers/gpu/drm/meson/meson_drv.c @@ -357,13 +357,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 = adev->parent; + 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 = adev->parent; struct meson_drm *priv = dev_get_drvdata(dev); struct drm_device *drm = priv->drm; @@ -387,9 +390,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) @@ -503,9 +510,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 Wed Oct 6 19:38:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540411 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D37D6C433F5 for ; Wed, 6 Oct 2021 19:39:36 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A529F611C5 for ; Wed, 6 Oct 2021 19:39:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A529F611C5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BEABB89B57; Wed, 6 Oct 2021 19:38:52 +0000 (UTC) Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8F6346EE44 for ; Wed, 6 Oct 2021 19:38:45 +0000 (UTC) Received: by mail-pf1-x42a.google.com with SMTP id g2so3286126pfc.6 for ; Wed, 06 Oct 2021 12:38:45 -0700 (PDT) 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=+z8spq4cdcPKhNDSMMsr6lVILQ9GCMpzmsR3lgzTaCA=; b=iGHSnRwwchpi5Tkq7doMTNvFa9r3VADcN321p5gth6rsSAkCxChv1/TpcoexdUqwTf bjTWhC9Go7emQT2Jp1DsbdOh4ilw3joEHD55nLlHU0YDLAtXqWTaVbyk8yGr1ilxMqKg f+EqQleH2dzNCB2xM7okVOrBTmrtYa8J1rIyY= 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=+z8spq4cdcPKhNDSMMsr6lVILQ9GCMpzmsR3lgzTaCA=; b=Y2zB8hOT5/mYxyaMwKVm0+T5BlaLoP8T40thKxBO8gzc07xZPMO0leQWhwFlAk0niD rK3s+W6ONqbX1mFaKEAp+yBTHWY8D4NDmGtVwvLSYxV1Tj8NTv160WdSMGYg4wermxLj EwhxeFkDlpZAQY3U9LvAj1XvDSqxnYdrkvSNHrT21CqEl11Y25MV47QqXYah0xjTq4g8 LGRN/rHko+rsYtdPuQQ4EZC9GhKUG0fFd7KM6STH4hLXFeVT5itfNbSFxvCD8wQHX0rd O/iaTPRDbW5aciJGhP3RlO8YwbtzZ8x6XYBYZh3HWO3kATI7IFxsEsi1wEtv/+Juvgin QdMw== X-Gm-Message-State: AOAM533XCqI2dRYNyNTjfPXni2/ihJ89YwksjmZ0R17TbjwG0WUhWQpF Tq6AmvTH5M6boEb3byyQdCYnkg== X-Google-Smtp-Source: ABdhPJwH4Ga5pH+EsfLgxRiyAhkWjDCH0zIE3TZRHi6CR2+XxdoanVbnAks241ztngYgIj/notfKcQ== X-Received: by 2002:aa7:8c12:0:b0:44c:5e3e:3733 with SMTP id c18-20020aa78c12000000b0044c5e3e3733mr19528656pfd.55.1633549124937; Wed, 06 Oct 2021 12:38:44 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:44 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 19/34] drm/omap: Migrate to aggregate driver Date: Wed, 6 Oct 2021 12:38:04 -0700 Message-Id: <20211006193819.2654854-20-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c index d6a5862b4dbf..6a6ae2786d7a 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 = adev->parent; struct dss_device *dss = dev_get_drvdata(dev); struct platform_device *drm_pdev; struct dss_pdata pdata; @@ -1339,9 +1340,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) @@ -1504,7 +1509,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; @@ -1543,7 +1548,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 Wed Oct 6 19:38:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540415 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FA18C433F5 for ; Wed, 6 Oct 2021 19:39:41 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0A428610A2 for ; Wed, 6 Oct 2021 19:39:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0A428610A2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 96FB989A6D; Wed, 6 Oct 2021 19:38:52 +0000 (UTC) Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by gabe.freedesktop.org (Postfix) with ESMTPS id A87C06EE4D for ; Wed, 6 Oct 2021 19:38:46 +0000 (UTC) Received: by mail-pf1-x434.google.com with SMTP id p1so3269845pfh.8 for ; Wed, 06 Oct 2021 12:38:46 -0700 (PDT) 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=pu3Ettw2+f3cI24EEPlu+iHiL6Bl5h06ZQoWL3Cz2Tw=; b=AoJOg0gAf+6zGwvuJJeeIopwS/luJM74WeAdJcNoi4aR3fyjHLgI+7l4/3l4kIibtM ILgyOcQB0cXJGhXPmE5p5jSxrGNBoqnbwmkydJPJRwMuNIL3ITrGrsU+3YgYgQV6aLj+ FqH2V+UVNaS3JmHv5SqQ8Qgtw2hHq1nZQSDB8= 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=pu3Ettw2+f3cI24EEPlu+iHiL6Bl5h06ZQoWL3Cz2Tw=; b=Ypg8wwdYI0lPaH4108DFVeIG8kR2r6vhhDwzpqgYy11bpSBaPJgW6GCOQWItex4qIp 7IJCf9jREx+L+jdn0XjPC4VG0GDqXkdphpByCGcduKLBGE8BRLMkc8nKiAIbaMucYe30 2pHlQixwjmClHzx5KalgsYMno3wlt4HkXYDzzQ+el5oT42uSIu1mAW54o7whpiamYgYk MDCMg3BYdLKGTWSC46cIkLJflCyRKEK9a8dbkfutR+HNa8JIa4hH0vj+YUAweSCwaJcs X36uj141F3eTsTXgaa/ygYY1fQR209iHHdixe0AqjLfhhKI2sE/22AftKF82O3MHQSkv qzUw== X-Gm-Message-State: AOAM531zahbR8u5HJSXBC57yKsCp3P9+nxtKAM/J/7ZqD/HCiU7ttJKM wPzDrVgIlisWmQtyxk71GAB6KQ== X-Google-Smtp-Source: ABdhPJyI8RrLozWLxX6QPY3zy5oLd/u5hIdHdrRvetAHEi7WRN1RPUvNEvFIk6AytWoJe1c0d9j2Uw== X-Received: by 2002:a62:4e87:0:b0:447:ce02:c32e with SMTP id c129-20020a624e87000000b00447ce02c32emr38015805pfb.33.1633549126124; Wed, 06 Oct 2021 12:38:46 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:45 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 20/34] drm/rockchip: Migrate to aggregate driver Date: Wed, 6 Oct 2021 12:38:05 -0700 Message-Id: <20211006193819.2654854-21-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 bfba9793d238..cc63222c3ad0 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -109,8 +109,9 @@ static void rockchip_iommu_cleanup(struct drm_device *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 = adev->parent; struct drm_device *drm_dev; struct rockchip_drm_private *private; int ret; @@ -186,8 +187,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 = adev->parent; struct drm_device *drm_dev = dev_get_drvdata(dev); drm_dev_unregister(drm_dev); @@ -342,9 +344,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) @@ -415,7 +421,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; @@ -426,7 +432,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 Wed Oct 6 19:38:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540417 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE829C433EF for ; Wed, 6 Oct 2021 19:39:42 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9CA06610A2 for ; Wed, 6 Oct 2021 19:39:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9CA06610A2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BA9436EE1C; Wed, 6 Oct 2021 19:38:53 +0000 (UTC) Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by gabe.freedesktop.org (Postfix) with ESMTPS id 902A06EE45 for ; Wed, 6 Oct 2021 19:38:47 +0000 (UTC) Received: by mail-pf1-x432.google.com with SMTP id 145so3258001pfz.11 for ; Wed, 06 Oct 2021 12:38:47 -0700 (PDT) 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=JIr2Bk0QBgCC/Qyy7+5Gbgr8NQwlH0hHiIdNIEPo3fk=; b=bW+COjRtbI/s22IeVkOw6yQ870sBScBOBF2HCZngTnHoZtYsMfJOE0ofz7QpGYUlk3 /Vl4JW5K0GR+OgSiaMKU5lJV6dRt4U31wvz3SUiHBWgysFRhZ3ohDMdS5R/FK46EaSrt S4SHBAHlZ/K2wI81ii8OutsoM1QQJfn2XGo/k= 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=JIr2Bk0QBgCC/Qyy7+5Gbgr8NQwlH0hHiIdNIEPo3fk=; b=TNDWL2RvDBkk4O5IMK5rVBE9lU5/qaqXQFjBPqReCyZsaT2alJbI2Bhbj+tLIXZSh0 vBxfOpqzVvec8YCLi/EcrWyRPd8sJf5/nhvBV26eJJV92sZveG4F/panFSN+XYm+6WKd dbNPp3Jn2t3EeBRORAJXncWFCKEI37b6/J1CP0dnJ2pyF04Q9mm/XHTCK39R/tHs4V+S 8afZhRx1exV/J2rOGVUTxf991j6pgJoD/eKEmHk5nD02d7n879tJeiwGWrB3RVRBg6Q+ /Q63irAJPg9pNd3AjDKUhtdVekIbSiaTA5kdmAx7ZI5HOLs0VuNYXm1bK5nYJhE7rGH+ pzIg== X-Gm-Message-State: AOAM5301+ihO/whHgcD/bPo9EW33bobqPxQHYyfgq2rBearjwLNq4HDe h4j1gB4TNC9a0ypgr3A4gLZhjcNZPW7rzg== X-Google-Smtp-Source: ABdhPJxQwqQ7SCmgtuHD6Kn2a24WTCagZcGpwIwgH0tFHMKyN3or9U6DNvjkc8eAzPbVbEHcBDoHvg== X-Received: by 2002:a63:d709:: with SMTP id d9mr421671pgg.377.1633549127254; Wed, 06 Oct 2021 12:38:47 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:46 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Benjamin Gaignard , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v2 21/34] drm/sti: Migrate to aggregate driver Date: Wed, 6 Oct 2021 12:38:06 -0700 Message-Id: <20211006193819.2654854-22-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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: Benjamin Gaignard 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..b277cc679154 100644 --- a/drivers/gpu/drm/sti/sti_drv.c +++ b/drivers/gpu/drm/sti/sti_drv.c @@ -182,8 +182,9 @@ static void sti_cleanup(struct drm_device *ddev) ddev->dev_private = NULL; } -static int sti_bind(struct device *dev) +static int sti_bind(struct aggregate_device *adev) { + struct device *dev = adev->parent; 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 = adev->parent; 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 Wed Oct 6 19:38:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540413 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDE9AC433F5 for ; Wed, 6 Oct 2021 19:39:38 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9960B610A2 for ; Wed, 6 Oct 2021 19:39:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9960B610A2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BE3DF89B3B; Wed, 6 Oct 2021 19:38:52 +0000 (UTC) Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by gabe.freedesktop.org (Postfix) with ESMTPS id E310A6EE44 for ; Wed, 6 Oct 2021 19:38:48 +0000 (UTC) Received: by mail-pg1-x532.google.com with SMTP id r201so3415060pgr.4 for ; Wed, 06 Oct 2021 12:38:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qrvKBJr+DUbrISc8WyZICnsdtffozhNCQiB3CMiYO5U=; b=QipD2WXeOyP+ruAnj6v88e8FykRbkwM5WCxPonygshkT2jmhHySnK34nWLCtH9N03o QA7VpRww1sA/jSk3TTHmUqrlRmEBIhzy/1KaaJ4Jw/0ZuwJHe397ooPbS4n5W7ApziJv RSNKF6pStQUO1T5p7O0LhHZh9q4VousGbbEQo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qrvKBJr+DUbrISc8WyZICnsdtffozhNCQiB3CMiYO5U=; b=bHQHOuPLmdWpNEEbpBgeWLWdyDD2WPy8F4vraaKcI5RTJI1yJVsYp7xhZNAYKotNgV NGYsWYKvYotnx/PpD+WfnO9Cu09X2ugOamxz340h59Eso0+C2AETqBgb2iOBDPb5pGYT h/o4iZxdJ9pA81Ol1smi6iNlWmYBHSOHPA9TcSPH2p0uTR985vBYMvtkVPI6MJ/FIeDV J0EM+TiT1BXbtvNgB/zsp3XZt/KZpDZ9px7O3RdCTWgzObbG+xudMBSi2M4dqiiHXbKF B7ySMNan2DFG4Yo645fJUMTGBEL+LTwUn8TMeoauw91MeiD5YSn29qHVaVLJ5q5TCV1y SHgQ== X-Gm-Message-State: AOAM532VK0M3TqcVr78SkD3cNetD7EtXKLtLN/9awRrhHdqozgpDS79m wYghegUc2O00i395PbcLvbwpr++tHQb1QA== X-Google-Smtp-Source: ABdhPJyuR+Vn2dNgoA0wdE/IZinkKqQ7enfmMPUJrzDejWlONcldLMNDplrRUfU3GnHbLNDWtxz07w== X-Received: by 2002:a62:6544:0:b0:44b:508b:d05c with SMTP id z65-20020a626544000000b0044b508bd05cmr194058pfb.56.1633549128375; Wed, 06 Oct 2021 12:38:48 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:48 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 22/34] drm/sun4i: Migrate to aggregate driver Date: Wed, 6 Oct 2021 12:38:07 -0700 Message-Id: <20211006193819.2654854-23-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 54dd562e294c..700f5e32eaf7 100644 --- a/drivers/gpu/drm/sun4i/sun4i_drv.c +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c @@ -56,8 +56,9 @@ static const struct drm_driver sun4i_drv_driver = { DRM_GEM_CMA_DRIVER_OPS_VMAP_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 = adev->parent; struct drm_device *drm; struct sun4i_drv *drv; int ret; @@ -125,8 +126,9 @@ static int sun4i_drv_bind(struct device *dev) return ret; } -static void sun4i_drv_unbind(struct device *dev) +static void sun4i_drv_unbind(struct aggregate_device *adev) { + struct device *dev = adev->parent; 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 Wed Oct 6 19:38:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540435 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11DB8C433F5 for ; Wed, 6 Oct 2021 19:40:00 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DA5B7611CC for ; Wed, 6 Oct 2021 19:39:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DA5B7611CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7600F6EE60; Wed, 6 Oct 2021 19:39:05 +0000 (UTC) Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 64D636EE20 for ; Wed, 6 Oct 2021 19:38:50 +0000 (UTC) Received: by mail-pj1-x102a.google.com with SMTP id pi19-20020a17090b1e5300b0019fdd3557d3so3207110pjb.5 for ; Wed, 06 Oct 2021 12:38:50 -0700 (PDT) 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=0NtNoitnZpRD+QXZE528qbbYjh9dmwDBO87rVNizGkg=; b=lopftWS70zdKuh7eeLaM7Ve1KWbPHsEyyolQXf7MWc5FOVSlznqwTsSzD7OJ0RgXQ6 RCDiOXnur86GhCaal/CxIOrzPvylAQhU9BcgvcHpvi48B7eWhyUhesbrzLVrlLCVKtm1 A7lIEExIiNzugRKMo5es0/MFBPiuB1u4yBzYQ= 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=0NtNoitnZpRD+QXZE528qbbYjh9dmwDBO87rVNizGkg=; b=0bpBbuKWhzxRw0RNoXF5BTpn4RXcO7yM/TLz6MUQiAtcVEFUEGdBwWlyDctlaOevLC qp/ltXx0GUtGeOB/cLDxJL6qKGxbJ0M4UoGk++0iapN64Gy+9P2fFBN7b+JpZtaw2Jc2 rGuLHwYWuhXojJAT2FOuWEMLzBSJaCGGRqk/1UKSaKbwizl/bbnyGJLllxWuW+3yVswO k7xQEKYDV0WOaZFK1SJG43hdsa2+jrPk1gira52yXwhJ+n2MQ/lnGc/gbm/ZDXYcDpjC 4GRINaVvJxROdYzU/7DRu5Pyiu9sEmLxsW5HDZmo/h2in8l3+ZtFjNchP9HPK/RQzKqk Afow== X-Gm-Message-State: AOAM533Wdor7JC8xBdrN1bU4BSgHxO9GPt8DDdZRJdQFhMWw7bytNkVR 8miRw8R+B8zZwccxn13DEp8vcQ== X-Google-Smtp-Source: ABdhPJwEmaRHU6SbK+81x0j/hXA94wAn6cv1WzZrG1OkVCyHwLhXfe2v03n4MfSK1ciPKL1V3aJ2XA== X-Received: by 2002:a17:90a:19d2:: with SMTP id 18mr61162pjj.217.1633549130049; Wed, 06 Oct 2021 12:38:50 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:49 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 23/34] drm/tilcdc: Migrate to aggregate driver Date: Wed, 6 Oct 2021 12:38:08 -0700 Message-Id: <20211006193819.2654854-24-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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: 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 6b03f89a98d4..d5c6567eec8d 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c @@ -531,13 +531,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 = adev->parent; + return tilcdc_init(&tilcdc_driver, dev); } -static void tilcdc_unbind(struct device *dev) +static void tilcdc_unbind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct drm_device *ddev = dev_get_drvdata(dev); /* Check if a subcomponent has already triggered the unloading. */ @@ -547,9 +550,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) @@ -566,12 +573,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) @@ -581,10 +585,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 Wed Oct 6 19:38:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540433 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15CADC433FE for ; Wed, 6 Oct 2021 19:39:58 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DE26E611CC for ; Wed, 6 Oct 2021 19:39:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DE26E611CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0EEFD6EE5F; Wed, 6 Oct 2021 19:39:04 +0000 (UTC) Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8C4F689241 for ; Wed, 6 Oct 2021 19:38:51 +0000 (UTC) Received: by mail-pf1-x436.google.com with SMTP id c29so3301119pfp.2 for ; Wed, 06 Oct 2021 12:38:51 -0700 (PDT) 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=8fBlAXi6sFYrXtAp7S0GQqlwZRRttRb1KFYpoiMF4WI=; b=YLxBqw/K6GYJqDVDGjOe0xLgAuNDXTn+4l+6boKAKuzVsS10fSytwCFxB1h+WlXK6t kcvtodC48R6aV8p1X0Y8QU17fBJgjecKFDgN0GKG/9GIf9wgIMaE7FGmZnfw4BHHt3Wn tJkv2hhGdpwFSXMlSXBGkUUP1RP5mXSET0SWo= 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=8fBlAXi6sFYrXtAp7S0GQqlwZRRttRb1KFYpoiMF4WI=; b=IWQ+8JzBosXJ8XGPnw6QGhSxv3OT4bIh058pVI+CXMjZFaJckR4OHqWcVpy1t77VI1 VQEFPy5B4uUPlHpsYWFU37ctXAWDbOJYsQcLcqOgJgwUir3M0vua60tpU++U9Kw2ykQj /DvlIaC/jzjEG1URlFwnF5CEuWOBOb5z3tIrCcYuJlmCE3+N45KzdMsjdhwj6Ax/xo85 mAj7fFs5pdtH+yXkIfzv8wPlJlBdCU25KW1QvJOHd8svl4J4vjnQImPumdxemMmf5xzo 7cticXiAKhGdV+Jc77jgZFJjGjCfDVWq5JLpJV9m3oSnSl98gR/Zsvj6Fjuj2wDNlzCi vQRg== X-Gm-Message-State: AOAM530N76UhbPLLkRi9TD/aHFmdrWQ2eAj2lOWNOCalCc12MTECFbfa 8iXqsVXx11IOZ/jNxozZL1tjdw== X-Google-Smtp-Source: ABdhPJzAkTtDc2TvdMKSzgurwunQ3xHuNLswxVRqr4heTJ45qdgTz9sSL9xUIdpA4rdD3cWD29xe8Q== X-Received: by 2002:a05:6a00:138a:b0:44c:b200:38d7 with SMTP id t10-20020a056a00138a00b0044cb20038d7mr180948pfg.5.1633549131211; Wed, 06 Oct 2021 12:38:51 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:50 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 24/34] drm/vc4: Migrate to aggregate driver Date: Wed, 6 Oct 2021 12:38:09 -0700 Message-Id: <20211006193819.2654854-25-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 f6c16c5aee68..bccbde7a2f59 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c @@ -214,8 +214,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 = adev->parent; struct platform_device *pdev = to_platform_device(dev); struct drm_device *drm; struct vc4_dev *vc4; @@ -286,8 +287,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 = adev->parent; struct drm_device *drm = dev_get_drvdata(dev); drm_dev_unregister(drm); @@ -295,9 +297,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, + }, }; /* @@ -328,12 +334,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 Wed Oct 6 19:38:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540443 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7E47C433EF for ; Wed, 6 Oct 2021 19:40:11 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9626561163 for ; Wed, 6 Oct 2021 19:40:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9626561163 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0F6516EE57; Wed, 6 Oct 2021 19:39:12 +0000 (UTC) Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1D94C89D9B for ; Wed, 6 Oct 2021 19:38:53 +0000 (UTC) Received: by mail-pj1-x1030.google.com with SMTP id ls14-20020a17090b350e00b001a00e2251c8so3209365pjb.4 for ; Wed, 06 Oct 2021 12:38:53 -0700 (PDT) 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=f0lZGXHwPviChh1qGaLbcibaQ5KdksPeQeI4kBQa+kk=; b=TWus5/+6G/7YPt/GYoLcEu98qL5WELx1WPPHt5rZgDYPi4TbXobioa/gZGAS2oFH2d CggOtJzqHj0w6B0PZ7xsOVu8wltF24F6za7fdU5ieL6CQKheeChKFXLcIWyeHcY9g1IZ F9kMdlqVsqS+TSe+pEn2ZiG+iUNaQ5zApt9tA= 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=f0lZGXHwPviChh1qGaLbcibaQ5KdksPeQeI4kBQa+kk=; b=Wiu7BbNRdFyrEkfU5e45Tt6+m4g2sTbeXfzSE1gs/mk1gn3uW+r2ctch4gUFdANUJP +IbHg9qiCm7QEbM4bIe8AC6yMZGaEgWY49QqK4AXW3CXAH9JdCXfKx/N9Ih116AEIs0H sR1GYrS2u8e7HFi+SmElTFwIghHyXAKi8xuvvtXtSPjlI/gf38rHLo6pvyDDlgqyRLh7 EPqLyw5OKiqtjqEMqRTDVMh3DPQUsZyQdmV2vWBRJuliWXiOPadc03Jp/QjSvpz5UCrn S+EmVgxuwAFZnW4kdv6slUa1vNJig1mF9+B8Dpiz39fQQY8qSqJKcp6rA3DS7yMIxvhk I/Jg== X-Gm-Message-State: AOAM5330hKvoKdj4PKx9WVM3h+dP8Q4HDiu3sx1yQxv4owFw0QCELGg7 ZHfNWpOOjCF7zJO4HPZATI1J/w== X-Google-Smtp-Source: ABdhPJw37huVc8Sl+jtSnZOt9wzTLpKJ426qHi4wEQ0jLRRR2Whgp9Qug67BtUn2e1soscFp4V2jhA== X-Received: by 2002:a17:90b:2503:: with SMTP id ns3mr643045pjb.206.1633549132258; Wed, 06 Oct 2021 12:38:52 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:52 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 25/34] drm/zte: Migrate to aggregate driver Date: Wed, 6 Oct 2021 12:38:10 -0700 Message-Id: <20211006193819.2654854-26-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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/zte/zx_drm_drv.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/zte/zx_drm_drv.c b/drivers/gpu/drm/zte/zx_drm_drv.c index 064056503ebb..b46f677ea51d 100644 --- a/drivers/gpu/drm/zte/zx_drm_drv.c +++ b/drivers/gpu/drm/zte/zx_drm_drv.c @@ -45,8 +45,9 @@ static const struct drm_driver zx_drm_driver = { .minor = 0, }; -static int zx_drm_bind(struct device *dev) +static int zx_drm_bind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct drm_device *drm; int ret; @@ -97,8 +98,9 @@ static int zx_drm_bind(struct device *dev) return ret; } -static void zx_drm_unbind(struct device *dev) +static void zx_drm_unbind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct drm_device *drm = dev_get_drvdata(dev); drm_dev_unregister(drm); @@ -110,9 +112,13 @@ static void zx_drm_unbind(struct device *dev) drm_dev_put(drm); } -static const struct component_master_ops zx_drm_master_ops = { - .bind = zx_drm_bind, - .unbind = zx_drm_unbind, +static struct aggregate_driver zx_aggregate_driver = { + .probe = zx_drm_bind, + .remove = zx_drm_unbind, + .driver = { + .name = "zx_drm", + .owner = THIS_MODULE, + }, }; static int compare_of(struct device *dev, void *data) @@ -135,12 +141,12 @@ static int zx_drm_probe(struct platform_device *pdev) for_each_available_child_of_node(parent, child) component_match_add(dev, &match, compare_of, child); - return component_master_add_with_match(dev, &zx_drm_master_ops, match); + return component_aggregate_register(dev, &zx_aggregate_driver, match); } static int zx_drm_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &zx_drm_master_ops); + component_aggregate_unregister(&pdev->dev, &zx_aggregate_driver); return 0; } From patchwork Wed Oct 6 19:38:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540431 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4036EC433F5 for ; Wed, 6 Oct 2021 19:39:56 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1146A611C6 for ; Wed, 6 Oct 2021 19:39:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1146A611C6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D35C36EE40; Wed, 6 Oct 2021 19:39:06 +0000 (UTC) Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by gabe.freedesktop.org (Postfix) with ESMTPS id F40296EE20 for ; Wed, 6 Oct 2021 19:38:53 +0000 (UTC) Received: by mail-pf1-x429.google.com with SMTP id q19so2799756pfl.4 for ; Wed, 06 Oct 2021 12:38:53 -0700 (PDT) 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=HoQjuHREWvjsK8rKG+0w83Xi8iEfhBhp3a3+GSxKR9Y=; b=WVsXT9YPaOq6lbwor7C76akvY+2k/VH9yJnA2hvETtzvwXFjJa3PrLl0B5Ce5dPfXC je7l6/8GgIsVihohh2eSAciaEEEpOrrNQUbmt/RkQLQLT/i1+WOw7BoAAVAqo0kTTExd t6hnsTdsmOSgmHtdWXFcrJS/dfE2+Mb3FIkbU= 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=HoQjuHREWvjsK8rKG+0w83Xi8iEfhBhp3a3+GSxKR9Y=; b=JO+8YoFjY6d4gafmlauGVr0us2nQ6nCjU9uGeAMTG0ofEKoK0qWSboTxoaEm/BvELn LOInnPU7XxJowney0czooj6hXuS7SEDlUQKDJpR5mAD+jNfbXqLriC84GbOdb1sQmXQQ yuFPo22frYW2r2pvkw0N3X44ZTR++0NZA/AtGBIcbQSgFDBDFjbHLOZeaGppn9qx1lle 8ktlVrPymt+BjZjTLcYGJnqwFjEEDE6oREswqazSzT/YZnjmHWpcEzm5yR8YT2OwQYkG Mtjf1vy6xLaCHj8BqRMijTSNCrNly9Hpe6jpw3GFg4oQzoAr2WDcFEhjbM6tOb47Pqpv v4sA== X-Gm-Message-State: AOAM531mSyqSTZY1RP0q4x8ZfRLxlYizeVmlQm3mMS44t8PIK+tq3aGO dJqfoFcVCt+x70b44yJtS71qTg== X-Google-Smtp-Source: ABdhPJycvCyAm7YdfmtOg2mjiTXHN2Zij2prLgvspms7d33gQ9VOWrXUCMxUvC21GUMCDyr+OsPRpw== X-Received: by 2002:aa7:9250:0:b0:44c:27d1:7f0f with SMTP id 16-20020aa79250000000b0044c27d17f0fmr166036pfp.41.1633549133593; Wed, 06 Oct 2021 12:38:53 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:53 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 26/34] iommu/mtk: Migrate to aggregate driver Date: Wed, 6 Oct 2021 12:38:11 -0700 Message-Id: <20211006193819.2654854-27-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- drivers/iommu/mtk_iommu.c | 14 +++++++++----- drivers/iommu/mtk_iommu.h | 6 ++++-- drivers/iommu/mtk_iommu_v1.c | 14 +++++++++----- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index d837adfd1da5..8b303c388a9b 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -750,9 +750,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) @@ -893,7 +897,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; @@ -926,7 +930,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..064fd4f4eade 100644 --- a/drivers/iommu/mtk_iommu.h +++ b/drivers/iommu/mtk_iommu.h @@ -94,15 +94,17 @@ static inline void release_of(struct device *dev, void *data) of_node_put(data); } -static inline int mtk_iommu_bind(struct device *dev) +static inline int mtk_iommu_bind(struct aggregate_device *adev) { + struct device *dev = adev->parent; 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 = adev->parent; 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; } From patchwork Wed Oct 6 19:38:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540425 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB8FDC433F5 for ; Wed, 6 Oct 2021 19:39:50 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8A18D61186 for ; Wed, 6 Oct 2021 19:39:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8A18D61186 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 052F46EE54; Wed, 6 Oct 2021 19:39:05 +0000 (UTC) Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by gabe.freedesktop.org (Postfix) with ESMTPS id 59B626EE48 for ; Wed, 6 Oct 2021 19:38:55 +0000 (UTC) Received: by mail-pg1-x52d.google.com with SMTP id r201so3415334pgr.4 for ; Wed, 06 Oct 2021 12:38:55 -0700 (PDT) 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=uzJHB9t+Bicwdag3X6iL63lm7ZGof5i0wMOcRCsHtBw=; b=LjCBQ+OlDWXcZsNZnBQtgm7AMig+37EhFW/9+yCcAfo48unx4nzdWSchzmgePmUhjA XyCY7hFDWvvn/+KhoHPX2V7JR+YVar3L1AffYvxYFJsLh905j5B2OD38wqtDboraJ85U 3QKnCZtLlfUM6fZHBa+mf8XZ+uBlsfEQEyFQY= 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=uzJHB9t+Bicwdag3X6iL63lm7ZGof5i0wMOcRCsHtBw=; b=YzPzdWPjsP7dpKE9UHL78jH3neR6WgWQkQFtHPX3rFG/UwyCdFC1ffomrXr/vI7siI mio9fZdd9/SHJzryRldjNmY0DXY5BpRqY7XIhb6cMKX/iClkNuUuyKRR+5j8IErUvkEO hGIVnuNAiYkAJaV+nYGipcZw7pHpaPueTlm+WhTogZXfsg56uB/k66MFU/An9TLJ7MVK cxxRxgT8JXJg2Pnr55UXaFCehLRCKb0LKK0Kjc5OZfx4xXJwxTEqKb0nGka0XDYq3iV8 7mCy7Qb2nXK/fg2AAqDZATK3EogJxGP384AaowCLBeaTlfiHx/zPH9pwA4iY2Qb2kfwI AD0A== X-Gm-Message-State: AOAM532kf84A24703cpm16uPRL0YDP0cG/YAyoTFVcQrFQgzjpYFpuUH nFJCqjYOpedmJpoBEe4RSv0OSw== X-Google-Smtp-Source: ABdhPJyH/as0xMCs+5MiZJ/L86BaynP3B044XAxgMkggLOL+q+e8ZFGlst8xK+9CCrIfuhGqIgEPxQ== X-Received: by 2002:a62:403:0:b0:433:9582:d449 with SMTP id 3-20020a620403000000b004339582d449mr178657pfe.15.1633549134744; Wed, 06 Oct 2021 12:38:54 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:54 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Tomas Winkler , Arnd Bergmann , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v2 27/34] mei: Migrate to aggregate driver Date: Wed, 6 Oct 2021 12:38:12 -0700 Message-Id: <20211006193819.2654854-28-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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: Arnd Bergmann Cc: Greg Kroah-Hartman Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/misc/mei/hdcp/mei_hdcp.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c index ec2a4fce8581..79dcc02277d2 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_component_master_bind(struct aggregate_device *adev) { + struct device *dev = adev->parent; 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_component_master_unbind(struct aggregate_device *adev) { + struct device *dev = adev->parent; 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_component_master_bind, + .remove = mei_component_master_unbind, + .driver = { + .name = "mei_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); From patchwork Wed Oct 6 19:38:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540445 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96E1DC433F5 for ; Wed, 6 Oct 2021 19:40:13 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 68AF9611C1 for ; Wed, 6 Oct 2021 19:40:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 68AF9611C1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EBDE36EE66; Wed, 6 Oct 2021 19:39:13 +0000 (UTC) Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by gabe.freedesktop.org (Postfix) with ESMTPS id 46F9F6EE20 for ; Wed, 6 Oct 2021 19:38:56 +0000 (UTC) Received: by mail-pg1-x529.google.com with SMTP id r2so3382735pgl.10 for ; Wed, 06 Oct 2021 12:38:56 -0700 (PDT) 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=r4ZlYPrmM5Tkk7hEVqwG73Jg1s6yPoPLqqklEbvZsNs=; b=iXHyWXwf/CQ5p/MtluAWBR3tIx3vtEMCYA9JvztHzfCgcdYhJD+jfKkaOxbbnqi2Yf VHxkPyGwhvl7HE48jfOvTdnMZEX98UFxUnp8X1B2Tfh/9MuvzxAAy7A612yarm75GA1B Ha+8XxSgEhEircqpplGKcbpiXwKIKaS/PIEoM= 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=r4ZlYPrmM5Tkk7hEVqwG73Jg1s6yPoPLqqklEbvZsNs=; b=w15W6jlynZO99twY78EmKNgI8/KDHbC2Lug5venBI4J9NgBSJVdH0yaPcuyWbc8o0C DnRyDqZ9WF/17DwqIGIo9f51mT3KWeit6gq1lAr3iGp4yj4nblFOVn9Tr7adXQhF8GEZ ghaPbO171kTCOlARhspvEdka8gGXmaQOfQ1ItTcHe1Le8FfmGRRHbIPcnTVlBzUlELHD aGrqs2gESNiZD4SgFsiD6HZb1hEU18pGATXMbjMRR/u9yfL/xjq6z0LgEHCMJ15YdmQu NLOr/ZdamZOSnHBVxVQrL+Vx4a11iufqzTfncdabjhjYXtXoFRBH4qb28FBpuCU8cXDY bLMQ== X-Gm-Message-State: AOAM530q0FojJh0BKq6ebCCL+R6goUP0P48VgjuFgAFu2iAKTkLLUTUx zlluwfAAWbIvapLH/ketL8/V9A== X-Google-Smtp-Source: ABdhPJyBnIIUOasVuz0HHwa5HSKuINPSNBBmrSfqVEIzUYx1TcpPNSjWFeK13ykM3k0PwSWN5fB2Sg== X-Received: by 2002:aa7:8246:0:b0:44b:4870:1b09 with SMTP id e6-20020aa78246000000b0044b48701b09mr38855725pfn.82.1633549135884; Wed, 06 Oct 2021 12:38:55 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:55 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Sebastian Reichel , linux-pm@vger.kernel.org, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v2 28/34] power: supply: ab8500: Migrate to aggregate driver Date: Wed, 6 Oct 2021 12:38:13 -0700 Message-Id: <20211006193819.2654854-29-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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: Sebastian Reichel Cc: Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Acked-by: Sebastian Reichel --- 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 15eadaf46f14..52d4105e28f2 100644 --- a/drivers/power/supply/ab8500_charger.c +++ b/drivers/power/supply/ab8500_charger.c @@ -3312,8 +3312,9 @@ static const struct power_supply_desc ab8500_usb_chg_desc = { .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 = adev->parent; struct ab8500_charger *di = dev_get_drvdata(dev); int ch_stat; int ret; @@ -3354,8 +3355,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 = adev->parent; struct ab8500_charger *di = dev_get_drvdata(dev); int ret; @@ -3380,9 +3382,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[] = { @@ -3663,9 +3669,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; @@ -3688,7 +3692,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); usb_put_phy(di->usb_phy); From patchwork Wed Oct 6 19:38:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540441 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F7B7C433F5 for ; Wed, 6 Oct 2021 19:40:08 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 31DE061251 for ; Wed, 6 Oct 2021 19:40:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 31DE061251 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D815E6EE5C; Wed, 6 Oct 2021 19:39:05 +0000 (UTC) Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by gabe.freedesktop.org (Postfix) with ESMTPS id A1C066EE48 for ; Wed, 6 Oct 2021 19:38:57 +0000 (UTC) Received: by mail-pg1-x530.google.com with SMTP id 66so3382825pgc.9 for ; Wed, 06 Oct 2021 12:38:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7Yh3mBEg2nfQJzEtBIxus+8u5VcBe7iEDAWACHn4tN4=; b=U9t/V66lvld0RzEXb++En51W/wZYZPUEPKiGpmWOjHVpfyAWf5GXzah9KRevUB6X2x E1Xwqfi4gZTVJQ0Kwfykyh7ztY48om+yOO9b+3F93MmzmQGgbNYyoiKOeiyGdWV3CvMQ P2GHLdvkmSFVCcMis+tjSKEbm30mCqQoC233g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7Yh3mBEg2nfQJzEtBIxus+8u5VcBe7iEDAWACHn4tN4=; b=DJoIEvmg62ggDeBiIUZUSiY+7q4XJYOYAxBn3/qR1Iguh2ZbMd75+Rrv2H5M6Sr2Lk 40pUp445p0geX2vNujRljimWo2YRzlXD+PEbF/Z9En6Egw4gehEmiKMxricmeCsyilzD h9DmGP5BouE13/2bfcLyl+XoXkn/hlaSqCliSXk+kPMgSIvKp0ysBMRdVK59cNhdjWmL tzk1bwdMBpxUGa4E5obCDn91ec9PAKLC+jW1bk2i1APEuEcANlv6T3zDsW2QRXPJOtK4 l8tx/enuY1AabGP7qMj+XOQsHEUYYUAlJeNeK8/5PaO7i1QOe2GcmwJ0kSVt3Gwta6l2 1WJw== X-Gm-Message-State: AOAM531dMtsodiVp5lYcaT9mBbwLQ9Vs+feMI6WfGYqSzIWgmzhcVIwD 24QMh9dfmRIJKz/B6Jx8evs+Mg== X-Google-Smtp-Source: ABdhPJz92vTWQMcjgF1fSdUOTLALP+adXUegWOTvRs47ng/FwRSYAB2qO/9HC5eL0SMUOg+GS75xEQ== X-Received: by 2002:a62:15c6:0:b0:44c:74b7:14f5 with SMTP id 189-20020a6215c6000000b0044c74b714f5mr13490385pfv.80.1633549137020; Wed, 06 Oct 2021 12:38:57 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:56 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 29/34] fbdev: omap2: Migrate to aggregate driver Date: Wed, 6 Oct 2021 12:38:14 -0700 Message-Id: <20211006193819.2654854-30-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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..f12663c39ceb 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/dss.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/dss.c @@ -1067,8 +1067,9 @@ static int dss_video_pll_probe(struct platform_device *pdev) } /* DSS HW IP initialisation */ -static int dss_bind(struct device *dev) +static int dss_bind(struct aggregate_device *adev) { + struct device *dev = adev->parent; 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 = adev->parent; 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 Wed Oct 6 19:38:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540449 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 663A1C433FE for ; Wed, 6 Oct 2021 19:40:17 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 391DF61177 for ; Wed, 6 Oct 2021 19:40:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 391DF61177 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 42AE16EE2B; Wed, 6 Oct 2021 19:39:23 +0000 (UTC) Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by gabe.freedesktop.org (Postfix) with ESMTPS id A03D76EE55 for ; Wed, 6 Oct 2021 19:38:58 +0000 (UTC) Received: by mail-pf1-x42a.google.com with SMTP id g2so3286576pfc.6 for ; Wed, 06 Oct 2021 12:38:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8jRHJbzxJCo8C1IXTJW3KiTq5EwC3cp5SncHLYDZJzc=; b=DW8Rq7I48xcvXfJwO7zkXFQduC0Ire4Rm/IUtLp2n5907rSjR5g3Ms15Gszi401quM XqjUBmfR0/WPu9fvux4hZDn8BRL79KCrhOTEhLR93sv6dm5LaN8m6Ey4spGKOAmhEd1H XQcWnWYhbhQPQ898DqOITmZobQar+DzEmVh7Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8jRHJbzxJCo8C1IXTJW3KiTq5EwC3cp5SncHLYDZJzc=; b=7l/X2aUUVZyXSdD6pTTWqi78mHkQyWahAAKsVYGwhULnMoamS85gVlM1sVXu2f2Z03 qn2Z316IoPAZjXnn+WUT/VqIpFHUk8V+mpPkKTQYu1KuQrzYJOWaEo/fsIaoW9ylUYz5 LONmOwYj8rhIJc3GQmlo/bsW9KHXsMqn7793xvUYw4milLe3NsAPV4XpxG9IVkCh8GEh jWKmSpEffjU2IwsB/AGywQuilgv37ghdz677WgRy1Cro5KvD2+zC5NdtKoP1RUEtoCBs i/hqqz/rRpqwfvSzuIp/zX9GbO0hdwb+vyndOqYoWrSAwPi7cpHjgkl6qZcF2ae7gKFV ttmg== X-Gm-Message-State: AOAM533Ltz19lAonFzlV+SBJ6aHh1G4AVtBd8uVt5tR636g7I+nT+DuH hHJBNWHtpEXIX1NLsv7ksGdBQQ== X-Google-Smtp-Source: ABdhPJx4kOT1B4vF6qURauwNXogEUpz3RWEPcYcshAJYfrjnwniPXAT8o/FsQzLPD4Sey6nHxE2u/Q== X-Received: by 2002:a63:5717:: with SMTP id l23mr445293pgb.87.1633549138330; Wed, 06 Oct 2021 12:38:58 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:58 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 30/34] sound: hdac: Migrate to aggregate driver Date: Wed, 6 Oct 2021 12:38:15 -0700 Message-Id: <20211006193819.2654854-31-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- sound/hda/hdac_component.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/sound/hda/hdac_component.c b/sound/hda/hdac_component.c index bb37e7e0bd79..9e4dab97f485 100644 --- a/sound/hda/hdac_component.c +++ b/sound/hda/hdac_component.c @@ -181,8 +181,9 @@ int snd_hdac_acomp_get_eld(struct hdac_device *codec, 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 = adev->parent; 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 = adev->parent; 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 Wed Oct 6 19:38:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540439 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF3EFC433FE for ; Wed, 6 Oct 2021 19:40:04 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C4FAD61245 for ; Wed, 6 Oct 2021 19:40:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C4FAD61245 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D408A6EE61; Wed, 6 Oct 2021 19:39:06 +0000 (UTC) Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by gabe.freedesktop.org (Postfix) with ESMTPS id B84366EE21 for ; Wed, 6 Oct 2021 19:38:59 +0000 (UTC) Received: by mail-pf1-x42b.google.com with SMTP id 145so3258418pfz.11 for ; Wed, 06 Oct 2021 12:38:59 -0700 (PDT) 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=fm8Ray60W+gsuBVO8IyR/yw2T2Yz5Ywf4X0EOYohXDA=; b=M9bnTNDCnWZ/AbmQrReLF0e9g14dbA2hMeAudESF0IRy+EF1EO5K2SqFpOXTYT37uU +xiIEGGNUokqXTN+fkT+Ar/FbOVmdVa11MMVtVg+n2H9yF/wuPa634sJWEjxXsnaWnIi Jm3hHKiIfWl3hAvdG6otRnoM3OP1/4OE9lnUk= 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=fm8Ray60W+gsuBVO8IyR/yw2T2Yz5Ywf4X0EOYohXDA=; b=mTjM+zFi7vReWFq3r/hnWQKk0Kv/b+VFoILZoSq8bGJQwVyU9/gfuv+3liGTDZmj/1 Rwy5JyJG7XAfsTnhYTcorBgUkdzVGghF02y4Tn6+d96Aj5AFLx201zv57ZurlbeyUpIV h0aFawMTQd52gCjoPx30CT2/e6OO/0wv87KZzZcsKyu0zc33P/eicbyXoFawNQsVjy/u ttAB9tCt9aNNae0hA32L7NTBxymSedsxb3MVgzavHTmEodf7MJK3qI2L66DoQL7dnGyl KRwp4xoMhkl8SZ/NeQmMlKcE20MyXUM0lM74Gm8w/UPL8Hh7e/J6Uv22n277x8qmKwi0 plFA== X-Gm-Message-State: AOAM5323nX0/qD6xBSjHAk3ddvVrZnaWHn/tfxpg4da9warwXkUarq5H xe3JkZ1fWlo91PSFkQn/YL5gfA== X-Google-Smtp-Source: ABdhPJzpbRB1T9FQhbPMp3f4W/5RvgPd0ymjpSO4hqV8uhllwkUtr714mEwXdatDXZpTyqxVsLio9A== X-Received: by 2002:a63:7456:: with SMTP id e22mr458679pgn.324.1633549139432; Wed, 06 Oct 2021 12:38:59 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:59 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 31/34] ASoC: codecs: wcd938x: Migrate to aggregate driver Date: Wed, 6 Oct 2021 12:38:16 -0700 Message-Id: <20211006193819.2654854-32-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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: 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 Acked-by: Mark Brown --- 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 f0daf8defcf1..6033de7f57ef 100644 --- a/sound/soc/codecs/wcd938x.c +++ b/sound/soc/codecs/wcd938x.c @@ -4316,8 +4316,9 @@ static struct snd_soc_dai_driver wcd938x_dais[] = { }, }; -static int wcd938x_bind(struct device *dev) +static int wcd938x_bind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct wcd938x_priv *wcd938x = dev_get_drvdata(dev); int ret; @@ -4400,8 +4401,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 = adev->parent; struct wcd938x_priv *wcd938x = dev_get_drvdata(dev); device_link_remove(dev, wcd938x->txdev); @@ -4411,9 +4413,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) @@ -4482,7 +4488,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; @@ -4498,7 +4504,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 Wed Oct 6 19:38:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540437 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2049BC4332F for ; Wed, 6 Oct 2021 19:40:02 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D6BB5611CC for ; Wed, 6 Oct 2021 19:40:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D6BB5611CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 357AA6EE29; Wed, 6 Oct 2021 19:39:07 +0000 (UTC) Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by gabe.freedesktop.org (Postfix) with ESMTPS id F11816EE5F for ; Wed, 6 Oct 2021 19:39:00 +0000 (UTC) Received: by mail-pg1-x532.google.com with SMTP id a73so3457855pge.0 for ; Wed, 06 Oct 2021 12:39:00 -0700 (PDT) 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=t6u5XUeO4sYz+ulCltZUbaQi7CS38xRTEpJdyBtoFfw=; b=gHqf7KGdvf03LAMkafGrTL614YdgYSNADvD6jKNuZzRP97v1aHA/q7T8kd0ZLXubtt Ws477MsfBS64eilUdOtGKUXmrXQRY6jgL2SVDJsn2QocOVzGtZubAXOWQygBkSsLMsTW 0w/0jU/+JjkKqJigRw32QZGjanhAVzqbHsR8Q= 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=t6u5XUeO4sYz+ulCltZUbaQi7CS38xRTEpJdyBtoFfw=; b=lgKA22vEyQA7RxWEswIHH9fzbmi/AE5E51sC0V/8QMQfi+L3gm4eS8d3wup5q5v4g0 E8aORQvONaw91aybzQ+llvHIofyF89pEVIy8Qy/jWj0dnyy/MGkAotb3u3WI+qMywhzc rdQ28zHJfnH2GYn79aba+L8pTzmA0shyVNKiBRwxGGFlYhsWeqnMbRKMhWEz9P83UWFL 1GhD0CCqB9hFQTPrXSKxzgiStDq/2dXPzygvuCQwUbupTmXGjz7pNn1Scq2w3ChdsQAc BpmN6g5VWudSVIZJi/v3+JT0f9hR8wov+btLdIakmpc63Nhqg7ToPIXIA+4e/bLlMJIc NXAg== X-Gm-Message-State: AOAM530V1rPt/EzVbg8lyTNmJ7cYcXghPS85CrxBlM0+2CED15amatBY MBsOqdAFReWEBTS/3jeXDmNRAKMA2V7BGA== X-Google-Smtp-Source: ABdhPJxRuwBTqdA6VB0UEYqKM/3I58rwst1cfSUQ17xYRbRYYPzZEwkK8K8qUlPCE155WqL7hoIqqA== X-Received: by 2002:a65:620d:: with SMTP id d13mr485007pgv.36.1633549140541; Wed, 06 Oct 2021 12:39:00 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:39:00 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 32/34] component: Get rid of drm_of_component_probe() Date: Wed, 6 Oct 2021 12:38:17 -0700 Message-Id: <20211006193819.2654854-33-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" There aren't any users anymore so drop it. 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 | 87 +++++++++------------------------------- include/drm/drm_of.h | 12 ------ 2 files changed, 20 insertions(+), 79 deletions(-) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 58db65ad2770..78fe2b809872 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, - int (*compare_of)(struct device *, void *), - struct component_match **matchptr) +/** + * 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. + */ +static int drm_of_aggregate_probe(struct device *dev, + int (*compare_of)(struct device *, void *), + 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. - */ -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 *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. - */ -static 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 c3ec9b14df48..447568992294 100644 --- a/include/drm/drm_of.h +++ b/include/drm/drm_of.h @@ -7,7 +7,6 @@ #include #endif -struct component_master_ops; struct component_match; struct device; struct drm_device; @@ -37,9 +36,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); @@ -73,14 +69,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 Wed Oct 6 19:38:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540429 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FED8C433EF for ; Wed, 6 Oct 2021 19:39:54 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 40D3C611C5 for ; Wed, 6 Oct 2021 19:39:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 40D3C611C5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6DDF26EE21; Wed, 6 Oct 2021 19:39:04 +0000 (UTC) Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by gabe.freedesktop.org (Postfix) with ESMTPS id E4D446EE45 for ; Wed, 6 Oct 2021 19:39:01 +0000 (UTC) Received: by mail-pg1-x529.google.com with SMTP id 75so3419398pga.3 for ; Wed, 06 Oct 2021 12:39:01 -0700 (PDT) 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=NjwWJoeqH2Q78OrEfQhtP8/+e1T/dAhtZT9RvI4IcNk=; b=Cba3iEezPLMzTZrAJsNbMyjgVr8Pt9bX/b8iQJj/rafPNCtmpTLgobk8L8N7IMEf2F r8RwJUu+37bkbpEJqp1JqkU7eZUfGc0CBEkcPWlR6BUa/FGeAPmmnlD1kjhTeOOy550D NYZtBSOt/DMbPMGaGnBjwaJew4USqomkNUoo8= 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=NjwWJoeqH2Q78OrEfQhtP8/+e1T/dAhtZT9RvI4IcNk=; b=UQCgdt2ECiLivx2J5zLFcdVC/cXP/uhW9218+Tz/imT1CZzsUcN9yhllQugxu1du2P 45aNny0McttxoOrjy9hUrO+E4AbbkM6zw6qIrbTDZkaffiOUNQFFkfmgZvtUDTz6P497 pMQI8ri5pj1zZWxsrS1U89VaJkpZ9n5WQumlfP1F/P1VgmcYc0jCJBXcmw8woQ6nsSmj Ylt2l5PcAyV++asg54WpPm6ntEQsSs4RRhwrpPcY12IDCtfgS6gkUXEhc5fWXgbjE0UV xaNDDWE36wyNIh/MHnzb1UFV5dNKyTeKXRnf1GghHq111CM4+5S7UAycRPvxB1IxPaBb cjcg== X-Gm-Message-State: AOAM530ntOq7zm48SOqE8/uljEE4qRfSmG3Vd3L62JRDVFXWwPndh7rZ 83wDGRNHmdnFi79cAYhDjWzYPg== X-Google-Smtp-Source: ABdhPJxoplQAMrZuav0lG8d3A5qfEyH8lCdSXX3ngcKRlEIoMACvU+bsK3Nru1KC+Q+TKrTi1gVoog== X-Received: by 2002:a63:c10b:: with SMTP id w11mr470789pgf.228.1633549141623; Wed, 06 Oct 2021 12:39:01 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.39.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:39:01 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 33/34] component: Remove component_master_ops and friends Date: Wed, 6 Oct 2021 12:38:18 -0700 Message-Id: <20211006193819.2654854-34-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The struct is unused now so drop it along with the functions that use it. Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Reported-by: kernel test robot --- drivers/base/component.c | 109 +++----------------------------------- drivers/gpu/drm/drm_drv.c | 2 +- include/linux/component.h | 45 ---------------- 3 files changed, 8 insertions(+), 148 deletions(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index a6dd33d0ddeb..939862b25b10 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -140,18 +140,12 @@ static void component_master_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; @@ -496,16 +490,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; @@ -523,7 +512,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; @@ -564,54 +553,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 @@ -640,42 +581,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 @@ -727,7 +632,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) { @@ -815,7 +720,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) { diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 7a5097467ba5..d188fa26bb1b 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -544,7 +544,7 @@ static void drm_fs_inode_free(struct inode *inode) * following guidelines apply: * * - The entire device initialization procedure should be run from the - * &component_master_ops.master_bind callback, starting with + * &aggregate_driver.probe callback, starting with * devm_drm_dev_alloc(), then binding all components with * component_bind_all() and finishing with drm_dev_register(). * diff --git a/include/linux/component.h b/include/linux/component.h index d8dcbf9733da..07fe481d4e3b 100644 --- a/include/linux/component.h +++ b/include/linux/component.h @@ -63,47 +63,7 @@ void component_del(struct device *, const struct component_ops *); int component_bind_all(struct device *master, void *master_data); void component_unbind_all(struct device *master, void *master_data); -/** - * struct component_master_ops - callback for the aggregate driver - * - * Aggregate drivers are registered with component_master_add_with_match() and - * unregistered with component_master_del(). - */ -struct component_master_ops { - /** - * @bind: - * - * Called when all components or the aggregate driver, as specified in - * the match list passed to component_master_add_with_match(), are - * ready. Usually there are 3 steps to bind an aggregate driver: - * - * 1. Allocate a structure for the aggregate driver. - * - * 2. Bind all components to the aggregate driver by calling - * component_bind_all() with the aggregate driver structure as opaque - * pointer data. - * - * 3. Register the aggregate driver with the subsystem to publish its - * interfaces. - * - * Note that the lifetime of the aggregate driver does not align with - * any of the underlying &struct device instances. Therefore devm cannot - * be used and all resources acquired or allocated in this callback must - * be explicitly released in the @unbind callback. - */ - int (*bind)(struct device *master); - /** - * @unbind: - * - * Called when either the aggregate driver, using - * component_master_del(), or one of its components, using - * component_del(), is unregistered. - */ - void (*unbind)(struct device *master); -}; - struct aggregate_device { - const struct component_master_ops *ops; struct device *parent; struct device dev; struct component_match *match; @@ -171,11 +131,6 @@ int component_aggregate_register(struct device *parent, void component_aggregate_unregister(struct device *parent, struct aggregate_driver *adrv); -void component_master_del(struct device *, - const struct component_master_ops *); - -int component_master_add_with_match(struct device *, - const struct component_master_ops *, struct component_match *); void component_match_add_release(struct device *master, struct component_match **matchptr, void (*release)(struct device *, void *), From patchwork Wed Oct 6 19:38:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12540447 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3ACA1C433EF for ; Wed, 6 Oct 2021 19:40:16 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0F4C261278 for ; Wed, 6 Oct 2021 19:40:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0F4C261278 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5B6E76EE28; Wed, 6 Oct 2021 19:39:22 +0000 (UTC) Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by gabe.freedesktop.org (Postfix) with ESMTPS id F1A976EE40 for ; Wed, 6 Oct 2021 19:39:03 +0000 (UTC) Received: by mail-pj1-x102d.google.com with SMTP id qe4-20020a17090b4f8400b0019f663cfcd1so5208267pjb.1 for ; Wed, 06 Oct 2021 12:39:03 -0700 (PDT) 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=Ot2+ntvoFG4rsH4e1sE1QMW5zjuXqRNCEhlTLCik2wM=; b=ZMhQIHtNA4/kV1vlNC99CTawkyKetOhHUYakJmO72VYU9TrfpZBzPPLUDYYFReVk3e Pom8N145OWgM8buTFKaH7OBf+pPgQzvJcfKcEX4AjvV0g0cy0C30dy8iPjzkw5jEF8z3 R5paxhucwDP6aHXmIJicXt2jbvOk9XRtrlCMM= 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=Ot2+ntvoFG4rsH4e1sE1QMW5zjuXqRNCEhlTLCik2wM=; b=t7fn8V83QAdAwiUu5g7QKo3h8hi2rKySGI32GEqcncEpC9lCuipHk/v935Dh9RVqIW 6VKbN8yIbTrknH0QVAOVnd1n9LJR+FDkoHM11sJzBfkSoWfiizsfunHBi6lEy3eHS99O VO6YdgbC2XBwRSm+Zb0GjDRYbwS0zqQAPSQYj4fpTrXVg7xD3okwNMXzYLOR5QdTPP/C PQcBdZvGaMD6KV/gNAzIxhcVA1R6FjwAkfrAZ0WncTeunahrREcXttPLmbs4SA1hD6K6 iitp8hzXem0JNWzV+e4lle+dKSB2N0QrL0Jn6ZmMOH8OuVS0RiIybzJKi6KdR82I5mLy 9yNw== X-Gm-Message-State: AOAM5316tVKxMWUSbPW/8f0S631OWxMoUzjqc/Bwfa3dRTgGo4XvMgw0 FtKTleeXwMY4p81k+HAF+UUlGg== X-Google-Smtp-Source: ABdhPJxkLFmtSoPOhMgZhiIHEnf6+SjN1wfSYnzctXTRYdCeWsjvLvOF8AP6gzVDYc69tY/rt6+66g== X-Received: by 2002:a17:90b:1b0b:: with SMTP id nu11mr80066pjb.103.1633549142676; Wed, 06 Oct 2021 12:39:02 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.39.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:39:02 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman 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 v2 34/34] component: Remove all references to 'master' Date: Wed, 6 Oct 2021 12:38:19 -0700 Message-Id: <20211006193819.2654854-35-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Remove all references to 'master' in the code now that we've migrated all the users of the ops structure to the aggregate driver. Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/base/component.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index 939862b25b10..75323d35773c 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 @@ -119,23 +114,23 @@ static int __init component_debug_init(void) core_initcall(component_debug_init); -static void component_master_debugfs_add(struct aggregate_device *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 aggregate_device *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 aggregate_device *m) +static void component_debugfs_add(struct aggregate_device *m) { } -static void component_master_debugfs_del(struct aggregate_device *m) +static void component_debugfs_del(struct aggregate_device *m) { } #endif @@ -343,7 +338,7 @@ EXPORT_SYMBOL(component_match_add_release); * @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(). @@ -367,7 +362,7 @@ static void free_aggregate_device(struct aggregate_device *adev) struct component_match *match = adev->match; int i; - component_master_debugfs_del(adev); + component_debugfs_del(adev); if (match) { for (i = 0; i < match->num; i++) { @@ -548,7 +543,7 @@ static struct aggregate_device *aggregate_device_add(struct device *parent, return ERR_PTR(ret); } - component_master_debugfs_add(adev); + component_debugfs_add(adev); return adev; }