Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4a4e1da8 authored by Alan Ott's avatar Alan Ott Committed by David S. Miller
Browse files

mrf24j40: Use threaded IRQ handler



Eliminate all the workqueue and interrupt enable/disable.

Signed-off-by: default avatarAlan Ott <alan@signal11.us>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9757f1d2
Loading
Loading
Loading
Loading
+7 −20
Original line number Original line Diff line number Diff line
@@ -82,7 +82,6 @@ struct mrf24j40 {


	struct mutex buffer_mutex; /* only used to protect buf */
	struct mutex buffer_mutex; /* only used to protect buf */
	struct completion tx_complete;
	struct completion tx_complete;
	struct work_struct irqwork;
	u8 *buf; /* 3 bytes. Used for SPI single-register transfers. */
	u8 *buf; /* 3 bytes. Used for SPI single-register transfers. */
};
};


@@ -590,17 +589,6 @@ static struct ieee802154_ops mrf24j40_ops = {
static irqreturn_t mrf24j40_isr(int irq, void *data)
static irqreturn_t mrf24j40_isr(int irq, void *data)
{
{
	struct mrf24j40 *devrec = data;
	struct mrf24j40 *devrec = data;

	disable_irq_nosync(irq);

	schedule_work(&devrec->irqwork);

	return IRQ_HANDLED;
}

static void mrf24j40_isrwork(struct work_struct *work)
{
	struct mrf24j40 *devrec = container_of(work, struct mrf24j40, irqwork);
	u8 intstat;
	u8 intstat;
	int ret;
	int ret;


@@ -618,7 +606,7 @@ static void mrf24j40_isrwork(struct work_struct *work)
		mrf24j40_handle_rx(devrec);
		mrf24j40_handle_rx(devrec);


out:
out:
	enable_irq(devrec->spi->irq);
	return IRQ_HANDLED;
}
}


static int mrf24j40_probe(struct spi_device *spi)
static int mrf24j40_probe(struct spi_device *spi)
@@ -642,7 +630,6 @@ static int mrf24j40_probe(struct spi_device *spi)


	mutex_init(&devrec->buffer_mutex);
	mutex_init(&devrec->buffer_mutex);
	init_completion(&devrec->tx_complete);
	init_completion(&devrec->tx_complete);
	INIT_WORK(&devrec->irqwork, mrf24j40_isrwork);
	devrec->spi = spi;
	devrec->spi = spi;
	spi_set_drvdata(spi, devrec);
	spi_set_drvdata(spi, devrec);


@@ -688,9 +675,10 @@ static int mrf24j40_probe(struct spi_device *spi)
	val &= ~0x3; /* Clear RX mode (normal) */
	val &= ~0x3; /* Clear RX mode (normal) */
	write_short_reg(devrec, REG_RXMCR, val);
	write_short_reg(devrec, REG_RXMCR, val);


	ret = request_irq(spi->irq,
	ret = request_threaded_irq(spi->irq,
				   NULL,
				   mrf24j40_isr,
				   mrf24j40_isr,
			  IRQF_TRIGGER_FALLING,
				   IRQF_TRIGGER_FALLING|IRQF_ONESHOT,
				   dev_name(&spi->dev),
				   dev_name(&spi->dev),
				   devrec);
				   devrec);


@@ -721,7 +709,6 @@ static int mrf24j40_remove(struct spi_device *spi)
	dev_dbg(printdev(devrec), "remove\n");
	dev_dbg(printdev(devrec), "remove\n");


	free_irq(spi->irq, devrec);
	free_irq(spi->irq, devrec);
	flush_work(&devrec->irqwork); /* TODO: Is this the right call? */
	ieee802154_unregister_device(devrec->dev);
	ieee802154_unregister_device(devrec->dev);
	ieee802154_free_device(devrec->dev);
	ieee802154_free_device(devrec->dev);
	/* TODO: Will ieee802154_free_device() wait until ->xmit() is
	/* TODO: Will ieee802154_free_device() wait until ->xmit() is