* [PATCH 1/2] spi: omap2-mcspi: Remove list_empty checking in omap2_mcspi_transfer_one_message
@ 2014-02-18 14:01 Axel Lin
2014-02-18 14:02 ` [PATCH 2/2] spi: omap2-mcspi: Convert to let spi core validate transfer speed Axel Lin
2014-02-19 4:38 ` [PATCH 1/2] spi: omap2-mcspi: Remove list_empty checking in omap2_mcspi_transfer_one_message Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2014-02-18 14:01 UTC (permalink / raw)
To: Mark Brown
Cc: Stefan Sørensen, Victor Kamensky, Illia Smyrnov,
linux-spi-u79uwXL29TY76Z2rM5mHXA
This checking is done in __spi_validate().
Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
---
drivers/spi/spi-omap2-mcspi.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 0493905..82cbe73 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -1207,9 +1207,6 @@ static int omap2_mcspi_transfer_one_message(struct spi_master *master,
m->actual_length = 0;
m->status = 0;
- /* reject invalid messages and transfers */
- if (list_empty(&m->transfers))
- return -EINVAL;
list_for_each_entry(t, &m->transfers, transfer_list) {
const void *tx_buf = t->tx_buf;
void *rx_buf = t->rx_buf;
--
1.8.1.2
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] spi: omap2-mcspi: Convert to let spi core validate transfer speed
2014-02-18 14:01 [PATCH 1/2] spi: omap2-mcspi: Remove list_empty checking in omap2_mcspi_transfer_one_message Axel Lin
@ 2014-02-18 14:02 ` Axel Lin
2014-02-19 4:38 ` [PATCH 1/2] spi: omap2-mcspi: Remove list_empty checking in omap2_mcspi_transfer_one_message Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Axel Lin @ 2014-02-18 14:02 UTC (permalink / raw)
To: Mark Brown
Cc: Stefan Sørensen, Victor Kamensky, Illia Smyrnov,
linux-spi-u79uwXL29TY76Z2rM5mHXA
Set master->max_speed_hz and master->min_speed_hz then spi core will handle
checking transfer speed. So we can remove the same checking in this driver.
Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
---
drivers/spi/spi-omap2-mcspi.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 82cbe73..2941c5b 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -1212,8 +1212,7 @@ static int omap2_mcspi_transfer_one_message(struct spi_master *master,
void *rx_buf = t->rx_buf;
unsigned len = t->len;
- if (t->speed_hz > OMAP2_MCSPI_MAX_FREQ
- || (len && !(rx_buf || tx_buf))) {
+ if ((len && !(rx_buf || tx_buf))) {
dev_dbg(mcspi->dev, "transfer: %d Hz, %d %s%s, %d bpw\n",
t->speed_hz,
len,
@@ -1222,12 +1221,6 @@ static int omap2_mcspi_transfer_one_message(struct spi_master *master,
t->bits_per_word);
return -EINVAL;
}
- if (t->speed_hz && t->speed_hz < (OMAP2_MCSPI_MAX_FREQ >> 15)) {
- dev_dbg(mcspi->dev, "speed_hz %d below minimum %d Hz\n",
- t->speed_hz,
- OMAP2_MCSPI_MAX_FREQ >> 15);
- return -EINVAL;
- }
if (m->is_dma_mapped || len < DMA_MIN_BYTES)
continue;
@@ -1339,6 +1332,8 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
master->transfer_one_message = omap2_mcspi_transfer_one_message;
master->cleanup = omap2_mcspi_cleanup;
master->dev.of_node = node;
+ master->max_speed_hz = OMAP2_MCSPI_MAX_FREQ;
+ master->min_speed_hz = OMAP2_MCSPI_MAX_FREQ >> 15;
platform_set_drvdata(pdev, master);
--
1.8.1.2
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] spi: omap2-mcspi: Remove list_empty checking in omap2_mcspi_transfer_one_message
2014-02-18 14:01 [PATCH 1/2] spi: omap2-mcspi: Remove list_empty checking in omap2_mcspi_transfer_one_message Axel Lin
2014-02-18 14:02 ` [PATCH 2/2] spi: omap2-mcspi: Convert to let spi core validate transfer speed Axel Lin
@ 2014-02-19 4:38 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2014-02-19 4:38 UTC (permalink / raw)
To: Axel Lin
Cc: Stefan Sørensen, Victor Kamensky, Illia Smyrnov,
linux-spi-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 126 bytes --]
On Tue, Feb 18, 2014 at 10:01:36PM +0800, Axel Lin wrote:
> This checking is done in __spi_validate().
Applied both, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-02-19 4:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-18 14:01 [PATCH 1/2] spi: omap2-mcspi: Remove list_empty checking in omap2_mcspi_transfer_one_message Axel Lin
2014-02-18 14:02 ` [PATCH 2/2] spi: omap2-mcspi: Convert to let spi core validate transfer speed Axel Lin
2014-02-19 4:38 ` [PATCH 1/2] spi: omap2-mcspi: Remove list_empty checking in omap2_mcspi_transfer_one_message Mark Brown
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).