From: Drew Fustini <dfustini@tenstorrent.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Drew Fustini <drew@pdp7.com>, Guo Ren <guoren@kernel.org>,
Fu Wei <wefu@redhat.com>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Emil Renner Berthing <emil.renner.berthing@canonical.com>,
Thomas Bonnefille <thomas.bonnefille@bootlin.com>,
linux-riscv@lists.infradead.org, linux-gpio@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 0/8] pinctrl: Add T-Head TH1520 SoC pin controllers
Date: Wed, 2 Oct 2024 17:02:42 -0700 [thread overview]
Message-ID: <Zv3fIuMUhukmOWQJ@x1> (raw)
In-Reply-To: <CACRpkdZRg+k=N42EA3+3c4Er=DHf2Q1aVzzCM0OQuEx7xWMAvw@mail.gmail.com>
On Wed, Oct 02, 2024 at 10:46:41PM +0200, Linus Walleij wrote:
> On Wed, Oct 2, 2024 at 8:35 PM Drew Fustini <dfustini@tenstorrent.com> wrote:
>
> > > Then I merged that into my "devel" branch for v6.13.
> >
> > Thanks for taking this. Will that also end up in linux-next eventually?
>
> Yes next -next.
>
> > I'm working on a TH1520 Ethernet driver which depends on the pinctrl
> > driver. Andrew Lunn replied to me that all the dependencies need to be
> > in linux-next [1].
>
> Well compile-time dependencies for sure, run-time dependencies
> we are usually a bit lax with as long as we know they will
> get there eventually.
>
> > > I think I'll make a stab at using guarded mutexes etc and see what
> > > you think about it!
> >
> > Do you mean using scoped_guard() for thp->mutex in
> > th1520_pinctrl_dt_node_to_map()?
>
> For all mutex and spinlocks in the driver.
The thp->lock spinlock is already using scoped_guard() everywhere.
I will post a patch that adds guard() for the thp->mutex like this:
diff --git a/drivers/pinctrl/pinctrl-th1520.c b/drivers/pinctrl/pinctrl-th1520.c
index 1bb78b212fd5..b7c2d998e9e7 100644
--- a/drivers/pinctrl/pinctrl-th1520.c
+++ b/drivers/pinctrl/pinctrl-th1520.c
@@ -444,8 +444,8 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
return -ENOMEM;
nmaps = 0;
- mutex_lock(&thp->mutex);
- for_each_available_child_of_node(np, child) {
+ guard(mutex)(&thp->mutex);
+ for_each_available_child_of_node_scoped(np, child) {
unsigned int rollback = nmaps;
enum th1520_muxtype muxtype;
struct property *prop;
@@ -530,7 +530,6 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
*maps = map;
*num_maps = nmaps;
- mutex_unlock(&thp->mutex);
return 0;
free_configs:
@@ -538,7 +537,6 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
put_child:
of_node_put(child);
th1520_pinctrl_dt_free_map(pctldev, map, nmaps);
- mutex_unlock(&thp->mutex);
return ret;
}
--
Thanks,
Drew
next prev parent reply other threads:[~2024-10-03 0:02 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-30 19:50 [PATCH v3 0/8] pinctrl: Add T-Head TH1520 SoC pin controllers Drew Fustini
2024-09-30 19:50 ` [PATCH v3 1/8] dt-bindings: pinctrl: Add thead,th1520-pinctrl bindings Drew Fustini
2024-09-30 19:50 ` [PATCH v3 2/8] pinctrl: Add driver for the T-Head TH1520 SoC Drew Fustini
2024-10-02 19:36 ` Kees Bakker
2024-10-03 2:43 ` Drew Fustini
2024-09-30 19:50 ` [PATCH v3 3/8] riscv: dts: thead: Add TH1520 pin control nodes Drew Fustini
2024-09-30 19:50 ` [PATCH v3 4/8] riscv: dts: thead: Add TH1520 GPIO ranges Drew Fustini
2024-09-30 19:50 ` [PATCH v3 5/8] riscv: dts: thead: Adjust TH1520 GPIO labels Drew Fustini
2024-09-30 19:50 ` [PATCH v3 6/8] riscv: dts: thead: Add Lichee Pi 4M GPIO line names Drew Fustini
2024-10-12 13:46 ` Emil Renner Berthing
2024-09-30 19:50 ` [PATCH v3 7/8] riscv: dts: thead: Add TH1520 pinctrl settings for UART0 Drew Fustini
2024-10-12 13:48 ` Emil Renner Berthing
2024-09-30 19:50 ` [PATCH v3 8/8] riscv: dtb: thead: Add BeagleV Ahead LEDs Drew Fustini
2024-10-12 14:41 ` Emil Renner Berthing
2024-10-01 12:13 ` [PATCH v3 0/8] pinctrl: Add T-Head TH1520 SoC pin controllers Linus Walleij
2024-10-02 18:34 ` Drew Fustini
2024-10-02 20:46 ` Linus Walleij
2024-10-03 0:02 ` Drew Fustini [this message]
2024-10-11 17:22 ` Drew Fustini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zv3fIuMUhukmOWQJ@x1 \
--to=dfustini@tenstorrent.com \
--cc=aou@eecs.berkeley.edu \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=drew@pdp7.com \
--cc=emil.renner.berthing@canonical.com \
--cc=guoren@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=robh@kernel.org \
--cc=thomas.bonnefille@bootlin.com \
--cc=wefu@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).