Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1011890pxb; Tue, 26 Oct 2021 00:54:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzb8oSUDTXHJgQv1QbY5vZTsfVf8J9IOxmfG+qUiYZ95ZscjcmKwYpKZodBRMs318PUVnae X-Received: by 2002:a05:6402:5245:: with SMTP id t5mr33149057edd.329.1635234840328; Tue, 26 Oct 2021 00:54:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635234840; cv=none; d=google.com; s=arc-20160816; b=vQpTEjabRemEf4RvT8NAX5mZPkUsdJB/BG77kKfWxADAVwKUGufBEskkKQpbOKsV5h bQ9WyKwrmGTTlYVcOAGhWIcEEKYMmmUYovydjjk5eSxI5mRKK//8OVBs379p/u43QC3k RP5GCnm3/wiNqanIwRN1SIsW/JiMpYScmqi91Omr9NS9ngWd+7Vp+/wCRYLD9qEm0lUk ajKaG01isU8vw6yb/GxyQJUhQxvRVCs9UiJWJ7D8g0D/aZodO3QxELJx0qmSqK94Ede4 q47CX9PHfKr1uSXUkicjfaKW04hifQ+tAxcaBk37jDxMCWN2xzP5pZ2czfqSuhfU3Boq anxg== 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=HoQjuHREWvjsK8rKG+0w83Xi8iEfhBhp3a3+GSxKR9Y=; b=Dlesb0F6VzxMoiZxESQhm+3LdTuUFrLuGJ5yz2PxSRJnAiOZUMHgV9k2WW8cfFXHg9 nfpsMxxvvHXisacW7O0nARXlTo8HGNoWoGPuymGU3kJ/JlbFSprPPlNEOrfqhmowWrrU XaBkQLI4PNMNCy7SDYlP0aXLqXaSha8qqt8tszKWEksgvSqPXPbj+g4b4MLJmpo5xRJW IvC7K/Kr98jzLJJUi1sZJmikEgWyt1gjDe8kgDkZYNTCoX7E6TbL4jZchJ/lMeFr/cUM h2xpyGs8CzkhkdhK2FpipsFFM152GUhKRIwjXzuDbJXFKTc9eSx0ITksbMuspncr6w1c 8qug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DIhkC3T2; 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 dm4si16064017ejc.699.2021.10.26.00.53.36; Tue, 26 Oct 2021 00:54:00 -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=DIhkC3T2; 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 S235942AbhJZAFP (ORCPT + 99 others); Mon, 25 Oct 2021 20:05:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235528AbhJZADf (ORCPT ); Mon, 25 Oct 2021 20:03:35 -0400 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 53411C061226 for ; Mon, 25 Oct 2021 17:01:10 -0700 (PDT) Received: by mail-pf1-x429.google.com with SMTP id o133so12471020pfg.7 for ; Mon, 25 Oct 2021 17:01:10 -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=HoQjuHREWvjsK8rKG+0w83Xi8iEfhBhp3a3+GSxKR9Y=; b=DIhkC3T27QWq0sDeTLd/pr0xlBZ6AEq0iYox+eP070HrrQqVsjk72M5k7wP2t56sxg nUpxgLIOUf7HQYcVRntTeybsGhiJ6B+vlNLvh/bCCBltL6jY2o2L7n9HEyT3fW/Fddx2 YyoB4EFXHbMZZ+qQyX+8c7nPGuGh3lcnj/m14= 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=HoQjuHREWvjsK8rKG+0w83Xi8iEfhBhp3a3+GSxKR9Y=; b=TfQ/n32cF/LT8uvSWp2hrwZEEghl9Hmd1xVG5HXd/mjSwK0vnR5iZJJLAirJD6wwbg 5h/P3k0oqs7yQeP9B5l9VnyLNKrR0xzPHm9rxzUff9PJWCE70beR49FQ4LO6MUZL7j8I 4rGmQn4xyMtRGeEOHHR0PLs3iKyVq4V47GxQMoSrJkIPDKqwIuDxX8ZzTRAFP9N0o8cH 7wMpFP7SIcloa1qtB+MxLMrE+MlOvA592jgIoDEQfRSn2xw7udpBXRc3l3o1bf60vPIM nlCgI4sAlRzKHJZpN2WVNOB9pxoq3hDImV44jkGE3ywlaHH8vrKQweZXxralqQiM/YtN Tezg== X-Gm-Message-State: AOAM532V8xeVED44wmaiNvs0iq2BP/cBSpEAExAfUo7SCrA3ASvAxZ/h wS5JKDXz6oOz0eWAP0AZry+S1A== X-Received: by 2002:a63:4f57:: with SMTP id p23mr16268519pgl.376.1635206469768; Mon, 25 Oct 2021 17:01:09 -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.01.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Oct 2021 17:01:09 -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, Yong Wu , Joerg Roedel , Will Deacon , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v3 27/34] iommu/mtk: Migrate to aggregate driver Date: Mon, 25 Oct 2021 17:00:37 -0700 Message-Id: <20211026000044.885195-28-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 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 d837adfd1da5..8b303c388a9b 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -750,9 +750,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) @@ -893,7 +897,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; @@ -926,7 +930,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; } -- https://chromeos.dev