Re: [PATCH] b43: fix regression in PIO case

From: Guennadi Liakhovetski
Date: Tue Dec 27 2011 - 18:06:17 EST


On Tue, 27 Dec 2011, RafaÅ MiÅecki wrote:

> W dniu 26 grudnia 2011 18:28 uÅytkownik Guennadi Liakhovetski
> <g.liakhovetski@xxxxxx> napisaÅ:
> > This patch fixes the regression, introduced by
> >
> > commit 17030f48e31adde5b043741c91ba143f5f7db0fd
> > From: RafaÅ MiÅecki <zajec5@xxxxxxxxx>
> > Date: Thu, 11 Aug 2011 17:16:27 +0200
> > Subject: [PATCH] b43: support new RX header, noticed to be used in 598.314+ fw
> >
> > in PIO case.
> >
> > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@xxxxxx>
> > ---
> > diff --git a/drivers/net/wireless/b43/pio.c b/drivers/net/wireless/b43/pio.c
> > index ce8a4bd..b64b64c 100644
> > --- a/drivers/net/wireless/b43/pio.c
> > +++ b/drivers/net/wireless/b43/pio.c
> > @@ -617,9 +617,19 @@ static bool pio_rx_frame(struct b43_pio_rxqueue *q)
> > Â Â Â Âconst char *err_msg = NULL;
> > Â Â Â Âstruct b43_rxhdr_fw4 *rxhdr =
> > Â Â Â Â Â Â Â Â(struct b43_rxhdr_fw4 *)wl->pio_scratchspace;
> > + Â Â Â size_t rxhdr_size = sizeof(*rxhdr);
> >
> > Â Â Â ÂBUILD_BUG_ON(sizeof(wl->pio_scratchspace) < sizeof(*rxhdr));
> > - Â Â Â memset(rxhdr, 0, sizeof(*rxhdr));
> > + Â Â Â switch (dev->fw.hdr_format) {
> > + Â Â Â case B43_FW_HDR_410:
> > + Â Â Â case B43_FW_HDR_351:
> > + Â Â Â Â Â Â Â rxhdr_size -= sizeof(rxhdr->format_598) -
> > + Â Â Â Â Â Â Â Â Â Â Â sizeof(rxhdr->format_351);
> > + Â Â Â Â Â Â Â break;
> > + Â Â Â case B43_FW_HDR_598:
> > + Â Â Â Â Â Â Â break;
> > + Â Â Â }
> > + Â Â Â memset(rxhdr, 0, rxhdr_size);
>
> Huuh, that's really tricky. Can you just do "normal" conditions as
> Larry suggested, please?

Sorry? I absolutely see nothing tricky there. Do you think this would look
"less tricky" to you:

switch (dev->fw.hdr_format) {
case B43_FW_HDR_410:
case B43_FW_HDR_351:
rxhdr_size = offsetof(struct b43_rxhdr_fw4,
format_351) +
sizeof(rxhdr_size->format_351);
break;
case B43_FW_HDR_598:
rxhdr_size = sizeof(*rxhdr);
break;
}

?

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/