#include <linux/delay.h>
#include <linux/mm.h>
#include <linux/highmem.h>
+#include <linux/interrupt.h>
#include <linux/crypto.h>
#include <crypto/algapi.h>
u8 snum;
+ struct tasklet_struct tasklet;
+
struct crypto_queue queue;
struct list_head alg_list;
};
hifn_write_1(dev, HIFN_1_DMA_IER, dev->dmareg);
}
- hifn_check_for_completion(dev, 0);
+ tasklet_schedule(&dev->tasklet);
hifn_clear_rings(dev);
return IRQ_HANDLED;
return err;
}
+static void hifn_tasklet_callback(unsigned long data)
+{
+ struct hifn_device *dev = (struct hifn_device *)data;
+
+ /*
+ * This is ok to call this without lock being held,
+ * althogh it modifies some parameters used in parallel,
+ * (like dev->success), but they are used in process
+ * context or update is atomic (like setting dev->sa[i] to NULL).
+ */
+ hifn_check_for_completion(dev, 0);
+}
+
static int hifn_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{
int err, i;
pci_set_drvdata(pdev, dev);
+ tasklet_init(&dev->tasklet, hifn_tasklet_callback, (unsigned long)dev);
+
crypto_init_queue(&dev->queue, 1);
err = request_irq(dev->irq, hifn_interrupt, IRQF_SHARED, dev->name, dev);
hifn_stop_device(dev);
err_out_free_irq:
free_irq(dev->irq, dev->name);
+ tasklet_kill(&dev->tasklet);
err_out_free_desc:
pci_free_consistent(pdev, sizeof(struct hifn_dma),
dev->desc_virt, dev->desc_dma);
hifn_stop_device(dev);
free_irq(dev->irq, dev->name);
+ tasklet_kill(&dev->tasklet);
hifn_flush(dev);