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

Commit 02157160 authored by Tony Lindgren's avatar Tony Lindgren Committed by Linus Walleij
Browse files

pinctrl: free debugfs entries when unloading a pinmux driver



We were not cleaning up properly after unloading a pinmux
driver compiled as module.

Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent f9d41d7c
Loading
Loading
Loading
Loading
+13 −1
Original line number Original line Diff line number Diff line
@@ -510,10 +510,12 @@ static struct dentry *debugfs_root;


static void pinctrl_init_device_debugfs(struct pinctrl_dev *pctldev)
static void pinctrl_init_device_debugfs(struct pinctrl_dev *pctldev)
{
{
	static struct dentry *device_root;
	struct dentry *device_root;


	device_root = debugfs_create_dir(dev_name(pctldev->dev),
	device_root = debugfs_create_dir(dev_name(pctldev->dev),
					 debugfs_root);
					 debugfs_root);
	pctldev->device_root = device_root;

	if (IS_ERR(device_root) || !device_root) {
	if (IS_ERR(device_root) || !device_root) {
		pr_warn("failed to create debugfs directory for %s\n",
		pr_warn("failed to create debugfs directory for %s\n",
			dev_name(pctldev->dev));
			dev_name(pctldev->dev));
@@ -529,6 +531,11 @@ static void pinctrl_init_device_debugfs(struct pinctrl_dev *pctldev)
	pinconf_init_device_debugfs(device_root, pctldev);
	pinconf_init_device_debugfs(device_root, pctldev);
}
}


static void pinctrl_remove_device_debugfs(struct pinctrl_dev *pctldev)
{
	debugfs_remove_recursive(pctldev->device_root);
}

static void pinctrl_init_debugfs(void)
static void pinctrl_init_debugfs(void)
{
{
	debugfs_root = debugfs_create_dir("pinctrl", NULL);
	debugfs_root = debugfs_create_dir("pinctrl", NULL);
@@ -553,6 +560,10 @@ static void pinctrl_init_debugfs(void)
{
{
}
}


static void pinctrl_remove_device_debugfs(struct pinctrl_dev *pctldev)
{
}

#endif
#endif


/**
/**
@@ -641,6 +652,7 @@ void pinctrl_unregister(struct pinctrl_dev *pctldev)
	if (pctldev == NULL)
	if (pctldev == NULL)
		return;
		return;


	pinctrl_remove_device_debugfs(pctldev);
	pinmux_unhog_maps(pctldev);
	pinmux_unhog_maps(pctldev);
	/* TODO: check that no pinmuxes are still active? */
	/* TODO: check that no pinmuxes are still active? */
	mutex_lock(&pinctrldev_list_mutex);
	mutex_lock(&pinctrldev_list_mutex);
+3 −0
Original line number Original line Diff line number Diff line
@@ -41,6 +41,9 @@ struct pinctrl_dev {
	struct device *dev;
	struct device *dev;
	struct module *owner;
	struct module *owner;
	void *driver_data;
	void *driver_data;
#ifdef CONFIG_DEBUG_FS
	struct dentry *device_root;
#endif
#ifdef CONFIG_PINMUX
#ifdef CONFIG_PINMUX
	struct mutex pinmux_hogs_lock;
	struct mutex pinmux_hogs_lock;
	struct list_head pinmux_hogs;
	struct list_head pinmux_hogs;