On Tuesday 27 November 2007 19:33:41 Larry Finger wrote:
> Ivo van Doorn wrote:
> > Hi,
> > 
> >>> On Monday 26 November 2007 23:15:53 Larry Finger wrote:
> >>>> Based on the code in the rtx200 directories that has a call to 
> >>>> input_allocate_device() that was not
> >>>> present in b43, I made a modification to 
> >>>> drivers/net/wireless/b43/rfkill.c as follows:
> >>>>
> >>>> Index: wireless-2.6/drivers/net/wireless/b43/rfkill.c
> >>>> ===================================================================
> >>>> --- wireless-2.6.orig/drivers/net/wireless/b43/rfkill.c
> >>>> +++ wireless-2.6/drivers/net/wireless/b43/rfkill.c
> >>>> @@ -133,6 +133,16 @@ void b43_rfkill_init(struct b43_wldev *d
> >>>>          rfk->poll_dev->poll = b43_rfkill_poll;
> >>>>          rfk->poll_dev->poll_interval = 1000; /* msecs */
> >>>>
> >>>> +        rfk->poll_dev->input = input_allocate_device();
> >>>> +        if (!rfk->poll_dev->input)
> >>>> +                goto err_free_polldev;
> >>>> +
> >>>> +        rfk->poll_dev->input->name = rfk->name;
> >>>> +        rfk->poll_dev->input->id.bustype = BUS_HOST;
> >>>> +        rfk->poll_dev->input->id.vendor = 
> >>>> dev->dev->bus->boardinfo.vendor;
> >>>> +        rfk->poll_dev->input->evbit[0] = BIT(EV_KEY);
> >>>> +        set_bit(KEY_WLAN, rfk->poll_dev->input->keybit);
> >>>> +
> >>> Ehm, you saw a few lines above that we do
> >>> input_allocate_polled_device()?
> >> I had not investigated the details of input_allocate_polled_device(). The 
> >> part that was missing in
> >> b43 is the initialization of the rfk->poll_dev->input data. I will be 
> >> posting a patch/hack that
> >> restores the LED behavior that we had before the rfkill code went in.
> > 
> > The concept of input_allocate_polled_device() was misintepretet by me as 
> > well,
> > but when allocating the polled device, you also must allocate a input 
> > device seperately
> > and make sure the poll_dev->input pointer is initialized. Otherwise the 
> > polled dev registration
> > will fail.
> 
> My testing shows that the separate input_allocate_device call is not needed - 
> only the
> initialization is required.
> > 
> >> BTW, there is a bug in rt2x00rfkill.c.
> > 
> > Where?
> 
> It is not a bug as much as redundant code.

It is a memory leak in rt2x00rfkill.c, as the structure is allocated twice.
Ivo, look at the code of input_allocate_polled_device(). It already
allocates the input dev.

> I posted a patch to clean up the code, which went to the 
> wireless mailing list and to rt2400-dev. Sorry, I forgot to include you.
> 
> Larry
> 
> 



-- 
Greetings Michael.
_______________________________________________
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev

Reply via email to