Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1743991pxb; Fri, 22 Oct 2021 06:54:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8AocsLjf6R89bD+N2ubgyEg3Jv8PHTRFYDbQF16ft6YMxUa/rZpmIDIS+XK87vhgbNiK5 X-Received: by 2002:a17:907:972a:: with SMTP id jg42mr16758154ejc.75.1634910860081; Fri, 22 Oct 2021 06:54:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634910860; cv=none; d=google.com; s=arc-20160816; b=fxHHF25zHFOBmW4inIxhp/QLoNvQI1BCiv+23xmsjD05jT4gvcOh5mk9QoD+Uq7Jh8 T+X3XgKI10q6wiKYY+l2l4AkWenyVw6I0ZhJZdr1rN8lOAm5cFQjKCb1LriyYA53YQut ZjPOApvumB7fC57D+CyfskpNUgpG4RbXk0DdH3pg2Tv9fuOITC2u+ywSPusvQEcUrmZO 9DrWYTXKHDvHS/BEjmxNIZB3aDTxBILyq8oH6TXwlEFn65RV1FQA+YHl8Du1yqc5gOpc Nd2PhFwn5/qbJ10vikKWMVwBJixEAJ7r4Axe0UvxEBBSXwHhmU+xdX0GVcfJnpr1bsiJ 0Z4A== 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=e4VAlxqjX7tVS4RVU1hVLMwxlt5HBKt4g0cT2A4i/lc=; b=sZXTqf3JwPugRVTJ1u+OjxYXK9ApaHFAAMgndIFy8QRNGz9UaTWeoqJsBXiyURjvmj T5DXq7WjAqMIUmz2K6cnrAANonR1HPJzw+hh81j6PJjaYn68DH+1eaTowZxtNPWHthbl kIIq61Wu4HTmW/E80NBeAkOFnL6h3YWorLBPRMZDBuI6cP2rdRUrSFNXohvQW4eUy674 5c0yZm8sSaj8R9qBnopZCqgH9bCUrcV6SAMURj/EBCCaufcUhD5h4jo6021PK5eUbRXl LTBybrSbeDyndv5J89UOaGZF+ImP+9y8I5J7fqkkpElxyu5lOoWjtaz/8O8piriv/S20 K/xg== 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 qf14si15614296ejc.165.2021.10.22.06.53.52; Fri, 22 Oct 2021 06:54:20 -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 S232986AbhJVNwv (ORCPT + 99 others); Fri, 22 Oct 2021 09:52:51 -0400 Received: from mail-pl1-f181.google.com ([209.85.214.181]:38832 "EHLO mail-pl1-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230342AbhJVNwt (ORCPT ); Fri, 22 Oct 2021 09:52:49 -0400 Received: by mail-pl1-f181.google.com with SMTP id i5so2735843pla.5; Fri, 22 Oct 2021 06:50:32 -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=e4VAlxqjX7tVS4RVU1hVLMwxlt5HBKt4g0cT2A4i/lc=; b=CQm86dOsCIjWXawe3/g/e4cs0g6/TUg6PmP6hYoQDl1Zcvv+5uvYJbEtgF6VFROEHr oztYhNAeb18MUGa/RK9O1PN0wHysJiez5sHpViiPltj0fPsoGzl20EHJBbyVSdw9iN4b hB0PDPM1ECf6uXWbIDITJ9IruZcJ/k3NgdyLqpjp/Yk5a/7hjQPkqgrEaTbzHB5mz5vI sBQZzQwXfFSs+B4LYz5G0Jbd1DrTPCek1Wq1XtsFHygBA80wLFl5msAFunQ/PCyp4EZc P5GAjBHEaV1WMr7olA4VESK7TpbTsW7OYQUv6KGYd4nCfgx9dBeVu7U5riIfhqMDbMG1 lFSA== X-Gm-Message-State: AOAM533TdPzLqSPNeEwH6WCs5XnYRvtS0QbKaN/hVjgLLZXlpooag0tF tx15TPh4oYHEHnH8vLpm25KGqz/o4g7r3siSiNU= X-Received: by 2002:a17:90b:390f:: with SMTP id ob15mr13560608pjb.185.1634910632123; Fri, 22 Oct 2021 06:50:32 -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 15:50:21 +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! > > > Can you convert this to simple > > > > > > if (assert) > > > ret = readl_... > > > else > > > ret = readl_... > > > > > > below? > > > > I don't see how that would work. We're using the done value in in the > > readl_poll_timeout. Maybe you can be a bit more explicit. > > Supply done either == mask or == ^mask. Try it. So you want this? if (assert) ret = readl_poll_timeout_atomic(reg_status, value, (value & mask) == done, 0, 1000); else ret = readl_poll_timeout_atomic(reg_status, value, (value & mask) == ^done, 0, 1000); The compiler might be clever enough, but I'd worry the long body of the readl_poll_timeout_atomic macro is inline twice. Rather than just flipping the bit in `done`.