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]
Date:   Fri, 26 Jun 2020 17:56:04 +0200
From:   Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
To:     Roy Im <roy.im.opensource@...semi.com>
Cc:     Bartosz Golaszewski <bgolaszewski@...libre.com>,
        Brian Masney <masneyb@...tation.org>,
        Dmitry Torokhov <dmitry.torokhov@...il.com>,
        Greg KH <gregkh@...uxfoundation.org>,
        Lee Jones <lee.jones@...aro.org>, Luca Weiss <luca@...tu.xyz>,
        Maximilian Luz <luzmaximilian@...il.com>,
        Pascal PAILLET-LME <p.paillet@...com>,
        Rob Herring <robh@...nel.org>,
        Samuel Ortiz <sameo@...ux.intel.com>,
        Thierry Reding <thierry.reding@...il.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Support Opensource <Support.Opensource@...semi.com>,
        "linux-input@...r.kernel.org" <linux-input@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-pwm@...r.kernel.org" <linux-pwm@...r.kernel.org>
Subject: Re: [PATCH v14 3/3] Input: new da7280 haptic driver

On Fri, Jun 26, 2020 at 01:17:29PM +0000, Roy Im wrote:
> > On Fri, June 26, 2020 3:19 PM, Uwe Kleine-König wrote:
> > Hello,
> > from the PWM POV I'm happy now. Just a few minor comments that I noticed while checking the PWM details.
> 
> Many thanks for your comments.
> 
> > 
> > On Thu, Jun 25, 2020 at 01:59:29AM +0900, Roy Im wrote:
> > > +		val = haptics->ps_seq_id << DA7280_PS_SEQ_ID_SHIFT |
> > > +			haptics->ps_seq_loop << DA7280_PS_SEQ_LOOP_SHIFT;
> > 
> > If you write this as:
> > 
> > 	val = FIELD_PREP(DA7280_PS_SEQ_ID_MASK, haptics->ps_seq_id) |
> > 		FIELD_PREP(DA7280_PS_SEQ_LOOP_MASK, haptics->ps_seq_loop);
> > 
> > you get some additional checks for free and can drop all defines for ..._SHIFT .
> 
> It is not difficult to update that as you advise, but I think having
> the shift there explicitly makes it more readable, so most of the
> drivers from my team have the defines(shift) up to now. I guess this
> is a kind of subjective thing. 
> Do you think it is still necessary? Then I will update as you said.

No, from my side it's not a hard requirement (and after all I'm not the
one who will take your commit). I personally like it better with
FIELD_PREP, but I can still sleep if you don't agree :-)

What I don't like about having both ..._SHIFT and ..._MASK is that there
is some duplication as ..._SHIFT can be calculated from ..._MASK:

	#define LALA_SHIFT (ffs(LALA_MASK) - 1)

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ