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]
Message-ID: <Y3RE3RjTRZ0uw4wZ@lunn.ch>
Date:   Wed, 16 Nov 2022 03:03:09 +0100
From:   Andrew Lunn <andrew@...n.ch>
To:     Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc:     Gregory Clement <gregory.clement@...tlin.com>,
        Sebastian Hesselbarth <sebastian.hesselbarth@...il.com>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ARM: mvebu: switch to using gpiod API in pm-board code

On Tue, Nov 15, 2022 at 05:40:35PM -0800, Dmitry Torokhov wrote:
> On Wed, Nov 16, 2022 at 02:10:29AM +0100, Andrew Lunn wrote:
> > > -		ret = gpio_direction_output(pic_gpios[i], 0);
> > > -		if (ret < 0) {
> > > -			gpio_free(pic_gpios[i]);
> > > +		pic_gpios[i] = fwnode_gpiod_get_index(of_fwnode_handle(np),
> > > +						      "ctrl", i, GPIOD_OUT_HIGH,
> > > +						      name);
> > 
> > The old code passes value=0 to gpio_direction_output(). For
> > fwnode_gpiod_get_index() you pass GPIOD_OUT_HIGH. Is this correct?
> 
> Yes, gpiod API works on logical states, whereas old gpio API used signal
> levels. In arch/arm/boot/dts/armada-xp-gp.dts ctrl-gpios are described
> as "active low":
> 
> 	cpus {
> 		pm_pic {
> 			ctrl-gpios = <&gpio0 16 GPIO_ACTIVE_LOW>,
> 				     <&gpio0 17 GPIO_ACTIVE_LOW>,
> 				     <&gpio0 18 GPIO_ACTIVE_LOW>;
> 		};
> 	};
> 
> so gpiolib will translate GPIOD_OUT_HIGH to 0 when setting final state
> of the pin.

Ah, yes. I knew that once, but it has gotten forgotten.

Thanks for the explanation and reminder.

       Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ