[v3] spi: orion: support armada extended baud rates
diff mbox

Message ID 543C8460.1060508@uclinux.org
State New, archived
Headers show

Commit Message

Greg Ungerer Oct. 14, 2014, 2:03 a.m. UTC
Hi Karl,

On 12/10/14 00:52, Karl Beldan wrote:
> On 28/09/14 23:24:04, Greg Ungerer wrote:
>> @@ -378,6 +452,10 @@ static int orion_spi_probe(struct platform_device *pdev)
>>  	spi = spi_master_get_devdata(master);
>>  	spi->master = master;
>>  
>> +	of_id = of_match_device(orion_spi_of_match_table, &pdev->dev);
>> +	devdata = of_id->data;
>> +	spi->devdata = devdata;
>> +
> Won't of_match_device return NULL on non-DT systems, and further
> references oops ?

Yes, sure enough.

So I propose to fix with this change.



Mark: This was generated on linux-3.17-rc7 with the first spi-orion
patch applied. What do you want it generated against?

Regards
Greg


--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Karl Beldan Oct. 15, 2014, 1:10 p.m. UTC | #1
On Tue, Oct 14, 2014 at 12:03:12PM +1000, Greg Ungerer wrote:
> Hi Karl,
> 
> On 12/10/14 00:52, Karl Beldan wrote:
> > On 28/09/14 23:24:04, Greg Ungerer wrote:
> >> @@ -378,6 +452,10 @@ static int orion_spi_probe(struct platform_device *pdev)
> >>  	spi = spi_master_get_devdata(master);
> >>  	spi->master = master;
> >>  
> >> +	of_id = of_match_device(orion_spi_of_match_table, &pdev->dev);
> >> +	devdata = of_id->data;
> >> +	spi->devdata = devdata;
> >> +
> > Won't of_match_device return NULL on non-DT systems, and further
> > references oops ?
> 
> Yes, sure enough.
> 
> So I propose to fix with this change.
> 
> diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c
> index acf8e48..c069ccd 100644
> --- a/drivers/spi/spi-orion.c
> +++ b/drivers/spi/spi-orion.c
> @@ -453,7 +453,7 @@ static int orion_spi_probe(struct platform_device *pdev)
>         spi->master = master;
>  
>         of_id = of_match_device(orion_spi_of_match_table, &pdev->dev);
> -       devdata = of_id->data;
> +       devdata = (of_id) ? of_id->data : &orion_spi_dev_data;
>         spi->devdata = devdata;
>  
I am not aware of the policy in the DT subsystem, I see some drivers
bailing out when not getting any match, some remove non-DT support and
add a dependency on OF, yet a message would feel appropriate.
Other than that ok, it should fix df59fa7f4bca.
 
Karl
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Greg Ungerer Oct. 17, 2014, 4:53 a.m. UTC | #2
Hi Karl,

On 15/10/14 23:10, Karl Beldan wrote:
> On Tue, Oct 14, 2014 at 12:03:12PM +1000, Greg Ungerer wrote:
>> Hi Karl,
>>
>> On 12/10/14 00:52, Karl Beldan wrote:
>>> On 28/09/14 23:24:04, Greg Ungerer wrote:
>>>> @@ -378,6 +452,10 @@ static int orion_spi_probe(struct platform_device *pdev)
>>>>  	spi = spi_master_get_devdata(master);
>>>>  	spi->master = master;
>>>>  
>>>> +	of_id = of_match_device(orion_spi_of_match_table, &pdev->dev);
>>>> +	devdata = of_id->data;
>>>> +	spi->devdata = devdata;
>>>> +
>>> Won't of_match_device return NULL on non-DT systems, and further
>>> references oops ?
>>
>> Yes, sure enough.
>>
>> So I propose to fix with this change.
>>
>> diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c
>> index acf8e48..c069ccd 100644
>> --- a/drivers/spi/spi-orion.c
>> +++ b/drivers/spi/spi-orion.c
>> @@ -453,7 +453,7 @@ static int orion_spi_probe(struct platform_device *pdev)
>>         spi->master = master;
>>  
>>         of_id = of_match_device(orion_spi_of_match_table, &pdev->dev);
>> -       devdata = of_id->data;
>> +       devdata = (of_id) ? of_id->data : &orion_spi_dev_data;
>>         spi->devdata = devdata;
>>  
> I am not aware of the policy in the DT subsystem, I see some drivers
> bailing out when not getting any match, some remove non-DT support and
> add a dependency on OF, yet a message would feel appropriate.
> Other than that ok, it should fix df59fa7f4bca.

Before the recent changes this driver didn't call of_match_device().
With the above fix in place if it does return NULL then it will behave
the same as it used to - using the default orion parameters. I think
that is the ideal behavior.

Regards
Greg




--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c
index acf8e48..c069ccd 100644
--- a/drivers/spi/spi-orion.c
+++ b/drivers/spi/spi-orion.c
@@ -453,7 +453,7 @@  static int orion_spi_probe(struct platform_device *pdev)
        spi->master = master;
 
        of_id = of_match_device(orion_spi_of_match_table, &pdev->dev);
-       devdata = of_id->data;
+       devdata = (of_id) ? of_id->data : &orion_spi_dev_data;
        spi->devdata = devdata;
 
        spi->clk = devm_clk_get(&pdev->dev, NULL);