On Sunday 28 October 2007, Michael Buesch wrote: > Registering the switch triggers a LED event, so we must register > LED triggers before the switch. > This has a potential to fix a crash, depending on how the device > driver initializes the rfkill data structure. > > Signed-off-by: Michael Buesch <mb@xxxxxxxxx> Signed-off-by: Ivo van Doorn <IvDoorn@xxxxxxxxx> > > Index: wireless-2.6/net/rfkill/rfkill.c > =================================================================== > --- wireless-2.6.orig/net/rfkill/rfkill.c 2007-10-27 13:28:33.000000000 +0200 > +++ wireless-2.6/net/rfkill/rfkill.c 2007-10-28 12:57:12.000000000 +0100 > @@ -388,19 +388,20 @@ int rfkill_register(struct rfkill *rfkil > if (!rfkill->toggle_radio) > return -EINVAL; > > + snprintf(dev->bus_id, sizeof(dev->bus_id), > + "rfkill%ld", (long)atomic_inc_return(&rfkill_no) - 1); > + > + rfkill_led_trigger_register(rfkill); > + > error = rfkill_add_switch(rfkill); > if (error) > return error; > > - snprintf(dev->bus_id, sizeof(dev->bus_id), > - "rfkill%ld", (long)atomic_inc_return(&rfkill_no) - 1); > - > error = device_add(dev); > if (error) { > rfkill_remove_switch(rfkill); > return error; > } > - rfkill_led_trigger_register(rfkill); > > return 0; > } > @@ -416,9 +417,9 @@ EXPORT_SYMBOL(rfkill_register); > */ > void rfkill_unregister(struct rfkill *rfkill) > { > - rfkill_led_trigger_unregister(rfkill); > device_del(&rfkill->dev); > rfkill_remove_switch(rfkill); > + rfkill_led_trigger_unregister(rfkill); > put_device(&rfkill->dev); > } > EXPORT_SYMBOL(rfkill_unregister); > - To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html