Received: by 2002:a05:7412:3210:b0:e2:908c:2ebd with SMTP id eu16csp404967rdb; Thu, 31 Aug 2023 12:55:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG82HPOJfHUnMQQTDtbKtGK540g/7IVu5MDuabztpiqByzpLurg+2XrmPuyMGqAv8U/RYkY X-Received: by 2002:a17:906:329a:b0:9a2:120a:5777 with SMTP id 26-20020a170906329a00b009a2120a5777mr218782ejw.70.1693511731804; Thu, 31 Aug 2023 12:55:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693511731; cv=none; d=google.com; s=arc-20160816; b=L1dwN8LJ0oHG2tlx4cA/mbOihFUVpq8CuYqO+HYRF3c/0p75uDhTu1ie2g9maodLgu VwqqVeozzQDN0/YGvOQVLQzXqWL4h86wOKkPalEYMpyCGHF/A70F1U1yiqAwYH6Iy7Oz z2DBDi1ZXqQAF3RIHuVP1i9QdUbFzON/AYNwPhGvgQTWdXGFXBc+AYYuVg33gLb0vIGC neoNAjy9G+C+5biM18dSyx/snN5FM4cazHEXRBmGYi5867gQqS95XLvS6Rxd+AY6Wp8R qPCTRdQgpXo+p284A28Wbp7VKlYWMSq5I8SA/dYctScXNPCQAUCVSd2oLVlzGcpguG7p B2pA== 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 :message-id:date:subject:cc:to:from; bh=zHBNYwEU//7NdM+zlE0A9VxGMblAQcSPwXo/ABYG1g8=; fh=zOQ6IUp2HEvN+dF3Klb6N06Rq9UuKwK0e/zxZ3PCwMI=; b=vWJfL5UyZ74v6o2dyxAORoZIVl+lVgmqCL6okcfqbYqSqPP7v9OJ9Xi32FdNJfFBvi 6JcQCwDnwVqxrnEYa2aKR/xk6NJb5S2agOjrD/4BfOnLSvC5XBuBlCtukRwrZeJvyulP 5T1raY6Vum/JXpX69Vni7mcIuCShMFaq/hpRkpPQzpGI1CZyOTsgZHgf+35QPh8GxRMU rSrKFPzNkkGMSCHjx0Ni8V+LvbAi9kwjlihjU38RXfVRXLVWkwzFN6tpki0a24vwtyaj w9bZNt2VBzeUnKrz6QMFHm8bqg+HmfOFZYRuFeAKNtphVAA7gPV03V9V7/y98coG2dU/ hL4w== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pk24-20020a170906d7b800b00992f7fe9c0bsi1489627ejb.328.2023.08.31.12.54.56; Thu, 31 Aug 2023 12:55:31 -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 S244441AbjHaTR2 (ORCPT + 99 others); Thu, 31 Aug 2023 15:17:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230245AbjHaTR0 (ORCPT ); Thu, 31 Aug 2023 15:17:26 -0400 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 10159E65 for ; Thu, 31 Aug 2023 12:17:23 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.02,217,1688396400"; d="scan'208";a="178337608" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 01 Sep 2023 04:17:23 +0900 Received: from localhost.localdomain (unknown [10.226.92.179]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id DD28C4000FA3; Fri, 1 Sep 2023 04:17:20 +0900 (JST) From: Biju Das To: Lee Jones Cc: Biju Das , Charles Keepax , Richard Fitzgerald , alsa-devel@alsa-project.org, patches@opensource.cirrus.com, linux-kernel@vger.kernel.org, Andy Shevchenko Subject: [PATCH v3] mfd: madera-i2c: Simplify probe() Date: Thu, 31 Aug 2023 20:17:17 +0100 Message-Id: <20230831191718.75509-1-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=AC_FROM_MANY_DOTS,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 Simplify probe() by replacing of_device_get_match_data() and ID lookup for retrieving match data by i2c_get_match_data(). Signed-off-by: Biju Das Acked-by: Charles Keepax --- Note: This patch is only compile tested. v2->v3: * Used uintptr_t for enum casting. v1->v2: * Added Ack tag from Charles Keepax. * Dropped blank line before switch statement. --- drivers/mfd/madera-i2c.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/mfd/madera-i2c.c b/drivers/mfd/madera-i2c.c index a404ea26bc79..0986e4a99f4a 100644 --- a/drivers/mfd/madera-i2c.c +++ b/drivers/mfd/madera-i2c.c @@ -18,21 +18,14 @@ static int madera_i2c_probe(struct i2c_client *i2c) { - const struct i2c_device_id *id = i2c_client_get_device_id(i2c); struct madera *madera; const struct regmap_config *regmap_16bit_config = NULL; const struct regmap_config *regmap_32bit_config = NULL; - const void *of_data; unsigned long type; const char *name; int ret; - of_data = of_device_get_match_data(&i2c->dev); - if (of_data) - type = (unsigned long)of_data; - else - type = id->driver_data; - + type = (uintptr_t)i2c_get_match_data(i2c); switch (type) { case CS47L15: if (IS_ENABLED(CONFIG_MFD_CS47L15)) { -- 2.25.1