spi: spi_s3c24xx must initialize bus_num
[sfrench/cifs-2.6.git] / drivers / spi / spi_s3c24xx.c
index 6e834b8b9d2785f51427cd11d3a051e9e9471b03..80719ef5436500dd0acd00e7a280c6ee1dcbc7c8 100644 (file)
@@ -192,8 +192,11 @@ static int s3c24xx_spi_txrx(struct spi_device *spi, struct spi_transfer *t)
        hw->len = t->len;
        hw->count = 0;
 
+       init_completion(&hw->done);
+
        /* send the first byte */
        writeb(hw_txbyte(hw, 0), hw->regs + S3C2410_SPTDAT);
+
        wait_for_completion(&hw->done);
 
        return hw->count;
@@ -235,6 +238,7 @@ static irqreturn_t s3c24xx_spi_irq(int irq, void *dev)
 
 static int __init s3c24xx_spi_probe(struct platform_device *pdev)
 {
+       struct s3c2410_spi_info *pdata;
        struct s3c24xx_spi *hw;
        struct spi_master *master;
        struct resource *res;
@@ -251,10 +255,10 @@ static int __init s3c24xx_spi_probe(struct platform_device *pdev)
        memset(hw, 0, sizeof(struct s3c24xx_spi));
 
        hw->master = spi_master_get(master);
-       hw->pdata = pdev->dev.platform_data;
+       hw->pdata = pdata = pdev->dev.platform_data;
        hw->dev = &pdev->dev;
 
-       if (hw->pdata == NULL) {
+       if (pdata == NULL) {
                dev_err(&pdev->dev, "No platform data supplied\n");
                err = -ENOENT;
                goto err_no_pdata;
@@ -330,13 +334,13 @@ static int __init s3c24xx_spi_probe(struct platform_device *pdev)
 
        /* setup any gpio we can */
 
-       if (!hw->pdata->set_cs) {
+       if (!pdata->set_cs) {
                hw->set_cs = s3c24xx_spi_gpiocs;
 
-               s3c2410_gpio_setpin(hw->pdata->pin_cs, 1);
-               s3c2410_gpio_cfgpin(hw->pdata->pin_cs, S3C2410_GPIO_OUTPUT);
+               s3c2410_gpio_setpin(pdata->pin_cs, 1);
+               s3c2410_gpio_cfgpin(pdata->pin_cs, S3C2410_GPIO_OUTPUT);
        } else
-               hw->set_cs = hw->pdata->set_cs;
+               hw->set_cs = pdata->set_cs;
 
        /* register our spi controller */
 
@@ -415,7 +419,7 @@ static int s3c24xx_spi_resume(struct platform_device *pdev)
 #define s3c24xx_spi_resume  NULL
 #endif
 
-MODULE_ALIAS("s3c2410_spi");                   /* for platform bus hotplug */
+MODULE_ALIAS("platform:s3c2410-spi");
 static struct platform_driver s3c24xx_spidrv = {
        .remove         = __exit_p(s3c24xx_spi_remove),
        .suspend        = s3c24xx_spi_suspend,