Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Tony Jones and committed by
Greg Kroah-Hartman
0c55445f 68db2bc9

+18 -17
+9 -8
drivers/mfd/ucb1x00-assabet.c
··· 20 20 #include "ucb1x00.h" 21 21 22 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 26 struct ucb1x00 *ucb = classdev_to_ucb1x00(dev); \ 26 27 int val; \ ··· 30 29 ucb1x00_adc_disable(ucb); \ 31 30 return sprintf(buf, "%d\n", val); \ 32 31 } \ 33 - static CLASS_DEVICE_ATTR(name,0444,name##_show,NULL) 32 + static DEVICE_ATTR(name,0444,name##_show,NULL) 34 33 35 34 UCB1X00_ATTR(vbatt, UCB_ADC_INP_AD1); 36 35 UCB1X00_ATTR(vcharger, UCB_ADC_INP_AD0); ··· 38 37 39 38 static int ucb1x00_assabet_add(struct ucb1x00_dev *dev) 40 39 { 41 - class_device_create_file(&dev->ucb->cdev, &class_device_attr_vbatt); 42 - class_device_create_file(&dev->ucb->cdev, &class_device_attr_vcharger); 43 - class_device_create_file(&dev->ucb->cdev, &class_device_attr_batt_temp); 40 + device_create_file(&dev->ucb->dev, &device_attr_vbatt); 41 + device_create_file(&dev->ucb->dev, &device_attr_vcharger); 42 + device_create_file(&dev->ucb->dev, &device_attr_batt_temp); 44 43 return 0; 45 44 } 46 45 47 46 static void ucb1x00_assabet_remove(struct ucb1x00_dev *dev) 48 47 { 49 - class_device_remove_file(&dev->ucb->cdev, &class_device_attr_batt_temp); 50 - class_device_remove_file(&dev->ucb->cdev, &class_device_attr_vcharger); 51 - class_device_remove_file(&dev->ucb->cdev, &class_device_attr_vbatt); 48 + device_remove_file(&dev->ucb->cdev, &device_attr_batt_temp); 49 + device_remove_file(&dev->ucb->cdev, &device_attr_vcharger); 50 + device_remove_file(&dev->ucb->cdev, &device_attr_vbatt); 52 51 } 53 52 54 53 static struct ucb1x00_driver ucb1x00_assabet_driver = {
+7 -7
drivers/mfd/ucb1x00-core.c
··· 458 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 463 struct ucb1x00 *ucb = classdev_to_ucb1x00(dev); 464 464 kfree(ucb); ··· 466 466 467 467 static struct class ucb1x00_class = { 468 468 .name = "ucb1x00", 469 - .release = ucb1x00_release, 469 + .dev_release = ucb1x00_release, 470 470 }; 471 471 472 472 static int ucb1x00_probe(struct mcp *mcp) ··· 490 490 goto err_disable; 491 491 492 492 493 - ucb->cdev.class = &ucb1x00_class; 494 - ucb->cdev.dev = &mcp->attached_device; 495 - strlcpy(ucb->cdev.class_id, "ucb1x00", sizeof(ucb->cdev.class_id)); 493 + ucb->dev.class = &ucb1x00_class; 494 + ucb->dev.parent = &mcp->attached_device; 495 + strlcpy(ucb->dev.bus_id, "ucb1x00", sizeof(ucb->dev.bus_id)); 496 496 497 497 spin_lock_init(&ucb->lock); 498 498 spin_lock_init(&ucb->io_lock); ··· 517 517 518 518 mcp_set_drvdata(mcp, ucb); 519 519 520 - ret = class_device_register(&ucb->cdev); 520 + ret = device_register(&ucb->dev); 521 521 if (ret) 522 522 goto err_irq; 523 523 ··· 554 554 mutex_unlock(&ucb1x00_mutex); 555 555 556 556 free_irq(ucb->irq, ucb); 557 - class_device_unregister(&ucb->cdev); 557 + device_unregister(&ucb->dev); 558 558 } 559 559 560 560 int ucb1x00_register_driver(struct ucb1x00_driver *drv)
+2 -2
drivers/mfd/ucb1x00.h
··· 120 120 u16 irq_fal_enbl; 121 121 u16 irq_ris_enbl; 122 122 struct ucb1x00_irq irq_handler[16]; 123 - struct class_device cdev; 123 + struct device dev; 124 124 struct list_head node; 125 125 struct list_head devs; 126 126 }; ··· 144 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 149 int ucb1x00_register_driver(struct ucb1x00_driver *); 150 150 void ucb1x00_unregister_driver(struct ucb1x00_driver *);