linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jari Vanhala <ext-jari.vanhala@nokia.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Jiri Kosina <jkosina@suse.cz>,
	"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>
Subject: Re: [PATCH] HID: TWL4030: add HID Force Feedback vibra
Date: Mon, 22 Feb 2010 15:19:36 +0200	[thread overview]
Message-ID: <1266844776.4787.3236.camel@tema> (raw)
In-Reply-To: <20100222064004.GB2095@core.coreip.homeip.net>

On Mon, 2010-02-22 at 07:40 +0100, ext Dmitry Torokhov wrote:
> > +config HID_TWL4030_VIBRA
> > +	tristate "HID Support for TWL4030 Vibrator"
> > +	depends on TWL4030_CORE
> > +	select TWL4030_CODEC
> > +	select INPUT_FF_MEMLESS
> > +	---help---
> > +	  This option enables support for TWL4030 Vibrator Driver.
> > +
> 
> To compile this driver as a module...

Um. You mean help-text.. Added.

> > +struct vibra_info {
> > +	struct device		*dev;
> > +	struct input_dev	*input_dev;
> > +
> > +	struct workqueue_struct *workqueue;
> 
> Why do we need a separate workqueue? Can't keventd serve us?

There were problems with too long delays once in a while, own workqueue
made things much better. Also, you can change priority if needed.

> > +	struct work_struct	play_work;
> > +
> > +	int			enabled;
> 
> Use bool?

Ok.

> > +	int			speed;
> > +	int			direction;
> > +
> > +	int			coexist;
> 
> Here as well?

Ok.

> > +static int vibra_play(struct input_dev *dev, void *data,
> > +		      struct ff_effect *effect)
> > +{
> > +	struct vibra_info *info = data;
> > +
> > +	if (!info->workqueue)
> > +		return 0;
> 
> How can workqueue be missig here?

It's missing when we remove driver. ff-memless wants to stop vibra (if
it was running) and destroys info. And also we really don't want to
start worker anymore.

> > +static int twl4030_vibra_resume(struct platform_device *pdev)
> > +{
> > +	vibra_disable_leds();
> > +	return 0;
> > +}
> Please convert ot dev_pm_ops.

Hum, pm...

> > +	info->input_dev = input_allocate_device();
> > +	if (info->input_dev == NULL) {
> > +		dev_err(&pdev->dev, "couldn't allocate input device\n");
> > +		kfree(info);
> 
> Leaking workqueue.

Oops.

> > +		return -ENOMEM;
> > +	}
> > +	input_set_drvdata(info->input_dev, info);
> > +
> > +	info->input_dev->name = "twl4030:vibrator";
> > +	info->input_dev->id.version = 1;
> > +	info->input_dev->dev.parent = pdev->dev.parent;
> > +	set_bit(FF_RUMBLE, info->input_dev->ffbit);
> > +
> > +	ret = input_register_device(info->input_dev);
> > +	if (ret < 0) {
> > +		dev_dbg(&pdev->dev, "couldn't register input device\n");
> 
> Here as well... Can we switch to standard "goto into error path" error
> handling?

Too bad that freeing input is different at different stages, but I moved
simple cleanup to error path. I will send corrected version after I test
changes.

	++Jam



  reply	other threads:[~2010-02-22 13:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-17 12:22 [PATCH] HID: TWL4030: add HID Force Feedback vibra Jari Vanhala
2010-02-17 12:41 ` Jiri Kosina
2010-02-18 12:50   ` Jari Vanhala
2010-02-18 12:52     ` Jiri Kosina
2010-02-20  8:52     ` Dmitry Torokhov
2010-02-22  6:40 ` Dmitry Torokhov
2010-02-22 13:19   ` Jari Vanhala [this message]
2010-02-22 18:38     ` Dmitry Torokhov
2010-02-23  8:40       ` Jari Vanhala

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=1266844776.4787.3236.camel@tema \
    --to=ext-jari.vanhala@nokia.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jkosina@suse.cz \
    --cc=linux-input@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).