Commit 0c55445f authored by Tony Jones's avatar Tony Jones Committed by Greg Kroah-Hartman

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: default avatarTony Jones <tonyj@suse.de>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 68db2bc9
...@@ -20,7 +20,8 @@ ...@@ -20,7 +20,8 @@
#include "ucb1x00.h" #include "ucb1x00.h"
#define UCB1X00_ATTR(name,input)\ #define UCB1X00_ATTR(name,input)\
static ssize_t name##_show(struct class_device *dev, char *buf) \ static ssize_t name##_show(struct device *dev, struct device_attribute *attr,
char *buf) \
{ \ { \
struct ucb1x00 *ucb = classdev_to_ucb1x00(dev); \ struct ucb1x00 *ucb = classdev_to_ucb1x00(dev); \
int val; \ int val; \
...@@ -29,7 +30,7 @@ static ssize_t name##_show(struct class_device *dev, char *buf) \ ...@@ -29,7 +30,7 @@ static ssize_t name##_show(struct class_device *dev, char *buf) \
ucb1x00_adc_disable(ucb); \ ucb1x00_adc_disable(ucb); \
return sprintf(buf, "%d\n", val); \ return sprintf(buf, "%d\n", val); \
} \ } \
static CLASS_DEVICE_ATTR(name,0444,name##_show,NULL) static DEVICE_ATTR(name,0444,name##_show,NULL)
UCB1X00_ATTR(vbatt, UCB_ADC_INP_AD1); UCB1X00_ATTR(vbatt, UCB_ADC_INP_AD1);
UCB1X00_ATTR(vcharger, UCB_ADC_INP_AD0); UCB1X00_ATTR(vcharger, UCB_ADC_INP_AD0);
...@@ -37,17 +38,17 @@ UCB1X00_ATTR(batt_temp, UCB_ADC_INP_AD2); ...@@ -37,17 +38,17 @@ UCB1X00_ATTR(batt_temp, UCB_ADC_INP_AD2);
static int ucb1x00_assabet_add(struct ucb1x00_dev *dev) static int ucb1x00_assabet_add(struct ucb1x00_dev *dev)
{ {
class_device_create_file(&dev->ucb->cdev, &class_device_attr_vbatt); device_create_file(&dev->ucb->dev, &device_attr_vbatt);
class_device_create_file(&dev->ucb->cdev, &class_device_attr_vcharger); device_create_file(&dev->ucb->dev, &device_attr_vcharger);
class_device_create_file(&dev->ucb->cdev, &class_device_attr_batt_temp); device_create_file(&dev->ucb->dev, &device_attr_batt_temp);
return 0; return 0;
} }
static void ucb1x00_assabet_remove(struct ucb1x00_dev *dev) static void ucb1x00_assabet_remove(struct ucb1x00_dev *dev)
{ {
class_device_remove_file(&dev->ucb->cdev, &class_device_attr_batt_temp); device_remove_file(&dev->ucb->cdev, &device_attr_batt_temp);
class_device_remove_file(&dev->ucb->cdev, &class_device_attr_vcharger); device_remove_file(&dev->ucb->cdev, &device_attr_vcharger);
class_device_remove_file(&dev->ucb->cdev, &class_device_attr_vbatt); device_remove_file(&dev->ucb->cdev, &device_attr_vbatt);
} }
static struct ucb1x00_driver ucb1x00_assabet_driver = { static struct ucb1x00_driver ucb1x00_assabet_driver = {
......
...@@ -458,7 +458,7 @@ static int ucb1x00_detect_irq(struct ucb1x00 *ucb) ...@@ -458,7 +458,7 @@ static int ucb1x00_detect_irq(struct ucb1x00 *ucb)
return probe_irq_off(mask); return probe_irq_off(mask);
} }
static void ucb1x00_release(struct class_device *dev) static void ucb1x00_release(struct device *dev)
{ {
struct ucb1x00 *ucb = classdev_to_ucb1x00(dev); struct ucb1x00 *ucb = classdev_to_ucb1x00(dev);
kfree(ucb); kfree(ucb);
...@@ -466,7 +466,7 @@ static void ucb1x00_release(struct class_device *dev) ...@@ -466,7 +466,7 @@ static void ucb1x00_release(struct class_device *dev)
static struct class ucb1x00_class = { static struct class ucb1x00_class = {
.name = "ucb1x00", .name = "ucb1x00",
.release = ucb1x00_release, .dev_release = ucb1x00_release,
}; };
static int ucb1x00_probe(struct mcp *mcp) static int ucb1x00_probe(struct mcp *mcp)
...@@ -490,9 +490,9 @@ static int ucb1x00_probe(struct mcp *mcp) ...@@ -490,9 +490,9 @@ static int ucb1x00_probe(struct mcp *mcp)
goto err_disable; goto err_disable;
ucb->cdev.class = &ucb1x00_class; ucb->dev.class = &ucb1x00_class;
ucb->cdev.dev = &mcp->attached_device; ucb->dev.parent = &mcp->attached_device;
strlcpy(ucb->cdev.class_id, "ucb1x00", sizeof(ucb->cdev.class_id)); strlcpy(ucb->dev.bus_id, "ucb1x00", sizeof(ucb->dev.bus_id));
spin_lock_init(&ucb->lock); spin_lock_init(&ucb->lock);
spin_lock_init(&ucb->io_lock); spin_lock_init(&ucb->io_lock);
...@@ -517,7 +517,7 @@ static int ucb1x00_probe(struct mcp *mcp) ...@@ -517,7 +517,7 @@ static int ucb1x00_probe(struct mcp *mcp)
mcp_set_drvdata(mcp, ucb); mcp_set_drvdata(mcp, ucb);
ret = class_device_register(&ucb->cdev); ret = device_register(&ucb->dev);
if (ret) if (ret)
goto err_irq; goto err_irq;
...@@ -554,7 +554,7 @@ static void ucb1x00_remove(struct mcp *mcp) ...@@ -554,7 +554,7 @@ static void ucb1x00_remove(struct mcp *mcp)
mutex_unlock(&ucb1x00_mutex); mutex_unlock(&ucb1x00_mutex);
free_irq(ucb->irq, ucb); free_irq(ucb->irq, ucb);
class_device_unregister(&ucb->cdev); device_unregister(&ucb->dev);
} }
int ucb1x00_register_driver(struct ucb1x00_driver *drv) int ucb1x00_register_driver(struct ucb1x00_driver *drv)
......
...@@ -120,7 +120,7 @@ struct ucb1x00 { ...@@ -120,7 +120,7 @@ struct ucb1x00 {
u16 irq_fal_enbl; u16 irq_fal_enbl;
u16 irq_ris_enbl; u16 irq_ris_enbl;
struct ucb1x00_irq irq_handler[16]; struct ucb1x00_irq irq_handler[16];
struct class_device cdev; struct device dev;
struct list_head node; struct list_head node;
struct list_head devs; struct list_head devs;
}; };
...@@ -144,7 +144,7 @@ struct ucb1x00_driver { ...@@ -144,7 +144,7 @@ struct ucb1x00_driver {
int (*resume)(struct ucb1x00_dev *dev); int (*resume)(struct ucb1x00_dev *dev);
}; };
#define classdev_to_ucb1x00(cd) container_of(cd, struct ucb1x00, cdev) #define classdev_to_ucb1x00(cd) container_of(cd, struct ucb1x00, dev)
int ucb1x00_register_driver(struct ucb1x00_driver *); int ucb1x00_register_driver(struct ucb1x00_driver *);
void ucb1x00_unregister_driver(struct ucb1x00_driver *); void ucb1x00_unregister_driver(struct ucb1x00_driver *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment