From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org
Subject: Re: [PATCH] Input: drivers/joystick: use parallel port device model
Date: Fri, 31 Jul 2015 15:45:25 +0530 [thread overview]
Message-ID: <20150731101525.GA7811@sudip-pc> (raw)
In-Reply-To: <20150730165323.GC13165@dtor-ws>
On Thu, Jul 30, 2015 at 09:53:23AM -0700, Dmitry Torokhov wrote:
> Hi Sudip,
Hi Dmitry,
>
> On Thu, Jul 30, 2015 at 07:36:34PM +0530, Sudip Mukherjee wrote:
> > Modify db9 driver to use the new Parallel Port device model.
> >
> > Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> > ---
> >
> > It will generate a checkpatch warning about long line but I have not
> > changed it as it was only 2 char more and for 2 char it is more readable
> > now.
>
> You can also write it as
>
> if (!have_dev)
> return -ENODEV;
>
> return parport_register_driver(...);
sure.
>
>
> Could you please tell me how you tested this change? With these devices
> becoming exceedingly rare just compile-tested changes may introduce
> regressions that are not easily noticed.
I dont have the device. It was just tested with module loading,
unloading, bind and unbind and checking that it is getting attached
properly. Also checked that with lp loaded, this driver fails to load.
Since the modification is only in the init, exit and probe
section so that should not affect the working of the driver. After the
driver loads and gets access to the parport and binds to it then these
sections have done their part. After that the db9_open and other old
functions will be responsible and since I have not touched those
functions so theoretically there should not be any regressions.
>
<snip>
> >
> > +
> > + for (i = 0; i < DB9_MAX_PORTS; i++) {
> > + if (db9_cfg[i].nargs == 0 ||
> > + db9_cfg[i].args[DB9_ARG_PARPORT] < 0)
> > + continue;
> > +
> > + if (db9_cfg[i].nargs < 2) {
> > + pr_warn("db9.c: Device type must be specified.\n");
> > + return;
> > + }
> > +
> > + if (db9_cfg[i].args[DB9_ARG_PARPORT] == pp->number)
> > + break;
> > + }
> > +
> > + if (i == DB9_MAX_PORTS) {
> > + pr_debug("Not using parport%d.\n", pp->number);
> > + return;
> > + }
>
> Why do we validate module options in attach() instead of how we did this
> in module init function? By doing this here we losing the ability to
> abort module loading when parameters are invalid.
It is there in the module_init. The same check was added here also.
we can remove the check for db9_cfg[i].nargs < 2 from here.
But the other one will be required to check for the port to which we
need to register.
>
> > +
<snip>
> >
> > - parport_put_port(pp);
> > - return db9;
> > + db9_base[i] = db9;
>
> Instead of using static array maybe store db9 in pardevice's private
> pointer? Given that we are using parport exclusively on detach we can
> just get the first pardevice and get db9 from it.
Well, yes... Actually I wanted to do this with the minimum possible code
change so that any chance of regression can be avoided. This should not
have any problem, but I am a bit hesitant as this can not be tested on
real hardware. If you confirm then I will make it this way in v2.
By any chance, do you have the hardware?
regards
sudip
next prev parent reply other threads:[~2015-07-31 10:15 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-30 14:06 [PATCH] Input: drivers/joystick: use parallel port device model Sudip Mukherjee
2015-07-30 16:53 ` Dmitry Torokhov
2015-07-31 10:15 ` Sudip Mukherjee [this message]
2015-07-31 16:54 ` Dmitry Torokhov
2015-07-31 17:34 ` Sudip Mukherjee
2015-07-31 20:36 ` Greg KH
2015-07-31 20:43 ` Dmitry Torokhov
2015-08-01 12:43 ` Sudip Mukherjee
2015-08-03 12:26 ` Pali Rohár
2015-08-03 12:36 ` Sudip Mukherjee
2015-08-03 12:41 ` Pali Rohár
2015-08-04 18:37 ` Pali Rohár
2015-08-03 15:02 ` Sudip Mukherjee
2015-08-04 18:41 ` Dmitry Torokhov
2015-08-05 6:27 ` Sudip Mukherjee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150731101525.GA7811@sudip-pc \
--to=sudipm.mukherjee@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).