Browse Source

pwm: core: populate the sysfs device into pwmchip

Populate the sysfs device into pwmchip so that the pwm chip
drivers can access its sysfs entries.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Bin Liu 6 years ago
parent
commit
63e0eeb282
2 changed files with 3 additions and 0 deletions
  1. 2 0
      drivers/pwm/sysfs.c
  2. 1 0
      include/linux/pwm.h

+ 2 - 0
drivers/pwm/sysfs.c

@@ -394,6 +394,8 @@ void pwmchip_sysfs_export(struct pwm_chip *chip)
 	if (IS_ERR(parent)) {
 		dev_warn(chip->dev,
 			 "device_create failed for pwm_chip sysfs export\n");
+	} else {
+		chip->sysfs_dev = parent;
 	}
 }
 

+ 1 - 0
include/linux/pwm.h

@@ -291,6 +291,7 @@ struct pwm_ops {
  */
 struct pwm_chip {
 	struct device *dev;
+	struct device *sysfs_dev;
 	struct list_head list;
 	const struct pwm_ops *ops;
 	int base;