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  linux-hardening  linux-cve-announce  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]
Message-ID: <20170313164118.GE3953@lunn.ch>
Date:   Mon, 13 Mar 2017 17:41:18 +0100
From:   Andrew Lunn <andrew@...n.ch>
To:     sean.wang@...iatek.com
Cc:     f.fainelli@...il.com, vivien.didelot@...oirfairelinux.com,
        matthias.bgg@...il.com, robh+dt@...nel.org, mark.rutland@....com,
        devicetree@...r.kernel.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-mediatek@...ts.infradead.org,
        davem@...emloft.net, Landen.Chao@...iatek.com, keyhaede@...il.com,
        objelf@...il.com
Subject: Re: [PATCH net-next 4/4] net-next: dsa: add dsa support for Mediatek
 MT7530 switch

Hi Sean

Just looking at the GPIO handling at the moment.

> +	/* Reset whole chip through gpio pin or
> +	 * memory-mapped registers for different
> +	 * type of hardware
> +	 */
> +	if (priv->mcm) {
> +		regmap_update_bits(priv->ethsys, SYSC_REG_RSTCTRL,
> +				   RESET_MCM, RESET_MCM);
> +		usleep_range(1000, 1100);
> +		regmap_update_bits(priv->ethsys, SYSC_REG_RSTCTRL,
> +				   RESET_MCM, ~RESET_MCM);
> +	} else {
> +		gpio_direction_output(priv->reset, 0);
> +		usleep_range(1000, 1100);
> +		gpio_set_value(priv->reset, 1);
> +	}

....

> +	/* Not MCM that indicates switch works as the remote standalone
> +	 * integrated circuit so the GPIO pin would be used to complete
> +	 * the reset, otherwise memory-mapped register accessing used
> +	 * through syscon provides in the case of MCM.
> +	 */
> +	if (!priv->mcm) {
> +		priv->reset = of_get_named_gpio(dn, "mediatek,reset-pin", 0);
> +		if (!gpio_is_valid(priv->reset))
> +			return priv->reset;
> +
> +		ret = devm_gpio_request_one(&mdiodev->dev,
> +					    priv->reset, GPIOF_OUT_INIT_LOW,
> +					    "mediatek,reset-pin");
> +		if (ret < 0) {
> +			dev_err(&mdiodev->dev,
> +				"fail to devm_gpio_request reset\n");
> +			return ret;
> +		}
> +	}

You are not handling the flags part of the GPIO binding. It is better
to use devm_gpiod_ API calls, which will handle the active low flags
for you.

    Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ