Received: by 2002:ab2:5c0e:0:b0:1ef:a325:1205 with SMTP id i14csp68576lqk; Wed, 13 Mar 2024 16:56:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVMGz7ItOAav2jKuGll/qWVWToeFw4xxOxf3XBPd6N2kyB4yDXh616u07AohOJFwG/0YJL7Q/F+oiPO86nsEaMb3v3vy50EIZ52lsF5TA== X-Google-Smtp-Source: AGHT+IFgnOBUxUvYLpi68dhBpBidi/CS/PCMrhtYFxFy2rga3FX83+z2nTmhZlI6WrfZoTLjKOLv X-Received: by 2002:a05:620a:29d4:b0:789:d0da:79d1 with SMTP id s20-20020a05620a29d400b00789d0da79d1mr648716qkp.21.1710374214684; Wed, 13 Mar 2024 16:56:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710374214; cv=pass; d=google.com; s=arc-20160816; b=no/TaSLA5TKNLmk1Q6273JhHsgvGtmPhBYhq8TvRZGmBLMNR/TpHovM2zVRmQVJsU1 i7yzbkJyOtP3D3qQSCJI42LQGID0S0trd3//vVbdk2AxjiIHYWnuAlrusYO7m2TB4n2y xMdBbCmqRFGzuwitylGj3Y/Ml8ZzvRpwcn00Ar8nYYqYgKLHOOM6O0IrClhu3ngwUzW2 HrmWaS/QmfZvAmh99Tc7pwX/VvOlkArdeWd4QcZAT9R4XYNDDjQCVwEXkXNVTS5Agy6o /ITYC5elSWWeInf1DHBCwyi2sn1zYap2FMN8Q09m7dLdMIBXBTuuGGWxexFoGg23oAOA Cm0Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=G4GckBs4JasQ0HyRPiWpc/x8x6igt+2gtGhOZIkLdTU=; fh=gZClyzT/eJjApr5eNXSCZCyUGDwc0nMn1hVkLcyIyUY=; b=hzQFezCA72DiAo1d/aHbZNt4xS/0Yx8Y286HQjjdYGxp1qn76JxJH+osc/FzqbZbzg 3Y864GB0Q6etsTAbXgPAfyE6affBMu9yJXycA4U70XpaK1if8+dLVdhdvA7KIsBwdCmr eDRlEBBjfzEBKqPdRK5pwyAGRavp0GVgtzzrwTpVBMwJYiFQnwTcRLZOihEx5Ihn/yF1 oif3DVT+8t8KAePBGxsiklD2+Zvh5UDDjFFdWs4U3Ai2NfRZwL8iosYqU7gWQVXUUZMw v2bNdHdNQrs3WdLMNgIALglSwnkdHm8mXDR9ls3gCGgKJpPOrbw3YCxN1Q5beLu/e9rk hUGg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-102662-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102662-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id r20-20020a05620a299400b007882aba13eesi331202qkp.569.2024.03.13.16.56.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 16:56:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-102662-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-102662-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102662-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 68E531C20D02 for ; Wed, 13 Mar 2024 23:56:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DAEB55E06E; Wed, 13 Mar 2024 23:55:39 +0000 (UTC) Received: from fgw23-7.mail.saunalahti.fi (fgw23-7.mail.saunalahti.fi [62.142.5.84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AAD641E480 for ; Wed, 13 Mar 2024 23:55:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.142.5.84 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710374139; cv=none; b=UeGiElnJqRYj6zo1LzfI/MQ8DzE3uw28IOLsgDP4Vp0oEjEkhyNn+GXhxIjS9hBZ+xJPjfx7Ngxe0vWW9GlJTjNIx9FjKSWUSOcMOL+wLWEJpsNVzFSUxfyznlRfDMeqnCJZaw5UO0V6eaJVCiU7gwYZlfDsmu0+URBdO2uV4RA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710374139; c=relaxed/simple; bh=8D7jTV0xn/0mDBGlZq6fj5SKZW5PkOCJZRDVQD3dKCs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=K2jwMns45fD82YdLY1QDBWP5siZdsgTFH3OCRUXAqBCysYEQbVvjoOr49/jEZwonjmFYP0+LyYEIXRH9umIt/KT8C4v60wAg9F0NjXw1z9wBZRHpCZ9xrki0s+xfYEpvPjJe6ZLz34h+djEPfoF4WMDqrLGf59qLLstmVWzTTJo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=fail smtp.mailfrom=gmail.com; arc=none smtp.client-ip=62.142.5.84 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=gmail.com Received: from localhost (88-113-26-217.elisa-laajakaista.fi [88.113.26.217]) by fgw23.mail.saunalahti.fi (Halon) with ESMTP id 06ec8550-e195-11ee-b972-005056bdfda7; Thu, 14 Mar 2024 01:54:27 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Andy Shevchenko , AngeloGioacchino Del Regno , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v1 04/11] pinctrl: aw9523: Make use of struct pinfunction and PINCTRL_PINFUNCTION() Date: Thu, 14 Mar 2024 01:52:07 +0200 Message-ID: <20240313235422.180075-5-andy.shevchenko@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240313235422.180075-1-andy.shevchenko@gmail.com> References: <20240313235422.180075-1-andy.shevchenko@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Andy Shevchenko Since pin control provides a generic data type and a macro for the pin function definition, use them in the driver. Signed-off-by: Andy Shevchenko --- drivers/pinctrl/pinctrl-aw9523.c | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-) diff --git a/drivers/pinctrl/pinctrl-aw9523.c b/drivers/pinctrl/pinctrl-aw9523.c index d93640a02d1d3..79916e6bf6f4e 100644 --- a/drivers/pinctrl/pinctrl-aw9523.c +++ b/drivers/pinctrl/pinctrl-aw9523.c @@ -66,18 +66,6 @@ struct aw9523_irq { u16 cached_gpio; }; -/* - * struct aw9523_pinmux - Pin mux params - * @name: Name of the mux - * @grps: Groups of the mux - * @num_grps: Number of groups (sizeof array grps) - */ -struct aw9523_pinmux { - const char *name; - const char * const *grps; - const u8 num_grps; -}; - /* * struct aw9523 - Main driver structure * @dev: device handle @@ -158,17 +146,9 @@ static const char * const gpio_pwm_groups[] = { }; /* Warning: Do NOT reorder this array */ -static const struct aw9523_pinmux aw9523_pmx[] = { - { - .name = "pwm", - .grps = gpio_pwm_groups, - .num_grps = ARRAY_SIZE(gpio_pwm_groups), - }, - { - .name = "gpio", - .grps = gpio_pwm_groups, - .num_grps = ARRAY_SIZE(gpio_pwm_groups), - }, +static const struct pinfunction aw9523_pmx[] = { + PINCTRL_PINFUNCTION("pwm", gpio_pwm_groups, ARRAY_SIZE(gpio_pwm_groups)), + PINCTRL_PINFUNCTION("gpio", gpio_pwm_groups, ARRAY_SIZE(gpio_pwm_groups)), }; static int aw9523_pmx_get_funcs_count(struct pinctrl_dev *pctl) @@ -184,10 +164,10 @@ static const char *aw9523_pmx_get_fname(struct pinctrl_dev *pctl, static int aw9523_pmx_get_groups(struct pinctrl_dev *pctl, unsigned int sel, const char * const **groups, - unsigned int * const num_groups) + unsigned int * const ngroups) { - *groups = aw9523_pmx[sel].grps; - *num_groups = aw9523_pmx[sel].num_grps; + *groups = aw9523_pmx[sel].groups; + *ngroups = aw9523_pmx[sel].ngrpoups; return 0; } -- 2.44.0