diff mbox

[v2] spi: spi-mpc512x-psc: don't use obsolet cell-index property

Message ID 1357862748-14130-1-git-send-email-agust@denx.de (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Anatolij Gustschin Jan. 11, 2013, 12:05 a.m. UTC
Remove deprecated cell-index property and use spi alias to
obtain the SPI PSC number used for SPI bus id.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
v2:
 - use of_alias_get_id() to get spi bus number

 drivers/spi/spi-mpc512x-psc.c |   16 +++++-----------
 1 files changed, 5 insertions(+), 11 deletions(-)

Comments

Grant Likely Feb. 5, 2013, 2:09 p.m. UTC | #1
On Fri, 11 Jan 2013 01:05:48 +0100, Anatolij Gustschin <agust@denx.de> wrote:
> Remove deprecated cell-index property and use spi alias to
> obtain the SPI PSC number used for SPI bus id.
> 
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> ---
> v2:
>  - use of_alias_get_id() to get spi bus number
> 

Applied, thanks.

g.

>  drivers/spi/spi-mpc512x-psc.c |   16 +++++-----------
>  1 files changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c
> index cb3a310..88e5441 100644
> --- a/drivers/spi/spi-mpc512x-psc.c
> +++ b/drivers/spi/spi-mpc512x-psc.c
> @@ -522,17 +522,11 @@ static int mpc512x_psc_spi_of_probe(struct platform_device *op)
>  	regaddr64 = of_translate_address(op->dev.of_node, regaddr_p);
>  
>  	/* get PSC id (0..11, used by port_config) */
> -	if (op->dev.platform_data == NULL) {
> -		const u32 *psc_nump;
> -
> -		psc_nump = of_get_property(op->dev.of_node, "cell-index", NULL);
> -		if (!psc_nump || *psc_nump > 11) {
> -			dev_err(&op->dev, "mpc512x_psc_spi: Device node %s "
> -				"has invalid cell-index property\n",
> -				op->dev.of_node->full_name);
> -			return -EINVAL;
> -		}
> -		id = *psc_nump;
> +	id = of_alias_get_id(op->dev.of_node, "spi");
> +	if (id < 0) {
> +		dev_err(&op->dev, "no alias id for %s\n",
> +			op->dev.of_node->full_name);
> +		return id;
>  	}
>  
>  	return mpc512x_psc_spi_do_probe(&op->dev, (u32) regaddr64, (u32) size64,
> -- 
> 1.7.5.4
>
diff mbox

Patch

diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c
index cb3a310..88e5441 100644
--- a/drivers/spi/spi-mpc512x-psc.c
+++ b/drivers/spi/spi-mpc512x-psc.c
@@ -522,17 +522,11 @@  static int mpc512x_psc_spi_of_probe(struct platform_device *op)
 	regaddr64 = of_translate_address(op->dev.of_node, regaddr_p);
 
 	/* get PSC id (0..11, used by port_config) */
-	if (op->dev.platform_data == NULL) {
-		const u32 *psc_nump;
-
-		psc_nump = of_get_property(op->dev.of_node, "cell-index", NULL);
-		if (!psc_nump || *psc_nump > 11) {
-			dev_err(&op->dev, "mpc512x_psc_spi: Device node %s "
-				"has invalid cell-index property\n",
-				op->dev.of_node->full_name);
-			return -EINVAL;
-		}
-		id = *psc_nump;
+	id = of_alias_get_id(op->dev.of_node, "spi");
+	if (id < 0) {
+		dev_err(&op->dev, "no alias id for %s\n",
+			op->dev.of_node->full_name);
+		return id;
 	}
 
 	return mpc512x_psc_spi_do_probe(&op->dev, (u32) regaddr64, (u32) size64,