Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jacky Huang <ychuang570808@gmail.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: linus.walleij@linaro.org, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org,
	p.zabel@pengutronix.de, j.neuschaefer@gmx.net,
	linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	ychuang3@nuvoton.com, schung@nuvoton.com
Subject: Re: [PATCH v6 3/3] pinctrl: nuvoton: Add ma35d1 pinctrl and GPIO driver
Date: Wed, 13 Mar 2024 18:25:34 +0800	[thread overview]
Message-ID: <cb19954a-5f4e-4c39-8944-5f02d3221d79@gmail.com> (raw)
In-Reply-To: <5c555723-1731-40cc-b9be-a88ef617e09f@moroto.mountain>



On 2024/3/13 下午 04:04, Dan Carpenter wrote:
> On Wed, Mar 13, 2024 at 03:57:19AM +0000, Jacky Huang wrote:
>> +static int ma35_gpiolib_register(struct platform_device *pdev, struct ma35_pinctrl *npctl)
>> +{
>> +	struct ma35_pin_ctrl *ctrl = npctl->ctrl;
>> +	struct ma35_pin_bank *bank = ctrl->pin_banks;
>> +	int ret;
>> +	int i;
>> +
>> +	for (i = 0; i < ctrl->nr_banks; ++i, ++bank) {
>> +		if (!bank->valid) {
>> +			dev_warn(&pdev->dev, "bank %s is not valid\n",
>> +				 bank->np->name);
>> +			continue;
>> +		}
>> +		bank->irqtype = 0;
>> +		bank->irqinten = 0;
>> +		bank->chip.label = bank->name;
>> +		bank->chip.of_gpio_n_cells = 2;
>> +		bank->chip.parent = &pdev->dev;
>> +		bank->chip.request = ma35_gpio_core_to_request;
>> +		bank->chip.direction_input = ma35_gpio_core_direction_in;
>> +		bank->chip.direction_output = ma35_gpio_core_direction_out;
>> +		bank->chip.get = ma35_gpio_core_get;
>> +		bank->chip.set = ma35_gpio_core_set;
>> +		bank->chip.base = -1;
>> +		bank->chip.ngpio = bank->nr_pins;
>> +		bank->chip.can_sleep = false;
>> +		spin_lock_init(&bank->lock);
>> +
>> +		if (bank->irq > 0) {
>> +			struct gpio_irq_chip *girq;
>> +
>> +			girq = &bank->chip.irq;
>> +			gpio_irq_chip_set_chip(girq, &ma35_gpio_irqchip);
>> +			girq->parent_handler = ma35_irq_demux_intgroup;
>> +			girq->num_parents = 1;
>> +
>> +			girq->parents = devm_kcalloc(&pdev->dev, 1, sizeof(*girq->parents),
>> +						     GFP_KERNEL);
>> +			if (!girq->parents)
>> +				return -ENOMEM;
> ret = -ENOMEM;
> goto fail;
>
> regards,
> dan carpenter

Thanks, I will fix it.

>> +
>> +			girq->parents[0] = bank->irq;
>> +			girq->default_type = IRQ_TYPE_NONE;
>> +			girq->handler = handle_level_irq;
>> +		}
>> +
>> +		ret = gpiochip_add_data(&bank->chip, bank);
>> +		if (ret) {
>> +			dev_err(&pdev->dev, "failed to register gpio_chip %s, error code: %d\n",
>> +				bank->chip.label, ret);
>> +			goto fail;
>> +		}
>> +	}
>> +	return 0;
>> +
>> +fail:
>> +	for (--i, --bank; i >= 0; --i, --bank) {
>> +		if (!bank->valid)
>> +			continue;
>> +		gpiochip_remove(&bank->chip);
>> +	}
>> +	return ret;
>> +}

Best Regards,
Jacky Huang


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2024-03-13 10:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-13  3:57 [PATCH v6 0/3] Add support for nuvoton ma35d1 pin control Jacky Huang
2024-03-13  3:57 ` [PATCH v6 1/3] dt-bindings: reset: Add syscon to nuvoton ma35d1 system-management node Jacky Huang
2024-03-13  3:57 ` [PATCH v6 2/3] dt-bindings: pinctrl: Document nuvoton ma35d1 pin control Jacky Huang
2024-03-13  3:57 ` [PATCH v6 3/3] pinctrl: nuvoton: Add ma35d1 pinctrl and GPIO driver Jacky Huang
2024-03-13  8:04   ` Dan Carpenter
2024-03-13 10:25     ` Jacky Huang [this message]
2024-03-28  9:10   ` Linus Walleij
2024-03-29  8:17     ` Jacky Huang

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=cb19954a-5f4e-4c39-8944-5f02d3221d79@gmail.com \
    --to=ychuang570808@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=j.neuschaefer@gmx.net \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --cc=schung@nuvoton.com \
    --cc=ychuang3@nuvoton.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