Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp554798rwr; Wed, 3 May 2023 02:46:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ72APsjpma/zezKRlE585REKw2rbQdo/gWSqHjeDaSRkBvieQF+bZaPn+IxkAJ/Q7OT8UlZ X-Received: by 2002:a17:90a:fb4a:b0:246:9517:30b6 with SMTP id iq10-20020a17090afb4a00b00246951730b6mr1845620pjb.4.1683107174219; Wed, 03 May 2023 02:46:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683107174; cv=none; d=google.com; s=arc-20160816; b=zCj9OPOTtGAJgT8CCX48GmgMsz6rSDxKZKXRanKqxr1zBey4wLsf6QnjFoKfwVYC75 KtPQXawvVXUjoGvaFVgBo5n+5K7NYxU+72F802bvUOBgl5TN/MwFGRyrjnn3BDa90j1m ziTbUcr/i2zr+W2jYhmq8N6yfFICzr39fP8FuU11rlmN6Vz8opewEFXdKQvsElDZZ/jN vKR5xRVMbVwzt0hoiqIQaojzJh9f40qPoFX//9qcbzJXm+s7R9JWUdBMT5rAinMxcYF1 3XqCDY+guMn5y/ruxszx9ZoncWYL4K9JZGJ6V4oQMdLmHxCsles3ORvJrF75ULClkZGR 1ZkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=UswhBddqVaXIV7KahhOAL0L+vAcJJ2NqdC/L7ARqHLI=; b=e9fe2fmU4JZ/T6NUk47okXLE5k3NaXnFGahoNm7en6724RcKGw83keOBSdgA6rBa6r NP/ZFBO/XZBosAe7xp1s6qLA2EEM7qryg6qcliIO6gXZ+GYmCIT1nynpWLiEtWbenmRA XI1nk3aCpIkXxhnSVjmybbcidaD4I3AviGwRjRch8ZgsoWf+eFjCIqD7LazV8FQGYu3c saJ1pYNigbSeiFkwAKQMYSPOAljhoMXUKTuoEzD7VIdX8MjVeXAhYyZ2bbIqAVf0SYT7 ZQcappJGNEzQhcdYQoJ5Y24uHn8BQErUissI5J+9tVI0M5QR6qRjHWJExxKFhqpE4clm +I1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=bBkeJTcu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e191-20020a6369c8000000b00524ecfa05d8si27317464pgc.15.2023.05.03.02.46.01; Wed, 03 May 2023 02:46:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=bBkeJTcu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229945AbjECJmk (ORCPT + 99 others); Wed, 3 May 2023 05:42:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229515AbjECJmg (ORCPT ); Wed, 3 May 2023 05:42:36 -0400 Received: from mail-qk1-x732.google.com (mail-qk1-x732.google.com [IPv6:2607:f8b0:4864:20::732]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32A6E4ED3; Wed, 3 May 2023 02:42:34 -0700 (PDT) Received: by mail-qk1-x732.google.com with SMTP id af79cd13be357-75131c2997bso144244485a.1; Wed, 03 May 2023 02:42:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683106953; x=1685698953; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=UswhBddqVaXIV7KahhOAL0L+vAcJJ2NqdC/L7ARqHLI=; b=bBkeJTcutU1gEMmYbPqloKEmhZKGZR3vpAPR7Ly0UkZvZDSfS7SqZtHaoocQe4Xkua ruNsGSw4EPvXfAczKkPscYyr7DOnesMtTPrEsZwtu/v8VA0C2oPy8KAiyqUYmd4ST1Mt F4a3P3xeHlxoRjr5qfxHgTvKW5G2kHD979Wo+p2GYDISigYAmzacBXZdDX2UkDVJbLAH K2v1SDwptNS+y+cBH86OVLtfuf3Hdu4FcHBkXnoXoAD6u7Q3fOEHAn51J3tzAGuQsvKG Wsge8r7s9YnWEYWFCkvC2AAVGeD6+Kb/zJq0qmgLAME0Ci2Bt1iJtx0ORC3WEsRfb2uV 9b/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683106953; x=1685698953; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UswhBddqVaXIV7KahhOAL0L+vAcJJ2NqdC/L7ARqHLI=; b=U39WTqd3NMwtFhujE19T71JNvVgRVzaD+WtGaBNJHhoZQ6b70O4zAdilUuaoxcL15A WSfbouWYDkmgR3oOFcADg9rf9VUYGTuU2LuA5vTtZcaZDMFU2AdYY+geLGxHvBM7YL8w eqV64Y3mMdyQB7TC+s0zBFlk4jtnOcLWIPNKNfI4+t+8BYDjJ6AX6eOvLPBkP0I6y3CA 34NEYFB3tX/09i6tDPvUrM9xirBpsgM52UgzghR9FE22MIaUPm2q8yEMOydpJi+Khf7s XlB5HVkztC7TFQVsGGVYlY42PD5FZkqJ8T7q2WzBHHGAV/0B19Vy8RFUZRdUf96o6sMV wEWQ== X-Gm-Message-State: AC+VfDwJdsLUXhkIEKJiaMtj3Owk4CzhIIWxuUso1ZY08IQUqmWixlOB caO/UaOKRdcqEW+rF3F3t0IIypJ5CoWTP6oA1/s= X-Received: by 2002:a05:6214:d64:b0:5ef:653e:169b with SMTP id 4-20020a0562140d6400b005ef653e169bmr2275095qvs.8.1683106953183; Wed, 03 May 2023 02:42:33 -0700 (PDT) MIME-Version: 1.0 References: <1683092380-29551-1-git-send-email-quic_rohiagar@quicinc.com> <1683092380-29551-3-git-send-email-quic_rohiagar@quicinc.com> In-Reply-To: <1683092380-29551-3-git-send-email-quic_rohiagar@quicinc.com> From: Andy Shevchenko Date: Wed, 3 May 2023 12:41:56 +0300 Message-ID: Subject: Re: [PATCH v5 2/3] pinctrl: qcom: Refactor target specific pinctrl driver To: Rohit Agarwal Cc: agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, linus.walleij@linaro.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, richardcochran@gmail.com, manivannan.sadhasivam@linaro.org, linux-arm-msm@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 3, 2023 at 8:39=E2=80=AFAM Rohit Agarwal wrote: > > Update the msm_function and msm_pingroup structure to reuse the generic structures > pinfunction and pingroup structures. Also refactor pinctrl drivers to adj= ust > the new macro and updated structure defined in pinctrl.h and pinctrl_msm.= h > respectively. Thanks for this, my comments below. ... > #define FUNCTION(fname) \ > [APQ_MUX_##fname] =3D { \ > - .name =3D #fname, \ > - .groups =3D fname##_groups, \ > - .ngroups =3D ARRAY_SIZE(fname##_groups), \ > - } > + .func =3D PINCTRL_PINFUNCTION(#fname, = \ > + fname##_groups, \ > + ARRAY_SIZE(fname##_groups)) = \ > + } Does it really make sense to keep an additional wrapper data type that does not add any value? Can't we simply have #define FUNCTION(fname) [...fname] =3D PINCTRL_PINFUNCTION(...) ? ... > + .grp =3D PINCTRL_PINGROUP("gpio"#id, gpio##id##_pins, = \ > + (unsigned int)ARRAY_SIZE(gpio##id##_pins)), \ Why do you need this casting? Same Q to all the rest of the similar cases. ... > +#include Keep it separate, and below the generic ones... > #include > #include > ...like here (note also a blank line). ... > /** > * struct msm_function - a pinmux function > - * @name: Name of the pinmux function. > - * @groups: List of pingroups for this function. > - * @ngroups: Number of entries in @groups. > + * @func: Generic data of the pin function (name and groups of pins) > */ > struct msm_function { > - const char *name; > - const char * const *groups; > - unsigned ngroups; > + struct pinfunction func; > }; But why? Just kill the entire structure. ... > #define FUNCTION(fname) \ This definition appears in many files, instead you can make a generic to this drivers one and use it here #define QCOM_FUNCTION(_prefix_, _fname_) [_prefix_##_fname_] =3D PINCTRL_PINFUNCTION(...) #define FUNCTION(fname) QCOM_FUNCTION(msm_mux, fname) (this just a pseudocode, might not even be compilable) > [msm_mux_##fname] =3D { \ > - .name =3D #fname, \ > - .groups =3D fname##_groups, \ > - .ngroups =3D ARRAY_SIZE(fname##_groups), \ > + .func =3D PINCTRL_PINFUNCTION(#fname, = \ > + fname##_groups, \ > + ARRAY_SIZE(fname##_groups)) = \ > } --=20 With Best Regards, Andy Shevchenko