linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: k.kozlowski@samsung.com (Krzysztof Kozlowski)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 10/18] mfd: max14577: Add detection of device type
Date: Wed, 05 Feb 2014 14:38:44 +0100	[thread overview]
Message-ID: <1391607524.3726.23.camel@AMDC1943> (raw)
In-Reply-To: <20140203095541.GK13529@lee--X1>

On Mon, 2014-02-03 at 09:55 +0000, Lee Jones wrote:
> > This patch continues the preparation for adding support for max77836
> > device to existing max14577 driver.
> > 
> > Add enum for types of devices supported by this driver. The device type
> > will be detected by matching of_device_id, or i2c_device_id as a
> > fallback.
> > 
> > The patch also moves to separate function the code related to displaying
> > DeviceID register values.
> > 
> > Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> > Cc: Kyungmin Park <kyungmin.park@samsung.com>
> > Cc: Marek Szyprowski <m.szyprowski@samsung.com>
> > ---
> >  drivers/mfd/max14577.c               |   61 +++++++++++++++++++++++-----------
> >  include/linux/mfd/max14577-private.h |   12 ++++---
> >  2 files changed, 50 insertions(+), 23 deletions(-)
> > 
> > diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c
> > index 1d8104213b3e..224aba8c5b3f 100644
> > --- a/drivers/mfd/max14577.c
> > +++ b/drivers/mfd/max14577.c
> > @@ -20,6 +20,7 @@
> 
> <snip>
> 
> > +static void max14577_print_dev_type(struct maxim_core *maxim_core)
> > +{
> > +	u8 reg_data, vendor_id, device_id;
> > +	int ret = max14577_read_reg(maxim_core->regmap_muic,
> > +			MAXIM_MUIC_REG_DEVICEID, &reg_data);
> 
> I'm not a big fan of declaring variables whilst feeding them with
> function return values. Can you separate the two please?

Sure.

> 
> > +	if (ret) {
> > +		dev_err(maxim_core->dev, "Failed to read DEVICEID
> > register: %d\n",
> 
> I think this is too many chars.

OK.

> 
> > +				ret);
> > +		return;
> > +	}
> > +
> 
> <snip>
> 
> > -	ret = max14577_read_reg(maxim_core->regmap_muic,
> > -			MAXIM_MUIC_REG_DEVICEID, &reg_data);
> > -	if (ret) {
> > -		dev_err(maxim_core->dev, "Device not found on this channel: %d\n",
> > -				ret);
> > -		return ret;
> > +	if (np) {
> > +		const struct of_device_id *of_id =
> > +			of_match_device(max14577_dt_match, &i2c->dev);
> 
> Again this is a bit messy. Bring it down onto a separate line.

OK.

I'll send fixed version after grabbing more ACK-s for previous
rename-patches (this patch depends on them).

Best regards,
Krzysztof

  reply	other threads:[~2014-02-05 13:38 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-28 12:18 [PATCH 00/18] mfd: max14577: Add support for MAX77836 Krzysztof Kozlowski
2014-01-28 12:18 ` [PATCH 01/18] regulator: max14577: Remove unused state container definition Krzysztof Kozlowski
2014-01-28 16:19   ` Mark Brown
2014-01-28 12:18 ` [PATCH 02/18] mfd: max14577: Remove unused enum max14577_irq_source Krzysztof Kozlowski
2014-02-03  9:25   ` Lee Jones
2014-01-28 12:18 ` [PATCH 03/18] mfd: max14577: Remove not needed header inclusion Krzysztof Kozlowski
2014-02-03  9:26   ` Lee Jones
2014-01-28 12:18 ` [PATCH 04/18] mfd: max14577: Add of_compatible to extcon mfd_cell Krzysztof Kozlowski
2014-02-03  9:27   ` Lee Jones
2014-01-28 12:18 ` [PATCH 05/18] mfd: max14577: Use of_match_ptr() in i2c_driver Krzysztof Kozlowski
2014-01-29 10:08   ` Krzysztof Kozlowski
2014-02-03  9:30   ` Lee Jones
2014-02-05 10:41     ` Krzysztof Kozlowski
2014-01-28 12:18 ` [PATCH 06/18] extcon: max14577: Change extcon name instead of static name according to device type Krzysztof Kozlowski
2014-02-05  0:43   ` Chanwoo Choi
2014-01-28 12:18 ` [PATCH 07/18] mfd: max14577: Rename and add MAX14577 symbols to prepare for max77836 Krzysztof Kozlowski
2014-02-03  9:38   ` Lee Jones
2014-02-05 10:45     ` Krzysztof Kozlowski
2014-02-06  1:53   ` Chanwoo Choi
2014-01-28 12:18 ` [PATCH 08/18] mfd: max14577: Rename state container to maxim_core Krzysztof Kozlowski
2014-02-03  9:42   ` Lee Jones
2014-02-05 10:48     ` Krzysztof Kozlowski
2014-02-06  1:55   ` Chanwoo Choi
2014-01-28 12:18 ` [PATCH 09/18] mfd: max14577: Add "muic" suffix to regmap and irq_chip Krzysztof Kozlowski
2014-02-03  9:45   ` Lee Jones
2014-02-05 10:48     ` Krzysztof Kozlowski
2014-02-06  1:56   ` Chanwoo Choi
2014-01-28 12:18 ` [PATCH 10/18] mfd: max14577: Add detection of device type Krzysztof Kozlowski
2014-02-03  9:55   ` Lee Jones
2014-02-05 13:38     ` Krzysztof Kozlowski [this message]
2014-01-28 12:18 ` [PATCH 11/18] extcon: max14577: Add max14577 prefix to muic_irqs Krzysztof Kozlowski
2014-02-05  0:47   ` Chanwoo Choi
2014-02-05 10:40     ` Krzysztof Kozlowski
2014-02-05 14:04       ` Lee Jones
2014-02-06  2:24         ` Chanwoo Choi
2014-01-28 12:18 ` [PATCH 12/18] extcon: max14577: Choose muic_irqs according to device type Krzysztof Kozlowski
2014-01-28 12:18 ` [PATCH 13/18] mfd: max77836: Add max77836 support to max14577 driver Krzysztof Kozlowski
2014-02-03 10:22   ` Lee Jones
2014-02-05 14:57     ` Krzysztof Kozlowski
2014-01-28 12:18 ` [PATCH 14/18] extcon: max14577: Add support for max77836 Krzysztof Kozlowski
2014-02-03 10:23   ` Lee Jones
2014-01-28 12:18 ` [PATCH 15/18] regulator: max14577: Add support for max77836 regulators Krzysztof Kozlowski
2014-01-28 16:25   ` Mark Brown
2014-02-03 10:24   ` Lee Jones
2014-01-28 12:18 ` [PATCH 16/18] charger: max14577: Add support for MAX77836 charger Krzysztof Kozlowski
2014-02-03 10:26   ` Lee Jones
2014-02-03 11:30   ` Jenny Tc
2014-02-05 12:49     ` Krzysztof Kozlowski
2014-01-28 12:18 ` [PATCH 17/18] power: max17040: Add ID for max77836 Fuel Gauge block Krzysztof Kozlowski
2014-01-28 12:18 ` [PATCH 18/18] mfd: max14577: Add device tree bindings document Krzysztof Kozlowski

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=1391607524.3726.23.camel@AMDC1943 \
    --to=k.kozlowski@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).