mfd: janz-cmodio: 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: Zhen Lei <thunder.leizhen@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
This commit is contained in:
@@ -149,15 +149,15 @@ static int cmodio_probe_submodules(struct cmodio_device *priv)
|
|||||||
* SYSFS Attributes
|
* SYSFS Attributes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static ssize_t mbus_show(struct device *dev, struct device_attribute *attr,
|
static ssize_t modulbus_number_show(struct device *dev,
|
||||||
char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct cmodio_device *priv = dev_get_drvdata(dev);
|
struct cmodio_device *priv = dev_get_drvdata(dev);
|
||||||
|
|
||||||
return snprintf(buf, PAGE_SIZE, "%x\n", priv->hex);
|
return snprintf(buf, PAGE_SIZE, "%x\n", priv->hex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DEVICE_ATTR(modulbus_number, S_IRUGO, mbus_show, NULL);
|
static DEVICE_ATTR_RO(modulbus_number);
|
||||||
|
|
||||||
static struct attribute *cmodio_sysfs_attrs[] = {
|
static struct attribute *cmodio_sysfs_attrs[] = {
|
||||||
&dev_attr_modulbus_number.attr,
|
&dev_attr_modulbus_number.attr,
|
||||||
|
|||||||
Reference in New Issue
Block a user