diff options
author | Tony Lindgren <tony@atomide.com> | 2012-01-20 11:17:22 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-01-24 17:03:02 -0500 |
commit | 0215716083cac67ff7ea3e3efdc9943bdb462274 (patch) | |
tree | 5d3f28f6aa09717833d5f60e5f7cb148e4a9d2e1 | |
parent | f9d41d7cb5a3a4fe9585d47e518d779d2aef8c94 (diff) |
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: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | drivers/pinctrl/core.c | 14 | ||||
-rw-r--r-- | drivers/pinctrl/core.h | 3 |
2 files changed, 16 insertions, 1 deletions
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index 569bdb3ef104..d9d35fcbfc6b 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c | |||
@@ -510,10 +510,12 @@ static struct dentry *debugfs_root; | |||
510 | 510 | ||
511 | static void pinctrl_init_device_debugfs(struct pinctrl_dev *pctldev) | 511 | static void pinctrl_init_device_debugfs(struct pinctrl_dev *pctldev) |
512 | { | 512 | { |
513 | static struct dentry *device_root; | 513 | struct dentry *device_root; |
514 | 514 | ||
515 | device_root = debugfs_create_dir(dev_name(pctldev->dev), | 515 | device_root = debugfs_create_dir(dev_name(pctldev->dev), |
516 | debugfs_root); | 516 | debugfs_root); |
517 | pctldev->device_root = device_root; | ||
518 | |||
517 | if (IS_ERR(device_root) || !device_root) { | 519 | if (IS_ERR(device_root) || !device_root) { |
518 | pr_warn("failed to create debugfs directory for %s\n", | 520 | pr_warn("failed to create debugfs directory for %s\n", |
519 | dev_name(pctldev->dev)); | 521 | dev_name(pctldev->dev)); |
@@ -529,6 +531,11 @@ static void pinctrl_init_device_debugfs(struct pinctrl_dev *pctldev) | |||
529 | pinconf_init_device_debugfs(device_root, pctldev); | 531 | pinconf_init_device_debugfs(device_root, pctldev); |
530 | } | 532 | } |
531 | 533 | ||
534 | static void pinctrl_remove_device_debugfs(struct pinctrl_dev *pctldev) | ||
535 | { | ||
536 | debugfs_remove_recursive(pctldev->device_root); | ||
537 | } | ||
538 | |||
532 | static void pinctrl_init_debugfs(void) | 539 | static void pinctrl_init_debugfs(void) |
533 | { | 540 | { |
534 | debugfs_root = debugfs_create_dir("pinctrl", NULL); | 541 | debugfs_root = debugfs_create_dir("pinctrl", NULL); |
@@ -553,6 +560,10 @@ static void pinctrl_init_debugfs(void) | |||
553 | { | 560 | { |
554 | } | 561 | } |
555 | 562 | ||
563 | static void pinctrl_remove_device_debugfs(struct pinctrl_dev *pctldev) | ||
564 | { | ||
565 | } | ||
566 | |||
556 | #endif | 567 | #endif |
557 | 568 | ||
558 | /** | 569 | /** |
@@ -641,6 +652,7 @@ void pinctrl_unregister(struct pinctrl_dev *pctldev) | |||
641 | if (pctldev == NULL) | 652 | if (pctldev == NULL) |
642 | return; | 653 | return; |
643 | 654 | ||
655 | pinctrl_remove_device_debugfs(pctldev); | ||
644 | pinmux_unhog_maps(pctldev); | 656 | pinmux_unhog_maps(pctldev); |
645 | /* TODO: check that no pinmuxes are still active? */ | 657 | /* TODO: check that no pinmuxes are still active? */ |
646 | mutex_lock(&pinctrldev_list_mutex); | 658 | mutex_lock(&pinctrldev_list_mutex); |
diff --git a/drivers/pinctrl/core.h b/drivers/pinctrl/core.h index 177a3310547f..cfa86da6b4b1 100644 --- a/drivers/pinctrl/core.h +++ b/drivers/pinctrl/core.h | |||
@@ -41,6 +41,9 @@ struct pinctrl_dev { | |||
41 | struct device *dev; | 41 | struct device *dev; |
42 | struct module *owner; | 42 | struct module *owner; |
43 | void *driver_data; | 43 | void *driver_data; |
44 | #ifdef CONFIG_DEBUG_FS | ||
45 | struct dentry *device_root; | ||
46 | #endif | ||
44 | #ifdef CONFIG_PINMUX | 47 | #ifdef CONFIG_PINMUX |
45 | struct mutex pinmux_hogs_lock; | 48 | struct mutex pinmux_hogs_lock; |
46 | struct list_head pinmux_hogs; | 49 | struct list_head pinmux_hogs; |