iommu/amd: use DEVICE_ATTR_RO macro
Subsystems (2)
PATCH 1/1 iommu/amd: use DEVICE_ATTR_RO macro
Use DEVICE_ATTR_RO() helper instead of plain DEVICE_ATTR(), which makes the code a bit shorter and easier to read.
Signed-off-by YueHaibing <[email protected]>
--- drivers/iommu/amd/init.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/iommu/amd/init.c +6 -8
@@ -1731,23 +1731,21 @@ static void init_iommu_perf_ctr(struct amd_iommu *iommu)return ; } -static ssize_t amd_iommu_show_cap (struct device *dev, -struct device_attribute *attr, -char *buf) +static ssize_t cap_show (struct device *dev, +struct device_attribute *attr,char *buf) {struct amd_iommu *iommu =dev_to_amd_iommu (dev);return sprintf (buf,"%x\n" , iommu->cap); } -static DEVICE_ATTR(cap, S_IRUGO, amd_iommu_show_cap, NULL); +static DEVICE_ATTR_RO (cap); -static ssize_t amd_iommu_show_features (struct device *dev, -struct device_attribute *attr, -char *buf) +static ssize_t features_show (struct device *dev, +struct device_attribute *attr,char *buf) {struct amd_iommu *iommu =dev_to_amd_iommu (dev);return sprintf (buf,"%llx\n" , iommu->features); } -static DEVICE_ATTR(features, S_IRUGO, amd_iommu_show_features, NULL); +static DEVICE_ATTR_RO (features);static struct attribute *amd_iommu_attrs[] = { &dev_attr_cap.attr,
Signature · 1 line
2.17.1