mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Vicente Bergas <vicencb@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/4] twl6030: add power button as an input key
Date: Mon, 11 Mar 2013 22:35:27 +0100	[thread overview]
Message-ID: <20130311213527.GN1906@pengutronix.de> (raw)
In-Reply-To: <1362958567-6110-3-git-send-email-vicencb@gmail.com>

On Mon, Mar 11, 2013 at 12:36:05AM +0100, Vicente Bergas wrote:
> 
> +
> +static int __init twl6030_pwrbtn_probe(struct device_d *dev)
> +{
> +	struct twl6030_pwrbtn_platform_data *pdata;
> +	struct console_device *cdev;
> +
> +	pdata = dev->platform_data;
> +
> +	if (!pdata) {
> +		pr_err("missing platform_data\n");

use dev_err and friends for driver messages.

> +		return -ENODEV;
> +	}
> +
> +	pdata->twl6030 = twl6030_get();
> +	if (!pdata->fifo_size)
> +		pdata->fifo_size = 4;
> +
> +	pdata->recv_fifo = kfifo_alloc(pdata->fifo_size);
> +
> +	pdata->poller.func = ic2_key_poller;
> +
> +	cdev = &pdata->cdev;
> +	dev->type_data = cdev;
> +	cdev->dev = dev;
> +	cdev->f_caps = CONSOLE_STDIN;
> +	cdev->tstc = twl6030_pwrbtn_tstc;
> +	cdev->getc = twl6030_pwrbtn_getc;
> +
> +	console_register(&pdata->cdev);
> +
> +	return poller_register(&pdata->poller);
> +}
> +
> +static struct driver_d twl6030_pwrbtn_driver = {
> +	.name	= "twl6030_pwrbtn",
> +	.probe	= twl6030_pwrbtn_probe,
> +};
> +device_platform_driver(twl6030_pwrbtn_driver);
> diff --git a/include/twl6030_pwrbtn.h b/include/twl6030_pwrbtn.h
> new file mode 100644
> index 0000000..e7e8383
> --- /dev/null
> +++ b/include/twl6030_pwrbtn.h
> @@ -0,0 +1,23 @@
> +#ifndef _TWL6030_PWRBTN_H
> +#define _TWL6030_PWRBTN_H
> +
> +#include <poller.h>
> +#include <kfifo.h>
> +#include <mfd/twl6030.h>
> +
> +struct twl6030_pwrbtn_platform_data {
> +	/* Configuration parameters */
> +	int code;
> +	/* optional */
> +	int fifo_size;

Since this driver handles a single key only, must the fifo size
be configurable?

> +
> +	/* internal */
> +	u8 previous_state;
> +
> +	struct twl6030 *twl6030;
> +	struct kfifo *recv_fifo;
> +	struct poller_struct poller;
> +	struct console_device cdev;
> +};

Please do not abuse platform_data for private driver data use. Allocate
a separate struct for it.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2013-03-11 21:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-10 23:36 [PATCH 0/4] ArchosG9: add keyboard input and new reset menu entries Vicente Bergas
2013-03-10 23:36 ` [PATCH 1/4] gpio_keys: detect keys pressed before booting Vicente Bergas
2013-03-10 23:36 ` [PATCH 2/4] twl6030: add power button as an input key Vicente Bergas
2013-03-11 21:35   ` Sascha Hauer [this message]
2013-03-10 23:36 ` [PATCH 3/4] OMAP4: add command to select next boot device priority Vicente Bergas
2013-03-11 21:42   ` Sascha Hauer
2013-03-10 23:36 ` [PATCH 4/4] ArchosG9: add keyboard input and new reset menu entries Vicente Bergas
2013-03-11 21:45   ` Sascha Hauer
2013-03-12  0:09     ` vj
2013-03-12  0:01 [PATCH 2/4] twl6030: add power button as an input key Vicente Bergas
2013-03-12 17:48 ` Sascha Hauer

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=20130311213527.GN1906@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=vicencb@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