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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Sun, 15 May 2011 10:05:44 -0700
From:	Mark Brown <broonie@...nsource.wolfsonmicro.com>
To:	Margarita Olaya <magi@...mlogic.co.uk>
Cc:	linux-kernel@...r.kernel.org, Liam Girdwood <lrg@...mlogic.co.uk>,
	sameo@...ux.intel.com
Subject: Re: [PATCHv3 1/4] mfd: tps65912: Add new mfd device

On Fri, May 13, 2011 at 04:30:22PM -0500, Margarita Olaya wrote:

> +#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
> +static int tps65912_i2c_read(struct tps65912 *tps65912, u8 reg,
> +				  int bytes, void *dest)
> +{

Putting both SPI and I2C drivers into the same file means that I2C is
forced to be built in if SPI is enabled (SPI can't be built as a
module).  This isn't a big deal really but it's nice to avoid the
dependency.

> +	dcdc_avs = (pmic_plat_data->is_dcdc1_avs << 0 |
> +			pmic_plat_data->is_dcdc2_avs  << 1 |
> +				pmic_plat_data->is_dcdc3_avs << 2 |
> +					pmic_plat_data->is_dcdc4_avs << 3);
> +	if (dcdc_avs) {
> +		tps65912->read(tps65912, TPS65912_I2C_SPI_CFG, 1, &value);
> +		dcdc_avs |= value;
> +		tps65912->write(tps65912, TPS65912_I2C_SPI_CFG, 1, &dcdc_avs);
> +	}
> +
> +	ret = mfd_add_devices(tps65912->dev, -1,
> +			      tps65912s, ARRAY_SIZE(tps65912s),
> +			      NULL, 0);
> +	if (ret < 0)
> +		goto err;

The platform data and MFD handling are common to both I2C and SPI - it'd
seem sensible to factor them out into a separate function called by the
I2C and SPI init paths to ensure they are kept in sync.
--
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