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]
Message-ID: <1418868881.28384.8.camel@perches.com>
Date:	Wed, 17 Dec 2014 18:14:41 -0800
From:	Joe Perches <joe@...ches.com>
To:	Jonathan Richardson <jonathar@...adcom.com>
Cc:	Dmitry Torokhov <dmitry.torokhov@...il.com>,
	Grant Likely <grant.likely@...aro.org>,
	Rob Herring <robh+dt@...nel.org>, Ray Jui <rjui@...adcom.com>,
	linux-kernel@...r.kernel.org, linux-input@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org,
	bcm-kernel-feedback-list@...adcom.com, devicetree@...r.kernel.org
Subject: Re: [PATCH 1/2] Input: touchscreen-iproc: Add Broadcom iProc
 touchscreen driver

On Wed, 2014-12-17 at 17:59 -0800, Jonathan Richardson wrote:
> Add initial version of the Broadcom touchscreen driver.

trivia:

> diff --git a/drivers/input/touchscreen/bcm_iproc_tsc.c b/drivers/input/touchscreen/bcm_iproc_tsc.c

> +/* Bit values for REGCTL2 */
> +#define TS_CONTROLLER_EN_BIT    (1 << 16)
> +#define TS_CONTROLLER_AVGDATA_SHIFT 8
> +#define TS_CONTROLLER_AVGDATA_MASK (0x7 << TS_CONTROLLER_AVGDATA_SHIFT)
> +#define TS_CONTROLLER_PWR_LDO   (1<<5)
> +#define TS_CONTROLLER_PWR_ADC   (1<<4)
> +#define TS_CONTROLLER_PWR_BGP   (1<<3)
> +#define TS_CONTROLLER_PWR_TS    (1<<2)
> +#define TS_WIRE_MODE_BIT        (1<<1)

Be nicer to use the same spacing around <<
or maybe use the BIT macro.

[]

> +static int get_tsc_config(struct device_node *np, struct iproc_ts_priv *priv)
> +{
> +	int ret;
> +	u32 val;
> +	struct device *dev = &priv->pdev->dev;
> +
> +	priv->cfg_params = default_config;
> +
> +	ret = of_property_read_u32(np, "scanning_period", &val);
> +	if (ret >= 0) {
> +		if ((1 <= val) && (val <= 256))
> +			priv->cfg_params.scanning_period = val;
> +		else {
> +			dev_err(dev, "scanning_period must be [1-256]");
> +			return -EINVAL;
> +		}

ret is never used so I'd probably remove it
from all these blocks.

It's probably be nicer to invert the logic ald
remove the else.

There's a missing terminating newline too.

Something like:

	if (of_property_read_u32(np, "scanning_period", &val) >= 0) {
		if (val < 1 || val > 256) {
			dev_err(dev, "scanning_period must be [1-256]\n");
			return -EINVAL;
		}
		priv->cfg_params.scanning_period = val;
	}

etc...


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ