From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C601AC04A6A for ; Mon, 14 Aug 2023 21:56:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233279AbjHNVzv (ORCPT ); Mon, 14 Aug 2023 17:55:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233161AbjHNVzY (ORCPT ); Mon, 14 Aug 2023 17:55:24 -0400 Received: from fgw22-7.mail.saunalahti.fi (fgw22-7.mail.saunalahti.fi [62.142.5.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC0B01998 for ; Mon, 14 Aug 2023 14:54:52 -0700 (PDT) Received: from localhost (88-113-24-87.elisa-laajakaista.fi [88.113.24.87]) by fgw22.mail.saunalahti.fi (Halon) with ESMTP id 51b4ccd9-3aec-11ee-a9de-005056bdf889; Tue, 15 Aug 2023 00:48:38 +0300 (EEST) From: andy.shevchenko@gmail.com Date: Tue, 15 Aug 2023 00:48:35 +0300 To: Yinbo Zhu Cc: Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Jianmin Lv , wanghongliang@loongson.cn, loongson-kernel@lists.loongnix.cn Subject: Re: [PATCH v3 2/2] gpio: loongson: add firmware offset parse support Message-ID: References: <20230807074043.31288-1-zhuyinbo@loongson.cn> <20230807074043.31288-3-zhuyinbo@loongson.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230807074043.31288-3-zhuyinbo@loongson.cn> Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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