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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 23 Jun 2020 16:41:05 +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-kernel@...r.kernel.org,
        linux-pwm@...r.kernel.org
Subject: Re: [RESEND PATCH V13 3/3] Input: new da7280 haptic driver

Hello,

On Mon, Jun 15, 2020 at 08:40:23PM +0900, Roy Im wrote:
> Adds support for the Dialog DA7280 LRA/ERM Haptic Driver with
> multiple mode and integrated waveform memory and wideband support.
> It communicates via an I2C bus to the device.
> 
> Signed-off-by: Roy Im <roy.im.opensource@...semi.com>

Just some picky comments below.

> +	error = pwm_apply_state(haptics->pwm_dev, &state);
> +	if (error)
> +		dev_err(haptics->dev,
> +			"failed to apply pwm state: %pE\n",
> +			ERR_PTR(error));

You can save some horizontal space here by dropping the \n after the
first comma. (There are a few more occurences.)

> +	return error;
> +}
> +[...]
> +
> +		/* Sync up PWM state and ensure it is off. */
> +		pwm_init_state(haptics->pwm_dev, &state);
> +		state.enabled = false;
> +		error = pwm_apply_state(haptics->pwm_dev, &state);
> +		if (error) {
> +			dev_err(dev,
> +				"failed to apply initial PWM state: %pE\n",
> +				ERR_PTR(error));
> +			return error;
> +		}
> +
> +		/* Check PWM Period, it must be in 10k ~ 250kHz */

The unit of a PWM period is in (nano)seconds, to it cannot be in the
range [10kHz, 250kHz]. (Is this too picky?)

> +		period2freq = 1000000 / state.period;
> +		if (period2freq < DA7280_MIN_PWM_FREQ_KHZ ||
> +		    period2freq > DA7280_MAX_PWM_FREQ_KHZ) {
> +			dev_err(dev, "Not supported PWM frequency(%d)\n",
> +				period2freq);

Doesn't the compiler warn here about period2freq being unsigned and %d
being for signed int values?

For my (non-native) English ear s/Not supported/Unsupported/ sounds
better. Also my eyes would be pleases by a space before the opening
brace.

> +			return -EINVAL;
> +		}
> +	}
> +
> +
> +[...]
> +static struct i2c_driver da7280_driver = {
> +	.driver	= {
> +		.name		= "da7280",
> +		.of_match_table	= of_match_ptr(da7280_of_match),
> +		.pm		= &da7280_pm_ops,

I don't like alignment of =, but I'm aware this is a subjective thing.
(The reason for me is that adding a new member that is longer than the
already existing requires touching all lines. So I stick to a single
space before a =.)

> +	},
> +	.probe	  = da7280_probe,
> +	.id_table = da7280_i2c_id,
> +};
> +module_i2c_driver(da7280_driver);
> +
> +MODULE_DESCRIPTION("DA7280 haptics driver");
> +MODULE_AUTHOR("Roy Im <Roy.Im.Opensource@...semi.com>");
> +MODULE_LICENSE("GPL");
> -- 
> end-of-patch for RESEND PATCH V13

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