From patchwork Thu Dec 2 22:26:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 520238 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 7BC8CC4321E for ; Thu, 2 Dec 2021 22:27:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349267AbhLBWbB (ORCPT ); Thu, 2 Dec 2021 17:31:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349193AbhLBWbA (ORCPT ); Thu, 2 Dec 2021 17:31:00 -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 604E2C061758 for ; Thu, 2 Dec 2021 14:27:37 -0800 (PST) Received: by mail-pj1-x1034.google.com with SMTP id y14-20020a17090a2b4e00b001a5824f4918so3633941pjc.4 for ; Thu, 02 Dec 2021 14:27: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=M08JekQWWfhJJuhYr6RW4wOJsoWLfsGZRbqzD6i13fw=; b=B+i5Ls7wrF2++Xq/jQqVhKISURVDtWKr+Of7/Dbgq4Bt0C+Du6oFRWA53Qp3IZsQQ7 vBkw6heR9rBQQrudufmJ7YQtxEqEPEG/ZP/vQpiuLI5+EWmoNlFCXYRhrjDHtIsVeViS YQ7CULwmnkFx1q1lQulAPU/9RUSQeXpwOhWow= 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=M08JekQWWfhJJuhYr6RW4wOJsoWLfsGZRbqzD6i13fw=; b=sN6qLDNF+ekpmtsVqOxwE/Ggl17lB0380SFSO5bBfLYH9hRL78ek4IQoXTSdEsOp3u d2mA1b7oshxDliN+5hqIxi6U4ytQhgbwnUWkZjYpC6I8ohp10SmMid2vlgW5VprS4W27 begExuhcc3a29EbTG4tkdxB+5s9RUIA9rFumwgwD+82S7PQ0+CIys6F1ixmMDaqMAX/L TBIvEIvYS+wRIrw9xIXR29E8Rfzeq4PKxc2v4LWSA+kwQu61OTvNNd1Ms8HfTG6lydwS 8InLhzJ/Bm/gWeMM3+3njuG3wGPc0HeYKKRgoFxV02eDiGgLryMDhMuiqO5OPqdBr3dY yeHg== X-Gm-Message-State: AOAM531JhF7/bxzFCqUj8jO+5rcNYidsx8JVXSLFHnir+bqFbaYy7ItO MoZ5EYwzwM8ZCiFpX+L5qxcP9A== X-Google-Smtp-Source: ABdhPJyvaIgvk3KgS40jCQL1KZMeoM4fJb4tO+zhFvPEG+xtzKlHXn84csPkGOfPvvfWPE3xS8XVvw== X-Received: by 2002:a17:90a:df96:: with SMTP id p22mr9145224pjv.129.1638484056924; Thu, 02 Dec 2021 14:27:36 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:36 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Daniel Vetter , Laurent Pinchart , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 01/34] component: Introduce struct aggregate_device Date: Thu, 2 Dec 2021 14:26:59 -0800 Message-Id: <20211202222732.2453851-2-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Replace 'struct master' with 'struct aggregate_device' and then rename 'master' to 'adev' everywhere in the code. While we're here, put a struct device inside the aggregate device so that we can register it with a bus_type in the next patch. The diff is large but that's because this is mostly a rename, where sometimes 'master' is replaced with 'adev' and other times it is replaced with 'parent' to indicate that the struct device that was being used is actually the parent of the aggregate device and driver. Cc: Daniel Vetter Cc: 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 | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index 2d25a6416587..d25048d04b70 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -9,6 +9,7 @@ */ #include #include +#include #include #include #include @@ -63,7 +64,10 @@ struct master { const struct component_master_ops *ops; struct device *parent; + struct device dev; struct component_match *match; + + int id; }; struct component { @@ -79,6 +83,7 @@ struct component { static DEFINE_MUTEX(component_mutex); static LIST_HEAD(component_list); static LIST_HEAD(masters); +static DEFINE_IDA(aggregate_ida); #ifdef CONFIG_DEBUG_FS @@ -440,6 +445,7 @@ static void free_master(struct master *master) } } + ida_free(&aggregate_ida, master->id); kfree(master); } @@ -460,7 +466,7 @@ int component_master_add_with_match(struct device *parent, struct component_match *match) { struct master *master; - int ret; + int ret, id; /* Reallocate the match array for its true size */ ret = component_match_realloc(match, match->num); @@ -471,9 +477,17 @@ int component_master_add_with_match(struct device *parent, if (!master) return -ENOMEM; + id = ida_alloc(&aggregate_ida, GFP_KERNEL); + if (id < 0) { + kfree(master); + return id; + } + + master->id = id; master->parent = parent; master->ops = ops; master->match = match; + dev_set_name(&master->dev, "aggregate%d", id); component_master_debugfs_add(master); /* Add to the list of available masters. */ From patchwork Thu Dec 2 22:27:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 519820 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 DC80DC433F5 for ; Thu, 2 Dec 2021 22:27:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349310AbhLBWbC (ORCPT ); Thu, 2 Dec 2021 17:31:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349282AbhLBWbB (ORCPT ); Thu, 2 Dec 2021 17:31:01 -0500 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7525EC061758 for ; Thu, 2 Dec 2021 14:27:38 -0800 (PST) Received: by mail-pg1-x536.google.com with SMTP id r138so1113154pgr.13 for ; Thu, 02 Dec 2021 14:27:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XOjdwb+RGwuxYQgDs5ovJZDeCC7N0Tblz0mG+0nxFpw=; b=iNoBaw7mU+hFQEF00m5Ady4fEwxIGZND0Ns0Rq9x3HrYyUV5cwusHClAoS2sYVGHix QirfDm5bEK0+ZtamJnu68EiMIK/z38YVH0YGJR6VOlC3f3ctUM5lDa8FIVGNx1KzJD/W sXTO/BI9X9PJK0m46+TcvdFnGaWeNSykyDcKc= 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=XOjdwb+RGwuxYQgDs5ovJZDeCC7N0Tblz0mG+0nxFpw=; b=3gYx46lIHRSoycPjbZ55WaXTEAy3XnbeQtceTGy89U7Sc3Kc6l/2R+QRwMs5BeWudZ 4KpZ/LhnN8nT2bbW0NDkw2U+PN09p8HsfumdTmsxc3tDtHw4atmyeNvC0pdrIIzgDSKx BdD+dXAuYXGsvcEw6WEUb6HvoCn6LpfegPILCxjkoSGzxbiMjF/vhmFHqnh6pRp2Y+Yf uBV9xnDB8G0jmQxNjsTMDEISiQdn+tcKr4oeIP72y8aCsfKEQO+QOWw14BaieoVMVGnW UX2v7G5bUpWOa+OgTtG266E66fV+rz9N2O9jCytx4cBWa0pgMIctwFkrEaLwKfH/nfQM IWFg== X-Gm-Message-State: AOAM5309hqsSWKv3p7jgq3bnFviPHBwboEC85eEca2JwsTfr2iVzTeeB BQqEU0beEYYrdBh15fK3wrNr4A== X-Google-Smtp-Source: ABdhPJxW1s/w1x68gVGXCa68j7541DqRocTQTy5c69uFC2yXlaN03A/b4/J1rkrJxQCNlg8CW6u8Tg== X-Received: by 2002:aa7:86c6:0:b0:4a4:ac66:99fc with SMTP id h6-20020aa786c6000000b004a4ac6699fcmr14720496pfo.83.1638484057942; Thu, 02 Dec 2021 14:27:37 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:37 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Daniel Vetter , Laurent Pinchart , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 02/34] component: Remove most references to 'master' Date: Thu, 2 Dec 2021 14:27:00 -0800 Message-Id: <20211202222732.2453851-3-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 now that we've decided to migrate all the users of the ops structure to the aggregate driver. 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 | 250 +++++++++++++++++++------------------- include/linux/component.h | 2 +- 2 files changed, 124 insertions(+), 128 deletions(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index d25048d04b70..a2a6f8def07a 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 @@ -58,7 +53,7 @@ struct component_match { struct component_match_array *compare; }; -struct master { +struct aggregate_device { struct list_head node; bool bound; @@ -72,7 +67,7 @@ struct master { struct component { struct list_head node; - struct master *master; + struct aggregate_device *adev; bool bound; const struct component_ops *ops; @@ -82,7 +77,7 @@ struct component { static DEFINE_MUTEX(component_mutex); static LIST_HEAD(component_list); -static LIST_HEAD(masters); +static LIST_HEAD(aggregate_devices); static DEFINE_IDA(aggregate_ida); #ifdef CONFIG_DEBUG_FS @@ -91,12 +86,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"); @@ -126,46 +121,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)) @@ -179,102 +174,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; } @@ -283,12 +279,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; } } @@ -329,7 +325,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 *), @@ -349,7 +345,7 @@ static void __component_match_add(struct device *master, return; } - devres_add(master, match); + devres_add(parent, match); *matchptr = match; } @@ -375,13 +371,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(). @@ -393,24 +389,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(). @@ -420,33 +416,33 @@ EXPORT_SYMBOL(component_match_add_release); * * See also component_match_add_release() and component_match_add_typed(). */ -void component_match_add_typed(struct device *master, +void component_match_add_typed(struct device *parent, struct component_match **matchptr, int (*compare_typed)(struct device *, int, void *), void *compare_data) { - __component_match_add(master, matchptr, NULL, NULL, compare_typed, + __component_match_add(parent, matchptr, NULL, NULL, compare_typed, compare_data); } EXPORT_SYMBOL(component_match_add_typed); -static void free_master(struct master *master) +static void free_aggregate_device(struct aggregate_device *adev) { - struct component_match *match = master->match; + struct component_match *match = adev->match; int i; - component_master_debugfs_del(master); - list_del(&master->node); + component_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; } } - ida_free(&aggregate_ida, master->id); - kfree(master); + ida_free(&aggregate_ida, adev->id); + kfree(adev); } /** @@ -465,7 +461,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, id; /* Reallocate the match array for its true size */ @@ -473,31 +469,31 @@ 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; id = ida_alloc(&aggregate_ida, GFP_KERNEL); if (id < 0) { - kfree(master); + kfree(adev); return id; } - master->id = id; - master->parent = parent; - master->ops = ops; - master->match = match; - dev_set_name(&master->dev, "aggregate%d", id); + adev->id = id; + adev->parent = parent; + adev->ops = ops; + adev->match = match; + dev_set_name(&adev->dev, "aggregate%d", id); - component_master_debugfs_add(master); - /* Add to the list of available masters. */ + component_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); @@ -517,25 +513,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 */ @@ -553,26 +549,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; @@ -582,7 +578,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; /* @@ -591,14 +587,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; @@ -609,16 +605,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); } @@ -636,31 +632,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); } } @@ -689,8 +685,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); @@ -771,9 +767,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 Dec 2 22:27:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 520236 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 5C8C4C433EF for ; Thu, 2 Dec 2021 22:27:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349350AbhLBWbD (ORCPT ); Thu, 2 Dec 2021 17:31:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349278AbhLBWbC (ORCPT ); Thu, 2 Dec 2021 17:31:02 -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 7EC96C061758 for ; Thu, 2 Dec 2021 14:27:39 -0800 (PST) Received: by mail-pf1-x435.google.com with SMTP id o4so915709pfp.13 for ; Thu, 02 Dec 2021 14:27: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=nnjpn2SThvIOcO+j0NZMSN00tcoyE0L+tqLJSblm2mc=; b=D/dmkDJbSE0vtZpWIN0xniNjlmEYlvKPPtiWyQL3j7/fgLaeRtONZmrZmCkzWrOJga plw0TZ6Q6DGxXktL2y0eEOwe7WO7apoTgabk+UpM1ErtFTf8fOhesl3cnZ8XaEEw6jzj UeOJNtZrhMdxQl//jDtDXhUhdJ0qopHgXBebY= 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=nnjpn2SThvIOcO+j0NZMSN00tcoyE0L+tqLJSblm2mc=; b=eRijVcDtDeMlN5HAywRNkC2uYGTOYe4FgiCW4OIMogCQCdhr6DyYFhZr1srehGFR9M xDptu62CSqlaWM7/9trzB/4OMF8aIsEc4N+hrEP1lo1BJ+11/ZkSc6OTipR8r/GQ6IDB P3qaXEFh24nKaja8Bc3r+L5buTqEFEkCDCQsTWOc/B0jkliiTpTz0kWUmRiq1+UOiic6 DSmFSRExJVEhPgZUTQwQVKGNFrKXnER68qXkrBeF9NFpDZvj2znxIxOYKFFox84RE8Cr L2waySEguDuV3Zz9bewLLzMYyPMQam12PHjHS4KfoP3aXlaEG4ri5reaIiWqLvUp5p5j Gm1A== X-Gm-Message-State: AOAM531L35xJRS+fufvUZo1GWsc1TRv5ymvuk+y2GC0NKdTp5yWZk7PQ XZd3r1mImS2g45g00q9ms6PBVA== X-Google-Smtp-Source: ABdhPJxzuQTz095Hu3getUUxx1iiY6eLvX2QZPVFdmH1VOD+Z5TnTA4nuru6tkb+7K2HspzZvczo2w== X-Received: by 2002:a62:7ec4:0:b0:4a3:219b:7008 with SMTP id z187-20020a627ec4000000b004a3219b7008mr15298548pfc.3.1638484058859; Thu, 02 Dec 2021 14:27:38 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:38 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Daniel Vetter , Laurent Pinchart , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan , Kai Vehmanen Subject: [PATCH v4 03/34] component: Introduce the aggregate bus_type Date: Thu, 2 Dec 2021 14:27:01 -0800 Message-Id: <20211202222732.2453851-4-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The component driver only provides 'bind' and 'unbind' callbacks to tell the host driver that it is time to assemble the aggregate driver now that all the components have probed. The component driver model doesn't attempt to resolve runtime PM or suspend/resume ordering, and explicitly mentions this in the code. This lack of support leads to some pretty gnarly usages of the 'prepare' and 'complete' power management hooks in drivers that host the aggregate device, and it fully breaks down when faced with ordering shutdown between the various components, the aggregate driver, and the host driver that registers the whole thing. In a concrete example, the MSM display driver at drivers/gpu/drm/msm is using 'prepare' and 'complete' to call the drm helpers drm_mode_config_helper_suspend() and drm_mode_config_helper_resume() respectively, so that it can move the aggregate driver suspend/resume callbacks to be before and after the components that make up the drm device call any suspend/resume hooks they have. This only works as long as the component devices don't do anything in their own 'prepare' and 'complete' callbacks. If they did, then the ordering would be incorrect and we would be doing something in the component drivers before the aggregate driver could do anything. Yuck! Similarly, when trying to add shutdown support to the MSM driver we run across a problem where we're trying to shutdown the drm device via drm_atomic_helper_shutdown(), but some of the devices in the encoder chain have already been shutdown. This time, the component devices aren't the problem (although they could be if they did anything in their shutdown callbacks), but there's a DSI to eDP bridge in the encoder chain that has already been shutdown before the driver hosting the aggregate device runs shutdown. The ordering of driver probe is like this: 1. msm_pdev_probe() (host driver) 2. DSI bridge 3. aggregate bind When it comes to shutdown we have this order: 1. DSI bridge 2. msm_pdev_shutdown() (host driver) and so the bridge is already off, but we want to communicate to it to turn things off on the display during msm_pdev_shutdown(). Double yuck! Unfortunately, this time we can't split shutdown into multiple phases and swap msm_pdev_shutdown() with the DSI bridge. Let's make the component driver into an actual device driver that has probe/remove/shutdown functions. The driver will only be bound to the aggregate device once all component drivers have called component_add() to indicate they're ready to assemble the aggregate driver. This allows us to attach shutdown logic (and in the future runtime PM logic) to the aggregate driver so that it runs the hooks in the correct order. Cc: Daniel Vetter Cc: Greg Kroah-Hartman Cc: Laurent Pinchart Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Cc: Kai Vehmanen Signed-off-by: Stephen Boyd --- drivers/base/component.c | 465 +++++++++++++++++++++++++++----------- include/linux/component.h | 62 ++++- 2 files changed, 392 insertions(+), 135 deletions(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index a2a6f8def07a..eec82caeae5e 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -9,6 +9,9 @@ #include #include #include +#include + +#include "base.h" /** * DOC: overview @@ -32,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; @@ -54,17 +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; @@ -73,11 +79,11 @@ struct component { const struct component_ops *ops; int subcomponent; struct device *dev; + struct device_link *link; }; static DEFINE_MUTEX(component_mutex); static LIST_HEAD(component_list); -static LIST_HEAD(aggregate_devices); static DEFINE_IDA(aggregate_ida); #ifdef CONFIG_DEBUG_FS @@ -94,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"); @@ -142,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, @@ -178,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 @@ -187,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); @@ -194,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 */ @@ -221,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; @@ -431,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++) { @@ -445,20 +395,142 @@ static void free_aggregate_device(struct aggregate_device *adev) kfree(adev); } -/** - * component_master_add_with_match - register an aggregate driver - * @parent: parent device of the aggregate driver - * @ops: callbacks for the aggregate driver - * @match: component match list for the aggregate driver - * - * Registers a new aggregate driver consisting of the components added to @match - * by calling one of the component_match_add() functions. Once all components in - * @match are available, it will be assembled by calling - * &component_master_ops.bind from @ops. Must be unregistered by calling - * component_master_del(). - */ -int component_master_add_with_match(struct device *parent, - const struct component_master_ops *ops, +static void aggregate_device_release(struct device *dev) +{ + struct aggregate_device *adev = to_aggregate_device(dev); + + free_aggregate_device(adev); +} + +static int aggregate_device_match(struct device *dev, struct device_driver *drv) +{ + const struct aggregate_driver *adrv = to_aggregate_driver(drv); + struct aggregate_device *adev = to_aggregate_device(dev); + int ret; + + /* Is this driver associated with this device */ + if (adrv != adev->adrv) + return 0; + + /* Should we start to assemble? */ + mutex_lock(&component_mutex); + ret = find_components(adev); + mutex_unlock(&component_mutex); + + return ret; +} + +/* TODO: Remove once all aggregate drivers use component_aggregate_register() */ +static int component_probe_bind(struct aggregate_device *adev) +{ + return adev->ops->bind(adev->parent); +} + +static void component_remove_unbind(struct aggregate_device *adev) +{ + adev->ops->unbind(adev->parent); +} + +static int aggregate_driver_probe(struct device *dev) +{ + const struct aggregate_driver *adrv = to_aggregate_driver(dev->driver); + struct aggregate_device *adev = to_aggregate_device(dev); + bool modern = adrv->probe != component_probe_bind; + int ret; + + /* Only do runtime PM when drivers migrate */ + if (modern) { + pm_runtime_get_noresume(dev); + pm_runtime_set_active(dev); + pm_runtime_enable(dev); + } + + mutex_lock(&component_mutex); + if (devres_open_group(adev->parent, 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; @@ -467,40 +539,114 @@ int component_master_add_with_match(struct device *parent, /* Reallocate the match array for its true size */ ret = component_match_realloc(match, match->num); if (ret) - return ret; + return ERR_PTR(ret); adev = kzalloc(sizeof(*adev), GFP_KERNEL); if (!adev) - return -ENOMEM; + return ERR_PTR(-ENOMEM); id = ida_alloc(&aggregate_ida, GFP_KERNEL); if (id < 0) { kfree(adev); - return id; + return ERR_PTR(id); } adev->id = id; adev->parent = parent; + adev->dev.bus = &aggregate_bus_type; + adev->dev.release = aggregate_device_release; adev->ops = ops; adev->match = match; + adev->adrv = adrv; dev_set_name(&adev->dev, "aggregate%d", id); + ret = device_register(&adev->dev); + if (ret) { + put_device(&adev->dev); + return ERR_PTR(ret); + } + component_debugfs_add(adev); - /* Add to the list of available aggregate devices. */ - mutex_lock(&component_mutex); - list_add(&adev->node, &aggregate_devices); - ret = try_to_bring_up_aggregate_device(adev, NULL); + return adev; +} + +/** + * component_master_add_with_match - register an aggregate driver + * @parent: parent device of the aggregate driver + * @ops: callbacks for the aggregate driver + * @match: component match list for the aggregate driver + * + * Registers a new aggregate driver consisting of the components added to @match + * by calling one of the component_match_add() functions. Once all components in + * @match are available, it will be assembled by calling + * &component_master_ops.bind from @ops. Must be unregistered by calling + * component_master_del(). + * + * Deprecated: Use component_aggregate_register() instead. + */ +int component_master_add_with_match(struct device *parent, + const struct component_master_ops *ops, + struct component_match *match) +{ + struct aggregate_driver *adrv; + struct aggregate_device *adev; + int ret = 0; - if (ret < 0) - free_aggregate_device(adev); + adrv = kzalloc(sizeof(*adrv), GFP_KERNEL); + if (!adrv) + return -ENOMEM; - mutex_unlock(&component_mutex); + adev = aggregate_device_add(parent, ops, adrv, match); + if (IS_ERR(adev)) { + ret = PTR_ERR(adev); + goto err; + } - return ret < 0 ? ret : 0; + 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 + * @adrv: aggregate driver to register + * + * Registers a new aggregate driver consisting of the components added to @adrv.match + * by calling one of the component_match_add() functions. Once all components in + * @match are available, the aggregate driver will be assembled by calling + * &adrv.bind. Must be unregistered by calling component_aggregate_unregister(). + */ +int component_aggregate_register(struct device *parent, + struct aggregate_driver *adrv, struct component_match *match) +{ + struct aggregate_device *adev; + int ret; + + adev = aggregate_device_add(parent, NULL, adrv, match); + if (IS_ERR(adev)) + return PTR_ERR(adev); + + ret = aggregate_driver_register(adrv); + if (ret) + put_device(&adev->dev); + + return ret; +} +EXPORT_SYMBOL_GPL(component_aggregate_register); + /** * component_master_del - unregister an aggregate driver * @parent: parent device of the aggregate driver @@ -509,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) { @@ -565,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); @@ -659,6 +845,7 @@ int component_bind_all(struct device *parent, void *data) component_unbind(c, adev, data); } } + put_device(&adev->dev); return ret; } @@ -682,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; } /** @@ -757,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); @@ -768,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 Dec 2 22:27:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 520237 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 01277C43217 for ; Thu, 2 Dec 2021 22:27:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349201AbhLBWbE (ORCPT ); Thu, 2 Dec 2021 17:31:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349324AbhLBWbD (ORCPT ); Thu, 2 Dec 2021 17:31:03 -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 11EECC06175A for ; Thu, 2 Dec 2021 14:27:40 -0800 (PST) Received: by mail-pf1-x436.google.com with SMTP id o4so915722pfp.13 for ; Thu, 02 Dec 2021 14:27: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=+OZEUzbJkhEl2ueO+0tubjfHfZwZ/3lRZTTLw8nIUe4=; b=hc4JGce2pZd1DWKE774zOsNlhycYp1UvUWX6JaKj7jkGVvKn09HeEo7ZeEZwH6iH84 6lnSrvPwcvrHX7MVjsAsHF7vhLTuJNPOa1CHcN2Pa6KWDtVndA4i97T1Noic7mdhhGt1 rrPEQOT78bWT9O/4PWfmzKoteAtSm/JQq1Gmc= 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=UCvRHlvLbarH65dn1kaNiSuXKkQBIuJs+CC0SeZekc9av7MCkL3q2LZD2dK3xIZ91Z p1jPvJaRF9L330dQfCr6lRb6haQffo1iAobI73E1eyPQYdNOkwwwq6CxvUXrRjzdXozV g5rM4lMv6a8zV69mxkciM+lVdCcX308MJh2EFcykJFrXHOlEKKDkFpZHz4lLX6VyzDHk 4HksajpJjmn3/sWMkehgOm97AsbAEcFDU7ls9nn94ZwlsgChcCenNc+5XMwEbT3E4PBi C37lnxrR1rKGPjnucDeVVAJbeX30tQKLa33OtsJDMgQAoINcT/VQN8UONdjZLt5sXRxa KD3g== X-Gm-Message-State: AOAM530h2GJ9XIdULN+DgBDdO4W9NbKQ46Ii8/XiqmuSSd094/r7surA WHhRNluGopGriGS8V5KKxLKLfw== X-Google-Smtp-Source: ABdhPJwiY55jDA28x9n5iZ6VVhrQyYsyqFFR5L0DFKk6xLstxRqZjnkU4tFz0X8NjRuNCvXhZFCd+w== X-Received: by 2002:a65:5ac8:: with SMTP id d8mr1555647pgt.258.1638484059598; Thu, 02 Dec 2021 14:27:39 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:39 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Daniel Vetter , Laurent Pinchart , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 04/34] component: Move struct aggregate_device out to header file Date: Thu, 2 Dec 2021 14:27:02 -0800 Message-Id: <20211202222732.2453851-5-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 Dec 2 22:27:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 519819 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 CCEA4C433FE for ; Thu, 2 Dec 2021 22:27:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349396AbhLBWbF (ORCPT ); Thu, 2 Dec 2021 17:31:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349358AbhLBWbD (ORCPT ); Thu, 2 Dec 2021 17:31:03 -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 D8DF0C061758 for ; Thu, 2 Dec 2021 14:27:40 -0800 (PST) Received: by mail-pf1-x430.google.com with SMTP id n26so967317pff.3 for ; Thu, 02 Dec 2021 14:27: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=wHTGmIfG7F9SDIRewz7zNR4I/bW/soPNx1fVWL7SSqg=; b=TIhzbwW7xTHq27qJYHACDhp2KHurEns7No/8zr4oeHK5WpKcaX2tdKQG/2Sq6MTgMc u6JYB1BJuxA9+Ndi47NNPXQzi9rkXp8AibeeFayghSUdd/814AmzOwFPk79RSADLlHrG ZRj61JMjB9Ung1m1l2YWQAdc4oNREC4YGw5XQ= 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=jeR7Ogznuy9pyyALOEZVRnJ4X1fcfWyCwpx+zNbkbjb1aX6cmgVoT0TehppbgzaXM1 os8QZLqyMgFQYtednhJBKjVhe/Q8qTflZGLChkt8KIbd4oWaQRtP0Z7JBBPdWKotgr5j 1OTBdOzg3kV8U0BsBAFRB8FNrQLwo8KcUR0PeAi+ACVG8xCuKDbHr4J0U07QOna2Xywe SifdCuw9iB4jCdI+BTRNUaEwYwCgsm7+p6ycjwYctokLPl8s1wWZTIps4BaFvE4xRPey QQc9Til1eE48F6KymneF1+ZNh9MK5bL4LqMI3WiEcp+wHJ8b0guFl1LRGrM+cAX2NBbc AY6A== X-Gm-Message-State: AOAM533cJd0YsxfiBYWGTdOzCDKkRgCP+6O+g1JV50crzvVd0XTptJf/ 3Pi5EJwvzUIufMVQSEDeoLiUHA== X-Google-Smtp-Source: ABdhPJzqNNOM+2d0wWt373IhGLQCkfpQ8uaLs4Awk+SD55er6894XsVy3NxTKfixb7gtqrTcou2m/A== X-Received: by 2002:a05:6a00:15c1:b0:49f:d21f:1d63 with SMTP id o1-20020a056a0015c100b0049fd21f1d63mr15298896pfu.18.1638484060421; Thu, 02 Dec 2021 14:27:40 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:40 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Daniel Vetter , Daniel Vetter , Laurent Pinchart , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 05/34] component: Add {bind,unbind}_component() ops that take aggregate device Date: Thu, 2 Dec 2021 14:27:03 -0800 Message-Id: <20211202222732.2453851-6-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 Dec 2 22:27:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 519818 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 9DD1BC43217 for ; Thu, 2 Dec 2021 22:27:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349290AbhLBWbG (ORCPT ); Thu, 2 Dec 2021 17:31:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349282AbhLBWbE (ORCPT ); Thu, 2 Dec 2021 17:31:04 -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 E1E93C061758 for ; Thu, 2 Dec 2021 14:27:41 -0800 (PST) Received: by mail-pf1-x429.google.com with SMTP id 8so964147pfo.4 for ; Thu, 02 Dec 2021 14:27: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=pT87OQ3egRwLpYLDnQ//DolOVTqHrwpGRKkmvVo/d+g=; b=XTbi4aHkbtNGDS7j3bk/TaTjb/qaeMqit0a8uTadCumr1MKDxtoauG1mCIwIPKQ8XS Dn2yKv1Gx/uoxx2EBmq0nBjU+M+6KJuQG2sm6bL9kHKH2MRKkUrwpKsWZYlttmASv0oT t6BdBty57VcoUZiABSAuPxOAMQFZBsibnbQ/k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pT87OQ3egRwLpYLDnQ//DolOVTqHrwpGRKkmvVo/d+g=; b=VGdtwZ8BW8XkdLmWCQ7f3WlLc8PNlTi7fAiyWkkHS6rXPkoGRPYLv0BETTdsHCTcKq NmBO0ehx2pxxb6u0EdL+Ao3P/n3mq065iLbqH7L3dN7h5LaRTVM//P9Moo25ddAtzyV7 zDM3TawrzcjeRVeiNA9KDApMpfteHZY8DFq+JRwzWsZyNzoZaDSQ6bGQhL0dvSV8NN5g 7M2dt1gHTMhytezdPMx82mkbWwWfY1WsZaiKyLyp8wYFLyb3nRB3agji7VqV7wmhEw4F Y4fr+UYzmr2bQlw7TSiCB6k3egpJKMDQ4A560apvkp5l5YPbuMD0XwmkmkUk3XAgWgxB tnhQ== X-Gm-Message-State: AOAM5311cVRNMHE/21tGM5ELNkVc0VaKMBBZKnYLV8qwX7EGac5QqXCU Up5N8G5hrMqFEpTM/ppmmRoRJw== X-Google-Smtp-Source: ABdhPJzOYaMldd9Pb2GkPUyu2nNVp6KEkzwLQ/LFvfUFYAYdtoCKXeDzVhnicKPYB7tDFx/fdclhpQ== X-Received: by 2002:a63:1446:: with SMTP id 6mr1569849pgu.150.1638484061394; Thu, 02 Dec 2021 14:27:41 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:40 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Laurent Pinchart , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 06/34] drm/of: Add a drm_of_aggregate_probe() API Date: Thu, 2 Dec 2021 14:27:04 -0800 Message-Id: <20211202222732.2453851-7-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 Dec 2 22:27:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 520235 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 D9C38C433F5 for ; Thu, 2 Dec 2021 22:27:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377190AbhLBWbH (ORCPT ); Thu, 2 Dec 2021 17:31:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356376AbhLBWbF (ORCPT ); Thu, 2 Dec 2021 17:31:05 -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 A0037C06174A for ; Thu, 2 Dec 2021 14:27:42 -0800 (PST) Received: by mail-pf1-x436.google.com with SMTP id g18so958960pfk.5 for ; Thu, 02 Dec 2021 14:27:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MLFo5uJ88/q78BTGkhEJmKSkKMysd8HwfQglPXTN2wU=; b=YOIWSmyXUC1gwfBg+mxcJI6bLd1QZuk7ZXAp8JtJ8Rx4P6txp6z2xi2PJpbwbIzcrE T2gZqoGJYJHR3UkQ00XqRplYmb6aGolq68S0za0jKVARthPRWJ2BaC2wHe9dQme4dlZP qq1ERd7mragzTa02G2Ol6b/9pOTXvUHz1gp4s= 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=FftXzMgBp9AxWCqTnx+sH0+zAXJztekBQrDx3bR6GUrUCmZlTzSMccIwIgVEc0ZdL6 rwFvBnZEMV4MDT+RFP2u5JE4Ei3G043XUOsRuR/ZTd+a2lPzK1fiRcyAJXpJBe6X+I31 yCUYHQU2Xj0k9/1dj8uvJbZNEHO3Pxp6P9mkgMzw5svxMNnI7hH7h/LmOHgqOzfWXCAm CImEqAMeHg0mqYt+nq+zouEtep7808Z1Vcuknwj3mioUCr1xvieS1DYMKgm+LTgWoB2q ME7S9ET0paMP8WxFCcnV1wAtxOIJ/lbVWo4CIyxD62+nq1wc3zpFHAt2J1g1AKVBfCfZ CORg== X-Gm-Message-State: AOAM532HYdLOvg4HX0hNYGhfCUR7WIGJuyv744g/2uVTl2lE0zv/+uKv R79sJkB8y+oAy/EiTqpQNLayQg== X-Google-Smtp-Source: ABdhPJwllu4eSCuzfr6fRf0Jpy2tTgWg6gjx2VzA44DzgUx5jyEEuWVialv1QGChSerhR2xWJyioHg== X-Received: by 2002:a63:904a:: with SMTP id a71mr1528938pge.241.1638484062175; Thu, 02 Dec 2021 14:27:42 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:41 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 07/34] drm/msm: Migrate to aggregate driver Date: Thu, 2 Dec 2021 14:27:05 -0800 Message-Id: <20211202222732.2453851-8-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 Dec 2 22:27:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 520234 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 D8FCCC433FE for ; Thu, 2 Dec 2021 22:27:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377210AbhLBWbH (ORCPT ); Thu, 2 Dec 2021 17:31:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377167AbhLBWbG (ORCPT ); Thu, 2 Dec 2021 17:31:06 -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 7A6D1C06174A for ; Thu, 2 Dec 2021 14:27:43 -0800 (PST) Received: by mail-pg1-x530.google.com with SMTP id r138so1113309pgr.13 for ; Thu, 02 Dec 2021 14:27:43 -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=laptljn+mS1jCHaMa/saNMEfnEIumKR3Kw56m2jL9msHSZPUUjaf0D8i2FDb4E1/im sDRbu2g6TORJ94p0AJyDzfkVNH4ROKSpUpjGuXR/0OJJqmUijGpCSuLaSLfcgJ+QbqiV HmXJIsvGQpb0iwRD4iXy2r+7d6ertsYT4kOg8= 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=qXKt76bxrqpu6o2OOP6oQf1Bn3vFwjx5/qoWlIlpJQcg7c6abAaiBAUb7SMmHZRhZF 0OHrec7QDlkc2HSNqgeu78axU5l/SoDE1EWR8om1p04EVp6HZCiTbgphnrhULOXarkzN 0lFKHEqplvzZD/r33jJsZ4TUCo2awN5PzbBuJKEDGQNZFynkcM04MLr8rSnZzF+5hziC /osel/MfemmcYofMUAfBp2cC3KFML5y2pTtPdGZfdnWtaZZ4+4nfaheiWUlm+5x0VOwU 5SQL0Wm3uxQtc9zE1hJztPQZaOcWD/4W2FIn+lkcXYGcXtY1DZza8JlsBKZzKttSDTMz DO7A== X-Gm-Message-State: AOAM530Fptqgorjslbb30sMUmmTylYnmKdsJvKySx32sdi6qt/KRZ2Fr x+HIlJgBK8IhLt8eZrAFAfbpLg== X-Google-Smtp-Source: ABdhPJzgC2BA6lM6AQuBQ3MmHaEre1h7NVDLyDuRYjggCOkuycTWWP2ntL1TrPHEFg5jdlgO8D3UXA== X-Received: by 2002:a63:6907:: with SMTP id e7mr1522235pgc.481.1638484063023; Thu, 02 Dec 2021 14:27:43 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:42 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, James Qian Wang , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 08/34] drm/komeda: Migrate to aggregate driver Date: Thu, 2 Dec 2021 14:27:06 -0800 Message-Id: <20211202222732.2453851-9-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 Dec 2 22:27:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 519817 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 CEDE1C433F5 for ; Thu, 2 Dec 2021 22:27:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377222AbhLBWbI (ORCPT ); Thu, 2 Dec 2021 17:31:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356400AbhLBWbH (ORCPT ); Thu, 2 Dec 2021 17:31:07 -0500 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43F58C06174A for ; Thu, 2 Dec 2021 14:27:44 -0800 (PST) Received: by mail-pf1-x431.google.com with SMTP id o4so915884pfp.13 for ; Thu, 02 Dec 2021 14:27:44 -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=TjqoJhhXaMP8hQlnS9mUSCYUDbyLXLVNi4ZHMPz7cMNMk89AJHT7ut7rIOAmSOtbPT CM/EMZKOMnPjVOh1Cs9zslDLklE243BdGdVj8ymfawIZQCJQ5dS5YUHc+Ibj8DTzlKxA IKypX8XmEuoMlr5UhMowgQybQ1aOPnRfDUqMg= 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=Vrhphst94oqio53BKmeHY0w3f/bb2GzyvnMMMt2uRflMyDlpZqIjd2Sy6Xu9ohdYQ3 QwxD7bK6xt54XeZYWGkte26gWUwFATmJges3aWhoukfy2hUhrOgQ20xnoYI9f82j7Inc RrnvY+mGsL7CJa288psGkFM/V7Bp/6mXm6Zq6+18lcBMRbl3+IFUnSkNfoKT0gwjJVgJ ohItRel/Ik+1G0lDrUFnr+Sqxczk/70rp8koCME8uHGADC+dZeOrdcHir3qmcHkYEGtQ 1Zq0lgLw2t4nR4YyVVXXUeN9i6JXT8NFEmeyC+cazPJ99wxJYMY271EoWE0XCtoTtA6K Lqbg== X-Gm-Message-State: AOAM5312XLVGXL4C4RuhHaXPNmURIZtZHTlJlDSW3Q1fiUExxO0ZG0lk /0Fupkv6X4G/tFt416S3i+HI6w== X-Google-Smtp-Source: ABdhPJymhpPWoRgTHhyDy+KR0Ms3HpYkh5COqphEYyWJv6Q+0OX4qWjOQ3OwkIsidViKOltM3lMIDw== X-Received: by 2002:a63:4a42:: with SMTP id j2mr1552651pgl.113.1638484063815; Thu, 02 Dec 2021 14:27:43 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:43 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Liviu Dudau , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 09/34] drm/arm/hdlcd: Migrate to aggregate driver Date: Thu, 2 Dec 2021 14:27:07 -0800 Message-Id: <20211202222732.2453851-10-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 Dec 2 22:27:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 520233 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 6A4EAC433FE for ; Thu, 2 Dec 2021 22:27:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377260AbhLBWbP (ORCPT ); Thu, 2 Dec 2021 17:31:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377218AbhLBWbI (ORCPT ); Thu, 2 Dec 2021 17:31:08 -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 1A9A6C06174A for ; Thu, 2 Dec 2021 14:27:45 -0800 (PST) Received: by mail-pj1-x1029.google.com with SMTP id j5-20020a17090a318500b001a6c749e697so3926717pjb.1 for ; Thu, 02 Dec 2021 14:27:45 -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=odwqzjRkBmxA1qXzAb8CtaV8Ax17PvJAsF8AWA5KlGHBc9xiJ20mEnFtBc9/S0n2DS m5c2HgazJs1iEEriuNiaJGQstV3se73Rp9LsgIm8iHfGJY8nQorkhMitamkq8qynQfK6 EUNGQbhmWVuUpWpQ7GeD3K90KEgEaF78pPYEg= 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=uzUTz5xzN7U7R2j3qOgrvirPWNbaQxBiCwcjjx4ypwAIR5qmLWVr+lfvt+87XcV6HA pTMx3HzLmZ4kOSeIo8+HL9ooovRfNOEdN7Tu3zJUmm6yFwLnP7s1ZhDZMV7jsV2ru14f vRGNK1ehf2VkWyusX8hZKRQbiKvLEN7Yo5MuCevnHPITXuM4cbRCmkcnrwXuiWK1hzyD mKDLHhPEysLeY/z/4MtBLLNpcoqMKaUtdz40IJ2WDCiGuTsVd9ehRVNRe7uL5E/wePtP ZTzXcO+IwZxCmincS15ZWFdNu5oxTKaAhiQro6KaPv/qOGC+Vhx2liS6LyqQ3vWoG52P FOJA== X-Gm-Message-State: AOAM533tWtDEFizW8cZSEEhxW/P3n03NMASaVScqJy4h/j9adFASB8s+ dj+rHLKm30syF07p/UqYTfgeHA== X-Google-Smtp-Source: ABdhPJzTjzlJn/+0dlB7m+bDOcOE8sPA8L78n/0o1kEtXiZ8GrYP+EFvD6RSgzQOktKB+UYrIdbj7A== X-Received: by 2002:a17:902:6acb:b0:142:76c3:d35f with SMTP id i11-20020a1709026acb00b0014276c3d35fmr18280297plt.89.1638484064692; Thu, 02 Dec 2021 14:27:44 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:44 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Laurent Pinchart , Liviu Dudau , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 10/34] drm/malidp: Migrate to aggregate driver Date: Thu, 2 Dec 2021 14:27:08 -0800 Message-Id: <20211202222732.2453851-11-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 Dec 2 22:27:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 520232 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 9E7ABC4332F for ; Thu, 2 Dec 2021 22:28:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377249AbhLBWba (ORCPT ); Thu, 2 Dec 2021 17:31:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377214AbhLBWbO (ORCPT ); Thu, 2 Dec 2021 17:31:14 -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 E020BC06175C for ; Thu, 2 Dec 2021 14:27:45 -0800 (PST) Received: by mail-pj1-x102b.google.com with SMTP id j5-20020a17090a318500b001a6c749e697so3926731pjb.1 for ; Thu, 02 Dec 2021 14:27:45 -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=TYTXsCnVyVTMggbeBEtilnBT75yzpjt35jbDKimuVcwhwcfmhkMUt0O/B8rQUSvzVj kwqQbp0iz9i7spvQquprrlXz+cCMKl886MW5eEdqmhfabJFDvTz0TDar0r/FXI9Ps3yH Shju2GWwcGqS3zvrpgS+tWBipo/I9FiU9cxPk= 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=jg7kpxnvrmB5QzuJT9MC9JNfLYbb1lhwK0PFIIx1nFEzAhIgpgKF2iVEx0xI6oEaIA Mv+XsczY2PonPYA9G3Y0muR7tHJTg45EhZBMqoXO/PHRNXdwHbQMaXRBYVGRzhHx3z6u WUCtGYRU5bPLfo4Zr3j1jSJeeLXTPq900dW+p41sVxtO8yu2hotU+SWCL59TDsEEmaBF 73E4InvSKvBDDZXHimuxtOalaAOw35D84KWelpspYMtwXVb9jZmjhB/asVEK4LIW3Tjj b7591TZEEHrTSKa/HPEmplto/xGv+WXms/cx1+HvHWaqXAflX383fs0h5oKFECRLO5Cu 4IWg== X-Gm-Message-State: AOAM531D2gl0OJmZ0J9pry1gaagjlwS21Q+E01tkSZzS+mYvWYh1ZmUN 8UuCMkRRniuMrZHCBJ162AXAMA== X-Google-Smtp-Source: ABdhPJyNC53JvGfTRvEHLfMmhZGaR3cy2dCdn1n96q59Rc7U/59GKl5q24SheXagRu3oedysUHBoYQ== X-Received: by 2002:a17:903:24d:b0:143:beb5:b6b1 with SMTP id j13-20020a170903024d00b00143beb5b6b1mr18420870plh.54.1638484065458; Thu, 02 Dec 2021 14:27:45 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:45 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Russell King , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Saravana Kannan Subject: [PATCH v4 11/34] drm/armada: Migrate to aggregate driver Date: Thu, 2 Dec 2021 14:27:09 -0800 Message-Id: <20211202222732.2453851-12-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 Dec 2 22:27:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 519816 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 5C2C6C433F5 for ; Thu, 2 Dec 2021 22:28:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377319AbhLBWb0 (ORCPT ); Thu, 2 Dec 2021 17:31:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377252AbhLBWbO (ORCPT ); Thu, 2 Dec 2021 17:31:14 -0500 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4109C06175D for ; Thu, 2 Dec 2021 14:27:46 -0800 (PST) Received: by mail-pl1-x635.google.com with SMTP id b11so716137pld.12 for ; Thu, 02 Dec 2021 14:27:46 -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=edVjBt2zUt8d3ir9bHAny/D3iecuGEgCqLqHfB5LmxlqM/yeay/mFqvVssTz8pJmS1 jIweoBkWZO8bpd1W6q5ofzuSBydx3x8o279iLi58XYs+aUU3Ru8bhRqzS309BXG95AOM pii45rKsVjczgp4/CPME0N90C+u8Xq5jwOJ0E= 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=DahajofM9Sm/rDfaHlUgFJSsqxh2AB009UZWweLB+IiBFqVNLop3VfBPvN1InNbqIU vEi4fiSdy3PjqvsNoyFsDR5C0204vW8JsgGb9UgGEGbCWms+1vXr0mzy7DhkPNdMWJWL uXNsnKDe5hvAESVE2MMkexai9OLkMZo0VJtNebyfm1khqeAfXOh/V5jsxhDDLck8SseJ WtJNClJXWuIveCfYTAE9mDph/5iBllIuxqPRGFLX54wiYp+2300kyTOMTO9rJu+ySFZu TxjsjrwZbRErCLylpQW0+Wg/xlGs1axS4nLQA859xewvYapag0q1f1NUUftlIx9fg1sC fIzg== X-Gm-Message-State: AOAM533sUnLkxCfxBrCofTMumFC4rIB9YlP0Ogjmq8TkFCrDU0puHFJT NmAPgLKzXeht5B9e+Of2y/FR/Q== X-Google-Smtp-Source: ABdhPJwr+y/130Jtap14aGacCeh6jp3d9XXNKHQZYwirxPlGzgQbGLR2z4IOOYuR0xMawVt16u+bLg== X-Received: by 2002:a17:902:7890:b0:143:c4f7:59e6 with SMTP id q16-20020a170902789000b00143c4f759e6mr18430277pll.87.1638484066222; Thu, 02 Dec 2021 14:27:46 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:45 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Lucas Stach , Russell King , Christian Gmeiner , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Saravana Kannan Subject: [PATCH v4 12/34] drm/etnaviv: Migrate to aggregate driver Date: Thu, 2 Dec 2021 14:27:10 -0800 Message-Id: <20211202222732.2453851-13-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 Dec 2 22:27:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 519815 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 59408C43217 for ; Thu, 2 Dec 2021 22:28:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377355AbhLBWbb (ORCPT ); Thu, 2 Dec 2021 17:31:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377253AbhLBWbO (ORCPT ); Thu, 2 Dec 2021 17:31:14 -0500 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 745CEC06175F for ; Thu, 2 Dec 2021 14:27:47 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id fv9-20020a17090b0e8900b001a6a5ab1392so919070pjb.1 for ; Thu, 02 Dec 2021 14:27:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9+fM2dIjOxE0hdJ7o5inMEoSl4k+Dtn8hCQbdOli+o8=; b=kxpNddAVM4UCApGa0KgV8xIMvcDMIdpjD4RGHf1INXzxIARtFcb/ceJ42oAKt+pbKH 32yRL5dBk+m+WNApwcyqWPBD8fRndcP8dHT+ABXxTjfg1XfneNevPDGhnI4RrXF7V4Rf zL4LfBVJVjs0AvFc8W5VMfZpVOIyD2QswVMKM= 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=6358VGmqFCYNMCLgL/7YOzLNvjZcrLAu4M0jVO5EEsnXQLolNyC2V76E9sm6YCCIMD 1tbm+iPGodxAbEY4DafKqpGCbYLyhNvobG0ZrUY3+8aBSQfHCGtmlEdh4n5SN6J/E2oF CqZWa7x4LRZfA9VcjdH3/1LAsFjTIw2LmpR0A0p2Xx6oIWzj9YCGZ2/9B7SKjM3i5+SW G5Q+zPZtkyy/nwt5OxvDjD0htZEiKRgx+WARvsvHeTLY2fMFyy9H0OWnIUmqIzGk2Ebz 6+QWoMtoUtE2LXSgfytJpNSAYUO67MZeIqxEWaZrMCWuKSDLnKoXFigEVtwkdVMvGZOt hqsQ== X-Gm-Message-State: AOAM531HjFAfozhiQsqFNhbDtCCNntjgB6Nmd66jlqy5nfN4kGc/ZmKk 5BwWWLIfG8VJ2CpQXC3aLErpVQ== X-Google-Smtp-Source: ABdhPJxTZlGNfuA/xaAscqobgPYNHZgkmBds2sudAVjr3LMNuV9Di1NVWX7maUGJpvtWiw8izHw5ZQ== X-Received: by 2002:a17:90a:cb98:: with SMTP id a24mr9100420pju.153.1638484067036; Thu, 02 Dec 2021 14:27:47 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:46 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Xinliang Liu , Tian Tao , John Stultz , Xinwei Kong , Chen Feng , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 13/34] drm/kirin: Migrate to aggregate driver Date: Thu, 2 Dec 2021 14:27:11 -0800 Message-Id: <20211202222732.2453851-14-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 Dec 2 22:27:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 520231 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 74004C433F5 for ; Thu, 2 Dec 2021 22:28:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377383AbhLBWbd (ORCPT ); Thu, 2 Dec 2021 17:31:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377258AbhLBWbO (ORCPT ); Thu, 2 Dec 2021 17:31:14 -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 3F4D4C0613DD for ; Thu, 2 Dec 2021 14:27:48 -0800 (PST) Received: by mail-pl1-x62f.google.com with SMTP id v19so739056plo.7 for ; Thu, 02 Dec 2021 14:27:48 -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=h6Zc00mbdNK4C5OKSsLKR+Q5xo/hWZf9dntwCh9eLhyHChFuCiFp48PqdvBc9zQLvX 5cW4RQoyc4XWAoC+w+gkdIICQjYWXHg7WFYJpFRNdf8T3MsRBN7Pg2Q2s7mplQYCk8Pw Q2GJuIDu/DUPETO/rxcEyAkD7AYJ9yjkSz22o= 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=lqZ8Gxnx35yTUawvEfG1ZAdGel77f4/RSIEdx14OoOezEEiT5X30taGCk6rIMEBlq9 B8ph7AN3k9SOftDm6oP3kQXvVNREGmr/lwxik5sExnsSvpxLT734zeirQKsCih5zFRkk D4jLlLaVpm24ZlytRR59/AlqUC4T5M4VOMO/lgVuG3193cFABQhqOufDpE4yIXJB1Qpr lyh2TJhVVNa5WU+djy/f1vy32u8RAL8pOCW8Ze1I2JD+/Ge6otWSyJPbI00poAR9l9n8 S1wktBzggvrA09gC5Smmu4HbPEwfbPdjAq1rQpCbpcerdSQOw/9f0NLd2nC3ye4F+7xX pLJw== X-Gm-Message-State: AOAM530crmDIocnVbN6hsIuJcO6FI9090FYnu5W2D2tIowbR0eADtEgj GLRREgefbFncXozMp7F2yNbtfQ== X-Google-Smtp-Source: ABdhPJyI/H2UZa/knKpc1NxwfqxSD+BRLUNEpghQZhKIwSpmILkwL5jjn7t7Z3Gmqe7p/Wydt3JXFw== X-Received: by 2002:a17:90a:f00e:: with SMTP id bt14mr9162131pjb.219.1638484067838; Thu, 02 Dec 2021 14:27:47 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:47 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 14/34] drm/exynos: Migrate to aggregate driver Date: Thu, 2 Dec 2021 14:27:12 -0800 Message-Id: <20211202222732.2453851-15-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 Dec 2 22:27:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 519814 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 1301CC433F5 for ; Thu, 2 Dec 2021 22:28:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349404AbhLBWbu (ORCPT ); Thu, 2 Dec 2021 17:31:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377316AbhLBWbZ (ORCPT ); Thu, 2 Dec 2021 17:31:25 -0500 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10F7AC0613ED for ; Thu, 2 Dec 2021 14:27:49 -0800 (PST) Received: by mail-pf1-x42e.google.com with SMTP id o4so916058pfp.13 for ; Thu, 02 Dec 2021 14:27:49 -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=S2cUyv9Jrj0pIQ5/FWHVT8/lxQnJ2mFqOXQxH4toOlnhWX5u9ggWSz2i+KOxf+Efpz zkybdoQu1cuONhDb6wYe/s4UNs11qwUoDeIrg58N1vhbqBrGiRZDi9oPIHwPdVkHu8Ua c0q4USKqqFECxpqCgUnx8UQA1xgJy3+2UoWpM= 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=JBf7i23CcTtgCDqouLIXa9IRu5Ip70Ey/QjkZkJVcaf/NDrg4xtivc8nVKpG95IYrc wc4C6U6unbs54yPm7n8HNAlgbxmIQLHdGkprYueCC0qIW7tJtEWaI8ZaHSOjiGY0tzU9 pXwXLcwltY736QNbtzFC7I7Bb01xy71td76y9r4CVpo9hz7Hb0tQAoWkw4mFiv9NMvYs v3JT9m+adzZ6n/a9dyK6PFJ3HhSPdRbd6B0v8q45r52l0XtrOdpTb+su1Uzm9J73dJU/ MjQPKCsLbW2hkiXmDxLtAsIhZLG0VfOxJ3viAfx3poozcnDKkc3tl5I/QbJSXyVydfZB 3vwg== X-Gm-Message-State: AOAM532SSrdV/qJYIwZHLz89JkgKLWIdbcve0VEtvPB109mLAK3PxMoL o65RV+u4eKFa3bM+WOMBvJHNSw== X-Google-Smtp-Source: ABdhPJxwnbblXolNA9QDloMU8T9W4LnnaErrTpJjrCxF8cdzwncQwTXxTXVaks30xOUz0l/fc1YfLw== X-Received: by 2002:a05:6a00:2391:b0:4a2:cb64:2c97 with SMTP id f17-20020a056a00239100b004a2cb642c97mr15192965pfc.36.1638484068602; Thu, 02 Dec 2021 14:27:48 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:48 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Philipp Zabel , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 15/34] drm/imx: Migrate to aggregate driver Date: Thu, 2 Dec 2021 14:27:13 -0800 Message-Id: <20211202222732.2453851-16-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 Dec 2 22:27:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 520230 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 BCE52C433FE for ; Thu, 2 Dec 2021 22:28:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377329AbhLBWbw (ORCPT ); Thu, 2 Dec 2021 17:31:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377341AbhLBWb3 (ORCPT ); Thu, 2 Dec 2021 17:31:29 -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 1FD50C0613F4 for ; Thu, 2 Dec 2021 14:27:49 -0800 (PST) Received: by mail-pf1-x429.google.com with SMTP id z6so945347pfe.7 for ; Thu, 02 Dec 2021 14:27:49 -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=hq0KVI3W2yasYBuPgIGtzBCut5dk4DJYuICxw3vS2py6HtWsmJi0uOZrbEt2z5j4bQ vk45hg2s5gz+GFi/7KR+2nDoWq28hq/63rxC2XqkyKm+DHAxwf8l/MoPaqX83nBWNAiP byNhGcarciphKJgh8x2UQWNtymc+mEA+PPlJE= 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=FvBDuPTjd6NmwqOOn3Z+OdC+4LcD20KIeZJ3QPx7NeJbyHGdjAhzexplu40+EXoLjS 3zxSgzKDXvvHTsMQArbyPcV81qH3omcDKzQl8A847KqWTd7cDm3oPOu9BCnh+3QZRYfh WkHSZiu6cMzLAY4pokV4wxq1L5rT8vc2OT+PjZEpbQjQ1LyjbB18l2HHOVQawcDEqUup XA04/TsgNdEHgnEiUASUbGFrrmjs9U+fbe2pm2c5RG9wmCGMEnz0ljfMZorX7v33QP1D c5HCJCUCXmOCavKSdUsFR6i2csjQubGqnMDmugUTtWu/gNBb9+dH7XhVzcDKbHwMQCbt wT7w== X-Gm-Message-State: AOAM533DNKPaJqr6Ga9oY6coCLSB0+qHTZ2BGwX71/U4dymPTK9mdBkS JkoE01z1YtzSYUGATGhGKn+mSg== X-Google-Smtp-Source: ABdhPJzBOFRRT3xYAgGwIIFyu36iZ8Fa/CB6Iksub5c1GFh4wBor6MIE8SX52J8xtv42ROyKRqcMew== X-Received: by 2002:a63:2ccd:: with SMTP id s196mr1541758pgs.77.1638484069377; Thu, 02 Dec 2021 14:27:49 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:49 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Paul Cercueil , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 16/34] drm/ingenic: Migrate to aggregate driver Date: Thu, 2 Dec 2021 14:27:14 -0800 Message-Id: <20211202222732.2453851-17-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 Dec 2 22:27:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 519813 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 D220EC433F5 for ; Thu, 2 Dec 2021 22:28:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377471AbhLBWbw (ORCPT ); Thu, 2 Dec 2021 17:31:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377347AbhLBWba (ORCPT ); Thu, 2 Dec 2021 17:31:30 -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 BE8A7C0613F7 for ; Thu, 2 Dec 2021 14:27:50 -0800 (PST) Received: by mail-pg1-x52a.google.com with SMTP id 200so1179438pga.1 for ; Thu, 02 Dec 2021 14:27:50 -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=NzGyKglvPau4q0v9u6dmIzAdp+hd1Eh9CZzdxQoEKjU=; b=OrPyVbGKZ7U8IUZdernU1rar5h9/SX+RfjhtxKW1SBnq0akyjbMmrj8pZ5yh4XMluT yyZKWAmOdgSVvoEWzYSKEX+zLWm3Svu6KXsz/t8GOWwOf17siT5fNb55Yz3SyCRdclRD s93qd3kPo6ikuDHKGmmZg42P93MjdCrJgmqho= 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=NzGyKglvPau4q0v9u6dmIzAdp+hd1Eh9CZzdxQoEKjU=; b=rBgNO3Gpo6Z/d+IU/N7Y4KHpegMVjzSZZ/1QXEDSazbc2shrNK3bnxtui21B9jmUJt /krORIS1Itm+eLrtHw7jHLNYdUVr3YarlbV+Ub/MmQrTG6sQNnMUr8QdHXQGztruhw0e 0GFEDbwM39zlYLfJO0bhrJrFnS0TSwcOwIRUPlZ9TgNBPsx/jpf1SgF+Y08gLb+L1wPr YQyRB0mLJNLS8XHCi5v0/5z314bNg4i4oTR06t2oGCe06TRWJ+GQeWeDTSbkLIum2fpB Kl2AcvpcwZm+cHrh1rTCib56kc69Gx69+WYHVOxAMPabv1eajHfJc8SJCPHnPiEzLLPT 1DGg== X-Gm-Message-State: AOAM5316CkkEOwEg1DYbJ8cKnmyLw/9tjL7A6uJ1Nau2ycgE7wub9nUt TyItoMYB6yeL+29sXFBR4K1R1A4pv3UPDQ== X-Google-Smtp-Source: ABdhPJxYrLMKujDzui6/t9n9lv6aIe5V2uKYN4fTKOZtM3iFG3ytu1txjiTDSyyL2T/8Iot4LHONEg== X-Received: by 2002:a63:5c05:: with SMTP id q5mr1536978pgb.599.1638484070333; Thu, 02 Dec 2021 14:27:50 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:49 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 17/34] drm/mcde: Migrate to aggregate driver Date: Thu, 2 Dec 2021 14:27:15 -0800 Message-Id: <20211202222732.2453851-18-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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/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 Dec 2 22:27:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 520229 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 AC4B1C433FE for ; Thu, 2 Dec 2021 22:28:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376382AbhLBWby (ORCPT ); Thu, 2 Dec 2021 17:31:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377364AbhLBWbc (ORCPT ); Thu, 2 Dec 2021 17:31:32 -0500 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95DC1C0613FB for ; Thu, 2 Dec 2021 14:27:51 -0800 (PST) Received: by mail-pg1-x532.google.com with SMTP id l190so1142512pge.7 for ; Thu, 02 Dec 2021 14:27:51 -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=GqHzD9FvNj8SYcgXbE573ClF6vnNZ4lCuFS/aJ3QG383hX8usV6EKBrhu9+NkEIamY OclBhOZt8HVNupj84GNDvtbiUwu5t4su0VRrL2FA1fAMeh5t9z0qEOjPG/EG9iTybM0H x7TdKSHNDr1wa8LbUzwsWMQ0urOKXq9btv+9M= 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=64RiJ5WhTgPvbZWu1cp0PZ2mhFmUI/Ovq6XHfo1S8oAiv03Ma5GI8J/dIWuWOA+2qQ PYIF79K3vOI3o41v5yeDKleawH5jAYvJwZFsRH4LqQK7q7htQR7jfc26OAOaANw+cjGO hbkNzeB40zfZR8opHOu7jd7EBZZJQGIJ19rxLXVEUKWxEl95TAv7OYSWON9Er7xt9aCB yotyfFGxcSDP3NPpk4oJN+7nbqt3EWsxEt6o1rs8D2q8oi8f/wMRF3Ig8F0zvSy6M5zd dbjrSvrIje4ORw40S+iux4blor1SgP1CfHdAv//ECcvMgUR2hpVAhTjq3zs2NENbu5Zd KT+Q== X-Gm-Message-State: AOAM531CejGuj2UZtS8+nUMwXcBikx0PZpMNRZ4N6L3aVK8TpuKpjHIw lAndywc+SXcS01jovtxc9R+JHw== X-Google-Smtp-Source: ABdhPJw2Fepit9l43kyK4gY1m1LC4bO41CiNzjUZksZppK/ZCWFoSYygyjGs0OZuYHfrjsdL9pHJog== X-Received: by 2002:a63:4c58:: with SMTP id m24mr1515448pgl.597.1638484071208; Thu, 02 Dec 2021 14:27:51 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:50 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Chun-Kuang Hu , Philipp Zabel , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 18/34] drm/mediatek: Migrate to aggregate driver Date: Thu, 2 Dec 2021 14:27:16 -0800 Message-Id: <20211202222732.2453851-19-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 Dec 2 22:27:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 519811 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 6F222C4332F for ; Thu, 2 Dec 2021 22:28:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377492AbhLBWbz (ORCPT ); Thu, 2 Dec 2021 17:31:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377365AbhLBWbc (ORCPT ); Thu, 2 Dec 2021 17:31:32 -0500 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3323C06174A for ; Thu, 2 Dec 2021 14:27:52 -0800 (PST) Received: by mail-pl1-x633.google.com with SMTP id v19so739147plo.7 for ; Thu, 02 Dec 2021 14:27:52 -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=MJAsiBHpO2q/hsdSciuVFwOT83PxpG9KpLTTD6y0Jx+32jDfUTd5R+reXnN94kI7HS GgGdo4Mh4lZoXjrW/jAhRMOM4ufPOdIVKUiioIwtOhV78I9fsMuFVoRq2DG3CtFH2zh0 FkzOE9NnxFQxGfNLVwIhT2jCD7yS3hFy2CGxc= 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=MwNcSytP+1Q31LdUZRb5IW18Lw+IcjpTEPyjLqruirzQKvZMYBGerazwhszP6xRzop 4wPsaEhJLo8I8Fog0IpeCLhjKQc98HXfB5Rl1ooNv6f9/ZXSVulBPohsiuYjldRYfl2e YnUbNKbUsf2hdMYQq8sLMza5zU0jCxapDADyDniG05Wgmibg7tj6TWK4+yig/KpB3LGl aQksnQwuaIcarAUPq4nuJ2e1LZdMzZr462yPFR30h2adIsBCInU3k3mxjl3Rx5qqr5YU OVHPxG8h35GGCBRV1aeI8YX/b3BNCACZrjWv1SmONqh9KCcAl9k0NVQ9VhNrVfkaz4TU QgRA== X-Gm-Message-State: AOAM530tU2ateVUhYta93tcW+2Ib1KcfNZ4SITTmbQx4TbXrKWzo+nKP G+SD6eULC4HdUWb4GHK96B6FFA== X-Google-Smtp-Source: ABdhPJzRLHHfwflAzf8KYyKYQgwlkeL0VlCcI9nc3Zp0HIXLhrAJVU/FYievGfLqo9GNTzZdkvDo5Q== X-Received: by 2002:a17:902:c7c2:b0:143:bdf7:1670 with SMTP id r2-20020a170902c7c200b00143bdf71670mr18130203pla.61.1638484072251; Thu, 02 Dec 2021 14:27:52 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:51 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Neil Armstrong , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 19/34] drm/meson: Migrate to aggregate driver Date: Thu, 2 Dec 2021 14:27:17 -0800 Message-Id: <20211202222732.2453851-20-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 Dec 2 22:27:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 519812 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 C5323C433F5 for ; Thu, 2 Dec 2021 22:28:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377349AbhLBWb4 (ORCPT ); Thu, 2 Dec 2021 17:31:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377375AbhLBWbd (ORCPT ); Thu, 2 Dec 2021 17:31:33 -0500 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BE77C0613FD for ; Thu, 2 Dec 2021 14:27:53 -0800 (PST) Received: by mail-pg1-x532.google.com with SMTP id s37so1133241pga.9 for ; Thu, 02 Dec 2021 14:27:53 -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=ZrzSCh/rFXkmx5Dr8yB+yeAaW9c6VEvfWvglxVBg2FFKJ7efhLwtmeT6vKYdWUr8Yw QqxZbXE04o4P2qvypJIKuDvCMKiknt4LJ6XNiz71Fa8gTKRC1cIH4is5SvtDk3Ngr68s MNI0HNgCtQ3pqos7n1/yzeN1LmON/a29L9lRY= 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=QV+tKaXbWjqxGe3KzZsFvEUuXgOUr4u8XROiD3E92Q+2+FcY7sV4aKNFw+O8+N4fRW qxpybeBp+/8VCyGyrATny3v2K3mTyLrd7fke8Qz5AjUV7DPXxlB4LjJ6ZVjSzGUO3pDO J7JKvS1TXW28QfWUAsFhkNMxMrtsPAQmY4lHzxXqMXeCmZH+PtJ4mC0rgFtc4ARJ4PqV Oc7xhMcuyz4tbJuMsPllZdpv1+3rVXs0p6qxxHYzm2BttLjQncLt18Xqx6HlMfc79Y+Q +Fg9c3BM5io796QFiGuLmjxbBIYKBoDYIGEgGC2eMNMm0XGl9nCjm9Ive4rSGTrXK3AK Y9qQ== X-Gm-Message-State: AOAM533jte+G7HELRTgvDr7XO0SOCnhq+tXR8w/7qtULxombKo2/3DqA yQt38DJ+AObtZrJ02TWLApnlXA== X-Google-Smtp-Source: ABdhPJy13mZ48jfTvFMjifi+H+M3BRVPQTEod/OK8/r5QfcrwMxFPAuEeOqfLBI/CQ3w3gfEW2A7GQ== X-Received: by 2002:a63:8848:: with SMTP id l69mr1617155pgd.41.1638484073050; Thu, 02 Dec 2021 14:27:53 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:52 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Tomi Valkeinen , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 20/34] drm/omap: Migrate to aggregate driver Date: Thu, 2 Dec 2021 14:27:18 -0800 Message-Id: <20211202222732.2453851-21-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 Dec 2 22:27:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 520228 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 C66B7C433EF for ; Thu, 2 Dec 2021 22:28:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377511AbhLBWb5 (ORCPT ); Thu, 2 Dec 2021 17:31:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377264AbhLBWbd (ORCPT ); Thu, 2 Dec 2021 17:31:33 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44CF8C061785 for ; Thu, 2 Dec 2021 14:27:54 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id k4so734103plx.8 for ; Thu, 02 Dec 2021 14:27:54 -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=cX1iY1ENOZ+a2V3hojNUuDbXyZap3b4mWnbZbtZ5qQdf3XFsal5YWMXVeycKdERVaT 8vdjnHo/vYB8jcaSorlm0ZMSnnQsueK2ba+1E13Qe8+ax7cnsvWNeieNVp8iPjhlgHXi RaEKwXwxy6REnAYw3vl35pPxNV51Ll5ar7l1M= 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=Xi86KuSw3RPI5xB2t04QtwQ/xqDP+IOuDY8Mmg8n2LACMN6RuERRRWmnKSN3UFDSYZ tcKZaEDNs88QvB6s53YUAJ5D6WylloHep1XKyJhsB3gFZ948B8BZRBJxy31473HORg82 jZQFVT25I1KVhb3Mhui1UQ8BGnXLA+eatw4OjIPuKg619RF78vMvr2HRBfMhAcwk8AKw qsugUy5w6MeF8Pl+tf0r37FsvrK3LI6Y/r+EE6W792L2px9X0hie36tLhqWlyLQeowBJ h5W2SUUeIktXYtiRkWLJbDTcnknugwwsVxvcvalLHbfrmHrTjMm98OPptNSVVY4ZMYbj Pkng== X-Gm-Message-State: AOAM5304dV6ULRrTIMo6etfmIwbpjdzpZm5CVYacEutJ6Ruqr5BU4UQj Xo+3lJmGW2M8mSDBXkK4mlLTxA== X-Google-Smtp-Source: ABdhPJyXKoYigNKyoGI61w9SibHpgcyXT6AsTEaLXML82XI6yjC6fGI3u/P/lH+Cj9/0aOxz4y0CHA== X-Received: by 2002:a17:902:d88b:b0:142:8acf:615b with SMTP id b11-20020a170902d88b00b001428acf615bmr18336884plz.62.1638484073793; Thu, 02 Dec 2021 14:27:53 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:53 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 21/34] drm/rockchip: Migrate to aggregate driver Date: Thu, 2 Dec 2021 14:27:19 -0800 Message-Id: <20211202222732.2453851-22-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 Dec 2 22:27:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 520227 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 1C74AC433F5 for ; Thu, 2 Dec 2021 22:28:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377296AbhLBWcN (ORCPT ); Thu, 2 Dec 2021 17:32:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377298AbhLBWbt (ORCPT ); Thu, 2 Dec 2021 17:31:49 -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 F3282C061792 for ; Thu, 2 Dec 2021 14:27:54 -0800 (PST) Received: by mail-pj1-x102d.google.com with SMTP id fv9-20020a17090b0e8900b001a6a5ab1392so919236pjb.1 for ; Thu, 02 Dec 2021 14:27:54 -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=PrhJPHDYUMYrr7Z38k7lHS+R3rg5br5jmDxDI/fMcQW6Tez0tJCj0ZyPDKVcJIpNbR RUQLEn6vaF8L0SiNiQK7mM8wbrTmqB5zFKnAK2fLgIOM9ZMpBEWJHiHZhJOvAfiQNHTV 2GMLWd8BO6z3t4VS0fDKLKtsRcZ/FMb4+7W7I= 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=CvXjDDiQ3AYl0RyTYq0LNGQYI+++EjjGf3BPbJ9bGOOnRf4U0Jsxpy2XuVI9zj6cqM IJ1HfZwLAiiIAPwfjURnY5LwAURlq6JzPFJQXGBEKz62QuTzPLdPhfAjQcGeLVsftmsn KWr6kBcCoXpevnxeBmbnyOMvq8ieOkLo+YsQ5DcG1CTMmNiTKrzeKG3dteY+QiSU3zAb 5kojxbxuH3ROEqfc2XKxuMdLyoiD5Xq+LTSYbo3iX0aCgYr+UfjMO5j4x3aZ8ORbrB6z vlaQmlE21piC6ElgSkfrQmy8LoY4zbbA798y+bS3m6otjkY3roR9X+nbnBkRyvM+RX34 CDig== X-Gm-Message-State: AOAM533bgirjFHxs8e5AUjIvJjcPbioxB3iT2oLHfyU41krWj8D/aP/w Fh1gevft1xZ0F3kXqtsy7uEohw== X-Google-Smtp-Source: ABdhPJyp13jsLtrHtY/hYRWS9wVZnJYDqVf8my8aKb8cYOnB+4i/m58C6/m7qRtTBejE+43q8owBmA== X-Received: by 2002:a17:90a:a786:: with SMTP id f6mr9065942pjq.158.1638484074553; Thu, 02 Dec 2021 14:27:54 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:54 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 22/34] drm/sti: Migrate to aggregate driver Date: Thu, 2 Dec 2021 14:27:20 -0800 Message-Id: <20211202222732.2453851-23-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 Dec 2 22:27:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 519805 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 24CCBC433FE for ; Thu, 2 Dec 2021 22:29:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377375AbhLBWcg (ORCPT ); Thu, 2 Dec 2021 17:32:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377316AbhLBWbw (ORCPT ); Thu, 2 Dec 2021 17:31:52 -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 BD6F6C06179E for ; Thu, 2 Dec 2021 14:27:55 -0800 (PST) Received: by mail-pf1-x42d.google.com with SMTP id o4so916300pfp.13 for ; Thu, 02 Dec 2021 14:27:55 -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=DuUYdGjfuiZBR1ya+iPMu+Sdj6HN/HJ08JUma9wc/4Lv3gy0ePurYjL7t/73NeUuAq Q64+6CKAFwPkeFLGdygcG+gv17qHsi0b1+edKa4FKi2dyoZNvb992X0lgxv89pR3O67d czo3LRlHOcJy3IGu6WOnt1cvXkO5nl2UJqFRs= 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=xkmGLuH73ZpHg4IB5fhzh1CvcIUk0dhmHwGFhCW/+M9DUlNh0up0EK3pNeY5lOtqCH K9YaeedpE10rb2p1hwewXqhy1CRfd38N4Sj+5tgNWy7uwjoL+MYTOKferHlGnMHGI4vg OzX7P42VNke4NP6LFWDL8EuSspGYMTh+4YVHrxLkjw2CU0qxp9XjjG5qIwr7ly99FU2/ F2+2/Ahg/D2ZAg806gKXYzUrlto353cEpYBZRb0Ph7VtSIdCLS2nSgHbjHP+maEnSu1D 5Uzp6g5T2PzLq5CmTMyYPVmWg+zR/Y7HgxUSUiUkFgGOc6EnVHBuhkeI4pu/ofc2WWoX JbgA== X-Gm-Message-State: AOAM531bPrSwM2EDrEw0ZfACCekRqWsXoUrO9BK+ZQ8Sz6QoSKMB1AtV 69ap4+usbX2uHpg+7HJB+/7SMQ== X-Google-Smtp-Source: ABdhPJwyV6A1W8Nb048fK/AxET3ZKPbCUPvFdhVy84ThrAAhIMdBm6o5JXluuljHIlgP9I1HrnwIfA== X-Received: by 2002:a63:66c7:: with SMTP id a190mr1546381pgc.463.1638484075311; Thu, 02 Dec 2021 14:27:55 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:55 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Maxime Ripard , Chen-Yu Tsai , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 23/34] drm/sun4i: Migrate to aggregate driver Date: Thu, 2 Dec 2021 14:27:21 -0800 Message-Id: <20211202222732.2453851-24-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 Dec 2 22:27:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 520222 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 86844C433F5 for ; Thu, 2 Dec 2021 22:29:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377505AbhLBWcf (ORCPT ); Thu, 2 Dec 2021 17:32:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377325AbhLBWbw (ORCPT ); Thu, 2 Dec 2021 17:31:52 -0500 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93CE5C0617A1 for ; Thu, 2 Dec 2021 14:27:56 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id h24so855574pjq.2 for ; Thu, 02 Dec 2021 14:27:56 -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=aYALRHsFn0lNW8BmuMj4+kHCOs9s7+R3OgAv3OJiR95IZOKFQZ+w9qea1ICG/SodJ/ +igOzUmHyzEw8aAwsBgJXPFpnzUsIWHpzkXGRs6MiCl/xNqRK4S7e4JncJDKrp9lxp5C rfQZhyDKl2Hmvyfaujv6SVjj5DXjOOdZ9ekBc= 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=vWyHeHWPZyRKRgqdXaOsFvxOzA7S/fbXbRausKwpjA1XVB7dQL/5payJq/v5JTP8eN ZDU/pp+3VJ/vk4GxX96fhak+F5laCelNKZONESoKrBbKVzSYRxKp2dOo1XDX6gVvCUb0 DWBExpp6+KMrWgXen/CzrjWYmakvXPhXV+DgvwnRkghgjuQ8EY3Ed6nBqt67bE1JnlBY i7bwzAUPxZTdm7Gl94NqjMULbtEEBgECsw0DckSSIOkk7kQbhPfUQgVazfF68TTHXCGx +fvlPXIImKns95tTb2ECCorX7KbyK8w3xo890RniSxUK03JguM+hd02gtU1DLEaEk6Fy vjmw== X-Gm-Message-State: AOAM531fCYUAyQ3h0dfTvhec9QHyDXr83ZrXRCEQEvlRVph1OWKg4/DG o6hd038oa7ppRgNBpCMNwktMjQ== X-Google-Smtp-Source: ABdhPJxUiQZ6cWHUZ7HxSKVla2/DNt2mW2yGwcM3YSXCD3G009K29EH1KFvgM4SvxeeeA68bDxoOhA== X-Received: by 2002:a17:90b:4b03:: with SMTP id lx3mr9200581pjb.18.1638484076151; Thu, 02 Dec 2021 14:27:56 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:55 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Jyri Sarha , Tomi Valkeinen , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 24/34] drm/tilcdc: Migrate to aggregate driver Date: Thu, 2 Dec 2021 14:27:22 -0800 Message-Id: <20211202222732.2453851-25-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 Dec 2 22:27:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 519810 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 C5D56C433FE for ; Thu, 2 Dec 2021 22:28:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377327AbhLBWcP (ORCPT ); Thu, 2 Dec 2021 17:32:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377328AbhLBWbw (ORCPT ); Thu, 2 Dec 2021 17:31:52 -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 68670C0617A5 for ; Thu, 2 Dec 2021 14:27:57 -0800 (PST) Received: by mail-pg1-x535.google.com with SMTP id s37so1133378pga.9 for ; Thu, 02 Dec 2021 14:27:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pXQku93D/rC4XyQwRyjDG+Hw8yXvhZdjZb839YbIyVI=; b=Iz/NjPjdEaZsBHJkEVtreK2U1LcF5Hqi38Sw8WurdATCOC6cL1aALbf5tKQ42nw/JP XLpn10TTzlDxcNpFgdRhit4cBTePM4p/PIDWzc95txSTNFZo0kjFKj1KkzQzYtvCtams AY/q6Vck3YO6Ilm0AFo2PgxxI49UeqhKkWzFc= 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=qDPB4WajU/SsIBkMDvq3a7RYfnNlH2ZOk9BkWHZL9ZpKTHGG2nU2YmNJDUQvZ9DlO4 sqlHxuv2QNk+QQ6Lr8z2z/lTHvy3wCzozSV7uUI4erVyMYuP+uh+3jqvgTJssYT4/yF+ WX9vA9GSeERTfoQsLyLSRtgnIv3yWtV8qDFEidwePDkvALd86YPYP8VbL/tENdO3XluS F/7yfe2XRhjxdZXj2Xwg3WTq2le1pnRZwoiRPasNKr1O4hkgNGuqaqD7e7C2bdYfPjw/ uA6SOo2cQVhbTXoziWY5+hOfry7dvBxUUu9IcDLyXRL/e8v4NiJKjRQrqMwudP9hTuwP bSzA== X-Gm-Message-State: AOAM533rpqI8QviN+QEHdzllSYOhO/ZUkJPX6wbJoq8JcAvgmTFf2v9t qgqQOhKVZ/2D0OnQpzvNF5V7Qg== X-Google-Smtp-Source: ABdhPJxVmEV2ZUl66ZDAbxGprGmuY7cFZIZJo7PYVlcaMs8O09k6dLAZng38yOdGkw+kn2oxif5+jA== X-Received: by 2002:a63:531d:: with SMTP id h29mr1517646pgb.583.1638484076938; Thu, 02 Dec 2021 14:27:56 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:56 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Emma Anholt , Maxime Ripard , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 25/34] drm/vc4: Migrate to aggregate driver Date: Thu, 2 Dec 2021 14:27:23 -0800 Message-Id: <20211202222732.2453851-26-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 Dec 2 22:27:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 519806 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 781F9C4167B for ; Thu, 2 Dec 2021 22:29:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377214AbhLBWcf (ORCPT ); Thu, 2 Dec 2021 17:32:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377335AbhLBWbw (ORCPT ); Thu, 2 Dec 2021 17:31:52 -0500 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36E56C061397 for ; Thu, 2 Dec 2021 14:27:58 -0800 (PST) Received: by mail-pj1-x102a.google.com with SMTP id cq22-20020a17090af99600b001a9550a17a5so3646368pjb.2 for ; Thu, 02 Dec 2021 14:27:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Cp/sB0csPJfGnASpc4rymZ0PPQPzUhdhwUtGaGHpcvc=; b=KihRgs88jccdjmO+PhDreTYDVNrTfno/WSsFpj4gTWQWTTYwLz+pe14OvOslpcI0Lz kb99udLnU3a6BeCYKJdLmq/khUldzQkliUtXC0aERbaI7Teg6JQx4Qt3wOl873gv81Nj 5kq4K74/WlUvaPz3l6AEBHb4pusrQjzzSd09U= 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=p+1wayuMNfDhJrPo16TaMcXbHyXNILnxCoDRrby1GSxvzZfc4FOuIQU40W/y4yJ8yG 3ZMoUlsoKzFSilal+OrlxG5hN+3BebvMfBEHu2rhbs8mCg+YuGGLBSESDj9e6UlnvXGK r9KIzph6PGHEJq8CVoJz+2YKh11MYzH/uMvYxmHA3UmiBKKsEi7v/jRpl18NS6HbM2Dj k6iA7MZLcDox65FilN7TMe2lz4ajdhSYQjn0fpRsLz2njzgTOFEFo2S5oQ3foiVVwdEH wOJE9hUW9Ursa2yHEwbPTXiQT8pR7c329arDRm2fpnIkEHPVuErrTik7gbt8bbiCttFO IIFA== X-Gm-Message-State: AOAM533aqatr9pBwNg33Bk3FhZqSncyVMFUWN6kyzesthcddI3e/XoTi cL6qB8w7vpTPbhBFjMQZ6RfJ2w== X-Google-Smtp-Source: ABdhPJwaaQcPTMEnUem1T73f8KKjDaKy34wIl3cV2+3CypV3RmSoKIODLwwMNQFDpidmCN4BQY+tvA== X-Received: by 2002:a17:90b:4b86:: with SMTP id lr6mr9061265pjb.98.1638484077743; Thu, 02 Dec 2021 14:27:57 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:57 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Yong Wu , Joerg Roedel , Will Deacon , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 26/34] iommu/mtk: Migrate to aggregate driver Date: Thu, 2 Dec 2021 14:27:24 -0800 Message-Id: <20211202222732.2453851-27-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 Dec 2 22:27:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 520226 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 17AF3C433F5 for ; Thu, 2 Dec 2021 22:28:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377571AbhLBWcQ (ORCPT ); Thu, 2 Dec 2021 17:32:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377470AbhLBWbw (ORCPT ); Thu, 2 Dec 2021 17:31:52 -0500 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0231FC06139A for ; Thu, 2 Dec 2021 14:27:59 -0800 (PST) Received: by mail-pg1-x52c.google.com with SMTP id 133so1116925pgc.12 for ; Thu, 02 Dec 2021 14:27:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uzJHB9t+Bicwdag3X6iL63lm7ZGof5i0wMOcRCsHtBw=; b=Jp4M9oOalLXfQ+WZP1KaLKmIr0YSHEDZeX6iW17YG+Abu34OQddIQDLeamTZDTLz4M gSoYA8n3mtIKKKkuTv+RRZLsBaRBJFHmknEz5zLGTMICRKY32ZABfecGxWCnJCMZPExC x16pSFVRaO9riiVI+U1615vxcNwIjnWVsVNzw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uzJHB9t+Bicwdag3X6iL63lm7ZGof5i0wMOcRCsHtBw=; b=MbItnQBC5KRImeIUEJ/Cnlc8cjmYCCh5EiZRFuSld/a5l5RV1VdHM0hZe57Fu7hkt1 +FwFroyazVl/uHp5yJBnlIQ3gosEWQA40b88nY7kDS3lJg0DsiqwrU/27qPo0V79tbNB IY+iyF29/hs6R6eqkkJxk1A7Qh2XO+pesG4erJkzFGxXe0fxfLyAkRgFBvggS4BjfhB9 JclYHbljm/T33vcHyWH5GvufB/iBtJDofCknifxHUROEN+qterp/bq5QVJM2qvbnzNtd FShHkY8tPvBwU+EO5EWILqG9g3jfxFPdA9t+DeXIUxjhLV5UZVVAAUMm0fqVbBvBJ3tE XtqQ== X-Gm-Message-State: AOAM531xgK73LyX0PcbK8zmsnZGEldtW3UNC3+gxUyzfAUVDEVM6nnXA KoM1lQpktxRsXaQrSXItXuLDxA== X-Google-Smtp-Source: ABdhPJwUHqMQso+81948bEPyRXAF9fKOn9gpZgEA6F7sXd4yu/e2aqztsPuRfkDwbTU+JhGvHCw7bQ== X-Received: by 2002:a63:5f0e:: with SMTP id t14mr1577700pgb.107.1638484078545; Thu, 02 Dec 2021 14:27:58 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:58 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Tomas Winkler , Arnd Bergmann , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 27/34] mei: Migrate to aggregate driver Date: Thu, 2 Dec 2021 14:27:25 -0800 Message-Id: <20211202222732.2453851-28-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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: Arnd Bergmann Cc: Greg Kroah-Hartman Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/misc/mei/hdcp/mei_hdcp.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c index ec2a4fce8581..79dcc02277d2 100644 --- a/drivers/misc/mei/hdcp/mei_hdcp.c +++ b/drivers/misc/mei/hdcp/mei_hdcp.c @@ -732,8 +732,9 @@ static const struct i915_hdcp_component_ops mei_hdcp_ops = { .close_hdcp_session = mei_hdcp_close_session, }; -static int mei_component_master_bind(struct device *dev) +static int mei_component_master_bind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct mei_cl_device *cldev = to_mei_cl_device(dev); struct i915_hdcp_comp_master *comp_master = mei_cldev_get_drvdata(cldev); @@ -749,8 +750,9 @@ static int mei_component_master_bind(struct device *dev) return 0; } -static void mei_component_master_unbind(struct device *dev) +static void mei_component_master_unbind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct mei_cl_device *cldev = to_mei_cl_device(dev); struct i915_hdcp_comp_master *comp_master = mei_cldev_get_drvdata(cldev); @@ -759,9 +761,13 @@ static void mei_component_master_unbind(struct device *dev) component_unbind_all(dev, comp_master); } -static const struct component_master_ops mei_component_master_ops = { - .bind = mei_component_master_bind, - .unbind = mei_component_master_unbind, +static struct aggregate_driver mei_aggregate_driver = { + .probe = mei_component_master_bind, + .remove = mei_component_master_unbind, + .driver = { + .name = "mei_agg", + .owner = THIS_MODULE, + }, }; /** @@ -826,9 +832,7 @@ static int mei_hdcp_probe(struct mei_cl_device *cldev, } mei_cldev_set_drvdata(cldev, comp_master); - ret = component_master_add_with_match(&cldev->dev, - &mei_component_master_ops, - master_match); + ret = component_aggregate_register(&cldev->dev, &mei_aggregate_driver, master_match); if (ret < 0) { dev_err(&cldev->dev, "Master comp add failed %d\n", ret); goto err_exit; @@ -850,7 +854,7 @@ static void mei_hdcp_remove(struct mei_cl_device *cldev) mei_cldev_get_drvdata(cldev); int ret; - component_master_del(&cldev->dev, &mei_component_master_ops); + component_aggregate_unregister(&cldev->dev, &mei_aggregate_driver); kfree(comp_master); mei_cldev_set_drvdata(cldev, NULL); From patchwork Thu Dec 2 22:27:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 519809 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 44589C433F5 for ; Thu, 2 Dec 2021 22:28:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377576AbhLBWcR (ORCPT ); Thu, 2 Dec 2021 17:32:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377475AbhLBWbw (ORCPT ); Thu, 2 Dec 2021 17:31:52 -0500 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C80CDC06139E for ; Thu, 2 Dec 2021 14:27:59 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id j6-20020a17090a588600b001a78a5ce46aso3681916pji.0 for ; Thu, 02 Dec 2021 14:27:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+JAo2MaGppQnqjiILYakqrQo0dvp6TO6MPFSMqu2Msw=; b=JwC02+ORyfxx4rSWQ3wiTgF2uaijCbmu4Tlo5ffDni05+C8GgWgtOdvlir6pEqQ67/ h/aGHxc974t0pS6wShnNr8fXdq97VS3rmsp3NbQz6XqUwQ9JrlF6GdD1ARgBzKNJRonS nSiOEDFuir9ehlzy5jn7kaOUgSyjlLf+dkazI= 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=+JAo2MaGppQnqjiILYakqrQo0dvp6TO6MPFSMqu2Msw=; b=5RWAXgW0/t/5YIFZ/zDH3MjJeCBp6yxDMHEIgfbp6s4qgsK0k0rrTVu0CLG6kbURRy gCQhsuWtVOSgvwLHnb4TRnqhIvRDGQssfasevAJanz0+LU3N7GKtWTDr3aScqrIFW+tQ JHzJN3M1MwzWfpUq9oLtLikqHIiUjC5UAcYMLHO7RGMvXXho6FBBWlDLQKFrEsfNYn2n b76oLUnIrDIP5WS7mC1sZx4Bk9v1aCh1EjLeGZsEXYWKY4iMq0NVyQS8tP7inkEeRuT/ iE5Kp5baIZ7i2XRPA8Xv5HPyFX/NDDxVtekDkY+8mMEr9kHmwVSptuUN57fcUX1/OY9T 0PqQ== X-Gm-Message-State: AOAM53215uqV7w1z8/TQ0dlV/PEROC2tHmJJT2sjzEirrOrG3pAiYjAH nyxzq0mIODIicgEtpUAQDJZVpw== X-Google-Smtp-Source: ABdhPJzIvss3OFpbFAl51HKLBYnJVDs+mnPXzZw7MTof1TWzNPmxYxGUZApsvNswjQHVoAiBqk4crA== X-Received: by 2002:a17:90b:4f42:: with SMTP id pj2mr9273117pjb.7.1638484079336; Thu, 02 Dec 2021 14:27:59 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:59 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Sebastian Reichel , linux-pm@vger.kernel.org, Daniel Vetter , Linus Walleij , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 28/34] power: supply: ab8500: Migrate to aggregate driver Date: Thu, 2 Dec 2021 14:27:26 -0800 Message-Id: <20211202222732.2453851-29-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 Cc: Cc: Daniel Vetter Cc: Linus Walleij Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd Tested-by: Linus Walleij --- 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 Dec 2 22:27:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 520223 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 CD60CC4321E for ; Thu, 2 Dec 2021 22:29:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245446AbhLBWce (ORCPT ); Thu, 2 Dec 2021 17:32:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377214AbhLBWby (ORCPT ); Thu, 2 Dec 2021 17:31:54 -0500 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B09BFC0613B5 for ; Thu, 2 Dec 2021 14:28:00 -0800 (PST) Received: by mail-pj1-x1035.google.com with SMTP id gf14-20020a17090ac7ce00b001a7a2a0b5c3so3624293pjb.5 for ; Thu, 02 Dec 2021 14:28:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7Yh3mBEg2nfQJzEtBIxus+8u5VcBe7iEDAWACHn4tN4=; b=AxX8KNRZA+wHuQG9cmu6uyQXNXpNtwIq6kReRzvqhC7DKvgVeLsfqNFckio5CqcnDA IambEJt91gZ+LcJwCFW2dxEC4shBxXv8qM4fK3D4PNySlxe0HYd/C91/Ra4VpWir5n9V 3qKVLxBMkK9asro6XoRwUr4AQ4WMfgSFsfgus= 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=odaxfhxPvD8fmsrAly5GbvyaN2JY+82qpd6s6Q7CTNZOVYxSG5S1Wk1psUpvRA6gaJ u/qol37Knrn2Wc2+3vdWeXP+wEtuLKTRuSSRWUMHdM51aLN2UG0B73Zi9/nHvPMPvu2c G+ZE8HMXFNrIOHiSnEFCFiWd9xGfA7+HRJJ98Hl3o8oApO+NWybGookvno/Pi7a3J43Y 7FtnjlvRZLTe5yhdQRtIKiGAsytREfHHuqtcfQF5adlTgzuQY00ZLRLnDi9feHjzwJbN bDPmrrsJDYbXUXXvWSDJ+XEoFhO+cCpu8tBX0C+0z73UCwVpeclRRSx7z/5yC7NXQ+tZ vMxA== X-Gm-Message-State: AOAM532P/xEr0ugcXUdYxiiNL36Xj5OtvNnZujZlbVe9F5AbHriYQicC yC4cw9s+IGJ/spvvLMITnDMTfw== X-Google-Smtp-Source: ABdhPJwWWaoXo6RAa2oS9kAIlappw6GQrq7MVtBMy7vND9JLl0sLERmN8auphygexhOMY9NICZU0VA== X-Received: by 2002:a17:90b:1806:: with SMTP id lw6mr9098680pjb.53.1638484080247; Thu, 02 Dec 2021 14:28:00 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.27.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:27:59 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 29/34] fbdev: omap2: Migrate to aggregate driver Date: Thu, 2 Dec 2021 14:27:27 -0800 Message-Id: <20211202222732.2453851-30-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 Dec 2 22:27:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 519807 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 38E4CC433EF for ; Thu, 2 Dec 2021 22:29:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377326AbhLBWcd (ORCPT ); Thu, 2 Dec 2021 17:32:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377488AbhLBWbz (ORCPT ); Thu, 2 Dec 2021 17:31:55 -0500 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77412C0613B8 for ; Thu, 2 Dec 2021 14:28:01 -0800 (PST) Received: by mail-pf1-x42e.google.com with SMTP id n85so932827pfd.10 for ; Thu, 02 Dec 2021 14:28: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=8jRHJbzxJCo8C1IXTJW3KiTq5EwC3cp5SncHLYDZJzc=; b=ZvsFOChi2a09b6GoTBICzT/9fIuSbCNP0iSOhGqrl/i12m292JHnXAGLUMcqmyMD0O 17OogpMQSH/ESLZpl1kLxvzz85n1vDsoy8ZaukjzCIbY16lEVRuJy40YowieCjPmPmHt K9O03qRVmeNmeOKGakhaWaK4fn3UZtYbAnwvA= 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=XAdP8WTrgXNMa+t65sc6NYDNEUbPB0Ss3uHhyO+vAlSWet0VLkr0RWmBDvwk0u8JKA lxjiykclEv3liWRhSYZwraov9TTSv1xlZ6CzODp7lUgnqxoYUfSomUik1gCSxzxAHHzX hd8rA63QFuLg3PuVZ0uShXfgGWdfMm1DhNi5YzPS4Z+P2f7R+OEhlgcEKUMc3+cS/lmo E1U2ZWUOrJrDdUoUr/4Bwt2pHgg9cOFdeZYB8yafitxmSCJ/o6ZGuEb2NN+0Cz2p5zbw FdvHS4NAnSL8ICskLIA6dbQhzDMZ3K8WCgsaoF6dOAee3L4UWOLu9DvoQwZfu4AwwCX1 mlsw== X-Gm-Message-State: AOAM530xOf5If/CScyWAdtfAWs/CLuEbgDJGUzz9nC0rKJyunWqh0mwm SD39cwW1tJsRh0QE2pO8mncJqQ== X-Google-Smtp-Source: ABdhPJyCZby3E+i5/8aEnm2EyoCRENRlXyXj72Cf4bL/EDdq4jQNoJTZVSt+IBu0bzhpZlm1le2Bng== X-Received: by 2002:aa7:88d3:0:b0:49f:baac:9b51 with SMTP id k19-20020aa788d3000000b0049fbaac9b51mr15296856pff.44.1638484081032; Thu, 02 Dec 2021 14:28:01 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.28.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:28:00 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Jaroslav Kysela , Takashi Iwai , Kai Vehmanen , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 30/34] sound: hdac: Migrate to aggregate driver Date: Thu, 2 Dec 2021 14:27:28 -0800 Message-Id: <20211202222732.2453851-31-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 Dec 2 22:27:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 519808 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 52ABBC43217 for ; Thu, 2 Dec 2021 22:29:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377486AbhLBWc3 (ORCPT ); Thu, 2 Dec 2021 17:32:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377495AbhLBWbz (ORCPT ); Thu, 2 Dec 2021 17:31:55 -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 4BEF5C0613BF for ; Thu, 2 Dec 2021 14:28:02 -0800 (PST) Received: by mail-pj1-x1036.google.com with SMTP id nh10-20020a17090b364a00b001a69adad5ebso912304pjb.2 for ; Thu, 02 Dec 2021 14:28:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=N66rEkaY3Hcvo9L0yTqqS+dEsFgKt6MiGsAE0j7XsvA=; b=XcKcYyUhIYivc39EjxDzgKxoJpVCSIl6YOFb+f4hLmxGUjyRbTHwoCyL2NtdhV/YdU r7DiT3WhsvI602knCn6FAvxGshi/IAwUHHzhfuGXwXnaW72X5cJFnC7R1yQpr0ZkdD2u kbux2NC5nCXoF6JESch1VN1TvCo5854Z4hPGw= 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=Spf3IigEfVw1Rrl9o2JADqWxo5dVmR8oNPgahVgtICY6lEomk8jZGggkDH4Lr2ChlW wGyzzF7FAiCgLenjPb/SWWSdVZnzz+0ao5QfWk4DwdPSffPyRtLVe1Il+0QiLQsLRujC 6hw/dOL5Lhz15RMIP/L46JvKcdqGQCAJiW8kUcQqoaznsBl1721NFNf7OHxv3psDAq/u Tq8pN06ejavgPwtAnqoAHjt+RX1hjwTn25QvF+i207oH+k5Kls9LgCd6XpWQ8BGf6go6 Tws5VzZKawd3VXyOItQIG7mYaZMkp4pDgZghtQnMnFb8vvuCnDyAYzrY89hX+JE/iFuN iaEQ== X-Gm-Message-State: AOAM532k16HDt8ki1Mreea0iu483u3ags9RRtR0YS88OomP6AiBDLSv0 d80NTwl8up255CNk9Yp144qfnQ== X-Google-Smtp-Source: ABdhPJyJAIEeNwFvHrDCG6a6EWCpmwbCAkuRuLpBUFvL5M7qySrlj3aUKw6GslG1dEiODlX+Vq+KTQ== X-Received: by 2002:a17:90b:33cf:: with SMTP id lk15mr9121711pjb.85.1638484081818; Thu, 02 Dec 2021 14:28:01 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.28.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:28:01 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Mark Brown , Jaroslav Kysela , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 31/34] ASoC: codecs: wcd938x: Migrate to aggregate driver Date: Thu, 2 Dec 2021 14:27:29 -0800 Message-Id: <20211202222732.2453851-32-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 Dec 2 22:27:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 520224 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 81A2BC4332F for ; Thu, 2 Dec 2021 22:29:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239007AbhLBWc1 (ORCPT ); Thu, 2 Dec 2021 17:32:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377498AbhLBWbz (ORCPT ); Thu, 2 Dec 2021 17:31:55 -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 074F8C061375 for ; Thu, 2 Dec 2021 14:28:03 -0800 (PST) Received: by mail-pj1-x1029.google.com with SMTP id nh10-20020a17090b364a00b001a69adad5ebso912319pjb.2 for ; Thu, 02 Dec 2021 14:28: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=twEuombJQmVZYlzCOOAcE1ksFq/a2VDjCMuKxzRCQIk=; b=Vmq7R0uniulp1DeTd5ImpEzQGrh6zfbWWVaNJdvx+iztqArXgXiU+lWEbbZGf9yRt5 9SiNk8dMVa94Y6Wt2myrSXV471vpxmqWU+FY1HflWZXXw6yhJoT3b1soIKuXTOgFNVad ksarLtgl3XwLKiUyG3kwR1OpROsS2bKghclEc= 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=twEuombJQmVZYlzCOOAcE1ksFq/a2VDjCMuKxzRCQIk=; b=uFZtz4amDpUupSn6UnftK7RiFDm4dLBSpVszF8oITORSEvzDKZkfnSmctzWOX58AU2 SGk8pgcESNEUZ1df3SQiBrOIu8DfiUdo/mbSR8MaozkqvEIH2Tqc3t+kR91FMDrB48lF 5tJQyOo40tGuBts9Co+x2eakcrMQ5cbZdynJaYYJcsMn/wtnl4YC8CCMgw8pqbYQudtn 3LDTRcYwnbYohHwQE17gJS6VWAVJDE1eonfLT/9A5aMD+lUxLkWTlHpCKj2XxPSJv2g9 143ecx3SyWMJj8E+KNrdBJ1z3KqPVd/SbemuBccHw6llMTSdmRFg8Hdx3zcTHKtC6/Kn tK+A== X-Gm-Message-State: AOAM531fmrWsxuVi+8Er9/WToEufWSHScXSQAn2VaP+8/4mVD4HVI4tv wCvbRPROD51ZJO98n3wBova/dw== X-Google-Smtp-Source: ABdhPJzc18sbrdkaWxZGqynaCTS8c2C8G6d/iIHzTfoUUvjEPBt4MSBejJHjCvNVYPHsG8WgZ1wkeQ== X-Received: by 2002:a17:90b:3850:: with SMTP id nl16mr9384332pjb.10.1638484082626; Thu, 02 Dec 2021 14:28:02 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.28.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:28:02 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Vitaly Lubart , Tomas Winkler , Daniele Ceraolo Spurio , Rodrigo Vivi , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 32/34] mei: pxp: Migrate to aggregate driver Date: Thu, 2 Dec 2021 14:27:30 -0800 Message-Id: <20211202222732.2453851-33-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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: Vitaly Lubart Cc: Tomas Winkler Cc: Daniele Ceraolo Spurio Cc: Rodrigo Vivi Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- drivers/misc/mei/pxp/mei_pxp.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/misc/mei/pxp/mei_pxp.c b/drivers/misc/mei/pxp/mei_pxp.c index f7380d387bab..50688a6fb1a9 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_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_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_aggregate_bind, + .remove = mei_aggregate_unbind, + .driver = { + .name = "mei", + .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 Dec 2 22:27:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 520225 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 87844C433EF for ; Thu, 2 Dec 2021 22:29:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377607AbhLBWcX (ORCPT ); Thu, 2 Dec 2021 17:32:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377500AbhLBWbz (ORCPT ); Thu, 2 Dec 2021 17:31:55 -0500 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E44ADC061377 for ; Thu, 2 Dec 2021 14:28:03 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id np3so836280pjb.4 for ; Thu, 02 Dec 2021 14:28: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=HmFwe71O6SgnJZrxVfyGwLakllS28Q6zlhd/maqZWnU=; b=A2/U/ZMfkChUnfq9PsvkbMDIt7QDQEY3r0JB9IYuAmZMJuo3Jgb7y5L+FnhyzRWdlY lGot14kFBgoB6mXDUmCETO/evZUJqdKKpAoX94yqD2P92PEyJi6DLmS/rl3WAeeyJO7M gdOOflOBf0yux+U7qNgXsj6GtxkhwOuZu5xjg= 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=6E51NyzijPILuk7dIaCd3oYiSy4mhjgTMktFO3OETvQkQhTwn7lUKXvxvYcwvQtJVT Sl7ENDVgXuJOZWSOdAnAsvTqp96wvAFHQpGWwzRJI2sV1eOLzBAVvOexmATV/y5soBws Fq0NdyrPXa0gBWzH6cJncL+4ZCbmzDELH6sDVXBqGZiIyww+wCM+BttxvIL/ZqZTjI/q pTi9kJDxp9jz4yIz7wYJaK6Jl4LfsZmCYM+5b/nU6iEmR4Fsv2EcXZqlZZUIvHRZ2GW1 NQ/Xzsl//iWMvo7ISQzhdPtCxRLoJzd6u0nphV2AkiFJ8CTPFmh5EmTa41kChjSBe9wS CIrg== X-Gm-Message-State: AOAM533GNEZyEXCdxPCtTwyiaTG90WlIxvRyZtUHto1+EhswxXIeIT9z oKEaOlKuGKOeiJvdfY9qQQMsuw== X-Google-Smtp-Source: ABdhPJzat4Uvneo1FNwJL5HsXMAaJnq1bdWvYSmzqPyx/ouc4S5AI21i23OXcJoKd7h6RbkLNCO6rQ== X-Received: by 2002:a17:90a:6f61:: with SMTP id d88mr9288909pjk.109.1638484083444; Thu, 02 Dec 2021 14:28:03 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.28.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:28:03 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Laurent Pinchart , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 33/34] component: Get rid of drm_of_component_probe() Date: Thu, 2 Dec 2021 14:27:31 -0800 Message-Id: <20211202222732.2453851-34-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 Dec 2 22:27:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 520221 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 93FECC433EF for ; Thu, 2 Dec 2021 22:29:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377366AbhLBWck (ORCPT ); Thu, 2 Dec 2021 17:32:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377380AbhLBWb4 (ORCPT ); Thu, 2 Dec 2021 17:31:56 -0500 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5C5AC06137C for ; Thu, 2 Dec 2021 14:28:04 -0800 (PST) Received: by mail-pl1-x633.google.com with SMTP id o14so744780plg.5 for ; Thu, 02 Dec 2021 14:28: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=lQPPjlrmfYNaZQJU5WpmjNJguM+Opu+iDFV373nUgEI=; b=KCM9awU9hR9q31ZrtoM6KfCBrTLCW62GiSOPxe+6dz0HKw2B3eVzsFVKfnfGvXhF9s vVMbO1WqT6qthi2nxSm2jUTXB/b+bzl9jE6YlswuvB0Ox+cwf5ikaEVoOmWbwGVplcCT E6xIrN3f69AFmvujMChxhNYYfCIDVl1EaHCHQ= 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=jWMNeu/H+wttVxa9IbpmZ6vFckSWi5TisIhd3ZyG3uP3taRE9RaXS1wQs7Ndih0TD7 WznJBbCq2b6Sb2H2X4W6+zVmTtk+o0hkjXHmmKlaZ4VWgZweyCi8XMkjsvTAmSlgabMt F2D/QoOzR2xYhne1ybAGIVGuK5gqOlXJQNBAT7QzKOPnOtuPAo/dybfC2jDE0D/e3xOK h+HrTn4XRNP+hROjNI59kJ0omn8nC/9HCAm+sYMi1n04VpCDqQmVZYu3j+obKUz4qM1s zkOsSumUTIGGhHGr2U9s2D3VF5TgHHg3bjHiQSxeAx3QKFVt2T7ELHSJa4odx/KJXXRO FFpw== X-Gm-Message-State: AOAM532KqhxSGo5FzpyKcIL9QrDwYU9+mSD1AgzKujH8lriQ33e8dqWS eCzxmhITwXo731hSCmLu+wneLw== X-Google-Smtp-Source: ABdhPJx1AV81uAombQGToSjTDY1INUbBt/qE7JnMcmPhzEESV5qra+YGdsINWUH+NyxFDyN20/YaaA== X-Received: by 2002:a17:902:c78a:b0:142:1b7a:930 with SMTP id w10-20020a170902c78a00b001421b7a0930mr18188917pla.8.1638484084303; Thu, 02 Dec 2021 14:28:04 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.28.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:28:03 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v4 34/34] component: Remove component_master_ops and friends Date: Thu, 2 Dec 2021 14:27:32 -0800 Message-Id: <20211202222732.2453851-35-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 *),