Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1012333pxb; Tue, 26 Oct 2021 00:54:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6CoP0a3Z904/c997vzPPV1hFfQm2JrzRNPhP6/ZjQ+y9w2zxaUg5jPYzXv1n48uxeOwqX X-Received: by 2002:a17:902:9a97:b0:13e:2da4:8132 with SMTP id w23-20020a1709029a9700b0013e2da48132mr20921852plp.34.1635234873077; Tue, 26 Oct 2021 00:54:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635234873; cv=none; d=google.com; s=arc-20160816; b=B7Nh7052SEfK81kultZ521ewMOVjM3Jpj18/BXrhoSGDbeJntZKvqo49XsaRS7A94V TDhzz54wH4oxbNfdehNGnSUFLy4wuprOr/6nh77lEbOcCICR05ToDzya+o8WQqf/+qJN TRO3XEJBN91KpA26TP1iDzCsRtfiOeodhXQWHkv8Axyt3+sqFhn7n5egtwDu7kkKcMM5 JhEjoOJxEb71NJMUsfPCR8D5iqD9efZYLW1LGFkQHNO8C2iB3hof0cXrCZKQNwE7KIJR EVNBJmDRo3mXRL3v0PfKdwJqEvldaU3toQjCCUT5Tc+vI7bve9Ebpyhkc8JzHyiU/c4v 88Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kiNOxXumrSGzV6vW4uZBorP3H/jCdIuX85JHNzz9/pA=; b=rIQyyET+MJ+YeT3NhrQzMneJ9ICkd+eFdhSbo1ywKEwBcKBKp1i7YAhB/ujTA6WR1c 5/nfcQO92yn8lQ8AanueHH32V1SJchsr7H+jQHjNMUIhHF9Mn71E368vgNE0iX5IrOfI I0vC9lmj2e5R7bKwHwRXwLb4PWBbZ5NKqNLWldt/PwqnX8Z8tW57KRvnSAOHptzoVFdO 8xBloo0T7UUIe6bSZ92f2JT8I/FwGeEMHmaBv31Qy0mmrCQ9dlEcFYIk3mFHdIvhnZZM U2iwJenRs/a6ztz5zPGH1oIvTjlQC4ihQ4Y1Bo+tJrktNW9rGkC6HxXoH5tATEg1lwKj ckBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=JMiy5eF8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mh13si33800381pjb.27.2021.10.26.00.54.15; Tue, 26 Oct 2021 00:54:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=JMiy5eF8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236430AbhJZAGk (ORCPT + 99 others); Mon, 25 Oct 2021 20:06:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233720AbhJZADM (ORCPT ); Mon, 25 Oct 2021 20:03:12 -0400 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7286C061224 for ; Mon, 25 Oct 2021 17:00:47 -0700 (PDT) Received: by mail-pf1-x42b.google.com with SMTP id x66so12446959pfx.13 for ; Mon, 25 Oct 2021 17:00:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kiNOxXumrSGzV6vW4uZBorP3H/jCdIuX85JHNzz9/pA=; b=JMiy5eF8fFhoaXn0XtQA82qv7f3Kn/gzOSEl6q6IP9UA+c2TYZxwR4GVpZOQ1XYabD DdoRH4AdBDSVqcecLfZZ2aazEwXu6Bv6xNHJb4qXAV848IlvHVMT7L5QCWoNoscX+gft MAZY0D2nvFDXOW35ypGnfdQ6lD2L8CpXJx8Pw= 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=kiNOxXumrSGzV6vW4uZBorP3H/jCdIuX85JHNzz9/pA=; b=a1Grnl+M0buSJRCQdzO5OprLvXkHque+eu0Mc/R1eLBZEPqNdo121Iw1p83y93mFAy /4WbFu3Uwb8iRpKSv0syui/YrSN1C56vyWOrznoayNKK6WKghPa7fgtdysqaPBoYHhhQ ZG/6BdZcVTp7oR630NQxqOnd4KrrBvsAVQE7+u0L/HYI9JPK3MYq+4uMK5MpzGIKmxMX ++SEmB80DLZUB8Osi0z61yCMSblZEhodGVDGeJtO4KAvmJe5x+KGxE8k1o2HhFj4Vn83 swWRzQqCzCYvbA5X4bjraqsrQGSInZjuP7HnDC0TuWeMbIsWUbqnjDa9QsCc01cZ7Ljo i50Q== X-Gm-Message-State: AOAM530kh07mHG8tE6P/V/dORefwFS3Bnpoi11+ExGSBvL5AKTF1tGJv wzvxwyFDZqc6TjAHCSWgQvd3iA== X-Received: by 2002:aa7:8149:0:b0:44c:916c:1fdb with SMTP id d9-20020aa78149000000b0044c916c1fdbmr22481157pfn.34.1635206447235; Mon, 25 Oct 2021 17:00:47 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:f5e3:5eb1:d5ee:6893]) by smtp.gmail.com with ESMTPSA id b7sm9900747pfm.28.2021.10.25.17.00.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Oct 2021 17:00:46 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Daniel Vetter , Laurent Pinchart , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v3 01/34] component: Introduce struct aggregate_device Date: Mon, 25 Oct 2021 17:00:11 -0700 Message-Id: <20211026000044.885195-2-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.1079.g6e70778dc9-goog In-Reply-To: <20211026000044.885195-1-swboyd@chromium.org> References: <20211026000044.885195-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 5e79299f6c3f..1c3c91ba7d2e 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -9,6 +9,7 @@ */ #include #include +#include #include #include #include @@ -64,7 +65,10 @@ struct master { const struct component_master_ops *ops; struct device *parent; + struct device dev; struct component_match *match; + + int id; }; struct component { @@ -80,6 +84,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. */ -- https://chromeos.dev