diff options
author | David Brownell <david-b@pacbell.net> | 2007-05-08 03:27:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 14:15:05 -0400 |
commit | da6752964290567a6b4ea180d1becda75e810e87 (patch) | |
tree | fbd577a64563fe264d38c957132d468058470f3b /drivers | |
parent | a7d801afc3d4d1c8aaa0449f17b9f9ce62e16236 (diff) |
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')
-rw-r--r-- | drivers/char/lp.c | 2 | ||||
-rw-r--r-- | drivers/char/ppdev.c | 2 | ||||
-rw-r--r-- | drivers/char/tipar.c | 2 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-parport.c | 1 | ||||
-rw-r--r-- | drivers/spi/spi_butterfly.c | 21 |
5 files changed, 8 insertions, 20 deletions
diff --git a/drivers/char/lp.c b/drivers/char/lp.c index b51d08be0bcf..2f04fed69f19 100644 --- a/drivers/char/lp.c +++ b/drivers/char/lp.c | |||
@@ -803,7 +803,7 @@ static int lp_register(int nr, struct parport *port) | |||
803 | if (reset) | 803 | if (reset) |
804 | lp_reset(nr); | 804 | lp_reset(nr); |
805 | 805 | ||
806 | class_device_create(lp_class, NULL, MKDEV(LP_MAJOR, nr), NULL, | 806 | class_device_create(lp_class, NULL, MKDEV(LP_MAJOR, nr), port->dev, |
807 | "lp%d", nr); | 807 | "lp%d", nr); |
808 | 808 | ||
809 | printk(KERN_INFO "lp%d: using %s (%s).\n", nr, port->name, | 809 | printk(KERN_INFO "lp%d: using %s (%s).\n", nr, port->name, |
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c index 4abd1eff61d6..804c5c2e2409 100644 --- a/drivers/char/ppdev.c +++ b/drivers/char/ppdev.c | |||
@@ -752,7 +752,7 @@ static const struct file_operations pp_fops = { | |||
752 | 752 | ||
753 | static void pp_attach(struct parport *port) | 753 | static void pp_attach(struct parport *port) |
754 | { | 754 | { |
755 | device_create(ppdev_class, NULL, MKDEV(PP_MAJOR, port->number), | 755 | device_create(ppdev_class, port->dev, MKDEV(PP_MAJOR, port->number), |
756 | "parport%d", port->number); | 756 | "parport%d", port->number); |
757 | } | 757 | } |
758 | 758 | ||
diff --git a/drivers/char/tipar.c b/drivers/char/tipar.c index 47fb20f69695..35b40b996534 100644 --- a/drivers/char/tipar.c +++ b/drivers/char/tipar.c | |||
@@ -442,7 +442,7 @@ tipar_register(int nr, struct parport *port) | |||
442 | } | 442 | } |
443 | 443 | ||
444 | class_device_create(tipar_class, NULL, MKDEV(TIPAR_MAJOR, | 444 | class_device_create(tipar_class, NULL, MKDEV(TIPAR_MAJOR, |
445 | TIPAR_MINOR + nr), NULL, "par%d", nr); | 445 | TIPAR_MINOR + nr), port->dev, "par%d", nr); |
446 | 446 | ||
447 | /* Display informations */ | 447 | /* Display informations */ |
448 | pr_info("tipar%d: using %s (%s)\n", nr, port->name, (port->irq == | 448 | pr_info("tipar%d: using %s (%s)\n", nr, port->name, (port->irq == |
diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c index 8c953707253f..039a07fde908 100644 --- a/drivers/i2c/busses/i2c-parport.c +++ b/drivers/i2c/busses/i2c-parport.c | |||
@@ -175,6 +175,7 @@ static void i2c_parport_attach (struct parport *port) | |||
175 | } | 175 | } |
176 | adapter->algo_data.data = port; | 176 | adapter->algo_data.data = port; |
177 | adapter->adapter.algo_data = &adapter->algo_data; | 177 | adapter->adapter.algo_data = &adapter->algo_data; |
178 | adapter->adapter.dev.parent = port->physport->dev; | ||
178 | 179 | ||
179 | if (parport_claim_or_block(adapter->pdev) < 0) { | 180 | if (parport_claim_or_block(adapter->pdev) < 0) { |
180 | printk(KERN_ERR "i2c-parport: Could not claim parallel port\n"); | 181 | printk(KERN_ERR "i2c-parport: Could not claim parallel port\n"); |
diff --git a/drivers/spi/spi_butterfly.c b/drivers/spi/spi_butterfly.c index 312987a03210..574d0fae4c59 100644 --- a/drivers/spi/spi_butterfly.c +++ b/drivers/spi/spi_butterfly.c | |||
@@ -20,7 +20,7 @@ | |||
20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
23 | #include <linux/platform_device.h> | 23 | #include <linux/device.h> |
24 | #include <linux/parport.h> | 24 | #include <linux/parport.h> |
25 | 25 | ||
26 | #include <linux/sched.h> | 26 | #include <linux/sched.h> |
@@ -237,24 +237,16 @@ static void butterfly_attach(struct parport *p) | |||
237 | int status; | 237 | int status; |
238 | struct butterfly *pp; | 238 | struct butterfly *pp; |
239 | struct spi_master *master; | 239 | struct spi_master *master; |
240 | struct platform_device *pdev; | 240 | struct device *dev = p->physport->dev; |
241 | 241 | ||
242 | if (butterfly) | 242 | if (butterfly || !dev) |
243 | return; | 243 | return; |
244 | 244 | ||
245 | /* REVISIT: this just _assumes_ a butterfly is there ... no probe, | 245 | /* REVISIT: this just _assumes_ a butterfly is there ... no probe, |
246 | * and no way to be selective about what it binds to. | 246 | * and no way to be selective about what it binds to. |
247 | */ | 247 | */ |
248 | 248 | ||
249 | /* FIXME where should master->cdev.dev come from? | 249 | master = spi_alloc_master(dev, sizeof *pp); |
250 | * e.g. /sys/bus/pnp0/00:0b, some PCI thing, etc | ||
251 | * setting up a platform device like this is an ugly kluge... | ||
252 | */ | ||
253 | pdev = platform_device_register_simple("butterfly", -1, NULL, 0); | ||
254 | if (IS_ERR(pdev)) | ||
255 | return; | ||
256 | |||
257 | master = spi_alloc_master(&pdev->dev, sizeof *pp); | ||
258 | if (!master) { | 250 | if (!master) { |
259 | status = -ENOMEM; | 251 | status = -ENOMEM; |
260 | goto done; | 252 | goto done; |
@@ -366,14 +358,12 @@ clean1: | |||
366 | clean0: | 358 | clean0: |
367 | (void) spi_master_put(pp->bitbang.master); | 359 | (void) spi_master_put(pp->bitbang.master); |
368 | done: | 360 | done: |
369 | platform_device_unregister(pdev); | ||
370 | pr_debug("%s: butterfly probe, fail %d\n", p->name, status); | 361 | pr_debug("%s: butterfly probe, fail %d\n", p->name, status); |
371 | } | 362 | } |
372 | 363 | ||
373 | static void butterfly_detach(struct parport *p) | 364 | static void butterfly_detach(struct parport *p) |
374 | { | 365 | { |
375 | struct butterfly *pp; | 366 | struct butterfly *pp; |
376 | struct platform_device *pdev; | ||
377 | int status; | 367 | int status; |
378 | 368 | ||
379 | /* FIXME this global is ugly ... but, how to quickly get from | 369 | /* FIXME this global is ugly ... but, how to quickly get from |
@@ -386,7 +376,6 @@ static void butterfly_detach(struct parport *p) | |||
386 | butterfly = NULL; | 376 | butterfly = NULL; |
387 | 377 | ||
388 | /* stop() unregisters child devices too */ | 378 | /* stop() unregisters child devices too */ |
389 | pdev = to_platform_device(pp->bitbang.master->cdev.dev); | ||
390 | status = spi_bitbang_stop(&pp->bitbang); | 379 | status = spi_bitbang_stop(&pp->bitbang); |
391 | 380 | ||
392 | /* turn off VCC */ | 381 | /* turn off VCC */ |
@@ -397,8 +386,6 @@ static void butterfly_detach(struct parport *p) | |||
397 | parport_unregister_device(pp->pd); | 386 | parport_unregister_device(pp->pd); |
398 | 387 | ||
399 | (void) spi_master_put(pp->bitbang.master); | 388 | (void) spi_master_put(pp->bitbang.master); |
400 | |||
401 | platform_device_unregister(pdev); | ||
402 | } | 389 | } |
403 | 390 | ||
404 | static struct parport_driver butterfly_driver = { | 391 | static struct parport_driver butterfly_driver = { |