Skip to content

Commit

Permalink
gpio: mockup: remove gpio debugfs when remove device
Browse files Browse the repository at this point in the history
[ Upstream commit 303e6da ]

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: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Wei Yongjun authored and gregkh committed Sep 20, 2022
1 parent 35c0b78 commit bc55c16
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drivers/gpio/gpio-mockup.c
Expand Up @@ -373,6 +373,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;
Expand Down Expand Up @@ -455,7 +462,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 const struct of_device_id gpio_mockup_of_match[] = {
Expand Down

0 comments on commit bc55c16

Please sign in to comment.