From patchwork Thu Jan 6 21:45:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705762 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A06EDC433FE for ; Thu, 6 Jan 2022 21:46:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244447AbiAFVqI (ORCPT ); Thu, 6 Jan 2022 16:46:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244410AbiAFVqC (ORCPT ); Thu, 6 Jan 2022 16:46:02 -0500 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1ED8C06118C for ; Thu, 6 Jan 2022 13:46:01 -0800 (PST) Received: by mail-pf1-x42d.google.com with SMTP id u20so3558893pfi.12 for ; Thu, 06 Jan 2022 13:46:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RmY1cenK39LeXHZdxikBLMAMQ0a1qm+zsJMLAmvgrDU=; b=f8YEJU69thyg9l1prrNVdACbNhPVwDnYPAvsWZQCfxuGCEnOXLapoRPPa9nO4t1NKS MQHKjftCulwgmqiKja59+9XQrMcVo4BDLWTnrCMCaWPKIGn8taUOwUWakXEyluRga50t 6VDe7o4C2A8erXxa9aDjEh/Sv+4oRE5+XBEss= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RmY1cenK39LeXHZdxikBLMAMQ0a1qm+zsJMLAmvgrDU=; b=PFnRgETyVwO8APNxmBrztQvxcyI5pv+MJAkDWmUUDoiS14IJftS/aFzwoAQJ2xqmWS zB0zSnkJ2K7SxP83BWDEX5dskYezL38mJVijOxRo1B2Ltd8x0ya3bBeLyauqnN1ev7RK 9XpZkltSI3qXNrQ73sWfHIq9yQiauY1Q8o4A2H/9XHqQRnJkvPVW2Vs4qVKa4NzvLjYY R6AkTHqz/zhH5xKe9hzwnjDdeRfgP89fV5n2SgxBRyNzaC8biW3Ui6Aj0Z8llmlzkhx0 9JoT6rL+i3/jDdkhjFKc89j1i6KcimPZhQQEgqc8grbG6U9iNlWtohqRbueDXw0LA2ei J6aQ== X-Gm-Message-State: AOAM532kcmRGnLNe4qhRfGEjrIecFyL5cQmolz4lWZu3C6tRraKxH+Ra 9WlUEUH8Iy9wXB4t30873ooS/g== X-Google-Smtp-Source: ABdhPJxGPujK12u8lFN4IcocU1zebcj8bRCGY4K+kr0OZzOMaAuSgL5xV6Isj1Sd2sBfbPsvKoMRoQ== X-Received: by 2002:a63:3704:: with SMTP id e4mr54745338pga.551.1641505561201; Thu, 06 Jan 2022 13:46:01 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:00 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Daniel Vetter , Laurent Pinchart , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 01/32] component: Replace most references to 'master' with 'aggregate device' Date: Thu, 6 Jan 2022 13:45:24 -0800 Message-Id: <20220106214556.2461363-2-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Remove most references to 'master' in the code and replace them with some form of 'aggregate device'. This better reflects the reality of what this code does, i.e. an aggregate device that represents a device like a GPU card once some set of devices that make up the aggregate device probe and register with the component framework. Cc: Daniel Vetter Cc: Greg Kroah-Hartman Cc: Laurent Pinchart Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/base/component.c | 242 +++++++++++++++++++------------------- include/linux/component.h | 2 +- 2 files changed, 120 insertions(+), 124 deletions(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index 2d25a6416587..34f9e0802719 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -1,11 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* * Componentized device handling. - * - * This is work in progress. We gather up the component devices into a list, - * and bind them when instructed. At the moment, we're specific to the DRM - * subsystem, and only handles one master device, but this doesn't have to be - * the case. */ #include #include @@ -57,7 +52,7 @@ struct component_match { struct component_match_array *compare; }; -struct master { +struct aggregate_device { struct list_head node; bool bound; @@ -68,7 +63,7 @@ struct master { struct component { struct list_head node; - struct master *master; + struct aggregate_device *adev; bool bound; const struct component_ops *ops; @@ -78,7 +73,7 @@ struct component { static DEFINE_MUTEX(component_mutex); static LIST_HEAD(component_list); -static LIST_HEAD(masters); +static LIST_HEAD(aggregate_devices); #ifdef CONFIG_DEBUG_FS @@ -86,12 +81,12 @@ static struct dentry *component_debugfs_dir; static int component_devices_show(struct seq_file *s, void *data) { - struct master *m = s->private; + struct aggregate_device *m = s->private; struct component_match *match = m->match; size_t i; mutex_lock(&component_mutex); - seq_printf(s, "%-40s %20s\n", "master name", "status"); + seq_printf(s, "%-40s %20s\n", "aggregate_device name", "status"); seq_puts(s, "-------------------------------------------------------------\n"); seq_printf(s, "%-40s %20s\n\n", dev_name(m->parent), m->bound ? "bound" : "not bound"); @@ -121,46 +116,46 @@ static int __init component_debug_init(void) core_initcall(component_debug_init); -static void component_master_debugfs_add(struct master *m) +static void component_debugfs_add(struct aggregate_device *m) { debugfs_create_file(dev_name(m->parent), 0444, component_debugfs_dir, m, &component_devices_fops); } -static void component_master_debugfs_del(struct master *m) +static void component_debugfs_del(struct aggregate_device *m) { debugfs_remove(debugfs_lookup(dev_name(m->parent), component_debugfs_dir)); } #else -static void component_master_debugfs_add(struct master *m) +static void component_debugfs_add(struct aggregate_device *m) { } -static void component_master_debugfs_del(struct master *m) +static void component_debugfs_del(struct aggregate_device *m) { } #endif -static struct master *__master_find(struct device *parent, +static struct aggregate_device *__aggregate_find(struct device *parent, const struct component_master_ops *ops) { - struct master *m; + struct aggregate_device *m; - list_for_each_entry(m, &masters, node) + list_for_each_entry(m, &aggregate_devices, node) if (m->parent == parent && (!ops || m->ops == ops)) return m; return NULL; } -static struct component *find_component(struct master *master, +static struct component *find_component(struct aggregate_device *adev, struct component_match_array *mc) { struct component *c; list_for_each_entry(c, &component_list, node) { - if (c->master && c->master != master) + if (c->adev && c->adev != adev) continue; if (mc->compare && mc->compare(c->dev, mc->data)) @@ -174,102 +169,103 @@ static struct component *find_component(struct master *master, return NULL; } -static int find_components(struct master *master) +static int find_components(struct aggregate_device *adev) { - struct component_match *match = master->match; + struct component_match *match = adev->match; size_t i; int ret = 0; /* * Scan the array of match functions and attach - * any components which are found to this master. + * any components which are found to this adev. */ for (i = 0; i < match->num; i++) { struct component_match_array *mc = &match->compare[i]; struct component *c; - dev_dbg(master->parent, "Looking for component %zu\n", i); + dev_dbg(adev->parent, "Looking for component %zu\n", i); if (match->compare[i].component) continue; - c = find_component(master, mc); + c = find_component(adev, mc); if (!c) { ret = -ENXIO; break; } - dev_dbg(master->parent, "found component %s, duplicate %u\n", dev_name(c->dev), !!c->master); + dev_dbg(adev->parent, "found component %s, duplicate %u\n", + dev_name(c->dev), !!c->adev); - /* Attach this component to the master */ - match->compare[i].duplicate = !!c->master; + /* Attach this component to the adev */ + match->compare[i].duplicate = !!c->adev; match->compare[i].component = c; - c->master = master; + c->adev = adev; } return ret; } -/* Detach component from associated master */ -static void remove_component(struct master *master, struct component *c) +/* Detach component from associated aggregate_device */ +static void remove_component(struct aggregate_device *adev, struct component *c) { size_t i; - /* Detach the component from this master. */ - for (i = 0; i < master->match->num; i++) - if (master->match->compare[i].component == c) - master->match->compare[i].component = NULL; + /* Detach the component from this adev. */ + for (i = 0; i < adev->match->num; i++) + if (adev->match->compare[i].component == c) + adev->match->compare[i].component = NULL; } /* - * Try to bring up a master. If component is NULL, we're interested in - * this master, otherwise it's a component which must be present to try - * and bring up the master. + * Try to bring up an aggregate device. If component is NULL, we're interested + * in this aggregate device, otherwise it's a component which must be present + * to try and bring up the aggregate device. * * Returns 1 for successful bringup, 0 if not ready, or -ve errno. */ -static int try_to_bring_up_master(struct master *master, +static int try_to_bring_up_aggregate_device(struct aggregate_device *adev, struct component *component) { int ret; - dev_dbg(master->parent, "trying to bring up master\n"); + dev_dbg(adev->parent, "trying to bring up adev\n"); - if (find_components(master)) { - dev_dbg(master->parent, "master has incomplete components\n"); + if (find_components(adev)) { + dev_dbg(adev->parent, "master has incomplete components\n"); return 0; } - if (component && component->master != master) { - dev_dbg(master->parent, "master is not for this component (%s)\n", + if (component && component->adev != adev) { + dev_dbg(adev->parent, "master is not for this component (%s)\n", dev_name(component->dev)); return 0; } - if (!devres_open_group(master->parent, master, GFP_KERNEL)) + if (!devres_open_group(adev->parent, adev, GFP_KERNEL)) return -ENOMEM; /* Found all components */ - ret = master->ops->bind(master->parent); + ret = adev->ops->bind(adev->parent); if (ret < 0) { - devres_release_group(master->parent, NULL); + devres_release_group(adev->parent, NULL); if (ret != -EPROBE_DEFER) - dev_info(master->parent, "master bind failed: %d\n", ret); + dev_info(adev->parent, "adev bind failed: %d\n", ret); return ret; } - devres_close_group(master->parent, NULL); - master->bound = true; + devres_close_group(adev->parent, NULL); + adev->bound = true; return 1; } static int try_to_bring_up_masters(struct component *component) { - struct master *m; + struct aggregate_device *adev; int ret = 0; - list_for_each_entry(m, &masters, node) { - if (!m->bound) { - ret = try_to_bring_up_master(m, component); + list_for_each_entry(adev, &aggregate_devices, node) { + if (!adev->bound) { + ret = try_to_bring_up_aggregate_device(adev, component); if (ret != 0) break; } @@ -278,12 +274,12 @@ static int try_to_bring_up_masters(struct component *component) return ret; } -static void take_down_master(struct master *master) +static void take_down_aggregate_device(struct aggregate_device *adev) { - if (master->bound) { - master->ops->unbind(master->parent); - devres_release_group(master->parent, master); - master->bound = false; + if (adev->bound) { + adev->ops->unbind(adev->parent); + devres_release_group(adev->parent, adev); + adev->bound = false; } } @@ -324,7 +320,7 @@ static int component_match_realloc(struct component_match *match, size_t num) return 0; } -static void __component_match_add(struct device *master, +static void __component_match_add(struct device *parent, struct component_match **matchptr, void (*release)(struct device *, void *), int (*compare)(struct device *, void *), @@ -344,7 +340,7 @@ static void __component_match_add(struct device *master, return; } - devres_add(master, match); + devres_add(parent, match); *matchptr = match; } @@ -370,13 +366,13 @@ static void __component_match_add(struct device *master, /** * component_match_add_release - add a component match entry with release callback - * @master: device with the aggregate driver + * @parent: parent device of the aggregate driver * @matchptr: pointer to the list of component matches * @release: release function for @compare_data * @compare: compare function to match against all components * @compare_data: opaque pointer passed to the @compare function * - * Adds a new component match to the list stored in @matchptr, which the @master + * Adds a new component match to the list stored in @matchptr, which the * aggregate driver needs to function. The list of component matches pointed to * by @matchptr must be initialized to NULL before adding the first match. This * only matches against components added with component_add(). @@ -388,24 +384,24 @@ static void __component_match_add(struct device *master, * * See also component_match_add() and component_match_add_typed(). */ -void component_match_add_release(struct device *master, +void component_match_add_release(struct device *parent, struct component_match **matchptr, void (*release)(struct device *, void *), int (*compare)(struct device *, void *), void *compare_data) { - __component_match_add(master, matchptr, release, compare, NULL, + __component_match_add(parent, matchptr, release, compare, NULL, compare_data); } EXPORT_SYMBOL(component_match_add_release); /** * component_match_add_typed - add a component match entry for a typed component - * @master: device with the aggregate driver + * @parent: parent device of the aggregate driver * @matchptr: pointer to the list of component matches * @compare_typed: compare function to match against all typed components * @compare_data: opaque pointer passed to the @compare function * - * Adds a new component match to the list stored in @matchptr, which the @master + * Adds a new component match to the list stored in @matchptr, which the * aggregate driver needs to function. The list of component matches pointed to * by @matchptr must be initialized to NULL before adding the first match. This * only matches against components added with component_add_typed(). @@ -415,32 +411,32 @@ EXPORT_SYMBOL(component_match_add_release); * * See also component_match_add_release() and component_match_add_typed(). */ -void component_match_add_typed(struct device *master, +void component_match_add_typed(struct device *parent, struct component_match **matchptr, int (*compare_typed)(struct device *, int, void *), void *compare_data) { - __component_match_add(master, matchptr, NULL, NULL, compare_typed, + __component_match_add(parent, matchptr, NULL, NULL, compare_typed, compare_data); } EXPORT_SYMBOL(component_match_add_typed); -static void free_master(struct master *master) +static void free_aggregate_device(struct aggregate_device *adev) { - struct component_match *match = master->match; + struct component_match *match = adev->match; int i; - component_master_debugfs_del(master); - list_del(&master->node); + component_debugfs_del(adev); + list_del(&adev->node); if (match) { for (i = 0; i < match->num; i++) { struct component *c = match->compare[i].component; if (c) - c->master = NULL; + c->adev = NULL; } } - kfree(master); + kfree(adev); } /** @@ -459,7 +455,7 @@ int component_master_add_with_match(struct device *parent, const struct component_master_ops *ops, struct component_match *match) { - struct master *master; + struct aggregate_device *adev; int ret; /* Reallocate the match array for its true size */ @@ -467,23 +463,23 @@ int component_master_add_with_match(struct device *parent, if (ret) return ret; - master = kzalloc(sizeof(*master), GFP_KERNEL); - if (!master) + adev = kzalloc(sizeof(*adev), GFP_KERNEL); + if (!adev) return -ENOMEM; - master->parent = parent; - master->ops = ops; - master->match = match; + adev->parent = parent; + adev->ops = ops; + adev->match = match; - component_master_debugfs_add(master); - /* Add to the list of available masters. */ + component_debugfs_add(adev); + /* Add to the list of available aggregate devices. */ mutex_lock(&component_mutex); - list_add(&master->node, &masters); + list_add(&adev->node, &aggregate_devices); - ret = try_to_bring_up_master(master, NULL); + ret = try_to_bring_up_aggregate_device(adev, NULL); if (ret < 0) - free_master(master); + free_aggregate_device(adev); mutex_unlock(&component_mutex); @@ -503,25 +499,25 @@ EXPORT_SYMBOL_GPL(component_master_add_with_match); void component_master_del(struct device *parent, const struct component_master_ops *ops) { - struct master *master; + struct aggregate_device *adev; mutex_lock(&component_mutex); - master = __master_find(parent, ops); - if (master) { - take_down_master(master); - free_master(master); + adev = __aggregate_find(parent, ops); + if (adev) { + take_down_aggregate_device(adev); + free_aggregate_device(adev); } mutex_unlock(&component_mutex); } EXPORT_SYMBOL_GPL(component_master_del); static void component_unbind(struct component *component, - struct master *master, void *data) + struct aggregate_device *adev, void *data) { WARN_ON(!component->bound); if (component->ops && component->ops->unbind) - component->ops->unbind(component->dev, master->parent, data); + component->ops->unbind(component->dev, adev->parent, data); component->bound = false; /* Release all resources claimed in the binding of this component */ @@ -539,26 +535,26 @@ static void component_unbind(struct component *component, */ void component_unbind_all(struct device *parent, void *data) { - struct master *master; + struct aggregate_device *adev; struct component *c; size_t i; WARN_ON(!mutex_is_locked(&component_mutex)); - master = __master_find(parent, NULL); - if (!master) + adev = __aggregate_find(parent, NULL); + if (!adev) return; /* Unbind components in reverse order */ - for (i = master->match->num; i--; ) - if (!master->match->compare[i].duplicate) { - c = master->match->compare[i].component; - component_unbind(c, master, data); + for (i = adev->match->num; i--; ) + if (!adev->match->compare[i].duplicate) { + c = adev->match->compare[i].component; + component_unbind(c, adev, data); } } EXPORT_SYMBOL_GPL(component_unbind_all); -static int component_bind(struct component *component, struct master *master, +static int component_bind(struct component *component, struct aggregate_device *adev, void *data) { int ret; @@ -568,7 +564,7 @@ static int component_bind(struct component *component, struct master *master, * This allows us to roll-back a failed component without * affecting anything else. */ - if (!devres_open_group(master->parent, NULL, GFP_KERNEL)) + if (!devres_open_group(adev->parent, NULL, GFP_KERNEL)) return -ENOMEM; /* @@ -577,14 +573,14 @@ static int component_bind(struct component *component, struct master *master, * at the appropriate moment. */ if (!devres_open_group(component->dev, component, GFP_KERNEL)) { - devres_release_group(master->parent, NULL); + devres_release_group(adev->parent, NULL); return -ENOMEM; } - dev_dbg(master->parent, "binding %s (ops %ps)\n", + dev_dbg(adev->parent, "binding %s (ops %ps)\n", dev_name(component->dev), component->ops); - ret = component->ops->bind(component->dev, master->parent, data); + ret = component->ops->bind(component->dev, adev->parent, data); if (!ret) { component->bound = true; @@ -595,16 +591,16 @@ static int component_bind(struct component *component, struct master *master, * can clean those resources up independently. */ devres_close_group(component->dev, NULL); - devres_remove_group(master->parent, NULL); + devres_remove_group(adev->parent, NULL); - dev_info(master->parent, "bound %s (ops %ps)\n", + dev_info(adev->parent, "bound %s (ops %ps)\n", dev_name(component->dev), component->ops); } else { devres_release_group(component->dev, NULL); - devres_release_group(master->parent, NULL); + devres_release_group(adev->parent, NULL); if (ret != -EPROBE_DEFER) - dev_err(master->parent, "failed to bind %s (ops %ps): %d\n", + dev_err(adev->parent, "failed to bind %s (ops %ps): %d\n", dev_name(component->dev), component->ops, ret); } @@ -622,31 +618,31 @@ static int component_bind(struct component *component, struct master *master, */ int component_bind_all(struct device *parent, void *data) { - struct master *master; + struct aggregate_device *adev; struct component *c; size_t i; int ret = 0; WARN_ON(!mutex_is_locked(&component_mutex)); - master = __master_find(parent, NULL); - if (!master) + adev = __aggregate_find(parent, NULL); + if (!adev) return -EINVAL; /* Bind components in match order */ - for (i = 0; i < master->match->num; i++) - if (!master->match->compare[i].duplicate) { - c = master->match->compare[i].component; - ret = component_bind(c, master, data); + for (i = 0; i < adev->match->num; i++) + if (!adev->match->compare[i].duplicate) { + c = adev->match->compare[i].component; + ret = component_bind(c, adev, data); if (ret) break; } if (ret != 0) { for (; i > 0; i--) - if (!master->match->compare[i - 1].duplicate) { - c = master->match->compare[i - 1].component; - component_unbind(c, master, data); + if (!adev->match->compare[i - 1].duplicate) { + c = adev->match->compare[i - 1].component; + component_unbind(c, adev, data); } } @@ -675,8 +671,8 @@ static int __component_add(struct device *dev, const struct component_ops *ops, ret = try_to_bring_up_masters(component); if (ret < 0) { - if (component->master) - remove_component(component->master, component); + if (component->adev) + remove_component(component->adev, component); list_del(&component->node); kfree(component); @@ -757,9 +753,9 @@ void component_del(struct device *dev, const struct component_ops *ops) break; } - if (component && component->master) { - take_down_master(component->master); - remove_component(component->master, component); + if (component && component->adev) { + take_down_aggregate_device(component->adev); + remove_component(component->adev, component); } mutex_unlock(&component_mutex); diff --git a/include/linux/component.h b/include/linux/component.h index 16de18f473d7..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 Thu Jan 6 21:45:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705763 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2030EC433FE for ; Thu, 6 Jan 2022 21:46:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244400AbiAFVqK (ORCPT ); Thu, 6 Jan 2022 16:46:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244425AbiAFVqD (ORCPT ); Thu, 6 Jan 2022 16:46:03 -0500 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 076A9C034000 for ; Thu, 6 Jan 2022 13:46:03 -0800 (PST) Received: by mail-pf1-x433.google.com with SMTP id q3so3582071pfs.7 for ; Thu, 06 Jan 2022 13:46:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ihieeriyE8UG3RZG4+pkuf1VTaWA2lHg2OnygIPLIw8=; b=aq/xKBP+WtsO6raoZRDAqa2CrfA+mQwOme4XqFwKmWlVIxQvarv9I00Q96a8FQmmGG yR7RBwi4B6T3u2QYNOFO1P2XEt6q8hH5Z6EgzxFvhj6PG2VrQ+L5UCWy9Fgy85iDBsIr 1tjtn8/V+/Mu1PNXnMrGyPhNT1TJic/s+SvwE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ihieeriyE8UG3RZG4+pkuf1VTaWA2lHg2OnygIPLIw8=; b=36OYlm0gjZ3ppfnxhY+bs44fJGzyDAql06VBYwi6WVUn5KugNWUv5bMXN5SXwONOwA TdrNiyGbSBXKm3dzRvdl/OGIgAxzI7Dqgg7NS+YuprzPZsdMoJyiBkOtILEWMYg2eaVL KWn2uJlkA43itbdNVRxodWQPKloU5NEPA1v+nBySD59XBB184zr0udagwgUkm8XKlHwn B8s+7Ck4YdW0kRqUvhNnKssCxZNXd1oXDtiB+0VbRzNhb0vAEr8PwZB5FFi9mzmiTdug HLHR/OKzmVW3gntXLw5zXOtKvdFhWQ/yPrFX+BFyWyFRrzg29oDbClxvedSbTE4ZppNQ 7cDw== X-Gm-Message-State: AOAM532OIxmSQCSdjymj4jj1DeoT3GXgH/BFzCY6BWn9AWiNHuJbkkh1 okOr7UiouZRjdWkDR4FrYKX+yFV4YblB+w== X-Google-Smtp-Source: ABdhPJwjE6tLJSuGMa5iYMELWPSTxueifiS36w0Y1ypl18Khz9RpepmFmn17k8A+TXDeeUNUum5B+g== X-Received: by 2002:aa7:9681:0:b0:4ba:98c6:8fc3 with SMTP id f1-20020aa79681000000b004ba98c68fc3mr62688363pfk.78.1641505562443; Thu, 06 Jan 2022 13:46:02 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:02 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Daniel Vetter , Laurent Pinchart , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 02/32] component: Introduce the aggregate bus_type Date: Thu, 6 Jan 2022 13:45:25 -0800 Message-Id: <20220106214556.2461363-3-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The component framework only provides 'bind' and 'unbind' callbacks to tell the host driver that it is time to assemble the aggregate driver now that all the components have probed. The component framework doesn't attempt to resolve runtime PM or suspend/resume ordering, and explicitly mentions this in the code. This lack of support leads to some pretty gnarly usages of the 'prepare' and 'complete' power management hooks in drivers that host the aggregate device, and it fully breaks down when faced with ordering shutdown between the various components, the aggregate driver, and the host driver that registers the whole thing. In a concrete example, the MSM display driver at drivers/gpu/drm/msm is using 'prepare' and 'complete' to call the drm helpers drm_mode_config_helper_suspend() and drm_mode_config_helper_resume() respectively, so that it can move the aggregate driver suspend/resume callbacks to be before and after the components that make up the drm device call any suspend/resume hooks they have. This only works as long as the component devices don't do anything in their own 'prepare' and 'complete' callbacks. If they did, then the ordering would be incorrect and we would be doing something in the component drivers before the aggregate driver could do anything. Yuck! Similarly, when trying to add shutdown support to the MSM driver we run across a problem where we're trying to shutdown the drm device via drm_atomic_helper_shutdown(), but some of the devices in the encoder chain have already been shutdown. This time, the component devices aren't the problem (although they could be if they did anything in their shutdown callbacks), but there's a DSI to eDP bridge in the encoder chain that has already been shutdown before the driver hosting the aggregate device runs shutdown. The ordering of driver probe is like this: 1. msm_pdev_probe() (host driver) 2. DSI bridge 3. aggregate bind When it comes to shutdown we have this order: 1. DSI bridge 2. msm_pdev_shutdown() (host driver) and so the bridge is already off, but we want to communicate to it to turn things off on the display during msm_pdev_shutdown(). Double yuck! Unfortunately, this time we can't split shutdown into multiple phases and swap msm_pdev_shutdown() with the DSI bridge. Let's make the component_master_ops into an actual device driver that has probe/remove/shutdown functions. The driver will only be bound to the aggregate device once all component drivers have called component_add() to indicate they're ready to assemble the aggregate driver. This allows us to attach shutdown logic (and in the future runtime PM logic) to the aggregate driver so that it runs the hooks in the correct order. Cc: Daniel Vetter Cc: Greg Kroah-Hartman Cc: Laurent Pinchart Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/base/component.c | 471 ++++++++++++++++++++++++++++---------- include/linux/component.h | 62 ++++- 2 files changed, 402 insertions(+), 131 deletions(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index 34f9e0802719..eec82caeae5e 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -4,10 +4,14 @@ */ #include #include +#include #include #include #include #include +#include + +#include "base.h" /** * DOC: overview @@ -31,8 +35,8 @@ * * Aggregate drivers first assemble a component match list of what they need * using component_match_add(). This is then registered as an aggregate driver - * using component_master_add_with_match(), and unregistered using - * component_master_del(). + * using component_aggregate_register(), and unregistered using + * component_aggregate_unregister(). */ struct component; @@ -53,14 +57,20 @@ struct component_match { }; struct aggregate_device { - struct list_head node; - bool bound; - const struct component_master_ops *ops; struct device *parent; + struct device dev; struct component_match *match; + struct aggregate_driver *adrv; + + int id; }; +static inline struct aggregate_device *to_aggregate_device(struct device *d) +{ + return container_of(d, struct aggregate_device, dev); +} + struct component { struct list_head node; struct aggregate_device *adev; @@ -69,11 +79,12 @@ struct component { const struct component_ops *ops; int subcomponent; struct device *dev; + struct device_link *link; }; static DEFINE_MUTEX(component_mutex); static LIST_HEAD(component_list); -static LIST_HEAD(aggregate_devices); +static DEFINE_IDA(aggregate_ida); #ifdef CONFIG_DEBUG_FS @@ -89,7 +100,7 @@ static int component_devices_show(struct seq_file *s, void *data) seq_printf(s, "%-40s %20s\n", "aggregate_device name", "status"); seq_puts(s, "-------------------------------------------------------------\n"); seq_printf(s, "%-40s %20s\n\n", - dev_name(m->parent), m->bound ? "bound" : "not bound"); + dev_name(m->parent), m->dev.driver ? "bound" : "not bound"); seq_printf(s, "%-40s %20s\n", "device name", "status"); seq_puts(s, "-------------------------------------------------------------\n"); @@ -137,16 +148,21 @@ static void component_debugfs_del(struct aggregate_device *m) #endif -static struct aggregate_device *__aggregate_find(struct device *parent, - const struct component_master_ops *ops) +struct aggregate_bus_find_data { + const struct component_master_ops *ops; + struct device *parent; +}; + +static int aggregate_bus_find_match(struct device *dev, const void *_data) { - struct aggregate_device *m; + struct aggregate_device *adev = to_aggregate_device(dev); + const struct aggregate_bus_find_data *data = _data; - list_for_each_entry(m, &aggregate_devices, node) - if (m->parent == parent && (!ops || m->ops == ops)) - return m; + if (adev->parent == data->parent && + (!data->ops || adev->ops == data->ops)) + return 1; - return NULL; + return 0; } static struct component *find_component(struct aggregate_device *adev, @@ -173,7 +189,6 @@ static int find_components(struct aggregate_device *adev) { struct component_match *match = adev->match; size_t i; - int ret = 0; /* * Scan the array of match functions and attach @@ -182,6 +197,7 @@ static int find_components(struct aggregate_device *adev) for (i = 0; i < match->num; i++) { struct component_match_array *mc = &match->compare[i]; struct component *c; + bool duplicate; dev_dbg(adev->parent, "Looking for component %zu\n", i); @@ -189,20 +205,27 @@ static int find_components(struct aggregate_device *adev) continue; c = find_component(adev, mc); - if (!c) { - ret = -ENXIO; - break; - } + if (!c) + return 0; + duplicate = !!c->adev; dev_dbg(adev->parent, "found component %s, duplicate %u\n", - dev_name(c->dev), !!c->adev); + dev_name(c->dev), duplicate); /* Attach this component to the adev */ - match->compare[i].duplicate = !!c->adev; + match->compare[i].duplicate = duplicate; match->compare[i].component = c; + if (duplicate) + continue; + + /* Matches put in component_del() */ + get_device(&adev->dev); + c->link = device_link_add(&adev->dev, c->dev, + DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME); c->adev = adev; } - return ret; + + return 1; } /* Detach component from associated aggregate_device */ @@ -216,73 +239,6 @@ static void remove_component(struct aggregate_device *adev, struct component *c) adev->match->compare[i].component = NULL; } -/* - * Try to bring up an aggregate device. If component is NULL, we're interested - * in this aggregate device, otherwise it's a component which must be present - * to try and bring up the aggregate device. - * - * Returns 1 for successful bringup, 0 if not ready, or -ve errno. - */ -static int try_to_bring_up_aggregate_device(struct aggregate_device *adev, - struct component *component) -{ - int ret; - - dev_dbg(adev->parent, "trying to bring up adev\n"); - - if (find_components(adev)) { - dev_dbg(adev->parent, "master has incomplete components\n"); - return 0; - } - - if (component && component->adev != adev) { - dev_dbg(adev->parent, "master is not for this component (%s)\n", - dev_name(component->dev)); - return 0; - } - - if (!devres_open_group(adev->parent, adev, GFP_KERNEL)) - return -ENOMEM; - - /* Found all components */ - ret = adev->ops->bind(adev->parent); - if (ret < 0) { - devres_release_group(adev->parent, NULL); - if (ret != -EPROBE_DEFER) - dev_info(adev->parent, "adev bind failed: %d\n", ret); - return ret; - } - - devres_close_group(adev->parent, NULL); - adev->bound = true; - return 1; -} - -static int try_to_bring_up_masters(struct component *component) -{ - struct aggregate_device *adev; - int ret = 0; - - list_for_each_entry(adev, &aggregate_devices, node) { - if (!adev->bound) { - ret = try_to_bring_up_aggregate_device(adev, component); - if (ret != 0) - break; - } - } - - return ret; -} - -static void take_down_aggregate_device(struct aggregate_device *adev) -{ - if (adev->bound) { - adev->ops->unbind(adev->parent); - devres_release_group(adev->parent, adev); - adev->bound = false; - } -} - static void devm_component_match_release(struct device *parent, void *res) { struct component_match *match = res; @@ -426,7 +382,6 @@ static void free_aggregate_device(struct aggregate_device *adev) int i; component_debugfs_del(adev); - list_del(&adev->node); if (match) { for (i = 0; i < match->num; i++) { @@ -436,9 +391,186 @@ static void free_aggregate_device(struct aggregate_device *adev) } } + ida_free(&aggregate_ida, adev->id); kfree(adev); } +static void aggregate_device_release(struct device *dev) +{ + struct aggregate_device *adev = to_aggregate_device(dev); + + free_aggregate_device(adev); +} + +static int aggregate_device_match(struct device *dev, struct device_driver *drv) +{ + const struct aggregate_driver *adrv = to_aggregate_driver(drv); + struct aggregate_device *adev = to_aggregate_device(dev); + int ret; + + /* Is this driver associated with this device */ + if (adrv != adev->adrv) + return 0; + + /* Should we start to assemble? */ + mutex_lock(&component_mutex); + ret = find_components(adev); + mutex_unlock(&component_mutex); + + return ret; +} + +/* TODO: Remove once all aggregate drivers use component_aggregate_register() */ +static int component_probe_bind(struct aggregate_device *adev) +{ + return adev->ops->bind(adev->parent); +} + +static void component_remove_unbind(struct aggregate_device *adev) +{ + adev->ops->unbind(adev->parent); +} + +static int aggregate_driver_probe(struct device *dev) +{ + const struct aggregate_driver *adrv = to_aggregate_driver(dev->driver); + struct aggregate_device *adev = to_aggregate_device(dev); + bool modern = adrv->probe != component_probe_bind; + int ret; + + /* Only do runtime PM when drivers migrate */ + if (modern) { + pm_runtime_get_noresume(dev); + pm_runtime_set_active(dev); + pm_runtime_enable(dev); + } + + mutex_lock(&component_mutex); + if (devres_open_group(adev->parent, adev, GFP_KERNEL)) { + ret = adrv->probe(adev); + if (ret) + devres_release_group(adev->parent, NULL); + } else { + ret = -ENOMEM; + } + devres_close_group(adev->parent, NULL); + mutex_unlock(&component_mutex); + + if (ret && modern) { + pm_runtime_disable(dev); + pm_runtime_set_suspended(dev); + pm_runtime_put_noidle(dev); + } + + return ret; +} + +static void aggregate_driver_remove(struct device *dev) +{ + const struct aggregate_driver *adrv = to_aggregate_driver(dev->driver); + struct aggregate_device *adev = to_aggregate_device(dev); + bool modern = adrv->remove != component_remove_unbind; + + /* Only do runtime PM when drivers migrate */ + if (modern) + pm_runtime_get_sync(dev); + adrv->remove(to_aggregate_device(dev)); + devres_release_group(adev->parent, adev); + if (!modern) + return; + + pm_runtime_put_noidle(dev); + + pm_runtime_disable(dev); + pm_runtime_set_suspended(dev); + pm_runtime_put_noidle(dev); +} + +static void aggregate_driver_shutdown(struct device *dev) +{ + const struct aggregate_driver *adrv = to_aggregate_driver(dev->driver); + + if (adrv && adrv->shutdown) + adrv->shutdown(to_aggregate_device(dev)); +} + +static struct bus_type aggregate_bus_type = { + .name = "aggregate", + .match = aggregate_device_match, + .probe = aggregate_driver_probe, + .remove = aggregate_driver_remove, + .shutdown = aggregate_driver_shutdown, +}; + +/* Callers take ownership of return value, should call put_device() */ +static struct aggregate_device *__aggregate_find(struct device *parent, + const struct component_master_ops *ops) +{ + struct device *dev; + struct aggregate_bus_find_data data = { + .ops = ops, + .parent = parent, + }; + + dev = bus_find_device(&aggregate_bus_type, NULL, &data, + aggregate_bus_find_match); + + return dev ? to_aggregate_device(dev) : NULL; +} + +static 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; + int ret, id; + + /* Reallocate the match array for its true size */ + ret = component_match_realloc(match, match->num); + if (ret) + return ERR_PTR(ret); + + adev = kzalloc(sizeof(*adev), GFP_KERNEL); + if (!adev) + return ERR_PTR(-ENOMEM); + + id = ida_alloc(&aggregate_ida, GFP_KERNEL); + if (id < 0) { + kfree(adev); + return ERR_PTR(id); + } + + adev->id = id; + adev->parent = parent; + adev->dev.bus = &aggregate_bus_type; + adev->dev.release = aggregate_device_release; + adev->ops = ops; + adev->match = match; + adev->adrv = adrv; + dev_set_name(&adev->dev, "aggregate%d", id); + + ret = device_register(&adev->dev); + if (ret) { + put_device(&adev->dev); + return ERR_PTR(ret); + } + + component_debugfs_add(adev); + + return adev; +} + /** * component_master_add_with_match - register an aggregate driver * @parent: parent device of the aggregate driver @@ -450,42 +582,70 @@ static void free_aggregate_device(struct aggregate_device *adev) * @match are available, it will be assembled by calling * &component_master_ops.bind from @ops. Must be unregistered by calling * component_master_del(). + * + * Deprecated: Use component_aggregate_register() instead. */ int component_master_add_with_match(struct device *parent, const struct component_master_ops *ops, struct component_match *match) { + struct aggregate_driver *adrv; struct aggregate_device *adev; - int ret; - - /* Reallocate the match array for its true size */ - ret = component_match_realloc(match, match->num); - if (ret) - return ret; + int ret = 0; - adev = kzalloc(sizeof(*adev), GFP_KERNEL); - if (!adev) + adrv = kzalloc(sizeof(*adrv), GFP_KERNEL); + if (!adrv) return -ENOMEM; - adev->parent = parent; - adev->ops = ops; - adev->match = match; + adev = aggregate_device_add(parent, ops, adrv, match); + if (IS_ERR(adev)) { + ret = PTR_ERR(adev); + goto err; + } - component_debugfs_add(adev); - /* Add to the list of available aggregate devices. */ - mutex_lock(&component_mutex); - list_add(&adev->node, &aggregate_devices); + adrv->probe = component_probe_bind; + adrv->remove = component_remove_unbind; + adrv->driver.owner = THIS_MODULE; + adrv->driver.name = dev_name(&adev->dev); - ret = try_to_bring_up_aggregate_device(adev, NULL); + ret = aggregate_driver_register(adrv); + if (!ret) + return 0; - if (ret < 0) - free_aggregate_device(adev); + put_device(&adev->dev); +err: + kfree(adrv); + return ret; +} +EXPORT_SYMBOL_GPL(component_master_add_with_match); - mutex_unlock(&component_mutex); +/** + * component_aggregate_register - register an aggregate driver + * @parent: parent device of the aggregate driver + * @adrv: aggregate driver to register + * + * Registers a new aggregate driver consisting of the components added to @adrv.match + * by calling one of the component_match_add() functions. Once all components in + * @match are available, the aggregate driver will be assembled by calling + * &adrv.bind. Must be unregistered by calling component_aggregate_unregister(). + */ +int component_aggregate_register(struct device *parent, + struct aggregate_driver *adrv, struct component_match *match) +{ + struct aggregate_device *adev; + int ret; + + adev = aggregate_device_add(parent, NULL, adrv, match); + if (IS_ERR(adev)) + return PTR_ERR(adev); - return ret < 0 ? ret : 0; + ret = aggregate_driver_register(adrv); + if (ret) + put_device(&adev->dev); + + return ret; } -EXPORT_SYMBOL_GPL(component_master_add_with_match); +EXPORT_SYMBOL_GPL(component_aggregate_register); /** * component_master_del - unregister an aggregate driver @@ -495,22 +655,60 @@ EXPORT_SYMBOL_GPL(component_master_add_with_match); * Unregisters an aggregate driver registered with * component_master_add_with_match(). If necessary the aggregate driver is first * disassembled by calling &component_master_ops.unbind from @ops. + * + * Deprecated: Use component_aggregate_unregister() instead. */ void component_master_del(struct device *parent, const struct component_master_ops *ops) { struct aggregate_device *adev; + struct aggregate_driver *adrv; + struct device_driver *drv; mutex_lock(&component_mutex); adev = __aggregate_find(parent, ops); + mutex_unlock(&component_mutex); + if (adev) { - take_down_aggregate_device(adev); - free_aggregate_device(adev); + drv = adev->dev.driver; + if (drv) { + adrv = to_aggregate_driver(drv); + aggregate_driver_unregister(adrv); + kfree(adrv); + } + + device_unregister(&adev->dev); } - mutex_unlock(&component_mutex); + put_device(&adev->dev); } EXPORT_SYMBOL_GPL(component_master_del); +/** + * component_aggregate_unregister - unregister an aggregate driver + * @parent: parent device of the aggregate driver + * @adrv: registered aggregate driver + * + * Unregisters an aggregate driver registered with + * component_aggregate_register(). If necessary the aggregate driver is first + * disassembled. + */ +void component_aggregate_unregister(struct device *parent, + struct aggregate_driver *adrv) +{ + struct aggregate_device *adev; + + mutex_lock(&component_mutex); + adev = __aggregate_find(parent, NULL); + mutex_unlock(&component_mutex); + + if (adev) + device_unregister(&adev->dev); + put_device(&adev->dev); + + aggregate_driver_unregister(adrv); +} +EXPORT_SYMBOL_GPL(component_aggregate_unregister); + static void component_unbind(struct component *component, struct aggregate_device *adev, void *data) { @@ -551,6 +749,8 @@ void component_unbind_all(struct device *parent, void *data) c = adev->match->compare[i].component; component_unbind(c, adev, data); } + + put_device(&adev->dev); } EXPORT_SYMBOL_GPL(component_unbind_all); @@ -645,6 +845,7 @@ int component_bind_all(struct device *parent, void *data) component_unbind(c, adev, data); } } + put_device(&adev->dev); return ret; } @@ -668,18 +869,22 @@ static int __component_add(struct device *dev, const struct component_ops *ops, mutex_lock(&component_mutex); list_add_tail(&component->node, &component_list); - - ret = try_to_bring_up_masters(component); - if (ret < 0) { - if (component->adev) - remove_component(component->adev, component); - list_del(&component->node); - - kfree(component); - } mutex_unlock(&component_mutex); - return ret < 0 ? ret : 0; + /* + * Try to bind. + * + * Note: we don't check the return value here because component devices + * don't care that the aggregate device can actually probe or not. They + * only care about adding themselves to the component_list and then + * waiting for their component_ops::bind_component callback to be + * called. + */ + ret = bus_rescan_devices(&aggregate_bus_type); + if (ret) + dev_dbg(dev, "rescan returned %d\n", ret); + + return 0; } /** @@ -743,6 +948,7 @@ EXPORT_SYMBOL_GPL(component_add); */ void component_del(struct device *dev, const struct component_ops *ops) { + struct aggregate_device *adev = NULL; struct component *c, *component = NULL; mutex_lock(&component_mutex); @@ -754,13 +960,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 Thu Jan 6 21:45:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705764 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCD6CC433F5 for ; Thu, 6 Jan 2022 21:46:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244479AbiAFVqM (ORCPT ); Thu, 6 Jan 2022 16:46:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244427AbiAFVqE (ORCPT ); Thu, 6 Jan 2022 16:46:04 -0500 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 186E5C061212 for ; Thu, 6 Jan 2022 13:46:04 -0800 (PST) Received: by mail-pj1-x102d.google.com with SMTP id l16-20020a17090a409000b001b2e9628c9cso4537929pjg.4 for ; Thu, 06 Jan 2022 13:46:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+OZEUzbJkhEl2ueO+0tubjfHfZwZ/3lRZTTLw8nIUe4=; b=QdNjIAobt/derYc6c3Gs9KGKe+gcE2F48axRhJXhDfWd037tfkRhiOvU+6INALe1xW l0X9pnu/3HJXfqPLowTbh129vmKQPv4Yba8RdqPUG4CGzbjJgcRNO4VLW6C4/gLrecXc hkmq4B3C/LNmQfiTrtbuw0RBZRXj4anmUvV3k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+OZEUzbJkhEl2ueO+0tubjfHfZwZ/3lRZTTLw8nIUe4=; b=PNpYp9FAl1N55Z24jzLaFG9SCkezfVS9EkEkm1/TU5ovMX9dtrmKNrIxzaVyI8iViz EVA9jccahsp5SXf6c78S8bYATuUDhwDJWntJS6HrbYzhwNTR9qqbElqleVqf3Wz3pJSC ZJNxoTeMoMUZYgbV2CNiWhy0hO5J3NM4LHQ+4h9I2mI2xsCKOz84Nif19qCvNY2oJFkH gkOLaTzExpcisKPb6fXm5uRw2+xhpQoHvXMdjMjRU9crTmkRGaT1Nd6kXwVPr1ww3bIQ yD57Frbd3Rx8egzX4BeMFbRZWHjRMYb8zcTQk2idVN4lkq+zMZiun27BdtlgVYtt7nBq laZQ== X-Gm-Message-State: AOAM532Nll6+QyOXBmH6x0SNJ9anQWfdXVURkwqQTa+JHA87Pq5Izd5G a7++dZL4+bBw987OYi/siOfDyQ== X-Google-Smtp-Source: ABdhPJx2Rn+if/ljePBBBfU5FyTBFf4xXawEJ++3znnA8VPOwm/9Zu1BwYB/KNJZYwq/dJQOifJsIA== X-Received: by 2002:a17:90b:384a:: with SMTP id nl10mr12390792pjb.203.1641505563694; Thu, 06 Jan 2022 13:46:03 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:03 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Daniel Vetter , Laurent Pinchart , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 03/32] component: Move struct aggregate_device out to header file Date: Thu, 6 Jan 2022 13:45:26 -0800 Message-Id: <20220106214556.2461363-4-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org This allows aggregate driver writers to use the device passed to their probe/remove/shutdown functions properly instead of treating it as an opaque pointer. Cc: Daniel Vetter Cc: Greg Kroah-Hartman Cc: Laurent Pinchart Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/base/component.c | 15 --------------- include/linux/component.h | 19 ++++++++++++++++--- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index eec82caeae5e..dc38a8939ae6 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -56,21 +56,6 @@ struct component_match { struct component_match_array *compare; }; -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 Thu Jan 6 21:45:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705765 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F27DC43217 for ; Thu, 6 Jan 2022 21:46:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244489AbiAFVqN (ORCPT ); Thu, 6 Jan 2022 16:46:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244435AbiAFVqH (ORCPT ); Thu, 6 Jan 2022 16:46:07 -0500 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8DADC034001 for ; Thu, 6 Jan 2022 13:46:06 -0800 (PST) Received: by mail-pl1-x62f.google.com with SMTP id p14so3417960plf.3 for ; Thu, 06 Jan 2022 13:46:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wHTGmIfG7F9SDIRewz7zNR4I/bW/soPNx1fVWL7SSqg=; b=jYXk75wBy5JTKs0io9za+IJePm5iRhd7PFw86GocJ/ZOIe8Q6PyOQEn/CB2Cc+TLm3 2ZhD/R0KNvDY8/P18/zqcaiUA0Yx/ifq5S5qwkg8S+P1l8gL0SUCzPhIdPJk901WtDca M3+Gli2Px1dUVedOgR1fVqZIO2cdFooC+y2hk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wHTGmIfG7F9SDIRewz7zNR4I/bW/soPNx1fVWL7SSqg=; b=J9ZkU3BLWKnYDs/MCIGdIf3MVO0LTSYM6uPEa2zD7nvfCsMwO9DspGFQejKwTKFDbK t7/PfzxKD6jG8MmKikuaMyJtewCzVwqUUjc+fv1Z2q/NjszDnRmhvBGnGy2dNvwxayXi YKWY1LqJfVV3sGkIidbyqmLpcHArYMhuXau/3MaqkTmUAb7/7Bx5inv+Sky5UIAQfjCC JV8FosbYHQjeMOCLkhAxIUaQYhJ4fFrFP6ZCqXgf3vFLF1ISs0xqq6Od8uw2vdrZtCOo PHNezz7lY166LggSJhChXF2jeYG3d3i39dxFFrryPlJ2/6z4xe461No2W8Xk85NicI9E s98Q== X-Gm-Message-State: AOAM533IlBX8z8gSoHY2GiHCYZELv3pb90qjvFJqGmu230qxE86DLZqu 76LjhzRz67JqI9+iBH+Ivstljw== X-Google-Smtp-Source: ABdhPJyrZfgLqySabEnQeFQoN6950iKcXddByevHgRq0wc/gtN1aTk6rss1QjaXFw4vTw780Dtn9OQ== X-Received: by 2002:a17:902:7681:b0:149:bb15:c53f with SMTP id m1-20020a170902768100b00149bb15c53fmr21842657pll.159.1641505564986; Thu, 06 Jan 2022 13:46:04 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:04 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Daniel Vetter , Daniel Vetter , Laurent Pinchart , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 04/32] component: Add {bind,unbind}_component() ops that take aggregate device Date: Thu, 6 Jan 2022 13:45:27 -0800 Message-Id: <20220106214556.2461363-5-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org We'd like to get more device model features in the component framework so let's pass the struct aggregate_device pointer instead of the parent device pointer to the component binding functions. This will allow drivers to inspect and control things related to the aggregate device in case they need it, and they'll always be able to get back to the device they were using before by using the 'parent' member of the aggregate device struct. Suggested-by: Daniel Vetter Cc: Daniel Vetter Cc: Greg Kroah-Hartman Cc: Laurent Pinchart Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/base/component.c | 14 +++++++++++--- include/linux/component.h | 22 ++++++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index dc38a8939ae6..e9e58b56cda4 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -699,8 +699,13 @@ static void component_unbind(struct component *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 */ @@ -765,7 +770,10 @@ static int component_bind(struct component *component, struct aggregate_device * dev_dbg(adev->parent, "binding %s (ops %ps)\n", dev_name(component->dev), component->ops); - 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 Thu Jan 6 21:45:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705766 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4267C4332F for ; Thu, 6 Jan 2022 21:46:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244448AbiAFVqO (ORCPT ); Thu, 6 Jan 2022 16:46:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244416AbiAFVqH (ORCPT ); Thu, 6 Jan 2022 16:46:07 -0500 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A706AC0611FF for ; Thu, 6 Jan 2022 13:46:06 -0800 (PST) Received: by mail-pf1-x430.google.com with SMTP id v13so3593420pfi.3 for ; Thu, 06 Jan 2022 13:46:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pT87OQ3egRwLpYLDnQ//DolOVTqHrwpGRKkmvVo/d+g=; b=ZY+Nh2Jaf/gEt7FazNbuSiJJOpmRXaMrnwnXMY++Gzp8bEiutUOA/xuGgWKH0w3FNj OvuDFllSXCjoLNf40OxYW+uizrfamdf3bQ+OYVFx0fzfZrEfHW/TAxdJRkypJSwOilex jGG6Y4vrFV0UEo7xUu1iVTyCivDxwO9Qeze5U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pT87OQ3egRwLpYLDnQ//DolOVTqHrwpGRKkmvVo/d+g=; b=D8Bl1ZbJxmkir1yrWk662zWoaFjaO6Sp1TmInkG30hDtp1hdVSrnY/y5qsFSvCSBTx k7pLiRQVKzaSw8wyalUn+Z/9lDTu874j0yzKhoAQHxxhjE9teErD5SP9KNOTBU2XfYGm Nqjs7LwIzCmjQLWW95ayuMS+U0B76fP7XvbqB8f8bQnrsIp8vnhCzNi6VsTMknZDO54W 2Em9DQy8Omr5oHeKMN6B2fCfXrEjfb6ZsDW+67QtHuzz++kLMnPcDB6RWlKiDdDxy30U WhVICtjTv0puQR+e4PRftDn+yHKt2sG31n1YvYYSy3xD82FJD+N4n5fr1KxaeIErWTU9 kZ6A== X-Gm-Message-State: AOAM531MTgfg5dUUznQdhzi5qQZBnG3SRl8gYP0IS947/4g4VRLSiPQL diDzbksGBsdbsXfkpPkJPMQxXw== X-Google-Smtp-Source: ABdhPJw5gtA5umryoXrWlTZ0DfdJiTAJSoZT5EbxDy0C+cY+TwaU7Ljz9BCSoRQeGO2Yx2fucyE3cg== X-Received: by 2002:a05:6a00:2304:b0:4ba:4cbb:8289 with SMTP id h4-20020a056a00230400b004ba4cbb8289mr61476292pfh.79.1641505566182; Thu, 06 Jan 2022 13:46:06 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:05 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Laurent Pinchart , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 05/32] drm/of: Add a drm_of_aggregate_probe() API Date: Thu, 6 Jan 2022 13:45:28 -0800 Message-Id: <20220106214556.2461363-6-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Similar to drm_of_component_probe() but using the new API that registers a driver instead of an ops struct. This allows us to migrate the users of drm_of_component_probe() to the new way of doing things. Cc: Laurent Pinchart Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/drm_of.c | 85 +++++++++++++++++++++++++++++++--------- include/drm/drm_of.h | 12 ++++++ 2 files changed, 78 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 37c34146eea8..008d6b7d2283 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -99,30 +99,18 @@ void drm_of_component_match_add(struct device *master, } EXPORT_SYMBOL_GPL(drm_of_component_match_add); -/** - * drm_of_component_probe - Generic probe function for a component based master - * @dev: master device containing the OF node - * @compare_of: compare function used for matching components - * @m_ops: component master ops to be used - * - * Parse the platform device OF node and bind all the components associated - * with the master. Interface ports are added before the encoders in order to - * satisfy their .bind requirements - * See Documentation/devicetree/bindings/graph.txt for the bindings. - * - * Returns zero if successful, or one of the standard error codes if it fails. - */ -int drm_of_component_probe(struct device *dev, +static int _drm_of_component_probe(struct device *dev, int (*compare_of)(struct device *, void *), - const struct component_master_ops *m_ops) + struct component_match **matchptr) { struct device_node *ep, *port, *remote; - struct component_match *match = NULL; int i; if (!dev->of_node) return -EINVAL; + *matchptr = NULL; + /* * Bind the crtc's ports first, so that drm_of_find_possible_crtcs() * called from encoder's .bind callbacks works as expected @@ -133,7 +121,7 @@ int drm_of_component_probe(struct device *dev, break; if (of_device_is_available(port->parent)) - drm_of_component_match_add(dev, &match, compare_of, + drm_of_component_match_add(dev, matchptr, compare_of, port); of_node_put(port); @@ -144,7 +132,7 @@ int drm_of_component_probe(struct device *dev, return -ENODEV; } - if (!match) { + if (!*matchptr) { dev_err(dev, "no available port\n"); return -ENODEV; } @@ -174,17 +162,76 @@ int drm_of_component_probe(struct device *dev, continue; } - drm_of_component_match_add(dev, &match, compare_of, + drm_of_component_match_add(dev, matchptr, compare_of, remote); of_node_put(remote); } of_node_put(port); } + return 0; +} + +/** + * drm_of_component_probe - Generic probe function for a component based master + * @dev: master device containing the OF node + * @compare_of: compare function used for matching components + * @m_ops: component master ops to be used + * + * Parse the platform device OF node and bind all the components associated + * with the master. Interface ports are added before the encoders in order to + * satisfy their .bind requirements + * See Documentation/devicetree/bindings/graph.txt for the bindings. + * + * Deprecated: Use drm_of_aggregate_probe() instead. + * + * Returns zero if successful, or one of the standard error codes if it fails. + */ +int drm_of_component_probe(struct device *dev, + int (*compare_of)(struct device *, void *), + const struct component_master_ops *m_ops) +{ + + struct component_match *match; + int ret; + + ret = _drm_of_component_probe(dev, compare_of, &match); + if (ret) + return ret; + return component_master_add_with_match(dev, m_ops, match); } EXPORT_SYMBOL(drm_of_component_probe); + +/** + * drm_of_aggregate_probe - Generic probe function for a component based aggregate host + * @dev: device containing the OF node + * @compare_of: compare function used for matching components + * @adrv: aggregate driver to be used + * + * Parse the platform device OF node and bind all the components associated + * with the aggregate device. Interface ports are added before the encoders in + * order to satisfy their .bind_component requirements + * See Documentation/devicetree/bindings/graph.txt for the bindings. + * + * Returns zero if successful, or one of the standard error codes if it fails. + */ +int drm_of_aggregate_probe(struct device *dev, + int (*compare_of)(struct device *, void *), + struct aggregate_driver *adrv) +{ + struct component_match *match; + int ret; + + ret = _drm_of_component_probe(dev, compare_of, &match); + if (ret) + return ret; + + return component_aggregate_register(dev, adrv, match); +} +EXPORT_SYMBOL(drm_of_aggregate_probe); + /* * drm_of_encoder_active_endpoint - return the active encoder endpoint * @node: device tree node containing encoder input ports diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h index b9b093add92e..9d35a141f888 100644 --- a/include/drm/drm_of.h +++ b/include/drm/drm_of.h @@ -7,6 +7,7 @@ #include #endif +struct aggregate_driver; struct component_master_ops; struct component_match; struct device; @@ -40,6 +41,9 @@ void drm_of_component_match_add(struct device *master, int drm_of_component_probe(struct device *dev, int (*compare_of)(struct device *, void *), const struct component_master_ops *m_ops); +int drm_of_aggregate_probe(struct device *dev, + int (*compare_of)(struct device *, void *), + struct aggregate_driver *adrv); int drm_of_encoder_active_endpoint(struct device_node *node, struct drm_encoder *encoder, struct of_endpoint *endpoint); @@ -78,6 +82,14 @@ drm_of_component_probe(struct device *dev, return -EINVAL; } +static inline int +drm_of_aggregate_probe(struct device *dev, + int (*compare_of)(struct device *, void *), + struct aggregate_driver *adrv) +{ + return -EINVAL; +} + static inline int drm_of_encoder_active_endpoint(struct device_node *node, struct drm_encoder *encoder, struct of_endpoint *endpoint) From patchwork Thu Jan 6 21:45:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705767 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74756C43219 for ; Thu, 6 Jan 2022 21:46:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244482AbiAFVqP (ORCPT ); Thu, 6 Jan 2022 16:46:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244440AbiAFVqI (ORCPT ); Thu, 6 Jan 2022 16:46:08 -0500 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E20D7C06118C for ; Thu, 6 Jan 2022 13:46:07 -0800 (PST) Received: by mail-pj1-x1036.google.com with SMTP id ie13so3571977pjb.1 for ; Thu, 06 Jan 2022 13:46:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MLFo5uJ88/q78BTGkhEJmKSkKMysd8HwfQglPXTN2wU=; b=nglDE8QY9t5hdSAJx4+V4q37ClBOabpxxFLIHDIl6b0J46Y4aM7i5LRT8JyqwRd/GR /dlRGYshMif/788W7Cbe1ePX91QrDYEuSqLmhtUQ/Rn7UEuXvBeE28dA6qmUpch4oWe1 /663ZKSP2KxNRXEUAPmX2A93rjrDVp/KOHSKI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MLFo5uJ88/q78BTGkhEJmKSkKMysd8HwfQglPXTN2wU=; b=pxltPkJObkGpARyd2GtHwGSpGn+kDbLdWoLJEvJKj3dqx97r9oaUo/yj5u9bMd82Rc 2ZqG5eZ/inV41tCPRZGmErTEr5YqlgPIA1/x1o7XriJhPL1rs5zSo7WvCBmKISQqM81b lSHkFXcvAxj1BZ3JqCaZiPomwGk9qkXDOA+/2kyXSvGwntz3G0RuXa9WlrsTS7m79fz7 QvN8yhiK8gsN+EwNSNTBzQzkMGekOZcr2beW1twqnhnxh1zEHd3kE0yCcFsJzGHJBKpQ r+jt+sQJJKaFJ5xiKx0cJjrj+bJg+7vAVm/00NJ5TIxsRT96eviAHizx8i3D1IJx7KrV thiA== X-Gm-Message-State: AOAM530zVd7CM40sX5SHqKVyw1vmNHYocOmhQSQJ15uv+88HsSc/ydEn t2WZ21sRmzJJMlhBMvvN3EQF3A== X-Google-Smtp-Source: ABdhPJxKPNiQbLhCjMWfO6s24aaY/aGv9aYyqnVU0SdXtFDVXaiu2l9rIuGYklh4MYLASJomWl2L2Q== X-Received: by 2002:a17:90b:3ece:: with SMTP id rm14mr12322633pjb.6.1641505567437; Thu, 06 Jan 2022 13:46:07 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:07 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 06/32] drm/msm: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:29 -0800 Message-Id: <20220106214556.2461363-7-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The device lists are poorly ordered when the component device code is used. This is because component_master_add_with_match() returns 0 regardless of component devices calling component_add() first. It can really only fail if an allocation fails, in which case everything is going bad and we're out of memory. The driver that registers the aggregate driver, can succeed at probe and put the attached device on the DPM lists before any of the component devices are probed and put on the lists. Within the component device framework this usually isn't that bad because the real driver work is done at bind time via component{,master}_ops::bind(). It becomes a problem when the driver core, or host driver, wants to operate on the component device outside of the bind/unbind functions, e.g. via 'remove' or 'shutdown'. The driver core doesn't understand the relationship between the host device and the component devices and could possibly try to operate on component devices when they're already removed from the system or shut down. Normally, device links or probe defer would reorder the lists and put devices that depend on other devices in the lists at the correct location, but with component devices this doesn't happen because this information isn't expressed anywhere. Drivers simply succeed at registering their component or the aggregate driver with the component framework and wait for their bind() callback to be called once the other components are ready. In summary, the drivers that make up the aggregate driver can probe in any order. This ordering problem becomes fairly obvious when shutting down the device with a DSI controller connected to a DSI bridge that is controlled via i2c. In this case, the msm display driver wants to tear down the display pipeline on shutdown via msm_pdev_shutdown() by calling drm_atomic_helper_shutdown(), and it can't do that unless the whole display chain is still probed and active in the system. When a display bridge is on i2c, the i2c device for the bridge will be created whenever the i2c controller probes, which could be before or after the msm display driver probes. If the i2c controller probes after the display driver, then the i2c controller will be shutdown before the display controller during system wide shutdown and thus i2c transactions will stop working before the display pipeline is shut down. This means we'll have the display bridge trying to access an i2c bus that's shut down because drm_atomic_helper_shutdown() is trying to disable the bridge after the bridge is off. The solution is to make the aggregate driver into a real struct driver that is bound to a device when the other component devices have all probed. Now that the component driver code is a proper bus, we can simply register an aggregate driver with that bus via component_aggregate_register() and then attach the shutdown hook to that driver to be sure that the shutdown for the display pipeline is called before any of the component device driver shutdown hooks are called. Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/msm/msm_drv.c | 46 +++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 7936e8d498dd..f6e9b0d318f5 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -1360,19 +1360,35 @@ static int add_gpu_components(struct device *dev, return 0; } -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, + }, }; /* @@ -1401,7 +1417,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; @@ -1414,23 +1430,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 }, @@ -1446,7 +1451,6 @@ MODULE_DEVICE_TABLE(of, dt_match); static struct platform_driver msm_platform_driver = { .probe = msm_pdev_probe, .remove = msm_pdev_remove, - .shutdown = msm_pdev_shutdown, .driver = { .name = "msm", .of_match_table = dt_match, From patchwork Thu Jan 6 21:45:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705768 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7760DC433F5 for ; Thu, 6 Jan 2022 21:46:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244506AbiAFVqP (ORCPT ); Thu, 6 Jan 2022 16:46:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244454AbiAFVqJ (ORCPT ); Thu, 6 Jan 2022 16:46:09 -0500 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13035C034005 for ; Thu, 6 Jan 2022 13:46:09 -0800 (PST) Received: by mail-pf1-x429.google.com with SMTP id p37so3593480pfh.4 for ; Thu, 06 Jan 2022 13:46:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QdKC3RDnWMeVhqBKuTAcfq/eZBHYEe2Kb+X7ix5SdpY=; b=IcaBfWVygHDNB6C8LkFxsWDgsRiQvHr6RF8HBCSc8kKeIzuGmKt6X6QMGLS4D8+pBO irbkBZrK9VdODT76096dKX1fUVhxrt6DZfbKHR2KJbI2wpIcsg4+hotoJ66bXLb8rWfq QM+viogiXHi5P8VefoPXVvE8N/Cic8ZmjsZKc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QdKC3RDnWMeVhqBKuTAcfq/eZBHYEe2Kb+X7ix5SdpY=; b=N3dNpdBkR0Qvo+DbNKDCj49I5/H1wrzjV7WsGa9+KKmmulK1yh5VN7tUgSsLBrAM18 RKLohEt9gN0T32pqGLXl0sAwdiOznoo6iNC8V9USZUJ62eJysU5F/CFsZafMw9heommm IxuBKuen9HPeRUw/Du295Ex0jAUVr4CZfz2Y3O0GNo6+sz9u3bAIRcIZWogA6WtGcsAh 69gB5lmMx/Gk3K2jwuNvhgwbRSExXBA+AU/DW739mhD8htnatzcpreonkbPGaVV/xXPM WwhR3zeLyuVvCLu5z6+twPM0w7roRK5djSy9+XdiFcOauzGPlI7qpUkqpbqRakmlhk7m Jyuw== X-Gm-Message-State: AOAM532Kv1cOVW63WhJom9KOnctcmWQSMfaHaXjvb9MHJhsyRN8GaNT7 Ocw7TtLErF+QiFP3ubt+S6vfQA== X-Google-Smtp-Source: ABdhPJxWvdamkm9BbUfP5bbx8cClxJTqWYMaUw5Takg8Yhy/ubQOstHCKsaqxVAG6NtjkwEGXyIWHw== X-Received: by 2002:a65:5589:: with SMTP id j9mr54673150pgs.119.1641505568659; Thu, 06 Jan 2022 13:46:08 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:08 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, James Qian Wang , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 07/32] drm/komeda: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:30 -0800 Message-Id: <20220106214556.2461363-8-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: James Qian Wang (Arm Technology China) Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- .../gpu/drm/arm/display/komeda/komeda_drv.c | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c index e7933930a657..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 Thu Jan 6 21:45:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705776 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC444C4321E for ; Thu, 6 Jan 2022 21:46:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244508AbiAFVq3 (ORCPT ); Thu, 6 Jan 2022 16:46:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244462AbiAFVqK (ORCPT ); Thu, 6 Jan 2022 16:46:10 -0500 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B018C061245 for ; Thu, 6 Jan 2022 13:46:10 -0800 (PST) Received: by mail-pf1-x42c.google.com with SMTP id 205so3641854pfu.0 for ; Thu, 06 Jan 2022 13:46:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=udX8aXVKtCgorZpoo7KBRMV9fl84l0zJ44mq5nPYnXQ=; b=Ya34FDKNKfvN1GQNsIj3/YHoOtnFnJomMP0x3sM6wb4AAXA5x9zxx14WIoBs2wHRpl 5mmvuYveL7LaSK9Yk07qPV6mwXvVreJp+RooagLKp0wjaY/HM5JCJP3uneRREyTMpbKx FmHW9pECA68YpJ3Xkz0I+ztn1d48xxPPPMBZs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=udX8aXVKtCgorZpoo7KBRMV9fl84l0zJ44mq5nPYnXQ=; b=OK2pBZAWViFV6kvoXNy5n/R2C2BDm2rBJJp62mHuIL1y+nV2U8ACt3Wd+IvdYzdiqI ckHlFg+I51B26HnHQCjhzzqTE3l6T2Q+9tdGvt1XSL/3Ws+9xct6G5XPc8kDTycaPaYi +jj4DN2ZnIjwBiPBii3ZnDPy/aBelXgxTacOawpByB1cPozkMHuhd3LjW9bmfjvtQRij GcB1jjJeHe1b8zJUpThTUhlFfk9EG1Y7qQ1+bpNec9i+sdgZyaxcEqsKatoiK7bnK4MT sxappXLGm/THC4MzKMuWT6ElxXI3w6vf7q7H3sbsnv7HL/kPFs5liH2FrH/L/sbAV2Fs qkVA== X-Gm-Message-State: AOAM531nbuDv5sVPLuwO+Rj/FkUJyQJmIVfpEKwH7EBehybhnQFma2CG Tgg5dYe/n0UwekK2v9bOmyJZ4Q== X-Google-Smtp-Source: ABdhPJwqM87G59xgRPi2C4DOO/wTX46XQXKwKNWtQf+08DlJeYiicq+R6L9sPwm8+CM6PygK176Kkw== X-Received: by 2002:a63:b20f:: with SMTP id x15mr16095753pge.82.1641505569883; Thu, 06 Jan 2022 13:46:09 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:09 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Liviu Dudau , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 08/32] drm/arm/hdlcd: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:31 -0800 Message-Id: <20220106214556.2461363-9-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Liviu Dudau Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/arm/hdlcd_drv.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c index 479c2422a2e0..5c03eb98d814 100644 --- a/drivers/gpu/drm/arm/hdlcd_drv.c +++ b/drivers/gpu/drm/arm/hdlcd_drv.c @@ -270,8 +270,9 @@ static const struct drm_driver hdlcd_driver = { .minor = 0, }; -static int hdlcd_drm_bind(struct device *dev) +static int hdlcd_drm_bind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct drm_device *drm; struct hdlcd_drm_private *hdlcd; int ret; @@ -344,8 +345,9 @@ static int hdlcd_drm_bind(struct device *dev) return ret; } -static void hdlcd_drm_unbind(struct device *dev) +static void hdlcd_drm_unbind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct drm_device *drm = dev_get_drvdata(dev); struct hdlcd_drm_private *hdlcd = drm->dev_private; @@ -367,9 +369,13 @@ static void hdlcd_drm_unbind(struct device *dev) drm_dev_put(drm); } -static const struct component_master_ops hdlcd_master_ops = { - .bind = hdlcd_drm_bind, - .unbind = hdlcd_drm_unbind, +static struct aggregate_driver hdlcd_aggregate_driver = { + .probe = hdlcd_drm_bind, + .remove = hdlcd_drm_unbind, + .driver = { + .name = "hdlcd_drm", + .owner = THIS_MODULE, + }, }; static int compare_dev(struct device *dev, void *data) @@ -390,13 +396,12 @@ static int hdlcd_probe(struct platform_device *pdev) drm_of_component_match_add(&pdev->dev, &match, compare_dev, port); of_node_put(port); - return component_master_add_with_match(&pdev->dev, &hdlcd_master_ops, - match); + return component_aggregate_register(&pdev->dev, &hdlcd_aggregate_driver, match); } static int hdlcd_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &hdlcd_master_ops); + component_aggregate_unregister(&pdev->dev, &hdlcd_aggregate_driver); return 0; } From patchwork Thu Jan 6 21:45:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705772 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BC60C433FE for ; Thu, 6 Jan 2022 21:46:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244440AbiAFVqQ (ORCPT ); Thu, 6 Jan 2022 16:46:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244475AbiAFVqN (ORCPT ); Thu, 6 Jan 2022 16:46:13 -0500 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB04CC0611FD for ; Thu, 6 Jan 2022 13:46:11 -0800 (PST) Received: by mail-pj1-x1029.google.com with SMTP id g11-20020a17090a7d0b00b001b2c12c7273so5406401pjl.0 for ; Thu, 06 Jan 2022 13:46:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tyFhWuo5Hgtey/EJ0ER9SojRROyEQ1lmEqqEKYabFj8=; b=LLJLmS+EadBgDQ+Aos6iptCIFgGQZC4BhHifui4nHYr+soQbQCsuRZf8eUfhEXakUF dCR3ZG3GODKgQD6iIPo9rc4CpzlKlxMLQQeuKOmYu2NLvK1RZzv62Y8acfrUkVf786px 6GNKOfhOa4RrRJZPK8de4dHA9uZuSsO3EcRSE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tyFhWuo5Hgtey/EJ0ER9SojRROyEQ1lmEqqEKYabFj8=; b=FAq8rzE4LiLX6K8xJ7sJWvYxsBTp+mWksJSs26+RNpAOxo2CW+BZHAKdR5Z3emRDnJ hLBi97xqu3Qi95J1pZIf+TIllMjexUIBRJB66Le4JQT9Jp8qKWimwKh+6q/+/OabZO0i tjaNTI6IEffonHaX1QBoVxnCPMwZ7Ga2h5+/YiG2q/Q7GpPlJeEAoTr1fUfTIrMJJsDz fXIwvQEGCPKli9vFhnJgXnbYIp5VMCjddDPGX8Tc1i7nltwlJNOm9wPRwPdTEyRzpeAf moNL39vFUYUIW4IX8GT5kCfp0J4Foy404PJQpvHmx+aMeSmITmbCeHND+gQr3i/AUyGS 1vSw== X-Gm-Message-State: AOAM530rkQSD+rzQSGN3msf5uHfaVjST6on2eKK6O8UUr8ui3Ewltatp ApRTRN4080PQNn6oW+z5Hb1KwA== X-Google-Smtp-Source: ABdhPJyyF7cPL+yI9hyzDjsYLKeK8/7opWbfS9Q9aFqPjk9CLzLHOaxee/DCuNvQMK+M3j2T3mtM3A== X-Received: by 2002:a17:90b:3143:: with SMTP id ip3mr12288271pjb.58.1641505571119; Thu, 06 Jan 2022 13:46:11 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:10 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Laurent Pinchart , Liviu Dudau , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 09/32] drm/malidp: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:32 -0800 Message-Id: <20220106214556.2461363-10-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. TODO: This can be updated to move the drm helper logic into the aggregate driver shutdown op. Cc: Laurent Pinchart Cc: Liviu Dudau Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/arm/malidp_drv.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c index 78d15b04b105..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 Thu Jan 6 21:45:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705769 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFD61C433EF for ; Thu, 6 Jan 2022 21:46:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244514AbiAFVqS (ORCPT ); Thu, 6 Jan 2022 16:46:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244485AbiAFVqN (ORCPT ); Thu, 6 Jan 2022 16:46:13 -0500 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCBD0C034007 for ; Thu, 6 Jan 2022 13:46:12 -0800 (PST) Received: by mail-pg1-x52a.google.com with SMTP id g22so3746950pgn.1 for ; Thu, 06 Jan 2022 13:46:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=g366T6z/wDv+u0z2UhkHLqZZ67YI06zaB4um2FhnwRI=; b=hMzRCsm85BzTseZgCckSwAtxGaQ6AwGKmpMBLS/VovB3h2UykhAOfX8IJg4bI+Przl +hVQ4fMopnz0l091lu3Xx9mRGBiLNG23xThYMrNM8Ofdiw6LWwc/hI+hwty7lC7UtgNN OqQ0vT+Q4Q1vqf95QgPtaETz8S+UHWY6u4ZlA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=g366T6z/wDv+u0z2UhkHLqZZ67YI06zaB4um2FhnwRI=; b=5k4JJpPSIE6/1gTpbBltSj4DSNVX6SBJDTVkrN7syhm2QB0x5Yrpl3tzyEnt3DYE4W dAf2T1crihyXrers4qyMt7cIJx80YvViKXm/H8Cc7gKAfMpeCSrblXomLuYW7bPOQd9g oi3BYytEH4YJnT82T8V6hpQ08Rp4Fkje1n+r1h9ZKkuwWRIQ7BS//ud8qqGjVa2pTQbO NgkeQhafG+Cq5ZGUWGGp+MxyhOmSdT6+qmwUjLsLAIfvTKKcpnfXDJ4JyBBXMIepoBww VKL1IN3IecB2w1yUpTbkXOobdyZ9/n+oxyDpBqzd7mOwE++7mvtmCZtS7LoCTjigy3mL mNXg== X-Gm-Message-State: AOAM530cdsepNeNWr1CIuPSfx8hx+cxDmdX4ZlV9USaZoOYi9yrj6Gjc SmLBE08vMXixYzW9MpOdtpG6eQ== X-Google-Smtp-Source: ABdhPJyLrhaeJQJp2viy5oBwJ2SLs74cYyQ+2SgkPuLbpAA6wOupAp3ggrLPzlQxYpAOTb8xeL3g8w== X-Received: by 2002:a63:7110:: with SMTP id m16mr38503368pgc.621.1641505572311; Thu, 06 Jan 2022 13:46:12 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:12 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Russell King , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Saravana Kannan Subject: [PATCH v5 10/32] drm/armada: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:33 -0800 Message-Id: <20220106214556.2461363-11-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Russell King Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/armada/armada_drv.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c index 8e3e98f13db4..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 Thu Jan 6 21:45:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705770 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E343FC4332F for ; Thu, 6 Jan 2022 21:46:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244512AbiAFVqR (ORCPT ); Thu, 6 Jan 2022 16:46:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244424AbiAFVqO (ORCPT ); Thu, 6 Jan 2022 16:46:14 -0500 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02DAEC061201 for ; Thu, 6 Jan 2022 13:46:14 -0800 (PST) Received: by mail-pj1-x1034.google.com with SMTP id rj2-20020a17090b3e8200b001b1944bad25so4540329pjb.5 for ; Thu, 06 Jan 2022 13:46:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NsjwfsQuiDMEQ+TXne3j17pwDv7xto97Rnhld6OcLgM=; b=UfX8IpxE7Xm8m0THPaEOlj7kVL2i9xBXvepNNTPjRZ4zlKvYKJEDRvcbsFMFQ/irYV 5Bf5aVv5JZ7qUuUqHXTUO8t1mGACN+ojn2ZDY0bM3Mg0eKxbkx7xhxdycW9FfTTWdHZo 3UM63Knx5hZTA/deRQPpqN0cu4ZGbjK9i0N+s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NsjwfsQuiDMEQ+TXne3j17pwDv7xto97Rnhld6OcLgM=; b=SnAWSsptm6+xp9r7MrceIO3wxGtnVB1z3a1OOFb4lETFn62GwgnF5t0Jtt5He4Jt9w TzilC5VugFXgiRXrjWl+4zb9aaPrLZxxOuEK20ORzFERkeS9+A3a1/UrLgGL5sNSkeBt W+Zrp4vCWXQSPB6G/qmI4w1F+Ujw9e0S2r3N3PKWs+sH0TlOugWN/p6zqKb3b2o10hcH blsNFC6XRkUKjtpKWnokBTXElCwcaF65dBnD6oQe1N+5Wi/8w6RhgtIqd/bZ6YVieI8d EnSTBURCc2lfJxr6zWsq17MuUaSFLfi9eOp2XN5N9fsLpw0kq0MQ/r3qUSnByIM0fM3W JpnA== X-Gm-Message-State: AOAM533ohpVK4m9Qc/BA9f5P8Y34IgfIxLRf68D7SGmTmZncwxK1YHOw 6oNtd/dtBThOapboBjYuue9I6g== X-Google-Smtp-Source: ABdhPJyk/M15t+lyhtoh1b/2CEQ3pV+TQZFLl1SvsJLFKiODwyiIibw9MBABprRy3lEFWknjr9AaqA== X-Received: by 2002:a17:90b:1d8b:: with SMTP id pf11mr6100787pjb.119.1641505573602; Thu, 06 Jan 2022 13:46:13 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:13 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Lucas Stach , Russell King , Christian Gmeiner , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Saravana Kannan Subject: [PATCH v5 11/32] drm/etnaviv: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:34 -0800 Message-Id: <20220106214556.2461363-12-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Lucas Stach Cc: Russell King Cc: Christian Gmeiner Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/etnaviv/etnaviv_drv.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c index 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 Thu Jan 6 21:45:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705775 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7823CC4332F for ; Thu, 6 Jan 2022 21:46:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244585AbiAFVq1 (ORCPT ); Thu, 6 Jan 2022 16:46:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244502AbiAFVqP (ORCPT ); Thu, 6 Jan 2022 16:46:15 -0500 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76AFFC061201 for ; Thu, 6 Jan 2022 13:46:15 -0800 (PST) Received: by mail-pj1-x102b.google.com with SMTP id lr15-20020a17090b4b8f00b001b19671cbebso4562426pjb.1 for ; Thu, 06 Jan 2022 13:46:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9+fM2dIjOxE0hdJ7o5inMEoSl4k+Dtn8hCQbdOli+o8=; b=WMHlwmVoo1ow1wofjzv++KabJgE5A6EpO98LpbSnWXIy+DtxgACpsY6fIhJHEKp4Bd W+/v2FNvE3U3LbDMGYS3WkdtPvljEpVfgIA6g7AmLK3pZtGtdL0WDNRxlHud8Ao9Elb2 aXXS4XgNXK4ewetP2amhDNnmvvcOWnwPPzCEQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9+fM2dIjOxE0hdJ7o5inMEoSl4k+Dtn8hCQbdOli+o8=; b=XY/3lsP/ASWuaXG8FJjCd9+Qsjev7TRer3CtH58vQOSkCk/bns+bDKpWY0I81SaexW 1Aehow0FdBXOulA9yE87FYdseP0j/5ZDxGUBNfxr0UEDwO7aG/M2XdBPMd73VA/BG22z 04aWfRYjk7JwcI+5wymBIV4P39fV5DLsvQSsoGI+KwXkaGZKoGolyD6W1cjuzmBOT9ST k4PfelkrcbsQaLqW0DpgcJJ+VoV+Bms7WxulzMuBAw9U7CXHuEUaNWJRl+srka7gvdMg IXuRS0aW7VxmgJTwNDAQo535kYtkiKu5ir8qXrJ4MSSc+9ogX4C9nF4ASmF4qESh8sZr lWFw== X-Gm-Message-State: AOAM5302DUTvhyVivsQ/T6Hm90mk2oQZl5ouAFGSg7mPP/4UtBeH0ukw +JR7XUODDhMTcobDcdaEr2M4RA== X-Google-Smtp-Source: ABdhPJwpQFHrvpwt076C/B60hfpgIoYWieUUFNJrKvBbE5BuNSwKXiWe++ylmqtUWZXuGmGRj9RTqg== X-Received: by 2002:a17:90b:3808:: with SMTP id mq8mr12220192pjb.85.1641505574987; Thu, 06 Jan 2022 13:46:14 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:14 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Xinliang Liu , Tian Tao , John Stultz , Xinwei Kong , Chen Feng , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 12/32] drm/kirin: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:35 -0800 Message-Id: <20220106214556.2461363-13-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Xinliang Liu Cc: Tian Tao Cc: John Stultz Cc: Xinwei Kong Cc: Chen Feng Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- .../gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index 98ae9a48f3fe..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 Thu Jan 6 21:45:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705771 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 188D3C433EF for ; Thu, 6 Jan 2022 21:46:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244519AbiAFVqS (ORCPT ); Thu, 6 Jan 2022 16:46:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244475AbiAFVqR (ORCPT ); Thu, 6 Jan 2022 16:46:17 -0500 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01CE1C061245 for ; Thu, 6 Jan 2022 13:46:17 -0800 (PST) Received: by mail-pf1-x429.google.com with SMTP id t123so3556091pfc.13 for ; Thu, 06 Jan 2022 13:46:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FPtGNMfzlxXubKgayi75A1lRD5p2YHP9GYCHjNIhA04=; b=F/n1S4F8s3kPZEe2GW35Eidb0SesLDzR2YqgAQAZIHrdsevP1q9bknfHQTxF6SqGJm Nfl9MQ9rGKoXrK+IFOpOOh3SAwv6F1KaWuQD7pffTOrkiJO/cXpEdVGWkZZkJ3dX53Xr AdWLpJwFpppBOInDDUOP4omGqDFxmR1REDYFY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FPtGNMfzlxXubKgayi75A1lRD5p2YHP9GYCHjNIhA04=; b=WpkUvOSMDOx9Ig68afN//VqMHVrFbGsUI/CQaHdmixNbkSVXXy8wRIIk7VgIUaQNIL CZotwyeRLdzrO6tQox8ZffSAE8wlh6ENIk9elxJocBftCLaWiccZOJXkapS9OqbA4//k J1jByqUsjHCIqz8n16BpzN1GcEw9Z8uOu0r+UWtE0AVsHbR0gJpPei3bgSt9KAWJuziU w0qtzHH7rowyheBcZ8oGHvdHDrRQJ1rkYB2BkG6tAqENCMIQfk4vPlG8hhgM0HBBIoxO h0Aet7TTmRe38mxP4JZMHE3cmhX77YOGza6UK9fluxQDZvOUHwx9UPp2HGJ2TXTSoNCu saAw== X-Gm-Message-State: AOAM5314cjbWaWwkgtURsXgYddqaJBZlzGlMoPiCZRuyELl+9tC5PWH6 vEO5ohbs3UmdAWOgSG2Zyi46yA== X-Google-Smtp-Source: ABdhPJzDyXbJ5oiJeJM1+1uFcXWrB43YEPXT+ZHV9hULBBomq9G68oQkCiEkLjlw9Juc82HcneKgAw== X-Received: by 2002:a62:1642:0:b0:4bb:b3b6:c037 with SMTP id 63-20020a621642000000b004bbb3b6c037mr56659975pfw.50.1641505576581; Thu, 06 Jan 2022 13:46:16 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:16 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 13/32] drm/exynos: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:36 -0800 Message-Id: <20220106214556.2461363-14-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Inki Dae Cc: Joonyoung Shim Cc: Seung-Woo Kim Cc: Kyungmin Park Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/exynos/exynos_drm_drv.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index 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 Thu Jan 6 21:45:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705774 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85673C433F5 for ; Thu, 6 Jan 2022 21:46:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244416AbiAFVqZ (ORCPT ); Thu, 6 Jan 2022 16:46:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244485AbiAFVqS (ORCPT ); Thu, 6 Jan 2022 16:46:18 -0500 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37D59C06118A for ; Thu, 6 Jan 2022 13:46:18 -0800 (PST) Received: by mail-pj1-x1034.google.com with SMTP id c9-20020a17090a1d0900b001b2b54bd6c5so10052281pjd.1 for ; Thu, 06 Jan 2022 13:46:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aOJT4e2/QJLKFjWixGXmSkqLgf4Tc1N8aTB3xOsamvQ=; b=ILyUjL86PabuV9iHfi1owzAuxjRlH7hKmctefUf5iFSmxQ8yCo6Qxg6zuq8+cH5t8y 8J0ddJ4qudUuoIlluaf9tgrxEAF9hlHaJrFhw3EfweYx2L4UlcukINHY/jfEMiup7Ohq 9Op19HAyziojbD0kXGY/lhxAXsVKWhFs600dQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aOJT4e2/QJLKFjWixGXmSkqLgf4Tc1N8aTB3xOsamvQ=; b=Upc5RAMIZzRHrakWEKRyjXJJrpt5e0UhPyjHcwRj1CTEXxPKxpz6Q2wlY9UbWMxz7j 4rai0SMZMK7SIUctZo5R5b++xmFw7bJGnZ2XFSYhznodtWn5Ornsxvjat2suF9VNDlXa lDc+upqv+5ebBixK25sP/4Uje/O8zJNnp9rWvoBA+Rn2lNiiv8a3dOXiUAMqxLQucHry OR/kr5/5D77isMmdJNlMkSPk70YsEkkuWET4n+S71s9b6JCM7yxiqVN4q6LBJ/mPwDGG Qc56GJqHLN48tFVW3w9ZA+gVF0fFD/qNMtrpfWRYvcOH3hMTgr/WkI8NMhXqodEr3ZbI jwmw== X-Gm-Message-State: AOAM530zEymwCrfdH2i3QA9u04jUnC3lR6lb9SDN4pMstsy/7cXI0AtQ XxMiyoEPE7QdWkYseoXp+CGP0A== X-Google-Smtp-Source: ABdhPJwN2qnfcJ9KhRSA5B219O9Th4wHo5ZTmhjZ5kL2M3+vwlyvS8V9GWpKXf0xhxdnHdYNhmKZuA== X-Received: by 2002:a17:90a:ccb:: with SMTP id 11mr7745818pjt.135.1641505577797; Thu, 06 Jan 2022 13:46:17 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:17 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Philipp Zabel , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 14/32] drm/imx: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:37 -0800 Message-Id: <20220106214556.2461363-15-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Philipp Zabel Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/imx/imx-drm-core.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c index cb685fe2039b..9e28bb16364c 100644 --- a/drivers/gpu/drm/imx/imx-drm-core.c +++ b/drivers/gpu/drm/imx/imx-drm-core.c @@ -196,8 +196,9 @@ static int compare_of(struct device *dev, void *data) return dev->of_node == 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; @@ -264,8 +265,9 @@ static int imx_drm_bind(struct device *dev) return ret; } -static void imx_drm_unbind(struct device *dev) +static void imx_drm_unbind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct drm_device *drm = dev_get_drvdata(dev); drm_dev_unregister(drm); @@ -279,14 +281,18 @@ static void imx_drm_unbind(struct device *dev) dev_set_drvdata(dev, NULL); } -static const struct component_master_ops imx_drm_ops = { - .bind = imx_drm_bind, - .unbind = imx_drm_unbind, +static struct aggregate_driver imx_drm_aggregate_driver = { + .probe = imx_drm_bind, + .remove = imx_drm_unbind, + .driver = { + .name = "imx_drm", + .owner = THIS_MODULE, + }, }; static int imx_drm_platform_probe(struct platform_device *pdev) { - int ret = drm_of_component_probe(&pdev->dev, compare_of, &imx_drm_ops); + int ret = drm_of_aggregate_probe(&pdev->dev, compare_of, &imx_drm_aggregate_driver); if (!ret) ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); @@ -296,7 +302,7 @@ static int imx_drm_platform_probe(struct platform_device *pdev) static int imx_drm_platform_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &imx_drm_ops); + component_aggregate_unregister(&pdev->dev, &imx_drm_aggregate_driver); return 0; } From patchwork Thu Jan 6 21:45:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705773 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C92BBC433FE for ; Thu, 6 Jan 2022 21:46:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244568AbiAFVqY (ORCPT ); Thu, 6 Jan 2022 16:46:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244532AbiAFVqT (ORCPT ); Thu, 6 Jan 2022 16:46:19 -0500 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84ED4C034000 for ; Thu, 6 Jan 2022 13:46:19 -0800 (PST) Received: by mail-pl1-x62f.google.com with SMTP id i6so3455990pla.0 for ; Thu, 06 Jan 2022 13:46:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=InGYSc3cNsqSsbEpZp55brWuJhvXfCPzOPufF1ln430=; b=geLOtRrcQoNShAYeNnrLXdKjIYR/IyoWWTuGrcF1264GfVWBQDjYocRBDtHKboalxq NlTAMMOQOJWtQqd4AlM4yYS4LfOux498Qr26h5HftL/q+OXekddI/VN4Haa1FCK/z5RP gUcg6RWh+0P8My25yDkFJTmBsIp4LYuwUytzo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=InGYSc3cNsqSsbEpZp55brWuJhvXfCPzOPufF1ln430=; b=4siHohMMceeIEqNinAQTWyhPe32qr3ixl5koGAGsgJK6doNvSXBRtRwoQt0yhjPX0U PJrnojbhcnQHcoOfgol3LWbUl2A+rgwJ02E9CjeRleSNXUbqWf39+ZP4O9vsl6PUj0jy GPwm/l1A1qDjz+I4Fzq5xrzihsEhatZ0//Q4kCI8BT/f0wepmQtEE/ap3gznADgBMA6+ z9QA6N9WchwjS8XaqOyE4lqZ2IOyochV6Nfcagq4nj8CdLGxSXOowLQYVujPEWHRmrnU IW/10cMy7tz5rp/cxh7YuT0GJ+FwknrtI9ksJniq0ojL34UqXLCkx25MWIpdgiGC8SOP tWXw== X-Gm-Message-State: AOAM531DhVdfk5dm9R3MRjNpijYqQW0UU89dOifDsgBO+L1ezOMOf2e3 1uNmAUBcV1a0NEzI51QYQqTL9g== X-Google-Smtp-Source: ABdhPJwrShL+WZS7fPjcU075+enEcp4MYi8BqFoh3gQpuVLFA/IeRy1wIlVUMeG2vPpOi4h7WK1MRQ== X-Received: by 2002:a17:90a:4482:: with SMTP id t2mr12123132pjg.133.1641505579072; Thu, 06 Jan 2022 13:46:19 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:18 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Paul Cercueil , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 15/32] drm/ingenic: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:38 -0800 Message-Id: <20220106214556.2461363-16-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. TODO: Move the helpers to PM in aggregate driver hooks. Acked-by: Paul Cercueil Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 25 +++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c index a5df1c8d34cd..d5330fb486e8 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c @@ -1150,8 +1150,10 @@ static int ingenic_drm_bind(struct device *dev, bool has_components) return ret; } -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,20 @@ static void ingenic_drm_unbind(struct device *dev) drm_atomic_helper_shutdown(&priv->drm); } -static const struct component_master_ops ingenic_master_ops = { - .bind = ingenic_drm_bind_with_components, - .unbind = ingenic_drm_unbind, +static void ingenic_aggregate_remove(struct aggregate_device *adev) +{ + struct device *dev = 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 +1209,7 @@ static int ingenic_drm_probe(struct platform_device *pdev) drm_of_component_match_add(dev, &match, compare_of, np); of_node_put(np); - 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 +1219,7 @@ static int ingenic_drm_remove(struct platform_device *pdev) if (!IS_ENABLED(CONFIG_DRM_INGENIC_IPU)) ingenic_drm_unbind(dev); else - component_master_del(dev, &ingenic_master_ops); + component_aggregate_unregister(dev, &ingenic_aggregate_driver); return 0; } From patchwork Thu Jan 6 21:45:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705778 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87C6BC433F5 for ; Thu, 6 Jan 2022 21:46:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244413AbiAFVqm (ORCPT ); Thu, 6 Jan 2022 16:46:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244491AbiAFVqX (ORCPT ); Thu, 6 Jan 2022 16:46:23 -0500 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D35BCC034004 for ; Thu, 6 Jan 2022 13:46:20 -0800 (PST) Received: by mail-pj1-x1030.google.com with SMTP id iy13so3551547pjb.5 for ; Thu, 06 Jan 2022 13:46:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RqazxdkkitgTin4SJ5P9dnD2fQGX/sBsDUPb6a/Agwo=; b=UF0V8/d2dqEfdB7HCgBN7DdYJT4+e8BJM+MYJD8k8/fO68+IUWBGZ6JkAsJJkh+FnD vaXLGgHFYVWFjjXVyQxkteffvW9U/hth0QeOEhOrAMeeMNR5ObgSOlPQix0JS2mt5/gW apV2grR0P52r0odyd0kdBpYKYJYhO3qZDpkHY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RqazxdkkitgTin4SJ5P9dnD2fQGX/sBsDUPb6a/Agwo=; b=iAcb3v1Lm/K5apvsePXILqeYMjmthJA6b1o3U/b7d6kwbvnMdQRdWe6Tx0RAi/GGQO a6kSv87EFizKxicc5keKy4aeeNUoem0vJZ0670LJ7WQk0FbUPZi2xZKMHFfcWV2EtT6C YeMm0PePzwjR2/mc1g4u9QXUntb1xe92QXJb0c9+Y1Gvq0Ranuk2Wu6n28sVO9CBUN6y hwP9Ji1+UHkEv7PtKlPyng7saMWJPCJtkQK+sLERIpjar4Gp1+sk10RTB9Xvh9LlbwKW 7jFaDCrBqTNfD3cyMqUaYdeDETYWzNEnxEPpgtzfxAgS6xqru39sZJpevAVJxF6//hiV maTg== X-Gm-Message-State: AOAM530ConoJ28SHFGpLcacyYTy1663ukXy9P+fS7wiobyVTe5KEo1O7 6qEVGZlxHhYbC5HWjHugI7q8yg== X-Google-Smtp-Source: ABdhPJx3X6P0Se4Tp7Ye4XYdLYrIonMHZGBXV1H/Uf8y5UHsJsIHUkaZumNdcF/jAe2cmmNLHsWLzA== X-Received: by 2002:a17:90b:33cd:: with SMTP id lk13mr12189005pjb.35.1641505580410; Thu, 06 Jan 2022 13:46:20 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:20 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan , Linus Walleij Subject: [PATCH v5 16/32] drm/mcde: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:39 -0800 Message-Id: <20220106214556.2461363-17-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Tested-by: Linus Walleij Signed-off-by: Stephen Boyd --- drivers/gpu/drm/mcde/mcde_drv.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/mcde/mcde_drv.c b/drivers/gpu/drm/mcde/mcde_drv.c index 5b5afc6aaf8e..1652f9e0601d 100644 --- a/drivers/gpu/drm/mcde/mcde_drv.c +++ b/drivers/gpu/drm/mcde/mcde_drv.c @@ -215,8 +215,9 @@ static const struct drm_driver mcde_drm_driver = { 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[] = { @@ -419,7 +425,7 @@ static int mcde_probe(struct platform_device *pdev) * Perform an invasive reset of the MCDE and all blocks by * cutting the power to the subsystem, then bring it back up * later when we enable the display as a result of - * component_master_add_with_match(). + * component_aggregate_register(). */ ret = regulator_disable(mcde->epod); if (ret) { @@ -429,8 +435,7 @@ static int mcde_probe(struct platform_device *pdev) /* Wait 50 ms so we are sure we cut the power */ usleep_range(50000, 70000); - ret = component_master_add_with_match(&pdev->dev, &mcde_drm_comp_ops, - match); + ret = component_aggregate_register(&pdev->dev, &mcde_drm_comp_driver, match); if (ret) { dev_err(dev, "failed to add component master\n"); /* @@ -459,7 +464,7 @@ static int mcde_remove(struct platform_device *pdev) struct drm_device *drm = platform_get_drvdata(pdev); struct mcde *mcde = to_mcde(drm); - component_master_del(&pdev->dev, &mcde_drm_comp_ops); + component_aggregate_unregister(&pdev->dev, &mcde_drm_comp_driver); clk_disable_unprepare(mcde->mcde_clk); regulator_disable(mcde->vana); regulator_disable(mcde->epod); From patchwork Thu Jan 6 21:45:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705777 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C492C4332F for ; Thu, 6 Jan 2022 21:46:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244504AbiAFVql (ORCPT ); Thu, 6 Jan 2022 16:46:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244558AbiAFVqX (ORCPT ); Thu, 6 Jan 2022 16:46:23 -0500 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A6C9C061212 for ; Thu, 6 Jan 2022 13:46:22 -0800 (PST) Received: by mail-pf1-x435.google.com with SMTP id c2so3603104pfc.1 for ; Thu, 06 Jan 2022 13:46:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SfmZAoSN1UYJWac68o+RmufoyphUhdu5prdrSebp+yc=; b=j12IJ9pTqCtVF88a8jspHlxmCl2AnRMMMJWTTo4mBdXh00MZSoo3H7jgEFsCOOVHmo 4W45zFTZyNZEgqpwY0w7aowWRRbTJfMxEqzMpB9QfIvvjZxRopqkP3lGZwAf4pCFaRTl 7KiNpYoUCCQ6P8ycDcCPsYHiST/atI3r4Xjr0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SfmZAoSN1UYJWac68o+RmufoyphUhdu5prdrSebp+yc=; b=zVp0yLDUY8zhxwOPjkwal+OYQbUqjGHiFnYj6jABivOsIVx4ORzzxqjYhDaezJIuP+ UmDOKLdpZa2C+gXFz8VGNhmws/Sa/c4oNmObqLLt7w+OzhAxZT7LaPKMOCVauabGuDA5 DMZT+WvUT9j//Y7OKFFbklNz/Tb6h9gvUgThPgk2BkrcnfyQExAhjaLmhjig2djifBv1 OLFK0ZTO4sLTqyTQ9LdjJiIJS5++DgdDcTDEEPNX2W6ApkIFJEH+PBKfJ3QwcoD7cfST 7Ur0XQxssgLMC99qWRsvP5n/7gvt7vBZS8o6655An6ubj/Q+/qRwSuA0Vw/Zuk0W8lqP Xzzg== X-Gm-Message-State: AOAM530CrjG/+ek4OewfXdRcG9pCVTI8XgMlIXFRgZQairvf5n4dSctH pWXefTcRfssluIXZXf8nuB4ldQ== X-Google-Smtp-Source: ABdhPJwuXTdUklcvp9RqipfrZwSh8trfMd3qwsc0+IRabadi0IvcA1TEUJc1VlZWI75ylSNT1Qex5A== X-Received: by 2002:a05:6a00:1a43:b0:4bb:8507:9568 with SMTP id h3-20020a056a001a4300b004bb85079568mr61382924pfv.42.1641505581688; Thu, 06 Jan 2022 13:46:21 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:21 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Chun-Kuang Hu , Philipp Zabel , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 17/32] drm/mediatek: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:40 -0800 Message-Id: <20220106214556.2461363-18-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Chun-Kuang Hu Cc: Philipp Zabel Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index 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 Thu Jan 6 21:45:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705780 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FB60C433FE for ; Thu, 6 Jan 2022 21:46:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244559AbiAFVqr (ORCPT ); Thu, 6 Jan 2022 16:46:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244518AbiAFVqX (ORCPT ); Thu, 6 Jan 2022 16:46:23 -0500 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F89CC0611FD for ; Thu, 6 Jan 2022 13:46:23 -0800 (PST) Received: by mail-pj1-x102e.google.com with SMTP id y16-20020a17090a6c9000b001b13ffaa625so10051744pjj.2 for ; Thu, 06 Jan 2022 13:46:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0P0B2t7jpcQb6RReBEhUJcwiQBX6wggU1M1usRBo/kI=; b=OMmriz8g6SqvUhC+jJKguXZPzeNbrMkAffwjErEk+CltWZ6StTRLM1QhiC5eJkz90c Z0YD413vMw0bVDIg90Vurus2guUNuLOOw7WxT2Ux27KNw3xAswtMH624dH2SEC/F2Yhx VcAd0TKcwWLB7s5I7sk8rCos61gT5buuj5b2Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0P0B2t7jpcQb6RReBEhUJcwiQBX6wggU1M1usRBo/kI=; b=cstEnivr638h/LfynlV4ldGK0syvD9jWTvzZd18UdAq7Uexa6hrPJzmU9xYzEwSLs9 APQV7umnfnwjyB6dpXu4hpaTFrs2EyHR+EO6KV1u4WBBR7Rzh6uF7MWi7ABp7JFN9uzy 25yM7YNkV8oPmbiL9kYqe8RvY/OsG1PyLtY9q5f1xZ92Jjp9rgqb4korWtoFCr7eI6EI cKgBvVTxqUMVVU5pEHbTzGkugIqo87785a0XS6RyNI3K6BYnEFGRzk4Rw1kTQoOgBmHc f+3FpYByxje0nKER25RY6LO35If+israEqyYZQC2q9Z1qotdnJbF85gIdJ/SWZ8ATNei nIDQ== X-Gm-Message-State: AOAM531NFG2fd1KR6n0rx1ihhxiH/tW2xBIq/La2Ipi/sPUYRUu0hh0f J29NyIOEheEQfjSrqFPvmQFGSw== X-Google-Smtp-Source: ABdhPJwevDLAx3RQTtIwgYxJoTRsVhvDf16aEqPPEqco33SsVOKqwUE3w+uhW5OAbjFhWL2saEpvwQ== X-Received: by 2002:a17:902:d645:b0:149:b7bf:9932 with SMTP id y5-20020a170902d64500b00149b7bf9932mr22561186plh.48.1641505582894; Thu, 06 Jan 2022 13:46:22 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:22 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Neil Armstrong , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 18/32] drm/meson: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:41 -0800 Message-Id: <20220106214556.2461363-19-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Neil Armstrong Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/meson/meson_drv.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c index 7f41a33592c8..3028f2a45f66 100644 --- a/drivers/gpu/drm/meson/meson_drv.c +++ b/drivers/gpu/drm/meson/meson_drv.c @@ -356,13 +356,16 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) return ret; } -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; @@ -386,9 +389,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) @@ -502,9 +509,7 @@ static int meson_drv_probe(struct platform_device *pdev) if (count) { dev_info(&pdev->dev, "Queued %d outputs on vpu\n", count); - return component_master_add_with_match(&pdev->dev, - &meson_drv_master_ops, - match); + return component_aggregate_register(&pdev->dev, &meson_aggregate_drv, match); } /* If no output endpoints were available, simply bail out */ From patchwork Thu Jan 6 21:45:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705779 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17267C433EF for ; Thu, 6 Jan 2022 21:46:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244834AbiAFVqq (ORCPT ); Thu, 6 Jan 2022 16:46:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244516AbiAFVqY (ORCPT ); Thu, 6 Jan 2022 16:46:24 -0500 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94450C06118C for ; Thu, 6 Jan 2022 13:46:24 -0800 (PST) Received: by mail-pf1-x436.google.com with SMTP id s15so3594276pfk.6 for ; Thu, 06 Jan 2022 13:46:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6IAciPlNRPfkJgo3LSljGMR1t9yoWVxJAu5cqfoLKs8=; b=Ui8wQJEmkOFa0mFXYEgsE6oEWR64bOCZFpPJNPhPReKZqlNYesA2A+Uh5/rpMcQa0g GZqntZqMXJjU6tk3qMd7yAsZ4uJw2LAT9Atbjj4E2NVaZRSW1crPxLfyrCrUCAYjpM7K A9PajHMZd8Q4KNCfPqvbXO1U2yICRGXb1wWfE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6IAciPlNRPfkJgo3LSljGMR1t9yoWVxJAu5cqfoLKs8=; b=ty0LgB+Q0JVXM+x4aqmC6wyHXruung2zzJuny7NX0GRUrHbw6cxItDE3FGAW2PxeXK H4AXRSQS0imUV0QlmV4ekKJOkjRK6ZyorBpghQaquQN9yKfIjZzzQT/csGmAwbq7kLha a89uFAe6Mr8EyyRZKHPPCRE/4PSMns0ZqV9eeap29Qmg4wVlkZvk4tB3grdP+GqVWVlx oDgiDPJMQHI2zkuOAPC5jlXRdw2JQTLMmqNYZqf9QNEA73j/mL84Yt0pr42JOZkv2P8S LT3miQtkB/ky/esRricUuUYY1XdZB9n/9qYNlL6xJEibVgOfrO90RkWy3uuLpe1KGI5m LrXg== X-Gm-Message-State: AOAM533JUF1HYI0B5eS3Xq9wuvQMN5wcqmCEVY74XIJRYi9HqnaPf7H1 Q/t1g+cddbBUaFBjBVvfA63p5A== X-Google-Smtp-Source: ABdhPJzWq9RI710y90K8zf1uJwBYNts69ZS6HDcA6iBGlm/u3mYDFqh9Vm6XQfwp3ev4pTauXgTU0g== X-Received: by 2002:a63:d314:: with SMTP id b20mr54174333pgg.207.1641505584138; Thu, 06 Jan 2022 13:46:24 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:23 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Tomi Valkeinen , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 19/32] drm/omap: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:42 -0800 Message-Id: <20220106214556.2461363-20-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Tomi Valkeinen Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/omapdrm/dss/dss.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c index d6a5862b4dbf..9328d97f19ab 100644 --- a/drivers/gpu/drm/omapdrm/dss/dss.c +++ b/drivers/gpu/drm/omapdrm/dss/dss.c @@ -1304,8 +1304,9 @@ static const struct soc_device_attribute dss_soc_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; @@ -1330,8 +1331,9 @@ static int dss_bind(struct device *dev) return 0; } -static void dss_unbind(struct device *dev) +static void dss_unbind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct dss_device *dss = dev_get_drvdata(dev); platform_device_unregister(dss->drm_pdev); @@ -1339,9 +1341,13 @@ static void dss_unbind(struct device *dev) component_unbind_all(dev, NULL); } -static const struct component_master_ops dss_component_ops = { - .bind = dss_bind, - .unbind = dss_unbind, +static struct aggregate_driver dss_aggregate_driver = { + .probe = dss_bind, + .remove = dss_unbind, + .driver = { + .name = "dss_drm", + .owner = THIS_MODULE, + }, }; static int dss_component_compare(struct device *dev, void *data) @@ -1504,7 +1510,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 +1549,7 @@ static int dss_remove(struct platform_device *pdev) of_platform_depopulate(&pdev->dev); - component_master_del(&pdev->dev, &dss_component_ops); + component_aggregate_unregister(&pdev->dev, &dss_aggregate_driver); dss_debugfs_remove_file(dss->debugfs.clk); dss_debugfs_remove_file(dss->debugfs.dss); From patchwork Thu Jan 6 21:45:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705781 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C132C43219 for ; Thu, 6 Jan 2022 21:47:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244721AbiAFVrH (ORCPT ); Thu, 6 Jan 2022 16:47:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244736AbiAFVqk (ORCPT ); Thu, 6 Jan 2022 16:46:40 -0500 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7EC3C034009 for ; Thu, 6 Jan 2022 13:46:25 -0800 (PST) Received: by mail-pl1-x62e.google.com with SMTP id x15so3424871plg.1 for ; Thu, 06 Jan 2022 13:46:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=44Qv1WEc4fBQtGQZgnR/7aRXBM5nSt7tXrgm1eHf/P0=; b=niK0EojGGWtp3v8hwFYBHDDVJkwIXfLIQ83lTuBY59xb19zCWoyJURj4sTcDU35y7Y KVZQW/BzuJ4V+wA8RKDZtqP+W7U1KDmr5r3VJ6uBw4qwiJiVqI2yQg3vB5On4T3wXRU8 OX+U4PjmZnhOgK4nAHA65avAkaz0oUHuqM3os= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=44Qv1WEc4fBQtGQZgnR/7aRXBM5nSt7tXrgm1eHf/P0=; b=WTnzy+fHGnevLue2YJRNopvTiz/XBlnkAz01vBTLqSiD8zWdSS4CSL9muwB60+IEt+ lmUDjFmx1mFTcfMTDI5RyeOs1lxc9XgO/k3GEPzVms2m6sXqNKQJVUKFAd3b3YFMFUru 7KJKH4m/VKjI8vRztzBtvODNcuAc+wDgDdAtz01L/OnlNU8D/8Xw9tXwWLBtrLJhtlf3 aYvjMAcQjMGLDvePcS0u1zrKZ+IgwGvkL5nyLpNMD+mfRKqqTXBIQEbtcGrebRZRWetK bMb0uC5w3uXYg6ROr8uI0EDKBf28PNc2mFQ+Rwo43unkEUO4hKRVpDYUXgHUz9rO3DqU DG+A== X-Gm-Message-State: AOAM5308uYl2j+vImoNA4Zm+Zw998D+4nimCzKoEVeYf1hmSVG92rWxu PBIqx8jezSfWbpFe00VcQjO2hw== X-Google-Smtp-Source: ABdhPJz2g3PjORGUq33Yccyh7naEWkhS7Y38LLqdLrUERFAXmoNOQLQqq3DhzN6ShCsGmaq/uSbn/Q== X-Received: by 2002:a17:90b:3c0c:: with SMTP id pb12mr12254066pjb.105.1641505585393; Thu, 06 Jan 2022 13:46:25 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:25 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 20/32] drm/rockchip: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:43 -0800 Message-Id: <20220106214556.2461363-21-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Sandy Huang Cc: "Heiko Stübner" Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index e4ebe60b3cc1..6c755361d376 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -109,8 +109,9 @@ static void rockchip_iommu_cleanup(struct drm_device *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; @@ -183,8 +184,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); @@ -346,9 +348,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) @@ -419,7 +425,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; @@ -430,7 +436,7 @@ static int rockchip_drm_platform_probe(struct platform_device *pdev) static int rockchip_drm_platform_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &rockchip_drm_ops); + component_aggregate_unregister(&pdev->dev, &rockchip_aggregate_driver); rockchip_drm_match_remove(&pdev->dev); From patchwork Thu Jan 6 21:45:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705782 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C07C2C4332F for ; Thu, 6 Jan 2022 21:47:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245067AbiAFVrG (ORCPT ); Thu, 6 Jan 2022 16:47:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244742AbiAFVqk (ORCPT ); Thu, 6 Jan 2022 16:46:40 -0500 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34E3AC03400E for ; Thu, 6 Jan 2022 13:46:27 -0800 (PST) Received: by mail-pj1-x1034.google.com with SMTP id l10-20020a17090a384a00b001b22190e075so10013206pjf.3 for ; Thu, 06 Jan 2022 13:46:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3a3i/nDaB8ZUdNqJ4VU8hWXyXTL7/wWiLoMS1h5NiSM=; b=fdvHO09XyrK1fRBMv6ZCuxZJEOBZEnRNlYv157RP6xvIBDI1KvxVfeWRIWISqNDWJy Mje3eRi4npSQNpDWJ9O/5uGZmlZQUlN1UZC4PK3FDQL/MgLM1GrU1WmJLfcElmnrOL1s 6sKDsY1CzavLw8ggHfgi4o17oPUIa2PeA1B94= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3a3i/nDaB8ZUdNqJ4VU8hWXyXTL7/wWiLoMS1h5NiSM=; b=URE4JgUcc6UdlRtnglhGi2k5domcSRnlvjXFWztgAEDO/rpK16bjY4GNoeJe2m6n23 Erx7kkYCUSZ7jbuzNAhV3NvXCH4de/fOnHnVxnOdfrYLK/zoC8Lhf2OAOD7PFlZe/hPp 1XHHuo13hcknYN89FsBA/yiY2SOryy5+oKZVAiP4K/BmxHXIOSDNsaOxRq7HHWc8YW2t hIJrqUSBudPdHrie6T0BKvSKag/TU3C6n6j37Fep0xmNTwId5WeLPWcL6jB3L//O4OdU Q7Fb1k8Mrd6WDUS686/ztrlsWKv+InVoQmneNwrjZi7vX8FQwRtNV/QKItTYh1rr9Ad4 GWLg== X-Gm-Message-State: AOAM532t6uF2fPdJ6CoGTyAeQN1BF1jaP1kWCrglYJle4cRT85BP/jiR /b3THsGmuEV5QTNIhqEbDoFCcQ== X-Google-Smtp-Source: ABdhPJwr1viR7RiIgdiNaWACG2FQzv9WC65+KPeGyqeBih/ukDD1zE8+KmCzZ5Vl/9CAHYBtTaRbIw== X-Received: by 2002:a17:902:ec85:b0:148:a8d2:91c0 with SMTP id x5-20020a170902ec8500b00148a8d291c0mr60254706plg.94.1641505586819; Thu, 06 Jan 2022 13:46:26 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:26 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 21/32] drm/sti: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:44 -0800 Message-Id: <20220106214556.2461363-22-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/sti/sti_drv.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c index c7efb43b83ee..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 Thu Jan 6 21:45:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705783 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40E15C433F5 for ; Thu, 6 Jan 2022 21:47:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245136AbiAFVrJ (ORCPT ); Thu, 6 Jan 2022 16:47:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244747AbiAFVqk (ORCPT ); Thu, 6 Jan 2022 16:46:40 -0500 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83BB5C033268 for ; Thu, 6 Jan 2022 13:46:28 -0800 (PST) Received: by mail-pg1-x531.google.com with SMTP id 200so3742609pgg.3 for ; Thu, 06 Jan 2022 13:46:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qrvKBJr+DUbrISc8WyZICnsdtffozhNCQiB3CMiYO5U=; b=YIm4yDL/DEzHEQ/KoisiGKXELBefTLgB6abDYKWPS//x1Mhw76BhF0i5M5H2ximQJJ Vr+KqieRuR4wHbR/hT46JfKeUSLg/gnc/Zpvg3isTAL8jjkmUUJNj1n7hA50mrOxpJIp aSKva71JsYpieNtNkDr58YeU8LeXNems3/iHg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qrvKBJr+DUbrISc8WyZICnsdtffozhNCQiB3CMiYO5U=; b=nlSo96nRi+w8clT7cx8VO+fXBMH1H3Duwrg/XILB6IYMQk38T3IjYz+YjgOeAMCOrg lrR9CVyLk/oj+9geZ+mPl4HHnKW3rcGwyj+szCZLDWWola8R/ZaeXe9zIVXW6iWKb5rg hWIQPyPkQSawidq5JitVY9QrqPgvKilJQCThftC/Eq4IsscyYj49XrGwBS2b22plcJt3 x3wEaFm03RVF3YKJuOjeEsZlj0eWnsHh5J8ORy7yClu7H1D80onZ8yvxF8vEXAt5zi8R /I8DReO/6zPKg82jlYTplhof447TGPS0s8sYaun0RA3VZeVppTa3NmWwwqVYfJdoJ5Yk w97Q== X-Gm-Message-State: AOAM5306ihQfV4wH6gc/R2UXOIZcd/s11Z4RcA3GDkSrzLB0SMGFXpct qi1AUn9xffvV9XYr3m9Zhfeyhg== X-Google-Smtp-Source: ABdhPJzb1OQ9XAYSMCSxVIyMkn4sVO7K/RXDTcJbr0zEftWLLjfJcqfaTtD8//YXtBqZkQi6QNLBPw== X-Received: by 2002:a63:b257:: with SMTP id t23mr292463pgo.335.1641505588077; Thu, 06 Jan 2022 13:46:28 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:27 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Maxime Ripard , Chen-Yu Tsai , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 22/32] drm/sun4i: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:45 -0800 Message-Id: <20220106214556.2461363-23-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Maxime Ripard Cc: Chen-Yu Tsai Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/sun4i/sun4i_drv.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c index 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 Thu Jan 6 21:45:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705784 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F2ECC4167B for ; Thu, 6 Jan 2022 21:47:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245147AbiAFVrJ (ORCPT ); Thu, 6 Jan 2022 16:47:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244752AbiAFVqk (ORCPT ); Thu, 6 Jan 2022 16:46:40 -0500 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8C05C033271 for ; Thu, 6 Jan 2022 13:46:29 -0800 (PST) Received: by mail-pg1-x530.google.com with SMTP id s1so3737138pga.5 for ; Thu, 06 Jan 2022 13:46:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wlRODoqLGygqE0LYiWEnBFh9kz/XzAvDsSAOOxu5peY=; b=GzZNEOZnJdx2UbmWqTs91g8v1Ek0T36tb8wTW6K2/HuA2Ir6bJylKpR1VTJD3+cT7V RR8lNKHT3YDRZdKc5H88k1lnvbdSlpls0QxgraRDcDW1uAlIThvxYrNqx4dC/ptFAYRc JoQKpeNyqCvuEgmtHzLaPPcwVTKqyhbnb66KA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wlRODoqLGygqE0LYiWEnBFh9kz/XzAvDsSAOOxu5peY=; b=KWMmk9OFLiz8lp9ivUI0c7BvxggvYORs4YRyYMkAm6P2L1tYGHc//Q6MgxNgSewFVy YryUg46ALo45k+aCPgHA3jFOpz6WpywtJQM/vgV/Rip4L6JugOH5kTVuKwQAZtCoAZ5G cRBgeemkI6zRoFaWXlAArIlhn97tIyDeJ/QoJFnu9ksOiYrmhAOgpnFn6cyK053hraPZ DzQHrlC6oiJwH1KrplDuyicbTN0HuLdOZFg8Db4pgcxageFmuLYVHg+TrK9gtbovOYqO OkduAKMmacgs1k7KaZF516un+cnkxmu3OysfFEAqIBjVuaAt3NhNH3vg7YQz+hnv0XNR waRg== X-Gm-Message-State: AOAM533sJ/V1g/98zBOFJeWZ6emurNpCv57V/JZEBrqEOFa52rzaAraY Y382aZgMOP6aW5x2N0ljItInXQ== X-Google-Smtp-Source: ABdhPJzQWO1uToj3tzBAQVjFHovHCVWrij+0CQbi4cIY9ccyePU+NaIcQKFL9LXXbASfdxbaDHhvhA== X-Received: by 2002:a63:8042:: with SMTP id j63mr53527969pgd.454.1641505589406; Thu, 06 Jan 2022 13:46:29 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:29 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Jyri Sarha , Tomi Valkeinen , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 23/32] drm/tilcdc: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:46 -0800 Message-Id: <20220106214556.2461363-24-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Tested-by: Jyri Sarha Cc: Tomi Valkeinen Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index 3ddb7c710a3d..92ff516fb6de 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c @@ -529,13 +529,16 @@ static const struct dev_pm_ops tilcdc_pm_ops = { /* * 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. */ @@ -545,9 +548,13 @@ static void tilcdc_unbind(struct device *dev) tilcdc_fini(dev_get_drvdata(dev)); } -static const struct component_master_ops tilcdc_comp_ops = { - .bind = tilcdc_bind, - .unbind = tilcdc_unbind, +static struct aggregate_driver tilcdc_aggregate_driver = { + .probe = tilcdc_bind, + .remove = tilcdc_unbind, + .driver = { + .name = "tilcdc_drm", + .owner = THIS_MODULE, + }, }; static int tilcdc_pdev_probe(struct platform_device *pdev) @@ -564,12 +571,9 @@ static int tilcdc_pdev_probe(struct platform_device *pdev) ret = tilcdc_get_external_components(&pdev->dev, &match); if (ret < 0) return ret; - else if (ret == 0) + if (ret == 0) return tilcdc_init(&tilcdc_driver, &pdev->dev); - else - return component_master_add_with_match(&pdev->dev, - &tilcdc_comp_ops, - match); + return component_aggregate_register(&pdev->dev, &tilcdc_aggregate_driver, match); } static int tilcdc_pdev_remove(struct platform_device *pdev) @@ -579,10 +583,10 @@ static int tilcdc_pdev_remove(struct platform_device *pdev) ret = tilcdc_get_external_components(&pdev->dev, NULL); if (ret < 0) return ret; - else if (ret == 0) + if (ret == 0) tilcdc_fini(platform_get_drvdata(pdev)); else - component_master_del(&pdev->dev, &tilcdc_comp_ops); + component_aggregate_unregister(&pdev->dev, &tilcdc_aggregate_driver); return 0; } From patchwork Thu Jan 6 21:45:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705785 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F870C4167D for ; Thu, 6 Jan 2022 21:47:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245177AbiAFVrK (ORCPT ); Thu, 6 Jan 2022 16:47:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244757AbiAFVqk (ORCPT ); Thu, 6 Jan 2022 16:46:40 -0500 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F046C033274 for ; Thu, 6 Jan 2022 13:46:31 -0800 (PST) Received: by mail-pg1-x531.google.com with SMTP id z30so238595pge.4 for ; Thu, 06 Jan 2022 13:46:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pXQku93D/rC4XyQwRyjDG+Hw8yXvhZdjZb839YbIyVI=; b=XNFvfrQVoCRkJsg0UDXwhqksdjN1M3Wn/j+UApsuk0/AmeJfmXR3Fiu+2LJd/rRR2L shwEpidpjJPREQx8USWBQtSU/rpnGZD7n9Hcl3MmF+Fi8BrE8hW1b2fzsqkLDXryTfvX IgpGdRMknXm0EoelHiL4T0fIc56a2EyUJNVjA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pXQku93D/rC4XyQwRyjDG+Hw8yXvhZdjZb839YbIyVI=; b=WWU90CFeqT2Ec2kUZU31OTa0lMD17DKaGQS73M33ArbREQoZq4rTCBk+pUZPKCezDY nWit+DEGbrgbGjqGoEp3zSMkNAU5wyqzjUFpRCxqRpT2e9+hWWB2rSQgFUxhhfZ03sJ3 B+Ix6ldfrprL9hWORnmumDgL/FCTg4vAFDitzCC/smCi0mrPdaCb0DK8ViEtzlrHghnp BULMFQE2RyS7PqdY3tX3bVdZ35loPSN23V5t5wy8iTU6hEwLvd7jJ7FIyi1q+zPtkM3X BsYBZv5wMPhqbWfXZ1wEaXoGqysfclluxNUDoI/0lU57Na7anxV1xEw7T0GyjbStA0o1 jCTQ== X-Gm-Message-State: AOAM533Occy2KXhfaYy8+aVAYyLBAnVtYRKiqvoae4GHYV34R7o69gPa bPvrJkAPMz2YRJ2bbiH4bt5MdQ== X-Google-Smtp-Source: ABdhPJzxEXPWmecqAT9M5vPs4YoQa9EQGMGNVPF/F/pdV8VYbPk2PnOFg0Jind+8jOkQzP/e2LpMfA== X-Received: by 2002:a63:7704:: with SMTP id s4mr7298509pgc.422.1641505590634; Thu, 06 Jan 2022 13:46:30 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:30 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Emma Anholt , Maxime Ripard , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 24/32] drm/vc4: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:47 -0800 Message-Id: <20220106214556.2461363-25-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Emma Anholt Cc: Maxime Ripard Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/vc4/vc4_drv.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c index 16abc3a3d601..82a44ebf9121 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c @@ -212,8 +212,9 @@ static void vc4_match_add_drivers(struct device *dev, } } -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; @@ -284,8 +285,9 @@ static int vc4_drm_bind(struct device *dev) return ret; } -static void vc4_drm_unbind(struct device *dev) +static void vc4_drm_unbind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct drm_device *drm = dev_get_drvdata(dev); drm_dev_unregister(drm); @@ -293,9 +295,13 @@ static void vc4_drm_unbind(struct device *dev) drm_atomic_helper_shutdown(drm); } -static const struct component_master_ops vc4_drm_ops = { - .bind = vc4_drm_bind, - .unbind = vc4_drm_unbind, +static struct aggregate_driver vc4_aggregate_driver = { + .probe = vc4_drm_bind, + .remove = vc4_drm_unbind, + .driver = { + .name = "vc4_drm", + .owner = THIS_MODULE, + }, }; /* @@ -326,12 +332,12 @@ static int vc4_platform_drm_probe(struct platform_device *pdev) vc4_match_add_drivers(dev, &match, component_drivers, ARRAY_SIZE(component_drivers)); - return component_master_add_with_match(dev, &vc4_drm_ops, match); + return component_aggregate_register(dev, &vc4_aggregate_driver, match); } static int vc4_platform_drm_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &vc4_drm_ops); + component_aggregate_unregister(&pdev->dev, &vc4_aggregate_driver); return 0; } From patchwork Thu Jan 6 21:45:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705786 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F22D3C433F5 for ; Thu, 6 Jan 2022 21:47:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245218AbiAFVrL (ORCPT ); Thu, 6 Jan 2022 16:47:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244779AbiAFVqm (ORCPT ); Thu, 6 Jan 2022 16:46:42 -0500 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52B74C03327B for ; Thu, 6 Jan 2022 13:46:32 -0800 (PST) Received: by mail-pg1-x535.google.com with SMTP id v25so3742726pge.2 for ; Thu, 06 Jan 2022 13:46:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Cp/sB0csPJfGnASpc4rymZ0PPQPzUhdhwUtGaGHpcvc=; b=hh951AuDm1lnuTY6Tg2bk0JqAZI+SXik/wKYCanK/9z21XaxR8dcVOq5HuTUHvXX+4 BA5DB+cYLOeFa4Yj/qhEHktwsW51FrcAvaCxu93fkpHy98KKRByaAlCqq3LMH6f2Yesv syDwoIVXJ+hcSDIJ+jirliEw4GXQyzkO5KEuA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Cp/sB0csPJfGnASpc4rymZ0PPQPzUhdhwUtGaGHpcvc=; b=iL234lTUNRH5m/RDg3UHU8xNhYK5ND8MzbadWB9R+ApFvA1nUGbP0UIGhZeyGte8/7 4HDMpc7WebRpkaiJYlvIyVT+WvQ3f4/iUAHerMomygt8VXJ0LzW2NdNYNi+kYfoNXwdQ AOtqkIk6PLj4n1ERZQC+AE2b7EXuDdmQ1vg4f/lX1UpSLg/H6DNJz/Uqa7MBGJTGUJJE 8gkR4aCt1p82U6DB5phHHLb4ovppLhsbcWUFKWI3DjY8ahTEkfhRGPZcWe5SUwNoSz+F Me5hI3QahzdVHwsCUts/Kkay7ku6kRhUncZtZdq1IE4nx1K2T0QOiTVWMPYFHYqV8w9W nARQ== X-Gm-Message-State: AOAM53163q+5RG5WpkdQ01xQRVTysKXAu824O+zThssPteRJOY7mNkPS IhWxqRRJpiQQd1/j5uCg0KtaAg== X-Google-Smtp-Source: ABdhPJy9dQQssWkM2CNx3zabLk5PMLLArRIIl85gPr/Wn1u8evvprhCEN6jMJEhMiz/HIX7vMXU6aQ== X-Received: by 2002:a63:a744:: with SMTP id w4mr31926122pgo.142.1641505591920; Thu, 06 Jan 2022 13:46:31 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:31 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Yong Wu , Joerg Roedel , Will Deacon , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 25/32] iommu/mtk: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:48 -0800 Message-Id: <20220106214556.2461363-26-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Yong Wu Cc: Joerg Roedel Cc: Will Deacon Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/iommu/mtk_iommu.c | 14 +++++++++----- drivers/iommu/mtk_iommu.h | 6 ++++-- drivers/iommu/mtk_iommu_v1.c | 14 +++++++++----- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 25b834104790..8e722898cbe2 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -752,9 +752,13 @@ static int mtk_iommu_hw_init(const struct mtk_iommu_data *data) return 0; } -static const struct component_master_ops mtk_iommu_com_ops = { - .bind = mtk_iommu_bind, - .unbind = mtk_iommu_unbind, +static struct aggregate_driver mtk_iommu_aggregate_driver = { + .probe = mtk_iommu_bind, + .remove = mtk_iommu_unbind, + .driver = { + .name = "mtk_iommu_agg", + .owner = THIS_MODULE, + }, }; static int mtk_iommu_probe(struct platform_device *pdev) @@ -895,7 +899,7 @@ static int mtk_iommu_probe(struct platform_device *pdev) goto out_list_del; } - ret = component_master_add_with_match(dev, &mtk_iommu_com_ops, match); + ret = component_aggregate_register(dev, &mtk_iommu_aggregate_driver, match); if (ret) goto out_bus_set_null; return ret; @@ -928,7 +932,7 @@ static int mtk_iommu_remove(struct platform_device *pdev) device_link_remove(data->smicomm_dev, &pdev->dev); pm_runtime_disable(&pdev->dev); devm_free_irq(&pdev->dev, data->irq, data); - component_master_del(&pdev->dev, &mtk_iommu_com_ops); + component_aggregate_unregister(&pdev->dev, &mtk_iommu_aggregate_driver); return 0; } diff --git a/drivers/iommu/mtk_iommu.h b/drivers/iommu/mtk_iommu.h index f81fa8862ed0..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 Thu Jan 6 21:45:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705787 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99942C433FE for ; Thu, 6 Jan 2022 21:47:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244580AbiAFVrM (ORCPT ); Thu, 6 Jan 2022 16:47:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244784AbiAFVqm (ORCPT ); Thu, 6 Jan 2022 16:46:42 -0500 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB8A4C03327E for ; Thu, 6 Jan 2022 13:46:33 -0800 (PST) Received: by mail-pj1-x102c.google.com with SMTP id rj2-20020a17090b3e8200b001b1944bad25so4541016pjb.5 for ; Thu, 06 Jan 2022 13:46:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SY5czEkZfSXZIjPhPgnaI25Y4JCRgE9mkB7SIRIjEMg=; b=VxInkVCtolIWlq4R8QhvD/B10sn9O/njUd1llzYE5tSI1+64q39+wd0nI6koEltTwm IDPskNz5cPBuRF9OnIJ7STgOnfbM3jQ6hinmHIcfdplmICrQIXXrYOPRsup2vEApwWZK 9YE1KK8MCejGRFHSfn+968gZuTnXgOIy60/Pk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SY5czEkZfSXZIjPhPgnaI25Y4JCRgE9mkB7SIRIjEMg=; b=b864zG/Vgdk8vLM+ZRmvwb6UZfej89MmSBfkhEENjkmaVlKkqq4ar9eyeqWLOAgvEx FewE90JLu59xGFj26wD6uZzsorBQI9GLg2R3LFyLCr3o423q9VJYtdEu96asZCNF/IsI jcOWQULGZm6rBn2e617dYcrbw/Xd+MUev7b6ufLGUeHs5faTs9t/DnXIJ3a1UoGFhpZL nJv2TLvI7/1M5FzYSbORoXVy0SaV7LJ/2jYT2+2VMc3psMEPPefX8X8Wus+7zlhk4aBO hzRRjLLZrUjBfxwP7Mrj6WgBAqnyUwS1yt75O1XceM1nfAhd76zTuKD/u04LwfFPLCJE oiPw== X-Gm-Message-State: AOAM5339qxDZgAOyAAVZIK8/pxlbJ4YJ7o+m3UDYRJDes8avjk3BQqQe BBamrIwqftZEzXWNi0bvGrCDaA== X-Google-Smtp-Source: ABdhPJwbg2UnIYpSvTBjjmfX8M65IZWtqUxOoJ5gDXa1KlR3zVKOJxoCt6FBFaaECG9hMQCbkgFNcw== X-Received: by 2002:a17:902:6bc9:b0:149:fdf1:f031 with SMTP id m9-20020a1709026bc900b00149fdf1f031mr2699589plt.58.1641505593321; Thu, 06 Jan 2022 13:46:33 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:33 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Tomas Winkler , Vitaly Lubart , Daniele Ceraolo Spurio , Rodrigo Vivi , Arnd Bergmann , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan , Alexander Usyskin Subject: [PATCH v5 26/32] mei: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:49 -0800 Message-Id: <20220106214556.2461363-27-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Tomas Winkler Cc: Vitaly Lubart Cc: Daniele Ceraolo Spurio Cc: Rodrigo Vivi Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Cc: Alexander Usyskin Signed-off-by: Stephen Boyd --- drivers/misc/mei/hdcp/mei_hdcp.c | 22 +++++++++++++--------- drivers/misc/mei/pxp/mei_pxp.c | 22 +++++++++++++--------- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c index ec2a4fce8581..ae903a09fb06 100644 --- a/drivers/misc/mei/hdcp/mei_hdcp.c +++ b/drivers/misc/mei/hdcp/mei_hdcp.c @@ -732,8 +732,9 @@ static const struct i915_hdcp_component_ops mei_hdcp_ops = { .close_hdcp_session = mei_hdcp_close_session, }; -static int mei_component_master_bind(struct device *dev) +static int mei_hdcp_aggregate_bind(struct aggregate_device *adev) { + struct device *dev = 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_hdcp_aggregate_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_hdcp_aggregate_bind, + .remove = mei_hdcp_aggregate_unbind, + .driver = { + .name = "mei_hdcp_agg", + .owner = THIS_MODULE, + }, }; /** @@ -826,9 +832,7 @@ static int mei_hdcp_probe(struct mei_cl_device *cldev, } mei_cldev_set_drvdata(cldev, comp_master); - ret = component_master_add_with_match(&cldev->dev, - &mei_component_master_ops, - master_match); + ret = component_aggregate_register(&cldev->dev, &mei_aggregate_driver, master_match); if (ret < 0) { dev_err(&cldev->dev, "Master comp add failed %d\n", ret); goto err_exit; @@ -850,7 +854,7 @@ static void mei_hdcp_remove(struct mei_cl_device *cldev) mei_cldev_get_drvdata(cldev); int ret; - component_master_del(&cldev->dev, &mei_component_master_ops); + component_aggregate_unregister(&cldev->dev, &mei_aggregate_driver); kfree(comp_master); mei_cldev_set_drvdata(cldev, NULL); diff --git a/drivers/misc/mei/pxp/mei_pxp.c b/drivers/misc/mei/pxp/mei_pxp.c index f7380d387bab..7b7bd7c0e8b1 100644 --- a/drivers/misc/mei/pxp/mei_pxp.c +++ b/drivers/misc/mei/pxp/mei_pxp.c @@ -83,8 +83,9 @@ static const struct i915_pxp_component_ops mei_pxp_ops = { .recv = mei_pxp_receive_message, }; -static int mei_component_master_bind(struct device *dev) +static int mei_pxp_aggregate_bind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct mei_cl_device *cldev = to_mei_cl_device(dev); struct i915_pxp_component *comp_master = mei_cldev_get_drvdata(cldev); int ret; @@ -98,17 +99,22 @@ static int mei_component_master_bind(struct device *dev) return 0; } -static void mei_component_master_unbind(struct device *dev) +static void mei_pxp_aggregate_unbind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct mei_cl_device *cldev = to_mei_cl_device(dev); struct i915_pxp_component *comp_master = mei_cldev_get_drvdata(cldev); component_unbind_all(dev, comp_master); } -static const struct component_master_ops mei_component_master_ops = { - .bind = mei_component_master_bind, - .unbind = mei_component_master_unbind, +static struct aggregate_driver mei_aggregate_driver = { + .probe = mei_pxp_aggregate_bind, + .remove = mei_pxp_aggregate_unbind, + .driver = { + .name = "mei_pxp_agg", + .owner = THIS_MODULE, + } }; /** @@ -173,9 +179,7 @@ static int mei_pxp_probe(struct mei_cl_device *cldev, } mei_cldev_set_drvdata(cldev, comp_master); - ret = component_master_add_with_match(&cldev->dev, - &mei_component_master_ops, - master_match); + ret = component_aggregate_register(&cldev->dev, &mei_aggregate_driver, master_match); if (ret < 0) { dev_err(&cldev->dev, "Master comp add failed %d\n", ret); goto err_exit; @@ -196,7 +200,7 @@ static void mei_pxp_remove(struct mei_cl_device *cldev) struct i915_pxp_component *comp_master = mei_cldev_get_drvdata(cldev); int ret; - component_master_del(&cldev->dev, &mei_component_master_ops); + component_aggregate_unregister(&cldev->dev, &mei_aggregate_driver); kfree(comp_master); mei_cldev_set_drvdata(cldev, NULL); From patchwork Thu Jan 6 21:45:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705788 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 004A9C433EF for ; Thu, 6 Jan 2022 21:47:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244863AbiAFVrg (ORCPT ); Thu, 6 Jan 2022 16:47:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244694AbiAFVqy (ORCPT ); Thu, 6 Jan 2022 16:46:54 -0500 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DD69C029820 for ; Thu, 6 Jan 2022 13:46:35 -0800 (PST) Received: by mail-pj1-x1029.google.com with SMTP id y16-20020a17090a6c9000b001b13ffaa625so10052122pjj.2 for ; Thu, 06 Jan 2022 13:46:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XGqq0UfufzgH1LXDtnLjAQyDmHk5g+0Lk09sKMzlfmI=; b=AOWN7v58HvJOqlZ6lHNZHE2A28mPb4zKe2Mj9bTZpwUh+HozXtTE3jJKFaw47lD3eY 5NtO2Oi1pTx6/Avl2BGK7Xwjzdc8hSPXzduFzhd2fF7rpBHqfzUQDhHs4/BcY7K7tS7F 0U4tA0tg9yLN38FNIeknPel3KIr+eOw+2+HBw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XGqq0UfufzgH1LXDtnLjAQyDmHk5g+0Lk09sKMzlfmI=; b=s8imvrbqBZJL+AFj/DQOoTnfvrwZiW8kRVVwW4BlS2i8RlfpklbvsOAH7BsvnMdkNN JhOY00VUzsXccbGCzbp7POm/TafWAwY7CypcFdq7+Bg4UQYYe56DFlNhWcAk3DARBxhM KQHHE89bIe3BseCshHLxtBOOQVx+qKCBr1EzjyArouOkeOgeONE0YDCM1Ydvi8Ix511J VgOpvH86hywwFCqbAfOlF/yz1/3GrA32KXV/2KZrTUGF2VHb3k5i1RZrDvNrkOjqG4Om TTxoCP83tvwjmxzA7Yp7rL6oZ3qNzQNjN7pv+/vv120gYyLMrbMMR3bfFrt2jRE4GHSr Hvmw== X-Gm-Message-State: AOAM5305cMj+v6xVPJQD8a4n4LVGgbNbV9iDjxNoIdEoFKjIeMQVUX6L 53ElZnF0v+vO8Rw0AKiALHSmPA== X-Google-Smtp-Source: ABdhPJxsrSp0V86crFp4pzNtzJwdoL0M0g2Krz5WE6X1drEmfa7npHt6A/QP0naMp9HjGxQ1EzBxtQ== X-Received: by 2002:a17:902:ce85:b0:148:d590:5734 with SMTP id f5-20020a170902ce8500b00148d5905734mr60400961plg.1.1641505594793; Thu, 06 Jan 2022 13:46:34 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:34 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Sebastian Reichel , Linus Walleij , linux-pm@vger.kernel.org, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 27/32] power: supply: ab8500: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:50 -0800 Message-Id: <20220106214556.2461363-28-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Acked-by: Sebastian Reichel Tested-by: Linus Walleij Cc: Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/power/supply/ab8500_charger.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/power/supply/ab8500_charger.c b/drivers/power/supply/ab8500_charger.c index 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 Thu Jan 6 21:45:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705789 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C64CDC4332F for ; Thu, 6 Jan 2022 21:47:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245588AbiAFVrh (ORCPT ); Thu, 6 Jan 2022 16:47:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244903AbiAFVqy (ORCPT ); Thu, 6 Jan 2022 16:46:54 -0500 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DBACC02982B for ; Thu, 6 Jan 2022 13:46:36 -0800 (PST) Received: by mail-pj1-x1036.google.com with SMTP id c9-20020a17090a1d0900b001b2b54bd6c5so10052917pjd.1 for ; Thu, 06 Jan 2022 13:46:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7Yh3mBEg2nfQJzEtBIxus+8u5VcBe7iEDAWACHn4tN4=; b=bQgFVNcdsjnA7zW9FFXSITmcWjYkWGAB8wIRURyJ5ti0xuNPsSAy9ghoYEb1syKKJs CGLf/Q/oMrQcJwXU3CDgbPhlA20klKs2lFHi/PEmoc8VHgh96v1EkUV6JppBc9bUOpOY flarDI+B9t/W/Ty3wNZQQPlH80IiRnLiaJXmQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7Yh3mBEg2nfQJzEtBIxus+8u5VcBe7iEDAWACHn4tN4=; b=SGV9Vtqtieujh7EoIuo0etmIbOtJB636SQ9RBggVmDUJXzt9ypOv3dkFOwLUKuT4qQ mN5ziHse4IJcWbvpXaFzoY8X/SWwcQUCqdCDKALEggHFSVzKofPh4IwvQt+lzmD5846F YyIg9ZBEshZLV/OYOUB1Yg9Qsu65JzgdDhmbq/cEN7Qnee2TEQtf+HA2v3Jj5T0ahU4W /5T9cGiRp3wncu2KxY3mT4hgZYpudS+G4YI8YMk/5lUtSWhOQnK0vWxaCIEUIMPekwk/ ix8BxJSDZ2z3gynNNBogauNfPgs+dvwq0zfm7uJaI+youcEo46aYp3xC589eI61eMoQi BtaA== X-Gm-Message-State: AOAM53034rnvRMACQvAVY+ookv7q9Do7o8E+UNuQtTpWV5JV2qX+eBhV MDqAAI1su7phnnuRvhkHVZo6Pw== X-Google-Smtp-Source: ABdhPJx3yLhPBYfq8wjRHSBRsuhDLs2BYE0BBSiTReIZmuvnjn2UxO8YtDDtwxw4qwXOdHpY78HYvw== X-Received: by 2002:a17:903:188:b0:149:512a:e69c with SMTP id z8-20020a170903018800b00149512ae69cmr60164734plg.40.1641505596109; Thu, 06 Jan 2022 13:46:36 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:35 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 28/32] fbdev: omap2: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:51 -0800 Message-Id: <20220106214556.2461363-29-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Cc: Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/video/fbdev/omap2/omapfb/dss/dss.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dss.c b/drivers/video/fbdev/omap2/omapfb/dss/dss.c index a6b1c1598040..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 Thu Jan 6 21:45:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705790 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6865C433F5 for ; Thu, 6 Jan 2022 21:47:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244948AbiAFVrs (ORCPT ); Thu, 6 Jan 2022 16:47:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245030AbiAFVrF (ORCPT ); Thu, 6 Jan 2022 16:47:05 -0500 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8185C02983F for ; Thu, 6 Jan 2022 13:46:37 -0800 (PST) Received: by mail-pg1-x52e.google.com with SMTP id s1so3737372pga.5 for ; Thu, 06 Jan 2022 13:46:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8jRHJbzxJCo8C1IXTJW3KiTq5EwC3cp5SncHLYDZJzc=; b=eReuh+xB+HXBzjAmlsPahN/YBwZeiwW4QIPx8qKKvBXEEvys1EVlO9m8YzP72gI66e qReW+p/tESbPl3PSl0eoZtMZ/mshzo2n9jtYYWK++biQkqwv4ERl7RWDuKoAP8oc6i0Z MVoMd+DUtrBY0hMbbo04/s41zThIM8mqEE5DY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8jRHJbzxJCo8C1IXTJW3KiTq5EwC3cp5SncHLYDZJzc=; b=ULgJXPyakIsV/l6miKDArR9GY8WB2dpdis96RP55k3SEbWYIxG7N9a5kJj6o8DxPlJ RA5M5jthpby9BINTzPejD5T/3J18RLiMJ6Rqtn8qqG3Bxw1CIWXD7Yw4HlPNRYjZkqjW 4hPTJO2Ovc4Rxssd5FKFpuZ+3LwUT8pYTU6DQAazRkq1EaLJF0aqSdV4MCEfEas3of59 cW+NnN1/jSDnwszTYbo+Jq/Sdqo93Qc2yi8+JXMyYluRUj9sdjjHx4RBKYHZ3CaPYFC3 toWcnja43QvsvyOf+K/RY8sxrDUnERhO05jp5ZZKru08YFDFv2AVTs9x1NKZ2CKD9dLj RWFw== X-Gm-Message-State: AOAM531HYlwrXdUx81ErR1DOFAOoJ3n98sCbvQz/ELRoS57yj9ITcvQL Vs+aQeUsAcyKN5ZWVwCnPWhwWA== X-Google-Smtp-Source: ABdhPJyHgT9qD3j5gx7eQngPsdPOyrFwzeyPSjZx8XO7m+E9g4eFWNl9gzOtJxE3QKVNLxFYLIS0aw== X-Received: by 2002:a05:6a00:1403:b0:4bc:80a3:19eb with SMTP id l3-20020a056a00140300b004bc80a319ebmr26380646pfu.1.1641505597456; Thu, 06 Jan 2022 13:46:37 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:37 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Jaroslav Kysela , Takashi Iwai , Kai Vehmanen , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 29/32] sound: hdac: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:52 -0800 Message-Id: <20220106214556.2461363-30-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Jaroslav Kysela Cc: Takashi Iwai Cc: Kai Vehmanen Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- 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 Thu Jan 6 21:45:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705792 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2ED8C4332F for ; Thu, 6 Jan 2022 21:47:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245008AbiAFVru (ORCPT ); Thu, 6 Jan 2022 16:47:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245035AbiAFVrF (ORCPT ); Thu, 6 Jan 2022 16:47:05 -0500 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35BEEC028C16 for ; Thu, 6 Jan 2022 13:46:39 -0800 (PST) Received: by mail-pf1-x435.google.com with SMTP id p37so3594291pfh.4 for ; Thu, 06 Jan 2022 13:46:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=N66rEkaY3Hcvo9L0yTqqS+dEsFgKt6MiGsAE0j7XsvA=; b=duTCpzs7Q9xBO5/jhvEz8d7dBWFz10UyRPM1+gs1MoWcr9Rjih5IN5nGhXwvevK79F LLH1VMRZRSRrbvBf8CSScTX1zcxPS5br+YawaCpH+p6G0YnWVaIEotrftZD5MdQGAOa4 FzTGm8fqHdWdHKUkrTNtlgHPLN8gG7IbLg8cg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=N66rEkaY3Hcvo9L0yTqqS+dEsFgKt6MiGsAE0j7XsvA=; b=UhIFzzlUw4Iqrf3ZXvVdgfhs/oRUccMeEjc1ibw4cziVXNpNBozrNorbp8s7QBeajW q2O7Y9JBw7fgTcdSY5Sm6BMPg9yjxrEx8D1GoLFYaJpN21S7IiBZmNMTXGw6QNBbYEme tbwnboN+dn+CkeHanwczQ7AXKxJ4MCzfDlkVe68DGEGauPL6DDEAp/KpucAIV7Kx8t8o Ja//5Pzjd4+wJ1K8GPQzrlfdK1FwU6aaAgSopkH7kHJWG/I82kknJWHfI7q9YfExPuVn fBCn18mFuOL5AfHLBhoFX6PmJ4TF2uxi4qpSDoe++IxXjPMP/VAxpdMZwzViv1WUVTrI 6bvw== X-Gm-Message-State: AOAM532EnrgEyKlikCLeyhhpNlqQGIngo9ajdkHR0yjo0d7SeOv3AoGP I+c5wHmQP08nU4u8oekQa6yx5A== X-Google-Smtp-Source: ABdhPJwMc7pXtV30yrUswG55aCMQDtvMJXNqLIxDsQ5YfePndNaTQa8QsvS1BLqjnpOZEiOenE8G+w== X-Received: by 2002:a05:6a00:1150:b0:4a2:7328:cce6 with SMTP id b16-20020a056a00115000b004a27328cce6mr62400254pfm.67.1641505598770; Thu, 06 Jan 2022 13:46:38 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:38 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Mark Brown , Jaroslav Kysela , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 30/32] ASoC: codecs: wcd938x: Migrate to aggregate driver Date: Thu, 6 Jan 2022 13:45:53 -0800 Message-Id: <20220106214556.2461363-31-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Acked-by: Mark Brown Cc: Jaroslav Kysela Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- sound/soc/codecs/wcd938x.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c index 52de7d14b139..f44f5d41bfdb 100644 --- a/sound/soc/codecs/wcd938x.c +++ b/sound/soc/codecs/wcd938x.c @@ -4316,8 +4316,9 @@ static struct snd_soc_dai_driver wcd938x_dais[] = { }, }; -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 Thu Jan 6 21:45:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705791 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8822BC433EF for ; Thu, 6 Jan 2022 21:47:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244994AbiAFVrt (ORCPT ); Thu, 6 Jan 2022 16:47:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245052AbiAFVrG (ORCPT ); Thu, 6 Jan 2022 16:47:06 -0500 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55667C028C37 for ; Thu, 6 Jan 2022 13:46:40 -0800 (PST) Received: by mail-pg1-x52b.google.com with SMTP id g2so3723539pgo.9 for ; Thu, 06 Jan 2022 13:46:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HmFwe71O6SgnJZrxVfyGwLakllS28Q6zlhd/maqZWnU=; b=oC+aBC1DvSyWs1byL8S+AMM9Zu/djXQvhnAeWjvOvlnZeTMYSqnmbERAdSpvGGNYLm tdgv+mY67LYuE2BD+8rhc7e7pjkRv4BqIyA7q84WzE8urLjsvcaMcjg4RasM6lZJLPsO wO14hLbGdiFL9b3CKehnp/G/BuUYpTXTgtc8E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HmFwe71O6SgnJZrxVfyGwLakllS28Q6zlhd/maqZWnU=; b=4vfMF1dViUf11xix6mp3t0LBNzuWI57bJQQ2M6W3a7iSXjFUMUziDHGPiNAWUzMxLi IDo1Pc4EKI/hizPSeUUyRXedFztIqZPMy3G2+N+jGxNAGkPd1lmoz8/+9MH4upHaTLia u9fwW7Se8Y3O3znVgkK4L6htiI7eiMUMMLEWhNYJUqgPtekzZpXlM5rLsDzIDvyqAhPR +MDTCl7gi3qz0Q21TvkJMZl9B95OhSebMdwUbCUrTei1ZWmI63+3MnWf21S78gXHsYUw ilvPJWmGr23zc7GxgAN6+ktM1TnBhoqd9coquwz4ENzwSj+FtuuihFuX3obczPjVaGYJ hPEA== X-Gm-Message-State: AOAM531W+uZrjZlslFJYRyZyDnu/vpzVDmQ2hL5bvJNZRmB5Fcpz1BWO ntP0tvIZa+DYSj1WZG1wO2wQZ6M6EFEstQ== X-Google-Smtp-Source: ABdhPJyHHiB/EXo8B0gxoZ3UvSHLGFDgF66NPCj3nIz0wmI71ULItFhSv5xHAWdhhG2PoRUUvjitlw== X-Received: by 2002:a63:350c:: with SMTP id c12mr45735439pga.568.1641505599934; Thu, 06 Jan 2022 13:46:39 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:39 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Laurent Pinchart , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 31/32] component: Get rid of drm_of_component_probe() Date: Thu, 6 Jan 2022 13:45:54 -0800 Message-Id: <20220106214556.2461363-32-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org There aren't any users anymore so drop it. Cc: Laurent Pinchart Cc: Daniel Vetter Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/gpu/drm/drm_of.c | 85 +++++++++------------------------------- include/drm/drm_of.h | 12 ------ 2 files changed, 19 insertions(+), 78 deletions(-) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 008d6b7d2283..c57216e28b70 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -99,18 +99,30 @@ void drm_of_component_match_add(struct device *master, } EXPORT_SYMBOL_GPL(drm_of_component_match_add); -static int _drm_of_component_probe(struct device *dev, +/** + * drm_of_aggregate_probe - Generic probe function for a component based aggregate host + * @dev: device containing the OF node + * @compare_of: compare function used for matching components + * @adrv: aggregate driver to be used + * + * Parse the platform device OF node and bind all the components associated + * with the aggregate device. Interface ports are added before the encoders in + * order to satisfy their .bind_component requirements + * See Documentation/devicetree/bindings/graph.txt for the bindings. + * + * Returns zero if successful, or one of the standard error codes if it fails. + */ +int drm_of_aggregate_probe(struct device *dev, int (*compare_of)(struct device *, void *), - struct component_match **matchptr) + struct aggregate_driver *adrv) { struct device_node *ep, *port, *remote; + struct component_match *match = NULL; int i; if (!dev->of_node) return -EINVAL; - *matchptr = NULL; - /* * Bind the crtc's ports first, so that drm_of_find_possible_crtcs() * called from encoder's .bind callbacks works as expected @@ -121,7 +133,7 @@ static int _drm_of_component_probe(struct device *dev, break; if (of_device_is_available(port->parent)) - drm_of_component_match_add(dev, matchptr, compare_of, + drm_of_component_match_add(dev, &match, compare_of, port); of_node_put(port); @@ -132,7 +144,7 @@ static int _drm_of_component_probe(struct device *dev, return -ENODEV; } - if (!*matchptr) { + if (!match) { dev_err(dev, "no available port\n"); return -ENODEV; } @@ -162,72 +174,13 @@ static int _drm_of_component_probe(struct device *dev, continue; } - drm_of_component_match_add(dev, matchptr, compare_of, + drm_of_component_match_add(dev, &match, compare_of, remote); of_node_put(remote); } of_node_put(port); } - return 0; -} - -/** - * drm_of_component_probe - Generic probe function for a component based master - * @dev: master device containing the OF node - * @compare_of: compare function used for matching components - * @m_ops: component master ops to be used - * - * Parse the platform device OF node and bind all the components associated - * with the master. Interface ports are added before the encoders in order to - * satisfy their .bind requirements - * See Documentation/devicetree/bindings/graph.txt for the bindings. - * - * Deprecated: Use drm_of_aggregate_probe() instead. - * - * Returns zero if successful, or one of the standard error codes if it fails. - */ -int drm_of_component_probe(struct device *dev, - int (*compare_of)(struct device *, void *), - const struct component_master_ops *m_ops) -{ - - struct component_match *match; - int ret; - - ret = _drm_of_component_probe(dev, compare_of, &match); - if (ret) - return ret; - - return component_master_add_with_match(dev, m_ops, match); -} -EXPORT_SYMBOL(drm_of_component_probe); - - -/** - * drm_of_aggregate_probe - Generic probe function for a component based aggregate host - * @dev: device containing the OF node - * @compare_of: compare function used for matching components - * @adrv: aggregate driver to be used - * - * Parse the platform device OF node and bind all the components associated - * with the aggregate device. Interface ports are added before the encoders in - * order to satisfy their .bind_component requirements - * See Documentation/devicetree/bindings/graph.txt for the bindings. - * - * Returns zero if successful, or one of the standard error codes if it fails. - */ -int drm_of_aggregate_probe(struct device *dev, - int (*compare_of)(struct device *, void *), - struct aggregate_driver *adrv) -{ - struct component_match *match; - int ret; - - ret = _drm_of_component_probe(dev, compare_of, &match); - if (ret) - return ret; - return component_aggregate_register(dev, adrv, match); } EXPORT_SYMBOL(drm_of_aggregate_probe); diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h index 9d35a141f888..33fba4f8e304 100644 --- a/include/drm/drm_of.h +++ b/include/drm/drm_of.h @@ -8,7 +8,6 @@ #endif struct aggregate_driver; -struct component_master_ops; struct component_match; struct device; struct drm_device; @@ -38,9 +37,6 @@ void drm_of_component_match_add(struct device *master, struct component_match **matchptr, int (*compare)(struct device *, void *), struct device_node *node); -int drm_of_component_probe(struct device *dev, - int (*compare_of)(struct device *, void *), - const struct component_master_ops *m_ops); int drm_of_aggregate_probe(struct device *dev, int (*compare_of)(struct device *, void *), struct aggregate_driver *adrv); @@ -74,14 +70,6 @@ drm_of_component_match_add(struct device *master, { } -static inline int -drm_of_component_probe(struct device *dev, - int (*compare_of)(struct device *, void *), - const struct component_master_ops *m_ops) -{ - return -EINVAL; -} - static inline int drm_of_aggregate_probe(struct device *dev, int (*compare_of)(struct device *, void *), From patchwork Thu Jan 6 21:45:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12705793 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F876C433F5 for ; Thu, 6 Jan 2022 21:47:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245029AbiAFVrx (ORCPT ); Thu, 6 Jan 2022 16:47:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244475AbiAFVrH (ORCPT ); Thu, 6 Jan 2022 16:47:07 -0500 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AA5DC061201 for ; Thu, 6 Jan 2022 13:46:41 -0800 (PST) Received: by mail-pj1-x1033.google.com with SMTP id c14-20020a17090a674e00b001b31e16749cso8543473pjm.4 for ; Thu, 06 Jan 2022 13:46:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lQPPjlrmfYNaZQJU5WpmjNJguM+Opu+iDFV373nUgEI=; b=HVIbZEzklAxMRu/3hS6qEUS2w9VQenVuylClk6HfQuPTHCrIy2ZAoQtPjHHAd7eW8L zwdlM1trt+idnLVgzDIOSxnYWCEtdLGphSOKjsCKItvcLCvsvXuVlQg5cxyQmwHQFS3h BWA/9Fi5cwr0LPWvXN+ZcRTGRl0XYr6C5fyZU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lQPPjlrmfYNaZQJU5WpmjNJguM+Opu+iDFV373nUgEI=; b=MNmWlsy2PIP3rejFCbUrLjFiqs6R5Dla/0tvz3ULRdo9Z5z9SGFzZemXKgzOAX9ZeF 6mkAUIyoJ4wc6hpSQuKfcRItKN0q5Co8bJTupv6PoA7Bo+IbU5YuyOHyCk0dCv+XM/9a 2FB6UlGTr+GIKbRznjSKcbfaoHxLE3GR5jdrdcXQeA29KIrX8zw4dnQVigpyIEe9FyCD uh/OUqEAsrvv7kL/i5HwlE1mnFy7ab1N+5SovEvwej1XeUE2Qkj2sELPjJIa6GB3WcIR sWpiui6xLUpZ9dK5DOVACApSOXOYWh0ycNlSaWCAJ9YnrGr7yal/kYr6C+A5N9l/nKu9 9dJQ== X-Gm-Message-State: AOAM530y9OKnnzyBNBcre6jNY3Wk0qmtgEU3yn0jTgx9a6rYcZiTwSXj 6LrGZNU51NlekbgKA80BSe74oA== X-Google-Smtp-Source: ABdhPJwWmmPVHvl582CArkqu+fGcEyz7mUGSem/oBOmpp4NV9QAX0PVmwc3fJoxhrAXvok7FSS9khg== X-Received: by 2002:a17:902:e5cf:b0:149:f5d0:5f0b with SMTP id u15-20020a170902e5cf00b00149f5d05f0bmr3715465plf.100.1641505601085; Thu, 06 Jan 2022 13:46:41 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:1ebe:a8fd:f9b0:7e85]) by smtp.gmail.com with ESMTPSA id 10sm3539960pfm.56.2022.01.06.13.46.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 13:46:40 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v5 32/32] component: Remove component_master_ops and friends Date: Thu, 6 Jan 2022 13:45:55 -0800 Message-Id: <20220106214556.2461363-33-swboyd@chromium.org> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog In-Reply-To: <20220106214556.2461363-1-swboyd@chromium.org> References: <20220106214556.2461363-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The struct is unused now so drop it along with the functions that use it. Cc: Daniel Vetter Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/base/component.c | 148 +++++--------------------------------- drivers/gpu/drm/drm_drv.c | 2 +- include/linux/component.h | 45 ------------ 3 files changed, 17 insertions(+), 178 deletions(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index e9e58b56cda4..cd50137753b4 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -133,18 +133,12 @@ static void component_debugfs_del(struct aggregate_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; @@ -405,30 +399,15 @@ static int aggregate_device_match(struct device *dev, struct device_driver *drv) return ret; } -/* TODO: Remove once all aggregate drivers use component_aggregate_register() */ -static int component_probe_bind(struct aggregate_device *adev) -{ - return adev->ops->bind(adev->parent); -} - -static void component_remove_unbind(struct aggregate_device *adev) -{ - adev->ops->unbind(adev->parent); -} - static int aggregate_driver_probe(struct device *dev) { const struct aggregate_driver *adrv = to_aggregate_driver(dev->driver); struct aggregate_device *adev = to_aggregate_device(dev); - bool modern = adrv->probe != component_probe_bind; int ret; - /* Only do runtime PM when drivers migrate */ - if (modern) { - pm_runtime_get_noresume(dev); - pm_runtime_set_active(dev); - pm_runtime_enable(dev); - } + pm_runtime_get_noresume(dev); + pm_runtime_set_active(dev); + pm_runtime_enable(dev); mutex_lock(&component_mutex); if (devres_open_group(adev->parent, adev, GFP_KERNEL)) { @@ -441,7 +420,7 @@ static int aggregate_driver_probe(struct device *dev) devres_close_group(adev->parent, NULL); mutex_unlock(&component_mutex); - if (ret && modern) { + if (ret) { pm_runtime_disable(dev); pm_runtime_set_suspended(dev); pm_runtime_put_noidle(dev); @@ -454,15 +433,10 @@ static void aggregate_driver_remove(struct device *dev) { const struct aggregate_driver *adrv = to_aggregate_driver(dev->driver); struct aggregate_device *adev = to_aggregate_device(dev); - bool modern = adrv->remove != component_remove_unbind; - /* Only do runtime PM when drivers migrate */ - if (modern) - pm_runtime_get_sync(dev); + pm_runtime_get_sync(dev); adrv->remove(to_aggregate_device(dev)); devres_release_group(adev->parent, adev); - if (!modern) - return; pm_runtime_put_noidle(dev); @@ -488,16 +462,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; @@ -515,7 +484,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; @@ -540,7 +509,6 @@ static struct aggregate_device *aggregate_device_add(struct device *parent, adev->parent = parent; adev->dev.bus = &aggregate_bus_type; adev->dev.release = aggregate_device_release; - adev->ops = ops; adev->match = match; adev->adrv = adrv; dev_set_name(&adev->dev, "aggregate%d", id); @@ -556,54 +524,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 @@ -620,7 +540,7 @@ int component_aggregate_register(struct device *parent, struct aggregate_device *adev; int ret; - adev = aggregate_device_add(parent, NULL, adrv, match); + adev = aggregate_device_add(parent, adrv, match); if (IS_ERR(adev)) return PTR_ERR(adev); @@ -632,42 +552,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 @@ -683,7 +567,7 @@ void component_aggregate_unregister(struct device *parent, struct aggregate_device *adev; mutex_lock(&component_mutex); - adev = __aggregate_find(parent, NULL); + adev = __aggregate_find(parent); mutex_unlock(&component_mutex); if (adev) @@ -719,7 +603,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) { @@ -729,7 +613,7 @@ void component_unbind_all(struct device *parent, void *data) WARN_ON(!mutex_is_locked(&component_mutex)); - adev = __aggregate_find(parent, NULL); + adev = __aggregate_find(parent); if (!adev) return; @@ -807,7 +691,7 @@ static int component_bind(struct component *component, struct aggregate_device * * * Binds all components of the aggregate @dev by passing @data to their * &component_ops.bind functions. Should be called from - * &component_master_ops.bind. + * &aggregate_driver.probe. */ int component_bind_all(struct device *parent, void *data) { @@ -818,7 +702,7 @@ int component_bind_all(struct device *parent, void *data) WARN_ON(!mutex_is_locked(&component_mutex)); - adev = __aggregate_find(parent, NULL); + adev = __aggregate_find(parent); if (!adev) return -EINVAL; diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 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 *),