Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1829770imm; Mon, 3 Sep 2018 10:31:07 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda9oOnpUrOICEwqpC+AnUdT7NDLasiB914wCeTRFQR5UyWvLeEngQeRDKM/wtNid9YQ6wSU X-Received: by 2002:a63:881:: with SMTP id 123-v6mr27057295pgi.244.1535995867533; Mon, 03 Sep 2018 10:31:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535995867; cv=none; d=google.com; s=arc-20160816; b=sENwjqHD8G2jdmkCnzkQ7YJD3GR9XfSaVIJ7VKlGXSMQe5SnitBQ6LP9QRm+18jHev xdELrpgSq/eLvWQPb3TOz9v4bWm8/o2yFk0iHLVSME8yS/NjwaZSmArvLyF6hrtC8PAb nNlc96i2I06s6YSFVi0yCXRoSHZ4Dgw2gjLWXBnoMhTgTaoqFHq4n2+oxXfk6EvY5C/j ssnkkTCAnMxcaAvv9JtUh/IMLv9s0Nxatq7qwV3br51kajjkpQhjbRQv1mVkZp3Xe1A1 eYcPh9K0/6fCYwj+9aD6YKgD05h9xjs67sbkwwlpuzlONdsB6AFFBkwdUXRR9S6s4WoF GfBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=vRAjF0BQpMVEUPJMWmsTvD5D5a32xNYGgVpWsRth2pE=; b=wlttjUL8NB+tsHocy6OUc0u+I+rLb5NSo0+eVByt4L9yG1v1vThvwkiM+VwVbEl0v6 3BbSXi1ZSzxykOtez+/p8Amh5FhJZoinQOhwo1tdEScxYFe+fUR+n1mfLMXImqcRbX6B 1HEuDo+Z9UeBOvVjFlAyjJ0eBER9E4QN0e/AzlCRWUC8NDCAe/dCQelh6QmsQRPeieJt VUv5aABxv7Diz/c+hQKJD4mu6xfTysXMDev0xB2PkWxLnjvH4LZ4TYQIYlviWNtMCRGp 0vOuLvDVZ8/59EzzSe5dlqYgGB0zbVmnBkaZNkFolQOrvbK9emYNaWWTDIT+r8GOFSlZ 8S3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eZVkP29H; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q17-v6si20445005pfi.183.2018.09.03.10.30.52; Mon, 03 Sep 2018 10:31:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eZVkP29H; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731090AbeICVun (ORCPT + 99 others); Mon, 3 Sep 2018 17:50:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:52136 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728575AbeICVum (ORCPT ); Mon, 3 Sep 2018 17:50:42 -0400 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D7FDF20658; Mon, 3 Sep 2018 17:29:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1535995774; bh=mrW6MfUJP6BVuZCk4oLn90TzNdhkVZ0Fay91me6WbWI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=eZVkP29HlEsiQ0I9ReHZjMD7iP7fbu7e1+AdcU+aWTyLuSncC54lKXLmFDawgeX15 gldlZPaW6UXH+LGW/kkfGqff6OAt00GumsH4StUrgvEJ1JoDHJBhZEStj31WYuM49n R7n4xcKQNtPrDsoFlx0MsfVplrOdqVZsykcLGSSc= Date: Mon, 3 Sep 2018 18:29:27 +0100 From: Jonathan Cameron To: Philipp Rossak Cc: lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, linux@armlinux.org.uk, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, eugen.hristev@microchip.com, rdunlap@infradead.org, vilhelm.gray@gmail.com, clabbe.montjoie@gmail.com, quentin.schulz@bootlin.com, geert+renesas@glider.be, lukas@wunner.de, icenowy@aosc.io, arnd@arndb.de, broonie@kernel.org, arnaud.pouliquen@st.com, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: Re: [PATCH v3 18/30] iio: adc: sun4i-gpadc-iio: rework: support multiple sensors Message-ID: <20180903182927.344858c4@archlinux> In-Reply-To: <3722842b-1aa3-ea46-c0ec-7a01bc8a723e@gmail.com> References: <20180830154518.29507-1-embed3d@gmail.com> <20180830154518.29507-19-embed3d@gmail.com> <20180902211125.0098c808@archlinux> <3722842b-1aa3-ea46-c0ec-7a01bc8a723e@gmail.com> X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 3 Sep 2018 15:58:30 +0200 Philipp Rossak 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