diff mbox

[2/2] spi: xlp: Add ACPI support for Vulcan SPI controller

Message ID 1470658708-8203-2-git-send-email-kamlakant.patel@broadcom.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kamlakant Patel Aug. 8, 2016, 12:18 p.m. UTC
From: Kamlakant Patel <kamlakant.patel@broadcom.com>

Add ACPI support for SPI controller on Broadcom Vulcan ARM64.

Signed-off-by: Kamlakant Patel <kamlakant.patel@broadcom.com>
---
 drivers/spi/spi-xlp.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

Comments

Mark Brown Aug. 8, 2016, 1:14 p.m. UTC | #1
On Mon, Aug 08, 2016 at 05:48:28PM +0530, kamlakant.patel@broadcom.com wrote:

> -	if (IS_ERR(clk)) {
> -		dev_err(&pdev->dev, "could not get spi clock\n");
> -		return -ENODEV;
> -	}
> +	if (IS_ERR(clk))
> +		return -EPROBE_DEFER;
> +

No, this is broken - if there really is a fatal error it'll silently
discard it and replace it with -EPROBE_DEFER.  This will cause things to
be incorrectly deferred if there is a real error making it harder for
people to diagnose problems.  You should just pass the error code you
get back to the caller.
diff mbox

Patch

diff --git a/drivers/spi/spi-xlp.c b/drivers/spi/spi-xlp.c
index 8f04fec..63483f5 100644
--- a/drivers/spi/spi-xlp.c
+++ b/drivers/spi/spi-xlp.c
@@ -11,6 +11,7 @@ 
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  */
+#include <linux/acpi.h>
 #include <linux/clk.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
@@ -403,10 +404,9 @@  static int xlp_spi_probe(struct platform_device *pdev)
 	}
 
 	clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(clk)) {
-		dev_err(&pdev->dev, "could not get spi clock\n");
-		return -ENODEV;
-	}
+	if (IS_ERR(clk))
+		return -EPROBE_DEFER;
+
 	xspi->spi_clk = clk_get_rate(clk);
 
 	master = spi_alloc_master(&pdev->dev, 0);
@@ -437,6 +437,14 @@  static int xlp_spi_probe(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_ACPI
+static const struct acpi_device_id xlp_spi_acpi_match[] = {
+	{ "BRCM900D", 0 },
+	{ },
+};
+MODULE_DEVICE_TABLE(acpi, xlp_spi_acpi_match);
+#endif
+
 static const struct of_device_id xlp_spi_dt_id[] = {
 	{ .compatible = "netlogic,xlp832-spi" },
 	{ },
@@ -447,6 +455,7 @@  static struct platform_driver xlp_spi_driver = {
 	.driver = {
 		.name	= "xlp-spi",
 		.of_match_table = xlp_spi_dt_id,
+		.acpi_match_table = ACPI_PTR(xlp_spi_acpi_match),
 	},
 };
 module_platform_driver(xlp_spi_driver);