Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1848793rdh; Tue, 26 Sep 2023 05:35:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGmS8M4aLQV+Bm4d9OGh5yEFqCNbwTITHr3sQZm65H5hdk5G7ktUigVmNaCYsxVe5FEqPb8 X-Received: by 2002:a05:6a00:10c6:b0:692:b429:390 with SMTP id d6-20020a056a0010c600b00692b4290390mr10867178pfu.29.1695731758333; Tue, 26 Sep 2023 05:35:58 -0700 (PDT) Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id h12-20020a056a00230c00b0068ff741579fsi13176853pfh.318.2023.09.26.05.35.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 05:35:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=eg5ENCGJ; arc=fail (DNS record missing); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id D28ED81DE39A; Mon, 25 Sep 2023 20:29:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233530AbjIZD30 (ORCPT + 99 others); Mon, 25 Sep 2023 23:29:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233498AbjIZD3T (ORCPT ); Mon, 25 Sep 2023 23:29:19 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2051.outbound.protection.outlook.com [40.107.6.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE991E9; Mon, 25 Sep 2023 20:29:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OcCQj1UB5cm2W1CPs5DYSUE4rd/csDoGqQXiFIgNrNS+0u9Wk+kBIwPb4yQCm94bxg/Wcn4DgxtQIzhi4x3ov39XIrOoVcTSML03Os9AuyI4Aaejnms8vMC+xi99U/m+NZmzaEgHnXXlupPo+e985qS97Niaj+N6vyAppkHAlINRjKalwB6HUXEQIjD7MxY8q+i2Yhl2m/jtGenKDHZqyeRG+rLYxIt6eM9Xy/vznY8nBB7wUcBeYZpANkFORIUNZ9tGHUbiHq3Tmvu8n8jrlI0WHz0+Nc01GJRsOTULDytQqskmnU4FVK3FKUxgEWakGiVgNT6CEsA5RZKypa1pJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3x9H1Ce1qmUmynZ0C+sr8L+tCdY5jnEewoTuImSmj+c=; b=SYA7ltTuq6gQ2tff3oVU2184UzKHIo2F9gah/wXsdJfcF7jNyNhmUha296UKhQ3tP96vzE843Y7W2lnk2S4UUS7VNzgbybuT+rUx/U+UmyTRcFdt4+Qb7ybAXxTZkpG+tRlu7cwRJ5TrKnr/fdyNVYRoE70THB5HbetxPB0oYc9kM8cbvBxwoXoZfQhTXxFNwHI8UYmRM0mJiMMsB6xQDAjrHC0IJqxKfeCwD0z/CL4yiMBIWj1djVBzE+dwXxYdtcVa7Dk6GkUns2y9zFM9hYI+IXcSC9Fu3GM4gsCg5ba+60EFmAbd1GVRXzz969c6lJLGHBnYo8G1+egQTvr9Dg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3x9H1Ce1qmUmynZ0C+sr8L+tCdY5jnEewoTuImSmj+c=; b=eg5ENCGJ406G9XxUNCVvhmKcOd5Ocye+vpF2LiE4uIRnluSKy9faIIpT5OFdaSNva3DJk4hSnJiXRnGDf7w/GBJi4DT4I/xn80nsqNXlhMNxi45/YFaNEMEIoZaZ6UjEr3x4FPR+6r4qog3ntGd1rgZUQ1FMzZy3UgUm8ui/w0Q= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by AS8PR04MB8436.eurprd04.prod.outlook.com (2603:10a6:20b:347::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.28; Tue, 26 Sep 2023 03:29:10 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::2b3:d8de:95c8:b28b]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::2b3:d8de:95c8:b28b%3]) with mapi id 15.20.6813.027; Tue, 26 Sep 2023 03:29:10 +0000 From: "Peng Fan (OSS)" Date: Tue, 26 Sep 2023 11:33:21 +0800 Subject: [PATCH v4 5/7] gpio: vf610: simplify code by adding of_device_id data for vf610 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230926-vf610-gpio-v4-5-b57b7f6e8368@nxp.com> References: <20230926-vf610-gpio-v4-0-b57b7f6e8368@nxp.com> In-Reply-To: <20230926-vf610-gpio-v4-0-b57b7f6e8368@nxp.com> To: Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Stefan Agner , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Marco Felsch Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Peng Fan X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1695699209; l=2667; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=6f39vc2cftNdy+/GaahiBhBp1bGlVPLOucytL1yIoAw=; b=GHK0VJqZSSbmQY15QcyO9yutCxZdbcD+4lti8idqyJIhChzz+qc79NZfDXFcp4QSQl7pTAD+C cGGCTjf8J2XCOTmqhDJvXZ8A2qdfL4JW1ER68DNSRWhFIKBFXp8iEq8 X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0054.apcprd02.prod.outlook.com (2603:1096:4:54::18) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|AS8PR04MB8436:EE_ X-MS-Office365-Filtering-Correlation-Id: bd04cf7d-522c-4dd4-2655-08dbbe40bf7e X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RP8SFdOF0YBqZ/26+z+ot4RCUy36X1+LhSi+9K5AFvam9kYhNNP44e2xHvesJW9xHDJJWyPABSYbftd1LisTxNhr2lJ0dzkg7OAN3PK0Ic49ehyZ1gJQ7oGOZVM3jmGfiewUFS+0GKEEichEK08jmhLNtx/FORXzwRnM6ZXXRC6kWUtrP3VRmJMG1Q20doqlIKgTSRLDSjfdJjdZDmAj4LiTdTBIzdg7x+DglJBjx8gDyYBqnXquwseHf7X5rtX3YlfAS3BzOf79HNDQAr13IE+1mOtKtqU04jaubCDZDVlCgHoHwp7TgVpCwj48fqVUo+8un1faQdfuMvN5yH/gGKQr3MasvVVH+BNc6uLCQDGbHo34uLSugQN6pd+5zJq8pf9s+wxtPT1bANsccsLTCHLp1KB+N+vkQaNFd046AWMu1HvYTGr0Rz6fWFNPZMK34MC9MBjNNLJld8uehAyYNyNHQxwMmqiRUCxXM0up7pUCozJt9PXJEx/JrRO8se0tmzTXPtTrs6chali4jZD195+VDvYY6W2Zf9A/EY1WETsSmrnDjhuUvSXiiZB6KTGSYEz8BjV0afbkTC2VtPtAvPMvoTz6wp0JMHfAyjWYf/cXgN8YQSxM98ZUTYKqGxCQ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9417.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(136003)(39860400002)(376002)(366004)(346002)(230922051799003)(1800799009)(451199024)(186009)(41300700001)(8936002)(4326008)(8676002)(7416002)(66476007)(66946007)(66556008)(316002)(26005)(110136005)(86362001)(2906002)(921005)(6486002)(478600001)(38350700002)(83380400001)(36756003)(52116002)(38100700002)(6666004)(6512007)(9686003)(5660300002)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Q0FjWlREcmVIVFBHdEtaOERIb2VjY3BXcmY1aFdVZ3EzR0dZSy9OWlRveThX?= =?utf-8?B?S3dBYm1UVFhmSTh3MWU2bjh1NW1zMXV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czk5YkpFSkJj?= =?utf-8?B?WEplaExxcjVoeEI3OTdFUzdzdXFNQ2NSL09YUWJkSkd1VDNPRnd6Q0FyQTJH?= =?utf-8?B?Si94OExQMnoxY3BQVURaTkdZOTAwalQ0Z1pRakk1YjRocFhqUkFjKzNkSkhT?= =?utf-8?B?QTdzR1pSMTJKVFJkUE9TczlVSDVCRkh5L3JHM0hUWkVFU1FrTDVDNGtJdTdx?= =?utf-8?B?L3ppVTZqNmxQa3JWd0ZDajZiNHlyQkNxWnNiQVU3aGxwdFB5VXhpTTJGS0ZZ?= =?utf-8?Q?88SgeyAppQZLgwgE+aYV/Raz4?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bd04cf7d-522c-4dd4-2655-08dbbe40bf7e X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2023 03:29:10.4137 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jfN0lspNCtaju7KSpxg+Jh3+FTWFLKhNBVoYhLoVx97ShjN/BnUwqnkCjZ1eSQVIhrdoGNYDvwiDHDe38PDuJg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8436 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 25 Sep 2023 20:29:32 -0700 (PDT) From: Peng Fan Add of_device_id data for devices compatible with fsl,vf610-gpio, then no need to check port->sdata is NULL or not. So code simplified a bit. Signed-off-by: Peng Fan --- drivers/gpio/gpio-vf610.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c index 49867d5db642..c48a3bdfb942 100644 --- a/drivers/gpio/gpio-vf610.c +++ b/drivers/gpio/gpio-vf610.c @@ -64,6 +64,10 @@ struct vf610_gpio_port { #define IMX8ULP_GPIO_BASE_OFF 0x40 #define IMX8ULP_BASE_OFF 0x80 +static const struct fsl_gpio_soc_data vf610_data = { + .have_dual_base = true, +}; + static const struct fsl_gpio_soc_data imx_data = { .have_paddr = true, .have_dual_base = true, @@ -74,7 +78,7 @@ static const struct fsl_gpio_soc_data imx8ulp_data = { }; static const struct of_device_id vf610_gpio_dt_ids[] = { - { .compatible = "fsl,vf610-gpio", .data = NULL, }, + { .compatible = "fsl,vf610-gpio", .data = &vf610_data }, { .compatible = "fsl,imx7ulp-gpio", .data = &imx_data, }, { .compatible = "fsl,imx8ulp-gpio", .data = &imx8ulp_data, }, { /* sentinel */ } @@ -96,7 +100,7 @@ static int vf610_gpio_get(struct gpio_chip *gc, unsigned int gpio) unsigned long mask = BIT(gpio); unsigned long offset = GPIO_PDIR; - if (port->sdata && port->sdata->have_paddr) { + if (port->sdata->have_paddr) { mask &= vf610_gpio_readl(port->gpio_base + GPIO_PDDR); if (mask) offset = GPIO_PDOR; @@ -120,7 +124,7 @@ static int vf610_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) unsigned long mask = BIT(gpio); u32 val; - if (port->sdata && port->sdata->have_paddr) { + if (port->sdata->have_paddr) { val = vf610_gpio_readl(port->gpio_base + GPIO_PDDR); val &= ~mask; vf610_gpio_writel(val, port->gpio_base + GPIO_PDDR); @@ -136,7 +140,7 @@ static int vf610_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, unsigned long mask = BIT(gpio); u32 val; - if (port->sdata && port->sdata->have_paddr) { + if (port->sdata->have_paddr) { val = vf610_gpio_readl(port->gpio_base + GPIO_PDDR); val |= mask; vf610_gpio_writel(val, port->gpio_base + GPIO_PDDR); @@ -287,7 +291,7 @@ static int vf610_gpio_probe(struct platform_device *pdev) (device_is_compatible(dev, "fsl,imx8ulp-gpio")))) dual_base = true; - if ((port->sdata && port->sdata->have_dual_base) || dual_base) { + if (port->sdata->have_dual_base || dual_base) { port->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(port->base)) return PTR_ERR(port->base); -- 2.37.1