diff options
author | Tony Jones <tonyj@suse.de> | 2007-09-24 20:03:03 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-01-24 23:40:06 -0500 |
commit | 0c55445f201841bfd6c658c47df8311b6722f002 (patch) | |
tree | 68b02474461eea74e0fd54c5858a433b6aa942ab | |
parent | 68db2bc98cc1594a1cc487755aff4340fd4f1611 (diff) |
MCP_UCB1200: Convert from class_device to device
struct class_device is going away, this converts the code to use struct
device instead.
Signed-off-by: Tony Jones <tonyj@suse.de>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/mfd/ucb1x00-assabet.c | 17 | ||||
-rw-r--r-- | drivers/mfd/ucb1x00-core.c | 14 | ||||
-rw-r--r-- | drivers/mfd/ucb1x00.h | 4 |
3 files changed, 18 insertions, 17 deletions
diff --git a/drivers/mfd/ucb1x00-assabet.c b/drivers/mfd/ucb1x00-assabet.c index e325fa71f38b..b7c8e7813865 100644 --- a/drivers/mfd/ucb1x00-assabet.c +++ b/drivers/mfd/ucb1x00-assabet.c | |||
@@ -20,7 +20,8 @@ | |||
20 | #include "ucb1x00.h" | 20 | #include "ucb1x00.h" |
21 | 21 | ||
22 | #define UCB1X00_ATTR(name,input)\ | 22 | #define UCB1X00_ATTR(name,input)\ |
23 | static ssize_t name##_show(struct class_device *dev, char *buf) \ | 23 | static ssize_t name##_show(struct device *dev, struct device_attribute *attr, |
24 | char *buf) \ | ||
24 | { \ | 25 | { \ |
25 | struct ucb1x00 *ucb = classdev_to_ucb1x00(dev); \ | 26 | struct ucb1x00 *ucb = classdev_to_ucb1x00(dev); \ |
26 | int val; \ | 27 | int val; \ |
@@ -29,7 +30,7 @@ static ssize_t name##_show(struct class_device *dev, char *buf) \ | |||
29 | ucb1x00_adc_disable(ucb); \ | 30 | ucb1x00_adc_disable(ucb); \ |
30 | return sprintf(buf, "%d\n", val); \ | 31 | return sprintf(buf, "%d\n", val); \ |
31 | } \ | 32 | } \ |
32 | static CLASS_DEVICE_ATTR(name,0444,name##_show,NULL) | 33 | static DEVICE_ATTR(name,0444,name##_show,NULL) |
33 | 34 | ||
34 | UCB1X00_ATTR(vbatt, UCB_ADC_INP_AD1); | 35 | UCB1X00_ATTR(vbatt, UCB_ADC_INP_AD1); |
35 | UCB1X00_ATTR(vcharger, UCB_ADC_INP_AD0); | 36 | UCB1X00_ATTR(vcharger, UCB_ADC_INP_AD0); |
@@ -37,17 +38,17 @@ UCB1X00_ATTR(batt_temp, UCB_ADC_INP_AD2); | |||
37 | 38 | ||
38 | static int ucb1x00_assabet_add(struct ucb1x00_dev *dev) | 39 | static int ucb1x00_assabet_add(struct ucb1x00_dev *dev) |
39 | { | 40 | { |
40 | class_device_create_file(&dev->ucb->cdev, &class_device_attr_vbatt); | 41 | device_create_file(&dev->ucb->dev, &device_attr_vbatt); |
41 | class_device_create_file(&dev->ucb->cdev, &class_device_attr_vcharger); | 42 | device_create_file(&dev->ucb->dev, &device_attr_vcharger); |
42 | class_device_create_file(&dev->ucb->cdev, &class_device_attr_batt_temp); | 43 | device_create_file(&dev->ucb->dev, &device_attr_batt_temp); |
43 | return 0; | 44 | return 0; |
44 | } | 45 | } |
45 | 46 | ||
46 | static void ucb1x00_assabet_remove(struct ucb1x00_dev *dev) | 47 | static void ucb1x00_assabet_remove(struct ucb1x00_dev *dev) |
47 | { | 48 | { |
48 | class_device_remove_file(&dev->ucb->cdev, &class_device_attr_batt_temp); | 49 | device_remove_file(&dev->ucb->cdev, &device_attr_batt_temp); |
49 | class_device_remove_file(&dev->ucb->cdev, &class_device_attr_vcharger); | 50 | device_remove_file(&dev->ucb->cdev, &device_attr_vcharger); |
50 | class_device_remove_file(&dev->ucb->cdev, &class_device_attr_vbatt); | 51 | device_remove_file(&dev->ucb->cdev, &device_attr_vbatt); |
51 | } | 52 | } |
52 | 53 | ||
53 | static struct ucb1x00_driver ucb1x00_assabet_driver = { | 54 | static struct ucb1x00_driver ucb1x00_assabet_driver = { |
diff --git a/drivers/mfd/ucb1x00-core.c b/drivers/mfd/ucb1x00-core.c index e03f1bcd4f9f..f6b10dda31fd 100644 --- a/drivers/mfd/ucb1x00-core.c +++ b/drivers/mfd/ucb1x00-core.c | |||
@@ -458,7 +458,7 @@ static int ucb1x00_detect_irq(struct ucb1x00 *ucb) | |||
458 | return probe_irq_off(mask); | 458 | return probe_irq_off(mask); |
459 | } | 459 | } |
460 | 460 | ||
461 | static void ucb1x00_release(struct class_device *dev) | 461 | static void ucb1x00_release(struct device *dev) |
462 | { | 462 | { |
463 | struct ucb1x00 *ucb = classdev_to_ucb1x00(dev); | 463 | struct ucb1x00 *ucb = classdev_to_ucb1x00(dev); |
464 | kfree(ucb); | 464 | kfree(ucb); |
@@ -466,7 +466,7 @@ static void ucb1x00_release(struct class_device *dev) | |||
466 | 466 | ||
467 | static struct class ucb1x00_class = { | 467 | static struct class ucb1x00_class = { |
468 | .name = "ucb1x00", | 468 | .name = "ucb1x00", |
469 | .release = ucb1x00_release, | 469 | .dev_release = ucb1x00_release, |
470 | }; | 470 | }; |
471 | 471 | ||
472 | static int ucb1x00_probe(struct mcp *mcp) | 472 | static int ucb1x00_probe(struct mcp *mcp) |
@@ -490,9 +490,9 @@ static int ucb1x00_probe(struct mcp *mcp) | |||
490 | goto err_disable; | 490 | goto err_disable; |
491 | 491 | ||
492 | 492 | ||
493 | ucb->cdev.class = &ucb1x00_class; | 493 | ucb->dev.class = &ucb1x00_class; |
494 | ucb->cdev.dev = &mcp->attached_device; | 494 | ucb->dev.parent = &mcp->attached_device; |
495 | strlcpy(ucb->cdev.class_id, "ucb1x00", sizeof(ucb->cdev.class_id)); | 495 | strlcpy(ucb->dev.bus_id, "ucb1x00", sizeof(ucb->dev.bus_id)); |
496 | 496 | ||
497 | spin_lock_init(&ucb->lock); | 497 | spin_lock_init(&ucb->lock); |
498 | spin_lock_init(&ucb->io_lock); | 498 | spin_lock_init(&ucb->io_lock); |
@@ -517,7 +517,7 @@ static int ucb1x00_probe(struct mcp *mcp) | |||
517 | 517 | ||
518 | mcp_set_drvdata(mcp, ucb); | 518 | mcp_set_drvdata(mcp, ucb); |
519 | 519 | ||
520 | ret = class_device_register(&ucb->cdev); | 520 | ret = device_register(&ucb->dev); |
521 | if (ret) | 521 | if (ret) |
522 | goto err_irq; | 522 | goto err_irq; |
523 | 523 | ||
@@ -554,7 +554,7 @@ static void ucb1x00_remove(struct mcp *mcp) | |||
554 | mutex_unlock(&ucb1x00_mutex); | 554 | mutex_unlock(&ucb1x00_mutex); |
555 | 555 | ||
556 | free_irq(ucb->irq, ucb); | 556 | free_irq(ucb->irq, ucb); |
557 | class_device_unregister(&ucb->cdev); | 557 | device_unregister(&ucb->dev); |
558 | } | 558 | } |
559 | 559 | ||
560 | int ucb1x00_register_driver(struct ucb1x00_driver *drv) | 560 | int ucb1x00_register_driver(struct ucb1x00_driver *drv) |
diff --git a/drivers/mfd/ucb1x00.h b/drivers/mfd/ucb1x00.h index ca8df8072d43..a8ad8a0ed5db 100644 --- a/drivers/mfd/ucb1x00.h +++ b/drivers/mfd/ucb1x00.h | |||
@@ -120,7 +120,7 @@ struct ucb1x00 { | |||
120 | u16 irq_fal_enbl; | 120 | u16 irq_fal_enbl; |
121 | u16 irq_ris_enbl; | 121 | u16 irq_ris_enbl; |
122 | struct ucb1x00_irq irq_handler[16]; | 122 | struct ucb1x00_irq irq_handler[16]; |
123 | struct class_device cdev; | 123 | struct device dev; |
124 | struct list_head node; | 124 | struct list_head node; |
125 | struct list_head devs; | 125 | struct list_head devs; |
126 | }; | 126 | }; |
@@ -144,7 +144,7 @@ struct ucb1x00_driver { | |||
144 | int (*resume)(struct ucb1x00_dev *dev); | 144 | int (*resume)(struct ucb1x00_dev *dev); |
145 | }; | 145 | }; |
146 | 146 | ||
147 | #define classdev_to_ucb1x00(cd) container_of(cd, struct ucb1x00, cdev) | 147 | #define classdev_to_ucb1x00(cd) container_of(cd, struct ucb1x00, dev) |
148 | 148 | ||
149 | int ucb1x00_register_driver(struct ucb1x00_driver *); | 149 | int ucb1x00_register_driver(struct ucb1x00_driver *); |
150 | void ucb1x00_unregister_driver(struct ucb1x00_driver *); | 150 | void ucb1x00_unregister_driver(struct ucb1x00_driver *); |