aboutsummaryrefslogtreecommitdiffstats
path: root/net/rfkill/rfkill.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/rfkill/rfkill.c')
-rw-r--r--net/rfkill/rfkill.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
index 3c7773475ea6..dd1c3f18f31d 100644
--- a/net/rfkill/rfkill.c
+++ b/net/rfkill/rfkill.c
@@ -386,12 +386,51 @@ static int rfkill_resume(struct device *dev)
386#define rfkill_resume NULL 386#define rfkill_resume NULL
387#endif 387#endif
388 388
389static int rfkill_blocking_uevent_notifier(struct notifier_block *nb,
390 unsigned long eventid,
391 void *data)
392{
393 struct rfkill *rfkill = (struct rfkill *)data;
394
395 switch (eventid) {
396 case RFKILL_STATE_CHANGED:
397 kobject_uevent(&rfkill->dev.kobj, KOBJ_CHANGE);
398 break;
399 default:
400 break;
401 }
402
403 return NOTIFY_DONE;
404}
405
406static struct notifier_block rfkill_blocking_uevent_nb = {
407 .notifier_call = rfkill_blocking_uevent_notifier,
408 .priority = 0,
409};
410
411static int rfkill_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
412{
413 struct rfkill *rfkill = to_rfkill(dev);
414 int error;
415
416 error = add_uevent_var(env, "RFKILL_NAME=%s", rfkill->name);
417 if (error)
418 return error;
419 error = add_uevent_var(env, "RFKILL_TYPE=%s",
420 rfkill_get_type_str(rfkill->type));
421 if (error)
422 return error;
423 error = add_uevent_var(env, "RFKILL_STATE=%d", rfkill->state);
424 return error;
425}
426
389static struct class rfkill_class = { 427static struct class rfkill_class = {
390 .name = "rfkill", 428 .name = "rfkill",
391 .dev_release = rfkill_release, 429 .dev_release = rfkill_release,
392 .dev_attrs = rfkill_dev_attrs, 430 .dev_attrs = rfkill_dev_attrs,
393 .suspend = rfkill_suspend, 431 .suspend = rfkill_suspend,
394 .resume = rfkill_resume, 432 .resume = rfkill_resume,
433 .dev_uevent = rfkill_dev_uevent,
395}; 434};
396 435
397static int rfkill_add_switch(struct rfkill *rfkill) 436static int rfkill_add_switch(struct rfkill *rfkill)
@@ -566,11 +605,14 @@ static int __init rfkill_init(void)
566 return error; 605 return error;
567 } 606 }
568 607
608 register_rfkill_notifier(&rfkill_blocking_uevent_nb);
609
569 return 0; 610 return 0;
570} 611}
571 612
572static void __exit rfkill_exit(void) 613static void __exit rfkill_exit(void)
573{ 614{
615 unregister_rfkill_notifier(&rfkill_blocking_uevent_nb);
574 class_unregister(&rfkill_class); 616 class_unregister(&rfkill_class);
575} 617}
576 618