All of lore.kernel.org
 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 2/3] spi: of: allow instantiating slaves without a driver
Date: Mon, 27 Jun 2016 21:02:31 +0200	[thread overview]
Message-ID: <a85f91bf364bd6e1681f5973ac92c2bb7f9a8999.1467053363.git.hramrach@gmail.com> (raw)
In-Reply-To: <cover.1467053363.git.hramrach@gmail.com>
In-Reply-To: <cover.1467053363.git.hramrach@gmail.com>

SPI slave devices are not created when looking up driver for the slave
fails. Create a device anyway so it can be manually bound to a driver.

This allows manually binding a driver to slave devices for which the
driver specified by compatible is not available of for which no driver
is specified at all. Drivers like spidev or m25p80 that require no
configuratiom can be bound to such node.

Since this allows slave DT nodes without specifying a slave driver make
speed also optional. It makes no sense to specify speed when the device
is not specified. The value is only advisory anyway and the slave
driver can try to set arbitrary transfer speed.

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
---
 drivers/spi/spi.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 0239b45..9b3b512 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1477,9 +1477,8 @@ of_register_spi_device(struct spi_master *master, struct device_node *nc)
 	rc = of_modalias_node(nc, spi->modalias,
 				sizeof(spi->modalias));
 	if (rc < 0) {
-		dev_err(&master->dev, "cannot find modalias for %s\n",
+		dev_warn(&master->dev, "cannot find modalias for %s\n",
 			nc->full_name);
-		goto err_out;
 	}
 
 	/* Device address */
@@ -1543,11 +1542,11 @@ of_register_spi_device(struct spi_master *master, struct device_node *nc)
 	/* Device speed */
 	rc = of_property_read_u32(nc, "spi-max-frequency", &value);
 	if (rc) {
-		dev_err(&master->dev, "%s has no valid 'spi-max-frequency' property (%d)\n",
+		dev_warn(&master->dev, "%s has no valid 'spi-max-frequency' property (%d)\n",
 			nc->full_name, rc);
-		goto err_out;
+	} else {
+		spi->max_speed_hz = value;
 	}
-	spi->max_speed_hz = value;
 
 	/* Store a pointer to the node in the device structure */
 	of_node_get(nc);
-- 
2.8.1

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

Thread overview: 50+ 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
2016-06-27 19:02 ` [PATCH v2 1/3] spi: spidev: fix the check for spidev in dt Michal Suchanek
2016-06-27 20:36   ` Mark Brown
2016-06-27 20:36     ` Mark Brown
2016-06-27 19:02 ` Michal Suchanek [this message]
2016-06-27 21:14   ` [PATCH v2 2/3] spi: of: allow instantiating slaves without a driver Mark Brown
2016-06-27 21:14     ` Mark Brown
2016-06-27 19:02 ` [PATCH v2 3/3] drivers core: allow id match override when manually binding driver Michal Suchanek
2016-06-27 19:02   ` Michal Suchanek
2016-06-27 19:09   ` Greg Kroah-Hartman
2016-06-27 19:09     ` Greg Kroah-Hartman
2016-06-27 19:40     ` Michal Suchanek
2016-06-27 19:40       ` Michal Suchanek
2016-06-27 20:32       ` Mark Brown
2016-06-27 20:32         ` Mark Brown
2016-06-27 22:12       ` Greg Kroah-Hartman
2016-06-27 22:12         ` Greg Kroah-Hartman
2016-06-28 12:40         ` Michal Suchanek
2016-06-28 12:40           ` Michal Suchanek
2016-06-28 15:51           ` Mark Brown
2016-06-28 15:51             ` Mark Brown
2016-06-28 16:24             ` Michal Suchanek
2016-06-28 16:24               ` Michal Suchanek
2016-06-28 18:38               ` Mark Brown
2016-06-28 18:38                 ` Mark Brown
2016-06-28 20:02                 ` Michal Suchanek
2016-06-28 20:57                   ` Mark Brown
2016-06-28 20:57                     ` Mark Brown
2016-06-29  3:32                     ` Michal Suchanek
2016-06-29  3:32                       ` Michal Suchanek
2016-06-29 18:02                       ` Mark Brown
2016-06-29 18:02                         ` Mark Brown
2016-06-30  7:47                         ` Michal Suchanek
2016-06-30  7:47                           ` Michal Suchanek
2016-06-30  9:03                           ` Dan O'Donovan
2016-06-30  9:03                             ` Dan O'Donovan
2016-07-01  9:36                             ` Mark Brown
2016-07-01 10:11                               ` Michal Suchanek
2016-07-01 10:11                                 ` Michal Suchanek
2016-07-01  8:25                           ` Mark Brown
2016-07-01  8:58                             ` Michal Suchanek
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
2016-07-01 18:56                                     ` Michal Suchanek
2016-07-01 18:56                                       ` Michal Suchanek
2016-07-01 19:36                                       ` Michal Suchanek
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=a85f91bf364bd6e1681f5973ac92c2bb7f9a8999.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 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.