]> err.no Git - linux-2.6/blobdiff - drivers/spi/spi_butterfly.c
Driver core: convert SPI code to use struct device
[linux-2.6] / drivers / spi / spi_butterfly.c
index ff9e5faa4dc9f369ec30e829279646547f1fba73..31b7970ae463d4117580567d6b718991c0e02644 100644 (file)
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/platform_device.h>
 #include <linux/parport.h>
 
+#include <linux/sched.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/spi_bitbang.h>
 #include <linux/spi/flash.h>
@@ -246,11 +246,13 @@ static void butterfly_attach(struct parport *p)
         * and no way to be selective about what it binds to.
         */
 
-       /* FIXME where should master->cdev.dev come from?
+       /* FIXME where should master->dev.parent come from?
         * e.g. /sys/bus/pnp0/00:0b, some PCI thing, etc
         * setting up a platform device like this is an ugly kluge...
         */
        pdev = platform_device_register_simple("butterfly", -1, NULL, 0);
+       if (IS_ERR(pdev))
+               return;
 
        master = spi_alloc_master(&pdev->dev, sizeof *pp);
        if (!master) {
@@ -321,6 +323,7 @@ static void butterfly_attach(struct parport *p)
         * (firmware resets at45, acts as spi slave) or neither (we ignore
         * both, AVR uses AT45).  Here we expect firmware for the first option.
         */
+
        pp->info[0].max_speed_hz = 15 * 1000 * 1000;
        strcpy(pp->info[0].modalias, "mtd_dataflash");
        pp->info[0].platform_data = &flash;
@@ -383,7 +386,7 @@ static void butterfly_detach(struct parport *p)
        butterfly = NULL;
 
        /* stop() unregisters child devices too */
-       pdev = to_platform_device(pp->bitbang.master->cdev.dev);
+       pdev = to_platform_device(pp->bitbang.master->dev.parent);
        status = spi_bitbang_stop(&pp->bitbang);
 
        /* turn off VCC */