Received: by 2002:a05:7412:bb8d:b0:d7:7d3a:4fe2 with SMTP id js13csp256750rdb; Mon, 14 Aug 2023 16:18:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG7CYv179ll1Cr22lafSCnslwadGZkmhJj8agLAYr1xtBEMpwDpc06+FrmX44oMmWVDSGHp X-Received: by 2002:a17:902:d4c4:b0:1bb:b34b:73a with SMTP id o4-20020a170902d4c400b001bbb34b073amr14649782plg.25.1692055106402; Mon, 14 Aug 2023 16:18:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692055106; cv=none; d=google.com; s=arc-20160816; b=uoc94yC88bVrXzCs3YaM0ZARqx08kV0Fy0m8ZVTCKLiRuVnZ4zs691OSMmMF43LnkQ SbQDqIneexll8ytl78jTwESnjnllDHqJ2YmTPhOrlS1gTTGdMUm0SDPYPeyOYlua2BiG 82KJdpCGEHr2lV43WFF1DK4SahzW6TmyskUUhp88eLmHR5g42e+jzk7iwf9v+vJjZ+ua k22jgmf1nt6zk85sP1j841pHUFUCEFBosodgCJyaOJmC3rAAJ6JQBtl5NmQPD2MkSGzg 0BfpzbAuKgR4/BgonY/Te+LyiSo2J7lcQSSf4PVs22UOSs6DZAuvENuQggXOLPIdbU0G 96rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:date:from; bh=yfWuGdCztvGY73Zgtye5/8TKlArK26Bsff1/wl5AkuU=; fh=vQIvM1p3FKTTYMDUOFnLlqyoHhaxGdwxGwUwAR8WVVE=; b=aNnZ/Ffy1lE5y2Zb3PNxdCfrDVhZchkhVsds1/us09OHbaBYGkl7UBVL1/NatBBR5g kIIsbzbbVsSrzUefttgF0hdjzOBySFA8dZgHsn9UJCCLVu44u2XR0MHp7fcuTELva52y tIRMIq87WEst4Jc2bHdGi7FLXwtbbpoQCno2H5IO7pN/DDtu9Itj+sr/QghRQNve/TBR NQuoI6QKO8vDBH6gK/v4Jk3pWRu5UhHJHcCnYFcRHUUrV+Pjnvw9U7njSW7hlhVQ1AGR G20SQXDMnxcFMrEem1kSuyIozHuBSENPU/CtGuR+NqRxrNsjszuLzO5LT7OZ7s3vj38f k90A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f7-20020a170902684700b001bdb3c09695si6861228pln.222.2023.08.14.16.18.08; Mon, 14 Aug 2023 16:18:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233146AbjHNVzw (ORCPT + 99 others); Mon, 14 Aug 2023 17:55:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233153AbjHNVzX (ORCPT ); Mon, 14 Aug 2023 17:55:23 -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 AB5AC1989 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> X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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