Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1776560pxb; Fri, 22 Oct 2021 07:27:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+709BERAkVx8Yw1xqV2Udtt6gAeJg77AUhDLd7i6me0qQpf77MrIx5bMRjNtw1Qs/c2Kr X-Received: by 2002:a05:6402:47:: with SMTP id f7mr466621edu.52.1634912863792; Fri, 22 Oct 2021 07:27:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634912863; cv=none; d=google.com; s=arc-20160816; b=RxhudILT+eXcBEU3zX9Qsz0SD50YzAIqFJS7jozb0vtaLOKeC/u/bPGoyck8UNFZBX mIa6nSY3gj5VlrrK78Bp7ugvemS9hlQyWqJEthgNVmX+lvXjaU93zjqmG3qb7iPTFUEn ak7hFQjU/Ct1+LoCCoUsgWEQRDMyJTzSF9DjLowQFFG5GQcL6tq4MmG+hsU3X/vVl9iJ 0rXV0/wNthrJp/j7rtGt8p6H3UmGkxOC+CYyWL5VrdMcn00J7Fd/PTOh/uFoUrcvksqa TXkAPR1OUmrrMXXTw6id8MZL90bvsRY/myBEf4N9s2NTvczl9SEzcPqT4BIt1umg0H5s F85A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=jorqKoNvCog+RdJEWLLzk4/vugG3Lx6Xwa7r7jPCqTI=; b=CkmGHOM6phT5Yd04vNyhyzEV2IjMg2qIS8Z3BHzZGR6Kr5nnr7OG8vlUjulsU9mSot +kq4Pd1j8yFnRO4OW6j0/pwzEaHjY8GQCR9H8YNhbHowCXeA68YxPQiqQDFZjVyp4uxP ivWKQ/AZlT7IaKRjZUfmWCNgMTAGD+TAsMVq9+O93/hNqpiEFpGI8LbWP1MJcQnR6pik ilgtiy+tTtIsIwd5g7aJEkRKhHS3mVy+KrtBF2nmZ/rjylIlW5MXvuJvYSPN06m75UTA GplGMk4Omzi2j7mrYCWt6y2J3xZWTiOBzBicxFUEE9PeMnW6oq9ILxd5NV5y+sgO6q5g cHoQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dm5si2473926ejc.321.2021.10.22.07.27.17; Fri, 22 Oct 2021 07:27:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232985AbhJVO1m (ORCPT + 99 others); Fri, 22 Oct 2021 10:27:42 -0400 Received: from mail-pf1-f175.google.com ([209.85.210.175]:46723 "EHLO mail-pf1-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232276AbhJVO1l (ORCPT ); Fri, 22 Oct 2021 10:27:41 -0400 Received: by mail-pf1-f175.google.com with SMTP id x66so3742087pfx.13; Fri, 22 Oct 2021 07:25:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jorqKoNvCog+RdJEWLLzk4/vugG3Lx6Xwa7r7jPCqTI=; b=FCdcn7vVuIjicwvIn3P4ZQHYD/4ly7txPGIskT4FNCudWWHaUJsbAzrx7pfW6LL83A TAhpi3CIUjv5qXNP9a8WpS1/8ylJur1VPW2sRE/aufw+28LLfAWw4OyczRadPZVQ+mbR N3cNbhPQ0/vudTJKhugvCJgY7JYdB7ZfyeS+ADjoMd1PVZ/leJ3De19ewjZXwUGFtxTV U6ETQuoioD0LK7Ba2iQ5KlwtkkYFnzn0mAF03QL66xz/jRs+yvxgiNvrmO1rjAXypm/6 Gzrh6cBcD/uD9cgnInElbp1uR/RO2uGJHQvs/AbMQdUkjGK0+E2svQXb6RAhvwFaUtud yYsQ== X-Gm-Message-State: AOAM530C1wF5Y63M0BPsndjMMIeeyk2N+P3SV6WXE8ySGa9sDQ3js9CC QXhHofQz+fu2jjHpBRx8Zl+8UjQzBZZi0I0sMJfVnYyjZZVsIA== X-Received: by 2002:a62:5257:0:b0:44c:ed84:350a with SMTP id g84-20020a625257000000b0044ced84350amr12576754pfb.79.1634912723745; Fri, 22 Oct 2021 07:25:23 -0700 (PDT) MIME-Version: 1.0 References: <20211021174223.43310-1-kernel@esmil.dk> <20211021174223.43310-10-kernel@esmil.dk> In-Reply-To: From: Emil Renner Berthing Date: Fri, 22 Oct 2021 16:25:12 +0200 Message-ID: Subject: Re: [PATCH v2 09/16] reset: starfive-jh7100: Add StarFive JH7100 reset driver To: Andy Shevchenko Cc: linux-riscv , devicetree , linux-clk , "open list:GPIO SUBSYSTEM" , "open list:SERIAL DRIVERS" , Palmer Dabbelt , Paul Walmsley , Rob Herring , Michael Turquette , Stephen Boyd , Thomas Gleixner , Marc Zyngier , Philipp Zabel , Linus Walleij , Greg Kroah-Hartman , Daniel Lezcano , Andy Shevchenko , Jiri Slaby , Maximilian Luz , Sagar Kadam , Drew Fustini , Geert Uytterhoeven , Michael Zhu , Fu Wei , Anup Patel , Atish Patra , Matteo Croce , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 22 Oct 2021 at 15:39, Andy Shevchenko wrote: > On Fri, Oct 22, 2021 at 4:35 PM Emil Renner Berthing wrote: > > On Fri, 22 Oct 2021 at 14:56, Andy Shevchenko wrote: > > > On Thu, Oct 21, 2021 at 8:43 PM Emil Renner Berthing wrote: > > ... > > > > Why all these ugly % 32 against constants? > > > > Because the JH7100_RST_ values goes higher than 31. There is a > > BIT_MASK macro, but that does % BITS_PER_LONG and this is a 64bit > > machine. > > And? It's exactly what you have to use! So you want me to use an unsigned long array or DECLARE_BITMAP and juggle two different index and bit offsets? Also is there a macro for handling that we'd then need 4 commas on 32bit COMPILE_TEST and 2 commas on 64bit? If you have some other way in mind you'll have to be a lot more explicit again. The point of the jh7100_reset_asserted array is that it exactly mirrors the values of the status registers when the lines are asserted. Maybe writing it like this would be more explicit: static const u32 jh7100_reset_asserted[4] = { /* STATUS0 register */ BIT(JH7100_RST_U74 % 32) | BIT(JH7100_RST_VP6_DRESET % 32) | BIT(JH7100_RST_VP6_BRESET % 32), /* STATUS1 register */ BIT(JH7100_RST_HIFI4_DRESET % 32) | BIT(JH7100_RST_HIFI4_BRESET % 32), /* STATUS2 register */ BIT(JH7100_RST_E24 % 32), /* STATUS3 register */ 0, };