From: Philipp Zabel <p.zabel@pengutronix.de>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>,
Baptiste Reynal <b.reynal@virtualopensystems.com>,
Alex Williamson <alex.williamson@redhat.com>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
KVM list <kvm@vger.kernel.org>,
OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS
<devicetree@vger.kernel.org>,
Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] vfio: platform: Add generic DT reset support
Date: Thu, 22 Feb 2018 10:36:04 +0100 [thread overview]
Message-ID: <1519292164.7447.1.camel@pengutronix.de> (raw)
In-Reply-To: <CAMuHMdXSwsH82U8P3N6jXef72ZP0iiZgzkgEuKhUsqoYmpW93g@mail.gmail.com>
Hi Geert,
On Thu, 2018-02-22 at 09:50 +0100, Geert Uytterhoeven wrote:
[...]
> > > @@ -127,8 +134,15 @@ static int vfio_platform_get_reset(struct vfio_platform_device *vdev)
> > > vdev->of_reset = vfio_platform_lookup_reset(vdev->compat,
> > > &vdev->reset_module);
> > > }
> > > + if (vdev->of_reset)
> > > + return 0;
> > > +
> > > + vdev->reset_control = __of_reset_control_get(vdev->device->of_node,
> > > + NULL, 0, false, false);
> > > + if (!IS_ERR(vdev->reset_control))
> > > + return 0;
> >
> > if you assign to a local variable first here:
> >
> > struct reset_control *rstc;
> >
> > ...
> >
> > rstc = of_reset_control_get_exclusive(vdev->device->of_node, NULL);
> > if (!IS_ERR(rstc)) {
> > vdev->reset_control = rstc;
> > return 0;
> > }
> >
> > Also, please don't use __of_reset_control_get directly.
>
> OK, apparently I didn't read <linux/reset.h> beyond the first #else...
I don't blame you, this is missing some documentation.
> > > @@ -217,6 +233,9 @@ static int vfio_platform_call_reset(struct vfio_platform_device *vdev,
> > > } else if (vdev->of_reset) {
> > > dev_info(vdev->device, "reset\n");
> > > return vdev->of_reset(vdev);
> > > + } else if (!IS_ERR_OR_NULL(vdev->reset_control)) {
> > > + dev_info(vdev->device, "reset\n");
> > > + return reset_control_reset(vdev->reset_control);
> >
> > } else {
> > if (vdev->reset_control)
> > dev_info(vdev->device, "reset\n");
> > return reset_control_reset(vdev->reset_control);
> >
> > > }
>
> I'd like to keep the "else if", as that's the pattern used by the blocks above.
my bad, there's more code after this.
} else if (vdev->reset_control) {
dev_info(vdev->device, "reset\n");
return reset_control_reset(vdev->reset_control);
}
is better as it doesn't lose the warning if vdev->reset_control == NULL.
It seems I've focused too much on getting rid of the IS_ERR_OR_NULL
macro.
regards
Philipp
prev parent reply other threads:[~2018-02-22 9:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-13 16:36 [PATCH 0/2] vfio: platform: Improve reset support Geert Uytterhoeven
2018-02-13 16:36 ` [PATCH 1/2] vfio: platform: Fix reset module leak in error path Geert Uytterhoeven
2018-02-14 8:36 ` Auger Eric
2018-02-14 9:32 ` Geert Uytterhoeven
2018-02-21 16:07 ` Geert Uytterhoeven
2018-02-26 9:47 ` Auger Eric
2018-02-26 9:49 ` Auger Eric
[not found] ` <1518539815-13774-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
2018-02-13 16:36 ` [PATCH 2/2] vfio: platform: Add generic DT reset support Geert Uytterhoeven
2018-02-14 9:09 ` Auger Eric
[not found] ` <ed556509-1460-3e05-b161-f476090ff480-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-02-14 9:43 ` Geert Uytterhoeven
2018-02-14 10:11 ` Auger Eric
2018-02-21 16:12 ` Geert Uytterhoeven
2018-02-21 16:51 ` Philipp Zabel
2018-02-22 8:50 ` Geert Uytterhoeven
2018-02-22 9:36 ` Philipp Zabel [this message]
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=1519292164.7447.1.camel@pengutronix.de \
--to=p.zabel@pengutronix.de \
--cc=alex.williamson@redhat.com \
--cc=b.reynal@virtualopensystems.com \
--cc=devicetree@vger.kernel.org \
--cc=geert+renesas@glider.be \
--cc=geert@linux-m68k.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=robh+dt@kernel.org \
/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).