Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp661543pxb; Wed, 6 Oct 2021 12:39:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYuUOehjtV1QF6JZbTBXc9GOEVuiE9sSnENfMoYxsGcEvOL23Yg4roUwl7X8kxmPePL8NR X-Received: by 2002:a17:902:7e88:b0:13e:91ec:4114 with SMTP id z8-20020a1709027e8800b0013e91ec4114mr110274pla.30.1633549183259; Wed, 06 Oct 2021 12:39:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633549183; cv=none; d=google.com; s=arc-20160816; b=G8USktVURLPhG2RgkDDZFpdEGoV9A2qsyQA8SvmG16iefaTr/fs3SgnFwxZIRf1lOL hIjSr2Yf5i9WyqJpR0SKsGkaVF+xF1f7PlPJ/HHQQRnLsHVy6cU37k7NKnmtiNX7y2N8 T3Ps9hLYI8soI+dVtlQzxC2MjVFLQRBVEQl/UtRvunzrhOIYGx3v7WsASmPXjAeR6GVQ XGlby1bZ86LeNhn3yHrml3V6NpAnny1Em6Cr7jo7iOknyEUGgNI0xvT4JYlmc/9YmFQ5 fH74R+UCyhbfDWS/Wh9FpGihCtCuWvUxNE9ErujVhTDZldjgOjbjc1szcgBm2Rz8pXno CZoQ== 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=WSt66/qxaj+Yl6pIb1r8ArjDZRzSqERxTSL7e01cwWQ=; b=bBv2IQwSerDCb7ykxXamZCxtD22DJqqr8nJiiWRR8n4bjtVXzM38DF0nU0seoKuDZh K5ewJvD+4CVMopvfeN4B0mgP7nt7JY84sYvkEzPfGc8BHnxq46DucnvpXKVb/BPUFT5G Zmj+0zS6liO8/j/CkwOiKtwvcdWkAiqNM1U2CfJKpTk3wZjSrzIk6YdyZm4t58sPiLeT WTabF7nSJX9wN0pHz/whnGKS+0eHxVQzKEExt5Fo+r7IRBEi2jZPwaelERve4tLgnl+y 5NKpKp+mRGlJbOqrH6HucRcT1CPKibG4nA9VGDfKu0ASOXTt72rNVG8Jr4yH0b/suzFd V7nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BmiI3LSy; 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 m22si38455991pgu.68.2021.10.06.12.39.30; Wed, 06 Oct 2021 12:39:43 -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=BmiI3LSy; 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 S239483AbhJFTkc (ORCPT + 99 others); Wed, 6 Oct 2021 15:40:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239431AbhJFTk0 (ORCPT ); Wed, 6 Oct 2021 15:40:26 -0400 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 35D3DC061764 for ; Wed, 6 Oct 2021 12:38:29 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id u7so3247131pfg.13 for ; Wed, 06 Oct 2021 12:38:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WSt66/qxaj+Yl6pIb1r8ArjDZRzSqERxTSL7e01cwWQ=; b=BmiI3LSyKjcVMkJ2gZd3LhPTHWfcmkydptEVQ9oiWWAFWzIe1MohWjx9bbawlzcH7q qetmyBf+RlGrk5ISWZRggAq3lthN3K/k4DISR3I5gMMLDXMXT8AzbWlWkmrgXro8h50I 0A+4VMPnY2FjF4u4slYiTPHpdBdGgrCNY66dA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WSt66/qxaj+Yl6pIb1r8ArjDZRzSqERxTSL7e01cwWQ=; b=xbXkIzugwc64uOaaQ5t0EJkzD7zepVV8o7hJsN+N3wCxG+yJ1T2aQZqmgQerZ7DLgz lLFfHg+BWpf8XcXpvX+EwWVKDYSI0f14trLn1H72pD1ePuCkZbDSVkH9E50sW7BH0DYc K/FPkXroajy02qsSg7pl94QBqttORsW42BC6DbZVagwfqd2BpmKF6Zkbi0WLuk7uAwri Awiz/FMhtL3K4aDFUgdwXt6CEPPduWDIAR5z1vaHyIKb78DhzAwZDdS+SiJJ6u8g6IMW lZ4GlsuBwJPrhgobbeO2NCZK5IFFEq3wy1jR8jleWc4tF9tB6Rt8vikFL8VCyqF1K7OT g50Q== X-Gm-Message-State: AOAM530RFtjabJjggKrwnR64VbtV66jzc8VgLcgA96MLB9IHMcYv/cUi UMGSB22xp0+GuMEA28grIQ/guA== X-Received: by 2002:a63:5717:: with SMTP id l23mr443433pgb.87.1633549108801; Wed, 06 Oct 2021 12:38:28 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:28 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Daniel Vetter Subject: [PATCH v2 05/34] component: Add {bind,unbind}_component() ops that take aggregate device Date: Wed, 6 Oct 2021 12:37:50 -0700 Message-Id: <20211006193819.2654854-6-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 Signed-off-by: Stephen Boyd --- drivers/base/component.c | 14 +++++++++++--- include/linux/component.h | 22 ++++++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/drivers/base/component.c b/drivers/base/component.c index f49b48695c8f..a6dd33d0ddeb 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -707,8 +707,13 @@ static void component_unbind(struct component *component, { WARN_ON(!component->bound); - if (component->ops && component->ops->unbind) - component->ops->unbind(component->dev, adev->parent, data); + if (component->ops) { + if (component->ops->unbind) + component->ops->unbind(component->dev, adev->parent, data); + else if (component->ops->unbind_component) + component->ops->unbind_component(component->dev, adev, data); + } + component->bound = false; /* Release all resources claimed in the binding of this component */ @@ -773,7 +778,10 @@ static int component_bind(struct component *component, struct aggregate_device * dev_dbg(adev->parent, "binding %s (ops %ps)\n", dev_name(component->dev), component->ops); - ret = component->ops->bind(component->dev, adev->parent, data); + if (component->ops->bind_component) + ret = component->ops->bind_component(component->dev, adev, data); + else + ret = component->ops->bind(component->dev, adev->parent, data); if (!ret) { component->bound = true; diff --git a/include/linux/component.h b/include/linux/component.h index e99cf8e910f0..d8dcbf9733da 100644 --- a/include/linux/component.h +++ b/include/linux/component.h @@ -6,6 +6,7 @@ #include struct component_match; +struct aggregate_device; /** * struct component_ops - callbacks for component drivers @@ -19,18 +20,39 @@ struct component_ops { * * Called through component_bind_all() when the aggregate driver is * ready to bind the overall driver. + * + * Deprecated: Use bind_component() instead. */ int (*bind)(struct device *comp, struct device *master, void *master_data); + /** + * @bind_component: + * + * Called through component_bind_all() when the aggregate driver is + * ready to bind the overall driver. + */ + int (*bind_component)(struct device *comp, struct aggregate_device *adev, + void *aggregate_data); /** * @unbind: * * Called through component_unbind_all() when the aggregate driver is * ready to bind the overall driver, or when component_bind_all() fails * part-ways through and needs to unbind some already bound components. + * + * Deprecated: Use unbind_component() instead. */ void (*unbind)(struct device *comp, struct device *master, void *master_data); + /** + * @unbind_component: + * + * Called through component_unbind_all() when the aggregate driver is + * ready to unbind the overall driver, or when component_bind_all() fails + * part-ways through and needs to unbind some already bound components. + */ + int (*unbind_component)(struct device *comp, struct aggregate_device *adev, + void *aggregate_data); }; int component_add(struct device *, const struct component_ops *); -- https://chromeos.dev