From: William Breathitt Gray <william.gray@linaro.org>
To: Biju Das <biju.das.jz@bp.renesas.com>
Cc: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Chris Paterson <Chris.Paterson2@renesas.com>,
Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>,
"linux-renesas-soc@vger.kernel.org"
<linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH v6 4/5] counter: Add Renesas RZ/G2L MTU3a counter driver
Date: Mon, 14 Nov 2022 23:53:07 -0500 [thread overview]
Message-ID: <Y3MbM0RtaAKUIyWM@fedora> (raw)
In-Reply-To: <TYCPR01MB59337BB8E20273468F38560E86059@TYCPR01MB5933.jpnprd01.prod.outlook.com>
[-- Attachment #1: Type: text/plain, Size: 1421 bytes --]
On Mon, Nov 14, 2022 at 05:52:11PM +0000, Biju Das wrote:
> > > > +static int rz_mtu3_initialize_counter(struct counter_device
> > > > +*counter, int id) {
> > > > + struct rz_mtu3_cnt *const priv = counter_priv(counter);
> > > > + struct rz_mtu3_channel *ch1 = priv->ch;
> > > > + struct rz_mtu3_channel *ch2 = ch1 + 1;
> > >
> > > No need to complicate this, just use priv->ch[0], priv->ch[1], and
> > > priv->ch[id]. Same advice applies to the other functions as well.
> >
> > I get below error when I use array susbscripts. "*ch1 = priv->ch[0];"
>
> > drivers/counter/rz-mtu3-cnt.c:291:32: error: incompatible types when
> > initialising type 'struct rz_mtu3_channel *' using type 'struct
> > rz_mtu3_channel'
> > 291 | struct rz_mtu3_channel *ch1 = priv->ch[0];
> >
>
> I could use "*ch1 = &priv->ch[0];" please let me know is it ok?
>
> Cheers,
> Biju
Hi Biju,
I meant to use the array subscripts inline (e.g. priv->ch[id].function).
However, I can see the benefit of using the ch1 and ch2 local variables,
so perhaps something like this would be clearer to read:
struct rz_mtu3_chanel *const ch = priv->ch;
struct rz_mtu3_chanel *const ch1 = &ch[0];
struct rz_mtu3_chanel *const ch2 = &ch[1];
...
case RZ_MTU3_16_BIT_MTU1_CH:
case RZ_MTU3_16_BIT_MTU2_CH:
if (ch[id].function != RZ_MTU3_NORMAL) {
...
William Breathitt Gray
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2022-11-15 4:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20221113171545.282457-1-biju.das.jz@bp.renesas.com>
2022-11-13 17:15 ` [PATCH v6 3/5] Documentation: ABI: sysfs-bus-counter: add external_input_phase_clock_select & long_word_access_ctrl_mode items Biju Das
2022-11-13 17:15 ` [PATCH v6 4/5] counter: Add Renesas RZ/G2L MTU3a counter driver Biju Das
2022-11-14 3:47 ` William Breathitt Gray
2022-11-14 13:53 ` William Breathitt Gray
2022-11-14 16:27 ` Biju Das
2022-11-14 15:24 ` Biju Das
2022-11-14 17:52 ` Biju Das
2022-11-15 4:53 ` William Breathitt Gray [this message]
2022-11-15 10:38 ` Biju Das
2022-11-16 2:12 ` William Breathitt Gray
2022-11-16 3:27 ` William Breathitt Gray
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=Y3MbM0RtaAKUIyWM@fedora \
--to=william.gray@linaro.org \
--cc=Chris.Paterson2@renesas.com \
--cc=biju.das.jz@bp.renesas.com \
--cc=geert+renesas@glider.be \
--cc=linux-iio@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
/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