Skip to contentSkip to conversation

thunderbolt: Notify userspace when boot_acl is changed

PATCH Applied Mika Westerberg 2 participants 3 messages Jun 18, 2018 – Jun 20, 2018 Thunderbolt driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thunderbolt: Notify userspace when boot_acl is changed

The commit 9aaa3b8b4c56 ("thunderbolt: Add support for preboot ACL") introduced boot_acl attribute but missed the fact that now userspace needs to poll the attribute constantly to find out whether it has changed or not. Fix this by sending notification to the userspace whenever the boot_acl attribute is changed.

Fixes 9aaa3b8b4c56 ("thunderbolt: Add support for preboot ACL")
---
 drivers/thunderbolt/domain.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/thunderbolt/domain.c +4 -0
index 6281266b8ec0..a923ebdeb73c 100644
@@ -213,6 +213,10 @@ static ssize_t boot_acl_store(struct device *dev, struct device_attribute *attr,
 		goto err_free_acl;
 	}
 	ret = tb->cm_ops->set_boot_acl(tb, acl, tb->nboot_acl);
+	if (!ret) {
+		/* Notify userspace about the change */
+		kobject_uevent(&tb->dev.kobj, KOBJ_CHANGE);
+	}
 	mutex_unlock(&tb->lock);
 
 err_free_acl:
Signature · 1 line
2.17.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 30 lines · Mika Westerberg

The commit 9aaa3b8b4c56 ("thunderbolt: Add support for preboot ACL") introduced boot_acl attribute but missed the fact that now userspace needs to poll the attribute constantly to find out whether it has changed or not. Fix this by sending notification to the userspace whenever the boot_acl attribute is changed.

Fixes 9aaa3b8b4c56 ("thunderbolt: Add support for preboot ACL")
---
 drivers/thunderbolt/domain.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/thunderbolt/domain.c +4 -1
index 6281266b8ec0..a923ebdeb73c 100644
@@ -213,6 +213,10 @@ static ssize_t boot_acl_store(struct device *dev, struct device_attribute *attr,
                goto err_free_acl;
        }
        ret = tb->cm_ops->set_boot_acl(tb, acl, tb->nboot_acl);
+       if (!ret) {
+               /* Notify userspace about the change */
+               kobject_uevent(&tb->dev.kobj, KOBJ_CHANGE);
+       }
        mutex_unlock(&tb->lock);
 
 err_free_acl:
--
Quoted 2 lines

2.17.1

author Applied
#2 lore raw
In reply to Mika Westerberg
Quoted 9 lines · Mika Westerberg

The commit 9aaa3b8b4c56 ("thunderbolt: Add support for preboot ACL") introduced boot_acl attribute but missed the fact that now userspace needs to poll the attribute constantly to find out whether it has changed or not. Fix this by sending notification to the userspace whenever the boot_acl attribute is changed.

Fixes 9aaa3b8b4c56 ("thunderbolt: Add support for preboot ACL")

Applied to thunderbolt.git/fixes.