From patchwork Mon Apr 16 09:34:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Izard X-Patchwork-Id: 10342459 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E442060365 for ; Mon, 16 Apr 2018 09:35:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3C09285B5 for ; Mon, 16 Apr 2018 09:35:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BEA07285E0; Mon, 16 Apr 2018 09:35:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6BEBF285B5 for ; Mon, 16 Apr 2018 09:35:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754413AbeDPJfE (ORCPT ); Mon, 16 Apr 2018 05:35:04 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:43504 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754386AbeDPJfD (ORCPT ); Mon, 16 Apr 2018 05:35:03 -0400 Received: by mail-wr0-f195.google.com with SMTP id y7so23987795wrh.10; Mon, 16 Apr 2018 02:35:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/KP/UP0LBtw7LQ6E68oujILqD59RGiaI4HY1zpETehw=; b=uRS9qd0rQTm9MlFCWbKRQXB6B3VFj0QpR6O//72Uhm8QhviUnpM7S1eUgaKsbGRRGf +wPSZ5DBpFiHXo/XbB3/6OvpDKqsy5Z4JoRoMH9Qe1mRt7f/3NM1rdXoqVU7d6zTZh+8 sxsCxiW0HTLPrLqyXNZQO7z1bmfTZWldRI6aYfqjZ59Wn1zkYJ2l6PBH0AHn+l5oLDyz HdeHNXMFEEA1a7NG5rrlVQsTop9dOSYU649WRYvinGXvPGXqVQx1gJrVKUS0DTD7IzQo nGEDGZBVpdBM+CcWJIwrXPwOy08p2b4kBPppt4oJA/MZyvVCKIUWyI7EZ2fCNX/SCJ3H 1E1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/KP/UP0LBtw7LQ6E68oujILqD59RGiaI4HY1zpETehw=; b=Z1dIJ3V0YT/ccVcsugtpRh/oPcn4chJ2M596XWgWpfIrKUIhfYVaT3997gN3nM8KJb bAom9nIbK0oIG5MVT4t7uHqhREWsroWrOGqcv1/vVxZYcXxWBSuIU/yoUhKTx4LEOsHg ZiQietqhdlsZlf18mS0fW8THOzzDbB9OUXAr5Mf9/3HRnAUllZ9iLZeOmI5Qxf9E/1Wx QCZqOLbQCmbmTSEvU74UZLComr++yyJ4URx+enBy0UygBOoiEQVoLD/AsVTI4H3jJ1Q0 z4shtFTX9cyk1aGYYTSKFLNjNLh9HuviR9RWGVTUw7QxQV7U/OoF08iE7IQADt0AJnNZ 2v3g== X-Gm-Message-State: ALQs6tC5amOmFQAJ+GR11j1nwWl+50LhJZBiyZBXXbh8JYJ6Mu8jyE9Y J1Te7MaEmdFJJg2jp825N/M= X-Google-Smtp-Source: AIpwx4/gkdZkJvoRn+zqTRS0v4dpKL5xIb8rYaDRu/tdjjckGmf0gQCiVO2TKI6Tp0vSMl31RzK8Jw== X-Received: by 10.28.16.85 with SMTP id 82mr9173429wmq.4.1523871301899; Mon, 16 Apr 2018 02:35:01 -0700 (PDT) Received: from localhost.localdomain (146.187.3.109.rev.sfr.net. [109.3.187.146]) by smtp.gmail.com with ESMTPSA id t6sm2705335wre.32.2018.04.16.02.34.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Apr 2018 02:35:01 -0700 (PDT) From: Romain Izard To: Nicolas Ferre , Felipe Balbi , Greg Kroah-Hartman , Alexandre Belloni , Ludovic Desroches Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, Romain Izard Subject: [PATCH 1/3] usb: gadget: udc: atmel: GPIO inversion is handled by gpiod Date: Mon, 16 Apr 2018 11:34:03 +0200 Message-Id: <20180416093405.16612-2-romain.izard.pro@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180416093405.16612-1-romain.izard.pro@gmail.com> References: <20180416093405.16612-1-romain.izard.pro@gmail.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When converting to GPIO descriptors, gpiod_get_value automatically handles the line inversion flags from the device tree. Do not invert the line twice. Fixes: 3df034081021fa4b6967ce3364bc7d867ec1c870 Signed-off-by: Romain Izard Acked-by: Ludovic Desroches --- drivers/usb/gadget/udc/atmel_usba_udc.c | 3 +-- drivers/usb/gadget/udc/atmel_usba_udc.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c index 27c16399c7e8..0fe3d0feb8f7 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.c +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c @@ -417,7 +417,7 @@ static inline void usba_int_enb_set(struct usba_udc *udc, u32 val) static int vbus_is_present(struct usba_udc *udc) { if (udc->vbus_pin) - return gpiod_get_value(udc->vbus_pin) ^ udc->vbus_pin_inverted; + return gpiod_get_value(udc->vbus_pin); /* No Vbus detection: Assume always present */ return 1; @@ -2076,7 +2076,6 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev, udc->vbus_pin = devm_gpiod_get_optional(&pdev->dev, "atmel,vbus", GPIOD_IN); - udc->vbus_pin_inverted = gpiod_is_active_low(udc->vbus_pin); if (fifo_mode == 0) { pp = NULL; diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.h b/drivers/usb/gadget/udc/atmel_usba_udc.h index 969ce8f3c3e2..d7eb7cf4fd5c 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.h +++ b/drivers/usb/gadget/udc/atmel_usba_udc.h @@ -326,7 +326,6 @@ struct usba_udc { const struct usba_udc_errata *errata; int irq; struct gpio_desc *vbus_pin; - int vbus_pin_inverted; int num_ep; int configured_ep; struct usba_fifo_cfg *fifo_cfg;