[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180903182927.344858c4@archlinux>
Date: Mon, 3 Sep 2018 18:29:27 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Philipp Rossak <embed3d@...il.com>
Cc: lee.jones@...aro.org, robh+dt@...nel.org, mark.rutland@....com,
maxime.ripard@...tlin.com, wens@...e.org, linux@...linux.org.uk,
knaack.h@....de, lars@...afoo.de, pmeerw@...erw.net,
eugen.hristev@...rochip.com, rdunlap@...radead.org,
vilhelm.gray@...il.com, clabbe.montjoie@...il.com,
quentin.schulz@...tlin.com, geert+renesas@...der.be,
lukas@...ner.de, icenowy@...c.io, arnd@...db.de,
broonie@...nel.org, arnaud.pouliquen@...com,
linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-sunxi@...glegroups.com
Subject: Re: [PATCH v3 18/30] iio: adc: sun4i-gpadc-iio: rework: support
multiple sensors
On Mon, 3 Sep 2018 15:58:30 +0200
Philipp Rossak <embed3d@...il.com> wrote:
> On 02.09.2018 22:11, Jonathan Cameron wrote:
> > This feels like a good place to factor out the code into a utility
> > function that just does one of them. That should hopefully
> > reduce the indenting etc enough to make the code easier to read.
> >
> >> + info->tzds[i].info = info;
> >> + info->tzds[i].sensor_id = i;
> >> +
> >> + info->tzds[i].tzd = thermal_zone_of_sensor_register(
> >> + info->sensor_device,
> >> + i, &info->tzds[i], &sun4i_ts_tz_ops);
> >> + /*
> >> + * Do not fail driver probing when failing to register in
> >> + * thermal because no thermal DT node is found.
> >> + */
> >> + if (IS_ERR(info->tzds[i].tzd) && \
> >> + PTR_ERR(info->tzds[i].tzd) != -ENODEV) {
> >> + dev_err(&pdev->dev,
> >> + "could not register thermal sensor: %ld\n",
> >> + PTR_ERR(info->tzds[i].tzd));
> >> + return PTR_ERR(info->tzds[i].tzd);
> >> + }
>
> So this code above should be placed in a separate function and called by
> the for loop?
> Did I understand that right?
Yes - exactly.
>
> Philipp
Powered by blists - more mailing lists