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  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:   Fri, 14 Feb 2020 01:35:50 +0000
From:   Roy Im <roy.im.opensource@...semi.com>
To:     Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>,
        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: [RESEND PATCH V8 3/3] Input: new da7280 haptic driver

On Tuesday, February 11, 2020 11:26 PM, Uwe Kleine-König wrote

> On Tue, Feb 11, 2020 at 10:13:24AM +0900, Roy Im wrote:
> > diff --git a/drivers/input/misc/da7280.c b/drivers/input/misc/da7280.c
> > new file mode 100644 index 0000000..4d1d1fc
> > --- /dev/null
> > +++ b/drivers/input/misc/da7280.c
> > @@ -0,0 +1,1688 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +/*
> > + * DA7280 Haptic device driver
> > + *
> > + * Copyright (c) 2019 Dialog Semiconductor.
> > + * Author: Roy Im <Roy.Im.Opensource@...semi.com>  */
> > +
> > +#include <linux/err.h>
> > +#include <linux/i2c.h>
> > +#include <linux/input.h>
> > +#include <linux/interrupt.h>
> > +#include <linux/module.h>
> > +#include <linux/pwm.h>
> > +#include <linux/regmap.h>
> > +#include <linux/workqueue.h>
> > +#include <linux/uaccess.h>
> > +#include "da7280.h"
> 
> Don't introduce a header file that is only used once. Better put the definitions into the c file then.

I will put the definitions into the c file.

> 
> > [...]
> > +static int da7280_haptic_set_pwm(struct da7280_haptic *haptics) {
> > +	struct pwm_args pargs;
> > +	u64 period_mag_multi;
> > +	unsigned int pwm_duty;
> > +	int error;
> > +
> > +	pwm_get_args(haptics->pwm_dev, &pargs);
> > +	period_mag_multi =
> > +		(u64)(pargs.period * haptics->gain);
> 
> This cast does not do anything, does it?

I will remove this.

> 
> > +	if (haptics->acc_en)
> > +		pwm_duty =
> > +			(unsigned int)(period_mag_multi >> 16);
> > +	else
> > +		pwm_duty =
> > +			(unsigned int)((period_mag_multi >> 16)
> > +				+ pargs.period) / 2;
> > +
> > +	error = pwm_config(haptics->pwm_dev,
> > +			   pwm_duty, pargs.period);
> > +	if (error) {
> > +		dev_err(haptics->dev,
> > +			"failed to configure pwm : %d\n", error);
> > +		return error;
> > +	}
> > +
> > +	error = pwm_enable(haptics->pwm_dev);
> > +	if (error) {
> > +		pwm_disable(haptics->pwm_dev);
> > +		dev_err(haptics->dev,
> > +			"failed to enable haptics pwm device : %d\n", error);
> > +	}
> 
> You should not use the legacy pwm API. Please stick to pwm_apply_state().
> 
> Also consider using %pE for more expressive error messages.

I will replace the legacy pwm API and stick to pwm_apply_state() and consider using the %pE.

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

Hello Uwe,

Thanks for your comments.
I will try to update as you advise.

Best regards,
Roy

Powered by blists - more mailing lists