aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi_butterfly.c
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2007-05-08 00:27:42 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 11:15:05 -0700
commitda6752964290567a6b4ea180d1becda75e810e87 (patch)
treefbd577a64563fe264d38c957132d468058470f3b /drivers/spi/spi_butterfly.c
parenta7d801afc3d4d1c8aaa0449f17b9f9ce62e16236 (diff)
downloadkernel_samsung_smdk4412-da6752964290567a6b4ea180d1becda75e810e87.zip
kernel_samsung_smdk4412-da6752964290567a6b4ea180d1becda75e810e87.tar.gz
kernel_samsung_smdk4412-da6752964290567a6b4ea180d1becda75e810e87.tar.bz2
layered parport code uses parport->dev
Update some of the layered parport_driver code to use parport->dev: - i2c-parport (parent of i2c_adapter) - spi_butterfly (parent of spi_master, allowing cruft removal) - lp (creating class_device) - ppdev (parent of parportN device) - tipar (creating class_device) There are still drivers that should be updated, like some of the input drivers; but they won't be any worse off than they are today. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Cc: Greg KH <greg@kroah.com> Cc: Jean Delvare <khali@linux-fr.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/spi/spi_butterfly.c')
-rw-r--r--drivers/spi/spi_butterfly.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/drivers/spi/spi_butterfly.c b/drivers/spi/spi_butterfly.c
index 312987a..574d0fa 100644
--- a/drivers/spi/spi_butterfly.c
+++ b/drivers/spi/spi_butterfly.c
@@ -20,7 +20,7 @@
#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>
@@ -237,24 +237,16 @@ static void butterfly_attach(struct parport *p)
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;
@@ -366,14 +358,12 @@ clean1:
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
@@ -386,7 +376,6 @@ static void butterfly_detach(struct parport *p)
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 */
@@ -397,8 +386,6 @@ static void butterfly_detach(struct parport *p)
parport_unregister_device(pp->pd);
(void) spi_master_put(pp->bitbang.master);
-
- platform_device_unregister(pdev);
}
static struct parport_driver butterfly_driver = {