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

phy: allwinner: phy-sun4i-usb: Add log when probing

When phy-sun4i-usb's probing fails, it does not print the reason in
kernel log, forcing the developer to edit this driver to add info logs.
This commit makes the kernel print the reason of phy-sun4i-usb's probing
failure or a success message.

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
Tested-by: Mylène Josserand <mylene.josserand@free-electrons.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>

authored by

Quentin Schulz and committed by
Kishon Vijay Abraham I
e7cded27 5771a8c0

+20 -5
+20 -5
drivers/phy/allwinner/phy-sun4i-usb.c
··· 653 653 654 654 data->id_det_gpio = devm_gpiod_get_optional(dev, "usb0_id_det", 655 655 GPIOD_IN); 656 - if (IS_ERR(data->id_det_gpio)) 656 + if (IS_ERR(data->id_det_gpio)) { 657 + dev_err(dev, "Couldn't request ID GPIO\n"); 657 658 return PTR_ERR(data->id_det_gpio); 659 + } 658 660 659 661 data->vbus_det_gpio = devm_gpiod_get_optional(dev, "usb0_vbus_det", 660 662 GPIOD_IN); 661 - if (IS_ERR(data->vbus_det_gpio)) 663 + if (IS_ERR(data->vbus_det_gpio)) { 664 + dev_err(dev, "Couldn't request VBUS detect GPIO\n"); 662 665 return PTR_ERR(data->vbus_det_gpio); 666 + } 663 667 664 668 if (of_find_property(np, "usb0_vbus_power-supply", NULL)) { 665 669 data->vbus_power_supply = devm_power_supply_get_by_phandle(dev, 666 670 "usb0_vbus_power-supply"); 667 - if (IS_ERR(data->vbus_power_supply)) 671 + if (IS_ERR(data->vbus_power_supply)) { 672 + dev_err(dev, "Couldn't get the VBUS power supply\n"); 668 673 return PTR_ERR(data->vbus_power_supply); 674 + } 669 675 670 676 if (!data->vbus_power_supply) 671 677 return -EPROBE_DEFER; ··· 680 674 data->dr_mode = of_usb_get_dr_mode_by_phy(np, 0); 681 675 682 676 data->extcon = devm_extcon_dev_allocate(dev, sun4i_usb_phy0_cable); 683 - if (IS_ERR(data->extcon)) 677 + if (IS_ERR(data->extcon)) { 678 + dev_err(dev, "Couldn't allocate our extcon device\n"); 684 679 return PTR_ERR(data->extcon); 680 + } 685 681 686 682 ret = devm_extcon_dev_register(dev, data->extcon); 687 683 if (ret) { ··· 698 690 snprintf(name, sizeof(name), "usb%d_vbus", i); 699 691 phy->vbus = devm_regulator_get_optional(dev, name); 700 692 if (IS_ERR(phy->vbus)) { 701 - if (PTR_ERR(phy->vbus) == -EPROBE_DEFER) 693 + if (PTR_ERR(phy->vbus) == -EPROBE_DEFER) { 694 + dev_err(dev, 695 + "Couldn't get regulator %s... Deferring probe\n", 696 + name); 702 697 return -EPROBE_DEFER; 698 + } 699 + 703 700 phy->vbus = NULL; 704 701 } 705 702 ··· 787 774 sun4i_usb_phy_remove(pdev); /* Stop detect work */ 788 775 return PTR_ERR(phy_provider); 789 776 } 777 + 778 + dev_dbg(dev, "successfully loaded\n"); 790 779 791 780 return 0; 792 781 }