From patchwork Mon Jul 11 12:38:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nuno Sa X-Patchwork-Id: 12913781 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE3A07A for ; Mon, 11 Jul 2022 13:51:10 +0000 (UTC) Received: from pps.filterd (m0167089.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26BBf38I026647; Mon, 11 Jul 2022 08:38:16 -0400 Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 3h76k6bhuv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Jul 2022 08:38:15 -0400 Received: from ASHBMBX9.ad.analog.com (ASHBMBX9.ad.analog.com [10.64.17.10]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 26BCcEaW000398 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 11 Jul 2022 08:38:14 -0400 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBMBX9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Mon, 11 Jul 2022 08:38:13 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server id 15.2.986.14 via Frontend Transport; Mon, 11 Jul 2022 08:38:13 -0400 Received: from nsa.ad.analog.com ([10.44.3.53]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 26BCbVE5011687; Mon, 11 Jul 2022 08:37:33 -0400 From: =?utf-8?q?Nuno_S=C3=A1?= To: , , , , , , Lad Prabhakar , , , , CC: Andy Gross , Nicolas Ferre , Benson Leung , Matthias Brugger , Tomer Maimon , Zhang Rui , "Rafael J. Wysocki" , Eugen Hristev , Sascha Hauer , Alexandre Belloni , Benjamin Fair , Nancy Yuen , Fabrice Gasnier , Jishnu Prakash , Christophe Branchereau , Avi Fishman , Tali Perry , Michael Hennerich , Miquel Raynal , Claudiu Beznea , Lars-Peter Clausen , Thara Gopinath , Cai Huoqing , Fabio Estevam , Olivier Moysan , Shawn Guo , Haibo Chen , Arnd Bergmann , Daniel Lezcano , Patrick Venture , Amit Kucheria , Maxime Coquelin , Lorenzo Bianconi , Paul Cercueil , Andy Shevchenko , Alexandre Torgue , Gwendal Grignou , Bjorn Andersson , Saravanan Sekar , Guenter Roeck , Jonathan Cameron , Pengutronix Kernel Team , Linus Walleij Subject: [PATCH v2 00/15] make iio inkern interface firmware agnostic Date: Mon, 11 Jul 2022 14:38:20 +0200 Message-ID: <20220711123835.811358-1-nuno.sa@analog.com> X-Mailer: git-send-email 2.37.0 Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-ORIG-GUID: WcE9hls-TN6poatnPpXjvAc08Rg5Ey-4 X-Proofpoint-GUID: WcE9hls-TN6poatnPpXjvAc08Rg5Ey-4 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-11_18,2022-07-08_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 adultscore=0 mlxlogscore=921 malwarescore=0 spamscore=0 impostorscore=0 priorityscore=1501 suspectscore=0 mlxscore=0 lowpriorityscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2207110054 First version of the series can be found here: https://lore.kernel.org/linux-iio/20220610084545.547700-1-nuno.sa@analog.com/ v2 changes: [1/15] * Fix typo and added more description in the commit message. [3/15] * Remove superfluous code; * Commit message spell fixes and added more details; * Improved error handling (this is the most significant change in this version. More details on the commit message). [4/15] * Drop the 'ugly' parent_lookup flag. With the new error handling, we can use -ENODEV to infer if we should proceed or not with the lookup. [5/15]: * Moved some local declarations up so long lines first; * Use 'bus_find_device_by_fwnode()'; * Proper ordering in includes. * Adapted error handling in '__fwnode_iio_channel_get_by_name()' taking ACPI into account and when 'name' is given but index < 0. It seems that ACPI code can actually return -ENOENT with index < 0 for which case we should continue the search. Not sure if a check in ACPI ('if (index < 0) return -EINVAL;) like is done in OF would make sense... [12/15]: * Use 'device_property_count_u64()' to get the number of diff channels. So no need for 'magic' divisions by 2 (no idea why I haven't done like this in the first place). [15/15] * Fix wrong conversion of 'if (ptr != NULL)' to 'if (!ptr)'. Special note for patch 3/15 where -ENODEV is still used despite some talks about using -ENOENT and hence, be more in line with firmware code. The reason I kept it was to be consistent with the rest of the file. I'd say that if we want to move to -ENOENT we should do it in a separate patch and for the complete file. Nuno Sá (15): iio: inkern: only release the device node when done with it iio: inkern: fix return value in devm_of_iio_channel_get_by_name() iio: inkern: only return error codes in iio_channel_get_*() APIs iio: inkern: split of_iio_channel_get_by_name() iio: inkern: move to fwnode properties thermal: qcom: qcom-spmi-adc-tm5: convert to IIO fwnode API iio: adc: ingenic-adc: convert to IIO fwnode interface iio: adc: ab8500-gpadc: convert to device properties iio: adc: at91-sama5d2_adc: convert to device properties iio: adc: qcom-pm8xxx-xoadc: convert to device properties iio: adc: qcom-spmi-vadc: convert to device properties iio: adc: qcom-spmi-adc5: convert to device properties iio: adc: stm32-adc: convert to device properties iio: inkern: remove OF dependencies iio: inkern: fix coding style warnings drivers/iio/adc/ab8500-gpadc.c | 27 +-- drivers/iio/adc/at91-sama5d2_adc.c | 30 +-- drivers/iio/adc/ingenic-adc.c | 8 +- drivers/iio/adc/qcom-pm8xxx-xoadc.c | 58 +++-- drivers/iio/adc/qcom-spmi-adc5.c | 63 +++--- drivers/iio/adc/qcom-spmi-vadc.c | 44 ++-- drivers/iio/adc/stm32-adc.c | 121 +++++----- drivers/iio/inkern.c | 271 +++++++++++++---------- drivers/thermal/qcom/qcom-spmi-adc-tm5.c | 3 +- include/linux/iio/consumer.h | 28 +-- include/linux/iio/iio.h | 8 +- 11 files changed, 347 insertions(+), 314 deletions(-)