tile: srom: convert srom_class to use dev_groups
The dev_attrs field of struct class is going away soon, dev_groups should be used instead. This converts the tile srom_class code to use the correct field. Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Родитель
62e13505b4
Коммит
e017a84b93
|
@ -279,33 +279,37 @@ loff_t srom_llseek(struct file *file, loff_t offset, int origin)
|
||||||
return fixed_size_llseek(file, offset, origin, srom->total_size);
|
return fixed_size_llseek(file, offset, origin, srom->total_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t total_show(struct device *dev,
|
static ssize_t total_size_show(struct device *dev,
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct srom_dev *srom = dev_get_drvdata(dev);
|
struct srom_dev *srom = dev_get_drvdata(dev);
|
||||||
return sprintf(buf, "%u\n", srom->total_size);
|
return sprintf(buf, "%u\n", srom->total_size);
|
||||||
}
|
}
|
||||||
|
static DEVICE_ATTR_RO(total_size);
|
||||||
|
|
||||||
static ssize_t sector_show(struct device *dev,
|
static ssize_t sector_size_show(struct device *dev,
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct srom_dev *srom = dev_get_drvdata(dev);
|
struct srom_dev *srom = dev_get_drvdata(dev);
|
||||||
return sprintf(buf, "%u\n", srom->sector_size);
|
return sprintf(buf, "%u\n", srom->sector_size);
|
||||||
}
|
}
|
||||||
|
static DEVICE_ATTR_RO(sector_size);
|
||||||
|
|
||||||
static ssize_t page_show(struct device *dev,
|
static ssize_t page_size_show(struct device *dev,
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct srom_dev *srom = dev_get_drvdata(dev);
|
struct srom_dev *srom = dev_get_drvdata(dev);
|
||||||
return sprintf(buf, "%u\n", srom->page_size);
|
return sprintf(buf, "%u\n", srom->page_size);
|
||||||
}
|
}
|
||||||
|
static DEVICE_ATTR_RO(page_size);
|
||||||
|
|
||||||
static struct device_attribute srom_dev_attrs[] = {
|
static struct attribute srom_dev_attrs[] = {
|
||||||
__ATTR(total_size, S_IRUGO, total_show, NULL),
|
&dev_attr_total_size.attr,
|
||||||
__ATTR(sector_size, S_IRUGO, sector_show, NULL),
|
&dev_attr_sector_size.attr,
|
||||||
__ATTR(page_size, S_IRUGO, page_show, NULL),
|
&dev_attr_page_size.attr,
|
||||||
__ATTR_NULL
|
NULL,
|
||||||
};
|
};
|
||||||
|
ATTRIBUTE_GROUPS(srom_dev);
|
||||||
|
|
||||||
static char *srom_devnode(struct device *dev, umode_t *mode)
|
static char *srom_devnode(struct device *dev, umode_t *mode)
|
||||||
{
|
{
|
||||||
|
@ -418,7 +422,7 @@ static int srom_init(void)
|
||||||
result = PTR_ERR(srom_class);
|
result = PTR_ERR(srom_class);
|
||||||
goto fail_cdev;
|
goto fail_cdev;
|
||||||
}
|
}
|
||||||
srom_class->dev_attrs = srom_dev_attrs;
|
srom_class->dev_groups = srom_dev_groups;
|
||||||
srom_class->devnode = srom_devnode;
|
srom_class->devnode = srom_devnode;
|
||||||
|
|
||||||
/* Do per-partition initialization */
|
/* Do per-partition initialization */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче