Commit 8296d026 authored by Wei Yongjun's avatar Wei Yongjun Committed by Jialin Zhang
Browse files

gpio: mockup: remove gpio debugfs when remove device

stable inclusion
from stable-v5.10.144
commit 3815e66c2183f3430490e450ba16779cf5214ec6
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I6D0V7

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=3815e66c2183f3430490e450ba16779cf5214ec6



--------------------------------

[ Upstream commit 303e6da9 ]

GPIO mockup debugfs is created in gpio_mockup_probe() but
forgot to remove when remove device. This patch add a devm
managed callback for removing them.

Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: default avatarBartosz Golaszewski <brgl@bgdev.pl>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
Reviewed-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 5ac2dd78
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -375,6 +375,13 @@ static void gpio_mockup_debugfs_setup(struct device *dev,
	}
}

static void gpio_mockup_debugfs_cleanup(void *data)
{
	struct gpio_mockup_chip *chip = data;

	debugfs_remove_recursive(chip->dbg_dir);
}

static void gpio_mockup_dispose_mappings(void *data)
{
	struct gpio_mockup_chip *chip = data;
@@ -457,7 +464,7 @@ static int gpio_mockup_probe(struct platform_device *pdev)

	gpio_mockup_debugfs_setup(dev, chip);

	return 0;
	return devm_add_action_or_reset(dev, gpio_mockup_debugfs_cleanup, chip);
}

static struct platform_driver gpio_mockup_driver = {