Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1687101imm; Mon, 3 Sep 2018 07:00:25 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb/MvBtAEg4yTaCwgXxSlavpOz02PK2ll1oatyrngJPNEeK6PwHIO0Y5+cpq7NtDwcY30H1 X-Received: by 2002:a63:4425:: with SMTP id r37-v6mr26325786pga.391.1535983225194; Mon, 03 Sep 2018 07:00:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535983225; cv=none; d=google.com; s=arc-20160816; b=h+/Qe9I9jfm+3INsHZeLz9mn5zfzycu4nvR+1hDQkBUr0KS6/tn9FmJAU5qC4lY07h rAsQHStWOfQeJcLdhd9/yFp3jgkRIgD9bKxyniNr9JQqLtEYMS17pT7meOZ3eCYxXIDm MqBq7wDlrW/3poZ3/N5YDrzzbfzi2MZ2XkwKXKKsF3U37mrQbqLq1pWV3HGzUKmJ7Hvq ehnKDR4ySEHsiJFAiTYG+TWgZ+GxBO+yl96xsGMT4CD7lo9eUo23anScrqh6rYNKYK1h +NuU/Nx8OKfoIVIY5IEG9fcNmTr6oz2ymDh49Dvk+jfKVCKe56z/BHUEqUWhMVdIo8tW QN7w== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=SZrTlOG64axx9DjK82bdU8/ljh4au3bhLYNdc7CICWw=; b=hXpDQGslvd/spxBv1sMAPSswk6DvoxMFmbUzt5Igm2LsWs5KnQGkzkELDtiHnCFR9R M+cc+ZdDdrKLyt/Z/Oop3bmasP/BVUxi/DQNnfXZEzsOpvLCWzHfGiyGsysHz2fkCzIk bVIjrUHQY+v0xnIVFfLgGkGYN8f7nZ32G1ZO5YFPGXW3m1MkYuG9SDM+8t26aKVfAt9T 664LWW8XRIMrIVWyuoHZqqPQ9b1jLYZ6K1AV+nXhSTT9G8YaqS5+sMkDXYFeFWUwbcZf K7W12QUBZs9WCmnu6pk/5qFWHGXovau2tWUgJNyzYqdkHfamPfok7ER3exwHlSZeP/V/ 2ocw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IpDkL1an; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d20-v6si18447306pgj.535.2018.09.03.07.00.10; Mon, 03 Sep 2018 07:00:25 -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=@gmail.com header.s=20161025 header.b=IpDkL1an; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727607AbeICSSw (ORCPT + 99 others); Mon, 3 Sep 2018 14:18:52 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:41256 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726284AbeICSSv (ORCPT ); Mon, 3 Sep 2018 14:18:51 -0400 Received: by mail-wr1-f68.google.com with SMTP id z96-v6so762068wrb.8; Mon, 03 Sep 2018 06:58:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=SZrTlOG64axx9DjK82bdU8/ljh4au3bhLYNdc7CICWw=; b=IpDkL1an5aU9fnk2k0Xa9d3iS6+61WHVWZiiAPfafJrOSMnauic6FCPUXEPNRq1z7v j20Q6AqelzIJ8nN2J2g0pal+lvp+z5oO2bYP9qrV7VJPGLxmrrX9k5rQjKKB7wqC1zPW M0/yZ/RzT1hD8EF6d6HfJolhAp40fyAbSvH15Cog2GUWkMa6+r0m2M2L1c5sEVeP+GyD QM0EPpcD053T/Bx3Dh52LdnORH1aPS+9iWxShqiS5tD/RV/ZIyt6u0RdfeOjWlze/HWI M9kv9NTuGsL0pA2eXWHWp711QH97CrFRSY2MF190kra3T/i8gGCOIeQZrRm5AWDycRIt UZpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=SZrTlOG64axx9DjK82bdU8/ljh4au3bhLYNdc7CICWw=; b=OYR1WkWUeNA1JaS6vrhqLkEYifDjrkCnnk9ixD41aCuwteA7Y1A7H+KJP2l4pAHJto z7fwFvXKTIZ+pmnUs5ZQOx6WDPZASj2TY7CuO2u4OWpEn4lszrcI639xNch2sM82C+h2 KeuzLBYnoM/KY8paIpqaAAywXlm+4uO9z2Ui30FWTHEwr+j0LiqGpcP/Pm3YMwBsjkOF j/vLFsnXcejjQ+5jqsdWtpkREDHl+Gtsy1X1gLfVxJiaXWcwE1vlrrUq+J3HS49DLmsU TiRGjvDRKx2IzIefgX7bJtk6hh+hd5YXHhmdyDN6B9Fha/FsIhhyvY3LCQ4ce8dGuYAz yb9w== X-Gm-Message-State: APzg51BUEwqSVq3FHlUN21BvIqkOksfyZFRILl5Gj76nijcRGGEw/Th/ ASqDwQFpbWuNfkvCFY/oD9Y= X-Received: by 2002:adf:8445:: with SMTP id 63-v6mr19530088wrf.41.1535983112076; Mon, 03 Sep 2018 06:58:32 -0700 (PDT) Received: from [10.104.3.222] (eduroam-nat1.rz.uni-ulm.de. [134.60.112.236]) by smtp.gmail.com with ESMTPSA id j44-v6sm27745684wre.40.2018.09.03.06.58.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Sep 2018 06:58:31 -0700 (PDT) Subject: Re: [PATCH v3 18/30] iio: adc: sun4i-gpadc-iio: rework: support multiple sensors To: Jonathan Cameron 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 References: <20180830154518.29507-1-embed3d@gmail.com> <20180830154518.29507-19-embed3d@gmail.com> <20180902211125.0098c808@archlinux> From: Philipp Rossak Message-ID: <3722842b-1aa3-ea46-c0ec-7a01bc8a723e@gmail.com> Date: Mon, 3 Sep 2018 15:58:30 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180902211125.0098c808@archlinux> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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