All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: Russell King <linux@arm.linux.org.uk>,
	Daniel Mack <daniel@zonque.org>,
	Robert Jarzmik <robert.jarzmik@free.fr>,
	Linus Walleij <linus.walleij@linaro.org>,
	Alexandre Courbot <gnurou@gmail.com>,
	Wolfram Sang <wsa@the-dreams.de>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Bryan Wu <cooloney@gmail.com>, Richard Purdie <rpurdie@rpsys.net>,
	Samuel Ortiz <sameo@linux.intel.com>,
	Lee Jones <lee.jones@linaro.org>,
	Jingoo Han <jg1.han@samsung.com>,
	Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
	Tomi Valkeinen <tomi.valkeinen@ti.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Andrea Adami <andrea.adami@gmail.com>,
	linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org,
	linux-i2c@vger.kernel.org, linux-input@vger.kernel.org,
	linux-leds@vger.kernel.org, linux-spi@vger.kernel.org,
	linux-fbdev@vger.kernel.org, alsa-devel@alsa-project.org
Subject: Re: [PATCH v2 09/17] spi: add locomo SPI driver
Date: Wed, 29 Apr 2015 12:27:19 +0100	[thread overview]
Message-ID: <20150429112719.GK22845@sirena.org.uk> (raw)
In-Reply-To: <1430178954-11138-10-git-send-email-dbaryshkov@gmail.com>

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

On Tue, Apr 28, 2015 at 02:55:46AM +0300, Dmitry Eremin-Solenikov wrote:

> +static int locomospi_reg_open(struct locomospi_dev *spidev)
> +{

> +static int locomospi_reg_release(struct locomospi_dev *spidev)
> +{

These are a bit weird - as far as I can tell they're just doing some
init done on probe and release?  I think I'd expect to see them either
inlined there or done as part of the PM operations too (including
runtime ones).

> +	for (j = 0; j < wait; j++) {
> +		regmap_read(spidev->regmap, LOCOMO_SPIST, &r);
> +		if (r & LOCOMO_SPI_RFW)
> +			break;
> +	}
> +	if (j == wait)
> +		dev_err(&spi->dev, "rfw timeout\n");

But we don't return an error if we time out?

> +static int locomo_spi_setup_transfer(struct spi_device *spi,
> +		struct spi_transfer *t)
> +{
> +	struct locomospi_dev *spidev;
> +	u32 hz = 0;
> +
> +	if (t)
> +		hz = t->speed_hz;
> +	if (!hz)
> +		hz = spi->max_speed_hz;

The core will set a speed on every transfer for you.

> +	if (!tx && !rx && t->len)
> +		return -EINVAL;

Put this in the core if it's needed.

> +static int locomo_spi_remove(struct platform_device *pdev)
> +{
> +	struct spi_master *master = platform_get_drvdata(pdev);
> +	struct locomospi_dev *spidev = spi_master_get_devdata(master);
> +
> +	return locomospi_reg_release(spidev);

We're doing this release before we free the master which is potentially
racy - but do we even need to do it at all?

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

WARNING: multiple messages have this Message-ID (diff)
From: Mark Brown <broonie@kernel.org>
To: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: Russell King <linux@arm.linux.org.uk>,
	Daniel Mack <daniel@zonque.org>,
	Robert Jarzmik <robert.jarzmik@free.fr>,
	Linus Walleij <linus.walleij@linaro.org>,
	Alexandre Courbot <gnurou@gmail.com>,
	Wolfram Sang <wsa@the-dreams.de>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Bryan Wu <cooloney@gmail.com>, Richard Purdie <rpurdie@rpsys.net>,
	Samuel Ortiz <sameo@linux.intel.com>,
	Lee Jones <lee.jones@linaro.org>,
	Jingoo Han <jg1.han@samsung.com>,
	Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
	Tomi Valkeinen <tomi.valkeinen@ti.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Andrea Adami <andrea.adami@gmail.com>,
	linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org,
	linux-i2c@vger.kernel.org, linux-input@vger.kernel.org,
	linux-leds@vger.kernel.org, linux-spi@vger.kernel.org,
	linux-fbdev@vger.kernel.org, alsa-devel@alsa-project.org
Subject: Re: [PATCH v2 09/17] spi: add locomo SPI driver
Date: Wed, 29 Apr 2015 11:27:19 +0000	[thread overview]
Message-ID: <20150429112719.GK22845@sirena.org.uk> (raw)
In-Reply-To: <1430178954-11138-10-git-send-email-dbaryshkov@gmail.com>

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

On Tue, Apr 28, 2015 at 02:55:46AM +0300, Dmitry Eremin-Solenikov wrote:

> +static int locomospi_reg_open(struct locomospi_dev *spidev)
> +{

> +static int locomospi_reg_release(struct locomospi_dev *spidev)
> +{

These are a bit weird - as far as I can tell they're just doing some
init done on probe and release?  I think I'd expect to see them either
inlined there or done as part of the PM operations too (including
runtime ones).

> +	for (j = 0; j < wait; j++) {
> +		regmap_read(spidev->regmap, LOCOMO_SPIST, &r);
> +		if (r & LOCOMO_SPI_RFW)
> +			break;
> +	}
> +	if (j == wait)
> +		dev_err(&spi->dev, "rfw timeout\n");

But we don't return an error if we time out?

> +static int locomo_spi_setup_transfer(struct spi_device *spi,
> +		struct spi_transfer *t)
> +{
> +	struct locomospi_dev *spidev;
> +	u32 hz = 0;
> +
> +	if (t)
> +		hz = t->speed_hz;
> +	if (!hz)
> +		hz = spi->max_speed_hz;

The core will set a speed on every transfer for you.

> +	if (!tx && !rx && t->len)
> +		return -EINVAL;

Put this in the core if it's needed.

> +static int locomo_spi_remove(struct platform_device *pdev)
> +{
> +	struct spi_master *master = platform_get_drvdata(pdev);
> +	struct locomospi_dev *spidev = spi_master_get_devdata(master);
> +
> +	return locomospi_reg_release(spidev);

We're doing this release before we free the master which is potentially
racy - but do we even need to do it at all?

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

WARNING: multiple messages have this Message-ID (diff)
From: broonie@kernel.org (Mark Brown)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 09/17] spi: add locomo SPI driver
Date: Wed, 29 Apr 2015 12:27:19 +0100	[thread overview]
Message-ID: <20150429112719.GK22845@sirena.org.uk> (raw)
In-Reply-To: <1430178954-11138-10-git-send-email-dbaryshkov@gmail.com>

On Tue, Apr 28, 2015 at 02:55:46AM +0300, Dmitry Eremin-Solenikov wrote:

> +static int locomospi_reg_open(struct locomospi_dev *spidev)
> +{

> +static int locomospi_reg_release(struct locomospi_dev *spidev)
> +{

These are a bit weird - as far as I can tell they're just doing some
init done on probe and release?  I think I'd expect to see them either
inlined there or done as part of the PM operations too (including
runtime ones).

> +	for (j = 0; j < wait; j++) {
> +		regmap_read(spidev->regmap, LOCOMO_SPIST, &r);
> +		if (r & LOCOMO_SPI_RFW)
> +			break;
> +	}
> +	if (j == wait)
> +		dev_err(&spi->dev, "rfw timeout\n");

But we don't return an error if we time out?

> +static int locomo_spi_setup_transfer(struct spi_device *spi,
> +		struct spi_transfer *t)
> +{
> +	struct locomospi_dev *spidev;
> +	u32 hz = 0;
> +
> +	if (t)
> +		hz = t->speed_hz;
> +	if (!hz)
> +		hz = spi->max_speed_hz;

The core will set a speed on every transfer for you.

> +	if (!tx && !rx && t->len)
> +		return -EINVAL;

Put this in the core if it's needed.

> +static int locomo_spi_remove(struct platform_device *pdev)
> +{
> +	struct spi_master *master = platform_get_drvdata(pdev);
> +	struct locomospi_dev *spidev = spi_master_get_devdata(master);
> +
> +	return locomospi_reg_release(spidev);

We're doing this release before we free the master which is potentially
racy - but do we even need to do it at all?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150429/45f7d423/attachment.sig>

  reply	other threads:[~2015-04-29 11:27 UTC|newest]

Thread overview: 148+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-27 23:55 [PATCH v2 00/17] new locomo driver set Dmitry Eremin-Solenikov
2015-04-27 23:55 ` Dmitry Eremin-Solenikov
2015-04-27 23:55 ` Dmitry Eremin-Solenikov
2015-04-27 23:55 ` [PATCH v2 01/17] mfd: add new driver for Sharp LoCoMo Dmitry Eremin-Solenikov
2015-04-27 23:55   ` Dmitry Eremin-Solenikov
     [not found]   ` <1430178954-11138-2-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-04-28 18:45     ` Lee Jones
2015-04-28 18:45       ` Lee Jones
2015-05-12 20:39       ` Dmitry Eremin-Solenikov
2015-05-12 20:39         ` Dmitry Eremin-Solenikov
2015-05-12 20:39         ` Dmitry Eremin-Solenikov
2015-05-12 20:39         ` Dmitry Eremin-Solenikov
2015-05-13  9:41         ` Lee Jones
2015-05-13  9:41           ` Lee Jones
2015-05-13  9:41           ` Lee Jones
2015-05-13  9:41           ` Lee Jones
2015-04-27 23:55 ` [PATCH v2 02/17] leds: port locomo leds driver to new locomo core Dmitry Eremin-Solenikov
2015-04-27 23:55   ` Dmitry Eremin-Solenikov
2015-04-27 23:55   ` Dmitry Eremin-Solenikov
2015-05-06 15:05   ` Jacek Anaszewski
2015-05-06 15:05     ` Jacek Anaszewski
2015-05-06 15:05     ` Jacek Anaszewski
2015-05-12 15:35     ` Dmitry Eremin-Solenikov
2015-05-12 15:35       ` Dmitry Eremin-Solenikov
2015-05-12 15:35       ` Dmitry Eremin-Solenikov
2015-05-12 15:35       ` Dmitry Eremin-Solenikov
     [not found]       ` <CALT56yNJWapNw1XLrzfbUDUz1LF_BB9DfF94H6GhbnBUEP80_w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-13 10:31         ` Jacek Anaszewski
2015-05-13 10:31           ` Jacek Anaszewski
2015-05-13 10:31           ` Jacek Anaszewski
2015-05-13 10:31           ` Jacek Anaszewski
     [not found]           ` <555327EA.5060402-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-05-13 14:14             ` Dmitry Eremin-Solenikov
2015-05-13 14:14               ` Dmitry Eremin-Solenikov
2015-05-13 14:14               ` Dmitry Eremin-Solenikov
2015-05-13 14:14               ` Dmitry Eremin-Solenikov
2015-05-13 14:53               ` Jacek Anaszewski
2015-05-13 14:53                 ` Jacek Anaszewski
2015-05-13 14:53                 ` Jacek Anaszewski
2015-05-13 14:53                 ` Jacek Anaszewski
     [not found]                 ` <5553654F.4010608-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-05-13 16:42                   ` Dmitry Torokhov
2015-05-13 16:42                     ` Dmitry Torokhov
2015-05-13 16:42                     ` Dmitry Torokhov
2015-05-13 16:42                     ` Dmitry Torokhov
2015-05-14  6:35                     ` Jacek Anaszewski
2015-05-14  6:35                       ` Jacek Anaszewski
2015-05-14  6:35                       ` Jacek Anaszewski
2015-05-14  6:35                       ` Jacek Anaszewski
2015-04-27 23:55 ` [PATCH v2 05/17] video: backlight: add new locomo backlight driver Dmitry Eremin-Solenikov
2015-04-27 23:55   ` Dmitry Eremin-Solenikov
2015-04-27 23:55   ` Dmitry Eremin-Solenikov
     [not found] ` <1430178954-11138-1-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-04-27 23:55   ` [PATCH v2 03/17] input: convert LoCoMo keyboard driver to use new locomo core Dmitry Eremin-Solenikov
2015-04-27 23:55     ` Dmitry Eremin-Solenikov
2015-04-27 23:55     ` Dmitry Eremin-Solenikov
2015-05-12 20:21     ` Dmitry Torokhov
2015-05-12 20:21       ` Dmitry Torokhov
2015-05-12 20:21       ` Dmitry Torokhov
2015-05-12 21:01       ` Dmitry Eremin-Solenikov
2015-05-12 21:01         ` Dmitry Eremin-Solenikov
2015-05-12 21:01         ` Dmitry Eremin-Solenikov
2015-05-12 21:01         ` Dmitry Eremin-Solenikov
2015-05-12 21:13         ` Dmitry Torokhov
2015-05-12 21:13           ` Dmitry Torokhov
2015-05-12 21:13           ` Dmitry Torokhov
2015-05-12 21:13           ` Dmitry Torokhov
2015-04-27 23:55   ` [PATCH v2 04/17] input: locomokbd: provide an Alt-SysRQ combination Dmitry Eremin-Solenikov
2015-04-27 23:55     ` Dmitry Eremin-Solenikov
2015-04-27 23:55     ` Dmitry Eremin-Solenikov
2015-05-12 20:12     ` Dmitry Torokhov
2015-05-12 20:12       ` Dmitry Torokhov
2015-05-12 20:12       ` Dmitry Torokhov
2015-05-12 20:40       ` Dmitry Eremin-Solenikov
2015-05-12 20:40         ` Dmitry Eremin-Solenikov
2015-05-12 20:40         ` Dmitry Eremin-Solenikov
2015-05-12 20:40         ` Dmitry Eremin-Solenikov
2015-04-27 23:55   ` [PATCH v2 06/17] video: lcd: add LoCoMo LCD driver Dmitry Eremin-Solenikov
2015-04-27 23:55     ` Dmitry Eremin-Solenikov
2015-04-27 23:55     ` Dmitry Eremin-Solenikov
2015-04-27 23:55   ` [PATCH v2 10/17] i2c: add locomo i2c driver Dmitry Eremin-Solenikov
2015-04-27 23:55     ` Dmitry Eremin-Solenikov
2015-04-27 23:55     ` Dmitry Eremin-Solenikov
2015-05-12 19:24     ` Wolfram Sang
2015-05-12 19:24       ` Wolfram Sang
2015-05-12 19:24       ` Wolfram Sang
2015-05-12 19:27       ` Dmitry Eremin-Solenikov
2015-05-12 19:27         ` Dmitry Eremin-Solenikov
2015-05-12 19:27         ` Dmitry Eremin-Solenikov
2015-05-12 19:27         ` Dmitry Eremin-Solenikov
2015-05-12 19:28         ` Wolfram Sang
2015-05-12 19:28           ` Wolfram Sang
2015-05-12 19:28           ` Wolfram Sang
2015-05-12 19:28           ` Wolfram Sang
2015-04-27 23:55 ` [PATCH v2 07/17] gpio: port LoCoMo gpio support from old driver Dmitry Eremin-Solenikov
2015-04-27 23:55   ` Dmitry Eremin-Solenikov
2015-04-27 23:55   ` Dmitry Eremin-Solenikov
2015-05-06 14:12   ` Linus Walleij
2015-05-06 14:12     ` Linus Walleij
2015-05-06 14:12     ` Linus Walleij
2015-04-27 23:55 ` [PATCH v2 08/17] gpio: locomo: implement per-pin irq handling Dmitry Eremin-Solenikov
2015-04-27 23:55   ` Dmitry Eremin-Solenikov
2015-04-27 23:55   ` Dmitry Eremin-Solenikov
2015-05-06 14:15   ` Linus Walleij
2015-05-06 14:15     ` Linus Walleij
2015-05-06 14:15     ` Linus Walleij
2015-05-06 16:42     ` Dmitry Eremin-Solenikov
2015-05-06 16:42       ` Dmitry Eremin-Solenikov
2015-05-06 16:42       ` Dmitry Eremin-Solenikov
2015-05-12 11:15       ` Linus Walleij
2015-05-12 11:15         ` Linus Walleij
2015-05-12 11:15         ` Linus Walleij
2015-04-27 23:55 ` [PATCH v2 09/17] spi: add locomo SPI driver Dmitry Eremin-Solenikov
2015-04-27 23:55   ` Dmitry Eremin-Solenikov
2015-04-27 23:55   ` Dmitry Eremin-Solenikov
2015-04-29 11:27   ` Mark Brown [this message]
2015-04-29 11:27     ` Mark Brown
2015-04-29 11:27     ` Mark Brown
2015-04-27 23:55 ` [PATCH v2 11/17] ARM: sa1100: make collie use new locomo drivers Dmitry Eremin-Solenikov
2015-04-27 23:55   ` Dmitry Eremin-Solenikov
2015-04-27 23:55   ` Dmitry Eremin-Solenikov
2015-04-27 23:55 ` [PATCH v2 12/17] ARM: sa1100: don't preallocate IRQ space for locomo Dmitry Eremin-Solenikov
2015-04-27 23:55   ` Dmitry Eremin-Solenikov
2015-04-27 23:55   ` Dmitry Eremin-Solenikov
2015-04-27 23:55 ` [PATCH v2 13/17] ASoC: pxa: poodle: make use of new locomo GPIO interface Dmitry Eremin-Solenikov
2015-04-27 23:55   ` Dmitry Eremin-Solenikov
2015-04-27 23:55   ` Dmitry Eremin-Solenikov
2015-05-06 14:19   ` Linus Walleij
2015-05-06 14:19     ` Linus Walleij
2015-05-06 14:19     ` Linus Walleij
2015-04-27 23:55 ` [PATCH v2 14/17] ARM: pxa: poodle: use new LoCoMo driver Dmitry Eremin-Solenikov
2015-04-27 23:55   ` Dmitry Eremin-Solenikov
2015-04-27 23:55   ` Dmitry Eremin-Solenikov
     [not found]   ` <1430178954-11138-15-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-04-28 19:35     ` Robert Jarzmik
2015-04-28 19:35       ` Robert Jarzmik
2015-04-28 19:35       ` Robert Jarzmik
2015-05-06 14:20     ` Linus Walleij
2015-05-06 14:20       ` Linus Walleij
2015-05-06 14:20       ` Linus Walleij
2015-04-27 23:55 ` [PATCH v2 15/17] ARM: pxa: poodle: don't preallocate IRQ space for locomo Dmitry Eremin-Solenikov
2015-04-27 23:55   ` Dmitry Eremin-Solenikov
2015-04-27 23:55   ` Dmitry Eremin-Solenikov
2015-04-28 19:36   ` Robert Jarzmik
2015-04-28 19:36     ` Robert Jarzmik
2015-04-28 19:36     ` Robert Jarzmik
2015-04-27 23:55 ` [PATCH v2 16/17] video: backlight: drop old locomo bl/lcd driver Dmitry Eremin-Solenikov
2015-04-27 23:55   ` Dmitry Eremin-Solenikov
2015-04-27 23:55   ` Dmitry Eremin-Solenikov
2015-04-27 23:55 ` [PATCH v2 17/17] ARM: drop old LoCoMo driver Dmitry Eremin-Solenikov
2015-04-27 23:55   ` Dmitry Eremin-Solenikov
     [not found]   ` <1430178954-11138-18-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-06 14:22     ` Linus Walleij
2015-05-06 14:22       ` Linus Walleij
2015-05-06 14:22       ` Linus Walleij

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=20150429112719.GK22845@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=andrea.adami@gmail.com \
    --cc=cooloney@gmail.com \
    --cc=daniel@zonque.org \
    --cc=dbaryshkov@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gnurou@gmail.com \
    --cc=jg1.han@samsung.com \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=plagnioj@jcrosoft.com \
    --cc=robert.jarzmik@free.fr \
    --cc=rpurdie@rpsys.net \
    --cc=sameo@linux.intel.com \
    --cc=tomi.valkeinen@ti.com \
    --cc=wsa@the-dreams.de \
    /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.