From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Nelson Date: Sun, 24 Apr 2016 16:32:23 -0700 Subject: [U-Boot] [RESEND PATCH V3 1/6] dm: gpio: add a default gpio xlate routine In-Reply-To: <571907FD.7060005@wwwdotorg.org> References: <1461166659-28276-1-git-send-email-eric@nelint.com> <1461166659-28276-2-git-send-email-eric@nelint.com> <571907FD.7060005@wwwdotorg.org> Message-ID: <571D5787.5000404@nelint.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Thanks Stephen, On 04/21/2016 10:03 AM, Stephen Warren wrote: > On 04/20/2016 09:37 AM, Eric Nelson wrote: >> Many drivers use a common form of offset + flags for device >> tree nodes. e.g.: >> <&gpio1 2 GPIO_ACTIVE_LOW> >> >> This patch adds a common implementation of this type of parsing >> and calls it when a gpio driver doesn't supply its' own xlate >> routine. >> >> This will allow removal of the driver-specific versions in a >> handful of drivers and simplify the addition of new drivers. > >> diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c > >> +int gpio_xlate_offs_flags(struct udevice *dev, >> + struct gpio_desc *desc, >> + struct fdtdec_phandle_args *args) >> +{ >> + if (args->args_count < 1) >> + return -EINVAL; >> + >> + desc->offset = args->args[0]; >> + >> + if (args->args_count < 2) >> + return 0; > > Nit: There's an indentation inconsistency there. > I seem to have fat fingered this. V4 on its way.