Received: by 2002:a05:7412:3210:b0:e2:908c:2ebd with SMTP id eu16csp680510rdb; Fri, 1 Sep 2023 00:30:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEvUviehTOstBnS2Ke/XrMCp37Vo+KU9SiFOcdk9T+4gIN/jKTfzaay+5CFy57gImBy0nFJ X-Received: by 2002:a17:902:f54f:b0:1c0:8a05:f32e with SMTP id h15-20020a170902f54f00b001c08a05f32emr2492254plf.23.1693553413468; Fri, 01 Sep 2023 00:30:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693553413; cv=none; d=google.com; s=arc-20160816; b=UjZmyU5Xw8nHWHHXAadyZ4Qn1kTisYpfS4ma+V8TBxeIHjCQXkgDYlUD+z81drD1uP yfg3MnWBiQ2Tt57InSnUaNFxP31JwFHWWTddtsGktvZw5p7rUs2eaK34x/fEQOsmEXiG SuTU/ZayR/UJlXerkif3PgvSghvXnNhCPs91f/PecCS4J3yaKz777jEMRp9SinL3MYDA BWNqq+XQLDWZn/WVdQQU/yntgoFqXqPKjONeXybLIu4IeagTGQ+UrPEpLCOBd/8Ml439 2dfyY/OxDtheuDvSogsfd59BR0SglwbctU5C+4WbEiUthZCk0eFeynws78Ds6lrovZJs D9gQ== 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=F1nhd467AXtQ9Jrry5evwAJ6IhtRHSxbLuW4nfhJWaU=; fh=K7TzmIZT5B1lycBQfsCiF4dq6OQCbe+LLVTZoxnlU0E=; b=SvwJrs320wDfrC2I9iiPeUrI03wFxuBvi7b27KBlRahafIoyLANlqoQiPO3LZLbxNU Fy2PY29xnaebQPsBhNOrVtHxzF9DK82RAxjm3O8xzdO5hdXvWU0GgAZx7Zcw/sbSc2aU LYwnEo6MM5DwmIxMVXxSfuU1heUWWMwO+LGZiW/EThMuRQnG+oV/WVWf9Dpekerqkekr tI7qYiHHEqHCQY/vAWhKQ/wT7rblAvq3SXoZMbNl3XpU2uDDRQD33h8Re0HVXRaRJXsC JRD3ayXLt7ZfPl2F/7pJSQ1LZ+8MCf7J9bJZzgwuK6WvDK1bZdZp7UEpgoPWt5zPwdXj HXSg== 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 la13-20020a170902fa0d00b001b20e2ba8e1si2337117plb.23.2023.09.01.00.29.58; Fri, 01 Sep 2023 00:30:13 -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 S242956AbjHaTXs (ORCPT + 99 others); Thu, 31 Aug 2023 15:23:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230245AbjHaTXs (ORCPT ); Thu, 31 Aug 2023 15:23:48 -0400 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 62243E65 for ; Thu, 31 Aug 2023 12:23:45 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.02,217,1688396400"; d="scan'208";a="174630762" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 01 Sep 2023 04:23:44 +0900 Received: from localhost.localdomain (unknown [10.226.92.179]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id BB31B400F4FA; Fri, 1 Sep 2023 04:23:42 +0900 (JST) From: Biju Das To: Lee Jones Cc: Biju Das , patches@opensource.cirrus.com, linux-kernel@vger.kernel.org, Andy Shevchenko , Charles Keepax Subject: [PATCH v3] mfd: arizona-i2c: Simplify probe() Date: Thu, 31 Aug 2023 20:23:40 +0100 Message-Id: <20230831192340.80452-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 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 Tested-by: Charles Keepax --- Note: This patch is only compile tested. v2->v3: * Used uintptr_t for enum casting. v1->v2: * Added Ack and Tested-by tag from Charles Keepax * Dropped unnecessary blank line before switch statement. --- drivers/mfd/arizona-i2c.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/mfd/arizona-i2c.c b/drivers/mfd/arizona-i2c.c index 9b7183ffc928..10e76fc8f12e 100644 --- a/drivers/mfd/arizona-i2c.c +++ b/drivers/mfd/arizona-i2c.c @@ -22,19 +22,12 @@ static int arizona_i2c_probe(struct i2c_client *i2c) { - const struct i2c_device_id *id = i2c_client_get_device_id(i2c); - const void *match_data; struct arizona *arizona; const struct regmap_config *regmap_config = NULL; - unsigned long type = 0; + unsigned long type; int ret; - match_data = device_get_match_data(&i2c->dev); - if (match_data) - type = (unsigned long)match_data; - else if (id) - type = id->driver_data; - + type = (uintptr_t)i2c_get_match_data(i2c); switch (type) { case WM5102: if (IS_ENABLED(CONFIG_MFD_WM5102)) -- 2.25.1