From patchwork Mon Aug 28 15:31:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 137047 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a7d1:0:b0:3f2:4152:657d with SMTP id p17csp3427518vqm; Mon, 28 Aug 2023 09:05:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFPq2hheza/wHTRljJwXStiLvIO0YBwDIwI4J/uhbo/3vqhPL7b9iqg6iAXCuimRUiKVkw4 X-Received: by 2002:a17:902:c943:b0:1bf:25a0:f874 with SMTP id i3-20020a170902c94300b001bf25a0f874mr31831493pla.65.1693238750042; Mon, 28 Aug 2023 09:05:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693238750; cv=none; d=google.com; s=arc-20160816; b=Yadx97CQoXVYkb78Jmlk78b97CxXWsAJxqBMvdP7ZaWkFYjmggECca4Xw+nVpU6Q5J EB40t+f12DHhm7CduvRK9wmH9GtPuD5Ze91s1eJQJL8AHiWxQYqWlKWLfibEu+I4spYW Kr09TAPvUf0CpijHAIwDh1lZZvKIMvqkk+tZUDxJ+8C0dehlSVZu5sPJ3585tyQ3x0Oq 6n8dVS7LUiBuF6HQZVvy9ERsHSCxjo34ir82G+ZxDHofs4n6dd4G4uoIjcar+xt1/7sc q9A2N5ubCS3QpJ/u0roo6VPI+LoIR0Zyr+yv9d+JOIVGo67uQbyelgwsqnaqgk6lbztR 8BZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=hvvrcjmZ1vvNApQOmG6/y2qDMEumutcP/TZ/DjVow/Q=; fh=VdeWdNv2Y3HwtDbQJ/FB5+bX4+EoEjY9/LxfbUHZuDA=; b=toxAvkvBMetf6TgZnYlDBfhlZWJsuAAz7RyBZJ3oCEhZIbpEzugjEp2/UkFHUB8QOv dYG1UL5ObJ8eO6zx7MugYDPDM+iGvESMHOlOZczqwJepwVrNNLt6IQrUAP2INrqfWSfL 52B5Dq6ScbzFgkmeEUxPXOk4FGHaCfzPIpjxRRKdIJm1S/iuaz1+3P8QatawdggJCflP E4Cpd0KOyM8Oy4/JUi9XWU6NHNxKatuZiGiRYAQxa+HFk3tAEHK1JS7GdRXiX5RBmUNt IrU71eyiX7wZ0cdsGY0liqtITZDQ5B5DNFL9g2Y7OmCTkyBTp+xakzpoOPH6Rbw3ynM0 65nA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d13-20020a170902cecd00b001b9da8b4eb8si4088374plg.373.2023.08.28.09.05.20; Mon, 28 Aug 2023 09:05:50 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230347AbjH1PcL (ORCPT + 99 others); Mon, 28 Aug 2023 11:32:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230047AbjH1Pby (ORCPT ); Mon, 28 Aug 2023 11:31:54 -0400 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8826E125; Mon, 28 Aug 2023 08:31:51 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.02,207,1688396400"; d="scan'208";a="174228506" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 29 Aug 2023 00:31:51 +0900 Received: from localhost.localdomain (unknown [10.226.92.234]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 4435C40065DD; Tue, 29 Aug 2023 00:31:49 +0900 (JST) From: Biju Das To: Tony Lindgren , Lee Jones Cc: Biju Das , linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Shevchenko Subject: [PATCH v2 1/2] mfd: palmas: Constify .data in OF table and {palmas,tps65917}_irq_chip Date: Mon, 28 Aug 2023 16:31:43 +0100 Message-Id: <20230828153144.75479-2-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230828153144.75479-1-biju.das.jz@bp.renesas.com> References: <20230828153144.75479-1-biju.das.jz@bp.renesas.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1775489515274654077 X-GMAIL-MSGID: 1775489515274654077 Constify .data in OF table and {palmas,tps65917}_irq_chip and replace the variable *features->features in struct palmas_driver_data and drop the {palmas,tps659038}_features variables and use their values directly in the named initialization. While at it, drop the inner leading commas for OF match table. Signed-off-by: Biju Das --- v1->v2: * Moved the OF table just above its user. * Removed trailing comma from the terminator entry for the OF table. --- drivers/mfd/palmas.c | 52 ++++++++++++++++---------------------------- 1 file changed, 19 insertions(+), 33 deletions(-) diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c index 6e562bab62e4..3ac9dec2b117 100644 --- a/drivers/mfd/palmas.c +++ b/drivers/mfd/palmas.c @@ -296,7 +296,7 @@ static const struct regmap_irq palmas_irqs[] = { }, }; -static struct regmap_irq_chip palmas_irq_chip = { +static const struct regmap_irq_chip palmas_irq_chip = { .name = "palmas", .irqs = palmas_irqs, .num_irqs = ARRAY_SIZE(palmas_irqs), @@ -309,7 +309,7 @@ static struct regmap_irq_chip palmas_irq_chip = { PALMAS_INT1_MASK), }; -static struct regmap_irq_chip tps65917_irq_chip = { +static const struct regmap_irq_chip tps65917_irq_chip = { .name = "tps65917", .irqs = tps65917_irqs, .num_irqs = ARRAY_SIZE(tps65917_irqs), @@ -463,51 +463,29 @@ static void palmas_power_off(void) __func__, ret); } -static unsigned int palmas_features = PALMAS_PMIC_FEATURE_SMPS10_BOOST; -static unsigned int tps659038_features; - struct palmas_driver_data { - unsigned int *features; - struct regmap_irq_chip *irq_chip; + unsigned int features; + const struct regmap_irq_chip *irq_chip; }; -static struct palmas_driver_data palmas_data = { - .features = &palmas_features, +static const struct palmas_driver_data palmas_data = { + .features = PALMAS_PMIC_FEATURE_SMPS10_BOOST, .irq_chip = &palmas_irq_chip, }; -static struct palmas_driver_data tps659038_data = { - .features = &tps659038_features, +static const struct palmas_driver_data tps659038_data = { .irq_chip = &palmas_irq_chip, }; -static struct palmas_driver_data tps65917_data = { - .features = &tps659038_features, +static const struct palmas_driver_data tps65917_data = { .irq_chip = &tps65917_irq_chip, }; -static const struct of_device_id of_palmas_match_tbl[] = { - { - .compatible = "ti,palmas", - .data = &palmas_data, - }, - { - .compatible = "ti,tps659038", - .data = &tps659038_data, - }, - { - .compatible = "ti,tps65917", - .data = &tps65917_data, - }, - { }, -}; -MODULE_DEVICE_TABLE(of, of_palmas_match_tbl); - static int palmas_i2c_probe(struct i2c_client *i2c) { struct palmas *palmas; struct palmas_platform_data *pdata; - struct palmas_driver_data *driver_data; + const struct palmas_driver_data *driver_data; struct device_node *node = i2c->dev.of_node; int ret = 0, i; unsigned int reg, addr; @@ -535,8 +513,8 @@ static int palmas_i2c_probe(struct i2c_client *i2c) palmas->dev = &i2c->dev; palmas->irq = i2c->irq; - driver_data = (struct palmas_driver_data *) device_get_match_data(&i2c->dev); - palmas->features = *driver_data->features; + driver_data = device_get_match_data(&i2c->dev); + palmas->features = driver_data->features; for (i = 0; i < PALMAS_NUM_CLIENTS; i++) { if (i == 0) @@ -712,6 +690,14 @@ static void palmas_i2c_remove(struct i2c_client *i2c) } } +static const struct of_device_id of_palmas_match_tbl[] = { + { .compatible = "ti,palmas", .data = &palmas_data }, + { .compatible = "ti,tps659038", .data = &tps659038_data }, + { .compatible = "ti,tps65917", .data = &tps65917_data }, + { } +}; +MODULE_DEVICE_TABLE(of, of_palmas_match_tbl); + static const struct i2c_device_id palmas_i2c_id[] = { { "palmas", }, { "twl6035", }, From patchwork Mon Aug 28 15:31:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 137046 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a7d1:0:b0:3f2:4152:657d with SMTP id p17csp3426902vqm; Mon, 28 Aug 2023 09:05:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEqpQx4esmRMG0lx/p9I2Lo3ZykCwZujg9w02nK6QyhW+nF3eOTmFG8bBncfn15nuPUEeox X-Received: by 2002:a05:6808:1904:b0:3a7:612:f62b with SMTP id bf4-20020a056808190400b003a70612f62bmr16279576oib.25.1693238705800; Mon, 28 Aug 2023 09:05:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693238705; cv=none; d=google.com; s=arc-20160816; b=aS6EQp17VYM5EJjMexeFEa0Izl63h9JFlGctfQvsRh4ND9cFFoesFZJZ9phEo8ocOL GY7v4/VePg8BY1EVe2MZ/o0HCkiQzQqkdYJd0Opc9KsHbX+zX0r9j+Spb3U/S3mJ7fM0 ASB38f+tFz3bln2Vafu0QTqKJuQlXi324dELTpKO1SIyPHuNh27Nh6WqFakCDSELqEwU efXicsLGJ7gqLqocw8eQyGR7CsE/lPcDiBkh34Z4bIXR+8B4dm0tZMHr8dNhzrowkokH SayJ+XEZdzaBlRQyfkgRytHlQO4NoUCpW0Pd+qJ0t02Bu26Cuse1305xKmKvXtIEq1PC ScxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=hFJE7bK3Ok9PKFWHOTkxe4x51cFwyFAtNxcXrqaSFys=; fh=VdeWdNv2Y3HwtDbQJ/FB5+bX4+EoEjY9/LxfbUHZuDA=; b=nrxIzyCVEtu3AumQK+TKniCV390cqDl1upMIUV8fPePi2Us3ogol7X/aOjXJiDu/V7 4Ajs+/jJdmn8fMtxDrkOAqETp6ER2fnmmSNEnEQdOjrzrBsb0x12dlmEWT5maS8vQxIt BfFZCpIZqSXIm+5U1d/VCtqWwRQ3Y13oPK7AABMNtIkRpgj2YBzkXPP1UFhCAE+5LASY bMY5WV3dzIx0EBQlUKnSsQLgvisdocpxZkfF/tHZhzPTT692pXZ4hfmu9wPqlNd+kfrz kNNkbRDlDti+wXKjO6pCQLpCBbjvwZKeEpBXiFNLHUsE95wn84YmkKXKq4J1miCpXAgt RpnA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b12-20020a65668c000000b0056aca1f1d5csi7281501pgw.777.2023.08.28.09.04.38; Mon, 28 Aug 2023 09:05:05 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231318AbjH1PcO (ORCPT + 99 others); Mon, 28 Aug 2023 11:32:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230236AbjH1Pb4 (ORCPT ); Mon, 28 Aug 2023 11:31:56 -0400 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 38DECA8; Mon, 28 Aug 2023 08:31:54 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.02,207,1688396400"; d="scan'208";a="174228511" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 29 Aug 2023 00:31:53 +0900 Received: from localhost.localdomain (unknown [10.226.92.234]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id EC83C40065DD; Tue, 29 Aug 2023 00:31:51 +0900 (JST) From: Biju Das To: Tony Lindgren , Lee Jones Cc: Biju Das , linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Shevchenko Subject: [PATCH v2 2/2] mfd: palmas: Make similar OF and ID table Date: Mon, 28 Aug 2023 16:31:44 +0100 Message-Id: <20230828153144.75479-3-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230828153144.75479-1-biju.das.jz@bp.renesas.com> References: <20230828153144.75479-1-biju.das.jz@bp.renesas.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1775489469273914615 X-GMAIL-MSGID: 1775489469273914615 Make similar OF and ID table to extend support for ID match using i2c_match_data(). Currently it works only for OF match tables as the driver_data is wrong for ID match. While at it, drop the inner leading commas for ID table. Signed-off-by: Biju Das --- v1->v2: * Removed trailing comma in the terminator entry for ID table --- drivers/mfd/palmas.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c index 3ac9dec2b117..7fc886f4f80e 100644 --- a/drivers/mfd/palmas.c +++ b/drivers/mfd/palmas.c @@ -513,7 +513,7 @@ static int palmas_i2c_probe(struct i2c_client *i2c) palmas->dev = &i2c->dev; palmas->irq = i2c->irq; - driver_data = device_get_match_data(&i2c->dev); + driver_data = i2c_get_match_data(i2c); palmas->features = driver_data->features; for (i = 0; i < PALMAS_NUM_CLIENTS; i++) { @@ -699,10 +699,10 @@ static const struct of_device_id of_palmas_match_tbl[] = { MODULE_DEVICE_TABLE(of, of_palmas_match_tbl); static const struct i2c_device_id palmas_i2c_id[] = { - { "palmas", }, - { "twl6035", }, - { "twl6037", }, - { "tps65913", }, + { "palmas", (kernel_ulong_t)&palmas_data }, + { "twl6035", (kernel_ulong_t)&palmas_data }, + { "twl6037", (kernel_ulong_t)&palmas_data }, + { "tps65913", (kernel_ulong_t)&palmas_data }, { /* end */ } }; MODULE_DEVICE_TABLE(i2c, palmas_i2c_id);