summaryrefslogtreecommitdiff
path: root/drivers/thunderbolt
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2021-08-06 15:28:54 +0100
committerMark Brown <broonie@kernel.org>2021-08-06 15:28:54 +0100
commit564ed89f69aaea286c41ed36da709e128c222021 (patch)
tree2edf6dc0822eab6ba74ac1c2c27e51b6c5dec8aa /drivers/thunderbolt
parent9d87ed06cdd2ea9582fa9ce713673502569ba2b2 (diff)
parent1651d9e7810e79500b4940122e192b8aaeb2d63c (diff)
downloadlinux-next-564ed89f69aaea286c41ed36da709e128c222021.tar.gz
Merge remote-tracking branch 'thunderbolt/next'
Diffstat (limited to 'drivers/thunderbolt')
-rw-r--r--drivers/thunderbolt/switch.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
index 10d6b228cc94..79d3b0c48bc3 100644
--- a/drivers/thunderbolt/switch.c
+++ b/drivers/thunderbolt/switch.c
@@ -1498,6 +1498,7 @@ static ssize_t authorized_show(struct device *dev,
static int disapprove_switch(struct device *dev, void *not_used)
{
+ char *envp[] = { "AUTHORIZED=0", NULL };
struct tb_switch *sw;
sw = tb_to_switch(dev);
@@ -1514,7 +1515,7 @@ static int disapprove_switch(struct device *dev, void *not_used)
return ret;
sw->authorized = 0;
- kobject_uevent(&sw->dev.kobj, KOBJ_CHANGE);
+ kobject_uevent_env(&sw->dev.kobj, KOBJ_CHANGE, envp);
}
return 0;
@@ -1522,7 +1523,9 @@ static int disapprove_switch(struct device *dev, void *not_used)
static int tb_switch_set_authorized(struct tb_switch *sw, unsigned int val)
{
+ char envp_string[13];
int ret = -EINVAL;
+ char *envp[] = { envp_string, NULL };
if (!mutex_trylock(&sw->tb->lock))
return restart_syscall();
@@ -1559,8 +1562,12 @@ static int tb_switch_set_authorized(struct tb_switch *sw, unsigned int val)
if (!ret) {
sw->authorized = val;
- /* Notify status change to the userspace */
- kobject_uevent(&sw->dev.kobj, KOBJ_CHANGE);
+ /*
+ * Notify status change to the userspace, informing the new
+ * value of /sys/bus/thunderbolt/devices/.../authorized.
+ */
+ sprintf(envp_string, "AUTHORIZED=%u", sw->authorized);
+ kobject_uevent_env(&sw->dev.kobj, KOBJ_CHANGE, envp);
}
unlock: