All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Arnd Bergmann <arnd@kernel.org>,
	Patrice Chotard <patrice.chotard@foss.st.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Hugues Fruchet <hugues.fruchet@st.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: c8sectpfe: convert to gpio descriptors
Date: Fri, 3 Feb 2023 15:10:55 -0800	[thread overview]
Message-ID: <CAKdAkRRA7XATxHBALDf8Pd2SWQX_OPAYgCQmtJi5H1so_EJ7VA@mail.gmail.com> (raw)
In-Reply-To: <14e7d2ba-1a24-42a1-b19e-842e0fd8286e@app.fastmail.com>

On Mon, Jan 30, 2023 at 10:19 AM Arnd Bergmann <arnd@arndb.de> wrote:
>
> On Mon, Jan 30, 2023, at 18:18, Andy Shevchenko wrote:
> > On Mon, Jan 30, 2023 at 02:09:47PM +0100, Arnd Bergmann wrote:
>
> >> +            ret = PTR_ERR_OR_ZERO(tsin->rst_gpio);
> >>              if (ret && ret != -EBUSY) {
> >> -                    dev_err(dev, "Can't request tsin%d reset gpio\n"
> >> -                            , fei->channel_data[index]->tsin_id);
> >> +                    dev_err_probe(dev, ret,
> >> +                                  "reset gpio for tsin%d not valid\n",
> >> +                                  tsin->tsin_id);
> >>                      goto err_node_put;
> >>              }
> >>
> >>              if (!ret) {
> >
> > Can be
> >
> >       if (IS_ERR() && PTR_ERR() != -EBUSY) {
> >               ret = dev_err_probe(dev, PTR_ERR(), ...);
> >               ...
> >       }
> >
> >       if (!IS_ERR())
> >
> > (Up to you)
>
> I prefer the version that only has one PTR_ERR(), but
> either way is fine with me.
>
> > But -EBUSY check seems strange to me. What was the motivation behind?
> > (As far as I can read the code the possibility to get this if and only
> >  if we have requested GPIO too early at initcall level. Would it be
> >  ever a possibility to get it in real life?)
>
> I noticed this part as being odd as well, no idea why the
> code is like this. I just left the logic unchanged here.

It could be they were trying to account for the possibility of the
reset line being shared between several blocks, and so the first one
to initialize would grab it and reset all chips, and the followers
would be skipping the reset logic.

-- 
Dmitry

WARNING: multiple messages have this Message-ID (diff)
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Arnd Bergmann <arnd@kernel.org>,
	 Patrice Chotard <patrice.chotard@foss.st.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	 Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Hugues Fruchet <hugues.fruchet@st.com>,
	 linux-arm-kernel@lists.infradead.org,
	linux-media@vger.kernel.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: c8sectpfe: convert to gpio descriptors
Date: Fri, 3 Feb 2023 15:10:55 -0800	[thread overview]
Message-ID: <CAKdAkRRA7XATxHBALDf8Pd2SWQX_OPAYgCQmtJi5H1so_EJ7VA@mail.gmail.com> (raw)
In-Reply-To: <14e7d2ba-1a24-42a1-b19e-842e0fd8286e@app.fastmail.com>

On Mon, Jan 30, 2023 at 10:19 AM Arnd Bergmann <arnd@arndb.de> wrote:
>
> On Mon, Jan 30, 2023, at 18:18, Andy Shevchenko wrote:
> > On Mon, Jan 30, 2023 at 02:09:47PM +0100, Arnd Bergmann wrote:
>
> >> +            ret = PTR_ERR_OR_ZERO(tsin->rst_gpio);
> >>              if (ret && ret != -EBUSY) {
> >> -                    dev_err(dev, "Can't request tsin%d reset gpio\n"
> >> -                            , fei->channel_data[index]->tsin_id);
> >> +                    dev_err_probe(dev, ret,
> >> +                                  "reset gpio for tsin%d not valid\n",
> >> +                                  tsin->tsin_id);
> >>                      goto err_node_put;
> >>              }
> >>
> >>              if (!ret) {
> >
> > Can be
> >
> >       if (IS_ERR() && PTR_ERR() != -EBUSY) {
> >               ret = dev_err_probe(dev, PTR_ERR(), ...);
> >               ...
> >       }
> >
> >       if (!IS_ERR())
> >
> > (Up to you)
>
> I prefer the version that only has one PTR_ERR(), but
> either way is fine with me.
>
> > But -EBUSY check seems strange to me. What was the motivation behind?
> > (As far as I can read the code the possibility to get this if and only
> >  if we have requested GPIO too early at initcall level. Would it be
> >  ever a possibility to get it in real life?)
>
> I noticed this part as being odd as well, no idea why the
> code is like this. I just left the logic unchanged here.

It could be they were trying to account for the possibility of the
reset line being shared between several blocks, and so the first one
to initialize would grab it and reset all chips, and the followers
would be skipping the reset logic.

-- 
Dmitry

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-02-03 23:11 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-30 13:09 [PATCH] media: c8sectpfe: convert to gpio descriptors Arnd Bergmann
2023-01-30 13:09 ` Arnd Bergmann
2023-01-30 17:18 ` Andy Shevchenko
2023-01-30 17:18   ` Andy Shevchenko
2023-01-30 18:17   ` Arnd Bergmann
2023-01-30 18:17     ` Arnd Bergmann
2023-02-03 23:10     ` Dmitry Torokhov [this message]
2023-02-03 23:10       ` Dmitry Torokhov
2023-02-01  3:29 ` Dmitry Torokhov
2023-02-01  3:29   ` Dmitry Torokhov
2023-02-01 18:35   ` Andy Shevchenko
2023-02-01 18:35     ` Andy Shevchenko
2023-05-17 18:21 ` Sakari Ailus
2023-05-17 18:21   ` Sakari Ailus
2023-05-17 19:12   ` Dmitry Torokhov
2023-05-17 19:12     ` Dmitry Torokhov
2023-05-17 19:26     ` Sakari Ailus
2023-05-17 19:26       ` Sakari Ailus
2023-05-19  1:05       ` Dmitry Torokhov
2023-05-19  1:05         ` Dmitry Torokhov

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=CAKdAkRRA7XATxHBALDf8Pd2SWQX_OPAYgCQmtJi5H1so_EJ7VA@mail.gmail.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=hugues.fruchet@st.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=patrice.chotard@foss.st.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.