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] [day] [month] [year] [list]
Date:   Tue, 14 Jun 2022 12:07:47 -0400
From:   William Breathitt Gray <william.gray@...aro.org>
To:     Jonathan Cameron <jic23@...nel.org>
Cc:     linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
        Syed Nayyar Waris <syednwaris@...il.com>
Subject: Re: [PATCH] counter: 104-quad-8: Implement and utilize register
 structures

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@...aro.org> wrote:
> 
> > Reduce magic numbers and improve code readability by implementing and
> > utilizing named register data structures.
> > 
> > Cc: Syed Nayyar Waris <syednwaris@...il.com>
> > Signed-off-by: William Breathitt Gray <william.gray@...aro.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@...wei.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

Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ