Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7cdcce9f authored by Guido Martínez's avatar Guido Martínez Committed by Dave Airlie
Browse files

drm/tilcdc: remove submodule destroy calls



The TI tilcdc driver is designed with a notion of submodules. Currently,
at unload time, these submodules are iterated and destroyed.

Now that the tilcdc remove order is fixed, this can be handled perfectly
by the kernel using the device infrastructure, since each submodule
is a kernel driver itself, and they are only destroy()'ed at unload
time. Therefore we move the destroy() functionality to each submodule's
remove().

Also, remove some checks in the unloading process since the new code
guarantees the resources are allocated and need a release.

Signed-off-by: default avatarGuido Martínez <guido@vanguardiasur.com.ar>
Tested-by: default avatarDarren Etheridge <detheridge@ti.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent c9a3ad25
Loading
Loading
Loading
Loading
+0 −0

Empty file added.

+0 −6
Original line number Diff line number Diff line
@@ -120,7 +120,6 @@ static int cpufreq_transition(struct notifier_block *nb,
static int tilcdc_unload(struct drm_device *dev)
{
	struct tilcdc_drm_private *priv = dev->dev_private;
	struct tilcdc_module *mod, *cur;

	drm_fbdev_cma_fini(priv->fbdev);
	drm_kms_helper_poll_fini(dev);
@@ -149,11 +148,6 @@ static int tilcdc_unload(struct drm_device *dev)

	pm_runtime_disable(dev->dev);

	list_for_each_entry_safe(mod, cur, &module_list, list) {
		DBG("destroying module: %s", mod->name);
		mod->funcs->destroy(mod);
	}

	kfree(priv);

	return 0;
+0 −1
Original line number Diff line number Diff line
@@ -98,7 +98,6 @@ struct tilcdc_module;
struct tilcdc_module_ops {
	/* create appropriate encoders/connectors: */
	int (*modeset_init)(struct tilcdc_module *mod, struct drm_device *dev);
	void (*destroy)(struct tilcdc_module *mod);
#ifdef CONFIG_DEBUG_FS
	/* create debugfs nodes (can be NULL): */
	int (*debugfs_init)(struct tilcdc_module *mod, struct drm_minor *minor);
+18 −18
Original line number Diff line number Diff line
@@ -282,21 +282,8 @@ static int panel_modeset_init(struct tilcdc_module *mod, struct drm_device *dev)
	return 0;
}

static void panel_destroy(struct tilcdc_module *mod)
{
	struct panel_module *panel_mod = to_panel_module(mod);

	if (panel_mod->timings)
		display_timings_release(panel_mod->timings);

	tilcdc_module_cleanup(mod);
	kfree(panel_mod->info);
	kfree(panel_mod);
}

static const struct tilcdc_module_ops panel_module_ops = {
		.modeset_init = panel_modeset_init,
		.destroy = panel_destroy,
};

/*
@@ -372,6 +359,7 @@ static int panel_probe(struct platform_device *pdev)
		return -ENOMEM;

	mod = &panel_mod->base;
	pdev->dev.platform_data = mod;

	tilcdc_module_init(mod, "panel", &panel_module_ops);

@@ -379,17 +367,16 @@ static int panel_probe(struct platform_device *pdev)
	if (IS_ERR(pinctrl))
		dev_warn(&pdev->dev, "pins are not configured\n");


	panel_mod->timings = of_get_display_timings(node);
	if (!panel_mod->timings) {
		dev_err(&pdev->dev, "could not get panel timings\n");
		goto fail;
		goto fail_free;
	}

	panel_mod->info = of_get_panel_info(node);
	if (!panel_mod->info) {
		dev_err(&pdev->dev, "could not get panel info\n");
		goto fail;
		goto fail_timings;
	}

	mod->preferred_bpp = panel_mod->info->bpp;
@@ -400,13 +387,26 @@ static int panel_probe(struct platform_device *pdev)

	return 0;

fail:
	panel_destroy(mod);
fail_timings:
	display_timings_release(panel_mod->timings);

fail_free:
	kfree(panel_mod);
	tilcdc_module_cleanup(mod);
	return ret;
}

static int panel_remove(struct platform_device *pdev)
{
	struct tilcdc_module *mod = dev_get_platdata(&pdev->dev);
	struct panel_module *panel_mod = to_panel_module(mod);

	display_timings_release(panel_mod->timings);

	tilcdc_module_cleanup(mod);
	kfree(panel_mod->info);
	kfree(panel_mod);

	return 0;
}

+15 −11
Original line number Diff line number Diff line
@@ -296,17 +296,8 @@ static int slave_modeset_init(struct tilcdc_module *mod, struct drm_device *dev)
	return 0;
}

static void slave_destroy(struct tilcdc_module *mod)
{
	struct slave_module *slave_mod = to_slave_module(mod);

	tilcdc_module_cleanup(mod);
	kfree(slave_mod);
}

static const struct tilcdc_module_ops slave_module_ops = {
		.modeset_init = slave_modeset_init,
		.destroy = slave_destroy,
};

/*
@@ -356,10 +347,13 @@ static int slave_probe(struct platform_device *pdev)
	}

	slave_mod = kzalloc(sizeof(*slave_mod), GFP_KERNEL);
	if (!slave_mod)
		return -ENOMEM;
	if (!slave_mod) {
		ret = -ENOMEM;
		goto fail_adapter;
	}

	mod = &slave_mod->base;
	pdev->dev.platform_data = mod;

	mod->preferred_bpp = slave_info.bpp;

@@ -374,10 +368,20 @@ static int slave_probe(struct platform_device *pdev)
	tilcdc_slave_probedefer(false);

	return 0;

fail_adapter:
	i2c_put_adapter(slavei2c);
	return ret;
}

static int slave_remove(struct platform_device *pdev)
{
	struct tilcdc_module *mod = dev_get_platdata(&pdev->dev);
	struct slave_module *slave_mod = to_slave_module(mod);

	tilcdc_module_cleanup(mod);
	kfree(slave_mod);

	return 0;
}

Loading