Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5600707rwr; Mon, 1 May 2023 08:11:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ49En+FP/lz6pTmddvh9caBgM76YhOH3pRa4FCLRck04w83OD9QOxtOQp9cbMI14bia7cYd X-Received: by 2002:a17:90b:30c1:b0:247:c85:21f5 with SMTP id hi1-20020a17090b30c100b002470c8521f5mr21661068pjb.19.1682953870640; Mon, 01 May 2023 08:11:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682953870; cv=none; d=google.com; s=arc-20160816; b=MyQVSX6Ak4Gc+qA09IUv4rluo9kD6zUz0geB6kE+NnutMfiiSBA9DgF2vqdP5xWVqV bgtdxn3RCXwE2lO4Ga+w3liOS9FqcF0oOfeTSt+bb5S2a1KPkgxz/HGPL2GKbBKM9QaX mpBG0EzDQaM/C0nALb9Hc99Tw54byhHJsCi85glY2ymvv1/LSpwSdtfV87sdTgNvLR7K uwhatHhVagko8Pg5ZhxhG31Fuzp666srXEHSSWN6VdzGJaayQoITbfg0aVk0R5Wn4nFj llTk0yJL+x0cpC+oaIXqiZDtP916sJbwz4yFtYaFrT9fCTosOLxWsxSECllLdDnga8dX 7hCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=YtFwf6j3w9Tn37PwEgGeWnMNxeNFB8zltEiqIJNE7VA=; b=x5osy0L4muuJVroG6BDBWdMna4VNCzJEGFVIaC9C3ddvUAHh21dCWg9kRvBJ58uHOY mcHE6tEVEBjCWwjEt7FSvLoQXAgfkYdmlV8l8ds4Q7MdlZmPQTgNzlrKbXT6xcPuYjnU iP4vazJH2YBnGQ9FZKCLLe+fUvf0DLZ9sFooZmTUwx8EXSkd59pWOAkeAI9ReUw0TNpL 4iM60QlQT5NLOoF63JcFDHU0eE6UXuspX6Xu0aW81prgp3RsP7VY2I7SmnF1SMeofovJ 75/IvlLBMjzOUeOhGmV6AQBJoVgZs34Ss3BROvG8bHnRwf0VWP45uCZSP8xPdD8sf1tq 4ARw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LXsZT+m4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u13-20020a17090ae00d00b0024ddf090102si5683328pjy.56.2023.05.01.08.10.58; Mon, 01 May 2023 08:11:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LXsZT+m4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232715AbjEAPJb (ORCPT + 99 others); Mon, 1 May 2023 11:09:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232704AbjEAPJZ (ORCPT ); Mon, 1 May 2023 11:09:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4D6F19A4; Mon, 1 May 2023 08:09:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0CBC361DA3; Mon, 1 May 2023 15:09:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2769C433D2; Mon, 1 May 2023 15:09:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1682953752; bh=cUsOqfxkIZKyqqJ02ZRf0fbQ0VVSONKVBQcffytJjtk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=LXsZT+m4RC1Wkzi4gGg7dhvNreN88Pqydx70S7nVYE3En1YazI1UXgrbDB/acgko4 WdN0xFED3fL+1lqYjoNtpiWvpUkQHn0dNcr5Tiw7hziaTknpfeok8+ybqMSuDk83Sd D28ffSMdMstVcNMKRxmI5eeyRFOrp3EZhxj7ZMV+8YcjLMz6ursQFkWzgde7DSGk0+ hURXmbJ6WJQSwV6dNCtmIFgI+DG/+9sVVEDGOxvPoDA4KmzUD/aQhENlLfkIB+k9z9 aKemwGil86e9cGRezdqtMUWqZVbY0VyyvpxZHHfK1vCGk883WzoXbnogrMeBOyXKV/ jwuPst3iBBYhg== Date: Mon, 1 May 2023 16:24:56 +0100 From: Jonathan Cameron To: Herve Codina Cc: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Lars-Peter Clausen , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, Christophe Leroy , Thomas Petazzoni Subject: Re: [PATCH 4/4] ASoC: codecs: Add support for the generic IIO auxiliary devices Message-ID: <20230501162456.3448c494@jic23-huawei> In-Reply-To: <20230424125216.0f279f82@bootlin.com> References: <20230421124122.324820-1-herve.codina@bootlin.com> <20230421124122.324820-5-herve.codina@bootlin.com> <20230422180814.61d24aa3@jic23-huawei> <20230424125216.0f279f82@bootlin.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.37; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > > > > +static int simple_iio_aux_probe(struct platform_device *pdev) > > > +{ > > > + struct device_node *np = pdev->dev.of_node; > > > + struct simple_iio_aux_chan *iio_aux_chan; > > > + struct simple_iio_aux *iio_aux; > > > + int count; > > > + u32 tmp; > > > + int ret; > > > + int i; > > > + > > > + iio_aux = devm_kzalloc(&pdev->dev, sizeof(*iio_aux), GFP_KERNEL); > > > + if (!iio_aux) > > > + return -ENOMEM; > > > + > > > + iio_aux->dev = &pdev->dev; > > > + > > > + count = of_property_count_strings(np, "io-channel-names"); > > > + if (count < 0) { > > > + dev_err(iio_aux->dev, "%pOF: failed to read io-channel-names\n", np); > > > + return count; > > > + } > > > + > > > + iio_aux->chans = devm_kmalloc_array(&pdev->dev, count, > > > + sizeof(*iio_aux->chans), GFP_KERNEL); > > > + if (!iio_aux->chans) > > > + return -ENOMEM; > > > + iio_aux->num_chans = count; > > > + > > > + for (i = 0; i < iio_aux->num_chans; i++) { > > > + iio_aux_chan = iio_aux->chans + i; > > > + > > > + ret = of_property_read_string_index(np, "io-channel-names", i, > > > + &iio_aux_chan->name); > > > > Whilst today this will be tightly couple with of, if you can use generic firmware > > handling where possible (from linux/property.h) it will reduce what needs > > to be tidied up if anyone fills in the gaps for IIO consumer bindings in ACPI > > and then someone uses PRP0001 based ACPI bindings. > > No device_property_read_*() function family are available to get a value > from an array using an index. That feels like it might be a feature gap in the generic property handling that should be solved. Emtirely reasonable not to do it in this series however! > > I would prefer to keep the of_property_read_*() function family I use for this > first IIO auxiliary device support. > > > > > > + if (ret < 0) { > > > + dev_err(iio_aux->dev, "%pOF: failed to read io-channel-names[%d]\n", np, i); > > > > dev_err_probe() would simplify these cases a little. Not sure on ASOC view on using > > that for cases that won't defer. I tend to take the view it's nicer everywhere > > for calls in probe() functions. > > I have the feeling that ASoC uses dev_err_probe() for cases that can defer. > Mark, can you confirm ? > Left as needs an answer from Mark. Jonathan