lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 4 Jun 2016 22:00:16 +0200
From:	Andrew Lunn <andrew@...n.ch>
To:	Florian Fainelli <f.fainelli@...il.com>
Cc:	netdev@...r.kernel.org, davem@...emloft.net,
	vivien.didelot@...oirfairelinux.com, john@...ozen.org
Subject: Re: [PATCH net-next 2/9] net: dsa: Add support for parsing the old
 binding

> -static int dsa_cpu_parse(struct device_node *port, u32 index,
> -			 struct dsa_switch_tree *dst,
> -			 struct dsa_switch *ds)
> +static int _dsa_cpu_parse(struct dsa_switch_tree *dst,
> +			   struct dsa_switch *ds,
> +			   struct net_device *ethernet_dev,
> +			   u32 index)
>  {
> -	struct net_device *ethernet_dev;
> -	struct device_node *ethernet;
> -
> -	ethernet = of_parse_phandle(port, "ethernet", 0);
> -	if (!ethernet)
> -		return -EINVAL;
> -
> -	ethernet_dev = of_find_net_device_by_node(ethernet);
> -	if (!ethernet_dev)
> -		return -EPROBE_DEFER;
> -

Hi Florian

You have just removed all the actual DT parsing. So i would give this
a different name, and avoid the _ prefix.

> +static int _dsa_register_switch_legacy(struct dsa_switch *ds, struct device_node *np)
> +{

We might want to call this _dsa_register_switch_legacy_sf2, since the
code only supports what is needed for your rather odd sf2 binding. It
does not appear to work for the generic DSA binding.

>  static int __dsa_register_switch(struct dsa_switch *ds, struct device_node *np)
>  {
>  	struct device_node *ports = dsa_get_ports(ds, np);
> @@ -626,8 +736,8 @@ static int _dsa_register_switch(struct dsa_switch *ds, struct device_node *np)
>  {
>  	struct device_node *ports = dsa_get_ports(ds, np);
>  
> -	if (IS_ERR(ports))
> -		return PTR_ERR(ports);
> +	if (IS_ERR(ports) && PTR_ERR(ports) == -EINVAL)
> +		return _dsa_register_switch_legacy(ds, np);

Maybe put this inside if config_enabled(CONFIG_NET_DSA_BCM_SF2)  {}?

      Andrew

Powered by blists - more mailing lists