All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Cc: Lee Jones <lee.jones@linaro.org>,
	Samuel Ortiz <sameo@linux.intel.com>,
	Mike Turquette <mturquette@linaro.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Alessandro Zummo <a.zummo@towertech.it>,
	Kukjin Kim <kgene.kim@samsung.com>,
	Doug Anderson <dianders@chromium.org>,
	Olof Johansson <olof@lixom.net>,
	Sjoerd Simons <sjoerd.simons@collabora.co.uk>,
	Daniel Stone <daniels@collabora.com>,
	Tomeu Vizoso <tomeu.vizoso@collabora.com>,
	linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
	linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] regulator: Add driver for Maxim 77802 PMIC regulators
Date: Mon, 9 Jun 2014 20:38:49 +0100	[thread overview]
Message-ID: <20140609193849.GE5099@sirena.org.uk> (raw)
In-Reply-To: <1402306670-17041-3-git-send-email-javier.martinez@collabora.co.uk>

[-- Attachment #1: Type: text/plain, Size: 1928 bytes --]

On Mon, Jun 09, 2014 at 11:37:47AM +0200, Javier Martinez Canillas wrote:

> +	case REGULATOR_MODE_STANDBY:			/* switch off */
> +		if (id != MAX77802_LDO1 && id != MAX77802_LDO20 &&
> +			id != MAX77802_LDO21 && id != MAX77802_LDO3) {
> +			val = MAX77802_OPMODE_STANDBY;
> +			break;
> +		}
> +		/* no break */

This sounds very broken...

> +		/* OK if some GPIOs aren't defined */
> +		if (!gpio_is_valid(gpio))
> +			continue;
> +
> +		/* If a GPIO is valid, we'd better be able to claim it */
> +		ret = devm_gpio_request_one(dev, gpio, GPIOF_OUT_INIT_HIGH,
> +					    "max77802 selb");
> +		if (ret) {
> +			dev_err(dev, "can't claim gpio[%d]: %d\n", i, ret);
> +			return ret;
> +		}

Can this use the GPIO descriptor API?

> +static void max77802_copy_reg(struct device *dev, struct regmap *regmap,
> +			      int from_reg, int to_reg)
> +{
> +	int val;
> +	int ret;
> +
> +	if (from_reg == to_reg)
> +		return;
> +
> +	ret = regmap_read(regmap, from_reg, &val);
> +	if (!ret)
> +		ret = regmap_write(regmap, to_reg, val);
> +
> +	if (ret)
> +		dev_warn(dev, "Copy err %d => %d (%d)\n",
> +			 from_reg, to_reg, ret);
> +}

This doesn't look at all device specific, better implement it in generic
code.

> +	if (pdata->num_regulators != MAX77802_MAX_REGULATORS) {
> +		dev_err(&pdev->dev,
> +			"Invalid initial data for regulator's initialiation: " \
> +			"expected %d, pdata/dt provided %d\n",
> +			MAX77802_MAX_REGULATORS,
> +			pdata->num_regulators);
> +		return -EINVAL;
> +	}

Don't split log messages over multiple lines so people can find the log
message in the kernel source with grep, though in any case checking for
this is a bug - the driver should always be at least able to read the
current state from the hardware.

> +static int __init max77802_pmic_init(void)
> +{
> +	return platform_driver_register(&max77802_pmic_driver);
> +}
> +subsys_initcall(max77802_pmic_init);

module_platform_driver().

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

WARNING: multiple messages have this Message-ID
From: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Javier Martinez Canillas
	<javier.martinez-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org>
Cc: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Samuel Ortiz <sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
	Mike Turquette
	<mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Liam Girdwood <lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Alessandro Zummo
	<a.zummo-BfzFCNDTiLLj+vYz1yj4TQ@public.gmane.org>,
	Kukjin Kim <kgene.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Doug Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
	Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>,
	Sjoerd Simons
	<sjoerd.simons-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org>,
	Daniel Stone <daniels-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>,
	Tomeu Vizoso
	<tomeu.vizoso-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 2/5] regulator: Add driver for Maxim 77802 PMIC regulators
Date: Mon, 9 Jun 2014 20:38:49 +0100	[thread overview]
Message-ID: <20140609193849.GE5099@sirena.org.uk> (raw)
In-Reply-To: <1402306670-17041-3-git-send-email-javier.martinez-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1928 bytes --]

On Mon, Jun 09, 2014 at 11:37:47AM +0200, Javier Martinez Canillas wrote:

> +	case REGULATOR_MODE_STANDBY:			/* switch off */
> +		if (id != MAX77802_LDO1 && id != MAX77802_LDO20 &&
> +			id != MAX77802_LDO21 && id != MAX77802_LDO3) {
> +			val = MAX77802_OPMODE_STANDBY;
> +			break;
> +		}
> +		/* no break */

This sounds very broken...

> +		/* OK if some GPIOs aren't defined */
> +		if (!gpio_is_valid(gpio))
> +			continue;
> +
> +		/* If a GPIO is valid, we'd better be able to claim it */
> +		ret = devm_gpio_request_one(dev, gpio, GPIOF_OUT_INIT_HIGH,
> +					    "max77802 selb");
> +		if (ret) {
> +			dev_err(dev, "can't claim gpio[%d]: %d\n", i, ret);
> +			return ret;
> +		}

Can this use the GPIO descriptor API?

> +static void max77802_copy_reg(struct device *dev, struct regmap *regmap,
> +			      int from_reg, int to_reg)
> +{
> +	int val;
> +	int ret;
> +
> +	if (from_reg == to_reg)
> +		return;
> +
> +	ret = regmap_read(regmap, from_reg, &val);
> +	if (!ret)
> +		ret = regmap_write(regmap, to_reg, val);
> +
> +	if (ret)
> +		dev_warn(dev, "Copy err %d => %d (%d)\n",
> +			 from_reg, to_reg, ret);
> +}

This doesn't look at all device specific, better implement it in generic
code.

> +	if (pdata->num_regulators != MAX77802_MAX_REGULATORS) {
> +		dev_err(&pdev->dev,
> +			"Invalid initial data for regulator's initialiation: " \
> +			"expected %d, pdata/dt provided %d\n",
> +			MAX77802_MAX_REGULATORS,
> +			pdata->num_regulators);
> +		return -EINVAL;
> +	}

Don't split log messages over multiple lines so people can find the log
message in the kernel source with grep, though in any case checking for
this is a bug - the driver should always be at least able to read the
current state from the hardware.

> +static int __init max77802_pmic_init(void)
> +{
> +	return platform_driver_register(&max77802_pmic_driver);
> +}
> +subsys_initcall(max77802_pmic_init);

module_platform_driver().

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

WARNING: multiple messages have this Message-ID
From: broonie@kernel.org (Mark Brown)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/5] regulator: Add driver for Maxim 77802 PMIC regulators
Date: Mon, 9 Jun 2014 20:38:49 +0100	[thread overview]
Message-ID: <20140609193849.GE5099@sirena.org.uk> (raw)
In-Reply-To: <1402306670-17041-3-git-send-email-javier.martinez@collabora.co.uk>

On Mon, Jun 09, 2014 at 11:37:47AM +0200, Javier Martinez Canillas wrote:

> +	case REGULATOR_MODE_STANDBY:			/* switch off */
> +		if (id != MAX77802_LDO1 && id != MAX77802_LDO20 &&
> +			id != MAX77802_LDO21 && id != MAX77802_LDO3) {
> +			val = MAX77802_OPMODE_STANDBY;
> +			break;
> +		}
> +		/* no break */

This sounds very broken...

> +		/* OK if some GPIOs aren't defined */
> +		if (!gpio_is_valid(gpio))
> +			continue;
> +
> +		/* If a GPIO is valid, we'd better be able to claim it */
> +		ret = devm_gpio_request_one(dev, gpio, GPIOF_OUT_INIT_HIGH,
> +					    "max77802 selb");
> +		if (ret) {
> +			dev_err(dev, "can't claim gpio[%d]: %d\n", i, ret);
> +			return ret;
> +		}

Can this use the GPIO descriptor API?

> +static void max77802_copy_reg(struct device *dev, struct regmap *regmap,
> +			      int from_reg, int to_reg)
> +{
> +	int val;
> +	int ret;
> +
> +	if (from_reg == to_reg)
> +		return;
> +
> +	ret = regmap_read(regmap, from_reg, &val);
> +	if (!ret)
> +		ret = regmap_write(regmap, to_reg, val);
> +
> +	if (ret)
> +		dev_warn(dev, "Copy err %d => %d (%d)\n",
> +			 from_reg, to_reg, ret);
> +}

This doesn't look at all device specific, better implement it in generic
code.

> +	if (pdata->num_regulators != MAX77802_MAX_REGULATORS) {
> +		dev_err(&pdev->dev,
> +			"Invalid initial data for regulator's initialiation: " \
> +			"expected %d, pdata/dt provided %d\n",
> +			MAX77802_MAX_REGULATORS,
> +			pdata->num_regulators);
> +		return -EINVAL;
> +	}

Don't split log messages over multiple lines so people can find the log
message in the kernel source with grep, though in any case checking for
this is a bug - the driver should always be at least able to read the
current state from the hardware.

> +static int __init max77802_pmic_init(void)
> +{
> +	return platform_driver_register(&max77802_pmic_driver);
> +}
> +subsys_initcall(max77802_pmic_init);

module_platform_driver().
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140609/7365afd5/attachment.sig>

  reply	other threads:[~2014-06-09 19:39 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-09  9:37 [PATCH 0/5] Add Maxim 77802 PMIC support Javier Martinez Canillas
2014-06-09  9:37 ` Javier Martinez Canillas
2014-06-09  9:37 ` [PATCH 1/5] mfd: Add driver for Maxim 77802 Power Management IC Javier Martinez Canillas
2014-06-09  9:37   ` Javier Martinez Canillas
2014-06-09 10:22   ` Krzysztof Kozlowski
2014-06-09 10:22     ` Krzysztof Kozlowski
2014-06-09 11:56     ` Mark Brown
2014-06-09 11:56       ` Mark Brown
2014-06-09 23:07     ` Javier Martinez Canillas
2014-06-09 23:07       ` Javier Martinez Canillas
2014-06-09 19:47   ` Mark Brown
2014-06-09 19:47     ` Mark Brown
2014-06-09 23:40     ` Javier Martinez Canillas
2014-06-09 23:40       ` Javier Martinez Canillas
2014-06-09  9:37 ` [PATCH 2/5] regulator: Add driver for Maxim 77802 PMIC regulators Javier Martinez Canillas
2014-06-09  9:37   ` Javier Martinez Canillas
2014-06-09 19:38   ` Mark Brown [this message]
2014-06-09 19:38     ` Mark Brown
2014-06-09 19:38     ` Mark Brown
2014-06-09 23:29     ` Javier Martinez Canillas
2014-06-09 23:29       ` Javier Martinez Canillas
2014-06-10 10:53       ` Mark Brown
2014-06-10 10:53         ` Mark Brown
2014-06-09  9:37 ` [PATCH 3/5] clk: Add driver for Maxim 77802 PMIC clocks Javier Martinez Canillas
2014-06-09  9:37   ` Javier Martinez Canillas
2014-06-09  9:37   ` Javier Martinez Canillas
2014-06-16  8:44   ` Lee Jones
2014-06-16  8:44     ` Lee Jones
2014-06-16  8:54     ` Javier Martinez Canillas
2014-06-16  8:54       ` Javier Martinez Canillas
2014-06-09  9:37 ` [PATCH 4/5] rtc: Add driver for Maxim 77802 PMIC Real-Time-Clock Javier Martinez Canillas
2014-06-09  9:37   ` Javier Martinez Canillas
2014-06-09  9:37 ` [PATCH 5/5] ARM: dts: Add max77802 device node for exynos5420-peach-pit Javier Martinez Canillas
2014-06-09  9:37   ` Javier Martinez Canillas
2014-06-09 10:16 ` [PATCH 0/5] Add Maxim 77802 PMIC support Krzysztof Kozlowski
2014-06-09 10:16   ` Krzysztof Kozlowski
2014-06-09 16:04   ` Doug Anderson
2014-06-09 16:04     ` Doug Anderson
2014-06-09 16:04     ` Doug Anderson
2014-06-09 22:55     ` Javier Martinez Canillas
2014-06-09 22:55       ` Javier Martinez Canillas
2014-06-09 22:55       ` Javier Martinez Canillas
2014-06-09 23:57       ` Doug Anderson
2014-06-09 23:57         ` Doug Anderson
2014-06-09 23:57         ` Doug Anderson
2014-06-10  7:45       ` Krzysztof Kozlowski
2014-06-10  7:45         ` Krzysztof Kozlowski
2014-06-10  7:45         ` Krzysztof Kozlowski
2014-06-10  7:32     ` Krzysztof Kozlowski
2014-06-10  7:32       ` Krzysztof Kozlowski
2014-06-10  7:32       ` Krzysztof Kozlowski
2014-06-10  7:50       ` Javier Martinez Canillas
2014-06-10  7:50         ` Javier Martinez Canillas
2014-06-10  7:50         ` Javier Martinez Canillas

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=20140609193849.GE5099@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=a.zummo@towertech.it \
    --cc=daniels@collabora.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dianders@chromium.org \
    --cc=javier.martinez@collabora.co.uk \
    --cc=kgene.kim@samsung.com \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=mturquette@linaro.org \
    --cc=olof@lixom.net \
    --cc=sameo@linux.intel.com \
    --cc=sjoerd.simons@collabora.co.uk \
    --cc=tomeu.vizoso@collabora.com \
    --subject='Re: [PATCH 2/5] regulator: Add driver for Maxim 77802 PMIC regulators' \
    /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

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.