lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 17 Jun 2014 16:57:19 +0100
From:	Mark Rutland <mark.rutland@....com>
To:	George Cherian <george.cherian@...com>
Cc:	"cw00.choi@...sung.com" <cw00.choi@...sung.com>,
	"myungjoo.ham@...sung.com" <myungjoo.ham@...sung.com>,
	"grant.likely@...aro.org" <grant.likely@...aro.org>,
	"rdunlap@...radead.org" <rdunlap@...radead.org>,
	"galak@...eaurora.org" <galak@...eaurora.org>,
	"ijc+devicetree@...lion.org.uk" <ijc+devicetree@...lion.org.uk>,
	"robh+dt@...nel.org" <robh+dt@...nel.org>,
	Pawel Moll <Pawel.Moll@....com>,
	"linux@...ck-us.net" <linux@...ck-us.net>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>
Subject: Re: [PATCH 2/2] extcon: gpio: Add dt support for the driver.

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@...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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ