public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: ShuFan Lee <leechu729@gmail.com>
Cc: greg@kroah.com, linux@roeck-us.net, shufan_lee@richtek.com,
	cy_huang@richtek.com, jun.li@nxp.com,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH] staging: typec: rt1711h typec chip driver
Date: Fri, 16 Mar 2018 17:05:55 +0200	[thread overview]
Message-ID: <20180316150555.GE11689@kuha.fi.intel.com> (raw)
In-Reply-To: <1521191569-21221-1-git-send-email-leechu729@gmail.com>

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

  parent reply	other threads:[~2018-03-16 15:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-16  9:12 [PATCH] staging: typec: rt1711h typec chip driver ShuFan Lee
2018-03-16 12:58 ` Greg KH
2018-03-16 13:29   ` Mats Karrman
2018-03-16 13:39     ` 李書帆
2018-03-16 15:05 ` Heikki Krogerus [this message]
2018-03-16 17:47   ` 李書帆

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180316150555.GE11689@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=cy_huang@richtek.com \
    --cc=greg@kroah.com \
    --cc=jun.li@nxp.com \
    --cc=leechu729@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=shufan_lee@richtek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox