From: Drew Fustini <dfustini@tenstorrent.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Drew Fustini <drew@pdp7.com>, Guo Ren <guoren@kernel.org>,
Fu Wei <wefu@redhat.com>,
Linus Walleij <linus.walleij@linaro.org>,
linux-riscv@lists.infradead.org, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] pinctrl: th1520: Convert to thp->mutex to guarded mutex
Date: Sat, 5 Oct 2024 17:16:27 -0700 [thread overview]
Message-ID: <ZwHW27ZuZrtBm56q@x1> (raw)
In-Reply-To: <a42a738a-b52d-4ff9-ac21-cffd808bc055@wanadoo.fr>
On Sat, Oct 05, 2024 at 09:43:06PM +0200, Christophe JAILLET wrote:
> Le 05/10/2024 à 21:35, Drew Fustini a écrit :
> > Convert th1520_pinctrl_dt_node_to_map() to use guarded mutex for
> > thp->mutex.
> >
> > Suggested-by: Linus Walleij <linus.walleij@linaro.org>
> > Signed-off-by: Drew Fustini <dfustini@tenstorrent.com>
> > ---
> > drivers/pinctrl/pinctrl-th1520.c | 8 +++-----
> > 1 file changed, 3 insertions(+), 5 deletions(-)
> >
>
> Hi,
>
> > diff --git a/drivers/pinctrl/pinctrl-th1520.c b/drivers/pinctrl/pinctrl-th1520.c
> > index 9331f4462480..d03a0a34220a 100644
> > --- a/drivers/pinctrl/pinctrl-th1520.c
> > +++ b/drivers/pinctrl/pinctrl-th1520.c
> > @@ -425,7 +425,7 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
> > int ret;
> > nmaps = 0;
> > - for_each_available_child_of_node(np, child) {
> > + for_each_available_child_of_node_scoped(np, child) {
>
> Using _scoped iterator is not described in the commit message.
> Is it expected to be part of this patch?
Yes, it was intentional, but you are right that I should have
highlighted that. I'll make it a separate patch.
>
> If yes, the "of_node_put(child);" just a few lines below should be removed.
Thanks, will do.
>
> > int npins = of_property_count_strings(child, "pins");
> > if (npins <= 0) {
> > @@ -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) {
>
> Same here...
>
> > 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);
>
> ... this should be removed, and maybe the label renamed.
Thanks, will do.
Drew
WARNING: multiple messages have this Message-ID (diff)
From: Drew Fustini <dfustini@tenstorrent.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Drew Fustini <drew@pdp7.com>, Guo Ren <guoren@kernel.org>,
Fu Wei <wefu@redhat.com>,
Linus Walleij <linus.walleij@linaro.org>,
linux-riscv@lists.infradead.org, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] pinctrl: th1520: Convert to thp->mutex to guarded mutex
Date: Sat, 5 Oct 2024 17:16:27 -0700 [thread overview]
Message-ID: <ZwHW27ZuZrtBm56q@x1> (raw)
In-Reply-To: <a42a738a-b52d-4ff9-ac21-cffd808bc055@wanadoo.fr>
On Sat, Oct 05, 2024 at 09:43:06PM +0200, Christophe JAILLET wrote:
> Le 05/10/2024 à 21:35, Drew Fustini a écrit :
> > Convert th1520_pinctrl_dt_node_to_map() to use guarded mutex for
> > thp->mutex.
> >
> > Suggested-by: Linus Walleij <linus.walleij@linaro.org>
> > Signed-off-by: Drew Fustini <dfustini@tenstorrent.com>
> > ---
> > drivers/pinctrl/pinctrl-th1520.c | 8 +++-----
> > 1 file changed, 3 insertions(+), 5 deletions(-)
> >
>
> Hi,
>
> > diff --git a/drivers/pinctrl/pinctrl-th1520.c b/drivers/pinctrl/pinctrl-th1520.c
> > index 9331f4462480..d03a0a34220a 100644
> > --- a/drivers/pinctrl/pinctrl-th1520.c
> > +++ b/drivers/pinctrl/pinctrl-th1520.c
> > @@ -425,7 +425,7 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
> > int ret;
> > nmaps = 0;
> > - for_each_available_child_of_node(np, child) {
> > + for_each_available_child_of_node_scoped(np, child) {
>
> Using _scoped iterator is not described in the commit message.
> Is it expected to be part of this patch?
Yes, it was intentional, but you are right that I should have
highlighted that. I'll make it a separate patch.
>
> If yes, the "of_node_put(child);" just a few lines below should be removed.
Thanks, will do.
>
> > int npins = of_property_count_strings(child, "pins");
> > if (npins <= 0) {
> > @@ -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) {
>
> Same here...
>
> > 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);
>
> ... this should be removed, and maybe the label renamed.
Thanks, will do.
Drew
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2024-10-06 0:16 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-05 19:35 [PATCH 0/2] pinctrl: th1520: Improve code quality Drew Fustini
2024-10-05 19:35 ` Drew Fustini
2024-10-05 19:35 ` [PATCH 1/2] pinctrl: th1520: Convert to thp->mutex to guarded mutex Drew Fustini
2024-10-05 19:35 ` Drew Fustini
2024-10-05 19:43 ` Christophe JAILLET
2024-10-05 19:43 ` Christophe JAILLET
2024-10-06 0:16 ` Drew Fustini [this message]
2024-10-06 0:16 ` Drew Fustini
2024-10-05 19:54 ` Markus Elfring
2024-10-05 19:54 ` Markus Elfring
2024-10-06 20:04 ` kernel test robot
2024-10-06 20:04 ` kernel test robot
2024-10-07 15:41 ` Dan Carpenter
2024-10-07 15:41 ` Dan Carpenter
2024-10-07 16:33 ` Drew Fustini
2024-10-07 16:33 ` Drew Fustini
2024-10-05 19:35 ` [PATCH 2/2] pinctrl: th1520: Fix return value for unknown pin error Drew Fustini
2024-10-05 19:35 ` Drew Fustini
2024-10-06 6:09 ` Markus Elfring
2024-10-06 6:09 ` Markus Elfring
-- strict thread matches above, loose matches on Subject: below --
2024-10-07 13:40 [PATCH 1/2] pinctrl: th1520: Convert to thp->mutex to guarded mutex kernel test robot
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=ZwHW27ZuZrtBm56q@x1 \
--to=dfustini@tenstorrent.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=drew@pdp7.com \
--cc=guoren@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=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.