summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Borzeszkowski <alan.borzeszkowski@linux.intel.com>2025-01-21 20:46:20 +0300
committerMika Westerberg <mika.westerberg@linux.intel.com>2025-04-24 08:24:38 +0300
commitcdf9956b6974206e1fd20e9bd30842df9714c5b8 (patch)
treeb7a91a585f4f0bce5516db9741e7752e54970e81
parent4fd7a1f0f7f281dcbdf2e42a2e30b6d2159deaf4 (diff)
downloadlinux-cdf9956b6974206e1fd20e9bd30842df9714c5b8.tar.xz
thunderbolt: Introduce domain event message handler
This patch introduces a function that can be used to send uevent notifications in the domain to userspace. For instance, it can indicate that a DisplayPort tunnel could not be established due to insufficient bandwidth. Userspace can then forward to user via dialog or similar. Convert boot_acl_store() to call this instead of open-coding. Signed-off-by: Alan Borzeszkowski <alan.borzeszkowski@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
-rw-r--r--drivers/thunderbolt/domain.c2
-rw-r--r--drivers/thunderbolt/tb.h13
2 files changed, 14 insertions, 1 deletions
diff --git a/drivers/thunderbolt/domain.c b/drivers/thunderbolt/domain.c
index 144d0232a70c..a3a7c8059eee 100644
--- a/drivers/thunderbolt/domain.c
+++ b/drivers/thunderbolt/domain.c
@@ -217,7 +217,7 @@ static ssize_t boot_acl_store(struct device *dev, struct device_attribute *attr,
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);
+ tb_domain_event(tb, NULL);
}
mutex_unlock(&tb->lock);
diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h
index 4e2faa0d5dba..87afd5a7c504 100644
--- a/drivers/thunderbolt/tb.h
+++ b/drivers/thunderbolt/tb.h
@@ -804,6 +804,19 @@ static inline void tb_domain_put(struct tb *tb)
put_device(&tb->dev);
}
+/**
+ * tb_domain_event() - Notify userspace about an event in domain
+ * @tb: Domain where event occurred
+ * @envp: Array of uevent environment strings (can be %NULL)
+ *
+ * This function provides a way to notify userspace about any events
+ * that take place in the domain.
+ */
+static inline void tb_domain_event(struct tb *tb, char *envp[])
+{
+ kobject_uevent_env(&tb->dev.kobj, KOBJ_CHANGE, envp);
+}
+
struct tb_nvm *tb_nvm_alloc(struct device *dev);
int tb_nvm_read_version(struct tb_nvm *nvm);
int tb_nvm_validate(struct tb_nvm *nvm);