+static ssize_t wb_flush_threshold_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct ufs_hba *hba = dev_get_drvdata(dev);
+
+ return sysfs_emit(buf, "%d\n", hba->vps->wb_flush_threshold);
+}
+ if (!ufshcd_is_wb_allowed(hba)) {
+ dev_warn(dev, "It is not allowed to configure WB buf flush threshold!\n");
+ return -EOPNOTSUPP;
+ }
+ if (kstrtouint(buf, 0, &wb_flush_threshold))
+ return -EINVAL;
+
+ /* The range of values for wb_flush_threshold is (0,10] */
+ if (wb_flush_threshold <= 0 || wb_flush_threshold > 10) {
+ dev_err(dev, "The value of wb_flush_threshold is invalid!\n");
+ return -EINVAL;
+ }