Johan Hovold <johan@kernel.org> says: The series fixes some runtime PM related issues in the axiado driver. Included is also a couple of related cleanups.
Unified · Split
| @@ -751,9 +751,9 @@ static const struct spi_controller_mem_ops ax_spi_mem_ops = { · 750 unmodified lines | ||
| 751 | 751 | */ |
| 752 | 752 | static int ax_spi_probe(struct platform_device *pdev) |
| 753 | 753 | { |
| 754 | − int ret = 0, irq; | |
| 755 | 754 | struct spi_controller *ctlr; |
| 756 | 755 | struct ax_spi *xspi; |
| 756 | + int ret, irq; | |
| 757 | 757 | u32 num_cs; |
| 758 | 758 | |
| 759 | 759 | ctlr = devm_spi_alloc_host(&pdev->dev, sizeof(*xspi)); |
| @@ -785,7 +785,7 @@ static int ax_spi_probe(struct platform_device *pdev) · 25 unmodified lines | ||
| 785 | 785 | ret = clk_prepare_enable(xspi->ref_clk); |
| 786 | 786 | if (ret) { |
| 787 | 787 | dev_err(&pdev->dev, "Unable to enable device clock.\n"); |
| 788 | − goto clk_dis_apb; | |
| 788 | + goto err_disable_apb; | |
| 789 | 789 | } |
| 790 | 790 | |
| 791 | 791 | pm_runtime_use_autosuspend(&pdev->dev); |
| @@ -815,7 +815,7 @@ static int ax_spi_probe(struct platform_device *pdev) · 23 unmodified lines | ||
| 815 | 815 | irq = platform_get_irq(pdev, 0); |
| 816 | 816 | if (irq <= 0) { |
| 817 | 817 | ret = -ENXIO; |
| 818 | − goto clk_dis_all; | |
| 818 | + goto err_disable_rpm; | |
| 819 | 819 | } |
| 820 | 820 | |
| 821 | 821 | ret = devm_request_irq(&pdev->dev, irq, ax_spi_irq, |
| @@ -823,7 +823,7 @@ static int ax_spi_probe(struct platform_device *pdev) · 1 unmodified line | ||
| 823 | 823 | if (ret != 0) { |
| 824 | 824 | ret = -ENXIO; |
| 825 | 825 | dev_err(&pdev->dev, "request_irq failed\n"); |
| 826 | − goto clk_dis_all; | |
| 826 | + goto err_disable_rpm; | |
| 827 | 827 | } |
| 828 | 828 | |
| 829 | 829 | ctlr->use_gpio_descriptors = true; |
| @@ -842,23 +842,26 @@ static int ax_spi_probe(struct platform_device *pdev) · 12 unmodified lines | ||
| 842 | 842 | |
| 843 | 843 | ctlr->bits_per_word_mask = SPI_BPW_MASK(8); |
| 844 | 844 | |
| 845 | − pm_runtime_put_autosuspend(&pdev->dev); | |
| 846 | − | |
| 847 | 845 | ctlr->mem_ops = &ax_spi_mem_ops; |
| 848 | 846 | |
| 849 | 847 | ret = spi_register_controller(ctlr); |
| 850 | 848 | if (ret) { |
| 851 | 849 | dev_err(&pdev->dev, "spi_register_controller failed\n"); |
| 852 | − goto clk_dis_all; | |
| 850 | + goto err_disable_rpm; | |
| 853 | 851 | } |
| 854 | 852 | |
| 855 | − return ret; | |
| 853 | + pm_runtime_put_autosuspend(&pdev->dev); | |
| 856 | 854 | |
| 857 | −clk_dis_all: | |
| 858 | − pm_runtime_set_suspended(&pdev->dev); | |
| 855 | + return 0; | |
| 856 | + | |
| 857 | +err_disable_rpm: | |
| 859 | 858 | pm_runtime_disable(&pdev->dev); |
| 859 | + pm_runtime_put_noidle(&pdev->dev); | |
| 860 | + pm_runtime_set_suspended(&pdev->dev); | |
| 861 | + pm_runtime_dont_use_autosuspend(&pdev->dev); | |
| 862 | + | |
| 860 | 863 | clk_disable_unprepare(xspi->ref_clk); |
| 861 | −clk_dis_apb: | |
| 864 | +err_disable_apb: | |
| 862 | 865 | clk_disable_unprepare(xspi->pclk); |
| 863 | 866 | |
| 864 | 867 | return ret; |
| @@ -877,10 +880,14 @@ static void ax_spi_remove(struct platform_device *pdev) · 12 unmodified lines | ||
| 877 | 880 | struct spi_controller *ctlr = platform_get_drvdata(pdev); |
| 878 | 881 | struct ax_spi *xspi = spi_controller_get_devdata(ctlr); |
| 879 | 882 | |
| 883 | + pm_runtime_get_sync(&pdev->dev); | |
| 884 | + | |
| 880 | 885 | spi_unregister_controller(ctlr); |
| 881 | 886 | |
| 882 | − pm_runtime_set_suspended(&pdev->dev); | |
| 883 | 887 | pm_runtime_disable(&pdev->dev); |
| 888 | + pm_runtime_put_noidle(&pdev->dev); | |
| 889 | + pm_runtime_set_suspended(&pdev->dev); | |
| 890 | + pm_runtime_dont_use_autosuspend(&pdev->dev); | |
| 884 | 891 | |
| 885 | 892 | clk_disable_unprepare(xspi->ref_clk); |
| 886 | 893 | clk_disable_unprepare(xspi->pclk); |