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: 12653601 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D6724C4332F for ; Thu, 2 Dec 2021 22:27:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E12666FBA2; Thu, 2 Dec 2021 22:27:38 +0000 (UTC) Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5C9D96FBD0 for ; Thu, 2 Dec 2021 22:27:37 +0000 (UTC) Received: by mail-pl1-x633.google.com with SMTP id p18so717138plf.13 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=Q6+mhL7db2l0pNQB93N1TmG0cT/RPcYsylApsQWWOhNC6inQllT96LMW3XD5TZsjIR nJi8Lh8AE7eZkYHE8oK5G3X8/WceNqM9QfWYtHUnO20QXzz+xF1wJV2lr2uXg3qBXyJ+ PiYWQAO6d6SNk8TK6aTdBSMIo5Qz25XV5k2Vjzy+fkw5Y5n7ad3qct4BCxz3eO9UKgnS kAXkpUa4bOFewIRnQkV9PBN4amZxtIdY6BxI4vizF2iUq5XHy0zGEq3jV4ounvVP7A0x MjIy+mUjWPCQashxJFWsla95YbVEFjB++Nt1Xr1xJ6SAJ4SdhLgpkmQ2L6ghkteKRvMw Eb+Q== X-Gm-Message-State: AOAM532kH8A2REOF+Kkb50XHfw0iTjoOv/cQdaW/mxQUcLd8B2jWUs7j GOY9h1K0S/zvL8Csi+fQmHGcoA== 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 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 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Saravana Kannan , "Rafael J. Wysocki" , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Laurent Pinchart , Daniel Vetter , Russell King , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Replace 'struct master' with 'struct aggregate_device' and then rename 'master' to 'adev' everywhere in the code. While we're here, put a struct device inside the aggregate device so that we can register it with a bus_type in the next patch. The diff is large but that's because this is mostly a rename, where sometimes 'master' is replaced with 'adev' and other times it is replaced with 'parent' to indicate that the struct device that was being used is actually the parent of the aggregate device and driver. Cc: Daniel Vetter Cc: 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. */