linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: Jonathan Corbet <corbet@lwn.net>, Jean Delvare <jdelvare@suse.de>,
	Wolfram Sang <wsa@the-dreams.de>,
	Willy Tarreau <willy@meta-x.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>,
	dan.carpenter@oracle.com
Cc: linux-i2c@vger.kernel.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org,
	Sudip Mukherjee <sudipm.mukherjee@gmail.com>,
	linux-doc@vger.kernel.org
Subject: [PATCH 3/4] i2c-parport: use device-model parport
Date: Wed, 15 Apr 2015 13:18:43 +0530	[thread overview]
Message-ID: <1429084124-2271-4-git-send-email-sudipm.mukherjee@gmail.com> (raw)
In-Reply-To: <1429084124-2271-1-git-send-email-sudipm.mukherjee@gmail.com>

modified the functions to use the new device-model of parport.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/i2c/busses/i2c-parport.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c
index a1fac5a..9464e74 100644
--- a/drivers/i2c/busses/i2c-parport.c
+++ b/drivers/i2c/busses/i2c-parport.c
@@ -160,20 +160,24 @@ static void i2c_parport_irq(void *data)
 			"SMBus alert received but no ARA client!\n");
 }
 
-static void i2c_parport_attach(struct parport *port)
+static int i2c_parport_attach(struct parport *port,
+			      struct parport_driver *drv)
 {
 	struct i2c_par *adapter;
 
 	adapter = kzalloc(sizeof(struct i2c_par), GFP_KERNEL);
 	if (adapter == NULL) {
 		printk(KERN_ERR "i2c-parport: Failed to kzalloc\n");
-		return;
+		return -ENOMEM;
 	}
 
 	pr_debug("i2c-parport: attaching to %s\n", port->name);
 	parport_disable_irq(port);
-	adapter->pdev = parport_register_device(port, "i2c-parport",
-		NULL, NULL, i2c_parport_irq, PARPORT_FLAG_EXCL, adapter);
+	adapter->pdev = parport_register_dev(port, "i2c-parport",
+					     NULL, NULL,
+					     i2c_parport_irq,
+					     PARPORT_FLAG_EXCL,
+					     adapter, drv);
 	if (!adapter->pdev) {
 		printk(KERN_ERR "i2c-parport: Unable to register with parport\n");
 		goto err_free;
@@ -230,13 +234,14 @@ static void i2c_parport_attach(struct parport *port)
 	mutex_lock(&adapter_list_lock);
 	list_add_tail(&adapter->node, &adapter_list);
 	mutex_unlock(&adapter_list_lock);
-	return;
+	return 0;
 
  err_unregister:
 	parport_release(adapter->pdev);
 	parport_unregister_device(adapter->pdev);
  err_free:
 	kfree(adapter);
+	return -ENODEV;
 }
 
 static void i2c_parport_detach(struct parport *port)
@@ -268,7 +273,7 @@ static void i2c_parport_detach(struct parport *port)
 
 static struct parport_driver i2c_parport_driver = {
 	.name	= "i2c-parport",
-	.attach	= i2c_parport_attach,
+	.attach_ret	= i2c_parport_attach,
 	.detach	= i2c_parport_detach,
 };
 
@@ -286,7 +291,7 @@ static int __init i2c_parport_init(void)
 		return -ENODEV;
 	}
 
-	return parport_register_driver(&i2c_parport_driver);
+	return parport_register_drv(&i2c_parport_driver);
 }
 
 static void __exit i2c_parport_exit(void)
-- 
1.8.1.2

  parent reply	other threads:[~2015-04-15  7:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-15  7:48 [PATCH 0/4] convert parport to device-model Sudip Mukherjee
2015-04-15  7:48 ` [PATCH 1/4] parport: modify parport subsystem to use devicemodel Sudip Mukherjee
2015-04-15  8:27   ` Dan Carpenter
2015-04-15  9:20     ` Sudip Mukherjee
2015-04-15  9:32       ` Dan Carpenter
2015-04-15  9:45       ` Dan Carpenter
2015-04-15 10:28         ` Sudip Mukherjee
2015-04-15  8:33   ` Dan Carpenter
2015-04-15  9:24     ` Sudip Mukherjee
2015-04-15 13:23   ` Greg Kroah-Hartman
2015-04-15 13:23   ` Greg Kroah-Hartman
2015-04-15 13:31   ` Greg Kroah-Hartman
     [not found]     ` <20150415133115.GG21491-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2015-04-15 16:13       ` Sudip Mukherjee
2015-04-15  7:48 ` [PATCH 2/4] parport: update TODO and documentation Sudip Mukherjee
2015-04-15  7:48 ` Sudip Mukherjee [this message]
2015-04-15  7:48 ` [PATCH 4/4] staging: panel: use parport in device-model Sudip Mukherjee

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=1429084124-2271-4-git-send-email-sudipm.mukherjee@gmail.com \
    --to=sudipm.mukherjee@gmail.com \
    --cc=corbet@lwn.net \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=jdelvare@suse.de \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=willy@meta-x.org \
    --cc=wsa@the-dreams.de \
    /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).