/* Shutdown of an instance of the controller device @dev SPI controller platform device  */
static int __devexit spi_m2s_remove(struct platform_device *pdev)
/* Shutdown of an instance of the controller device @dev SPI controller platform device  */
static int __devexit spi_m2s_remove(struct platform_device *pdev)
{
	struct spi_master *m  = platform_get_drvdata(pdev);
	struct m2s_spi_dsc *s = spi_master_get_devdata(m);
	struct spi_message *msg;
	unsigned long f;
	spin_lock_irqsave(&s->lock, f);
	s->stopping = 1;
	list_for_each_entry(msg, &s->queue, queue) {
		msg->status = -ESHUTDOWN;
		msg->complete(msg->context);
	}
	spin_unlock_irqrestore(&s->lock, f);
	spi_unregister_master(m);
	free_irq(s->irq, s);
	iounmap(s->spi_regs);
	iounmap(s->pdma_regs);
	spi_master_put(m);
	platform_set_drvdata(pdev, NULL);
	spi_m2s_hw_release(s);
	return 0;
}