[PATCH] libertas: fix spinlock recursion bug

Holger Schurig hs4233 at mail.mn-solutions.de
Thu Mar 27 06:08:23 EDT 2008

> struct lbs_event {

add "struct list_head list;"

> 	u32 event;  /* MACREG_INT_CODE_xxxxx */
> 	u32 len;
> 	u8 buf[LBS_UPLD_SIZE];
> };

Hmm, buf is LBS_UPLD_SIZE (2312 bytes). However, if_cs.c, 
if_sdio.c and if_usb.c use LBS_CMD_BUFFER_SIZE, which is 2048.

> void lbs_interrupt(struct lbs_private *priv, u32 event, u8
> *resp_data, u32 resp_len) {

With this approach, the driver would have copy the date from the 
hardware into local buffer. Then it would call lbs_interrupt() 
with a pointer to this local buffer. Then lbs_interrupt() would 
memcpy() this. Then something in main.c and/or cmd.c would again 
memcpy() this.

Let's split lbs_interrupt() into two functions:

struct lbs_event *lbs_get_free_event(struct lbs_private *priv);

void lbs_handle_event(struct lbs_private *priv, struct lbs_event 

Then the hardware driver can do:

  struct lbs_event *event = lbs_get_free_event(priv);
  if (!event)
  if_cs_receive_cmdres(priv, &event->buf, &event->len);
  lbs_handle_event(priv, event);

More information about the libertas-dev mailing list