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

Input: synaptics-rmi4 - make rmi_f34v7_erase_all() use the "erase all" command

A full erase is required to recover from error conditions like "Bad
Partition Table". Various individual partition erase commands can be
(and need to be) omitted, as they will fail until a new partition table
has been written.

Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Link: https://lore.kernel.org/r/20220608124808.51402-7-matthias.schiffer@ew.tq-group.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Matthias Schiffer and committed by
Dmitry Torokhov
d8d007f2 d316e709

+1 -86
+1 -86
drivers/input/rmi4/rmi_f34v7.c
··· 608 608 return 0; 609 609 } 610 610 611 - static int rmi_f34v7_erase_config(struct f34_data *f34) 612 - { 613 - int ret; 614 - 615 - dev_info(&f34->fn->dev, "Erasing config...\n"); 616 - 617 - init_completion(&f34->v7.cmd_done); 618 - 619 - switch (f34->v7.config_area) { 620 - case v7_UI_CONFIG_AREA: 621 - ret = rmi_f34v7_write_command(f34, v7_CMD_ERASE_UI_CONFIG); 622 - if (ret < 0) 623 - return ret; 624 - break; 625 - case v7_DP_CONFIG_AREA: 626 - ret = rmi_f34v7_write_command(f34, v7_CMD_ERASE_DISP_CONFIG); 627 - if (ret < 0) 628 - return ret; 629 - break; 630 - case v7_BL_CONFIG_AREA: 631 - ret = rmi_f34v7_write_command(f34, v7_CMD_ERASE_BL_CONFIG); 632 - if (ret < 0) 633 - return ret; 634 - break; 635 - } 636 - 637 - ret = rmi_f34v7_check_command_status(f34, F34_ERASE_WAIT_MS); 638 - if (ret < 0) 639 - return ret; 640 - 641 - return 0; 642 - } 643 - 644 - static int rmi_f34v7_erase_guest_code(struct f34_data *f34) 645 - { 646 - int ret; 647 - 648 - dev_info(&f34->fn->dev, "Erasing guest code...\n"); 649 - 650 - init_completion(&f34->v7.cmd_done); 651 - 652 - ret = rmi_f34v7_write_command(f34, v7_CMD_ERASE_GUEST_CODE); 653 - if (ret < 0) 654 - return ret; 655 - 656 - ret = rmi_f34v7_check_command_status(f34, F34_ERASE_WAIT_MS); 657 - if (ret < 0) 658 - return ret; 659 - 660 - return 0; 661 - } 662 - 663 611 static int rmi_f34v7_erase_all(struct f34_data *f34) 664 612 { 665 613 int ret; ··· 616 668 617 669 init_completion(&f34->v7.cmd_done); 618 670 619 - ret = rmi_f34v7_write_command(f34, v7_CMD_ERASE_UI_FIRMWARE); 671 + ret = rmi_f34v7_write_command(f34, v7_CMD_ERASE_ALL); 620 672 if (ret < 0) 621 673 return ret; 622 674 623 675 ret = rmi_f34v7_check_command_status(f34, F34_ERASE_WAIT_MS); 624 676 if (ret < 0) 625 677 return ret; 626 - 627 - f34->v7.config_area = v7_UI_CONFIG_AREA; 628 - ret = rmi_f34v7_erase_config(f34); 629 - if (ret < 0) 630 - return ret; 631 - 632 - if (f34->v7.has_display_cfg) { 633 - f34->v7.config_area = v7_DP_CONFIG_AREA; 634 - ret = rmi_f34v7_erase_config(f34); 635 - if (ret < 0) 636 - return ret; 637 - } 638 - 639 - if (f34->v7.has_guest_code) { 640 - ret = rmi_f34v7_erase_guest_code(f34); 641 - if (ret < 0) 642 - return ret; 643 - } 644 678 645 679 return 0; 646 680 } ··· 827 897 828 898 init_completion(&f34->v7.cmd_done); 829 899 830 - ret = rmi_f34v7_write_command(f34, v7_CMD_ERASE_FLASH_CONFIG); 831 - if (ret < 0) 832 - return ret; 833 - 834 - rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, 835 - "%s: Erase flash config command written\n", __func__); 836 - 837 - ret = rmi_f34v7_check_command_status(f34, F34_WRITE_WAIT_MS); 838 - if (ret < 0) 839 - return ret; 840 - 841 900 ret = rmi_f34v7_write_config(f34); 842 901 if (ret < 0) 843 902 return ret; ··· 853 934 f34->v7.read_config_buf_size = f34->v7.config_size; 854 935 855 936 ret = rmi_f34v7_read_blocks(f34, block_count, v7_CMD_READ_CONFIG); 856 - if (ret < 0) 857 - return ret; 858 - 859 - ret = rmi_f34v7_erase_config(f34); 860 937 if (ret < 0) 861 938 return ret; 862 939