pwm: convert class code to use dev_groups
The dev_attrs field of struct class is going away soon, dev_groups should be used instead. This converts the PWM class code to use the correct field. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
This commit is contained in:
parent
5ae90d8e46
commit
9da0175963
1 changed files with 12 additions and 9 deletions
|
@ -268,6 +268,7 @@ static ssize_t pwm_export_store(struct device *parent,
|
||||||
|
|
||||||
return ret ? : len;
|
return ret ? : len;
|
||||||
}
|
}
|
||||||
|
static DEVICE_ATTR(export, 0200, NULL, pwm_export_store);
|
||||||
|
|
||||||
static ssize_t pwm_unexport_store(struct device *parent,
|
static ssize_t pwm_unexport_store(struct device *parent,
|
||||||
struct device_attribute *attr,
|
struct device_attribute *attr,
|
||||||
|
@ -288,27 +289,29 @@ static ssize_t pwm_unexport_store(struct device *parent,
|
||||||
|
|
||||||
return ret ? : len;
|
return ret ? : len;
|
||||||
}
|
}
|
||||||
|
static DEVICE_ATTR(unexport, 0200, NULL, pwm_unexport_store);
|
||||||
|
|
||||||
static ssize_t pwm_npwm_show(struct device *parent,
|
static ssize_t npwm_show(struct device *parent, struct device_attribute *attr,
|
||||||
struct device_attribute *attr,
|
char *buf)
|
||||||
char *buf)
|
|
||||||
{
|
{
|
||||||
const struct pwm_chip *chip = dev_get_drvdata(parent);
|
const struct pwm_chip *chip = dev_get_drvdata(parent);
|
||||||
|
|
||||||
return sprintf(buf, "%u\n", chip->npwm);
|
return sprintf(buf, "%u\n", chip->npwm);
|
||||||
}
|
}
|
||||||
|
static DEVICE_ATTR_RO(npwm);
|
||||||
|
|
||||||
static struct device_attribute pwm_chip_attrs[] = {
|
static struct attribute *pwm_chip_attrs[] = {
|
||||||
__ATTR(export, 0200, NULL, pwm_export_store),
|
&dev_attr_export.attr,
|
||||||
__ATTR(unexport, 0200, NULL, pwm_unexport_store),
|
&dev_attr_unexport.attr,
|
||||||
__ATTR(npwm, 0444, pwm_npwm_show, NULL),
|
&dev_attr_npwm.attr,
|
||||||
__ATTR_NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
ATTRIBUTE_GROUPS(pwm_chip);
|
||||||
|
|
||||||
static struct class pwm_class = {
|
static struct class pwm_class = {
|
||||||
.name = "pwm",
|
.name = "pwm",
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.dev_attrs = pwm_chip_attrs,
|
.dev_groups = pwm_chip_groups,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int pwmchip_sysfs_match(struct device *parent, const void *data)
|
static int pwmchip_sysfs_match(struct device *parent, const void *data)
|
||||||
|
|
Loading…
Add table
Reference in a new issue