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


Groups > linux.kernel > #1203243 > unrolled thread

Re: [PATCH v2] Input: drivers/joystick: use parallel port device model

Started bySudip Mukherjee <sudipm.mukherjee@gmail.com>
First post2015-08-08 12:40 +0200
Last post2015-08-17 09:30 +0200
Articles 6 — 3 participants

Back to article view | Back to linux.kernel

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


Contents

  Re: [PATCH v2] Input: drivers/joystick: use parallel port device  model Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-08-08 12:40 +0200
    Re: [PATCH v2] Input: drivers/joystick: use parallel port device  model Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-08-13 15:50 +0200
      Re: [PATCH v2] Input: drivers/joystick: use parallel port device  model Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2015-08-13 18:30 +0200
        Re: [PATCH v2] Input: drivers/joystick: use parallel port device  model Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-08-14 09:00 +0200
          Re: [PATCH v2] Input: drivers/joystick: use parallel port device  model Pali Rohár <pali.rohar@gmail.com> - 2015-08-14 09:10 +0200
            Re: [PATCH v2] Input: drivers/joystick: use parallel port device  model Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-08-17 09:30 +0200

#1203243 — Re: [PATCH v2] Input: drivers/joystick: use parallel port device model

FromSudip Mukherjee <sudipm.mukherjee@gmail.com>
Date2015-08-08 12:40 +0200
SubjectRe: [PATCH v2] Input: drivers/joystick: use parallel port device model
Message-ID<pV9HH-4yH-3@gated-at.bofh.it>
On Tue, Aug 04, 2015 at 07:55:51PM +0530, Sudip Mukherjee wrote:
> Modify db9 driver to use the new Parallel Port device model.
> 
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---
> 
> v2: an extra check was removed. db9_base could not be removed. Already
> mailed you the reasons, reference is at:
> https://lkml.org/lkml/2015/8/3/403

Hi Dmitry,
I was telling you on the other thread that to remove db9_base we will
need to modify the parport code and then it has to be tested by everyone
again and that will also change the old behaviour of parport. The v2 to
which I am replying now is still having that db9_base.

Please see the following patch, this is the minimum change required to
update db9 driver. Personally I donot like this approach as in this
method if a parallel port is hotplugged after this driver is loaded then
it will not work. Please let me know your views on the posted v2 and
also on the following proposal.

regards
sudip


diff --git a/drivers/input/joystick/db9.c b/drivers/input/joystick/db9.c
index 8e7de5c..348e7d2 100644
--- a/drivers/input/joystick/db9.c
+++ b/drivers/input/joystick/db9.c
@@ -553,7 +553,7 @@ static void db9_close(struct input_dev *dev)
 	mutex_unlock(&db9->mutex);
 }
 
-static struct db9 __init *db9_probe(int parport, int mode)
+static struct db9 __init *db9_probe(int parport, int mode, int cnt)
 {
 	struct db9 *db9;
 	const struct db9_mode_data *db9_mode;
@@ -562,6 +562,7 @@ static struct db9 __init *db9_probe(int parport, int mode)
 	struct input_dev *input_dev;
 	int i, j;
 	int err;
+	struct pardev_cb db9_parport_cb;
 
 	if (mode < 1 || mode >= DB9_MAX_PAD || !db9_modes[mode].n_buttons) {
 		printk(KERN_ERR "db9.c: Bad device type %d\n", mode);
@@ -584,7 +585,9 @@ static struct db9 __init *db9_probe(int parport, int mode)
 		goto err_put_pp;
 	}
 
-	pd = parport_register_device(pp, "db9", NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL);
+	db9_parport_cb.flags = PARPORT_FLAG_EXCL;
+
+	pd = parport_register_dev_model(pp, "db9", &db9_parport_cb, cnt);
 	if (!pd) {
 		printk(KERN_ERR "db9.c: parport busy already - lp.o loaded?\n");
 		err = -EBUSY;
@@ -671,11 +674,19 @@ static void db9_remove(struct db9 *db9)
 	kfree(db9);
 }
 
+static struct parport_driver db9_parport_driver = {
+	.name = "db9",
+	.devmodel = true,
+};
+
 static int __init db9_init(void)
 {
 	int i;
 	int have_dev = 0;
-	int err = 0;
+	int err = parport_register_driver(&db9_parport_driver);
+
+	if (err)
+		return err;
 
 	for (i = 0; i < DB9_MAX_PORTS; i++) {
 		if (db9_cfg[i].nargs == 0 || db9_cfg[i].args[DB9_ARG_PARPORT] < 0)
@@ -688,7 +699,7 @@ static int __init db9_init(void)
 		}
 
 		db9_base[i] = db9_probe(db9_cfg[i].args[DB9_ARG_PARPORT],
-					db9_cfg[i].args[DB9_ARG_MODE]);
+					db9_cfg[i].args[DB9_ARG_MODE], i);
 		if (IS_ERR(db9_base[i])) {
 			err = PTR_ERR(db9_base[i]);
 			break;
@@ -701,10 +712,15 @@ static int __init db9_init(void)
 		while (--i >= 0)
 			if (db9_base[i])
 				db9_remove(db9_base[i]);
+		parport_unregister_driver(&db9_parport_driver);
 		return err;
 	}
 
-	return have_dev ? 0 : -ENODEV;
+	if (have_dev)
+		return 0;
+
+	parport_unregister_driver(&db9_parport_driver);
+	return -ENODEV;
 }
 
 static void __exit db9_exit(void)
@@ -714,6 +730,7 @@ static void __exit db9_exit(void)
 	for (i = 0; i < DB9_MAX_PORTS; i++)
 		if (db9_base[i])
 			db9_remove(db9_base[i]);
+	parport_unregister_driver(&db9_parport_driver);
 }
 
 module_init(db9_init);

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

[toc] | [next] | [standalone]


#1206826

FromSudip Mukherjee <sudipm.mukherjee@gmail.com>
Date2015-08-13 15:50 +0200
Message-ID<pX13k-4V5-31@gated-at.bofh.it>
In reply to#1203243
On Sat, Aug 08, 2015 at 04:05:15PM +0530, Sudip Mukherjee wrote:
> On Tue, Aug 04, 2015 at 07:55:51PM +0530, Sudip Mukherjee wrote:
> > Modify db9 driver to use the new Parallel Port device model.
> > 
> > Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> > ---
> > 
> > v2: an extra check was removed. db9_base could not be removed. Already
> > mailed you the reasons, reference is at:
> > https://lkml.org/lkml/2015/8/3/403
> 
> Hi Dmitry,
> I was telling you on the other thread that to remove db9_base we will
> need to modify the parport code and then it has to be tested by everyone
> again and that will also change the old behaviour of parport. The v2 to
> which I am replying now is still having that db9_base.
> 
> Please see the following patch, this is the minimum change required to
> update db9 driver. Personally I donot like this approach as in this
> method if a parallel port is hotplugged after this driver is loaded then
> it will not work. Please let me know your views on the posted v2 and
> also on the following proposal.

Hi Dmitry,
Did you have a chance to look at this?
Pali Rohár has the hardware and he is ready to test it.

regards
sudip

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

[toc] | [prev] | [next] | [standalone]


#1206946

FromDmitry Torokhov <dmitry.torokhov@gmail.com>
Date2015-08-13 18:30 +0200
Message-ID<pX3ya-92-11@gated-at.bofh.it>
In reply to#1206826
On Thu, Aug 13, 2015 at 07:16:14PM +0530, Sudip Mukherjee wrote:
> On Sat, Aug 08, 2015 at 04:05:15PM +0530, Sudip Mukherjee wrote:
> > On Tue, Aug 04, 2015 at 07:55:51PM +0530, Sudip Mukherjee wrote:
> > > Modify db9 driver to use the new Parallel Port device model.
> > > 
> > > Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> > > ---
> > > 
> > > v2: an extra check was removed. db9_base could not be removed. Already
> > > mailed you the reasons, reference is at:
> > > https://lkml.org/lkml/2015/8/3/403
> > 
> > Hi Dmitry,
> > I was telling you on the other thread that to remove db9_base we will
> > need to modify the parport code and then it has to be tested by everyone
> > again and that will also change the old behaviour of parport. The v2 to
> > which I am replying now is still having that db9_base.
> > 
> > Please see the following patch, this is the minimum change required to
> > update db9 driver. Personally I donot like this approach as in this
> > method if a parallel port is hotplugged after this driver is loaded then
> > it will not work. Please let me know your views on the posted v2 and
> > also on the following proposal.
> 
> Hi Dmitry,
> Did you have a chance to look at this?

Right, so I agree that we should allow for hotplug and so the v2 is in
that sense is better than v3.

I still would prefer for the core to keep track of relationship between
devices and drivers, but if you would prefer to postpone implementing it
that woudl be fine.

> Pali Rohár has the hardware and he is ready to test it.

Pali, could you give the v2 version of the patch a spin
(https://patchwork.kernel.org/patch/6940321/)?

Thanks.

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

[toc] | [prev] | [next] | [standalone]


#1207356

FromSudip Mukherjee <sudipm.mukherjee@gmail.com>
Date2015-08-14 09:00 +0200
Message-ID<pXh85-2TO-7@gated-at.bofh.it>
In reply to#1206946
On Thu, Aug 13, 2015 at 09:26:02AM -0700, Dmitry Torokhov wrote:
> On Thu, Aug 13, 2015 at 07:16:14PM +0530, Sudip Mukherjee wrote:
> > On Sat, Aug 08, 2015 at 04:05:15PM +0530, Sudip Mukherjee wrote:
> > > On Tue, Aug 04, 2015 at 07:55:51PM +0530, Sudip Mukherjee wrote:
> > > > Modify db9 driver to use the new Parallel Port device model.
> > > > 
> > > > Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> > > > ---
> > > > 
> > > > v2: an extra check was removed. db9_base could not be removed. Already
> > > > mailed you the reasons, reference is at:
> > > > https://lkml.org/lkml/2015/8/3/403
> > > 
> > > Hi Dmitry,
> > > I was telling you on the other thread that to remove db9_base we will
> > > need to modify the parport code and then it has to be tested by everyone
> > > again and that will also change the old behaviour of parport. The v2 to
> > > which I am replying now is still having that db9_base.
> > > 
> > > Please see the following patch, this is the minimum change required to
> > > update db9 driver. Personally I donot like this approach as in this
> > > method if a parallel port is hotplugged after this driver is loaded then
> > > it will not work. Please let me know your views on the posted v2 and
> > > also on the following proposal.
> > 
> > Hi Dmitry,
> > Did you have a chance to look at this?
> 
> Right, so I agree that we should allow for hotplug and so the v2 is in
> that sense is better than v3.
> 
> I still would prefer for the core to keep track of relationship between
> devices and drivers, but if you would prefer to postpone implementing it
> that woudl be fine.
Thanks. Right now the code is already a mixture of the new code and the
old code and its almost a mess. After all drivers are converted and the
old code removed then the parport code will become much simpler than
what it is now. And it will be easy to make those enhancements at that
time.
> 
> > Pali Rohár has the hardware and he is ready to test it.
> 
> Pali, could you give the v2 version of the patch a spin
> (https://patchwork.kernel.org/patch/6940321/)?
Adding Pali to the cc list.

Hi Pali,
Are you still away from your desktop with the joystick? or can it be
tested?

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

[toc] | [prev] | [next] | [standalone]


#1207367

FromPali Rohár <pali.rohar@gmail.com>
Date2015-08-14 09:10 +0200
Message-ID<pXhhM-3ku-7@gated-at.bofh.it>
In reply to#1207356
On Friday 14 August 2015 12:25:42 Sudip Mukherjee wrote:
> On Thu, Aug 13, 2015 at 09:26:02AM -0700, Dmitry Torokhov wrote:
> > On Thu, Aug 13, 2015 at 07:16:14PM +0530, Sudip Mukherjee wrote:
> > > Pali Rohár has the hardware and he is ready to test it.
> > 
> > Pali, could you give the v2 version of the patch a spin
> > (https://patchwork.kernel.org/patch/6940321/)?
> Adding Pali to the cc list.
> 
> Hi Pali,
> Are you still away from your desktop with the joystick? or can it be
> tested?
> 
> regards
> sudip

Yes, I'm still away from desktop with joystick... First I need to know
against which kernel version can be that patch tested? I remember that
v1 applied correctly against ubuntu's default 3.13 (which is installed
on that desktop) but driver did not compiled.

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

[toc] | [prev] | [next] | [standalone]


#1208422

FromSudip Mukherjee <sudipm.mukherjee@gmail.com>
Date2015-08-17 09:30 +0200
Message-ID<pYn1L-tt-5@gated-at.bofh.it>
In reply to#1207367
On Fri, Aug 14, 2015 at 09:05:55AM +0200, Pali Rohár wrote:
> On Friday 14 August 2015 12:25:42 Sudip Mukherjee wrote:
> > On Thu, Aug 13, 2015 at 09:26:02AM -0700, Dmitry Torokhov wrote:
> > > On Thu, Aug 13, 2015 at 07:16:14PM +0530, Sudip Mukherjee wrote:
> > > > Pali Rohár has the hardware and he is ready to test it.
> > > 
> > > Pali, could you give the v2 version of the patch a spin
> > > (https://patchwork.kernel.org/patch/6940321/)?
> > Adding Pali to the cc list.
> > 
> > Hi Pali,
> > Are you still away from your desktop with the joystick? or can it be
> > tested?
> > 
> > regards
> > sudip
> 
> Yes, I'm still away from desktop with joystick... First I need to know
> against which kernel version can be that patch tested? I remember that
> v1 applied correctly against ubuntu's default 3.13 (which is installed
> on that desktop) but driver did not compiled.

Sorry for the delay in replying. The change in parallel port code was
merged in 4.2, so you can test it againt 4.2-rc*.

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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web