linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Suchanek <hramrach@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Mark Brown <broonie@kernel.org>,
	linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org
Cc: Michal Suchanek <hramrach@gmail.com>
Subject: [PATCH v2 1/3] spi: spidev: fix the check for spidev in dt
Date: Mon, 27 Jun 2016 21:02:30 +0200	[thread overview]
Message-ID: <0123f28025f0a29a0771a43397ad14259a2094b7.1467053363.git.hramrach@gmail.com> (raw)
In-Reply-To: <cover.1467053363.git.hramrach@gmail.com>
In-Reply-To: <cover.1467053363.git.hramrach@gmail.com>

The error message is "buggy DT: spidev listed directly in DT\n"

That's not what the check does. It checks that one if the IDs listed in
the driver match table matches what is set on the DT node.

This does not work if you manage to convince the kernel to bind spidev
on a node that has some other random compatible which is not "spidev".

Also the spidev id match table is not compiled when !CONFIG_OF

So add a match table that has just "spidev" entry in it so it can
reliably detect what this message is supposed to warn about.

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
---
 - fix indent
 - update commit mesage
---
 drivers/spi/spidev.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
index e3c19f3..3c6ebe7 100644
--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -700,6 +700,11 @@ static const struct of_device_id spidev_dt_ids[] = {
 MODULE_DEVICE_TABLE(of, spidev_dt_ids);
 #endif
 
+static const struct of_device_id spidev_check[] = {
+	{ .compatible = "spidev" },
+	{}
+};
+
 /*-------------------------------------------------------------------------*/
 
 static int spidev_probe(struct spi_device *spi)
@@ -713,10 +718,10 @@ static int spidev_probe(struct spi_device *spi)
 	 * compatible string, it is a Linux implementation thing
 	 * rather than a description of the hardware.
 	 */
-	if (spi->dev.of_node && !of_match_device(spidev_dt_ids, &spi->dev)) {
+	if (spi->dev.of_node && of_match_device(spidev_check, &spi->dev)) {
 		dev_err(&spi->dev, "buggy DT: spidev listed directly in DT\n");
 		WARN_ON(spi->dev.of_node &&
-			!of_match_device(spidev_dt_ids, &spi->dev));
+			of_match_device(spidev_check, &spi->dev));
 	}
 
 	/* Allocate driver data */
-- 
2.8.1

  reply	other threads:[~2016-06-27 19:02 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-27 19:02 [PATCH v2 0/3] Updated spidev usability patchset Michal Suchanek
2016-06-27 19:02 ` Michal Suchanek [this message]
     [not found]   ` <0123f28025f0a29a0771a43397ad14259a2094b7.1467053363.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-06-27 20:36     ` [PATCH v2 1/3] spi: spidev: fix the check for spidev in dt Mark Brown
2016-06-27 19:02 ` [PATCH v2 2/3] spi: of: allow instantiating slaves without a driver Michal Suchanek
     [not found]   ` <a85f91bf364bd6e1681f5973ac92c2bb7f9a8999.1467053363.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-06-27 21:14     ` Mark Brown
     [not found] ` <cover.1467053363.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-06-27 19:02   ` [PATCH v2 3/3] drivers core: allow id match override when manually binding driver Michal Suchanek
     [not found]     ` <15ff382f699387e2d8f23779db851d0de7e9291e.1467053363.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-06-27 19:09       ` Greg Kroah-Hartman
     [not found]         ` <20160627190949.GB5111-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2016-06-27 19:40           ` Michal Suchanek
     [not found]             ` <CAOMqctQj0ftbOH9dvMPczBPeSFTvDuTKCXgYprYvtcQDYML8Kw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-06-27 20:32               ` Mark Brown
2016-06-27 22:12               ` Greg Kroah-Hartman
     [not found]                 ` <20160627221259.GA10054-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2016-06-28 12:40                   ` Michal Suchanek
     [not found]                     ` <CAOMqctTQAY0NzTpEqyLyScu8UrSXcF82oLVMM+e2F2WQ225B7A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-06-28 15:51                       ` Mark Brown
     [not found]                         ` <20160628155107.GP17217-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-06-28 16:24                           ` Michal Suchanek
     [not found]                             ` <CAOMqctQbFmWv04idz7G+dPOCg7n-E0AQdhGAyohUDBniKvrP_g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-06-28 18:38                               ` Mark Brown
2016-06-28 20:02                                 ` Michal Suchanek
     [not found]                                   ` <CAOMqctTNmcg32PFVOZaA99GpFba9GOGOuOqmi3ujzxcHRFZsOA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-06-28 20:57                                     ` Mark Brown
     [not found]                                       ` <20160628205736.GE17217-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-06-29  3:32                                         ` Michal Suchanek
     [not found]                                           ` <CAOMqctS2xGCgfXschxudcAEYq-mcfPDmFS_pTzCuXa0bFBE0NA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-06-29 18:02                                             ` Mark Brown
     [not found]                                               ` <20160629180211.GF6247-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-06-30  7:47                                                 ` Michal Suchanek
     [not found]                                                   ` <CAOMqctR-f+dNBiWk8LEqkeYMhpvACjMi8aH3GpHY==RjfANf8Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-06-30  9:03                                                     ` Dan O'Donovan
2016-07-01  9:36                                                       ` Mark Brown
     [not found]                                                         ` <20160701093613.GF6247-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-07-01 10:11                                                           ` Michal Suchanek
2016-07-01  8:25                                                   ` Mark Brown
     [not found]                                                     ` <20160701082548.GE6247-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-07-01  8:58                                                       ` Michal Suchanek
2016-07-01 15:00                                                         ` Mark Brown
2016-07-01 15:37                                                           ` Michal Suchanek
2016-07-01 16:22                                                             ` Mark Brown
     [not found]                                                               ` <20160701162228.GZ6247-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-07-01 18:56                                                                 ` Michal Suchanek
     [not found]                                                                   ` <CAOMqctR8mdjzCpfJodHO6MDUEMZubKmnT_eZZs+48xJXQfragA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-07-01 19:36                                                                     ` Michal Suchanek

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=0123f28025f0a29a0771a43397ad14259a2094b7.1467053363.git.hramrach@gmail.com \
    --to=hramrach@gmail.com \
    --cc=broonie@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.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).