Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1281802 > unrolled thread

[PATCH 4/4] spi: butterfly: use new parport device model

Started bySudip Mukherjee <sudipm.mukherjee@gmail.com>
First post2015-12-02 14:50 +0100
Last post2015-12-02 14:50 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 4/4] spi: butterfly: use new parport device model Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-12-02 14:50 +0100

#1281802 — [PATCH 4/4] spi: butterfly: use new parport device model

FromSudip Mukherjee <sudipm.mukherjee@gmail.com>
Date2015-12-02 14:50 +0100
Subject[PATCH 4/4] spi: butterfly: use new parport device model
Message-ID<qBfXd-7QB-53@gated-at.bofh.it>
Modify spi-butterfly driver to use the new parallel port device model.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---

Only change is in the module loading part. It has been tested by
inserting and removing the module repeatedly, tested with unbind also.

 drivers/spi/spi-butterfly.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/spi-butterfly.c b/drivers/spi/spi-butterfly.c
index f16ef7f..22a31e4 100644
--- a/drivers/spi/spi-butterfly.c
+++ b/drivers/spi/spi-butterfly.c
@@ -189,6 +189,7 @@ static void butterfly_attach(struct parport *p)
 	struct butterfly	*pp;
 	struct spi_master	*master;
 	struct device		*dev = p->physport->dev;
+	struct pardev_cb	butterfly_cb;
 
 	if (butterfly || !dev)
 		return;
@@ -221,9 +222,9 @@ static void butterfly_attach(struct parport *p)
 	 * parport hookup
 	 */
 	pp->port = p;
-	pd = parport_register_device(p, "spi_butterfly",
-				     NULL, NULL, NULL,
-				     0 /* FLAGS */, pp);
+	memset(&butterfly_cb, 0, sizeof(butterfly_cb));
+	butterfly_cb.private = pp;
+	pd = parport_register_dev_model(p, "spi_butterfly", &butterfly_cb, 0);
 	if (!pd) {
 		status = -ENOMEM;
 		goto clean0;
@@ -321,8 +322,9 @@ static void butterfly_detach(struct parport *p)
 
 static struct parport_driver butterfly_driver = {
 	.name =		"spi_butterfly",
-	.attach =	butterfly_attach,
+	.match_port =	butterfly_attach,
 	.detach =	butterfly_detach,
+	.devmodel = true,
 };
 
 static int __init butterfly_init(void)
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web