@@ -52,6 +52,7 @@ struct gpio_mockup_chip {
struct gpio_mockup_line_status *lines;
struct irq_domain *irq_sim_domain;
struct dentry *dbg_dir;
+ struct dentry *dbg_link;
struct mutex lock;
};
@@ -355,6 +356,13 @@ static void gpio_mockup_remove_chip_debugfs_entry(void *data)
debugfs_remove_recursive(entry);
}
+static void gpio_mockup_remove_chip_debugfs_link(void *data)
+{
+ struct dentry *link = data;
+
+ debugfs_remove(link);
+}
+
static int gpio_mockup_debugfs_setup(struct device *dev,
struct gpio_mockup_chip *chip)
{
@@ -368,7 +376,7 @@ static int gpio_mockup_debugfs_setup(struct device *dev,
gc = &chip->gc;
devname = dev_name(&gc->gpiodev->dev);
- chip->dbg_dir = debugfs_create_dir(devname, gpio_mockup_dbg_dir);
+ chip->dbg_dir = debugfs_create_dir(gc->label, gpio_mockup_dbg_dir);
if (IS_ERR(chip->dbg_dir))
return PTR_ERR(chip->dbg_dir);
@@ -377,6 +385,16 @@ static int gpio_mockup_debugfs_setup(struct device *dev,
if (ret)
return ret;
+ chip->dbg_link = debugfs_create_symlink(devname, gpio_mockup_dbg_dir,
+ gc->label);
+ if (IS_ERR(chip->dbg_link))
+ return PTR_ERR(chip->dbg_link);
+
+ ret = devm_add_action_or_reset(dev,
+ gpio_mockup_remove_chip_debugfs_link, chip->dbg_link);
+ if (ret)
+ return ret;
+
for (i = 0; i < gc->ngpio; i++) {
name = devm_kasprintf(dev, GFP_KERNEL, "%d", i);
if (!name)