Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3140631pxb; Mon, 18 Oct 2021 08:58:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGyd4PGzidwVkBd3v+nEev6dMbvgHVucRlPZAjY8MmjquyBBtiWeClB9q75fX2Tn+OlBEQ X-Received: by 2002:a50:d085:: with SMTP id v5mr44995025edd.75.1634572711660; Mon, 18 Oct 2021 08:58:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634572711; cv=none; d=google.com; s=arc-20160816; b=HC1NfR9URJ8CZ2eOk5qi7WKwFvBwUN7yx8JO0bbYwjUmlxd2VenrcP9uifKNRFW3kb vOUgMx2lhQvtv6A8UWlQ2a+lI16o0VZwzB/M69ovEbagqxrS27XjIiG+PJt5GmHbvNvb i70q8lAiFk0PEb23fCFDweQuXuQ3nZqdAbPTOLDGr3DoYp4F+0b61AzHpze8ttrZtRTS jiksBdDI8XUQxue9FEC33rabjWMvYDrGIm2MjK+FTDLAuUPLT79l2aM+z7H6i4XS2bAH UDFwae5Hc/k4vajPOZ3T8wWHYGHmw1m2nmEyPSsu69PxHv3HcG3dbIWOMVDUowpIXLpb xokQ== 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=Sz77FGY3TYZu+DudMczIxYP7Uz431ugMBdntq9R2j6g=; b=krPTZaugguwoRfI6DPT51K2p5uoQ9ABShhAgN1JqSxnmm+DChPQhQdB7QUHRLDbpsi un7fkOCSeyNhP8czR3r/TUinTGzc4nL8mXGZI8HwTtoSRfknssC0P4t0OeUAE/RZCLAN eFKmM0dI1cpMJR4MDSDmyL9npWrxmvI8xf6VRdcLjbz5HaO15TlFYyW7aPt+X+EWUjoV J2nVjRwOwpYDBe2GDWR5wiGwN3kxL6h58gw8EeMnBWNedJfXHcHyCVqmEEHUVwVVVQ45 Bb1sZKaku69WQ74/OwZsE3orqaAuWbh1k1i7/vq04SMvOJ5XCBvIDdZXHCXb/jmhRuxR IkEQ== 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 m19si20355937edc.218.2021.10.18.08.58.07; Mon, 18 Oct 2021 08:58:31 -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 S233408AbhJRP63 (ORCPT + 99 others); Mon, 18 Oct 2021 11:58:29 -0400 Received: from mail-pl1-f169.google.com ([209.85.214.169]:42978 "EHLO mail-pl1-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232019AbhJRP62 (ORCPT ); Mon, 18 Oct 2021 11:58:28 -0400 Received: by mail-pl1-f169.google.com with SMTP id l6so11536201plh.9; Mon, 18 Oct 2021 08:56:17 -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=Sz77FGY3TYZu+DudMczIxYP7Uz431ugMBdntq9R2j6g=; b=fMWAyxCGyUQl41hh95+Y8oHBNoYwVoSs00yjW8OGqOvMGdwcOk4D0Jz0g1PxnwdVqa RdcB8gwaQys115HjZ5tgNbVvMZldZbwHan8ozsqWBLY+7JA5L03Dvyf79URvd/cU97yq DgFrbqLL26i1Kjzcr9PJ1Yx8BrAuYdUcTITtI+aO+j/viJVpR+M9JKFVaVsq2EY/wrwQ L8i4oaGaRjwkpr+jzqaIe1viP0ACpSGFteZ1h5H+cTpJXkKMUlo5joU2PZAwc/lA8noc v4awG+mUghOaHChEh/Syghmeqdu66bufJUn51UqpIIwHaPxWcTvgyadhc5vHsyzd4Gkp gn1w== X-Gm-Message-State: AOAM533gppni8c+ydFOYQ0Hwgd/4LX1H5lgnCEvY+GckzDtuWMdfstti zgd6Shj/5bhKxpOjMtIH0BijAQLjl9LtovCkKEg= X-Received: by 2002:a17:90b:694:: with SMTP id m20mr48766296pjz.160.1634572576629; Mon, 18 Oct 2021 08:56:16 -0700 (PDT) MIME-Version: 1.0 References: <20211012134027.684712-1-kernel@esmil.dk> <20211012134027.684712-13-kernel@esmil.dk> In-Reply-To: From: Emil Renner Berthing Date: Mon, 18 Oct 2021 17:56:05 +0200 Message-ID: Subject: Re: [PATCH v1 12/16] pinctrl: starfive: Add pinctrl driver for StarFive SoCs 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 , Anup Patel , Atish Patra , Matteo Croce , Linux Kernel Mailing List , Huan Feng Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 18 Oct 2021 at 17:48, Andy Shevchenko wrote: > On Mon, Oct 18, 2021 at 6:35 PM Emil Renner Berthing wrote: > > On Tue, 12 Oct 2021 at 19:03, Andy Shevchenko wrote: > > > On Tue, Oct 12, 2021 at 4:43 PM Emil Renner Berthing wrote: > > When answering, cut down your message to the point, please! It's a bit > annoying to remove overquoting... > > ... > > > > > + case PIN_CONFIG_BIAS_DISABLE: > > > > > > > + mask |= PAD_BIAS_MASK; > > > > > > Use it... > > > > > > > + value = (value & ~PAD_BIAS_MASK) | PAD_BIAS_DISABLE; > > > > > > ...here. Ditto for the similar cases in this function and elsewhere. > > > > I don't follow. How do you want me to use mask? If I did value = > > (value & ~mask) | PAD_BIAS_DISABLE; then I'd wipe the previous > > configuration. Eg. suppose the first config is the drive strength and > > second disables bias. Then on the 2nd loop mask = > > PAD_DRIVE_STRENGTH_MASK | PAD_BIAS_MASK and the drive strength value > > would be wiped. > > Collect masks and new values in temporary variables and apply them > once after the loop is done, no? But that's exactly what the code does. It merges all the config options into a single mask and value so we only need to do rmw on the register once. > ... > > > > > + ret = clk_prepare_enable(clk); > > > > + if (ret) { > > > > > > > + reset_control_deassert(rst); > > > > > > Use devm_add_action_or_reset(). > > > > I don't see how that is better. > > Pity. The rule of thumb is to either try to use devm_*() everywhere in > the probe, or don't use it at all. Above is the more-or-less standard > pattern where devn_add_action_or_reset() is being used in the entire > kernel. > > > Then I'd first need to call that and > > check for errors, but just on the line below enabling the clock the > > reset line is deasserted anyway, so then the action isn't needed any > > longer. So that 3 lines of code for devm_add_action_or_reset + > > lingering unneeded action or code to remove it again vs. just the line > > above. > > Then don't use devm_*() at all. What's the point? I'm confused. So you wan't an unneeded action to linger because the probe function temporarily asserts reset for 3 lines of code? > ... > > > > > + sfp->gc.of_node = dev->of_node; > > > > > > Isn't GPIO library do this for you? > > > > If it does I can't find it. > > Heh... `man git grep` > Hint: `git grep -n 'of_node = .*of_node' -- drivers/gpio/gpiolib*` That's exactly what I did. > -- > With Best Regards, > Andy Shevchenko