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] [day] [month] [year] [list]
Date:	Tue, 06 Jan 2015 15:57:02 +0300
From:	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To:	Zubair Lutfullah Kakakhel <Zubair.Kakakhel@...tec.com>,
	davem@...emloft.net
CC:	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
	netdev@...r.kernel.org, s.hauer@...gutronix.de
Subject: Re: [PATCH_V3] dm9000: Add regulator and reset support to dm9000

Hello.

On 1/6/2015 2:15 PM, Zubair Lutfullah Kakakhel wrote:

> In boards, the dm9000 chip's power and reset can be controlled by gpio.

> It makes sense to add them to the dm9000 driver and let dt be used to
> enable power and reset the phy.

> Signed-off-by: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@...tec.com>
> Signed-off-by: Paul Burton <paul.burton@...tec.com>

[...]

> diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c
> index ef0bb58..246c89d 100644
> --- a/drivers/net/ethernet/davicom/dm9000.c
> +++ b/drivers/net/ethernet/davicom/dm9000.c
[...]
> @@ -1426,11 +1429,49 @@ dm9000_probe(struct platform_device *pdev)
>   	struct dm9000_plat_data *pdata = dev_get_platdata(&pdev->dev);
>   	struct board_info *db;	/* Point a board information structure */
>   	struct net_device *ndev;
> +	struct device *dev = &pdev->dev;
>   	const unsigned char *mac_src;
>   	int ret = 0;
>   	int iosize;
>   	int i;
>   	u32 id_val;
> +	int reset_gpios;
> +	enum of_gpio_flags flags;
> +	struct regulator *power;
> +
> +	power = devm_regulator_get(dev, "vcc");
> +	if (PTR_ERR(power) == -EPROBE_DEFER)
> +			return -EPROBE_DEFER;

    Line over-indented.

[...]
> +	reset_gpios = of_get_named_gpio_flags(dev->of_node, "reset-gpios", 0,
> +					      &flags);
> +	if (gpio_is_valid(reset_gpios)) {
> +		ret = devm_gpio_request_one(dev, reset_gpios, flags,
> +					    "dm9000_reset");
> +		if (ret) {
> +			dev_err(dev, "failed to request reset gpio %d: %d\n",
> +				reset_gpios, ret);
> +			return -ENODEV;
> +		}
> +
> +		gpio_direction_output(reset_gpios, 0);

    You could skip this call as devm_gpio_request_one() can handle that for you.

[...]

WBR, Sergei

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ