From patchwork Tue Jan 3 17:00:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 710537 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3ttKvj3PBgz9s1h for ; Wed, 4 Jan 2017 04:00:49 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759876AbdACRAg (ORCPT ); Tue, 3 Jan 2017 12:00:36 -0500 Received: from mga14.intel.com ([192.55.52.115]:56703 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753016AbdACRAc (ORCPT ); Tue, 3 Jan 2017 12:00:32 -0500 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP; 03 Jan 2017 09:00:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,455,1477983600"; d="scan'208";a="918499607" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 03 Jan 2017 09:00:21 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id CE340E4; Tue, 3 Jan 2017 19:00:20 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , linux-gpio@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v1 1/1] gpio: devres: Use global array of gpio suffixes Date: Tue, 3 Jan 2017 19:00:20 +0200 Message-Id: <20170103170020.35844-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.11.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org We have already a global array of possible GPIO suffixes. Use it here instead of another copy of them. Unfortunately this will not reduce the memory footprint, though allows to easy maintain list in only one place. Signed-off-by: Andy Shevchenko --- drivers/gpio/devres.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/devres.c b/drivers/gpio/devres.c index b760cbbb41d8..54da61112752 100644 --- a/drivers/gpio/devres.c +++ b/drivers/gpio/devres.c @@ -21,6 +21,8 @@ #include #include +#include "gpiolib.h" + static void devm_gpiod_release(struct device *dev, void *res) { struct gpio_desc **desc = res; @@ -135,7 +137,6 @@ struct gpio_desc *devm_get_gpiod_from_child(struct device *dev, const char *con_id, struct fwnode_handle *child) { - static const char * const suffixes[] = { "gpios", "gpio" }; char prop_name[32]; /* 32 is max size of property name */ struct gpio_desc **dr; struct gpio_desc *desc; @@ -146,13 +147,13 @@ struct gpio_desc *devm_get_gpiod_from_child(struct device *dev, if (!dr) return ERR_PTR(-ENOMEM); - for (i = 0; i < ARRAY_SIZE(suffixes); i++) { + for (i = 0; i < ARRAY_SIZE(gpio_suffixes); i++) { if (con_id) snprintf(prop_name, sizeof(prop_name), "%s-%s", - con_id, suffixes[i]); + con_id, gpio_suffixes[i]); else snprintf(prop_name, sizeof(prop_name), "%s", - suffixes[i]); + gpio_suffixes[i]); desc = fwnode_get_named_gpiod(child, prop_name); if (!IS_ERR(desc) || (PTR_ERR(desc) != -ENOENT))