linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Fabien Marteau <fabien.marteau@armadeus.com>
Cc: Scott Moreau <oreaus@gmail.com>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] input: joystick:   Adding Austria Microsystem AS5011 joystick driver
Date: Wed, 24 Nov 2010 11:55:24 -0800	[thread overview]
Message-ID: <20101124195523.GF27368@core.coreip.homeip.net> (raw)
In-Reply-To: <4CEBED7E.7010101@armadeus.com>

Hi Fabien,

On Tue, Nov 23, 2010 at 05:36:14PM +0100, Fabien Marteau wrote:
> Driver for EasyPoint AS5011 2 axis joystick chip. This chip is plugged
> on an I2C bus. It as been tested on ARM processor (i.MX27).
> 

Thank you for the patch. In addiitoon to comments you got from the other
reviewers I'd recommend switching to threaded IRQ instead of using a
separate workqueue, it greatly simplifies the code.

> +
> +static irqreturn_t button_interrupt(int irq, void *dev_id)
> +{
> +	struct as5011_platform_data *plat_dat =
> +		(struct as5011_platform_data *)dev_id;
> +	int ret;
> +
> +	ret = gpio_get_value(plat_dat->button_gpio);
> +	if (ret)
> +		input_report_key(plat_dat->input_dev, BTN_JOYSTICK, 0);
> +	else
> +		input_report_key(plat_dat->input_dev, BTN_JOYSTICK, 1);
> +	input_sync(plat_dat->input_dev);
> +	return IRQ_HANDLED;

That appears to be a hard IRQ; are you sure that gpio_get_value will not
sleep?

> +
> +	plat_dat->input_dev->name = "Austria Microsystem as5011 joystick";
> +	plat_dat->input_dev->uniq = "Austria0";
> +	plat_dat->input_dev->id.bustype = BUS_I2C;
> +	plat_dat->input_dev->phys = "/dev/input/event0";

Phys is not the path in device tree but rather physical device
connection path within the system. If there is not known connection path
it is better just leave it as NULL.

> +	plat_dat->input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
> +	plat_dat->input_dev->keybit[BIT_WORD(BTN_JOYSTICK)] =
> +					BIT_MASK(BTN_JOYSTICK);
> +
> +	input_set_abs_params(plat_dat->input_dev,
> +			     ABS_X,
> +			     AS5011_MIN_AXIS,
> +			     AS5011_MAX_AXIS,
> +			     AS5011_FUZZ,
> +			     AS5011_FLAT);
> +	input_set_abs_params(plat_dat->input_dev,
> +			     ABS_Y,
> +			     AS5011_MIN_AXIS,
> +			     AS5011_MAX_AXIS,
> +			     AS5011_FUZZ,
> +			     AS5011_FLAT);
> +
> +	plat_dat->button_irq_name =
> +		kmalloc(sizeof(unsigned char)*SIZE_NAME,
> +					 GFP_KERNEL);

Just why does it have to be separately allocated? I'd even stick with
"as5011" for all IRQ names.

> +
> +	queue_work(plat_dat->workqueue, &plat_dat->update_axes_work);
> +

The device is quite likely not opened here so why do you want to send
events?

Thanks.

-- 
Dmitry

  parent reply	other threads:[~2010-11-24 19:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-23 16:36 [PATCH] input: joystick: Adding Austria Microsystem AS5011 joystick driver Fabien Marteau
2010-11-23 17:45 ` Dan Carpenter
2010-11-24 15:29 ` Anirudh Ghayal
2010-11-25 10:32   ` Fabien Marteau
2010-11-24 19:55 ` Dmitry Torokhov [this message]
2010-11-25 10:10   ` Fabien Marteau
2010-11-27  8:19     ` Dmitry Torokhov

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=20101124195523.GF27368@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=fabien.marteau@armadeus.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oreaus@gmail.com \
    /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).