-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path0021-scsi-ufs-sysfs-Add-urgent-flush-level-entry-RW.patch
75 lines (69 loc) · 2.23 KB
/
0021-scsi-ufs-sysfs-Add-urgent-flush-level-entry-RW.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
From 89b50312c957f73a7c2f618e44897a8d07d5c078 Mon Sep 17 00:00:00 2001
From: Avri Altman <[email protected]>
Date: Sat, 6 Apr 2019 13:16:15 +0300
Subject: [PATCH 21/25] scsi: ufs-sysfs: Add urgent flush level entry (RW)
Change-Id: Ic7473a62a3a6171d40d6d8d490b02337bc9046fd
Signed-off-by: Avri Altman <[email protected]>
---
drivers/scsi/ufs/ufs-sysfs.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/drivers/scsi/ufs/ufs-sysfs.c b/drivers/scsi/ufs/ufs-sysfs.c
index dd17df0..60f339a 100644
--- a/drivers/scsi/ufs/ufs-sysfs.c
+++ b/drivers/scsi/ufs/ufs-sysfs.c
@@ -231,6 +231,40 @@ static ssize_t turbo_write_urgent_flush_ref_show(struct device *dev,
return sprintf(buf, "%d\n", atomic_read(&hba->tw_urgent_flush_ref));
}
+static ssize_t turbo_write_urgent_flush_lvl_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct ufs_hba *hba = dev_get_drvdata(dev);
+
+ if (!ufshcd_is_tw_supported(hba))
+ return -EOPNOTSUPP;
+
+ return sprintf(buf,"%d\n", hba->tw_urgent_flush_lvl);
+}
+
+static ssize_t
+turbo_write_urgent_flush_lvl_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct ufs_hba *hba = dev_get_drvdata(dev);
+ unsigned int lvl;
+
+ if (!ufshcd_is_tw_supported(hba))
+ return -EOPNOTSUPP;
+
+ if (kstrtouint(buf, 0, &lvl))
+ return -EINVAL;
+
+ if (lvl > UFS_TW_BUFFER_LVL_MAX)
+ return -EINVAL;
+
+ hba->tw_urgent_flush_lvl = lvl;
+
+ return count;
+}
+
static DEVICE_ATTR_RW(rpm_lvl);
static DEVICE_ATTR_RO(rpm_target_dev_state);
static DEVICE_ATTR_RO(rpm_target_link_state);
@@ -241,6 +275,7 @@ static DEVICE_ATTR_RW(turbo_write_do_enable);
static DEVICE_ATTR_RW(turbo_write_do_flush);
static DEVICE_ATTR_RW(turbo_write_do_hibern8_flush);
static DEVICE_ATTR_RO(turbo_write_urgent_flush_ref);
+static DEVICE_ATTR_RW(turbo_write_urgent_flush_lvl);
static struct attribute *ufs_sysfs_ufshcd_attrs[] = {
&dev_attr_rpm_lvl.attr,
@@ -253,6 +288,7 @@ static struct attribute *ufs_sysfs_ufshcd_attrs[] = {
&dev_attr_turbo_write_do_flush.attr,
&dev_attr_turbo_write_do_hibern8_flush.attr,
&dev_attr_turbo_write_urgent_flush_ref.attr,
+ &dev_attr_turbo_write_urgent_flush_lvl.attr,
NULL
};
--
2.7.4