From mboxrd@z Thu Jan 1 00:00:00 1970 From: Philipp Rossak Subject: Re: [PATCH v3 18/30] iio: adc: sun4i-gpadc-iio: rework: support multiple sensors Date: Mon, 3 Sep 2018 15:58:30 +0200 Message-ID: <3722842b-1aa3-ea46-c0ec-7a01bc8a723e@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> <20180830154518.29507-19-embed3d@gmail.com> <20180902211125.0098c808@archlinux> Reply-To: embed3d-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Return-path: Sender: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org In-Reply-To: <20180902211125.0098c808@archlinux> Content-Language: en-US List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , To: Jonathan Cameron Cc: lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, mark.rutland-5wv7dgnIgG8@public.gmane.org, maxime.ripard-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org, wens-jdAy2FN1RRM@public.gmane.org, linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org, knaack.h-Mmb7MZpHnFY@public.gmane.org, lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org, pmeerw-jW+XmwGofnusTnJN9+BGXg@public.gmane.org, eugen.hristev-UWL1GkI3JZL3oGB3hsPCZA@public.gmane.org, rdunlap-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org, vilhelm.gray-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, clabbe.montjoie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, quentin.schulz-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org, geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org, lukas-JFq808J9C/izQB+pC5nmwQ@public.gmane.org, icenowy-h8G6r0blFSE@public.gmane.org, arnd-r2nGTMty4D4@public.gmane.org, broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, arnaud.pouliquen-qxv4g6HH51o@public.gmane.org, linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-Id: devicetree@vger.kernel.org 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? Philipp