Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp778387rdg; Thu, 10 Aug 2023 21:53:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHyeWsnRhARq/K7f4dyvzCRdVhUvuGAZPOgeZN7/UjKh85rhWUProjAGzqgidc7GyPw4rI4 X-Received: by 2002:a17:902:da83:b0:1b5:64a4:be8b with SMTP id j3-20020a170902da8300b001b564a4be8bmr888726plx.35.1691729596019; Thu, 10 Aug 2023 21:53:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691729596; cv=none; d=google.com; s=arc-20160816; b=XHKQccY51ADNnPrBsPkbO8lZXFv+4HjaP7I7V+5gr8eVgFP3ipQQWlqwU2SUX2FSN6 dEgKfm1TtbyaoIMALb4uMVsAnNFlTVCQ7UyPcd/nHwTZoe09cRpMA907QhlKKDi4rwxt le1nOGr13Lk/3YREn/TKva/KQqjvXtdh8ulsPkcnfwKuAAyri+dZac0xxuAUd4x7kH4v 3UaJQ7lG2a+jHPSGPKNGxo/sIPn89tbFvzfz3fDmosupjoCBS7lquzHtHCvZICI844eY GJL2d/S3sFIEp9x58xyjQCsfk/lMNL19s4iwqyCOZvbwYFblE88Qb2dRPeul+Sp9nQfR bW4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=P//Q34hn9J4p3GN6t7CzXRDyCvtkqo87hD5PwQ8dXvE=; fh=t6s904Cx+b3+vIRMRCYwss4VnhKgzfBGvaKeYmIipIw=; b=FixMpqeGgfYPa+ghQyZcLm/wT1F2fYYjy/eI543y9jN1GNe6ogDJez4gHOZZxvMaJr IRjIAklZFSdzVw6ZwF5EYSvGddJg7EoonqrpEp8kFvcZ+KNm3mNxqidMJNVA25Huz3EI NVsHqPdnmFcO8ZuG2it5OahLxGjLMCN9ZAA+W0T4hkbTWAnSVULUx6++ypEvLgEbKqv+ ekjK3nk1q8mNU2pfxlsPV+Y+CetsenBWBnrDiqQlHEz51BznXgObheqboIMt2XtIIu3Z HXpmuCVm/UpcGekecHkQIFhnmryYaoQ/YP6KmVHD21FvIZVSXGESOnhemee7D4bZOCD1 YElA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w23-20020a170902a71700b001b8698d619asi2613410plq.602.2023.08.10.21.53.03; Thu, 10 Aug 2023 21:53:16 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231402AbjHKDuj (ORCPT + 99 others); Thu, 10 Aug 2023 23:50:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229592AbjHKDug (ORCPT ); Thu, 10 Aug 2023 23:50:36 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DE7082D70; Thu, 10 Aug 2023 20:50:34 -0700 (PDT) Received: from loongson.cn (unknown [10.20.42.201]) by gateway (Coremail) with SMTP id _____8AxFvEIsNVkJ0YVAA--.45296S3; Fri, 11 Aug 2023 11:50:32 +0800 (CST) Received: from [10.20.42.201] (unknown [10.20.42.201]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxniMGsNVkDExUAA--.38354S3; Fri, 11 Aug 2023 11:50:32 +0800 (CST) Subject: Re: [PATCH v3 2/2] gpio: loongson: add firmware offset parse support To: Linus Walleij Cc: 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, zhuyinbo@loongson.cn References: <20230807074043.31288-1-zhuyinbo@loongson.cn> <20230807074043.31288-3-zhuyinbo@loongson.cn> From: Yinbo Zhu Message-ID: <768426b7-7192-8902-1d93-189a7fd64214@loongson.cn> Date: Fri, 11 Aug 2023 11:50:30 +0800 User-Agent: Mozilla/5.0 (X11; Linux loongarch64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8BxniMGsNVkDExUAA--.38354S3 X-CM-SenderInfo: 52kx5xhqerqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 在 2023/8/10 下午4:27, Linus Walleij 写道: > Hi Yinbo, > > thanks for your patch! > > On Mon, Aug 7, 2023 at 9:41 AM Yinbo Zhu wrote: > >> 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. >> >> Signed-off-by: Yinbo Zhu > > (...) >> @@ -26,6 +26,7 @@ struct loongson_gpio_chip_data { >> unsigned int conf_offset; >> unsigned int out_offset; >> unsigned int in_offset; >> + unsigned int inten_offset; > > Consider just changing all of these from unsigned int to u32. okay, I got it. > > (...) >> + if (device_property_read_u32(dev, "loongson,gpio-conf-offset", (u32 *)&d->conf_offset) >> + || device_property_read_u32(dev, "loongson,gpio-in-offset", (u32 *)&d->in_offset) >> + || device_property_read_u32(dev, "loongson,gpio-out-offset", (u32 *)&d->out_offset) >> + || device_property_read_u32(dev, "loongson,gpio-ctrl-mode", (u32 *)&d->mode)) > > Because then you can get rid of this annoying forest of cast. Change offset to u32 and here still need use a (u32 *) cast, because the chip_data is const type so &chip_data->offset will be (const u32 *) type and need a (u32 *) cast. > > I'm fine with doing this change in this patch without a need for a separate > refactoring, as it's just a contained driver and clearly just about typing. okay, I got it. Thanks, Yinbo.