Subject: Re: [PATCH v4 2/8] net: can: c_can: Introduce c_can_driver_data structure

From: Marc Kleine-Budde <[email-masked]>
Date: Thu, 13 Nov 2014 11:57:50 +0100

On 11/07/2014 03:49 PM, Roger Quadros wrote:
> We want to have more data than just can_dev_id to be present
> in the driver data e.g. TI platforms need RAMINIT register
> description. Introduce the c_can_driver_data structure and move
> the can_dev_id into it.
> 
> Tidy up the way it is used on probe().
> 
> Signed-off-by: Roger Quadros <[email-masked]>

[...]

> @@ -198,21 +206,19 @@ static int c_can_plat_probe(struct platform_device *pdev)
>  	struct net_device *dev;
>  	struct c_can_priv *priv;
>  	const struct of_device_id *match;
> -	const struct platform_device_id *id;
>  	struct resource *mem, *res;
>  	int irq;
>  	struct clk *clk;
> -
> -	if (pdev->dev.of_node) {
> -		match = of_match_device(c_can_of_table, &pdev->dev);
> -		if (!match) {
> -			dev_err(&pdev->dev, "Failed to find matching dt id\n");
> -			ret = -EINVAL;
> -			goto exit;
> -		}
> -		id = match->data;
> +	const struct c_can_driver_data *drvdata;
> +
> +	match = of_match_device(c_can_of_table, &pdev->dev);
> +	if (match) {
> +		drvdata = match->data;
> +	} else if (pdev->id_entry->driver_data) {
> +		drvdata = (struct c_can_driver_data *)
> +			   pdev->id_entry->driver_data;
                           ^^^^^^^^^^^^^^
I've changes this to platform_get_device_id() while aplying.

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |