From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8EBA4C433FE for ; Wed, 3 Nov 2021 17:14:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6AE2A6112E for ; Wed, 3 Nov 2021 17:14:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229642AbhKCRRf convert rfc822-to-8bit (ORCPT ); Wed, 3 Nov 2021 13:17:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:42078 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229587AbhKCRRe (ORCPT ); Wed, 3 Nov 2021 13:17:34 -0400 Received: from jic23-huawei (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (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 9AC856109F; Wed, 3 Nov 2021 17:14:55 +0000 (UTC) Date: Wed, 3 Nov 2021 17:19:28 +0000 From: Jonathan Cameron To: Anand Ashok Dumbre Cc: Andy Shevchenko , Linux Kernel Mailing List , Lars-Peter Clausen , linux-iio , git , Michal Simek , Peter Meerwald , devicetree , Manish Narani Subject: Re: [PATCH v7 2/4] iio: adc: Add Xilinx AMS driver Message-ID: <20211103171928.23e86227@jic23-huawei> In-Reply-To: References: <20211019152048.28983-1-anand.ashok.dumbre@xilinx.com> <20211019152048.28983-3-anand.ashok.dumbre@xilinx.com> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Tue, 2 Nov 2021 21:31:21 +0000 Anand Ashok Dumbre wrote: > Hi Andy, > > Thanks for the review. ... > > > + return IRQ_NONE; > > > > ... > > > > > + for_each_child_of_node(chan_node, child) { > > > + ret = of_property_read_u32(child, "reg", ®); > > > + if (ret || reg > (AMS_PL_MAX_EXT_CHANNEL + 30)) > > > + continue; > > > + > > > + memcpy(&channels[num_channels], &ams_pl_channels[reg + > > > + AMS_PL_MAX_FIXED_CHANNEL - 30], > > > + sizeof(*channels)); > > > + > > > + if (of_property_read_bool(child, "xlnx,bipolar")) > > > + channels[num_channels].scan_type.sign = 's'; > > > + > > > + num_channels++; > > > + } > > > > Use device property API here instead of *of_*() calls. > > > > > > ... > > > > > + /* Initialize buffer for channel specification */ > > > + ams_channels = kzalloc(sizeof(ams_ps_channels) + > > > + sizeof(ams_pl_channels) + > > > + sizeof(ams_ctrl_channels), GFP_KERNEL); > > > > Use the corresponding macro from overflow.h. > > > > > + if (!ams_channels) > > > + return -ENOMEM; > > > > ... > > > > > + if (of_device_is_available(np)) { > > > > fwnode_device_is_available() > > Currently acpi is not supported with this driver. But I will add support in the next series of patches. > I don’t have a full understanding of ACPI and its interfaces. So would it be okay once the first iteration > gets checked in, I will add ACPI support on top. If you use the generic fwnode etc from property.h then dt will just work and it may well be enough to enable the weirdness that is ACPI ID PRP0001 which actually uses dt properties but reads them from an ACPI DSDT. So basically nothing to do except use the generic accessors rather than the of_ variants. Jonathan