From: andy.shevchenko@gmail.com
To: Yinbo Zhu <zhuyinbo@loongson.cn>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, Jianmin Lv <lvjianmin@loongson.cn>,
wanghongliang@loongson.cn, loongson-kernel@lists.loongnix.cn
Subject: Re: [PATCH v3 2/2] gpio: loongson: add firmware offset parse support
Date: Tue, 15 Aug 2023 00:48:35 +0300 [thread overview]
Message-ID: <ZNqhM18XoaqNdN99@surfacebook.localdomain> (raw)
In-Reply-To: <20230807074043.31288-3-zhuyinbo@loongson.cn>
Mon, Aug 07, 2023 at 03:40:43PM +0800, Yinbo Zhu kirjoitti:
> Loongson GPIO controllers come in multiple variants that are compatible
> except for certain register offset values. Add support for device
> properties allowing to specify them in ACPI or DT.
> + if (device_property_read_u32(dev, "ngpios", &ngpios) || !ngpios)
> + return -EINVAL;
> +
> + ret = DIV_ROUND_UP(ngpios, 8);
> + switch (ret) {
> + case 1 ... 2:
> + io_width = ret;
> + break;
> + case 3 ... 4:
> + io_width = 0x4;
> + break;
> + case 5 ... 8:
> + io_width = 0x8;
> + break;
> + default:
> + dev_err(dev, "unsupported io width\n");
> + return -EINVAL;
> + }
Why? We have bgpio_init() handle this.
https://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git/commit/?h=gpio/for-next&id=55b2395e4e92adc492c6b30ac109eb78250dcd9d
...
> + lgpio->chip.can_sleep = 0;
It's boolean, use boolean initializer.
...
> + if (lgpio->chip_data->label)
> + lgpio->chip.label = lgpio->chip_data->label;
> + else
> + lgpio->chip.label = kstrdup(to_platform_device(dev)->name, GFP_KERNEL);
No error check? Not a devm_*() variant, so leaking memory?
...
> + {
> + .id = "LOON0007",
> + },
How does DSDT excerpt for this device look like?
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2023-08-14 21:56 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-07 7:40 [PATCH v3 0/2] gpio: loongson: add firmware offset parse support Yinbo Zhu
2023-08-07 7:40 ` [PATCH v3 1/2] gpio: dt-bindings: add parsing of loongson gpio offset Yinbo Zhu
2023-08-08 12:05 ` Conor Dooley
2023-08-09 7:47 ` Yinbo Zhu
2023-08-09 15:39 ` Conor Dooley
2023-08-10 6:19 ` Yinbo Zhu
2023-08-11 14:25 ` Bartosz Golaszewski
2023-08-14 3:39 ` Yinbo Zhu
2023-08-14 19:18 ` Krzysztof Kozlowski
2023-08-15 8:59 ` Linus Walleij
2023-08-23 3:37 ` Yinbo Zhu
2023-08-08 15:05 ` Krzysztof Kozlowski
2023-08-09 7:28 ` Yinbo Zhu
2023-08-09 13:00 ` Krzysztof Kozlowski
2023-08-10 3:35 ` Yinbo Zhu
2023-08-10 6:08 ` Krzysztof Kozlowski
2023-08-07 7:40 ` [PATCH v3 2/2] gpio: loongson: add firmware offset parse support Yinbo Zhu
2023-08-10 8:27 ` Linus Walleij
2023-08-11 3:50 ` Yinbo Zhu
2023-08-14 21:48 ` andy.shevchenko [this message]
2023-08-23 7:36 ` Yinbo Zhu
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=ZNqhM18XoaqNdN99@surfacebook.localdomain \
--to=andy.shevchenko@gmail.com \
--cc=brgl@bgdev.pl \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=loongson-kernel@lists.loongnix.cn \
--cc=lvjianmin@loongson.cn \
--cc=robh+dt@kernel.org \
--cc=wanghongliang@loongson.cn \
--cc=zhuyinbo@loongson.cn \
/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