devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: George Cherian <george.cherian@ti.com>
Cc: "cw00.choi@samsung.com" <cw00.choi@samsung.com>,
	"myungjoo.ham@samsung.com" <myungjoo.ham@samsung.com>,
	"grant.likely@linaro.org" <grant.likely@linaro.org>,
	"rdunlap@infradead.org" <rdunlap@infradead.org>,
	"galak@codeaurora.org" <galak@codeaurora.org>,
	"ijc+devicetree@hellion.org.uk" <ijc+devicetree@hellion.org.uk>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	Pawel Moll <Pawel.Moll@arm.com>,
	"linux@roeck-us.net" <linux@roeck-us.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH 2/2] extcon: gpio: Add dt support for the driver.
Date: Tue, 17 Jun 2014 16:57:19 +0100	[thread overview]
Message-ID: <20140617155719.GC8930@leverpostej> (raw)
In-Reply-To: <1402977500-19987-3-git-send-email-george.cherian@ti.com>

On Tue, Jun 17, 2014 at 04:58:20AM +0100, George Cherian wrote:
> Add device tree support to extcon-gpio driver.
> Add devicetree binding documentation
> 
> Signed-off-by: George Cherian <george.cherian@ti.com>
> ---
>  .../devicetree/bindings/extcon/extcon-gpio.txt     | 34 ++++++++++++++++++++++
>  drivers/extcon/extcon-gpio.c                       | 29 ++++++++++++++++++
>  2 files changed, 63 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/extcon/extcon-gpio.txt
> 
> diff --git a/Documentation/devicetree/bindings/extcon/extcon-gpio.txt b/Documentation/devicetree/bindings/extcon/extcon-gpio.txt
> new file mode 100644
> index 0000000..80b791b
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/extcon/extcon-gpio.txt
> @@ -0,0 +1,34 @@
> +GPIO based EXTCON
> +
> +EXTCON GPIO
> +-----------
> +
> +Required Properties:
> + - compatible: should be:
> +   * "ti,extcon-gpio"
> + - gpios: specifies the gpio pin used.
> + - debounce: Debounce time for GPIO IRQ in ms
> + - irq-flags: IRQ flag to be used ( eg: IRQ_TYPE_EDGE_FALLING)

This looks distinctly odd. Why do you need this here?

> +Optional Properties:
> + - gpio-active-low: Property describing whether gpio active state is 1 or 0
> +		    If defined , low state of gpio means active.

Surely this is defined in the gpio flags?

> + - check-on-resume: Property describing whether to check the gpio state
> +		    while resuming from SLEEP.

Does this need to be in DT? Surely we could jsut always check this?

> + - state-on: print_state is overriden with state_on string if provided.
> +	     If NULL, default method of extcon class is used.
> + - state_off: print_state is overriden with state_off string  if provided.
> +	      If NUll, default method of extcon class is used.

This means nothing from a HW perspective. This describes linux internal
details.

[...]

> +		of_property_read_u32(np, "debounce", (u32 *)&pdata->debounce);
> +		of_property_read_u32(np, "irq-flags", (u32 *)&pdata->irq_flags);

If you need theses casts, the code is broken.

These functions can only read into a u32. If you pass a smaller type
you'll trash aribtrary memory locations, and if you pass a larger type
this is broken for BE.

Mark.

  reply	other threads:[~2014-06-17 15:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-17  3:58 [PATCH 0/2] Add devicetree support for extcon-gpio George Cherian
2014-06-17  3:58 ` [PATCH 1/2] extcon: gpio: Minor cleanups George Cherian
2014-06-17  3:58 ` [PATCH 2/2] extcon: gpio: Add dt support for the driver George Cherian
2014-06-17 15:57   ` Mark Rutland [this message]
2014-06-19  3:30     ` George Cherian

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=20140617155719.GC8930@leverpostej \
    --to=mark.rutland@arm.com \
    --cc=Pawel.Moll@arm.com \
    --cc=cw00.choi@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=george.cherian@ti.com \
    --cc=grant.likely@linaro.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=myungjoo.ham@samsung.com \
    --cc=rdunlap@infradead.org \
    --cc=robh+dt@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).