lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230501162456.3448c494@jic23-huawei>
Date:   Mon, 1 May 2023 16:24:56 +0100
From:   Jonathan Cameron <jic23@...nel.org>
To:     Herve Codina <herve.codina@...tlin.com>
Cc:     Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Jaroslav Kysela <perex@...ex.cz>,
        Takashi Iwai <tiwai@...e.com>, alsa-devel@...a-project.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-iio@...r.kernel.org,
        Christophe Leroy <christophe.leroy@...roup.eu>,
        Thomas Petazzoni <thomas.petazzoni@...tlin.com>
Subject: Re: [PATCH 4/4] ASoC: codecs: Add support for the generic IIO
 auxiliary devices


> >   
> > > +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



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ