diff mbox

[02/14] net: dsa: Report known silicon revisions for Marvell 88E6060

Message ID 1414037002-25528-3-git-send-email-linux@roeck-us.net
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Guenter Roeck Oct. 23, 2014, 4:03 a.m. UTC
Report known silicon revisions when probing Marvell 88E6060 switches.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/net/dsa/mv88e6060.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Sergei Shtylyov Oct. 23, 2014, 12:51 p.m. UTC | #1
Hello.

On 10/23/2014 8:03 AM, Guenter Roeck wrote:

> Report known silicon revisions when probing Marvell 88E6060 switches.

> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>   drivers/net/dsa/mv88e6060.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)

> diff --git a/drivers/net/dsa/mv88e6060.c b/drivers/net/dsa/mv88e6060.c
> index 05b0ca3..c29aebe 100644
> --- a/drivers/net/dsa/mv88e6060.c
> +++ b/drivers/net/dsa/mv88e6060.c
> @@ -69,8 +69,11 @@ static char *mv88e6060_probe(struct device *host_dev, int sw_addr)
>
>   	ret = mdiobus_read(bus, sw_addr + REG_PORT(0), 0x03);
>   	if (ret >= 0) {
> -		ret &= 0xfff0;
>   		if (ret == 0x0600)
> +			return "Marvell 88E6060 (A0)";
> +		if (ret == 0x0601 || ret == 0x0602)

    *else* *if*.

> +			return "Marvell 88E6060 (B0)";
> +		if ((ret & 0xfff0) == 0x0600)

    Likewise?

>   			return "Marvell 88E6060";
>   	}

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Guenter Roeck Oct. 23, 2014, 1:20 p.m. UTC | #2
On 10/23/2014 05:51 AM, Sergei Shtylyov wrote:
> Hello.
>
> On 10/23/2014 8:03 AM, Guenter Roeck wrote:
>
>> Report known silicon revisions when probing Marvell 88E6060 switches.
>
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>> ---
>>   drivers/net/dsa/mv88e6060.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>
>> diff --git a/drivers/net/dsa/mv88e6060.c b/drivers/net/dsa/mv88e6060.c
>> index 05b0ca3..c29aebe 100644
>> --- a/drivers/net/dsa/mv88e6060.c
>> +++ b/drivers/net/dsa/mv88e6060.c
>> @@ -69,8 +69,11 @@ static char *mv88e6060_probe(struct device *host_dev, int sw_addr)
>>
>>       ret = mdiobus_read(bus, sw_addr + REG_PORT(0), 0x03);
>>       if (ret >= 0) {
>> -        ret &= 0xfff0;
>>           if (ret == 0x0600)
>> +            return "Marvell 88E6060 (A0)";
>> +        if (ret == 0x0601 || ret == 0x0602)
>
>     *else* *if*.
>
>> +            return "Marvell 88E6060 (B0)";
>> +        if ((ret & 0xfff0) == 0x0600)
>
>     Likewise?
>

The if case returns, so the else would just introduce an unnecessary
additional level of indentation. I think nowadays even checkpatch
complains about an unnecessary else after return.

Thanks,
Guenter

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov Oct. 23, 2014, 4 p.m. UTC | #3
On 10/23/2014 05:20 PM, Guenter Roeck wrote:

>>> Report known silicon revisions when probing Marvell 88E6060 switches.

>>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>>> ---
>>>   drivers/net/dsa/mv88e6060.c | 5 ++++-
>>>   1 file changed, 4 insertions(+), 1 deletion(-)

>>> diff --git a/drivers/net/dsa/mv88e6060.c b/drivers/net/dsa/mv88e6060.c
>>> index 05b0ca3..c29aebe 100644
>>> --- a/drivers/net/dsa/mv88e6060.c
>>> +++ b/drivers/net/dsa/mv88e6060.c
>>> @@ -69,8 +69,11 @@ static char *mv88e6060_probe(struct device *host_dev,
>>> int sw_addr)
>>>
>>>       ret = mdiobus_read(bus, sw_addr + REG_PORT(0), 0x03);
>>>       if (ret >= 0) {
>>> -        ret &= 0xfff0;
>>>           if (ret == 0x0600)
>>> +            return "Marvell 88E6060 (A0)";
>>> +        if (ret == 0x0601 || ret == 0x0602)

>>     *else* *if*.

>>> +            return "Marvell 88E6060 (B0)";
>>> +        if ((ret & 0xfff0) == 0x0600)

>>     Likewise?

> The if case returns, so the else would just introduce an unnecessary
> additional level of indentation.

    Not really.

> I think nowadays even checkpatch
> complains about an unnecessary else after return.

    You're right about the *return* though. I should have stayed silent.

> Thanks,
> Guenter

WBR, Sergei

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

Patch

diff --git a/drivers/net/dsa/mv88e6060.c b/drivers/net/dsa/mv88e6060.c
index 05b0ca3..c29aebe 100644
--- a/drivers/net/dsa/mv88e6060.c
+++ b/drivers/net/dsa/mv88e6060.c
@@ -69,8 +69,11 @@  static char *mv88e6060_probe(struct device *host_dev, int sw_addr)
 
 	ret = mdiobus_read(bus, sw_addr + REG_PORT(0), 0x03);
 	if (ret >= 0) {
-		ret &= 0xfff0;
 		if (ret == 0x0600)
+			return "Marvell 88E6060 (A0)";
+		if (ret == 0x0601 || ret == 0x0602)
+			return "Marvell 88E6060 (B0)";
+		if ((ret & 0xfff0) == 0x0600)
 			return "Marvell 88E6060";
 	}