@@ -92,12 +92,14 @@ static struct sk_buff *alloc_lc_skb(struct nfcmrvl_private *priv, uint8_t plen)
static void fw_dnld_over(struct nfcmrvl_private *priv, u32 error)
{
+ spin_lock_irq(&priv->fw_dnld.lock);
if (priv->fw_dnld.fw) {
release_firmware(priv->fw_dnld.fw);
priv->fw_dnld.fw = NULL;
priv->fw_dnld.header = NULL;
priv->fw_dnld.binary_config = NULL;
}
+ spin_unlock_irq(&priv->fw_dnld.lock);
atomic_set(&priv->ndev->cmd_cnt, 0);
@@ -451,6 +453,7 @@ int nfcmrvl_fw_dnld_init(struct nfcmrvl_private *priv)
if (!priv->fw_dnld.rx_wq)
return -ENOMEM;
skb_queue_head_init(&priv->fw_dnld.rx_q);
+ spin_lock_init(&priv->fw_dnld.lock);
return 0;
}
@@ -75,6 +75,8 @@ struct nfcmrvl_fw_dnld {
struct sk_buff_head rx_q;
struct timer_list timer;
+ /* To synchronize among different threads that call fw_dnld_over.*/
+ spinlock_t lock;
};
int nfcmrvl_fw_dnld_init(struct nfcmrvl_private *priv);