Re: [PATCH] net: sky2: allow mac to come from dt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Tue, Mar 4, 2014 at 10:32 PM, Rob Herring <robherring2@xxxxxxxxx> wrote:
<snip>
>> @@ -4805,8 +4808,27 @@ static struct net_device *sky2_init_netdev(struct sky2_hw *hw, unsigned port,
>>
>>         dev->features |= dev->hw_features;
>>
>> +       /* try to get mac address in the following order:
>> +        * 1) from device tree data
>> +        * 2) from internal registers set by bootloader
>> +        */
>> +       iap = NULL;
>> +       if (IS_ENABLED(CONFIG_OF)) {
>
> This shouldn't be needed.
>
>> +               struct device_node *np = hw->pdev->dev.of_node;
>> +               if (np)
>> +                       iap = (unsigned char *) of_get_mac_address(np);
>> +       }
>
> This should all just be 1 line. of_get_mac_address should just return
> NULL if !CONFIG_OF or np == NULL.

agreed - I verified this is true

>
>> +
>> +       /* 2) mac registers set by bootloader
>> +        */
>> +       if (!iap || !is_valid_ether_addr(iap)) {
>
> Perhaps is_valid_ether_addr check should also be moved into of_get_mac_address.
>

looks like it already does that - I'll simplify the above

> Rob

Thanks for the review!

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




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux