devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Cristian Pop <cristian.pop@analog.com>,
	<linux-iio@vger.kernel.org>, <linux-gpio@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<robh+dt@kernel.org>
Subject: Re: [PATCH v2 2/2] one-bit-adc-dac: Add initial version of one bit ADC-DAC
Date: Fri, 21 Jan 2022 14:56:09 +0000	[thread overview]
Message-ID: <20220121145609.00005fa7@Huawei.com> (raw)
In-Reply-To: <CAHp75VeakSDtDfGO1tcZKgoJ0KTAHgYMKG1v=cYDSHoc-zLUbw@mail.gmail.com>

On Tue, 18 Jan 2022 19:06:20 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Mon, Jan 17, 2022 at 8:41 AM Jonathan Cameron <jic23@kernel.org> wrote:
> > On Tue, 11 Jan 2022 13:59:19 +0200
> > Cristian Pop <cristian.pop@analog.com> wrote:  
> 
> > > +     st->labels = devm_kzalloc(device, sizeof(*st->labels) * child_num, GFP_KERNEL);
> > > +     if (!st->labels)
> > > +             return -ENOMEM;
> > > +
> > > +     i = child_num;
> > > +     fwnode_for_each_child_node(fwnode, child) {
> > > +             if (fwnode_property_read_u32(child, "reg", &crt_ch))
> > > +                     continue;
> > > +
> > > +             if (crt_ch >= num_channels)
> > > +                     continue;
> > > +
> > > +             if (fwnode_property_read_string(child, "label", &label))
> > > +                     continue;
> > > +
> > > +             chan = &channels[crt_ch];  
> > ? Not used.
> >  
> > > +             st->labels[--i] = label;  
> 
> > I've no idea how this works...  Should be looking for the chan->channel
> > value as that's what your read uses to index.  
> 
> It's an implicit memcpy().

Not that.  What I don't follow is how it ends up in the right element of
st->labels[] seeing as i has nothing to do with reg which should
be the channel number.  Far as I can see it's setting the labels
in a random order.

Jonathan

> 
> > > +     }
> > > +
> > > +     return 0;
> > > +}  
> 
> 
> 


  reply	other threads:[~2022-01-21 14:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-11 11:59 [PATCH v2 1/2] dt-bindings: iio: addac: one-bit-adc-dac yaml documentation Cristian Pop
2022-01-11 11:59 ` [PATCH v2 2/2] one-bit-adc-dac: Add initial version of one bit ADC-DAC Cristian Pop
2022-01-12 15:23   ` Andy Shevchenko
2022-01-16 11:52   ` Jonathan Cameron
2022-01-18 17:06     ` Andy Shevchenko
2022-01-21 14:56       ` Jonathan Cameron [this message]
2022-01-19  9:38     ` Sa, Nuno
2022-01-21 10:24     ` Pop, Cristian
2022-01-21 14:54       ` Jonathan Cameron
2022-01-11 15:14 ` [PATCH v2 1/2] dt-bindings: iio: addac: one-bit-adc-dac yaml documentation Rob Herring
2022-01-11 22:02 ` Rob Herring
2022-01-16 11:30 ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220121145609.00005fa7@Huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=cristian.pop@analog.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).