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

power: supply: twl4030-charger: remove nonstandard max_current sysfs attribute

Since we now support the standard 'input_current_limit' property by

commit 3fb319c2cdcd ("power: supply: twl4030-charger: add writable INPUT_CURRENT_LIMIT property")

we can now remove the nonstandard 'max_current' sysfs attribute.

See Documentation/power/power_supply_class.txt line 125

Both are functionally equivalent. From ABI point of view it is just a rename
of the property.

This also removes the entry in Documentation/ABI/testing/sysfs-class-power-twl4030

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>

authored by

H. Nikolaus Schaller and committed by
Sebastian Reichel
49fb3846 e1285417

-80
-17
Documentation/ABI/testing/sysfs-class-power-twl4030
··· 1 - What: /sys/class/power_supply/twl4030_ac/max_current 2 - /sys/class/power_supply/twl4030_usb/max_current 3 - Description: 4 - Read/Write limit on current which may 5 - be drawn from the ac (Accessory Charger) or 6 - USB port. 7 - 8 - Value is in micro-Amps. 9 - 10 - Value is set automatically to an appropriate 11 - value when a cable is plugged or unplugged. 12 - 13 - Value can the set by writing to the attribute. 14 - The change will only persist until the next 15 - plug event. These event are reported via udev. 16 - 17 - 18 1 What: /sys/class/power_supply/twl4030_usb/mode 19 2 Description: 20 3 Changing mode for USB port.
-63
drivers/power/supply/twl4030_charger.c
··· 624 624 return IRQ_HANDLED; 625 625 } 626 626 627 - /* 628 - * Provide "max_current" attribute in sysfs. 629 - */ 630 - static ssize_t 631 - twl4030_bci_max_current_store(struct device *dev, struct device_attribute *attr, 632 - const char *buf, size_t n) 633 - { 634 - struct twl4030_bci *bci = dev_get_drvdata(dev->parent); 635 - int cur = 0; 636 - int status = 0; 637 - status = kstrtoint(buf, 10, &cur); 638 - if (status) 639 - return status; 640 - if (cur < 0) 641 - return -EINVAL; 642 - if (dev == &bci->ac->dev) 643 - bci->ac_cur = cur; 644 - else 645 - bci->usb_cur_target = cur; 646 - 647 - twl4030_charger_update_current(bci); 648 - return n; 649 - } 650 - 651 - /* 652 - * sysfs max_current show 653 - */ 654 - static ssize_t twl4030_bci_max_current_show(struct device *dev, 655 - struct device_attribute *attr, char *buf) 656 - { 657 - int status = 0; 658 - int cur = -1; 659 - u8 bcictl1; 660 - struct twl4030_bci *bci = dev_get_drvdata(dev->parent); 661 - 662 - if (dev == &bci->ac->dev) { 663 - if (!bci->ac_is_active) 664 - cur = bci->ac_cur; 665 - } else { 666 - if (bci->ac_is_active) 667 - cur = bci->usb_cur_target; 668 - } 669 - if (cur < 0) { 670 - cur = twl4030bci_read_adc_val(TWL4030_BCIIREF1); 671 - if (cur < 0) 672 - return cur; 673 - status = twl4030_bci_read(TWL4030_BCICTL1, &bcictl1); 674 - if (status < 0) 675 - return status; 676 - cur = regval2ua(cur, bcictl1 & TWL4030_CGAIN); 677 - } 678 - return scnprintf(buf, PAGE_SIZE, "%u\n", cur); 679 - } 680 - 681 - static DEVICE_ATTR(max_current, 0644, twl4030_bci_max_current_show, 682 - twl4030_bci_max_current_store); 683 - 684 627 static void twl4030_bci_usb_work(struct work_struct *data) 685 628 { 686 629 struct twl4030_bci *bci = container_of(data, struct twl4030_bci, work); ··· 1054 1111 dev_warn(&pdev->dev, "failed to unmask interrupts: %d\n", ret); 1055 1112 1056 1113 twl4030_charger_update_current(bci); 1057 - if (device_create_file(&bci->usb->dev, &dev_attr_max_current)) 1058 - dev_warn(&pdev->dev, "could not create sysfs file\n"); 1059 1114 if (device_create_file(&bci->usb->dev, &dev_attr_mode)) 1060 1115 dev_warn(&pdev->dev, "could not create sysfs file\n"); 1061 1116 if (device_create_file(&bci->ac->dev, &dev_attr_mode)) 1062 - dev_warn(&pdev->dev, "could not create sysfs file\n"); 1063 - if (device_create_file(&bci->ac->dev, &dev_attr_max_current)) 1064 1117 dev_warn(&pdev->dev, "could not create sysfs file\n"); 1065 1118 1066 1119 twl4030_charger_enable_ac(bci, true); ··· 1089 1150 1090 1151 iio_channel_release(bci->channel_vac); 1091 1152 1092 - device_remove_file(&bci->usb->dev, &dev_attr_max_current); 1093 1153 device_remove_file(&bci->usb->dev, &dev_attr_mode); 1094 - device_remove_file(&bci->ac->dev, &dev_attr_max_current); 1095 1154 device_remove_file(&bci->ac->dev, &dev_attr_mode); 1096 1155 /* mask interrupts */ 1097 1156 twl_i2c_write_u8(TWL4030_MODULE_INTERRUPTS, 0xff,