drm/msm/mdp5: move iommu_domain_alloc() call close to its usage
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Thu, 16 Jun 2022 08:11:03 +0000 (11:11 +0300)
committerRob Clark <robdclark@chromium.org>
Wed, 6 Jul 2022 15:52:38 +0000 (08:52 -0700)
Move iommu_domain_alloc() in front of adress space/IOMMU initialization.
This allows us to drop final bits of struct mdp5_cfg_platform which
remained from the pre-DT days.

Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/489695/
Link: https://lore.kernel.org/r/20220616081106.350262-3-dmitry.baryshkov@linaro.org
Signed-off-by: Rob Clark <robdclark@chromium.org>
drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.c
drivers/gpu/drm/msm/disp/mdp5/mdp5_cfg.h
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c

index b17f868ffca83444ae05ed7349fb0778c157c330..1f1555aa02d23fbfe9512f3df173f4932e0c0a04 100644 (file)
@@ -1253,8 +1253,6 @@ static const struct mdp5_cfg_handler cfg_handlers_v3[] = {
        { .revision = 3, .config = { .hw = &sdm630_config } },
 };
 
-static struct mdp5_cfg_platform *mdp5_get_config(struct platform_device *dev);
-
 const struct mdp5_cfg_hw *mdp5_cfg_get_hw_config(struct mdp5_cfg_handler *cfg_handler)
 {
        return cfg_handler->config.hw;
@@ -1279,10 +1277,8 @@ struct mdp5_cfg_handler *mdp5_cfg_init(struct mdp5_kms *mdp5_kms,
                uint32_t major, uint32_t minor)
 {
        struct drm_device *dev = mdp5_kms->dev;
-       struct platform_device *pdev = to_platform_device(dev->dev);
        struct mdp5_cfg_handler *cfg_handler;
        const struct mdp5_cfg_handler *cfg_handlers;
-       struct mdp5_cfg_platform *pconfig;
        int i, ret = 0, num_handlers;
 
        cfg_handler = kzalloc(sizeof(*cfg_handler), GFP_KERNEL);
@@ -1325,9 +1321,6 @@ struct mdp5_cfg_handler *mdp5_cfg_init(struct mdp5_kms *mdp5_kms,
        cfg_handler->revision = minor;
        cfg_handler->config.hw = mdp5_cfg;
 
-       pconfig = mdp5_get_config(pdev);
-       memcpy(&cfg_handler->config.platform, pconfig, sizeof(*pconfig));
-
        DBG("MDP5: %s hw config selected", mdp5_cfg->name);
 
        return cfg_handler;
@@ -1338,12 +1331,3 @@ fail:
 
        return ERR_PTR(ret);
 }
-
-static struct mdp5_cfg_platform *mdp5_get_config(struct platform_device *dev)
-{
-       static struct mdp5_cfg_platform config = {};
-
-       config.iommu = iommu_domain_alloc(&platform_bus_type);
-
-       return &config;
-}
index 6b03d7899309a312e3047127b2a539310aae6ccc..c2502cc338646a69f5c8dead27f760565f391aef 100644 (file)
@@ -104,14 +104,8 @@ struct mdp5_cfg_hw {
        uint32_t max_clk;
 };
 
-/* platform config data (ie. from DT, or pdata) */
-struct mdp5_cfg_platform {
-       struct iommu_domain *iommu;
-};
-
 struct mdp5_cfg {
        const struct mdp5_cfg_hw *hw;
-       struct mdp5_cfg_platform platform;
 };
 
 struct mdp5_kms;
index 3d5621a68f858ed958b8b4f9497c7cdf40a710e5..a69e23f10d9180c84813cfe27410d9bfa5094155 100644 (file)
@@ -558,6 +558,7 @@ static int mdp5_kms_init(struct drm_device *dev)
        struct msm_gem_address_space *aspace;
        int irq, i, ret;
        struct device *iommu_dev;
+       struct iommu_domain *iommu;
 
        ret = mdp5_init(to_platform_device(dev->dev), dev);
 
@@ -601,14 +602,15 @@ static int mdp5_kms_init(struct drm_device *dev)
        }
        mdelay(16);
 
-       if (config->platform.iommu) {
+       iommu = iommu_domain_alloc(&platform_bus_type);
+       if (iommu) {
                struct msm_mmu *mmu;
 
                iommu_dev = &pdev->dev;
                if (!dev_iommu_fwspec_get(iommu_dev))
                        iommu_dev = iommu_dev->parent;
 
-               mmu = msm_iommu_new(iommu_dev, config->platform.iommu);
+               mmu = msm_iommu_new(iommu_dev, iommu);
 
                aspace = msm_gem_address_space_create(mmu, "mdp5",
                        0x1000, 0x100000000 - 0x1000);