@@ -130,6 +130,20 @@ static ssize_t scrub_attr_show(struct device *dev,
u64 val;
struct scrub_device_attribute *hattr = to_scrub_attr(devattr);
+ ret = hattr->ops->read(dev, hattr->attr, hattr->region_id, &val);
+ if (ret < 0)
+ return ret;
+
+ return sprintf(buf, "%lld\n", val);
+}
+
+static ssize_t scrub_attr_show_hex(struct device *dev,
+ struct device_attribute *devattr, char *buf)
+{
+ int ret;
+ u64 val;
+ struct scrub_device_attribute *hattr = to_scrub_attr(devattr);
+
ret = hattr->ops->read(dev, hattr->attr, hattr->region_id, &val);
if (ret < 0)
return ret;
@@ -236,8 +250,12 @@ static struct attribute *scrub_genattr(const void *drvdata,
hattr->region_id = region_id;
dattr = &hattr->dev_attr;
- dattr->show = is_string ? scrub_attr_show_string : scrub_attr_show;
- dattr->store = is_hex ? scrub_attr_store_hex : scrub_attr_store;
+ if (is_string) {
+ dattr->show = scrub_attr_show_string;
+ } else {
+ dattr->show = is_hex ? scrub_attr_show_hex : scrub_attr_show;
+ dattr->store = is_hex ? scrub_attr_store_hex : scrub_attr_store;
+ }
a = &dattr->attr;
sysfs_attr_init(a);