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: <20180316150555.GE11689@kuha.fi.intel.com>
Date:   Fri, 16 Mar 2018 17:05:55 +0200
From:   Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To:     ShuFan Lee <leechu729@...il.com>
Cc:     greg@...ah.com, linux@...ck-us.net, shufan_lee@...htek.com,
        cy_huang@...htek.com, jun.li@....com, linux-kernel@...r.kernel.org,
        linux-usb@...r.kernel.org
Subject: Re: [PATCH] staging: typec: rt1711h typec chip driver

Hi ShuFan,

On Fri, Mar 16, 2018 at 05:12:49PM +0800, ShuFan Lee wrote:
> +static int rt1711h_init_gpio(struct rt1711h_chip *chip)
> +{
> +	int ret;
> +	struct device_node *np = chip->dev->of_node;
> +
> +	ret = of_get_named_gpio(np, "rt,intr_gpio", 0);
> +	if (ret < 0) {
> +		dev_err(chip->dev, "%s get int gpio fail(%d)\n", __func__, ret);
> +		return ret;
> +	}
> +	chip->irq_gpio = ret;
> +
> +	ret = devm_gpio_request_one(chip->dev, chip->irq_gpio, GPIOF_IN,
> +				    dev_name(chip->dev));
> +	if (ret < 0) {
> +		dev_err(chip->dev, "%s request gpio fail(%d)\n", __func__, ret);
> +		return ret;
> +	}
> +
> +	chip->irq = gpio_to_irq(chip->irq_gpio);
> +	if (chip->irq <= 0) {
> +		dev_err(chip->dev, "%s gpio2irq fail(%d)\n", __func__,
> +			chip->irq);
> +		return -EINVAL;
> +	}
> +	return 0;

"rt,intr_gpio" should probable be "rt,intr-gpio". Then this function
can be prepared for all types of platforms:

static int rt1711h_init_gpio(struct rt1711h_chip *chip)
{
        struct gpio_desc *gpio;

        gpio = devm_gpiod_get(chip->dev, "rt,intr", GFP_KERNEL);
        if (IS_ERR(gpio))
                return PTR_ERR(gpio);

        chip->irq = gpiod_to_irq(gpio);
	if (chip->irq < 0)
		return chip->irq;

	return 0;
}


Thanks,

-- 
heikki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ