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

Configure Feed

Select the types of activity you want to include in your feed.

regulator: ROHM BDxxxxx minor print improvements

Merge series from Matti Vaittinen <mazziesaccount@gmail.com>:

Minor (printing) improvements for ROHM regulator drivers.

This series:

- Drops an unnecessary info print from bd718x7.
(Added a fixes tag for this but not really sure if worth
adding to stable)
- Convert the ROHM BDxxxxx PMIC regulator drivers to use dev_err_probe().
- Change the probe logic for bd718x7 to favor the more usual devm-style
where errors are returned immediately.

+57 -81
+4 -6
drivers/regulator/bd71815-regulator.c
··· 602 602 config.ena_gpiod = NULL; 603 603 604 604 rdev = devm_regulator_register(&pdev->dev, desc, &config); 605 - if (IS_ERR(rdev)) { 606 - dev_err(&pdev->dev, 607 - "failed to register %s regulator\n", 608 - desc->name); 609 - return PTR_ERR(rdev); 610 - } 605 + if (IS_ERR(rdev)) 606 + return dev_err_probe(&pdev->dev, PTR_ERR(rdev), 607 + "failed to register %s regulator\n", 608 + desc->name); 611 609 } 612 610 return 0; 613 611 }
+9 -12
drivers/regulator/bd71828-regulator.c
··· 750 750 rd = &bd71828_rdata[i]; 751 751 rdev = devm_regulator_register(&pdev->dev, 752 752 &rd->desc, &config); 753 - if (IS_ERR(rdev)) { 754 - dev_err(&pdev->dev, 755 - "failed to register %s regulator\n", 756 - rd->desc.name); 757 - return PTR_ERR(rdev); 758 - } 753 + if (IS_ERR(rdev)) 754 + return dev_err_probe(&pdev->dev, PTR_ERR(rdev), 755 + "failed to register %s regulator\n", 756 + rd->desc.name); 757 + 759 758 for (j = 0; j < rd->reg_init_amnt; j++) { 760 759 ret = regmap_update_bits(config.regmap, 761 760 rd->reg_inits[j].reg, 762 761 rd->reg_inits[j].mask, 763 762 rd->reg_inits[j].val); 764 - if (ret) { 765 - dev_err(&pdev->dev, 766 - "regulator %s init failed\n", 767 - rd->desc.name); 768 - return ret; 769 - } 763 + if (ret) 764 + return dev_err_probe(&pdev->dev, ret, 765 + "regulator %s init failed\n", 766 + rd->desc.name); 770 767 } 771 768 } 772 769 return 0;
+19 -34
drivers/regulator/bd718x7-regulator.c
··· 1576 1576 if (!of_node_name_eq(np, desc->of_match)) 1577 1577 continue; 1578 1578 1579 - pr_info("Looking at node '%s'\n", desc->of_match); 1580 - 1581 1579 /* The feedback loop connection does not make sense for LDOs */ 1582 1580 if (desc->id >= BD718XX_LDO1) 1583 1581 return -EINVAL; ··· 1706 1708 break; 1707 1709 default: 1708 1710 dev_err(&pdev->dev, "Unsupported chip type\n"); 1709 - err = -EINVAL; 1710 - goto err; 1711 + return -EINVAL; 1711 1712 } 1712 1713 1713 1714 /* Register LOCK release */ 1714 1715 err = regmap_update_bits(regmap, BD718XX_REG_REGLOCK, 1715 1716 (REGLOCK_PWRSEQ | REGLOCK_VREG), 0); 1716 - if (err) { 1717 - dev_err(&pdev->dev, "Failed to unlock PMIC (%d)\n", err); 1718 - goto err; 1719 - } else { 1720 - dev_dbg(&pdev->dev, "Unlocked lock register 0x%x\n", 1721 - BD718XX_REG_REGLOCK); 1722 - } 1717 + if (err) 1718 + return dev_err_probe(&pdev->dev, err, "Failed to unlock PMIC\n"); 1719 + 1720 + dev_dbg(&pdev->dev, "Unlocked lock register 0x%x\n", 1721 + BD718XX_REG_REGLOCK); 1723 1722 1724 1723 use_snvs = of_property_read_bool(pdev->dev.parent->of_node, 1725 1724 "rohm,reset-snvs-powered"); ··· 1733 1738 BD718XX_WDOG_POWEROFF_MASK | 1734 1739 BD718XX_KEY_L_POWEROFF_MASK, 1735 1740 BD718XX_POWOFF_TO_RDY); 1736 - if (err) { 1737 - dev_err(&pdev->dev, "Failed to change reset target\n"); 1738 - goto err; 1739 - } else { 1740 - dev_dbg(&pdev->dev, 1741 - "Changed all resets from SVNS to READY\n"); 1742 - } 1741 + if (err) 1742 + return dev_err_probe(&pdev->dev, err, 1743 + "Failed to change reset target\n"); 1744 + 1745 + dev_dbg(&pdev->dev, "Changed all resets from SVNS to READY\n"); 1743 1746 } 1744 1747 1745 1748 config.dev = pdev->dev.parent; ··· 1773 1780 desc->ops = swops[i]; 1774 1781 1775 1782 rdev = devm_regulator_register(&pdev->dev, desc, &config); 1776 - if (IS_ERR(rdev)) { 1777 - dev_err(&pdev->dev, 1778 - "failed to register %s regulator\n", 1779 - desc->name); 1780 - err = PTR_ERR(rdev); 1781 - goto err; 1782 - } 1783 + if (IS_ERR(rdev)) 1784 + return dev_err_probe(&pdev->dev, PTR_ERR(rdev), 1785 + "failed to register %s regulator\n", 1786 + desc->name); 1783 1787 1784 1788 /* 1785 1789 * Regulator register gets the regulator constraints and ··· 1799 1809 !rdev->constraints->boot_on)) { 1800 1810 err = regmap_update_bits(regmap, r->init.reg, 1801 1811 r->init.mask, r->init.val); 1802 - if (err) { 1803 - dev_err(&pdev->dev, 1812 + if (err) 1813 + return dev_err_probe(&pdev->dev, err, 1804 1814 "Failed to take control for (%s)\n", 1805 1815 desc->name); 1806 - goto err; 1807 - } 1808 1816 } 1809 1817 for (j = 0; j < r->additional_init_amnt; j++) { 1810 1818 err = regmap_update_bits(regmap, 1811 1819 r->additional_inits[j].reg, 1812 1820 r->additional_inits[j].mask, 1813 1821 r->additional_inits[j].val); 1814 - if (err) { 1815 - dev_err(&pdev->dev, 1822 + if (err) 1823 + return dev_err_probe(&pdev->dev, err, 1816 1824 "Buck (%s) initialization failed\n", 1817 1825 desc->name); 1818 - goto err; 1819 - } 1820 1826 } 1821 1827 } 1822 1828 1823 - err: 1824 1829 return err; 1825 1830 } 1826 1831
+25 -29
drivers/regulator/bd9576-regulator.c
··· 953 953 dev_fwnode(pdev->dev.parent), 954 954 "rohm,vout1-en", GPIOD_OUT_LOW, 955 955 "vout1-en"); 956 - if (!IS_ERR(en)) { 957 - /* VOUT1_OPS gpio ctrl */ 958 - /* 959 - * Regulator core prioritizes the ena_gpio over 960 - * enable/disable/is_enabled callbacks so no need to 961 - * clear them. We can still use same ops 962 - */ 956 + 957 + /* VOUT1_OPS gpio ctrl */ 958 + /* 959 + * Regulator core prioritizes the ena_gpio over 960 + * enable/disable/is_enabled callbacks so no need to clear them 961 + * even if GPIO is used. So, we can still use same ops. 962 + * 963 + * In theory it is possible someone wants to set vout1-en LOW 964 + * during OTP loading and set VOUT1 to be controlled by GPIO - 965 + * but control the GPIO from some where else than this driver. 966 + * For that to work we should unset the is_enabled callback 967 + * here. 968 + * 969 + * I believe such case where rohm,vout1-en-low is set and 970 + * vout1-en-gpios is not is likely to be a misconfiguration. 971 + * So let's just err out for now. 972 + */ 973 + if (!IS_ERR(en)) 963 974 config.ena_gpiod = en; 964 - } else { 965 - /* 966 - * In theory it is possible someone wants to set 967 - * vout1-en LOW during OTP loading and set VOUT1 to be 968 - * controlled by GPIO - but control the GPIO from some 969 - * where else than this driver. For that to work we 970 - * should unset the is_enabled callback here. 971 - * 972 - * I believe such case where rohm,vout1-en-low is set 973 - * and vout1-en-gpios is not is likely to be a 974 - * misconfiguration. So let's just err out for now. 975 - */ 976 - dev_err(&pdev->dev, 977 - "Failed to get VOUT1 control GPIO\n"); 978 - return PTR_ERR(en); 979 - } 975 + else 976 + return dev_err_probe(&pdev->dev, PTR_ERR(en), 977 + "Failed to get VOUT1 control GPIO\n"); 980 978 } 981 979 982 980 /* ··· 1035 1037 1036 1038 r->rdev = devm_regulator_register(&pdev->dev, desc, 1037 1039 &config); 1038 - if (IS_ERR(r->rdev)) { 1039 - dev_err(&pdev->dev, 1040 - "failed to register %s regulator\n", 1041 - desc->name); 1042 - return PTR_ERR(r->rdev); 1043 - } 1040 + if (IS_ERR(r->rdev)) 1041 + return dev_err_probe(&pdev->dev, PTR_ERR(r->rdev), 1042 + "failed to register %s regulator\n", 1043 + desc->name); 1044 1044 /* 1045 1045 * Clear the VOUT1 GPIO setting - rest of the regulators do not 1046 1046 * support GPIO control