All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] pps: client: use new parport device model
@ 2018-01-28 23:22 Sudip Mukherjee
  2018-01-28 23:22 ` [PATCH 2/2] pps: generator: " Sudip Mukherjee
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Sudip Mukherjee @ 2018-01-28 23:22 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rodolfo Giometti; +Cc: linux-kernel, Sudip Mukherjee

Modify pps client driver to use the new parallel port device model.
In that process, added an index to mention the device number when we
have more than one parallel port.

Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
---

Tested on qemu with two parallel ports.

 drivers/pps/clients/pps_parport.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/drivers/pps/clients/pps_parport.c b/drivers/pps/clients/pps_parport.c
index 83797d8..4db824f 100644
--- a/drivers/pps/clients/pps_parport.c
+++ b/drivers/pps/clients/pps_parport.c
@@ -49,6 +49,7 @@
 	" zero turns clear edge capture off entirely");
 module_param(clear_wait, uint, 0);
 
+static DEFINE_IDA(pps_client_index);
 
 /* internal per port structure */
 struct pps_client_pp {
@@ -56,6 +57,7 @@ struct pps_client_pp {
 	struct pps_device *pps;		/* PPS device */
 	unsigned int cw;		/* port clear timeout */
 	unsigned int cw_err;		/* number of timeouts */
+	int index;			/* device number */
 };
 
 static inline int signal_is_set(struct parport *port)
@@ -136,6 +138,8 @@ static void parport_irq(void *handle)
 
 static void parport_attach(struct parport *port)
 {
+	struct pardev_cb pps_client_cb;
+	int index;
 	struct pps_client_pp *device;
 	struct pps_source_info info = {
 		.name		= KBUILD_MODNAME,
@@ -154,8 +158,15 @@ static void parport_attach(struct parport *port)
 		return;
 	}
 
-	device->pardev = parport_register_device(port, KBUILD_MODNAME,
-			NULL, NULL, parport_irq, PARPORT_FLAG_EXCL, device);
+	index = ida_simple_get(&pps_client_index, 0, 0, GFP_KERNEL);
+	memset(&pps_client_cb, 0, sizeof(pps_client_cb));
+	pps_client_cb.private = device;
+	pps_client_cb.irq_func = parport_irq;
+	pps_client_cb.flags = PARPORT_FLAG_EXCL;
+	device->pardev = parport_register_dev_model(port,
+						    KBUILD_MODNAME,
+						    &pps_client_cb,
+						    index);
 	if (!device->pardev) {
 		pr_err("couldn't register with %s\n", port->name);
 		goto err_free;
@@ -176,6 +187,7 @@ static void parport_attach(struct parport *port)
 	device->cw = clear_wait;
 
 	port->ops->enable_irq(port);
+	device->index = index;
 
 	pr_info("attached to %s\n", port->name);
 
@@ -186,6 +198,7 @@ static void parport_attach(struct parport *port)
 err_unregister_dev:
 	parport_unregister_device(device->pardev);
 err_free:
+	ida_simple_remove(&pps_client_index, index);
 	kfree(device);
 }
 
@@ -205,13 +218,15 @@ static void parport_detach(struct parport *port)
 	pps_unregister_source(device->pps);
 	parport_release(pardev);
 	parport_unregister_device(pardev);
+	ida_simple_remove(&pps_client_index, device->index);
 	kfree(device);
 }
 
 static struct parport_driver pps_parport_driver = {
 	.name = KBUILD_MODNAME,
-	.attach = parport_attach,
+	.match_port = parport_attach,
 	.detach = parport_detach,
+	.devmodel = true,
 };
 
 /* module staff */
-- 
1.9.1

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

* [PATCH 2/2] pps: generator: use new parport device model
  2018-01-28 23:22 [PATCH 1/2] pps: client: use new parport device model Sudip Mukherjee
@ 2018-01-28 23:22 ` Sudip Mukherjee
  2018-01-29 12:07   ` Rodolfo Giometti
  2018-01-29 12:06 ` [PATCH 1/2] pps: client: " Rodolfo Giometti
  2018-03-05 21:45 ` [1/2] " Sudip Mukherjee
  2 siblings, 1 reply; 6+ messages in thread
From: Sudip Mukherjee @ 2018-01-28 23:22 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rodolfo Giometti; +Cc: linux-kernel, Sudip Mukherjee

Modify pps generator driver to use the new parallel port device model.

Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
---

Tested on qemu with two parallel ports.

 drivers/pps/generators/pps_gen_parport.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/pps/generators/pps_gen_parport.c b/drivers/pps/generators/pps_gen_parport.c
index dcd39fb..99b076c 100644
--- a/drivers/pps/generators/pps_gen_parport.c
+++ b/drivers/pps/generators/pps_gen_parport.c
@@ -192,13 +192,18 @@ static inline ktime_t next_intr_time(struct pps_generator_pp *dev)
 
 static void parport_attach(struct parport *port)
 {
+	struct pardev_cb pps_cb;
+
 	if (attached) {
 		/* we already have a port */
 		return;
 	}
 
-	device.pardev = parport_register_device(port, KBUILD_MODNAME,
-			NULL, NULL, NULL, PARPORT_FLAG_EXCL, &device);
+	memset(&pps_cb, 0, sizeof(pps_cb));
+	pps_cb.private = &device;
+	pps_cb.flags = PARPORT_FLAG_EXCL;
+	device.pardev = parport_register_dev_model(port, KBUILD_MODNAME,
+						   &pps_cb, 0);
 	if (!device.pardev) {
 		pr_err("couldn't register with %s\n", port->name);
 		return;
@@ -236,8 +241,9 @@ static void parport_detach(struct parport *port)
 
 static struct parport_driver pps_gen_parport_driver = {
 	.name = KBUILD_MODNAME,
-	.attach = parport_attach,
+	.match_port = parport_attach,
 	.detach = parport_detach,
+	.devmodel = true,
 };
 
 /* module staff */
-- 
1.9.1

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

* Re: [PATCH 1/2] pps: client: use new parport device model
  2018-01-28 23:22 [PATCH 1/2] pps: client: use new parport device model Sudip Mukherjee
  2018-01-28 23:22 ` [PATCH 2/2] pps: generator: " Sudip Mukherjee
@ 2018-01-29 12:06 ` Rodolfo Giometti
  2018-03-05 21:45 ` [1/2] " Sudip Mukherjee
  2 siblings, 0 replies; 6+ messages in thread
From: Rodolfo Giometti @ 2018-01-29 12:06 UTC (permalink / raw)
  To: Sudip Mukherjee, Greg Kroah-Hartman; +Cc: linux-kernel

On 29/01/18 00:22, Sudip Mukherjee wrote:
> Modify pps client driver to use the new parallel port device model.
> In that process, added an index to mention the device number when we
> have more than one parallel port.
> 
> Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>

Acked-by: Rodolfo Giometti <giometti@enneenne.com>

-- 

HCE Engineering                      e-mail: giometti@hce-engineering.it
GNU/Linux Solutions                          giometti@enneenne.com
Linux Device Driver                          giometti@linux.it
Embedded Systems                     phone:  +39 349 2432127
UNIX programming                     skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it

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

* Re: [PATCH 2/2] pps: generator: use new parport device model
  2018-01-28 23:22 ` [PATCH 2/2] pps: generator: " Sudip Mukherjee
@ 2018-01-29 12:07   ` Rodolfo Giometti
  0 siblings, 0 replies; 6+ messages in thread
From: Rodolfo Giometti @ 2018-01-29 12:07 UTC (permalink / raw)
  To: Sudip Mukherjee, Greg Kroah-Hartman; +Cc: linux-kernel

On 29/01/18 00:22, Sudip Mukherjee wrote:
> Modify pps generator driver to use the new parallel port device model.
> 
> Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>

Acked-by: Rodolfo Giometti <giometti@enneenne.com>

-- 

HCE Engineering                      e-mail: giometti@hce-engineering.it
GNU/Linux Solutions                          giometti@enneenne.com
Linux Device Driver                          giometti@linux.it
Embedded Systems                     phone:  +39 349 2432127
UNIX programming                     skype:  rodolfo.giometti
Cosino Project - the quick prototyping embedded system - www.cosino.it
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it

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

* Re: [1/2] pps: client: use new parport device model
  2018-01-28 23:22 [PATCH 1/2] pps: client: use new parport device model Sudip Mukherjee
  2018-01-28 23:22 ` [PATCH 2/2] pps: generator: " Sudip Mukherjee
  2018-01-29 12:06 ` [PATCH 1/2] pps: client: " Rodolfo Giometti
@ 2018-03-05 21:45 ` Sudip Mukherjee
  2018-03-06  2:38   ` Greg Kroah-Hartman
  2 siblings, 1 reply; 6+ messages in thread
From: Sudip Mukherjee @ 2018-03-05 21:45 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rodolfo Giometti; +Cc: linux-kernel

On Sun, Jan 28, 2018 at 11:22:08PM +0000, Sudip Mukherjee wrote:
> Modify pps client driver to use the new parallel port device model.
> In that process, added an index to mention the device number when we
> have more than one parallel port.
> 
> Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> Acked-by: Rodolfo Giometti <giometti@enneenne.com>
> ---

Hi Greg,

A gentle reminder for this one.

--
Regards
Sudip

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

* Re: [1/2] pps: client: use new parport device model
  2018-03-05 21:45 ` [1/2] " Sudip Mukherjee
@ 2018-03-06  2:38   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2018-03-06  2:38 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: Rodolfo Giometti, linux-kernel

On Mon, Mar 05, 2018 at 09:45:21PM +0000, Sudip Mukherjee wrote:
> On Sun, Jan 28, 2018 at 11:22:08PM +0000, Sudip Mukherjee wrote:
> > Modify pps client driver to use the new parallel port device model.
> > In that process, added an index to mention the device number when we
> > have more than one parallel port.
> > 
> > Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> > Acked-by: Rodolfo Giometti <giometti@enneenne.com>
> > ---
> 
> Hi Greg,
> 
> A gentle reminder for this one.

Hah, I have over 1000 patches in my to-review queue right now.  That's
what I get for trying to go on vacation for a few days...

don't worry, it's not lost...

greg k-h

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

end of thread, other threads:[~2018-03-06  2:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-28 23:22 [PATCH 1/2] pps: client: use new parport device model Sudip Mukherjee
2018-01-28 23:22 ` [PATCH 2/2] pps: generator: " Sudip Mukherjee
2018-01-29 12:07   ` Rodolfo Giometti
2018-01-29 12:06 ` [PATCH 1/2] pps: client: " Rodolfo Giometti
2018-03-05 21:45 ` [1/2] " Sudip Mukherjee
2018-03-06  2:38   ` Greg Kroah-Hartman

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.