From patchwork Tue Jan 2 10:32:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10140259 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 AFE476034B for ; Tue, 2 Jan 2018 10:35:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87BD328AB3 for ; Tue, 2 Jan 2018 10:35:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78E2328ABE; Tue, 2 Jan 2018 10:35:00 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, 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 E77E728AB3 for ; Tue, 2 Jan 2018 10:34:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752455AbeABKe6 (ORCPT ); Tue, 2 Jan 2018 05:34:58 -0500 Received: from mail-lf0-f68.google.com ([209.85.215.68]:41265 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752198AbeABKe6 (ORCPT ); Tue, 2 Jan 2018 05:34:58 -0500 Received: by mail-lf0-f68.google.com with SMTP id h137so11069952lfe.8 for ; Tue, 02 Jan 2018 02:34:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=HLE7xKupW9DVHH+yY0HhVh7ovJARwfI/RDuzZm8gPcY=; b=BYlwyIj4UJWUZyAbI2vQvk4VFFC6gglp173aM0wvEcQf5m4h9VjFSyU0voMOUw6szO Ae7nCUWTuUEfbWIrTV0xanbSUp5KyElp8omJS+ojlwkrJodz6yNNggGYliW2kBz+uqyl m/LH4i9HNWb81ycRl9JAi7vhhMiKZOhtY97qw= 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; bh=HLE7xKupW9DVHH+yY0HhVh7ovJARwfI/RDuzZm8gPcY=; b=jC4HB2dEH4HxfIkYm2HYJ8MdcelppQei4jaDh7CkD34LPgMvsCTpJxLt3O25R9/3B4 vgG3AWEqewLQbbXg6D6ehhNctUlSBf7HoRoxdWZSOCydANZC5nfPD3p/F5B/TMFl6XNt bCqJVlECprG48V/P+bqkYTUBu25XE6Q1Wa5CZttgFsR/gxLYA6CiyIYfsUh2eh4f9lEl MlKyWeLtia43fj1M1r3o7EdQQ8UFhvSfPiUJJ/acSN3WWVktdn83h21ceTeyQ0On2JCW WA2nO43RQ8b2DB6OdqU78Ti7khHfQtxDCxgfzkhS7/Jyg7eJTMxxTgV5JW8TFjQCuAv/ o+dw== X-Gm-Message-State: AKGB3mK3lTiBNbhdiwgYCA3LUD9YlzdCH0OpuYZvIC+Hf6da8B7UzVya bK/vtmt2O3YDzSRxdkhQNBXIcw== X-Google-Smtp-Source: ACJfBovxPCWQHO2IXNkxIfewyyC85BsTgNp0DsHtKa+mI2XDSDSvpj/qslV3yfEuspYJF3OJI20biw== X-Received: by 10.46.89.2 with SMTP id n2mr26850019ljb.149.1514889296689; Tue, 02 Jan 2018 02:34:56 -0800 (PST) Received: from localhost.localdomain (c-cb7471d5.014-348-6c756e10.cust.bredbandsbolaget.se. [213.113.116.203]) by smtp.gmail.com with ESMTPSA id l73sm5813658lfi.80.2018.01.02.02.34.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Jan 2018 02:34:55 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Linus Walleij , Grygorii Strashko , Santosh Shilimkar , Kevin Hilman , linux-omap@vger.kernel.org Subject: [PATCH v2] gpio: omap: Give unique labels to each GPIO bank/chip Date: Tue, 2 Jan 2018 11:32:48 +0100 Message-Id: <20180102103248.15803-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As we need to add GPIO lookup tables to the OMAP platforms, we need to reference each GPIO chip with a unique label. Use the GPIO base to name each chip, "gpio-0-31", "gpio-32-63" etc. Cc: Grygorii Strashko Cc: Santosh Shilimkar Cc: Kevin Hilman Cc: linux-omap@vger.kernel.org Signed-off-by: Linus Walleij Acked-by: Grygorii Strashko --- ChangeLog v1->v2: - Break out errorpath fix to a separate patch. --- drivers/gpio/gpio-omap.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index d83e8624964a..ed07bbcede01 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -1059,6 +1059,7 @@ static void omap_gpio_mod_init(struct gpio_bank *bank) static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc) { static int gpio; + const char *label; int irq_base = 0; int ret; @@ -1080,7 +1081,11 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc) bank->chip.parent = &omap_mpuio_device.dev; bank->chip.base = OMAP_MPUIO(0); } else { - bank->chip.label = "gpio"; + label = devm_kasprintf(bank->chip.parent, GFP_KERNEL, "gpio-%d-%d", + gpio, gpio + bank->width - 1); + if (!label) + return -ENOMEM; + bank->chip.label = label; bank->chip.base = gpio; } bank->chip.ngpio = bank->width;