if (reset)
                lp_reset(nr);
 
-       class_device_create(lp_class, NULL, MKDEV(LP_MAJOR, nr), NULL,
+       class_device_create(lp_class, NULL, MKDEV(LP_MAJOR, nr), port->dev,
                                "lp%d", nr);
 
        printk(KERN_INFO "lp%d: using %s (%s).\n", nr, port->name, 
 
 
 static void pp_attach(struct parport *port)
 {
-       device_create(ppdev_class, NULL, MKDEV(PP_MAJOR, port->number),
+       device_create(ppdev_class, port->dev, MKDEV(PP_MAJOR, port->number),
                        "parport%d", port->number);
 }
 
 
        }
 
        class_device_create(tipar_class, NULL, MKDEV(TIPAR_MAJOR,
-                       TIPAR_MINOR + nr), NULL, "par%d", nr);
+                       TIPAR_MINOR + nr), port->dev, "par%d", nr);
 
        /* Display informations */
        pr_info("tipar%d: using %s (%s)\n", nr, port->name, (port->irq ==
 
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/delay.h>
-#include <linux/platform_device.h>
+#include <linux/device.h>
 #include <linux/parport.h>
 
 #include <linux/sched.h>
        int                     status;
        struct butterfly        *pp;
        struct spi_master       *master;
-       struct platform_device  *pdev;
+       struct device           *dev = p->physport->dev;
 
-       if (butterfly)
+       if (butterfly || !dev)
                return;
 
        /* REVISIT:  this just _assumes_ a butterfly is there ... no probe,
         * and no way to be selective about what it binds to.
         */
 
-       /* FIXME where should master->cdev.dev 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);
+       master = spi_alloc_master(dev, sizeof *pp);
        if (!master) {
                status = -ENOMEM;
                goto done;
 clean0:
        (void) spi_master_put(pp->bitbang.master);
 done:
-       platform_device_unregister(pdev);
        pr_debug("%s: butterfly probe, fail %d\n", p->name, status);
 }
 
 static void butterfly_detach(struct parport *p)
 {
        struct butterfly        *pp;
-       struct platform_device  *pdev;
        int                     status;
 
        /* FIXME this global is ugly ... but, how to quickly get from
        butterfly = NULL;
 
        /* stop() unregisters child devices too */
-       pdev = to_platform_device(pp->bitbang.master->cdev.dev);
        status = spi_bitbang_stop(&pp->bitbang);
 
        /* turn off VCC */
        parport_unregister_device(pp->pd);
 
        (void) spi_master_put(pp->bitbang.master);
-
-       platform_device_unregister(pdev);
 }
 
 static struct parport_driver butterfly_driver = {