From: William Breathitt Gray <william.gray@linaro.org>
To: Jonathan Cameron <jic23@kernel.org>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
Syed Nayyar Waris <syednwaris@gmail.com>
Subject: Re: [PATCH] counter: 104-quad-8: Implement and utilize register structures
Date: Tue, 14 Jun 2022 12:07:47 -0400 [thread overview]
Message-ID: <YqiyU46LB7XZw1D8@fedora> (raw)
In-Reply-To: <20220614121302.27a13e4d@jic23-huawei>
[-- Attachment #1: Type: text/plain, Size: 2425 bytes --]
On Tue, Jun 14, 2022 at 12:13:02PM +0100, Jonathan Cameron wrote:
> On Wed, 1 Jun 2022 16:36:29 -0400
> William Breathitt Gray <william.gray@linaro.org> wrote:
>
> > Reduce magic numbers and improve code readability by implementing and
> > utilizing named register data structures.
> >
> > Cc: Syed Nayyar Waris <syednwaris@gmail.com>
> > Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
>
> In this particular case this does clean up the + 1's scattered through
> the code to access the control registers so I'm more or less convinced
> readability is improved. The access via an offset from a base is
> a very common pattern though in kernel drivers, so reviewers tend
> to be used to it, hence I'm not sure I'd want to see lots of drivers
> go this way. Fine here though.
>
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> > ---
> > drivers/counter/104-quad-8.c | 166 ++++++++++++++++++++---------------
> > 1 file changed, 93 insertions(+), 73 deletions(-)
> >
> > diff --git a/drivers/counter/104-quad-8.c b/drivers/counter/104-quad-8.c
> > index 43dde9abfdcf..a1ec04313926 100644
> > --- a/drivers/counter/104-quad-8.c
> > +++ b/drivers/counter/104-quad-8.c
> > @@ -33,6 +33,36 @@ MODULE_PARM_DESC(irq, "ACCES 104-QUAD-8 interrupt line numbers");
> >
> > #define QUAD8_NUM_COUNTERS 8
> >
> > +/**
> > + * struct channel_reg - channel register structure
> > + * @data: Count data
> > + * @control: Channel flags and control
> > + */
> > +struct channel_reg {
> > + u8 data;
> > + u8 control;
> > +};
> > +
> > +/**
> > + * struct quad8_reg - device register structure
> > + * @channel: quadrature counter data and control
> > + * @interrupt_status: channel interrupt status
> > + * @channel_oper: enable/reset counters and interrupt functions
> > + * @index_interrupt: enable channel interrupts
> > + * @reserved: reserved for Factory Use
> > + * @index_input_levels: index signal logical input level
> > + * @cable_status: differential encoder cable status
> > + */
> > +struct quad8_reg {
> > + struct channel_reg channel[QUAD_NUM_COUNTERS];
Oops, this should be QUAD8_NUM_COUNTERS here. I'll submit a v2 with this
typo fixed when I get a chance and then give this patch some more time
for others to test; assuming no other changes, I'll add your
Reviewed-by tag as well.
Thanks,
William Breathitt Gray
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
prev parent reply other threads:[~2022-06-14 16:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-01 20:36 [PATCH] counter: 104-quad-8: Implement and utilize register structures William Breathitt Gray
2022-06-14 11:13 ` Jonathan Cameron
2022-06-14 16:07 ` William Breathitt Gray [this message]
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=YqiyU46LB7XZw1D8@fedora \
--to=william.gray@linaro.org \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=syednwaris@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.