All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] use devicemodel with parport
@ 2015-05-20 15:26 ` Sudip Mukherjee
  0 siblings, 0 replies; 48+ messages in thread
From: Sudip Mukherjee @ 2015-05-20 15:26 UTC (permalink / raw)
  To: Tim Waugh, Jean Delvare, Wolfram Sang, Willy Tarreau,
	Greg Kroah-Hartman, Alan Cox
  Cc: linux-kernel, linux-i2c, devel, Sudip Mukherjee

After 5 versions of WIP, finally a patch submission.
parport subsystem is now in the transition stage and supports the old
model and the new device model. 3 of the drivers have been converted
into new model and tested.
After other drivers are converted we can remove the old code from
parport.

Sudip Mukherjee (6):
  parport: add device-model to parport subsystem
  staging: panel: use new parport device model
  i2c-parport: define ports to connect
  i2c-parport: use new parport device model
  paride: use new parport device model
  MAINTAINERS: maintain parport

 MAINTAINERS                      |   7 +-
 drivers/block/paride/paride.c    |  57 ++++++-
 drivers/block/paride/paride.h    |   2 +
 drivers/block/paride/pcd.c       |   9 +
 drivers/block/paride/pd.c        |  12 +-
 drivers/block/paride/pf.c        |   7 +
 drivers/block/paride/pg.c        |   8 +
 drivers/block/paride/pt.c        |   8 +
 drivers/i2c/busses/i2c-parport.c |  38 ++++-
 drivers/parport/parport_pc.c     |   4 +-
 drivers/parport/procfs.c         |  15 +-
 drivers/parport/share.c          | 345 ++++++++++++++++++++++++++++++++++++---
 drivers/staging/panel/panel.c    |  14 +-
 include/linux/parport.h          |  43 ++++-
 14 files changed, 522 insertions(+), 47 deletions(-)

-- 
1.8.1.2


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 0/6] use devicemodel with parport
@ 2015-05-20 15:26 ` Sudip Mukherjee
  0 siblings, 0 replies; 48+ messages in thread
From: Sudip Mukherjee @ 2015-05-20 15:26 UTC (permalink / raw)
  To: Tim Waugh, Jean Delvare, Wolfram Sang, Willy Tarreau,
	Greg Kroah-Hartman, Alan Cox
  Cc: devel, Sudip Mukherjee, linux-kernel, linux-i2c

After 5 versions of WIP, finally a patch submission.
parport subsystem is now in the transition stage and supports the old
model and the new device model. 3 of the drivers have been converted
into new model and tested.
After other drivers are converted we can remove the old code from
parport.

Sudip Mukherjee (6):
  parport: add device-model to parport subsystem
  staging: panel: use new parport device model
  i2c-parport: define ports to connect
  i2c-parport: use new parport device model
  paride: use new parport device model
  MAINTAINERS: maintain parport

 MAINTAINERS                      |   7 +-
 drivers/block/paride/paride.c    |  57 ++++++-
 drivers/block/paride/paride.h    |   2 +
 drivers/block/paride/pcd.c       |   9 +
 drivers/block/paride/pd.c        |  12 +-
 drivers/block/paride/pf.c        |   7 +
 drivers/block/paride/pg.c        |   8 +
 drivers/block/paride/pt.c        |   8 +
 drivers/i2c/busses/i2c-parport.c |  38 ++++-
 drivers/parport/parport_pc.c     |   4 +-
 drivers/parport/procfs.c         |  15 +-
 drivers/parport/share.c          | 345 ++++++++++++++++++++++++++++++++++++---
 drivers/staging/panel/panel.c    |  14 +-
 include/linux/parport.h          |  43 ++++-
 14 files changed, 522 insertions(+), 47 deletions(-)

-- 
1.8.1.2

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 1/6] parport: add device-model to parport subsystem
  2015-05-20 15:26 ` Sudip Mukherjee
@ 2015-05-20 15:26   ` Sudip Mukherjee
  -1 siblings, 0 replies; 48+ messages in thread
From: Sudip Mukherjee @ 2015-05-20 15:26 UTC (permalink / raw)
  To: Tim Waugh, Jean Delvare, Wolfram Sang, Willy Tarreau,
	Greg Kroah-Hartman, Alan Cox
  Cc: linux-kernel, linux-i2c, devel, Sudip Mukherjee

parport subsystem starts using the device-model. Drivers using the
device-model has to define devmodel as true and should register the
device with parport using parport_register_dev_model().

Tested-by: Jean Delvare <jdelvare@suse.de>
Tested-by: Alan Cox <gnomes@lxorguk.ukuu.org.uk>
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---

patch:	renaming of cnt and one label, added one comment.
	instead of probe check for devmodel. Define a default probe.
       	No change in core functionality.

v5:
	a) addition/removal of ports are now handled.
	b) is_parport moved to the core level
	c) common parport_driver_register code
	d) parport_register_dev_model now accepts instance number.

v4:	use of is_parport() is introduced to check the type of device
	that has been passed to probe or match_port.

v3:	started use of parport_del_port(). previously it was creating
	some ghost parallel ports during port probing.
	parport_del_port() removes registered ports if probing has
	failed.

v2:	started using probe function. Without probe,whenever any driver
	is trying to register, it is getting bound to all the available
	parallel ports. To solve that probe was required.
	Now the driver is binding only to the device it has registered.
	And that device will appear as a subdevice of the particular
	parallel port it wants to use.

	In v1 Greg mentioned that we do not need to maintain our own
	list. That has been partially done. we are no longer maintaining
	the list of drivers. But we still need to maintain the list of
	ports and devices as that will be used by drivers which are not
	yet converted to device model. When all drivers are converted
	to use the device-model parallel port all these lists can be
	removed.

 drivers/parport/parport_pc.c |   4 +-
 drivers/parport/procfs.c     |  15 +-
 drivers/parport/share.c      | 345 ++++++++++++++++++++++++++++++++++++++++---
 include/linux/parport.h      |  43 +++++-
 4 files changed, 379 insertions(+), 28 deletions(-)

diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index 53d15b3..78530d1 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -2255,7 +2255,7 @@ out5:
 		release_region(base+0x3, 5);
 	release_region(base, 3);
 out4:
-	parport_put_port(p);
+	parport_del_port(p);
 out3:
 	kfree(priv);
 out2:
@@ -2294,7 +2294,7 @@ void parport_pc_unregister_port(struct parport *p)
 				    priv->dma_handle);
 #endif
 	kfree(p->private_data);
-	parport_put_port(p);
+	parport_del_port(p);
 	kfree(ops); /* hope no-one cached it */
 }
 EXPORT_SYMBOL(parport_pc_unregister_port);
diff --git a/drivers/parport/procfs.c b/drivers/parport/procfs.c
index 3b47080..c776333 100644
--- a/drivers/parport/procfs.c
+++ b/drivers/parport/procfs.c
@@ -21,6 +21,7 @@
 #include <linux/parport.h>
 #include <linux/ctype.h>
 #include <linux/sysctl.h>
+#include <linux/device.h>
 
 #include <asm/uaccess.h>
 
@@ -558,8 +559,18 @@ int parport_device_proc_unregister(struct pardevice *device)
 
 static int __init parport_default_proc_register(void)
 {
+	int ret;
+
 	parport_default_sysctl_table.sysctl_header =
 		register_sysctl_table(parport_default_sysctl_table.dev_dir);
+	if (!parport_default_sysctl_table.sysctl_header)
+		return -ENOMEM;
+	ret = parport_bus_init();
+	if (ret) {
+		unregister_sysctl_table(parport_default_sysctl_table.
+					sysctl_header);
+		return ret;
+	}
 	return 0;
 }
 
@@ -570,6 +581,7 @@ static void __exit parport_default_proc_unregister(void)
 					sysctl_header);
 		parport_default_sysctl_table.sysctl_header = NULL;
 	}
+	parport_bus_exit();
 }
 
 #else /* no sysctl or no procfs*/
@@ -596,11 +608,12 @@ int parport_device_proc_unregister(struct pardevice *device)
 
 static int __init parport_default_proc_register (void)
 {
-	return 0;
+	return parport_bus_init();
 }
 
 static void __exit parport_default_proc_unregister (void)
 {
+	parport_bus_exit();
 }
 #endif
 
diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index 3fa6624..99d03ed 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -29,6 +29,7 @@
 #include <linux/slab.h>
 #include <linux/sched.h>
 #include <linux/kmod.h>
+#include <linux/device.h>
 
 #include <linux/spinlock.h>
 #include <linux/mutex.h>
@@ -100,13 +101,91 @@ static struct parport_operations dead_ops = {
 	.owner		= NULL,
 };
 
+static struct device_type parport_device_type = {
+	.name = "parport",
+};
+
+static int is_parport(struct device *dev)
+{
+	return dev->type == &parport_device_type;
+}
+
+static int parport_probe(struct device *dev)
+{
+	struct parport_driver *drv;
+
+	if (is_parport(dev))
+		return -ENODEV;
+
+	drv = to_parport_driver(dev->driver);
+	if (!drv->probe) {
+		/* if driver has not defined a custom probe */
+		struct pardevice *par_dev = to_pardevice(dev);
+
+		if (strcmp(par_dev->name, drv->name))
+			return -ENODEV;
+		return 0;
+	}
+	/* if driver defined its own probe */
+	return drv->probe(to_pardevice(dev));
+}
+
+static struct bus_type parport_bus_type = {
+	.name = "parport",
+	.probe = parport_probe,
+};
+
+int parport_bus_init(void)
+{
+	return bus_register(&parport_bus_type);
+}
+
+void parport_bus_exit(void)
+{
+	bus_unregister(&parport_bus_type);
+}
+
+/*
+ * iterates through all the drivers registered with the bus and sends the port
+ * details to the match_port callback of the driver, so that the driver can
+ * know about the new port that just regsitered with the bus and decide if it
+ * wants to use this new port.
+ */
+static int driver_check(struct device_driver *dev_drv, void *_port)
+{
+	struct parport *port = _port;
+	struct parport_driver *drv = to_parport_driver(dev_drv);
+
+	if (drv->match_port)
+		drv->match_port(port);
+	return 0;
+}
+
 /* Call attach(port) for each registered driver. */
 static void attach_driver_chain(struct parport *port)
 {
 	/* caller has exclusive registration_lock */
 	struct parport_driver *drv;
+
 	list_for_each_entry(drv, &drivers, list)
 		drv->attach(port);
+
+	/*
+	 * call the driver_check function of the drivers registered in
+	 * new device model
+	 */
+
+	bus_for_each_drv(&parport_bus_type, NULL, port, driver_check);
+}
+
+static int driver_detach(struct device_driver *_drv, void *_port)
+{
+	struct parport *port = _port;
+	struct parport_driver *drv = to_parport_driver(_drv);
+
+	if (drv->detach)
+		drv->detach(port);
+	return 0;
 }
 
 /* Call detach(port) for each registered driver. */
@@ -116,6 +195,13 @@ static void detach_driver_chain(struct parport *port)
 	/* caller has exclusive registration_lock */
 	list_for_each_entry(drv, &drivers, list)
 		drv->detach (port);
+
+	/*
+	 * call the detach function of the drivers registered in
+	 * new device model
+	 */
+
+	bus_for_each_drv(&parport_bus_type, NULL, port, driver_detach);
 }
 
 /* Ask kmod for some lowlevel drivers. */
@@ -126,17 +212,39 @@ static void get_lowlevel_driver (void)
 	request_module ("parport_lowlevel");
 }
 
+/*
+ * iterates through all the devices connected to the bus and sends the device
+ * details to the match_port callback of the driver, so that the driver can
+ * know what are all the ports that are connected to the bus and choose the
+ * port to which it wants to register its device.
+ */
+static int port_check(struct device *dev, void *dev_drv)
+{
+	struct parport_driver *drv = dev_drv;
+
+	/* only send ports, do not send other devices connected to bus */
+	if (is_parport(dev))
+		drv->match_port(to_parport_dev(dev));
+	return 0;
+}
+
 /**
  *	parport_register_driver - register a parallel port device driver
  *	@drv: structure describing the driver
+ *	@owner: owner module of drv
+ *	@mod_name: module name string
  *
  *	This can be called by a parallel port device driver in order
  *	to receive notifications about ports being found in the
  *	system, as well as ports no longer available.
  *
+ *	If devmodel is true then the new device model is used
+ *	for registration.
+ *
  *	The @drv structure is allocated by the caller and must not be
  *	deallocated until after calling parport_unregister_driver().
  *
+ *	If using the non device model:
  *	The driver's attach() function may block.  The port that
  *	attach() is given will be valid for the duration of the
  *	callback, but if the driver wants to take a copy of the
@@ -148,21 +256,57 @@ static void get_lowlevel_driver (void)
  *	callback, but if the driver wants to take a copy of the
  *	pointer it must call parport_get_port() to do so.
  *
- *	Returns 0 on success.  Currently it always succeeds.
+ *
+ *	Returns 0 on success. The non device model will always succeeds.
+ *	but the new device model can fail and will return the error code.
  **/
 
-int parport_register_driver (struct parport_driver *drv)
+int __parport_register_driver(struct parport_driver *drv, struct module *owner,
+			      const char *mod_name)
 {
-	struct parport *port;
-
 	if (list_empty(&portlist))
 		get_lowlevel_driver ();
 
-	mutex_lock(&registration_lock);
-	list_for_each_entry(port, &portlist, list)
-		drv->attach(port);
-	list_add(&drv->list, &drivers);
-	mutex_unlock(&registration_lock);
+	if (drv->devmodel) {
+		/* using device model */
+		int ret;
+
+		/* initialize common driver fields */
+		drv->driver.name = drv->name;
+		drv->driver.bus = &parport_bus_type;
+		drv->driver.owner = owner;
+		drv->driver.mod_name = mod_name;
+		ret = driver_register(&drv->driver);
+		if (ret)
+			return ret;
+
+		mutex_lock(&registration_lock);
+		if (drv->match_port)
+			bus_for_each_dev(&parport_bus_type, NULL, drv,
+					 port_check);
+		mutex_unlock(&registration_lock);
+	} else {
+		struct parport *port;
+
+		drv->devmodel = false;
+
+		mutex_lock(&registration_lock);
+		list_for_each_entry(port, &portlist, list)
+			drv->attach(port);
+		list_add(&drv->list, &drivers);
+		mutex_unlock(&registration_lock);
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL(__parport_register_driver);
+
+static int port_detach(struct device *dev, void *_drv)
+{
+	struct parport_driver *drv = _drv;
+
+	if (is_parport(dev) && drv->detach)
+		drv->detach(to_parport_dev(dev));
 
 	return 0;
 }
@@ -189,15 +333,22 @@ void parport_unregister_driver (struct parport_driver *drv)
 	struct parport *port;
 
 	mutex_lock(&registration_lock);
-	list_del_init(&drv->list);
-	list_for_each_entry(port, &portlist, list)
-		drv->detach(port);
+	if (drv->devmodel) {
+		bus_for_each_dev(&parport_bus_type, NULL, drv, port_detach);
+		driver_unregister(&drv->driver);
+	} else {
+		list_del_init(&drv->list);
+		list_for_each_entry(port, &portlist, list)
+			drv->detach(port);
+	}
 	mutex_unlock(&registration_lock);
 }
 
-static void free_port (struct parport *port)
+static void free_port(struct device *dev)
 {
 	int d;
+	struct parport *port = to_parport_dev(dev);
+
 	spin_lock(&full_list_lock);
 	list_del(&port->full_list);
 	spin_unlock(&full_list_lock);
@@ -223,25 +374,29 @@ static void free_port (struct parport *port)
 
 struct parport *parport_get_port (struct parport *port)
 {
-	atomic_inc (&port->ref_count);
-	return port;
+	struct device *dev = get_device(&port->bus_dev);
+
+	return to_parport_dev(dev);
+}
+
+void parport_del_port(struct parport *port)
+{
+	device_unregister(&port->bus_dev);
 }
+EXPORT_SYMBOL(parport_del_port);
 
 /**
  *	parport_put_port - decrement a port's reference count
  *	@port: the port
  *
  *	This should be called once for each call to parport_get_port(),
- *	once the port is no longer needed.
+ *	once the port is no longer needed. When the reference count reaches
+ *	zero (port is no longer used), free_port is called.
  **/
 
 void parport_put_port (struct parport *port)
 {
-	if (atomic_dec_and_test (&port->ref_count))
-		/* Can destroy it now. */
-		free_port (port);
-
-	return;
+	put_device(&port->bus_dev);
 }
 
 /**
@@ -281,6 +436,7 @@ struct parport *parport_register_port(unsigned long base, int irq, int dma,
 	int num;
 	int device;
 	char *name;
+	int ret;
 
 	tmp = kzalloc(sizeof(struct parport), GFP_KERNEL);
 	if (!tmp) {
@@ -333,6 +489,10 @@ struct parport *parport_register_port(unsigned long base, int irq, int dma,
 	 */
 	sprintf(name, "parport%d", tmp->portnum = tmp->number);
 	tmp->name = name;
+	tmp->bus_dev.bus = &parport_bus_type;
+	tmp->bus_dev.release = free_port;
+	dev_set_name(&tmp->bus_dev, name);
+	tmp->bus_dev.type = &parport_device_type;
 
 	for (device = 0; device < 5; device++)
 		/* assume the worst */
@@ -340,6 +500,12 @@ struct parport *parport_register_port(unsigned long base, int irq, int dma,
 
 	tmp->waithead = tmp->waittail = NULL;
 
+	ret = device_register(&tmp->bus_dev);
+	if (ret) {
+		put_device(&tmp->bus_dev);
+		return NULL;
+	}
+
 	return tmp;
 }
 
@@ -575,6 +741,7 @@ parport_register_device(struct parport *port, const char *name,
 	tmp->irq_func = irq_func;
 	tmp->waiting = 0;
 	tmp->timeout = 5 * HZ;
+	tmp->devmodel = false;
 
 	/* Chain this onto the list */
 	tmp->prev = NULL;
@@ -630,6 +797,136 @@ parport_register_device(struct parport *port, const char *name,
 	return NULL;
 }
 
+static void free_pardevice(struct device *dev)
+{
+	struct pardevice *par_dev = to_pardevice(dev);
+
+	kfree(par_dev->name);
+	kfree(par_dev);
+}
+
+struct pardevice *
+parport_register_dev_model(struct parport *port, const char *name,
+			   const struct pardev_cb *par_dev_cb, int id)
+{
+	struct pardevice *par_dev;
+	int ret;
+	char *devname;
+
+	if (port->physport->flags & PARPORT_FLAG_EXCL) {
+		/* An exclusive device is registered. */
+		pr_err("%s: no more devices allowed\n", port->name);
+		return NULL;
+	}
+
+	if (par_dev_cb->flags & PARPORT_DEV_LURK) {
+		if (!par_dev_cb->preempt || !par_dev_cb->wakeup) {
+			pr_info("%s: refused to register lurking device (%s) without callbacks\n",
+				port->name, name);
+			return NULL;
+		}
+	}
+
+	if (!try_module_get(port->ops->owner))
+		return NULL;
+
+	parport_get_port(port);
+
+	par_dev = kzalloc(sizeof(*par_dev), GFP_KERNEL);
+	if (!par_dev)
+		goto err_put_port;
+
+	par_dev->state = kzalloc(sizeof(*par_dev->state), GFP_KERNEL);
+	if (!par_dev->state)
+		goto err_put_par_dev;
+
+	devname = kstrdup(name, GFP_KERNEL);
+	if (!devname)
+		goto err_free_par_dev;
+
+	par_dev->name = devname;
+	par_dev->port = port;
+	par_dev->daisy = -1;
+	par_dev->preempt = par_dev_cb->preempt;
+	par_dev->wakeup = par_dev_cb->wakeup;
+	par_dev->private = par_dev_cb->private;
+	par_dev->flags = par_dev_cb->flags;
+	par_dev->irq_func = par_dev_cb->irq_func;
+	par_dev->waiting = 0;
+	par_dev->timeout = 5 * HZ;
+
+	par_dev->dev.parent = &port->bus_dev;
+	par_dev->dev.bus = &parport_bus_type;
+	ret = dev_set_name(&par_dev->dev, "%s.%d", devname, id);
+	if (ret)
+		goto err_free_devname;
+	par_dev->dev.release = free_pardevice;
+	par_dev->devmodel = true;
+	ret = device_register(&par_dev->dev);
+	if (ret)
+		goto err_put_dev;
+
+	/* Chain this onto the list */
+	par_dev->prev = NULL;
+	/*
+	 * This function must not run from an irq handler so we don' t need
+	 * to clear irq on the local CPU. -arca
+	 */
+	spin_lock(&port->physport->pardevice_lock);
+
+	if (par_dev_cb->flags & PARPORT_DEV_EXCL) {
+		if (port->physport->devices) {
+			spin_unlock(&port->physport->pardevice_lock);
+			pr_debug("%s: cannot grant exclusive access for device %s\n",
+				 port->name, name);
+			goto err_put_dev;
+		}
+		port->flags |= PARPORT_FLAG_EXCL;
+	}
+
+	par_dev->next = port->physport->devices;
+	wmb();	/*
+		 * Make sure that tmp->next is written before it's
+		 * added to the list; see comments marked 'no locking
+		 * required'
+		 */
+	if (port->physport->devices)
+		port->physport->devices->prev = par_dev;
+	port->physport->devices = par_dev;
+	spin_unlock(&port->physport->pardevice_lock);
+
+	init_waitqueue_head(&par_dev->wait_q);
+	par_dev->timeslice = parport_default_timeslice;
+	par_dev->waitnext = NULL;
+	par_dev->waitprev = NULL;
+
+	/*
+	 * This has to be run as last thing since init_state may need other
+	 * pardevice fields. -arca
+	 */
+	port->ops->init_state(par_dev, par_dev->state);
+	port->proc_device = par_dev;
+	parport_device_proc_register(par_dev);
+
+	return par_dev;
+
+err_put_dev:
+	put_device(&par_dev->dev);
+err_free_devname:
+	kfree(devname);
+err_free_par_dev:
+	kfree(par_dev->state);
+err_put_par_dev:
+	if (!par_dev->devmodel)
+		kfree(par_dev);
+err_put_port:
+	parport_put_port(port);
+	module_put(port->ops->owner);
+
+	return NULL;
+}
+EXPORT_SYMBOL(parport_register_dev_model);
+
 /**
  *	parport_unregister_device - deregister a device on a parallel port
  *	@dev: pointer to structure representing device
@@ -691,7 +988,10 @@ void parport_unregister_device(struct pardevice *dev)
 	spin_unlock_irq(&port->waitlist_lock);
 
 	kfree(dev->state);
-	kfree(dev);
+	if (dev->devmodel)
+		device_unregister(&dev->dev);
+	else
+		kfree(dev);
 
 	module_put(port->ops->owner);
 	parport_put_port (port);
@@ -1019,7 +1319,6 @@ EXPORT_SYMBOL(parport_release);
 EXPORT_SYMBOL(parport_register_port);
 EXPORT_SYMBOL(parport_announce_port);
 EXPORT_SYMBOL(parport_remove_port);
-EXPORT_SYMBOL(parport_register_driver);
 EXPORT_SYMBOL(parport_unregister_driver);
 EXPORT_SYMBOL(parport_register_device);
 EXPORT_SYMBOL(parport_unregister_device);
diff --git a/include/linux/parport.h b/include/linux/parport.h
index c22f125..58e3c64 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -13,6 +13,7 @@
 #include <linux/wait.h>
 #include <linux/irqreturn.h>
 #include <linux/semaphore.h>
+#include <linux/device.h>
 #include <asm/ptrace.h>
 #include <uapi/linux/parport.h>
 
@@ -145,6 +146,8 @@ struct pardevice {
 	unsigned int flags;
 	struct pardevice *next;
 	struct pardevice *prev;
+	struct device dev;
+	bool devmodel;
 	struct parport_state *state;     /* saved status over preemption */
 	wait_queue_head_t wait_q;
 	unsigned long int time;
@@ -156,6 +159,8 @@ struct pardevice {
 	void * sysctl_table;
 };
 
+#define to_pardevice(n) container_of(n, struct pardevice, dev)
+
 /* IEEE1284 information */
 
 /* IEEE1284 phases. These are exposed to userland through ppdev IOCTL
@@ -195,7 +200,7 @@ struct parport {
 				 * This may unfortulately be null if the
 				 * port has a legacy driver.
 				 */
-
+	struct device bus_dev;	/* to link with the bus */
 	struct parport *physport;
 				/* If this is a non-default mux
 				   parport, i.e. we're a clone of a real
@@ -245,15 +250,26 @@ struct parport {
 	struct parport *slaves[3];
 };
 
+#define to_parport_dev(n) container_of(n, struct parport, bus_dev)
+
 #define DEFAULT_SPIN_TIME 500 /* us */
 
 struct parport_driver {
 	const char *name;
 	void (*attach) (struct parport *);
 	void (*detach) (struct parport *);
+	void (*match_port)(struct parport *);
+	int (*probe)(struct pardevice *);
+	struct device_driver driver;
+	bool devmodel;
 	struct list_head list;
 };
 
+#define to_parport_driver(n) container_of(n, struct parport_driver, driver)
+
+int parport_bus_init(void);
+void parport_bus_exit(void);
+
 /* parport_register_port registers a new parallel port at the given
    address (if one does not already exist) and returns a pointer to it.
    This entails claiming the I/O region, IRQ and DMA.  NULL is returned
@@ -272,10 +288,20 @@ void parport_announce_port (struct parport *port);
 extern void parport_remove_port(struct parport *port);
 
 /* Register a new high-level driver. */
-extern int parport_register_driver (struct parport_driver *);
+
+int __must_check __parport_register_driver(struct parport_driver *,
+					   struct module *,
+					   const char *mod_name);
+/*
+ * parport_register_driver must be a macro so that KBUILD_MODNAME can
+ * be expanded
+ */
+#define parport_register_driver(driver)             \
+	__parport_register_driver(driver, THIS_MODULE, KBUILD_MODNAME)
 
 /* Unregister a high-level driver. */
 extern void parport_unregister_driver (struct parport_driver *);
+void parport_unregister_driver(struct parport_driver *);
 
 /* If parport_register_driver doesn't fit your needs, perhaps
  * parport_find_xxx does. */
@@ -288,6 +314,15 @@ extern irqreturn_t parport_irq_handler(int irq, void *dev_id);
 /* Reference counting for ports. */
 extern struct parport *parport_get_port (struct parport *);
 extern void parport_put_port (struct parport *);
+void parport_del_port(struct parport *);
+
+struct pardev_cb {
+	int (*preempt)(void *);
+	void (*wakeup)(void *);
+	void *private;
+	void (*irq_func)(void *);
+	unsigned int flags;
+};
 
 /* parport_register_device declares that a device is connected to a
    port, and tells the kernel all it needs to know.
@@ -301,6 +336,10 @@ struct pardevice *parport_register_device(struct parport *port,
 			  void (*irq_func)(void *), 
 			  int flags, void *handle);
 
+struct pardevice *
+parport_register_dev_model(struct parport *port, const char *name,
+			   const struct pardev_cb *par_dev_cb, int cnt);
+
 /* parport_unregister unlinks a device from the chain. */
 extern void parport_unregister_device(struct pardevice *dev);
 
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 1/6] parport: add device-model to parport subsystem
@ 2015-05-20 15:26   ` Sudip Mukherjee
  0 siblings, 0 replies; 48+ messages in thread
From: Sudip Mukherjee @ 2015-05-20 15:26 UTC (permalink / raw)
  To: Tim Waugh, Jean Delvare, Wolfram Sang, Willy Tarreau,
	Greg Kroah-Hartman, Alan Cox
  Cc: devel, Sudip Mukherjee, linux-kernel, linux-i2c

parport subsystem starts using the device-model. Drivers using the
device-model has to define devmodel as true and should register the
device with parport using parport_register_dev_model().

Tested-by: Jean Delvare <jdelvare@suse.de>
Tested-by: Alan Cox <gnomes@lxorguk.ukuu.org.uk>
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---

patch:	renaming of cnt and one label, added one comment.
	instead of probe check for devmodel. Define a default probe.
       	No change in core functionality.

v5:
	a) addition/removal of ports are now handled.
	b) is_parport moved to the core level
	c) common parport_driver_register code
	d) parport_register_dev_model now accepts instance number.

v4:	use of is_parport() is introduced to check the type of device
	that has been passed to probe or match_port.

v3:	started use of parport_del_port(). previously it was creating
	some ghost parallel ports during port probing.
	parport_del_port() removes registered ports if probing has
	failed.

v2:	started using probe function. Without probe,whenever any driver
	is trying to register, it is getting bound to all the available
	parallel ports. To solve that probe was required.
	Now the driver is binding only to the device it has registered.
	And that device will appear as a subdevice of the particular
	parallel port it wants to use.

	In v1 Greg mentioned that we do not need to maintain our own
	list. That has been partially done. we are no longer maintaining
	the list of drivers. But we still need to maintain the list of
	ports and devices as that will be used by drivers which are not
	yet converted to device model. When all drivers are converted
	to use the device-model parallel port all these lists can be
	removed.

 drivers/parport/parport_pc.c |   4 +-
 drivers/parport/procfs.c     |  15 +-
 drivers/parport/share.c      | 345 ++++++++++++++++++++++++++++++++++++++++---
 include/linux/parport.h      |  43 +++++-
 4 files changed, 379 insertions(+), 28 deletions(-)

diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index 53d15b3..78530d1 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -2255,7 +2255,7 @@ out5:
 		release_region(base+0x3, 5);
 	release_region(base, 3);
 out4:
-	parport_put_port(p);
+	parport_del_port(p);
 out3:
 	kfree(priv);
 out2:
@@ -2294,7 +2294,7 @@ void parport_pc_unregister_port(struct parport *p)
 				    priv->dma_handle);
 #endif
 	kfree(p->private_data);
-	parport_put_port(p);
+	parport_del_port(p);
 	kfree(ops); /* hope no-one cached it */
 }
 EXPORT_SYMBOL(parport_pc_unregister_port);
diff --git a/drivers/parport/procfs.c b/drivers/parport/procfs.c
index 3b47080..c776333 100644
--- a/drivers/parport/procfs.c
+++ b/drivers/parport/procfs.c
@@ -21,6 +21,7 @@
 #include <linux/parport.h>
 #include <linux/ctype.h>
 #include <linux/sysctl.h>
+#include <linux/device.h>
 
 #include <asm/uaccess.h>
 
@@ -558,8 +559,18 @@ int parport_device_proc_unregister(struct pardevice *device)
 
 static int __init parport_default_proc_register(void)
 {
+	int ret;
+
 	parport_default_sysctl_table.sysctl_header =
 		register_sysctl_table(parport_default_sysctl_table.dev_dir);
+	if (!parport_default_sysctl_table.sysctl_header)
+		return -ENOMEM;
+	ret = parport_bus_init();
+	if (ret) {
+		unregister_sysctl_table(parport_default_sysctl_table.
+					sysctl_header);
+		return ret;
+	}
 	return 0;
 }
 
@@ -570,6 +581,7 @@ static void __exit parport_default_proc_unregister(void)
 					sysctl_header);
 		parport_default_sysctl_table.sysctl_header = NULL;
 	}
+	parport_bus_exit();
 }
 
 #else /* no sysctl or no procfs*/
@@ -596,11 +608,12 @@ int parport_device_proc_unregister(struct pardevice *device)
 
 static int __init parport_default_proc_register (void)
 {
-	return 0;
+	return parport_bus_init();
 }
 
 static void __exit parport_default_proc_unregister (void)
 {
+	parport_bus_exit();
 }
 #endif
 
diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index 3fa6624..99d03ed 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -29,6 +29,7 @@
 #include <linux/slab.h>
 #include <linux/sched.h>
 #include <linux/kmod.h>
+#include <linux/device.h>
 
 #include <linux/spinlock.h>
 #include <linux/mutex.h>
@@ -100,13 +101,91 @@ static struct parport_operations dead_ops = {
 	.owner		= NULL,
 };
 
+static struct device_type parport_device_type = {
+	.name = "parport",
+};
+
+static int is_parport(struct device *dev)
+{
+	return dev->type == &parport_device_type;
+}
+
+static int parport_probe(struct device *dev)
+{
+	struct parport_driver *drv;
+
+	if (is_parport(dev))
+		return -ENODEV;
+
+	drv = to_parport_driver(dev->driver);
+	if (!drv->probe) {
+		/* if driver has not defined a custom probe */
+		struct pardevice *par_dev = to_pardevice(dev);
+
+		if (strcmp(par_dev->name, drv->name))
+			return -ENODEV;
+		return 0;
+	}
+	/* if driver defined its own probe */
+	return drv->probe(to_pardevice(dev));
+}
+
+static struct bus_type parport_bus_type = {
+	.name = "parport",
+	.probe = parport_probe,
+};
+
+int parport_bus_init(void)
+{
+	return bus_register(&parport_bus_type);
+}
+
+void parport_bus_exit(void)
+{
+	bus_unregister(&parport_bus_type);
+}
+
+/*
+ * iterates through all the drivers registered with the bus and sends the port
+ * details to the match_port callback of the driver, so that the driver can
+ * know about the new port that just regsitered with the bus and decide if it
+ * wants to use this new port.
+ */
+static int driver_check(struct device_driver *dev_drv, void *_port)
+{
+	struct parport *port = _port;
+	struct parport_driver *drv = to_parport_driver(dev_drv);
+
+	if (drv->match_port)
+		drv->match_port(port);
+	return 0;
+}
+
 /* Call attach(port) for each registered driver. */
 static void attach_driver_chain(struct parport *port)
 {
 	/* caller has exclusive registration_lock */
 	struct parport_driver *drv;
+
 	list_for_each_entry(drv, &drivers, list)
 		drv->attach(port);
+
+	/*
+	 * call the driver_check function of the drivers registered in
+	 * new device model
+	 */
+
+	bus_for_each_drv(&parport_bus_type, NULL, port, driver_check);
+}
+
+static int driver_detach(struct device_driver *_drv, void *_port)
+{
+	struct parport *port = _port;
+	struct parport_driver *drv = to_parport_driver(_drv);
+
+	if (drv->detach)
+		drv->detach(port);
+	return 0;
 }
 
 /* Call detach(port) for each registered driver. */
@@ -116,6 +195,13 @@ static void detach_driver_chain(struct parport *port)
 	/* caller has exclusive registration_lock */
 	list_for_each_entry(drv, &drivers, list)
 		drv->detach (port);
+
+	/*
+	 * call the detach function of the drivers registered in
+	 * new device model
+	 */
+
+	bus_for_each_drv(&parport_bus_type, NULL, port, driver_detach);
 }
 
 /* Ask kmod for some lowlevel drivers. */
@@ -126,17 +212,39 @@ static void get_lowlevel_driver (void)
 	request_module ("parport_lowlevel");
 }
 
+/*
+ * iterates through all the devices connected to the bus and sends the device
+ * details to the match_port callback of the driver, so that the driver can
+ * know what are all the ports that are connected to the bus and choose the
+ * port to which it wants to register its device.
+ */
+static int port_check(struct device *dev, void *dev_drv)
+{
+	struct parport_driver *drv = dev_drv;
+
+	/* only send ports, do not send other devices connected to bus */
+	if (is_parport(dev))
+		drv->match_port(to_parport_dev(dev));
+	return 0;
+}
+
 /**
  *	parport_register_driver - register a parallel port device driver
  *	@drv: structure describing the driver
+ *	@owner: owner module of drv
+ *	@mod_name: module name string
  *
  *	This can be called by a parallel port device driver in order
  *	to receive notifications about ports being found in the
  *	system, as well as ports no longer available.
  *
+ *	If devmodel is true then the new device model is used
+ *	for registration.
+ *
  *	The @drv structure is allocated by the caller and must not be
  *	deallocated until after calling parport_unregister_driver().
  *
+ *	If using the non device model:
  *	The driver's attach() function may block.  The port that
  *	attach() is given will be valid for the duration of the
  *	callback, but if the driver wants to take a copy of the
@@ -148,21 +256,57 @@ static void get_lowlevel_driver (void)
  *	callback, but if the driver wants to take a copy of the
  *	pointer it must call parport_get_port() to do so.
  *
- *	Returns 0 on success.  Currently it always succeeds.
+ *
+ *	Returns 0 on success. The non device model will always succeeds.
+ *	but the new device model can fail and will return the error code.
  **/
 
-int parport_register_driver (struct parport_driver *drv)
+int __parport_register_driver(struct parport_driver *drv, struct module *owner,
+			      const char *mod_name)
 {
-	struct parport *port;
-
 	if (list_empty(&portlist))
 		get_lowlevel_driver ();
 
-	mutex_lock(&registration_lock);
-	list_for_each_entry(port, &portlist, list)
-		drv->attach(port);
-	list_add(&drv->list, &drivers);
-	mutex_unlock(&registration_lock);
+	if (drv->devmodel) {
+		/* using device model */
+		int ret;
+
+		/* initialize common driver fields */
+		drv->driver.name = drv->name;
+		drv->driver.bus = &parport_bus_type;
+		drv->driver.owner = owner;
+		drv->driver.mod_name = mod_name;
+		ret = driver_register(&drv->driver);
+		if (ret)
+			return ret;
+
+		mutex_lock(&registration_lock);
+		if (drv->match_port)
+			bus_for_each_dev(&parport_bus_type, NULL, drv,
+					 port_check);
+		mutex_unlock(&registration_lock);
+	} else {
+		struct parport *port;
+
+		drv->devmodel = false;
+
+		mutex_lock(&registration_lock);
+		list_for_each_entry(port, &portlist, list)
+			drv->attach(port);
+		list_add(&drv->list, &drivers);
+		mutex_unlock(&registration_lock);
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL(__parport_register_driver);
+
+static int port_detach(struct device *dev, void *_drv)
+{
+	struct parport_driver *drv = _drv;
+
+	if (is_parport(dev) && drv->detach)
+		drv->detach(to_parport_dev(dev));
 
 	return 0;
 }
@@ -189,15 +333,22 @@ void parport_unregister_driver (struct parport_driver *drv)
 	struct parport *port;
 
 	mutex_lock(&registration_lock);
-	list_del_init(&drv->list);
-	list_for_each_entry(port, &portlist, list)
-		drv->detach(port);
+	if (drv->devmodel) {
+		bus_for_each_dev(&parport_bus_type, NULL, drv, port_detach);
+		driver_unregister(&drv->driver);
+	} else {
+		list_del_init(&drv->list);
+		list_for_each_entry(port, &portlist, list)
+			drv->detach(port);
+	}
 	mutex_unlock(&registration_lock);
 }
 
-static void free_port (struct parport *port)
+static void free_port(struct device *dev)
 {
 	int d;
+	struct parport *port = to_parport_dev(dev);
+
 	spin_lock(&full_list_lock);
 	list_del(&port->full_list);
 	spin_unlock(&full_list_lock);
@@ -223,25 +374,29 @@ static void free_port (struct parport *port)
 
 struct parport *parport_get_port (struct parport *port)
 {
-	atomic_inc (&port->ref_count);
-	return port;
+	struct device *dev = get_device(&port->bus_dev);
+
+	return to_parport_dev(dev);
+}
+
+void parport_del_port(struct parport *port)
+{
+	device_unregister(&port->bus_dev);
 }
+EXPORT_SYMBOL(parport_del_port);
 
 /**
  *	parport_put_port - decrement a port's reference count
  *	@port: the port
  *
  *	This should be called once for each call to parport_get_port(),
- *	once the port is no longer needed.
+ *	once the port is no longer needed. When the reference count reaches
+ *	zero (port is no longer used), free_port is called.
  **/
 
 void parport_put_port (struct parport *port)
 {
-	if (atomic_dec_and_test (&port->ref_count))
-		/* Can destroy it now. */
-		free_port (port);
-
-	return;
+	put_device(&port->bus_dev);
 }
 
 /**
@@ -281,6 +436,7 @@ struct parport *parport_register_port(unsigned long base, int irq, int dma,
 	int num;
 	int device;
 	char *name;
+	int ret;
 
 	tmp = kzalloc(sizeof(struct parport), GFP_KERNEL);
 	if (!tmp) {
@@ -333,6 +489,10 @@ struct parport *parport_register_port(unsigned long base, int irq, int dma,
 	 */
 	sprintf(name, "parport%d", tmp->portnum = tmp->number);
 	tmp->name = name;
+	tmp->bus_dev.bus = &parport_bus_type;
+	tmp->bus_dev.release = free_port;
+	dev_set_name(&tmp->bus_dev, name);
+	tmp->bus_dev.type = &parport_device_type;
 
 	for (device = 0; device < 5; device++)
 		/* assume the worst */
@@ -340,6 +500,12 @@ struct parport *parport_register_port(unsigned long base, int irq, int dma,
 
 	tmp->waithead = tmp->waittail = NULL;
 
+	ret = device_register(&tmp->bus_dev);
+	if (ret) {
+		put_device(&tmp->bus_dev);
+		return NULL;
+	}
+
 	return tmp;
 }
 
@@ -575,6 +741,7 @@ parport_register_device(struct parport *port, const char *name,
 	tmp->irq_func = irq_func;
 	tmp->waiting = 0;
 	tmp->timeout = 5 * HZ;
+	tmp->devmodel = false;
 
 	/* Chain this onto the list */
 	tmp->prev = NULL;
@@ -630,6 +797,136 @@ parport_register_device(struct parport *port, const char *name,
 	return NULL;
 }
 
+static void free_pardevice(struct device *dev)
+{
+	struct pardevice *par_dev = to_pardevice(dev);
+
+	kfree(par_dev->name);
+	kfree(par_dev);
+}
+
+struct pardevice *
+parport_register_dev_model(struct parport *port, const char *name,
+			   const struct pardev_cb *par_dev_cb, int id)
+{
+	struct pardevice *par_dev;
+	int ret;
+	char *devname;
+
+	if (port->physport->flags & PARPORT_FLAG_EXCL) {
+		/* An exclusive device is registered. */
+		pr_err("%s: no more devices allowed\n", port->name);
+		return NULL;
+	}
+
+	if (par_dev_cb->flags & PARPORT_DEV_LURK) {
+		if (!par_dev_cb->preempt || !par_dev_cb->wakeup) {
+			pr_info("%s: refused to register lurking device (%s) without callbacks\n",
+				port->name, name);
+			return NULL;
+		}
+	}
+
+	if (!try_module_get(port->ops->owner))
+		return NULL;
+
+	parport_get_port(port);
+
+	par_dev = kzalloc(sizeof(*par_dev), GFP_KERNEL);
+	if (!par_dev)
+		goto err_put_port;
+
+	par_dev->state = kzalloc(sizeof(*par_dev->state), GFP_KERNEL);
+	if (!par_dev->state)
+		goto err_put_par_dev;
+
+	devname = kstrdup(name, GFP_KERNEL);
+	if (!devname)
+		goto err_free_par_dev;
+
+	par_dev->name = devname;
+	par_dev->port = port;
+	par_dev->daisy = -1;
+	par_dev->preempt = par_dev_cb->preempt;
+	par_dev->wakeup = par_dev_cb->wakeup;
+	par_dev->private = par_dev_cb->private;
+	par_dev->flags = par_dev_cb->flags;
+	par_dev->irq_func = par_dev_cb->irq_func;
+	par_dev->waiting = 0;
+	par_dev->timeout = 5 * HZ;
+
+	par_dev->dev.parent = &port->bus_dev;
+	par_dev->dev.bus = &parport_bus_type;
+	ret = dev_set_name(&par_dev->dev, "%s.%d", devname, id);
+	if (ret)
+		goto err_free_devname;
+	par_dev->dev.release = free_pardevice;
+	par_dev->devmodel = true;
+	ret = device_register(&par_dev->dev);
+	if (ret)
+		goto err_put_dev;
+
+	/* Chain this onto the list */
+	par_dev->prev = NULL;
+	/*
+	 * This function must not run from an irq handler so we don' t need
+	 * to clear irq on the local CPU. -arca
+	 */
+	spin_lock(&port->physport->pardevice_lock);
+
+	if (par_dev_cb->flags & PARPORT_DEV_EXCL) {
+		if (port->physport->devices) {
+			spin_unlock(&port->physport->pardevice_lock);
+			pr_debug("%s: cannot grant exclusive access for device %s\n",
+				 port->name, name);
+			goto err_put_dev;
+		}
+		port->flags |= PARPORT_FLAG_EXCL;
+	}
+
+	par_dev->next = port->physport->devices;
+	wmb();	/*
+		 * Make sure that tmp->next is written before it's
+		 * added to the list; see comments marked 'no locking
+		 * required'
+		 */
+	if (port->physport->devices)
+		port->physport->devices->prev = par_dev;
+	port->physport->devices = par_dev;
+	spin_unlock(&port->physport->pardevice_lock);
+
+	init_waitqueue_head(&par_dev->wait_q);
+	par_dev->timeslice = parport_default_timeslice;
+	par_dev->waitnext = NULL;
+	par_dev->waitprev = NULL;
+
+	/*
+	 * This has to be run as last thing since init_state may need other
+	 * pardevice fields. -arca
+	 */
+	port->ops->init_state(par_dev, par_dev->state);
+	port->proc_device = par_dev;
+	parport_device_proc_register(par_dev);
+
+	return par_dev;
+
+err_put_dev:
+	put_device(&par_dev->dev);
+err_free_devname:
+	kfree(devname);
+err_free_par_dev:
+	kfree(par_dev->state);
+err_put_par_dev:
+	if (!par_dev->devmodel)
+		kfree(par_dev);
+err_put_port:
+	parport_put_port(port);
+	module_put(port->ops->owner);
+
+	return NULL;
+}
+EXPORT_SYMBOL(parport_register_dev_model);
+
 /**
  *	parport_unregister_device - deregister a device on a parallel port
  *	@dev: pointer to structure representing device
@@ -691,7 +988,10 @@ void parport_unregister_device(struct pardevice *dev)
 	spin_unlock_irq(&port->waitlist_lock);
 
 	kfree(dev->state);
-	kfree(dev);
+	if (dev->devmodel)
+		device_unregister(&dev->dev);
+	else
+		kfree(dev);
 
 	module_put(port->ops->owner);
 	parport_put_port (port);
@@ -1019,7 +1319,6 @@ EXPORT_SYMBOL(parport_release);
 EXPORT_SYMBOL(parport_register_port);
 EXPORT_SYMBOL(parport_announce_port);
 EXPORT_SYMBOL(parport_remove_port);
-EXPORT_SYMBOL(parport_register_driver);
 EXPORT_SYMBOL(parport_unregister_driver);
 EXPORT_SYMBOL(parport_register_device);
 EXPORT_SYMBOL(parport_unregister_device);
diff --git a/include/linux/parport.h b/include/linux/parport.h
index c22f125..58e3c64 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -13,6 +13,7 @@
 #include <linux/wait.h>
 #include <linux/irqreturn.h>
 #include <linux/semaphore.h>
+#include <linux/device.h>
 #include <asm/ptrace.h>
 #include <uapi/linux/parport.h>
 
@@ -145,6 +146,8 @@ struct pardevice {
 	unsigned int flags;
 	struct pardevice *next;
 	struct pardevice *prev;
+	struct device dev;
+	bool devmodel;
 	struct parport_state *state;     /* saved status over preemption */
 	wait_queue_head_t wait_q;
 	unsigned long int time;
@@ -156,6 +159,8 @@ struct pardevice {
 	void * sysctl_table;
 };
 
+#define to_pardevice(n) container_of(n, struct pardevice, dev)
+
 /* IEEE1284 information */
 
 /* IEEE1284 phases. These are exposed to userland through ppdev IOCTL
@@ -195,7 +200,7 @@ struct parport {
 				 * This may unfortulately be null if the
 				 * port has a legacy driver.
 				 */
-
+	struct device bus_dev;	/* to link with the bus */
 	struct parport *physport;
 				/* If this is a non-default mux
 				   parport, i.e. we're a clone of a real
@@ -245,15 +250,26 @@ struct parport {
 	struct parport *slaves[3];
 };
 
+#define to_parport_dev(n) container_of(n, struct parport, bus_dev)
+
 #define DEFAULT_SPIN_TIME 500 /* us */
 
 struct parport_driver {
 	const char *name;
 	void (*attach) (struct parport *);
 	void (*detach) (struct parport *);
+	void (*match_port)(struct parport *);
+	int (*probe)(struct pardevice *);
+	struct device_driver driver;
+	bool devmodel;
 	struct list_head list;
 };
 
+#define to_parport_driver(n) container_of(n, struct parport_driver, driver)
+
+int parport_bus_init(void);
+void parport_bus_exit(void);
+
 /* parport_register_port registers a new parallel port at the given
    address (if one does not already exist) and returns a pointer to it.
    This entails claiming the I/O region, IRQ and DMA.  NULL is returned
@@ -272,10 +288,20 @@ void parport_announce_port (struct parport *port);
 extern void parport_remove_port(struct parport *port);
 
 /* Register a new high-level driver. */
-extern int parport_register_driver (struct parport_driver *);
+
+int __must_check __parport_register_driver(struct parport_driver *,
+					   struct module *,
+					   const char *mod_name);
+/*
+ * parport_register_driver must be a macro so that KBUILD_MODNAME can
+ * be expanded
+ */
+#define parport_register_driver(driver)             \
+	__parport_register_driver(driver, THIS_MODULE, KBUILD_MODNAME)
 
 /* Unregister a high-level driver. */
 extern void parport_unregister_driver (struct parport_driver *);
+void parport_unregister_driver(struct parport_driver *);
 
 /* If parport_register_driver doesn't fit your needs, perhaps
  * parport_find_xxx does. */
@@ -288,6 +314,15 @@ extern irqreturn_t parport_irq_handler(int irq, void *dev_id);
 /* Reference counting for ports. */
 extern struct parport *parport_get_port (struct parport *);
 extern void parport_put_port (struct parport *);
+void parport_del_port(struct parport *);
+
+struct pardev_cb {
+	int (*preempt)(void *);
+	void (*wakeup)(void *);
+	void *private;
+	void (*irq_func)(void *);
+	unsigned int flags;
+};
 
 /* parport_register_device declares that a device is connected to a
    port, and tells the kernel all it needs to know.
@@ -301,6 +336,10 @@ struct pardevice *parport_register_device(struct parport *port,
 			  void (*irq_func)(void *), 
 			  int flags, void *handle);
 
+struct pardevice *
+parport_register_dev_model(struct parport *port, const char *name,
+			   const struct pardev_cb *par_dev_cb, int cnt);
+
 /* parport_unregister unlinks a device from the chain. */
 extern void parport_unregister_device(struct pardevice *dev);
 
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 2/6] staging: panel: use new parport device model
  2015-05-20 15:26 ` Sudip Mukherjee
  (?)
  (?)
@ 2015-05-20 15:26 ` Sudip Mukherjee
  -1 siblings, 0 replies; 48+ messages in thread
From: Sudip Mukherjee @ 2015-05-20 15:26 UTC (permalink / raw)
  To: Tim Waugh, Jean Delvare, Wolfram Sang, Willy Tarreau,
	Greg Kroah-Hartman, Alan Cox
  Cc: linux-kernel, linux-i2c, devel, Sudip Mukherjee

Converted to use the new device-model parallel port.

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

The comment about panel_cb.flags can be removed, it is kept just
for the comment to remind us that it might be better to use
PARPORT_DEV_EXCL.

 drivers/staging/panel/panel.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index 1d8ed8b..70f0ac6 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -2190,6 +2190,8 @@ static struct notifier_block panel_notifier = {
 
 static void panel_attach(struct parport *port)
 {
+	struct pardev_cb panel_cb;
+
 	if (port->number != parport)
 		return;
 
@@ -2199,10 +2201,11 @@ static void panel_attach(struct parport *port)
 		return;
 	}
 
-	pprt = parport_register_device(port, "panel", NULL, NULL,  /* pf, kf */
-				       NULL,
-				       /*PARPORT_DEV_EXCL */
-				       0, (void *)&pprt);
+	memset(&panel_cb, 0, sizeof(panel_cb));
+	panel_cb.private = &pprt;
+	/* panel_cb.flags = 0 should be PARPORT_DEV_EXCL? */
+
+	pprt = parport_register_dev_model(port, "panel", &panel_cb, 0);
 	if (pprt == NULL) {
 		pr_err("%s: port->number=%d parport=%d, parport_register_device() failed\n",
 		       __func__, port->number, parport);
@@ -2256,8 +2259,9 @@ static void panel_detach(struct parport *port)
 
 static struct parport_driver panel_driver = {
 	.name = "panel",
-	.attach = panel_attach,
+	.match_port = panel_attach,
 	.detach = panel_detach,
+	.devmodel = true,
 };
 
 /* init function */
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 3/6] i2c-parport: define ports to connect
  2015-05-20 15:26 ` Sudip Mukherjee
@ 2015-05-20 15:26   ` Sudip Mukherjee
  -1 siblings, 0 replies; 48+ messages in thread
From: Sudip Mukherjee @ 2015-05-20 15:26 UTC (permalink / raw)
  To: Tim Waugh, Jean Delvare, Wolfram Sang, Willy Tarreau,
	Greg Kroah-Hartman, Alan Cox
  Cc: linux-kernel, linux-i2c, devel, Sudip Mukherjee

As of now i2c-parport was connecting to all the available parallel
ports. Lets limit that to maximum of 4 instances and at the same time
define which instance connects to which parallel port.

Tested-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---

MODULE_PARM_DESC modified

 drivers/i2c/busses/i2c-parport.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c
index a1fac5a..155da95 100644
--- a/drivers/i2c/busses/i2c-parport.c
+++ b/drivers/i2c/busses/i2c-parport.c
@@ -46,6 +46,9 @@ struct i2c_par {
 
 static LIST_HEAD(adapter_list);
 static DEFINE_MUTEX(adapter_list_lock);
+#define MAX_DEVICE 4
+static int parport[MAX_DEVICE] = {0, -1, -1, -1};
+
 
 /* ----- Low-level parallel port access ----------------------------------- */
 
@@ -163,6 +166,19 @@ static void i2c_parport_irq(void *data)
 static void i2c_parport_attach(struct parport *port)
 {
 	struct i2c_par *adapter;
+	int i;
+	struct pardev_cb i2c_parport_cb;
+
+	for (i = 0; i < MAX_DEVICE; i++) {
+		if (parport[i] == -1)
+			continue;
+		if (port->number == parport[i])
+			break;
+	}
+	if (i == MAX_DEVICE) {
+		pr_debug("i2c-parport: Not using parport%d.\n", port->number);
+		return;
+	}
 
 	adapter = kzalloc(sizeof(struct i2c_par), GFP_KERNEL);
 	if (adapter == NULL) {
@@ -298,5 +314,12 @@ MODULE_AUTHOR("Jean Delvare <jdelvare@suse.de>");
 MODULE_DESCRIPTION("I2C bus over parallel port");
 MODULE_LICENSE("GPL");
 
+module_param_array(parport, int, NULL, 0);
+MODULE_PARM_DESC(parport,
+		 "List of parallel ports to bind to, by index.\n"
+		 " Atmost " __stringify(MAX_DEVICE) " devices are supported.\n"
+		 " Default is one device connected to parport0.\n"
+);
+
 module_init(i2c_parport_init);
 module_exit(i2c_parport_exit);
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 3/6] i2c-parport: define ports to connect
@ 2015-05-20 15:26   ` Sudip Mukherjee
  0 siblings, 0 replies; 48+ messages in thread
From: Sudip Mukherjee @ 2015-05-20 15:26 UTC (permalink / raw)
  To: Tim Waugh, Jean Delvare, Wolfram Sang, Willy Tarreau,
	Greg Kroah-Hartman, Alan Cox
  Cc: devel, Sudip Mukherjee, linux-kernel, linux-i2c

As of now i2c-parport was connecting to all the available parallel
ports. Lets limit that to maximum of 4 instances and at the same time
define which instance connects to which parallel port.

Tested-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---

MODULE_PARM_DESC modified

 drivers/i2c/busses/i2c-parport.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c
index a1fac5a..155da95 100644
--- a/drivers/i2c/busses/i2c-parport.c
+++ b/drivers/i2c/busses/i2c-parport.c
@@ -46,6 +46,9 @@ struct i2c_par {
 
 static LIST_HEAD(adapter_list);
 static DEFINE_MUTEX(adapter_list_lock);
+#define MAX_DEVICE 4
+static int parport[MAX_DEVICE] = {0, -1, -1, -1};
+
 
 /* ----- Low-level parallel port access ----------------------------------- */
 
@@ -163,6 +166,19 @@ static void i2c_parport_irq(void *data)
 static void i2c_parport_attach(struct parport *port)
 {
 	struct i2c_par *adapter;
+	int i;
+	struct pardev_cb i2c_parport_cb;
+
+	for (i = 0; i < MAX_DEVICE; i++) {
+		if (parport[i] == -1)
+			continue;
+		if (port->number == parport[i])
+			break;
+	}
+	if (i == MAX_DEVICE) {
+		pr_debug("i2c-parport: Not using parport%d.\n", port->number);
+		return;
+	}
 
 	adapter = kzalloc(sizeof(struct i2c_par), GFP_KERNEL);
 	if (adapter == NULL) {
@@ -298,5 +314,12 @@ MODULE_AUTHOR("Jean Delvare <jdelvare@suse.de>");
 MODULE_DESCRIPTION("I2C bus over parallel port");
 MODULE_LICENSE("GPL");
 
+module_param_array(parport, int, NULL, 0);
+MODULE_PARM_DESC(parport,
+		 "List of parallel ports to bind to, by index.\n"
+		 " Atmost " __stringify(MAX_DEVICE) " devices are supported.\n"
+		 " Default is one device connected to parport0.\n"
+);
+
 module_init(i2c_parport_init);
 module_exit(i2c_parport_exit);
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 4/6] i2c-parport: use new parport device model
  2015-05-20 15:26 ` Sudip Mukherjee
                   ` (3 preceding siblings ...)
  (?)
@ 2015-05-20 15:27 ` Sudip Mukherjee
  2015-05-20 15:49   ` Wolfram Sang
  2015-05-21  6:16     ` Sudip Mukherjee
  -1 siblings, 2 replies; 48+ messages in thread
From: Sudip Mukherjee @ 2015-05-20 15:27 UTC (permalink / raw)
  To: Tim Waugh, Jean Delvare, Wolfram Sang, Willy Tarreau,
	Greg Kroah-Hartman, Alan Cox
  Cc: linux-kernel, linux-i2c, devel, Sudip Mukherjee

Modify i2c-parport driver to use the new parallel port device model.

Tested-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---

i2c_parport_cb is made local, devmodel added to driver structure,
and probe removed.	       

 drivers/i2c/busses/i2c-parport.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c
index 155da95..138347e 100644
--- a/drivers/i2c/busses/i2c-parport.c
+++ b/drivers/i2c/busses/i2c-parport.c
@@ -185,11 +185,15 @@ static void i2c_parport_attach(struct parport *port)
 		printk(KERN_ERR "i2c-parport: Failed to kzalloc\n");
 		return;
 	}
+	memset(&i2c_parport_cb, 0, sizeof(i2c_parport_cb));
+	i2c_parport_cb.flags = PARPORT_FLAG_EXCL;
+	i2c_parport_cb.irq_func = i2c_parport_irq;
+	i2c_parport_cb.private = adapter;
 
 	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_model(port, "i2c-parport",
+						   &i2c_parport_cb, i);
 	if (!adapter->pdev) {
 		printk(KERN_ERR "i2c-parport: Unable to register with parport\n");
 		goto err_free;
@@ -283,9 +287,10 @@ static void i2c_parport_detach(struct parport *port)
 }
 
 static struct parport_driver i2c_parport_driver = {
-	.name	= "i2c-parport",
-	.attach	= i2c_parport_attach,
-	.detach	= i2c_parport_detach,
+	.name		= "i2c-parport",
+	.match_port	= i2c_parport_attach,
+	.detach		= i2c_parport_detach,
+	.devmodel	= true,
 };
 
 /* ----- Module loading, unloading and information ------------------------ */
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 5/6] paride: use new parport device model
  2015-05-20 15:26 ` Sudip Mukherjee
@ 2015-05-20 15:27   ` Sudip Mukherjee
  -1 siblings, 0 replies; 48+ messages in thread
From: Sudip Mukherjee @ 2015-05-20 15:27 UTC (permalink / raw)
  To: Tim Waugh, Jean Delvare, Wolfram Sang, Willy Tarreau,
	Greg Kroah-Hartman, Alan Cox
  Cc: linux-kernel, linux-i2c, devel, Sudip Mukherjee

Modify paride driver to use the new parallel port device model.

Tested-by: Alan Cox <gnomes@lxorguk.ukuu.org.uk>
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---

One change after testing by Alan, par_cb is made a local variable
instead of a global one.

 drivers/block/paride/paride.c | 57 ++++++++++++++++++++++++++++++++++++++-----
 drivers/block/paride/paride.h |  2 ++
 drivers/block/paride/pcd.c    |  9 +++++++
 drivers/block/paride/pd.c     | 12 ++++++++-
 drivers/block/paride/pf.c     |  7 ++++++
 drivers/block/paride/pg.c     |  8 ++++++
 drivers/block/paride/pt.c     |  8 ++++++
 7 files changed, 96 insertions(+), 7 deletions(-)

diff --git a/drivers/block/paride/paride.c b/drivers/block/paride/paride.c
index 48c50f1..0e28799 100644
--- a/drivers/block/paride/paride.c
+++ b/drivers/block/paride/paride.c
@@ -30,6 +30,7 @@
 #include <linux/wait.h>
 #include <linux/sched.h>	/* TASK_* */
 #include <linux/parport.h>
+#include <linux/slab.h>
 
 #include "paride.h"
 
@@ -244,17 +245,19 @@ void paride_unregister(PIP * pr)
 
 EXPORT_SYMBOL(paride_unregister);
 
-static int pi_register_parport(PIA * pi, int verbose)
+static int pi_register_parport(PIA *pi, int verbose, int unit)
 {
 	struct parport *port;
+	struct pardev_cb par_cb;
 
 	port = parport_find_base(pi->port);
 	if (!port)
 		return 0;
-
-	pi->pardev = parport_register_device(port,
-					     pi->device, NULL,
-					     pi_wake_up, NULL, 0, (void *) pi);
+	memset(&par_cb, 0, sizeof(par_cb));
+	par_cb.wakeup = pi_wake_up;
+	par_cb.private = (void *)pi;
+	pi->pardev = parport_register_dev_model(port, pi->device, &par_cb,
+						unit);
 	parport_put_port(port);
 	if (!pi->pardev)
 		return 0;
@@ -311,7 +314,7 @@ static int pi_probe_unit(PIA * pi, int unit, char *scratch, int verbose)
 		e = pi->proto->max_units;
 	}
 
-	if (!pi_register_parport(pi, verbose))
+	if (!pi_register_parport(pi, verbose, s))
 		return 0;
 
 	if (pi->proto->test_port) {
@@ -432,3 +435,45 @@ int pi_init(PIA * pi, int autoprobe, int port, int mode,
 }
 
 EXPORT_SYMBOL(pi_init);
+
+static int pi_probe(struct pardevice *par_dev)
+{
+	struct device_driver *drv = par_dev->dev.driver;
+	int len = strlen(drv->name);
+
+	if (strncmp(par_dev->name, drv->name, len))
+		return -ENODEV;
+
+	return 0;
+}
+
+void *pi_register_driver(char *name)
+{
+	struct parport_driver *parp_drv;
+	int ret;
+
+	parp_drv = kzalloc(sizeof(*parp_drv), GFP_KERNEL);
+	if (!parp_drv)
+		return NULL;
+
+	parp_drv->name = name;
+	parp_drv->probe = pi_probe;
+	parp_drv->devmodel = true;
+
+	ret = parport_register_driver(parp_drv);
+	if (ret) {
+		kfree(parp_drv);
+		return NULL;
+	}
+	return (void *)parp_drv;
+}
+EXPORT_SYMBOL(pi_register_driver);
+
+void pi_unregister_driver(void *_drv)
+{
+	struct parport_driver *drv = _drv;
+
+	parport_unregister_driver(drv);
+	kfree(drv);
+}
+EXPORT_SYMBOL(pi_unregister_driver);
diff --git a/drivers/block/paride/paride.h b/drivers/block/paride/paride.h
index 2bddbf4..ddb9e58 100644
--- a/drivers/block/paride/paride.h
+++ b/drivers/block/paride/paride.h
@@ -165,6 +165,8 @@ typedef struct pi_protocol PIP;
 
 extern int paride_register( PIP * );
 extern void paride_unregister ( PIP * );
+void *pi_register_driver(char *);
+void pi_unregister_driver(void *);
 
 #endif /* __DRIVERS_PARIDE_H__ */
 /* end of paride.h */
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c
index 3b7c9f1..9336236 100644
--- a/drivers/block/paride/pcd.c
+++ b/drivers/block/paride/pcd.c
@@ -221,6 +221,7 @@ static int pcd_busy;		/* request being processed ? */
 static int pcd_sector;		/* address of next requested sector */
 static int pcd_count;		/* number of blocks still to do */
 static char *pcd_buf;		/* buffer for request in progress */
+static void *par_drv;		/* reference of parport driver */
 
 /* kernel glue structures */
 
@@ -690,6 +691,12 @@ static int pcd_detect(void)
 	printk("%s: %s version %s, major %d, nice %d\n",
 	       name, name, PCD_VERSION, major, nice);
 
+	par_drv = pi_register_driver(name);
+	if (!par_drv) {
+		pr_err("failed to register %s driver\n", name);
+		return -1;
+	}
+
 	k = 0;
 	if (pcd_drive_count == 0) { /* nothing spec'd - so autoprobe for 1 */
 		cd = pcd;
@@ -723,6 +730,7 @@ static int pcd_detect(void)
 	printk("%s: No CD-ROM drive found\n", name);
 	for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++)
 		put_disk(cd->disk);
+	pi_unregister_driver(par_drv);
 	return -1;
 }
 
@@ -984,6 +992,7 @@ static void __exit pcd_exit(void)
 	}
 	blk_cleanup_queue(pcd_queue);
 	unregister_blkdev(major, name);
+	pi_unregister_driver(par_drv);
 }
 
 MODULE_LICENSE("GPL");
diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c
index dbb4da1..b9242d7 100644
--- a/drivers/block/paride/pd.c
+++ b/drivers/block/paride/pd.c
@@ -247,6 +247,8 @@ static char *pd_errs[17] = { "ERR", "INDEX", "ECC", "DRQ", "SEEK", "WRERR",
 	"IDNF", "MC", "UNC", "???", "TMO"
 };
 
+static void *par_drv;		/* reference of parport driver */
+
 static inline int status_reg(struct pd_unit *disk)
 {
 	return pi_read_regr(disk->pi, 1, 6);
@@ -872,6 +874,12 @@ static int pd_detect(void)
 			pd_drive_count++;
 	}
 
+	par_drv = pi_register_driver(name);
+	if (!par_drv) {
+		pr_err("failed to register %s driver\n", name);
+		return -1;
+	}
+
 	if (pd_drive_count == 0) { /* nothing spec'd - so autoprobe for 1 */
 		disk = pd;
 		if (pi_init(disk->pi, 1, -1, -1, -1, -1, -1, pd_scratch,
@@ -902,8 +910,10 @@ static int pd_detect(void)
 			found = 1;
 		}
 	}
-	if (!found)
+	if (!found) {
 		printk("%s: no valid drive found\n", name);
+		pi_unregister_driver(par_drv);
+	}
 	return found;
 }
 
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c
index 9a15fd3..7a7d977 100644
--- a/drivers/block/paride/pf.c
+++ b/drivers/block/paride/pf.c
@@ -264,6 +264,7 @@ static int pf_cmd;		/* current command READ/WRITE */
 static struct pf_unit *pf_current;/* unit of current request */
 static int pf_mask;		/* stopper for pseudo-int */
 static char *pf_buf;		/* buffer for request in progress */
+static void *par_drv;		/* reference of parport driver */
 
 /* kernel glue structures */
 
@@ -703,6 +704,11 @@ static int pf_detect(void)
 	printk("%s: %s version %s, major %d, cluster %d, nice %d\n",
 	       name, name, PF_VERSION, major, cluster, nice);
 
+	par_drv = pi_register_driver(name);
+	if (!par_drv) {
+		pr_err("failed to register %s driver\n", name);
+		return -1;
+	}
 	k = 0;
 	if (pf_drive_count == 0) {
 		if (pi_init(pf->pi, 1, -1, -1, -1, -1, -1, pf_scratch, PI_PF,
@@ -735,6 +741,7 @@ static int pf_detect(void)
 	printk("%s: No ATAPI disk detected\n", name);
 	for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++)
 		put_disk(pf->disk);
+	pi_unregister_driver(par_drv);
 	return -1;
 }
 
diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c
index 876d0c3..bfbd4c8 100644
--- a/drivers/block/paride/pg.c
+++ b/drivers/block/paride/pg.c
@@ -227,6 +227,7 @@ static int pg_identify(struct pg *dev, int log);
 static char pg_scratch[512];	/* scratch block buffer */
 
 static struct class *pg_class;
+static void *par_drv;		/* reference of parport driver */
 
 /* kernel glue structures */
 
@@ -481,6 +482,12 @@ static int pg_detect(void)
 
 	printk("%s: %s version %s, major %d\n", name, name, PG_VERSION, major);
 
+	par_drv = pi_register_driver(name);
+	if (!par_drv) {
+		pr_err("failed to register %s driver\n", name);
+		return -1;
+	}
+
 	k = 0;
 	if (pg_drive_count == 0) {
 		if (pi_init(dev->pi, 1, -1, -1, -1, -1, -1, pg_scratch,
@@ -511,6 +518,7 @@ static int pg_detect(void)
 	if (k)
 		return 0;
 
+	pi_unregister_driver(par_drv);
 	printk("%s: No ATAPI device detected\n", name);
 	return -1;
 }
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c
index 2596042..1740d75 100644
--- a/drivers/block/paride/pt.c
+++ b/drivers/block/paride/pt.c
@@ -232,6 +232,7 @@ static int pt_identify(struct pt_unit *tape);
 static struct pt_unit pt[PT_UNITS];
 
 static char pt_scratch[512];	/* scratch block buffer */
+static void *par_drv;		/* reference of parport driver */
 
 /* kernel glue structures */
 
@@ -605,6 +606,12 @@ static int pt_detect(void)
 
 	printk("%s: %s version %s, major %d\n", name, name, PT_VERSION, major);
 
+	par_drv = pi_register_driver(name);
+	if (!par_drv) {
+		pr_err("failed to register %s driver\n", name);
+		return -1;
+	}
+
 	specified = 0;
 	for (unit = 0; unit < PT_UNITS; unit++) {
 		struct pt_unit *tape = &pt[unit];
@@ -644,6 +651,7 @@ static int pt_detect(void)
 	if (found)
 		return 0;
 
+	pi_unregister_driver(par_drv);
 	printk("%s: No ATAPI tape drive detected\n", name);
 	return -1;
 }
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 5/6] paride: use new parport device model
@ 2015-05-20 15:27   ` Sudip Mukherjee
  0 siblings, 0 replies; 48+ messages in thread
From: Sudip Mukherjee @ 2015-05-20 15:27 UTC (permalink / raw)
  To: Tim Waugh, Jean Delvare, Wolfram Sang, Willy Tarreau,
	Greg Kroah-Hartman, Alan Cox
  Cc: devel, Sudip Mukherjee, linux-kernel, linux-i2c

Modify paride driver to use the new parallel port device model.

Tested-by: Alan Cox <gnomes@lxorguk.ukuu.org.uk>
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---

One change after testing by Alan, par_cb is made a local variable
instead of a global one.

 drivers/block/paride/paride.c | 57 ++++++++++++++++++++++++++++++++++++++-----
 drivers/block/paride/paride.h |  2 ++
 drivers/block/paride/pcd.c    |  9 +++++++
 drivers/block/paride/pd.c     | 12 ++++++++-
 drivers/block/paride/pf.c     |  7 ++++++
 drivers/block/paride/pg.c     |  8 ++++++
 drivers/block/paride/pt.c     |  8 ++++++
 7 files changed, 96 insertions(+), 7 deletions(-)

diff --git a/drivers/block/paride/paride.c b/drivers/block/paride/paride.c
index 48c50f1..0e28799 100644
--- a/drivers/block/paride/paride.c
+++ b/drivers/block/paride/paride.c
@@ -30,6 +30,7 @@
 #include <linux/wait.h>
 #include <linux/sched.h>	/* TASK_* */
 #include <linux/parport.h>
+#include <linux/slab.h>
 
 #include "paride.h"
 
@@ -244,17 +245,19 @@ void paride_unregister(PIP * pr)
 
 EXPORT_SYMBOL(paride_unregister);
 
-static int pi_register_parport(PIA * pi, int verbose)
+static int pi_register_parport(PIA *pi, int verbose, int unit)
 {
 	struct parport *port;
+	struct pardev_cb par_cb;
 
 	port = parport_find_base(pi->port);
 	if (!port)
 		return 0;
-
-	pi->pardev = parport_register_device(port,
-					     pi->device, NULL,
-					     pi_wake_up, NULL, 0, (void *) pi);
+	memset(&par_cb, 0, sizeof(par_cb));
+	par_cb.wakeup = pi_wake_up;
+	par_cb.private = (void *)pi;
+	pi->pardev = parport_register_dev_model(port, pi->device, &par_cb,
+						unit);
 	parport_put_port(port);
 	if (!pi->pardev)
 		return 0;
@@ -311,7 +314,7 @@ static int pi_probe_unit(PIA * pi, int unit, char *scratch, int verbose)
 		e = pi->proto->max_units;
 	}
 
-	if (!pi_register_parport(pi, verbose))
+	if (!pi_register_parport(pi, verbose, s))
 		return 0;
 
 	if (pi->proto->test_port) {
@@ -432,3 +435,45 @@ int pi_init(PIA * pi, int autoprobe, int port, int mode,
 }
 
 EXPORT_SYMBOL(pi_init);
+
+static int pi_probe(struct pardevice *par_dev)
+{
+	struct device_driver *drv = par_dev->dev.driver;
+	int len = strlen(drv->name);
+
+	if (strncmp(par_dev->name, drv->name, len))
+		return -ENODEV;
+
+	return 0;
+}
+
+void *pi_register_driver(char *name)
+{
+	struct parport_driver *parp_drv;
+	int ret;
+
+	parp_drv = kzalloc(sizeof(*parp_drv), GFP_KERNEL);
+	if (!parp_drv)
+		return NULL;
+
+	parp_drv->name = name;
+	parp_drv->probe = pi_probe;
+	parp_drv->devmodel = true;
+
+	ret = parport_register_driver(parp_drv);
+	if (ret) {
+		kfree(parp_drv);
+		return NULL;
+	}
+	return (void *)parp_drv;
+}
+EXPORT_SYMBOL(pi_register_driver);
+
+void pi_unregister_driver(void *_drv)
+{
+	struct parport_driver *drv = _drv;
+
+	parport_unregister_driver(drv);
+	kfree(drv);
+}
+EXPORT_SYMBOL(pi_unregister_driver);
diff --git a/drivers/block/paride/paride.h b/drivers/block/paride/paride.h
index 2bddbf4..ddb9e58 100644
--- a/drivers/block/paride/paride.h
+++ b/drivers/block/paride/paride.h
@@ -165,6 +165,8 @@ typedef struct pi_protocol PIP;
 
 extern int paride_register( PIP * );
 extern void paride_unregister ( PIP * );
+void *pi_register_driver(char *);
+void pi_unregister_driver(void *);
 
 #endif /* __DRIVERS_PARIDE_H__ */
 /* end of paride.h */
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c
index 3b7c9f1..9336236 100644
--- a/drivers/block/paride/pcd.c
+++ b/drivers/block/paride/pcd.c
@@ -221,6 +221,7 @@ static int pcd_busy;		/* request being processed ? */
 static int pcd_sector;		/* address of next requested sector */
 static int pcd_count;		/* number of blocks still to do */
 static char *pcd_buf;		/* buffer for request in progress */
+static void *par_drv;		/* reference of parport driver */
 
 /* kernel glue structures */
 
@@ -690,6 +691,12 @@ static int pcd_detect(void)
 	printk("%s: %s version %s, major %d, nice %d\n",
 	       name, name, PCD_VERSION, major, nice);
 
+	par_drv = pi_register_driver(name);
+	if (!par_drv) {
+		pr_err("failed to register %s driver\n", name);
+		return -1;
+	}
+
 	k = 0;
 	if (pcd_drive_count == 0) { /* nothing spec'd - so autoprobe for 1 */
 		cd = pcd;
@@ -723,6 +730,7 @@ static int pcd_detect(void)
 	printk("%s: No CD-ROM drive found\n", name);
 	for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++)
 		put_disk(cd->disk);
+	pi_unregister_driver(par_drv);
 	return -1;
 }
 
@@ -984,6 +992,7 @@ static void __exit pcd_exit(void)
 	}
 	blk_cleanup_queue(pcd_queue);
 	unregister_blkdev(major, name);
+	pi_unregister_driver(par_drv);
 }
 
 MODULE_LICENSE("GPL");
diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c
index dbb4da1..b9242d7 100644
--- a/drivers/block/paride/pd.c
+++ b/drivers/block/paride/pd.c
@@ -247,6 +247,8 @@ static char *pd_errs[17] = { "ERR", "INDEX", "ECC", "DRQ", "SEEK", "WRERR",
 	"IDNF", "MC", "UNC", "???", "TMO"
 };
 
+static void *par_drv;		/* reference of parport driver */
+
 static inline int status_reg(struct pd_unit *disk)
 {
 	return pi_read_regr(disk->pi, 1, 6);
@@ -872,6 +874,12 @@ static int pd_detect(void)
 			pd_drive_count++;
 	}
 
+	par_drv = pi_register_driver(name);
+	if (!par_drv) {
+		pr_err("failed to register %s driver\n", name);
+		return -1;
+	}
+
 	if (pd_drive_count == 0) { /* nothing spec'd - so autoprobe for 1 */
 		disk = pd;
 		if (pi_init(disk->pi, 1, -1, -1, -1, -1, -1, pd_scratch,
@@ -902,8 +910,10 @@ static int pd_detect(void)
 			found = 1;
 		}
 	}
-	if (!found)
+	if (!found) {
 		printk("%s: no valid drive found\n", name);
+		pi_unregister_driver(par_drv);
+	}
 	return found;
 }
 
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c
index 9a15fd3..7a7d977 100644
--- a/drivers/block/paride/pf.c
+++ b/drivers/block/paride/pf.c
@@ -264,6 +264,7 @@ static int pf_cmd;		/* current command READ/WRITE */
 static struct pf_unit *pf_current;/* unit of current request */
 static int pf_mask;		/* stopper for pseudo-int */
 static char *pf_buf;		/* buffer for request in progress */
+static void *par_drv;		/* reference of parport driver */
 
 /* kernel glue structures */
 
@@ -703,6 +704,11 @@ static int pf_detect(void)
 	printk("%s: %s version %s, major %d, cluster %d, nice %d\n",
 	       name, name, PF_VERSION, major, cluster, nice);
 
+	par_drv = pi_register_driver(name);
+	if (!par_drv) {
+		pr_err("failed to register %s driver\n", name);
+		return -1;
+	}
 	k = 0;
 	if (pf_drive_count == 0) {
 		if (pi_init(pf->pi, 1, -1, -1, -1, -1, -1, pf_scratch, PI_PF,
@@ -735,6 +741,7 @@ static int pf_detect(void)
 	printk("%s: No ATAPI disk detected\n", name);
 	for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++)
 		put_disk(pf->disk);
+	pi_unregister_driver(par_drv);
 	return -1;
 }
 
diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c
index 876d0c3..bfbd4c8 100644
--- a/drivers/block/paride/pg.c
+++ b/drivers/block/paride/pg.c
@@ -227,6 +227,7 @@ static int pg_identify(struct pg *dev, int log);
 static char pg_scratch[512];	/* scratch block buffer */
 
 static struct class *pg_class;
+static void *par_drv;		/* reference of parport driver */
 
 /* kernel glue structures */
 
@@ -481,6 +482,12 @@ static int pg_detect(void)
 
 	printk("%s: %s version %s, major %d\n", name, name, PG_VERSION, major);
 
+	par_drv = pi_register_driver(name);
+	if (!par_drv) {
+		pr_err("failed to register %s driver\n", name);
+		return -1;
+	}
+
 	k = 0;
 	if (pg_drive_count == 0) {
 		if (pi_init(dev->pi, 1, -1, -1, -1, -1, -1, pg_scratch,
@@ -511,6 +518,7 @@ static int pg_detect(void)
 	if (k)
 		return 0;
 
+	pi_unregister_driver(par_drv);
 	printk("%s: No ATAPI device detected\n", name);
 	return -1;
 }
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c
index 2596042..1740d75 100644
--- a/drivers/block/paride/pt.c
+++ b/drivers/block/paride/pt.c
@@ -232,6 +232,7 @@ static int pt_identify(struct pt_unit *tape);
 static struct pt_unit pt[PT_UNITS];
 
 static char pt_scratch[512];	/* scratch block buffer */
+static void *par_drv;		/* reference of parport driver */
 
 /* kernel glue structures */
 
@@ -605,6 +606,12 @@ static int pt_detect(void)
 
 	printk("%s: %s version %s, major %d\n", name, name, PT_VERSION, major);
 
+	par_drv = pi_register_driver(name);
+	if (!par_drv) {
+		pr_err("failed to register %s driver\n", name);
+		return -1;
+	}
+
 	specified = 0;
 	for (unit = 0; unit < PT_UNITS; unit++) {
 		struct pt_unit *tape = &pt[unit];
@@ -644,6 +651,7 @@ static int pt_detect(void)
 	if (found)
 		return 0;
 
+	pi_unregister_driver(par_drv);
 	printk("%s: No ATAPI tape drive detected\n", name);
 	return -1;
 }
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 6/6] MAINTAINERS: maintain parport
  2015-05-20 15:26 ` Sudip Mukherjee
                   ` (5 preceding siblings ...)
  (?)
@ 2015-05-20 15:27 ` Sudip Mukherjee
  2015-05-20 15:46     ` Richard Weinberger
  -1 siblings, 1 reply; 48+ messages in thread
From: Sudip Mukherjee @ 2015-05-20 15:27 UTC (permalink / raw)
  To: Tim Waugh, Jean Delvare, Wolfram Sang, Willy Tarreau,
	Greg Kroah-Hartman, Alan Cox
  Cc: linux-kernel, linux-i2c, devel, Sudip Mukherjee

Lets give the parport subsystem a proper name and start
maintaining the files.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 MAINTAINERS | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 86d9398..0eb5ce2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7476,13 +7476,16 @@ S:	Maintained
 F:	Documentation/mn10300/
 F:	arch/mn10300/
 
-PARALLEL PORT SUPPORT
+PARALLEL PORT SUBSYSTEM
+M:	Sudip Mukherjee <sudipm.mukherjee@gmail.com>
+M:	Sudip Mukherjee <sudip@vectorindia.org>
 L:	linux-parport@lists.infradead.org (subscribers-only)
-S:	Orphan
+S:	Maintained
 F:	drivers/parport/
 F:	include/linux/parport*.h
 F:	drivers/char/ppdev.c
 F:	include/uapi/linux/ppdev.h
+F:	Documentation/parport*.txt
 
 PARAVIRT_OPS INTERFACE
 M:	Jeremy Fitzhardinge <jeremy@goop.org>
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* Re: [PATCH 3/6] i2c-parport: define ports to connect
  2015-05-20 15:26   ` Sudip Mukherjee
@ 2015-05-20 15:46     ` Wolfram Sang
  -1 siblings, 0 replies; 48+ messages in thread
From: Wolfram Sang @ 2015-05-20 15:46 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: Tim Waugh, Jean Delvare, Willy Tarreau, Greg Kroah-Hartman,
	Alan Cox, linux-kernel, linux-i2c, devel

[-- Attachment #1: Type: text/plain, Size: 463 bytes --]

On Wed, May 20, 2015 at 08:56:59PM +0530, Sudip Mukherjee wrote:
> As of now i2c-parport was connecting to all the available parallel
> ports. Lets limit that to maximum of 4 instances and at the same time
> define which instance connects to which parallel port.
> 
> Tested-by: Jean Delvare <jdelvare@suse.de>
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>

I assume this goes in as one series:

Acked-by: Wolfram Sang <wsa@the-dreams.de>


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 3/6] i2c-parport: define ports to connect
@ 2015-05-20 15:46     ` Wolfram Sang
  0 siblings, 0 replies; 48+ messages in thread
From: Wolfram Sang @ 2015-05-20 15:46 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: devel, Alan Cox, Greg Kroah-Hartman, linux-kernel, Tim Waugh,
	Willy Tarreau, Jean Delvare, linux-i2c


[-- Attachment #1.1: Type: text/plain, Size: 463 bytes --]

On Wed, May 20, 2015 at 08:56:59PM +0530, Sudip Mukherjee wrote:
> As of now i2c-parport was connecting to all the available parallel
> ports. Lets limit that to maximum of 4 instances and at the same time
> define which instance connects to which parallel port.
> 
> Tested-by: Jean Delvare <jdelvare@suse.de>
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>

I assume this goes in as one series:

Acked-by: Wolfram Sang <wsa@the-dreams.de>


[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 169 bytes --]

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 6/6] MAINTAINERS: maintain parport
  2015-05-20 15:27 ` [PATCH 6/6] MAINTAINERS: maintain parport Sudip Mukherjee
@ 2015-05-20 15:46     ` Richard Weinberger
  0 siblings, 0 replies; 48+ messages in thread
From: Richard Weinberger @ 2015-05-20 15:46 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: Tim Waugh, Jean Delvare, Wolfram Sang, Willy Tarreau,
	Greg Kroah-Hartman, Alan Cox, LKML, linux-i2c, devel

On Wed, May 20, 2015 at 5:27 PM, Sudip Mukherjee
<sudipm.mukherjee@gmail.com> wrote:
> Lets give the parport subsystem a proper name and start
> maintaining the files.

Excuse me, but usually someone takes over the maintainer role after
proving that he
cares for a sub system for a certain period of time.
Or did I miss something?

-- 
Thanks,
//richard

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 6/6] MAINTAINERS: maintain parport
@ 2015-05-20 15:46     ` Richard Weinberger
  0 siblings, 0 replies; 48+ messages in thread
From: Richard Weinberger @ 2015-05-20 15:46 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: devel, Alan Cox, Wolfram Sang, Greg Kroah-Hartman, LKML,
	Tim Waugh, Willy Tarreau, Jean Delvare, linux-i2c

On Wed, May 20, 2015 at 5:27 PM, Sudip Mukherjee
<sudipm.mukherjee@gmail.com> wrote:
> Lets give the parport subsystem a proper name and start
> maintaining the files.

Excuse me, but usually someone takes over the maintainer role after
proving that he
cares for a sub system for a certain period of time.
Or did I miss something?

-- 
Thanks,
//richard

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 4/6] i2c-parport: use new parport device model
  2015-05-20 15:27 ` [PATCH 4/6] i2c-parport: use new parport device model Sudip Mukherjee
@ 2015-05-20 15:49   ` Wolfram Sang
  2015-05-20 17:14       ` Sudip Mukherjee
  2015-05-21  6:16     ` Sudip Mukherjee
  1 sibling, 1 reply; 48+ messages in thread
From: Wolfram Sang @ 2015-05-20 15:49 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: Tim Waugh, Jean Delvare, Willy Tarreau, Greg Kroah-Hartman,
	Alan Cox, linux-kernel, linux-i2c, devel

[-- Attachment #1: Type: text/plain, Size: 739 bytes --]

On Wed, May 20, 2015 at 08:57:00PM +0530, Sudip Mukherjee wrote:
> Modify i2c-parport driver to use the new parallel port device model.
> 
> Tested-by: Jean Delvare <jdelvare@suse.de>
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---

In general:

Acked-by: Wolfram Sang <wsa@the-dreams.de>

>  static struct parport_driver i2c_parport_driver = {
> -	.name	= "i2c-parport",
> -	.attach	= i2c_parport_attach,
> -	.detach	= i2c_parport_detach,
> +	.name		= "i2c-parport",
> +	.match_port	= i2c_parport_attach,
> +	.detach		= i2c_parport_detach,
> +	.devmodel	= true,

Minor nit: I prefer to not use tabs but a single space after the struct
member names. Less hazzle in the future and still readable IMO.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 6/6] MAINTAINERS: maintain parport
  2015-05-20 15:46     ` Richard Weinberger
@ 2015-05-20 16:28       ` Joe Perches
  -1 siblings, 0 replies; 48+ messages in thread
From: Joe Perches @ 2015-05-20 16:28 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Sudip Mukherjee, Tim Waugh, Jean Delvare, Wolfram Sang,
	Willy Tarreau, Greg Kroah-Hartman, Alan Cox, LKML, linux-i2c,
	devel

On Wed, 2015-05-20 at 17:46 +0200, Richard Weinberger wrote:
> On Wed, May 20, 2015 at 5:27 PM, Sudip Mukherjee
> <sudipm.mukherjee@gmail.com> wrote:
> > Lets give the parport subsystem a proper name and start
> > maintaining the files.
> 
> Excuse me, but usually someone takes over the maintainer role after
> proving that he
> cares for a sub system for a certain period of time.
> Or did I miss something?

MAINTAINERS:85:    Orphan:      No current maintainer [but maybe you could take the
MAINTAINERS-86-                 role as you write your new code].

Parport is an orphan, hasn't had a maintainer since at
least 2.6.12, and has almost no activity minus drive-by
cleanups and new device ID support every once in awhile.

Sudip is writing new code.

If Sudip wants to be a maintainer of parport, assuming
he has the time and resources to give it a go, I think
he should be welcomed to it.

Thanks Sudip.  Best of luck...


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 6/6] MAINTAINERS: maintain parport
@ 2015-05-20 16:28       ` Joe Perches
  0 siblings, 0 replies; 48+ messages in thread
From: Joe Perches @ 2015-05-20 16:28 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: devel, Alan Cox, Wolfram Sang, Greg Kroah-Hartman, LKML,
	Tim Waugh, Willy Tarreau, Sudip Mukherjee, Jean Delvare,
	linux-i2c

On Wed, 2015-05-20 at 17:46 +0200, Richard Weinberger wrote:
> On Wed, May 20, 2015 at 5:27 PM, Sudip Mukherjee
> <sudipm.mukherjee@gmail.com> wrote:
> > Lets give the parport subsystem a proper name and start
> > maintaining the files.
> 
> Excuse me, but usually someone takes over the maintainer role after
> proving that he
> cares for a sub system for a certain period of time.
> Or did I miss something?

MAINTAINERS:85:    Orphan:      No current maintainer [but maybe you could take the
MAINTAINERS-86-                 role as you write your new code].

Parport is an orphan, hasn't had a maintainer since at
least 2.6.12, and has almost no activity minus drive-by
cleanups and new device ID support every once in awhile.

Sudip is writing new code.

If Sudip wants to be a maintainer of parport, assuming
he has the time and resources to give it a go, I think
he should be welcomed to it.

Thanks Sudip.  Best of luck...

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 6/6] MAINTAINERS: maintain parport
  2015-05-20 15:46     ` Richard Weinberger
@ 2015-05-20 16:33       ` One Thousand Gnomes
  -1 siblings, 0 replies; 48+ messages in thread
From: One Thousand Gnomes @ 2015-05-20 16:33 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Sudip Mukherjee, Tim Waugh, Jean Delvare, Wolfram Sang,
	Willy Tarreau, Greg Kroah-Hartman, LKML, linux-i2c, devel

On Wed, 20 May 2015 17:46:44 +0200
Richard Weinberger <richard.weinberger@gmail.com> wrote:

> On Wed, May 20, 2015 at 5:27 PM, Sudip Mukherjee
> <sudipm.mukherjee@gmail.com> wrote:
> > Lets give the parport subsystem a proper name and start
> > maintaining the files.
> 
> Excuse me, but usually someone takes over the maintainer role after
> proving that he
> cares for a sub system for a certain period of time.
> Or did I miss something?

It currently (and for some time) has had no maintainer so having a
maintainer is IMHO definitely an improvement in things.

Alan

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 6/6] MAINTAINERS: maintain parport
@ 2015-05-20 16:33       ` One Thousand Gnomes
  0 siblings, 0 replies; 48+ messages in thread
From: One Thousand Gnomes @ 2015-05-20 16:33 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: devel, Wolfram Sang, Greg Kroah-Hartman, LKML, Tim Waugh,
	Willy Tarreau, Sudip Mukherjee, Jean Delvare, linux-i2c

On Wed, 20 May 2015 17:46:44 +0200
Richard Weinberger <richard.weinberger@gmail.com> wrote:

> On Wed, May 20, 2015 at 5:27 PM, Sudip Mukherjee
> <sudipm.mukherjee@gmail.com> wrote:
> > Lets give the parport subsystem a proper name and start
> > maintaining the files.
> 
> Excuse me, but usually someone takes over the maintainer role after
> proving that he
> cares for a sub system for a certain period of time.
> Or did I miss something?

It currently (and for some time) has had no maintainer so having a
maintainer is IMHO definitely an improvement in things.

Alan

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 4/6] i2c-parport: use new parport device model
  2015-05-20 15:49   ` Wolfram Sang
@ 2015-05-20 17:14       ` Sudip Mukherjee
  0 siblings, 0 replies; 48+ messages in thread
From: Sudip Mukherjee @ 2015-05-20 17:14 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Tim Waugh, Jean Delvare, Willy Tarreau, Greg Kroah-Hartman,
	Alan Cox, linux-kernel, linux-i2c, devel

On Wed, May 20, 2015 at 05:49:07PM +0200, Wolfram Sang wrote:
> On Wed, May 20, 2015 at 08:57:00PM +0530, Sudip Mukherjee wrote:
> > Modify i2c-parport driver to use the new parallel port device model.
> > 
> > Tested-by: Jean Delvare <jdelvare@suse.de>
> > Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> > ---
> 
> In general:
> 
> Acked-by: Wolfram Sang <wsa@the-dreams.de>
> 
> >  static struct parport_driver i2c_parport_driver = {
> > -	.name	= "i2c-parport",
> > -	.attach	= i2c_parport_attach,
> > -	.detach	= i2c_parport_detach,
> > +	.name		= "i2c-parport",
> > +	.match_port	= i2c_parport_attach,
> > +	.detach		= i2c_parport_detach,
> > +	.devmodel	= true,
> 
> Minor nit: I prefer to not use tabs but a single space after the struct
> member names. Less hazzle in the future and still readable IMO.
It was having space originally. I changed that into tab as it was
looking good with them as aligned.
I will wait today for some more review and send v2 tomorrow with this
chanage.

regards
sudip
> 



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 4/6] i2c-parport: use new parport device model
@ 2015-05-20 17:14       ` Sudip Mukherjee
  0 siblings, 0 replies; 48+ messages in thread
From: Sudip Mukherjee @ 2015-05-20 17:14 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Tim Waugh, Jean Delvare, Willy Tarreau, Greg Kroah-Hartman,
	Alan Cox, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b

On Wed, May 20, 2015 at 05:49:07PM +0200, Wolfram Sang wrote:
> On Wed, May 20, 2015 at 08:57:00PM +0530, Sudip Mukherjee wrote:
> > Modify i2c-parport driver to use the new parallel port device model.
> > 
> > Tested-by: Jean Delvare <jdelvare-l3A5Bk7waGM@public.gmane.org>
> > Signed-off-by: Sudip Mukherjee <sudip-ofJRbWXBVFamYgehrs7/Lw@public.gmane.org>
> > ---
> 
> In general:
> 
> Acked-by: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
> 
> >  static struct parport_driver i2c_parport_driver = {
> > -	.name	= "i2c-parport",
> > -	.attach	= i2c_parport_attach,
> > -	.detach	= i2c_parport_detach,
> > +	.name		= "i2c-parport",
> > +	.match_port	= i2c_parport_attach,
> > +	.detach		= i2c_parport_detach,
> > +	.devmodel	= true,
> 
> Minor nit: I prefer to not use tabs but a single space after the struct
> member names. Less hazzle in the future and still readable IMO.
It was having space originally. I changed that into tab as it was
looking good with them as aligned.
I will wait today for some more review and send v2 tomorrow with this
chanage.

regards
sudip
> 

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 6/6] MAINTAINERS: maintain parport
  2015-05-20 16:28       ` Joe Perches
@ 2015-05-20 17:31         ` Sudip Mukherjee
  -1 siblings, 0 replies; 48+ messages in thread
From: Sudip Mukherjee @ 2015-05-20 17:31 UTC (permalink / raw)
  To: Joe Perches
  Cc: Richard Weinberger, Tim Waugh, Jean Delvare, Wolfram Sang,
	Willy Tarreau, Greg Kroah-Hartman, Alan Cox, LKML, linux-i2c,
	devel

On Wed, May 20, 2015 at 09:28:16AM -0700, Joe Perches wrote:
> On Wed, 2015-05-20 at 17:46 +0200, Richard Weinberger wrote:
> > On Wed, May 20, 2015 at 5:27 PM, Sudip Mukherjee
> > <sudipm.mukherjee@gmail.com> wrote:
> > > Lets give the parport subsystem a proper name and start
> > > maintaining the files.
> > 
> > Excuse me, but usually someone takes over the maintainer role after
> > proving that he
> > cares for a sub system for a certain period of time.
> > Or did I miss something?
> 
> MAINTAINERS:85:    Orphan:      No current maintainer [but maybe you could take the
> MAINTAINERS-86-                 role as you write your new code].
> 
> Parport is an orphan, hasn't had a maintainer since at
> least 2.6.12, and has almost no activity minus drive-by
> cleanups and new device ID support every once in awhile.
> 
> Sudip is writing new code.
> 
> If Sudip wants to be a maintainer of parport, assuming
> he has the time and resources to give it a go, I think
> he should be welcomed to it.
> 
> Thanks Sudip.  Best of luck...

Thanks Joe & Alan for the support. I consider myself inexperienced
to maintain a subsystem, but I hope you all will be there to review
and help me in the process.

regards
sudip

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 6/6] MAINTAINERS: maintain parport
@ 2015-05-20 17:31         ` Sudip Mukherjee
  0 siblings, 0 replies; 48+ messages in thread
From: Sudip Mukherjee @ 2015-05-20 17:31 UTC (permalink / raw)
  To: Joe Perches
  Cc: devel, Alan Cox, Wolfram Sang, Richard Weinberger,
	Greg Kroah-Hartman, LKML, Tim Waugh, Willy Tarreau, Jean Delvare,
	linux-i2c

On Wed, May 20, 2015 at 09:28:16AM -0700, Joe Perches wrote:
> On Wed, 2015-05-20 at 17:46 +0200, Richard Weinberger wrote:
> > On Wed, May 20, 2015 at 5:27 PM, Sudip Mukherjee
> > <sudipm.mukherjee@gmail.com> wrote:
> > > Lets give the parport subsystem a proper name and start
> > > maintaining the files.
> > 
> > Excuse me, but usually someone takes over the maintainer role after
> > proving that he
> > cares for a sub system for a certain period of time.
> > Or did I miss something?
> 
> MAINTAINERS:85:    Orphan:      No current maintainer [but maybe you could take the
> MAINTAINERS-86-                 role as you write your new code].
> 
> Parport is an orphan, hasn't had a maintainer since at
> least 2.6.12, and has almost no activity minus drive-by
> cleanups and new device ID support every once in awhile.
> 
> Sudip is writing new code.
> 
> If Sudip wants to be a maintainer of parport, assuming
> he has the time and resources to give it a go, I think
> he should be welcomed to it.
> 
> Thanks Sudip.  Best of luck...

Thanks Joe & Alan for the support. I consider myself inexperienced
to maintain a subsystem, but I hope you all will be there to review
and help me in the process.

regards
sudip

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 4/6] i2c-parport: use new parport device model
  2015-05-20 17:14       ` Sudip Mukherjee
@ 2015-05-20 17:35         ` Wolfram Sang
  -1 siblings, 0 replies; 48+ messages in thread
From: Wolfram Sang @ 2015-05-20 17:35 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: Tim Waugh, Jean Delvare, Willy Tarreau, Greg Kroah-Hartman,
	Alan Cox, linux-kernel, linux-i2c, devel

[-- Attachment #1: Type: text/plain, Size: 729 bytes --]


> > >  static struct parport_driver i2c_parport_driver = {
> > > -	.name	= "i2c-parport",
> > > -	.attach	= i2c_parport_attach,
> > > -	.detach	= i2c_parport_detach,
> > > +	.name		= "i2c-parport",
> > > +	.match_port	= i2c_parport_attach,
> > > +	.detach		= i2c_parport_detach,
> > > +	.devmodel	= true,
> > 
> > Minor nit: I prefer to not use tabs but a single space after the struct
> > member names. Less hazzle in the future and still readable IMO.
> It was having space originally. I changed that into tab as it was
> looking good with them as aligned.
> I will wait today for some more review and send v2 tomorrow with this
> chanage.

Thanks. Just to make sure: Keep it one space only, no alignment.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 4/6] i2c-parport: use new parport device model
@ 2015-05-20 17:35         ` Wolfram Sang
  0 siblings, 0 replies; 48+ messages in thread
From: Wolfram Sang @ 2015-05-20 17:35 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: Tim Waugh, Jean Delvare, Willy Tarreau, Greg Kroah-Hartman,
	Alan Cox, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b

[-- Attachment #1: Type: text/plain, Size: 729 bytes --]


> > >  static struct parport_driver i2c_parport_driver = {
> > > -	.name	= "i2c-parport",
> > > -	.attach	= i2c_parport_attach,
> > > -	.detach	= i2c_parport_detach,
> > > +	.name		= "i2c-parport",
> > > +	.match_port	= i2c_parport_attach,
> > > +	.detach		= i2c_parport_detach,
> > > +	.devmodel	= true,
> > 
> > Minor nit: I prefer to not use tabs but a single space after the struct
> > member names. Less hazzle in the future and still readable IMO.
> It was having space originally. I changed that into tab as it was
> looking good with them as aligned.
> I will wait today for some more review and send v2 tomorrow with this
> chanage.

Thanks. Just to make sure: Keep it one space only, no alignment.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 4/6] i2c-parport: use new parport device model
  2015-05-20 17:14       ` Sudip Mukherjee
@ 2015-05-20 17:59         ` Jean Delvare
  -1 siblings, 0 replies; 48+ messages in thread
From: Jean Delvare @ 2015-05-20 17:59 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: Wolfram Sang, Tim Waugh, Willy Tarreau, Greg Kroah-Hartman,
	Alan Cox, linux-kernel, linux-i2c, devel

On Wed, 20 May 2015 22:44:52 +0530, Sudip Mukherjee wrote:
> On Wed, May 20, 2015 at 05:49:07PM +0200, Wolfram Sang wrote:
> > On Wed, May 20, 2015 at 08:57:00PM +0530, Sudip Mukherjee wrote:
> > >  static struct parport_driver i2c_parport_driver = {
> > > -	.name	= "i2c-parport",
> > > -	.attach	= i2c_parport_attach,
> > > -	.detach	= i2c_parport_detach,
> > > +	.name		= "i2c-parport",
> > > +	.match_port	= i2c_parport_attach,
> > > +	.detach		= i2c_parport_detach,
> > > +	.devmodel	= true,
> > 
> > Minor nit: I prefer to not use tabs but a single space after the struct
> > member names. Less hazzle in the future and still readable IMO.
>
> It was having space originally. I changed that into tab as it was
> looking good with them as aligned.

As the driver maintainer, I am fine with both unaligned or tab-aligned.
Space-aligned as I did originally was not a good idea, I admit.

-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 4/6] i2c-parport: use new parport device model
@ 2015-05-20 17:59         ` Jean Delvare
  0 siblings, 0 replies; 48+ messages in thread
From: Jean Delvare @ 2015-05-20 17:59 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: Wolfram Sang, Tim Waugh, Willy Tarreau, Greg Kroah-Hartman,
	Alan Cox, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b

On Wed, 20 May 2015 22:44:52 +0530, Sudip Mukherjee wrote:
> On Wed, May 20, 2015 at 05:49:07PM +0200, Wolfram Sang wrote:
> > On Wed, May 20, 2015 at 08:57:00PM +0530, Sudip Mukherjee wrote:
> > >  static struct parport_driver i2c_parport_driver = {
> > > -	.name	= "i2c-parport",
> > > -	.attach	= i2c_parport_attach,
> > > -	.detach	= i2c_parport_detach,
> > > +	.name		= "i2c-parport",
> > > +	.match_port	= i2c_parport_attach,
> > > +	.detach		= i2c_parport_detach,
> > > +	.devmodel	= true,
> > 
> > Minor nit: I prefer to not use tabs but a single space after the struct
> > member names. Less hazzle in the future and still readable IMO.
>
> It was having space originally. I changed that into tab as it was
> looking good with them as aligned.

As the driver maintainer, I am fine with both unaligned or tab-aligned.
Space-aligned as I did originally was not a good idea, I admit.

-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 6/6] MAINTAINERS: maintain parport
  2015-05-20 16:33       ` One Thousand Gnomes
  (?)
@ 2015-05-20 20:36       ` Richard Weinberger
  2015-05-21  5:59           ` Sudip Mukherjee
  -1 siblings, 1 reply; 48+ messages in thread
From: Richard Weinberger @ 2015-05-20 20:36 UTC (permalink / raw)
  To: One Thousand Gnomes
  Cc: Sudip Mukherjee, Tim Waugh, Jean Delvare, Wolfram Sang,
	Willy Tarreau, Greg Kroah-Hartman, LKML, linux-i2c, devel

Am 20.05.2015 um 18:33 schrieb One Thousand Gnomes:
> On Wed, 20 May 2015 17:46:44 +0200
> Richard Weinberger <richard.weinberger@gmail.com> wrote:
> 
>> On Wed, May 20, 2015 at 5:27 PM, Sudip Mukherjee
>> <sudipm.mukherjee@gmail.com> wrote:
>>> Lets give the parport subsystem a proper name and start
>>> maintaining the files.
>>
>> Excuse me, but usually someone takes over the maintainer role after
>> proving that he
>> cares for a sub system for a certain period of time.
>> Or did I miss something?
> 
> It currently (and for some time) has had no maintainer so having a
> maintainer is IMHO definitely an improvement in things.

Having a maintainer is good.
All I wanted to point out was that it is IMHO uncommon to claim maintainership
before being the main contributor or the de facto maintainer of a
subsystem.

This "rule" prevents us from "Mommy!!! Look, I'm a maintainer!!!1" patches. ;-)

Thanks,
//richard

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [RFC PATCH] checkpatch: check for 2 or more spaces around assignment of a declaration
  2015-05-20 17:59         ` Jean Delvare
  (?)
@ 2015-05-21  1:02         ` Joe Perches
  2015-05-21  5:48             ` Willy Tarreau
  -1 siblings, 1 reply; 48+ messages in thread
From: Joe Perches @ 2015-05-21  1:02 UTC (permalink / raw)
  To: Jean Delvare, Andrew Morton
  Cc: Sudip Mukherjee, Wolfram Sang, Tim Waugh, Willy Tarreau,
	Greg Kroah-Hartman, Alan Cox, linux-kernel, linux-i2c, devel

On Wed, 2015-05-20 at 19:59 +0200, Jean Delvare wrote:
> On Wed, 20 May 2015 22:44:52 +0530, Sudip Mukherjee wrote:
> > On Wed, May 20, 2015 at 05:49:07PM +0200, Wolfram Sang wrote:
> > > On Wed, May 20, 2015 at 08:57:00PM +0530, Sudip Mukherjee wrote:
> > > >  static struct parport_driver i2c_parport_driver = {
> > > > -	.name	= "i2c-parport",
> > > > -	.attach	= i2c_parport_attach,
> > > > -	.detach	= i2c_parport_detach,
> > > > +	.name		= "i2c-parport",
> > > > +	.match_port	= i2c_parport_attach,
> > > > +	.detach		= i2c_parport_detach,
> > > > +	.devmodel	= true,
> > > 
> > > Minor nit: I prefer to not use tabs but a single space after the struct
> > > member names. Less hazzle in the future and still readable IMO.
> >
> > It was having space originally. I changed that into tab as it was
> > looking good with them as aligned.
> 
> As the driver maintainer, I am fine with both unaligned or tab-aligned.
> Space-aligned as I did originally was not a good idea, I admit.

Perhaps space aligned declarations should have some
checkpatch --strict warning for 2 or more spaces
around any assignment of the declaration.

	int a   = 1;		// 2+ spaces before =
	int b	=  2;		// 2+ spaces after =
	int c	=	3;	// uses tabs around =, no warning
	int d		= 4;	// uses 2 tabs before =, no warning
	
Something like:
---
 scripts/checkpatch.pl | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 89b1df4..8f9d26f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3902,6 +3902,13 @@ sub process {
 			    "multiple assignments should be avoided\n" . $herecurr);
 		}
 
+# check for space aligned declarations
+		if ($line =~ /^.\s*(?:$Declare|$DeclareMisordered)\s*$Ident {2,}=\s*(?:$Lval|$Constant|$String)/ ||
+		    $line =~ /^.\s*(?:$Declare|$DeclareMisordered)\s*$Ident\s*= {2,}(?:$Lval|$Constant|$String)/) {
+			CHK("SPACING",
+			    "Avoid multiple space assigments - prefer a single space or tabs\n" . $herecurr);
+		}
+
 ## # check for multiple declarations, allowing for a function declaration
 ## # continuation.
 ## 		if ($line =~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Ident.*/ &&




^ permalink raw reply related	[flat|nested] 48+ messages in thread

* Re: [RFC PATCH] checkpatch: check for 2 or more spaces around assignment of a declaration
  2015-05-21  1:02         ` [RFC PATCH] checkpatch: check for 2 or more spaces around assignment of a declaration Joe Perches
@ 2015-05-21  5:48             ` Willy Tarreau
  0 siblings, 0 replies; 48+ messages in thread
From: Willy Tarreau @ 2015-05-21  5:48 UTC (permalink / raw)
  To: Joe Perches
  Cc: Jean Delvare, Andrew Morton, Sudip Mukherjee, Wolfram Sang,
	Tim Waugh, Willy Tarreau, Greg Kroah-Hartman, Alan Cox,
	linux-kernel, linux-i2c, devel

On Wed, May 20, 2015 at 06:02:06PM -0700, Joe Perches wrote:
> Perhaps space aligned declarations should have some
> checkpatch --strict warning for 2 or more spaces
> around any assignment of the declaration.
> 
> 	int a   = 1;		// 2+ spaces before =
> 	int b	=  2;		// 2+ spaces after =
> 	int c	=	3;	// uses tabs around =, no warning
> 	int d		= 4;	// uses 2 tabs before =, no warning

FWIW, in my own code I've stopped using tabs for this and replaced
them with spaces. Tabs are fine *before* code but they completely
mangle the display for people using different tab sizes, or even
when reading diffs, because they heavily depend on the number of
characters *before* them while what you want is to ensure that
what is *after* is on a fixed position.

I would even go further and report warnings when tabs are used after
text.

Tabs after text were very useful in ASM editors in the past because
it was possible to define 3 fixed positions (mnemonic, operands,
comments) and that was the primary purpose of tabs. But in todays
editors, tabs do not mean "jump to next position" but "add between
1 and 8 to the current position" which doesn't make sense at all
if what preceeds can be larger than 8 (which is most often the case
in C code).

Willy


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [RFC PATCH] checkpatch: check for 2 or more spaces around assignment of a declaration
@ 2015-05-21  5:48             ` Willy Tarreau
  0 siblings, 0 replies; 48+ messages in thread
From: Willy Tarreau @ 2015-05-21  5:48 UTC (permalink / raw)
  To: Joe Perches
  Cc: devel, Alan Cox, Wolfram Sang, Greg Kroah-Hartman, linux-kernel,
	Jean Delvare, Willy Tarreau, Andrew Morton, Sudip Mukherjee,
	Tim Waugh, linux-i2c

On Wed, May 20, 2015 at 06:02:06PM -0700, Joe Perches wrote:
> Perhaps space aligned declarations should have some
> checkpatch --strict warning for 2 or more spaces
> around any assignment of the declaration.
> 
> 	int a   = 1;		// 2+ spaces before =
> 	int b	=  2;		// 2+ spaces after =
> 	int c	=	3;	// uses tabs around =, no warning
> 	int d		= 4;	// uses 2 tabs before =, no warning

FWIW, in my own code I've stopped using tabs for this and replaced
them with spaces. Tabs are fine *before* code but they completely
mangle the display for people using different tab sizes, or even
when reading diffs, because they heavily depend on the number of
characters *before* them while what you want is to ensure that
what is *after* is on a fixed position.

I would even go further and report warnings when tabs are used after
text.

Tabs after text were very useful in ASM editors in the past because
it was possible to define 3 fixed positions (mnemonic, operands,
comments) and that was the primary purpose of tabs. But in todays
editors, tabs do not mean "jump to next position" but "add between
1 and 8 to the current position" which doesn't make sense at all
if what preceeds can be larger than 8 (which is most often the case
in C code).

Willy

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 6/6] MAINTAINERS: maintain parport
  2015-05-20 15:46     ` Richard Weinberger
@ 2015-05-21  5:51       ` Willy Tarreau
  -1 siblings, 0 replies; 48+ messages in thread
From: Willy Tarreau @ 2015-05-21  5:51 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Sudip Mukherjee, Tim Waugh, Jean Delvare, Wolfram Sang,
	Willy Tarreau, Greg Kroah-Hartman, Alan Cox, LKML, linux-i2c,
	devel

On Wed, May 20, 2015 at 05:46:44PM +0200, Richard Weinberger wrote:
> On Wed, May 20, 2015 at 5:27 PM, Sudip Mukherjee
> <sudipm.mukherjee@gmail.com> wrote:
> > Lets give the parport subsystem a proper name and start
> > maintaining the files.
> 
> Excuse me, but usually someone takes over the maintainer role after
> proving that he
> cares for a sub system for a certain period of time.
> Or did I miss something?

Sudip has been volunteering for fixing this code which is marked
as "orphan". So whatever his experience and care in this area,
it will be better for the driver to have a maintainer than none.

Good luck Sudip, as drivers which have become orphans are probably
the ones that deserve the least love :-)

Willy


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 6/6] MAINTAINERS: maintain parport
@ 2015-05-21  5:51       ` Willy Tarreau
  0 siblings, 0 replies; 48+ messages in thread
From: Willy Tarreau @ 2015-05-21  5:51 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: devel, Alan Cox, Wolfram Sang, Greg Kroah-Hartman, LKML,
	Tim Waugh, Willy Tarreau, Sudip Mukherjee, Jean Delvare,
	linux-i2c

On Wed, May 20, 2015 at 05:46:44PM +0200, Richard Weinberger wrote:
> On Wed, May 20, 2015 at 5:27 PM, Sudip Mukherjee
> <sudipm.mukherjee@gmail.com> wrote:
> > Lets give the parport subsystem a proper name and start
> > maintaining the files.
> 
> Excuse me, but usually someone takes over the maintainer role after
> proving that he
> cares for a sub system for a certain period of time.
> Or did I miss something?

Sudip has been volunteering for fixing this code which is marked
as "orphan". So whatever his experience and care in this area,
it will be better for the driver to have a maintainer than none.

Good luck Sudip, as drivers which have become orphans are probably
the ones that deserve the least love :-)

Willy

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 6/6] MAINTAINERS: maintain parport
@ 2015-05-21  5:59           ` Sudip Mukherjee
  0 siblings, 0 replies; 48+ messages in thread
From: Sudip Mukherjee @ 2015-05-21  5:59 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: One Thousand Gnomes, Tim Waugh, Jean Delvare, Wolfram Sang,
	Willy Tarreau, Greg Kroah-Hartman, LKML, linux-i2c, devel,
	dan.carpenter

On Wed, May 20, 2015 at 10:36:04PM +0200, Richard Weinberger wrote:
> Am 20.05.2015 um 18:33 schrieb One Thousand Gnomes:
> > On Wed, 20 May 2015 17:46:44 +0200
> > Richard Weinberger <richard.weinberger@gmail.com> wrote:
> > 
> >> On Wed, May 20, 2015 at 5:27 PM, Sudip Mukherjee
> >> <sudipm.mukherjee@gmail.com> wrote:
> >>> Lets give the parport subsystem a proper name and start
> >>> maintaining the files.
> >>
> >> Excuse me, but usually someone takes over the maintainer role after
> >> proving that he
> >> cares for a sub system for a certain period of time.
> >> Or did I miss something?
> > 
> > It currently (and for some time) has had no maintainer so having a
> > maintainer is IMHO definitely an improvement in things.
> 
> Having a maintainer is good.
> All I wanted to point out was that it is IMHO uncommon to claim maintainership
> before being the main contributor or the de facto maintainer of a
> subsystem.
> 
> This "rule" prevents us from "Mommy!!! Look, I'm a maintainer!!!1" patches. ;-)

I already have my name in the MAINTAINERS file, so that is not a cookie
to cry for.
Personnaly I will prefer Joe Perches or Dan Carpenter to be the maintainer.
They have reviewed many of my patches since I started contributing here and
I have learnt and still learning many things from them.
if this patch is a debatable topic, then lets drop it. I have written these
changes, and will write the next changes also, it doesnot matter if my name
is there in the MAINTAINERS or not.
The main reason I gave this patch is just because if any problem
(read as regression) arises due to these changes then those problem mails
would have directly come to my inbox.

regards
sudip

> 
> Thanks,
> //richard

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 6/6] MAINTAINERS: maintain parport
@ 2015-05-21  5:59           ` Sudip Mukherjee
  0 siblings, 0 replies; 48+ messages in thread
From: Sudip Mukherjee @ 2015-05-21  5:59 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: One Thousand Gnomes, Tim Waugh, Jean Delvare, Wolfram Sang,
	Willy Tarreau, Greg Kroah-Hartman, LKML,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b,
	dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA

On Wed, May 20, 2015 at 10:36:04PM +0200, Richard Weinberger wrote:
> Am 20.05.2015 um 18:33 schrieb One Thousand Gnomes:
> > On Wed, 20 May 2015 17:46:44 +0200
> > Richard Weinberger <richard.weinberger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > 
> >> On Wed, May 20, 2015 at 5:27 PM, Sudip Mukherjee
> >> <sudipm.mukherjee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> >>> Lets give the parport subsystem a proper name and start
> >>> maintaining the files.
> >>
> >> Excuse me, but usually someone takes over the maintainer role after
> >> proving that he
> >> cares for a sub system for a certain period of time.
> >> Or did I miss something?
> > 
> > It currently (and for some time) has had no maintainer so having a
> > maintainer is IMHO definitely an improvement in things.
> 
> Having a maintainer is good.
> All I wanted to point out was that it is IMHO uncommon to claim maintainership
> before being the main contributor or the de facto maintainer of a
> subsystem.
> 
> This "rule" prevents us from "Mommy!!! Look, I'm a maintainer!!!1" patches. ;-)

I already have my name in the MAINTAINERS file, so that is not a cookie
to cry for.
Personnaly I will prefer Joe Perches or Dan Carpenter to be the maintainer.
They have reviewed many of my patches since I started contributing here and
I have learnt and still learning many things from them.
if this patch is a debatable topic, then lets drop it. I have written these
changes, and will write the next changes also, it doesnot matter if my name
is there in the MAINTAINERS or not.
The main reason I gave this patch is just because if any problem
(read as regression) arises due to these changes then those problem mails
would have directly come to my inbox.

regards
sudip

> 
> Thanks,
> //richard

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 6/6] MAINTAINERS: maintain parport
  2015-05-21  5:51       ` Willy Tarreau
@ 2015-05-21  6:09         ` Greg Kroah-Hartman
  -1 siblings, 0 replies; 48+ messages in thread
From: Greg Kroah-Hartman @ 2015-05-21  6:09 UTC (permalink / raw)
  To: Willy Tarreau
  Cc: Richard Weinberger, devel, Alan Cox, Wolfram Sang, LKML,
	Tim Waugh, Willy Tarreau, Sudip Mukherjee, Jean Delvare,
	linux-i2c

On Thu, May 21, 2015 at 07:51:18AM +0200, Willy Tarreau wrote:
> On Wed, May 20, 2015 at 05:46:44PM +0200, Richard Weinberger wrote:
> > On Wed, May 20, 2015 at 5:27 PM, Sudip Mukherjee
> > <sudipm.mukherjee@gmail.com> wrote:
> > > Lets give the parport subsystem a proper name and start
> > > maintaining the files.
> > 
> > Excuse me, but usually someone takes over the maintainer role after
> > proving that he
> > cares for a sub system for a certain period of time.
> > Or did I miss something?
> 
> Sudip has been volunteering for fixing this code which is marked
> as "orphan". So whatever his experience and care in this area,
> it will be better for the driver to have a maintainer than none.
> 
> Good luck Sudip, as drivers which have become orphans are probably
> the ones that deserve the least love :-)

I agree.  I've been "baby-sitting" this subsystem for a long time now.
If Sudip wants to take it on, and based on his recent patches it looks
like he does, I'm all for him to be the maintainer of it.  So this patch
in the series is fine with me, I'll apply it when the rest of this
series gets merged.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 6/6] MAINTAINERS: maintain parport
@ 2015-05-21  6:09         ` Greg Kroah-Hartman
  0 siblings, 0 replies; 48+ messages in thread
From: Greg Kroah-Hartman @ 2015-05-21  6:09 UTC (permalink / raw)
  To: Willy Tarreau
  Cc: devel, Alan Cox, Wolfram Sang, Richard Weinberger, LKML,
	Jean Delvare, Willy Tarreau, Sudip Mukherjee, Tim Waugh,
	linux-i2c

On Thu, May 21, 2015 at 07:51:18AM +0200, Willy Tarreau wrote:
> On Wed, May 20, 2015 at 05:46:44PM +0200, Richard Weinberger wrote:
> > On Wed, May 20, 2015 at 5:27 PM, Sudip Mukherjee
> > <sudipm.mukherjee@gmail.com> wrote:
> > > Lets give the parport subsystem a proper name and start
> > > maintaining the files.
> > 
> > Excuse me, but usually someone takes over the maintainer role after
> > proving that he
> > cares for a sub system for a certain period of time.
> > Or did I miss something?
> 
> Sudip has been volunteering for fixing this code which is marked
> as "orphan". So whatever his experience and care in this area,
> it will be better for the driver to have a maintainer than none.
> 
> Good luck Sudip, as drivers which have become orphans are probably
> the ones that deserve the least love :-)

I agree.  I've been "baby-sitting" this subsystem for a long time now.
If Sudip wants to take it on, and based on his recent patches it looks
like he does, I'm all for him to be the maintainer of it.  So this patch
in the series is fine with me, I'll apply it when the rest of this
series gets merged.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH v2 4/6] i2c-parport: use new parport device model
  2015-05-20 15:27 ` [PATCH 4/6] i2c-parport: use new parport device model Sudip Mukherjee
@ 2015-05-21  6:16     ` Sudip Mukherjee
  2015-05-21  6:16     ` Sudip Mukherjee
  1 sibling, 0 replies; 48+ messages in thread
From: Sudip Mukherjee @ 2015-05-21  6:16 UTC (permalink / raw)
  To: Tim Waugh, Jean Delvare, Wolfram Sang, Willy Tarreau,
	Greg Kroah-Hartman, Alan Cox
  Cc: linux-kernel, linux-i2c, devel, Sudip Mukherjee

Modify i2c-parport driver to use the new parallel port device model.

Tested-by: Jean Delvare <jdelvare@suse.de>
Acked-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---

v2: Changed to one space instead of tab in i2c_parport_driver.

i2c_parport_cb is made local, devmodel added to driver structure,
and probe removed.	       

 drivers/i2c/busses/i2c-parport.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c
index 155da95..138347e 100644
--- a/drivers/i2c/busses/i2c-parport.c
+++ b/drivers/i2c/busses/i2c-parport.c
@@ -185,11 +185,15 @@ static void i2c_parport_attach(struct parport *port)
 		printk(KERN_ERR "i2c-parport: Failed to kzalloc\n");
 		return;
 	}
+	memset(&i2c_parport_cb, 0, sizeof(i2c_parport_cb));
+	i2c_parport_cb.flags = PARPORT_FLAG_EXCL;
+	i2c_parport_cb.irq_func = i2c_parport_irq;
+	i2c_parport_cb.private = adapter;
 
 	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_model(port, "i2c-parport",
+						   &i2c_parport_cb, i);
 	if (!adapter->pdev) {
 		printk(KERN_ERR "i2c-parport: Unable to register with parport\n");
 		goto err_free;
@@ -283,9 +287,10 @@ static void i2c_parport_detach(struct parport *port)
 }
 
 static struct parport_driver i2c_parport_driver = {
-	.name	= "i2c-parport",
-	.attach	= i2c_parport_attach,
-	.detach	= i2c_parport_detach,
+	.name = "i2c-parport",
+	.match_port = i2c_parport_attach,
+	.detach = i2c_parport_detach,
+	.devmodel = true,
 };
 
 /* ----- Module loading, unloading and information ------------------------ */
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH v2 4/6] i2c-parport: use new parport device model
@ 2015-05-21  6:16     ` Sudip Mukherjee
  0 siblings, 0 replies; 48+ messages in thread
From: Sudip Mukherjee @ 2015-05-21  6:16 UTC (permalink / raw)
  To: Tim Waugh, Jean Delvare, Wolfram Sang, Willy Tarreau,
	Greg Kroah-Hartman, Alan Cox
  Cc: devel, Sudip Mukherjee, linux-kernel, linux-i2c

Modify i2c-parport driver to use the new parallel port device model.

Tested-by: Jean Delvare <jdelvare@suse.de>
Acked-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---

v2: Changed to one space instead of tab in i2c_parport_driver.

i2c_parport_cb is made local, devmodel added to driver structure,
and probe removed.	       

 drivers/i2c/busses/i2c-parport.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c
index 155da95..138347e 100644
--- a/drivers/i2c/busses/i2c-parport.c
+++ b/drivers/i2c/busses/i2c-parport.c
@@ -185,11 +185,15 @@ static void i2c_parport_attach(struct parport *port)
 		printk(KERN_ERR "i2c-parport: Failed to kzalloc\n");
 		return;
 	}
+	memset(&i2c_parport_cb, 0, sizeof(i2c_parport_cb));
+	i2c_parport_cb.flags = PARPORT_FLAG_EXCL;
+	i2c_parport_cb.irq_func = i2c_parport_irq;
+	i2c_parport_cb.private = adapter;
 
 	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_model(port, "i2c-parport",
+						   &i2c_parport_cb, i);
 	if (!adapter->pdev) {
 		printk(KERN_ERR "i2c-parport: Unable to register with parport\n");
 		goto err_free;
@@ -283,9 +287,10 @@ static void i2c_parport_detach(struct parport *port)
 }
 
 static struct parport_driver i2c_parport_driver = {
-	.name	= "i2c-parport",
-	.attach	= i2c_parport_attach,
-	.detach	= i2c_parport_detach,
+	.name = "i2c-parport",
+	.match_port = i2c_parport_attach,
+	.detach = i2c_parport_detach,
+	.devmodel = true,
 };
 
 /* ----- Module loading, unloading and information ------------------------ */
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* Re: [PATCH 0/6] use devicemodel with parport
  2015-05-20 15:26 ` Sudip Mukherjee
@ 2015-05-31 22:05   ` Greg Kroah-Hartman
  -1 siblings, 0 replies; 48+ messages in thread
From: Greg Kroah-Hartman @ 2015-05-31 22:05 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: Tim Waugh, Jean Delvare, Wolfram Sang, Willy Tarreau, Alan Cox,
	devel, linux-kernel, linux-i2c

On Wed, May 20, 2015 at 08:56:56PM +0530, Sudip Mukherjee wrote:
> After 5 versions of WIP, finally a patch submission.
> parport subsystem is now in the transition stage and supports the old
> model and the new device model. 3 of the drivers have been converted
> into new model and tested.
> After other drivers are converted we can remove the old code from
> parport.

This looks good, very nice job.

Are you going to continue to fix up the other drivers?  I don't want us
to have a half-converted subsystem in the kernel.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 0/6] use devicemodel with parport
@ 2015-05-31 22:05   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 48+ messages in thread
From: Greg Kroah-Hartman @ 2015-05-31 22:05 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: devel, Alan Cox, Wolfram Sang, linux-kernel, Tim Waugh,
	Willy Tarreau, Jean Delvare, linux-i2c

On Wed, May 20, 2015 at 08:56:56PM +0530, Sudip Mukherjee wrote:
> After 5 versions of WIP, finally a patch submission.
> parport subsystem is now in the transition stage and supports the old
> model and the new device model. 3 of the drivers have been converted
> into new model and tested.
> After other drivers are converted we can remove the old code from
> parport.

This looks good, very nice job.

Are you going to continue to fix up the other drivers?  I don't want us
to have a half-converted subsystem in the kernel.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 0/6] use devicemodel with parport
@ 2015-06-01  5:46     ` Sudip Mukherjee
  0 siblings, 0 replies; 48+ messages in thread
From: Sudip Mukherjee @ 2015-06-01  5:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Tim Waugh, Jean Delvare, Wolfram Sang, Willy Tarreau, Alan Cox,
	devel, linux-kernel, linux-i2c

On Mon, Jun 01, 2015 at 07:05:30AM +0900, Greg Kroah-Hartman wrote:
> On Wed, May 20, 2015 at 08:56:56PM +0530, Sudip Mukherjee wrote:
> > After 5 versions of WIP, finally a patch submission.
> > parport subsystem is now in the transition stage and supports the old
> > model and the new device model. 3 of the drivers have been converted
> > into new model and tested.
> > After other drivers are converted we can remove the old code from
> > parport.
> 
> This looks good, very nice job.
Thanks, but its not me alone. Dan, Jean, Alan has helped me a lot in this.
> 
> Are you going to continue to fix up the other drivers?  I don't want us
> to have a half-converted subsystem in the kernel.
ofcourse yes. I also donot want to be a maintainer of half converted
subsystem. :)
i am thinking, after it is in the linux-next for a few days and seeing
any effects of these changes I will start with the other drivers.
and after all drivers are converted and that is also in next for sufficient
days I will start with the cleanup of the old codes.
And then there are some pending bugs in bugzilla. I am also planning to
add the code for epst in paride (i saw in many forums that people are
not able to use their scanner on latest kernels).

regards
sudip

> 
> thanks,
> 
> greg k-h

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 0/6] use devicemodel with parport
@ 2015-06-01  5:46     ` Sudip Mukherjee
  0 siblings, 0 replies; 48+ messages in thread
From: Sudip Mukherjee @ 2015-06-01  5:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Tim Waugh, Jean Delvare, Wolfram Sang, Willy Tarreau, Alan Cox,
	devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

On Mon, Jun 01, 2015 at 07:05:30AM +0900, Greg Kroah-Hartman wrote:
> On Wed, May 20, 2015 at 08:56:56PM +0530, Sudip Mukherjee wrote:
> > After 5 versions of WIP, finally a patch submission.
> > parport subsystem is now in the transition stage and supports the old
> > model and the new device model. 3 of the drivers have been converted
> > into new model and tested.
> > After other drivers are converted we can remove the old code from
> > parport.
> 
> This looks good, very nice job.
Thanks, but its not me alone. Dan, Jean, Alan has helped me a lot in this.
> 
> Are you going to continue to fix up the other drivers?  I don't want us
> to have a half-converted subsystem in the kernel.
ofcourse yes. I also donot want to be a maintainer of half converted
subsystem. :)
i am thinking, after it is in the linux-next for a few days and seeing
any effects of these changes I will start with the other drivers.
and after all drivers are converted and that is also in next for sufficient
days I will start with the cleanup of the old codes.
And then there are some pending bugs in bugzilla. I am also planning to
add the code for epst in paride (i saw in many forums that people are
not able to use their scanner on latest kernels).

regards
sudip

> 
> thanks,
> 
> greg k-h

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 0/6] use devicemodel with parport
  2015-06-01  5:46     ` Sudip Mukherjee
@ 2015-06-01  6:18       ` Greg Kroah-Hartman
  -1 siblings, 0 replies; 48+ messages in thread
From: Greg Kroah-Hartman @ 2015-06-01  6:18 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: Tim Waugh, Jean Delvare, Wolfram Sang, Willy Tarreau, Alan Cox,
	devel, linux-kernel, linux-i2c

On Mon, Jun 01, 2015 at 11:16:51AM +0530, Sudip Mukherjee wrote:
> On Mon, Jun 01, 2015 at 07:05:30AM +0900, Greg Kroah-Hartman wrote:
> > On Wed, May 20, 2015 at 08:56:56PM +0530, Sudip Mukherjee wrote:
> > > After 5 versions of WIP, finally a patch submission.
> > > parport subsystem is now in the transition stage and supports the old
> > > model and the new device model. 3 of the drivers have been converted
> > > into new model and tested.
> > > After other drivers are converted we can remove the old code from
> > > parport.
> > 
> > This looks good, very nice job.
> Thanks, but its not me alone. Dan, Jean, Alan has helped me a lot in this.
> > 
> > Are you going to continue to fix up the other drivers?  I don't want us
> > to have a half-converted subsystem in the kernel.
> ofcourse yes. I also donot want to be a maintainer of half converted
> subsystem. :)
> i am thinking, after it is in the linux-next for a few days and seeing
> any effects of these changes I will start with the other drivers.
> and after all drivers are converted and that is also in next for sufficient
> days I will start with the cleanup of the old codes.

Sounds like a good plan.

> And then there are some pending bugs in bugzilla. I am also planning to
> add the code for epst in paride (i saw in many forums that people are
> not able to use their scanner on latest kernels).

"epst"?  What's that?


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 0/6] use devicemodel with parport
@ 2015-06-01  6:18       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 48+ messages in thread
From: Greg Kroah-Hartman @ 2015-06-01  6:18 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: Tim Waugh, Jean Delvare, Wolfram Sang, Willy Tarreau, Alan Cox,
	devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

On Mon, Jun 01, 2015 at 11:16:51AM +0530, Sudip Mukherjee wrote:
> On Mon, Jun 01, 2015 at 07:05:30AM +0900, Greg Kroah-Hartman wrote:
> > On Wed, May 20, 2015 at 08:56:56PM +0530, Sudip Mukherjee wrote:
> > > After 5 versions of WIP, finally a patch submission.
> > > parport subsystem is now in the transition stage and supports the old
> > > model and the new device model. 3 of the drivers have been converted
> > > into new model and tested.
> > > After other drivers are converted we can remove the old code from
> > > parport.
> > 
> > This looks good, very nice job.
> Thanks, but its not me alone. Dan, Jean, Alan has helped me a lot in this.
> > 
> > Are you going to continue to fix up the other drivers?  I don't want us
> > to have a half-converted subsystem in the kernel.
> ofcourse yes. I also donot want to be a maintainer of half converted
> subsystem. :)
> i am thinking, after it is in the linux-next for a few days and seeing
> any effects of these changes I will start with the other drivers.
> and after all drivers are converted and that is also in next for sufficient
> days I will start with the cleanup of the old codes.

Sounds like a good plan.

> And then there are some pending bugs in bugzilla. I am also planning to
> add the code for epst in paride (i saw in many forums that people are
> not able to use their scanner on latest kernels).

"epst"?  What's that?

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 0/6] use devicemodel with parport
@ 2015-06-01  8:34         ` Sudip Mukherjee
  0 siblings, 0 replies; 48+ messages in thread
From: Sudip Mukherjee @ 2015-06-01  8:34 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Tim Waugh, Jean Delvare, Wolfram Sang, Willy Tarreau, Alan Cox,
	devel, linux-kernel, linux-i2c

On Mon, Jun 01, 2015 at 03:18:11PM +0900, Greg Kroah-Hartman wrote:
> On Mon, Jun 01, 2015 at 11:16:51AM +0530, Sudip Mukherjee wrote:
> > On Mon, Jun 01, 2015 at 07:05:30AM +0900, Greg Kroah-Hartman wrote:
> > > On Wed, May 20, 2015 at 08:56:56PM +0530, Sudip Mukherjee wrote:
<snip>
> 
> > And then there are some pending bugs in bugzilla. I am also planning to
> > add the code for epst in paride (i saw in many forums that people are
> > not able to use their scanner on latest kernels).
> 
> "epst"?  What's that?
it was part of ppscsi, mainly needed to use HP scanjet 5100C. I had a
short look and it seems like the other parts of ppscsi are already there
in paride, but somehow epst was leftout and Tim says he is not interested
with that code now. And besides paride might get orphaned now, so there is
noone else to re-add that support in the newer kernels. My only hesitation
is that I donot have the scanner to test the code. :(

regards
sudip

> 

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 0/6] use devicemodel with parport
@ 2015-06-01  8:34         ` Sudip Mukherjee
  0 siblings, 0 replies; 48+ messages in thread
From: Sudip Mukherjee @ 2015-06-01  8:34 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Tim Waugh, Jean Delvare, Wolfram Sang, Willy Tarreau, Alan Cox,
	devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

On Mon, Jun 01, 2015 at 03:18:11PM +0900, Greg Kroah-Hartman wrote:
> On Mon, Jun 01, 2015 at 11:16:51AM +0530, Sudip Mukherjee wrote:
> > On Mon, Jun 01, 2015 at 07:05:30AM +0900, Greg Kroah-Hartman wrote:
> > > On Wed, May 20, 2015 at 08:56:56PM +0530, Sudip Mukherjee wrote:
<snip>
> 
> > And then there are some pending bugs in bugzilla. I am also planning to
> > add the code for epst in paride (i saw in many forums that people are
> > not able to use their scanner on latest kernels).
> 
> "epst"?  What's that?
it was part of ppscsi, mainly needed to use HP scanjet 5100C. I had a
short look and it seems like the other parts of ppscsi are already there
in paride, but somehow epst was leftout and Tim says he is not interested
with that code now. And besides paride might get orphaned now, so there is
noone else to re-add that support in the newer kernels. My only hesitation
is that I donot have the scanner to test the code. :(

regards
sudip

> 

^ permalink raw reply	[flat|nested] 48+ messages in thread

end of thread, other threads:[~2015-06-01  8:34 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-20 15:26 [PATCH 0/6] use devicemodel with parport Sudip Mukherjee
2015-05-20 15:26 ` Sudip Mukherjee
2015-05-20 15:26 ` [PATCH 1/6] parport: add device-model to parport subsystem Sudip Mukherjee
2015-05-20 15:26   ` Sudip Mukherjee
2015-05-20 15:26 ` [PATCH 2/6] staging: panel: use new parport device model Sudip Mukherjee
2015-05-20 15:26 ` [PATCH 3/6] i2c-parport: define ports to connect Sudip Mukherjee
2015-05-20 15:26   ` Sudip Mukherjee
2015-05-20 15:46   ` Wolfram Sang
2015-05-20 15:46     ` Wolfram Sang
2015-05-20 15:27 ` [PATCH 4/6] i2c-parport: use new parport device model Sudip Mukherjee
2015-05-20 15:49   ` Wolfram Sang
2015-05-20 17:14     ` Sudip Mukherjee
2015-05-20 17:14       ` Sudip Mukherjee
2015-05-20 17:35       ` Wolfram Sang
2015-05-20 17:35         ` Wolfram Sang
2015-05-20 17:59       ` Jean Delvare
2015-05-20 17:59         ` Jean Delvare
2015-05-21  1:02         ` [RFC PATCH] checkpatch: check for 2 or more spaces around assignment of a declaration Joe Perches
2015-05-21  5:48           ` Willy Tarreau
2015-05-21  5:48             ` Willy Tarreau
2015-05-21  6:16   ` [PATCH v2 4/6] i2c-parport: use new parport device model Sudip Mukherjee
2015-05-21  6:16     ` Sudip Mukherjee
2015-05-20 15:27 ` [PATCH 5/6] paride: " Sudip Mukherjee
2015-05-20 15:27   ` Sudip Mukherjee
2015-05-20 15:27 ` [PATCH 6/6] MAINTAINERS: maintain parport Sudip Mukherjee
2015-05-20 15:46   ` Richard Weinberger
2015-05-20 15:46     ` Richard Weinberger
2015-05-20 16:28     ` Joe Perches
2015-05-20 16:28       ` Joe Perches
2015-05-20 17:31       ` Sudip Mukherjee
2015-05-20 17:31         ` Sudip Mukherjee
2015-05-20 16:33     ` One Thousand Gnomes
2015-05-20 16:33       ` One Thousand Gnomes
2015-05-20 20:36       ` Richard Weinberger
2015-05-21  5:59         ` Sudip Mukherjee
2015-05-21  5:59           ` Sudip Mukherjee
2015-05-21  5:51     ` Willy Tarreau
2015-05-21  5:51       ` Willy Tarreau
2015-05-21  6:09       ` Greg Kroah-Hartman
2015-05-21  6:09         ` Greg Kroah-Hartman
2015-05-31 22:05 ` [PATCH 0/6] use devicemodel with parport Greg Kroah-Hartman
2015-05-31 22:05   ` Greg Kroah-Hartman
2015-06-01  5:46   ` Sudip Mukherjee
2015-06-01  5:46     ` Sudip Mukherjee
2015-06-01  6:18     ` Greg Kroah-Hartman
2015-06-01  6:18       ` Greg Kroah-Hartman
2015-06-01  8:34       ` Sudip Mukherjee
2015-06-01  8:34         ` Sudip Mukherjee

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.