lkml.org 
[lkml]   [2020]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH v14 3/3] Input: new da7280 haptic driver
Date
> 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.

>
> > +static u8 da7280_haptic_of_gpi_pol_str(struct device *dev,
> > + const char *str)
> > +{
> > + if (!strcmp(str, "Rising-edge"))
> > + return 0;
> > + else if (!strcmp(str, "Falling-edge"))
> > + return 1;
> > + else if (!strcmp(str, "Both-edge"))
> > + return 2;
> > +
> > + dev_warn(dev, "Invalid string - set to default\n");
>
> Maybe mention "Rising-edge" being the default?

OK, I will change them to be clear.

>
> > + return 0;
> > +}
>
> Best regards
> Uwe
>
> --
> Pengutronix e.K. | Uwe Kleine-König |
> Industrial Linux Solutions | https://www.pengutronix.de/ |

\
 
 \ /
  Last update: 2020-06-26 15:18    [W:0.079 / U:0.752 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site