Эх сурвалжийг харах

gpio: mockup: extend the debugfs layout

Currently each chip has a dedicated directory in debugfs for event
triggers. We use the chip's label for the directory name, but the user
can't really associate these directories with chip names without
parsing the relevant sysfs entries.

Use chip names for directory names. For backward compatibility: create
links pointing to the actual directories named using the chip labels.

Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Bartosz Golaszewski 7 жил өмнө
parent
commit
ca8792af40

+ 8 - 2
drivers/gpio/gpio-mockup.c

@@ -196,17 +196,23 @@ static void gpio_mockup_debugfs_setup(struct device *dev,
 				      struct gpio_mockup_chip *chip)
 				      struct gpio_mockup_chip *chip)
 {
 {
 	struct gpio_mockup_dbgfs_private *priv;
 	struct gpio_mockup_dbgfs_private *priv;
-	struct dentry *evfile;
+	struct dentry *evfile, *link;
 	struct gpio_chip *gc;
 	struct gpio_chip *gc;
+	const char *devname;
 	char *name;
 	char *name;
 	int i;
 	int i;
 
 
 	gc = &chip->gc;
 	gc = &chip->gc;
+	devname = dev_name(&gc->gpiodev->dev);
 
 
-	chip->dbg_dir = debugfs_create_dir(gc->label, gpio_mockup_dbg_dir);
+	chip->dbg_dir = debugfs_create_dir(devname, gpio_mockup_dbg_dir);
 	if (!chip->dbg_dir)
 	if (!chip->dbg_dir)
 		goto err;
 		goto err;
 
 
+	link = debugfs_create_symlink(gc->label, gpio_mockup_dbg_dir, devname);
+	if (!link)
+		goto err;
+
 	for (i = 0; i < gc->ngpio; i++) {
 	for (i = 0; i < gc->ngpio; i++) {
 		name = devm_kasprintf(dev, GFP_KERNEL, "%d", i);
 		name = devm_kasprintf(dev, GFP_KERNEL, "%d", i);
 		if (!name)
 		if (!name)