Commit cd5bde2c authored by Zhen Lei's avatar Zhen Lei Committed by Lee Jones
Browse files

mfd: kempld-core: Use DEVICE_ATTR_RO macro



Use DEVICE_ATTR_RO macro helper instead of plain DEVICE_ATTR, which makes
the code a bit shorter and easier to read.

Signed-off-by: default avatarZhen Lei <thunder.leizhen@huawei.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent 426d94a9
Loading
Loading
Loading
Loading
+9 −10
Original line number Diff line number Diff line
@@ -344,7 +344,7 @@ static const char *kempld_get_type_string(struct kempld_device_data *pld)
	return version_type;
}

static ssize_t kempld_version_show(struct device *dev,
static ssize_t pld_version_show(struct device *dev,
				struct device_attribute *attr, char *buf)
{
	struct kempld_device_data *pld = dev_get_drvdata(dev);
@@ -352,7 +352,7 @@ static ssize_t kempld_version_show(struct device *dev,
	return scnprintf(buf, PAGE_SIZE, "%s\n", pld->info.version);
}

static ssize_t kempld_specification_show(struct device *dev,
static ssize_t pld_specification_show(struct device *dev,
				      struct device_attribute *attr, char *buf)
{
	struct kempld_device_data *pld = dev_get_drvdata(dev);
@@ -361,7 +361,7 @@ static ssize_t kempld_specification_show(struct device *dev,
		       pld->info.spec_minor);
}

static ssize_t kempld_type_show(struct device *dev,
static ssize_t pld_type_show(struct device *dev,
			     struct device_attribute *attr, char *buf)
{
	struct kempld_device_data *pld = dev_get_drvdata(dev);
@@ -369,10 +369,9 @@ static ssize_t kempld_type_show(struct device *dev,
	return scnprintf(buf, PAGE_SIZE, "%s\n", kempld_get_type_string(pld));
}

static DEVICE_ATTR(pld_version, S_IRUGO, kempld_version_show, NULL);
static DEVICE_ATTR(pld_specification, S_IRUGO, kempld_specification_show,
		   NULL);
static DEVICE_ATTR(pld_type, S_IRUGO, kempld_type_show, NULL);
static DEVICE_ATTR_RO(pld_version);
static DEVICE_ATTR_RO(pld_specification);
static DEVICE_ATTR_RO(pld_type);

static struct attribute *pld_attributes[] = {
	&dev_attr_pld_version.attr,