linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: AnilKumar Ch <anilkumar@ti.com>
Cc: sameo@linux.intel.com, lrg@ti.com, linux-kernel@vger.kernel.org,
	linux-omap@vger.kernel.org, nsekhar@ti.com
Subject: Re: [PATCH 1/2] MFD: TPS65217: Add new mfd device for TPS65217
Date: Fri, 23 Dec 2011 10:49:18 +0000	[thread overview]
Message-ID: <20111223104918.GD2834@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1324617679-14301-1-git-send-email-anilkumar@ti.com>

On Fri, Dec 23, 2011 at 10:51:19AM +0530, AnilKumar Ch wrote:
> The TPS65217 chip is a power management IC for Portable Navigation Systems
> and Tablet Computing devices. It contains the following components:

I can't help but thinking that there ought to be more code sharing
between the various TI PMIC drivers.

> +static int tps65217_i2c_read_device(struct tps65217_dev *tps65217, char reg,
> +				  int bytes, void *dest)
> +{
> +	struct i2c_client *i2c = tps65217->i2c_client;
> +	struct i2c_msg xfer[2];
> +	int ret;

Use regmap for the register I/O, this will save a lot of code and will
also give access to things like the register cache code.

> +	tps65217 = kzalloc(sizeof(struct tps65217_dev), GFP_KERNEL);
> +	if (tps65217 == NULL)
> +		return -ENOMEM;

Use devm_kzalloc(), it saves all the unwinding code.

> +/* All register addresses */
> +#define TPS65217_REG_CHIPID		0X00

You should verify this as part of the probe() routine - read it back to
make sure it's what's expected, and log the chip revision too in case it
is useful for diagnostics.

       reply	other threads:[~2011-12-23 10:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1324617679-14301-1-git-send-email-anilkumar@ti.com>
2011-12-23 10:49 ` Mark Brown [this message]
2011-12-28  9:14   ` [PATCH 1/2] MFD: TPS65217: Add new mfd device for TPS65217 AnilKumar, Chimata
2012-01-02  9:48   ` AnilKumar, Chimata
2012-01-02 11:29     ` Mark Brown

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=20111223104918.GD2834@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=anilkumar@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=lrg@ti.com \
    --cc=nsekhar@ti.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).