All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Noralf Trønnes" <noralf@tronnes.org>
To: dri-devel@lists.freedesktop.org
Cc: sam@ravnborg.org, david@lechnology.com
Subject: [PATCH v2 03/11] drm/tinydrm: Use spi_is_bpw_supported()
Date: Fri, 19 Jul 2019 17:59:08 +0200	[thread overview]
Message-ID: <20190719155916.62465-4-noralf@tronnes.org> (raw)
In-Reply-To: <20190719155916.62465-1-noralf@tronnes.org>

This means that tinydrm_spi_bpw_supported() can be removed.

Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 .../gpu/drm/tinydrm/core/tinydrm-helpers.c    | 32 +------------------
 drivers/gpu/drm/tinydrm/mipi-dbi.c            |  5 ++-
 include/drm/tinydrm/tinydrm-helpers.h         |  1 -
 3 files changed, 3 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
index dfeafac4c656..aeb49cefed25 100644
--- a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
+++ b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
@@ -53,36 +53,6 @@ size_t tinydrm_spi_max_transfer_size(struct spi_device *spi, size_t max_len)
 }
 EXPORT_SYMBOL(tinydrm_spi_max_transfer_size);
 
-/**
- * tinydrm_spi_bpw_supported - Check if bits per word is supported
- * @spi: SPI device
- * @bpw: Bits per word
- *
- * This function checks to see if the SPI master driver supports @bpw.
- *
- * Returns:
- * True if @bpw is supported, false otherwise.
- */
-bool tinydrm_spi_bpw_supported(struct spi_device *spi, u8 bpw)
-{
-	u32 bpw_mask = spi->master->bits_per_word_mask;
-
-	if (bpw == 8)
-		return true;
-
-	if (!bpw_mask) {
-		dev_warn_once(&spi->dev,
-			      "bits_per_word_mask not set, assume 8-bit only\n");
-		return false;
-	}
-
-	if (bpw_mask & SPI_BPW_MASK(bpw))
-		return true;
-
-	return false;
-}
-EXPORT_SYMBOL(tinydrm_spi_bpw_supported);
-
 static void
 tinydrm_dbg_spi_print(struct spi_device *spi, struct spi_transfer *tr,
 		      const void *buf, int idx, bool tx)
@@ -159,7 +129,7 @@ int tinydrm_spi_transfer(struct spi_device *spi, u32 speed_hz,
 		pr_debug("[drm:%s] bpw=%u, max_chunk=%zu, transfers:\n",
 			 __func__, bpw, max_chunk);
 
-	if (bpw == 16 && !tinydrm_spi_bpw_supported(spi, 16)) {
+	if (bpw == 16 && !spi_is_bpw_supported(spi, 16)) {
 		tr.bits_per_word = 8;
 		if (tinydrm_machine_little_endian()) {
 			swap_buf = kmalloc(min(len, max_chunk), GFP_KERNEL);
diff --git a/drivers/gpu/drm/tinydrm/mipi-dbi.c b/drivers/gpu/drm/tinydrm/mipi-dbi.c
index 791a0b43beef..b6c46453e904 100644
--- a/drivers/gpu/drm/tinydrm/mipi-dbi.c
+++ b/drivers/gpu/drm/tinydrm/mipi-dbi.c
@@ -782,7 +782,7 @@ static int mipi_dbi_spi1_transfer(struct mipi_dbi *mipi, int dc,
 	u16 *dst16;
 	int ret;
 
-	if (!tinydrm_spi_bpw_supported(spi, 9))
+	if (!spi_is_bpw_supported(spi, 9))
 		return mipi_dbi_spi1e_transfer(mipi, dc, buf, len, bpw);
 
 	tr.speed_hz = mipi_dbi_spi_cmd_max_speed(spi, len);
@@ -1003,8 +1003,7 @@ int mipi_dbi_spi_init(struct spi_device *spi, struct mipi_dbi *mipi,
 	if (dc) {
 		mipi->command = mipi_dbi_typec3_command;
 		mipi->dc = dc;
-		if (tinydrm_machine_little_endian() &&
-		    !tinydrm_spi_bpw_supported(spi, 16))
+		if (tinydrm_machine_little_endian() && !spi_is_bpw_supported(spi, 16))
 			mipi->swap_bytes = true;
 	} else {
 		mipi->command = mipi_dbi_typec1_command;
diff --git a/include/drm/tinydrm/tinydrm-helpers.h b/include/drm/tinydrm/tinydrm-helpers.h
index f8bcadf48cb1..146bc383297c 100644
--- a/include/drm/tinydrm/tinydrm-helpers.h
+++ b/include/drm/tinydrm/tinydrm-helpers.h
@@ -43,7 +43,6 @@ int tinydrm_display_pipe_init(struct drm_device *drm,
 			      unsigned int rotation);
 
 size_t tinydrm_spi_max_transfer_size(struct spi_device *spi, size_t max_len);
-bool tinydrm_spi_bpw_supported(struct spi_device *spi, u8 bpw);
 int tinydrm_spi_transfer(struct spi_device *spi, u32 speed_hz,
 			 struct spi_transfer *header, u8 bpw, const void *buf,
 			 size_t len);
-- 
2.20.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2019-07-19 15:59 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-19 15:59 [PATCH v2 00/11] drm/tinydrm: Remove tinydrm.ko Noralf Trønnes
2019-07-19 15:59 ` [PATCH v2 01/11] drm: Add SPI connector type Noralf Trønnes
2019-07-19 15:59 ` [PATCH v2 02/11] drm/tinydrm: Use DRM_MODE_CONNECTOR_SPI Noralf Trønnes
2019-07-19 15:59 ` Noralf Trønnes [this message]
2019-07-19 15:59 ` [PATCH v2 04/11] drm/tinydrm: Remove spi debug buffer dumping Noralf Trønnes
2019-07-19 15:59 ` [PATCH v2 05/11] drm/tinydrm: Remove tinydrm_spi_max_transfer_size() Noralf Trønnes
2019-10-15 14:32   ` Andy Shevchenko
2019-10-15 15:02     ` Andy Shevchenko
2019-10-15 15:41     ` Noralf Trønnes
2019-10-15 15:57       ` Daniel Vetter
2019-10-16 16:13         ` Andy Shevchenko
2019-10-16 17:44           ` Daniel Vetter
2019-10-16 18:00             ` Mark Brown
2019-10-17  6:58             ` Andy Shevchenko
2019-10-15 15:59       ` Andy Shevchenko
2019-10-15 16:05         ` Daniel Vetter
2019-10-16  8:07           ` Andy Shevchenko
2019-10-15 16:55         ` Noralf Trønnes
2019-07-19 15:59 ` [PATCH v2 06/11] drm/tinydrm: Clean up tinydrm_spi_transfer() Noralf Trønnes
2019-07-19 15:59 ` [PATCH v2 07/11] drm/tinydrm: Move tinydrm_spi_transfer() Noralf Trønnes
2019-07-19 15:59 ` [PATCH v2 08/11] drm/tinydrm: Move tinydrm_machine_little_endian() Noralf Trønnes
2019-07-19 15:59 ` [PATCH v2 09/11] drm/tinydrm/repaper: Don't use tinydrm_display_pipe_init() Noralf Trønnes
2019-07-19 15:59 ` [PATCH v2 10/11] drm/tinydrm/mipi-dbi: Add mipi_dbi_init_with_formats() Noralf Trønnes
2019-07-22 19:48   ` David Lechner
2019-07-19 15:59 ` [PATCH v2 11/11] drm/tinydrm: Move tinydrm_display_pipe_init() to mipi-dbi Noralf Trønnes
2019-07-23 14:11 ` [PATCH v2 00/11] drm/tinydrm: Remove tinydrm.ko Noralf Trønnes

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=20190719155916.62465-4-noralf@tronnes.org \
    --to=noralf@tronnes.org \
    --cc=david@lechnology.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sam@ravnborg.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 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.