[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAFaeLdS5zLz+E0M32J47QBfxR_0EkM7erEJCdHnQ__G4R7XYCA@mail.gmail.com>
Date: Sat, 17 Mar 2018 01:47:01 +0800
From: 李書帆 <leechu729@...il.com>
To: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
Cc: Greg KH <greg@...ah.com>, Guenter Roeck <linux@...ck-us.net>,
shufan_lee(李書帆) <shufan_lee@...htek.com>,
cy_huang(黃啟原) <cy_huang@...htek.com>,
Jun Li <jun.li@....com>, linux-kernel@...r.kernel.org,
linux-usb@...r.kernel.org
Subject: Re: [PATCH] staging: typec: rt1711h typec chip driver
Hi Heikki,
2018-03-16 23:05 GMT+08:00 Heikki Krogerus <heikki.krogerus@...ux.intel.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
Thank you, I've changed it in PATCH v2.
May I add you to Suggested-by list?
--
Best Regards,
書帆
Powered by blists - more mailing lists