Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 103146
b: refs/heads/master
c: ffb67c3
h: refs/heads/master
v: v3
  • Loading branch information
Henrique de Moraes Holschuh authored and John W. Linville committed Jun 26, 2008
1 parent 87206d5 commit f7e506f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 99c632e5a304e1f76350eb9e8b2493514de8b60c
refs/heads/master: ffb67c34e436fb163c4067936ccec797354fa6c6
42 changes: 42 additions & 0 deletions trunk/net/rfkill/rfkill.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,12 +386,51 @@ static int rfkill_resume(struct device *dev)
#define rfkill_resume NULL
#endif

static int rfkill_blocking_uevent_notifier(struct notifier_block *nb,
unsigned long eventid,
void *data)
{
struct rfkill *rfkill = (struct rfkill *)data;

switch (eventid) {
case RFKILL_STATE_CHANGED:
kobject_uevent(&rfkill->dev.kobj, KOBJ_CHANGE);
break;
default:
break;
}

return NOTIFY_DONE;
}

static struct notifier_block rfkill_blocking_uevent_nb = {
.notifier_call = rfkill_blocking_uevent_notifier,
.priority = 0,
};

static int rfkill_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
{
struct rfkill *rfkill = to_rfkill(dev);
int error;

error = add_uevent_var(env, "RFKILL_NAME=%s", rfkill->name);
if (error)
return error;
error = add_uevent_var(env, "RFKILL_TYPE=%s",
rfkill_get_type_str(rfkill->type));
if (error)
return error;
error = add_uevent_var(env, "RFKILL_STATE=%d", rfkill->state);
return error;
}

static struct class rfkill_class = {
.name = "rfkill",
.dev_release = rfkill_release,
.dev_attrs = rfkill_dev_attrs,
.suspend = rfkill_suspend,
.resume = rfkill_resume,
.dev_uevent = rfkill_dev_uevent,
};

static int rfkill_add_switch(struct rfkill *rfkill)
Expand Down Expand Up @@ -566,11 +605,14 @@ static int __init rfkill_init(void)
return error;
}

register_rfkill_notifier(&rfkill_blocking_uevent_nb);

return 0;
}

static void __exit rfkill_exit(void)
{
unregister_rfkill_notifier(&rfkill_blocking_uevent_nb);
class_unregister(&rfkill_class);
}

Expand Down

0 comments on commit f7e506f

Please sign in to comment.