All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Margarita Olaya <magi@slimlogic.co.uk>
Cc: linux-kernel@vger.kernel.org, Liam Girdwood <lrg@slimlogic.co.uk>,
	sameo@linux.intel.com
Subject: Re: [PATCHv3 1/4] mfd: tps65912: Add new mfd device
Date: Sun, 15 May 2011 10:05:44 -0700	[thread overview]
Message-ID: <20110515170544.GB11579@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <BANLkTinwGcDx7gU-vMX4=uHhLWC6qBb-jQ@mail.gmail.com>

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.

      reply	other threads:[~2011-05-15 17:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-13 21:30 [PATCHv3 1/4] mfd: tps65912: Add new mfd device Margarita Olaya
2011-05-15 17:05 ` Mark Brown [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110515170544.GB11579@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@slimlogic.co.uk \
    --cc=magi@slimlogic.co.uk \
    --cc=sameo@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.