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

regulator: core: convert class code to use dev_groups

The dev_attrs field of struct class is going away soon, dev_groups
should be used instead. This converts the regulator class code to use
the correct field.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Mark Brown <broonie@linaro.org>

authored by

Greg Kroah-Hartman and committed by
Mark Brown
587cea27 070260f0

+16 -12
+16 -12
drivers/regulator/core.c
··· 323 323 } 324 324 static DEVICE_ATTR(microamps, 0444, regulator_uA_show, NULL); 325 325 326 - static ssize_t regulator_name_show(struct device *dev, 327 - struct device_attribute *attr, char *buf) 326 + static ssize_t name_show(struct device *dev, struct device_attribute *attr, 327 + char *buf) 328 328 { 329 329 struct regulator_dev *rdev = dev_get_drvdata(dev); 330 330 331 331 return sprintf(buf, "%s\n", rdev_get_name(rdev)); 332 332 } 333 + static DEVICE_ATTR_RO(name); 333 334 334 335 static ssize_t regulator_print_opmode(char *buf, int mode) 335 336 { ··· 490 489 } 491 490 static DEVICE_ATTR(requested_microamps, 0444, regulator_total_uA_show, NULL); 492 491 493 - static ssize_t regulator_num_users_show(struct device *dev, 494 - struct device_attribute *attr, char *buf) 492 + static ssize_t num_users_show(struct device *dev, struct device_attribute *attr, 493 + char *buf) 495 494 { 496 495 struct regulator_dev *rdev = dev_get_drvdata(dev); 497 496 return sprintf(buf, "%d\n", rdev->use_count); 498 497 } 498 + static DEVICE_ATTR_RO(num_users); 499 499 500 - static ssize_t regulator_type_show(struct device *dev, 501 - struct device_attribute *attr, char *buf) 500 + static ssize_t type_show(struct device *dev, struct device_attribute *attr, 501 + char *buf) 502 502 { 503 503 struct regulator_dev *rdev = dev_get_drvdata(dev); 504 504 ··· 511 509 } 512 510 return sprintf(buf, "unknown\n"); 513 511 } 512 + static DEVICE_ATTR_RO(type); 514 513 515 514 static ssize_t regulator_suspend_mem_uV_show(struct device *dev, 516 515 struct device_attribute *attr, char *buf) ··· 635 632 * These are the only attributes are present for all regulators. 636 633 * Other attributes are a function of regulator functionality. 637 634 */ 638 - static struct device_attribute regulator_dev_attrs[] = { 639 - __ATTR(name, 0444, regulator_name_show, NULL), 640 - __ATTR(num_users, 0444, regulator_num_users_show, NULL), 641 - __ATTR(type, 0444, regulator_type_show, NULL), 642 - __ATTR_NULL, 635 + static struct attribute *regulator_dev_attrs[] = { 636 + &dev_attr_name.attr, 637 + &dev_attr_num_users.attr, 638 + &dev_attr_type.attr, 639 + NULL, 643 640 }; 641 + ATTRIBUTE_GROUPS(regulator_dev); 644 642 645 643 static void regulator_dev_release(struct device *dev) 646 644 { ··· 652 648 static struct class regulator_class = { 653 649 .name = "regulator", 654 650 .dev_release = regulator_dev_release, 655 - .dev_attrs = regulator_dev_attrs, 651 + .dev_groups = regulator_dev_groups, 656 652 }; 657 653 658 654 /* Calculate the new optimum regulator operating mode based on the new total