[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZNqhM18XoaqNdN99@surfacebook.localdomain>
Date: Tue, 15 Aug 2023 00:48:35 +0300
From: andy.shevchenko@...il.com
To: Yinbo Zhu <zhuyinbo@...ngson.cn>
Cc: Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <brgl@...ev.pl>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>, linux-gpio@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
Jianmin Lv <lvjianmin@...ngson.cn>, wanghongliang@...ngson.cn,
loongson-kernel@...ts.loongnix.cn
Subject: Re: [PATCH v3 2/2] gpio: loongson: add firmware offset parse support
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
Powered by blists - more mailing lists