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] [day] [month] [year] [list]
Date:	Mon, 21 Jul 2014 09:04:20 +0100
From:	Lee Jones <lee.jones@...aro.org>
To:	"Opensource [Steve Twiss]" <stwiss.opensource@...semi.com>
Cc:	Alessandro Zummo <a.zummo@...ertech.it>,
	Andrew Morton <akpm@...ux-foundation.org>,
	LINUX-KERNEL <linux-kernel@...r.kernel.org>,
	RTC-LINUX <rtc-linux@...glegroups.com>,
	Samuel Ortiz <sameo@...ux.intel.com>,
	David Dajun Chen <david.chen@...semi.com>,
	Mark Brown <broonie@...aro.org>,
	Philipp Zabel <p.zabel@...gutronix.de>,
	Support Opensource <support.opensource@...semi.com>
Subject: Re: [RFC V1] mfd: da9063: Add support for AD silicon variant

On Wed, 16 Jul 2014, Opensource [Steve Twiss] wrote:
> From: Opensource [Steve Twiss] <stwiss.opensource@...semi.com>
> 
> Add register definitions for DA9063 AD (0x3) silicon variant ID
> and Kconfig support to choose the silicon variant at compile time.
> This patch also adds RTC support for the AD silicon changes.
> 
> It adds AD support as a compile-time flag under a new menu item in
> Kconfig called 'Support DA9063 AD silicon variant ID'. This allows
> the user to choose AD support, or to leave blank and choose support
> for the newer silicon variant ID, but not both at the same time.
> 
> This extra option for supporting AD will only appear if the main 'Dialog
> Semiconductor DA9063 PMIC Support' option is chosen. The AD support
> boolean will be defaulted to false (unchecked) until the user
> modifies it. This means that AD support is not turned on by default.
> 
> The DA9063 probe function has been modified to use the compile time
> directive CONFIG_MFD_DA9063_AD. This configuration option will allow
> AD support only if this boolean is true, otherwise it will default to
> support BB (or greater) silicon.
> 
> 
> Signed-off-by: Opensource [Steve Twiss] <stwiss.opensource@...semi.com>
> ---

[...]

> --- a/drivers/mfd/da9063-core.c
> +++ b/drivers/mfd/da9063-core.c

[...]

> -	if (variant_code != PMIC_DA9063_BB) {
> -		dev_err(da9063->dev, "Unknown chip variant code: 0x%02X\n",
> -				variant_code);
> +#ifdef CONFIG_MFD_DA9063_AD
> +	if (variant_code != PMIC_DA9063_AD) {
> +		dev_err(da9063->dev,
> +			"Only AD (0x3) silicon is supported in this configuration: 0x%02X\n",
> +			variant_code);
>  		return -ENODEV;
>  	}
> +#else
> +	if (variant_code < PMIC_DA9063_BB) {
> +		dev_err(da9063->dev,
> +			"Cannot support variant code < BB (0x5): 0x%02X\n",
> +			variant_code);
> +		return -ENODEV;
> +	}
> +#endif

[...]

> diff --git a/drivers/rtc/rtc-da9063.c b/drivers/rtc/rtc-da9063.c
> index 5953930..66c3073 100644
> --- a/drivers/rtc/rtc-da9063.c
> +++ b/drivers/rtc/rtc-da9063.c

[...]

> +#ifdef CONFIG_MFD_DA9063_AD
> +	data[RTC_SEC] = 0;
> +	ret = regmap_bulk_read(rtc->hw->regmap, DA9063_REG_ALARM_MI,
> +			       &data[RTC_MIN], RTC_ALARM_DATA_LEN);
> +#else
>  	ret = regmap_bulk_read(rtc->hw->regmap, DA9063_REG_ALARM_S,
>  			       &data[RTC_SEC], RTC_DATA_LEN);
> +#endif

This isn't how we normally do things.  You need to create local
variables for the differences and populated them in a switch statement
based on variant ID.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
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