Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp299364rdh; Sat, 23 Sep 2023 10:49:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFBm5NFQaVUYYOaWxGQWxu7GBHYnZPbnfkocp0aN8aUtRHxKZTfgzbmoyjuo7806jd6oM17 X-Received: by 2002:a17:902:d505:b0:1c5:9f52:6a5b with SMTP id b5-20020a170902d50500b001c59f526a5bmr2462841plg.42.1695491399016; Sat, 23 Sep 2023 10:49:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695491399; cv=none; d=google.com; s=arc-20160816; b=v/RJTJF7s5mS/NUnT14D7yz78yevj9VszQVejvj+2zMTUTO6YlhNogenvkGaLq3dMX YgGzxVJBklFvfGAelAtxl5nnP4tj4VTqPGcbrnIdvuWoFGq1c4rTwuKizKz7GbPeNWjn 3flVo7iKjPr9nQyuLo7G9oUaYIqO2h6Dvhwo4QCB5y+Llm7Xg2gjf+Y13ISDSOkF5YgP HxHxcqxEoEpVVt+DoSC7ZX04YEyPSrXZhfvjIzM/f2jCE2m2rGnGeSCIoeSu41cSi3Lu mJ6K9KSNT/m3v1ohN+XgXcQTGrD4uqfkhs/cUqblzEAj8nkLFH724Nh7H0T5nURnc7xc 6Yww== 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=WRWjNBlM6dtv1iP8Xu0NBXk7q5FQuQDWT+RgpNs0rgk=; fh=1qz5Pfm/JcLX63bfALOa3wJ+yBN40cfw5RWdoNyTBwo=; b=I7PpPedr6ikkRY/GP1LXjynqlH//1YrXgLrOqBL8pHYCvecg3KzIwxRNZUZZ5Kz1Y7 JPq/M1NKSTTNSS1WR56bU7pkqKGDpnmmZyPBUmL+TtwWiLel76wr1iBM7Yyh6s9jpdP3 XdCCr70ybQIHYqTOXQLZ/7EIyA0w0wu2mA+v5yaAvKMLa0zq6K70GqYkM3/LoAEwAaQL XOAu/CNjyZrqXIUjI9FtOr6D0XkQnnQ5lxdgStXvw8kgoteQQNjih/eWJ+9+wehGei2T b8Dq6aptSw/YvelVMbVWm51agwZgmNH/rb8eNayz9YZCaDzj3dIqKG+4BeKIsAN2mZ9m f9Rg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id e17-20020a17090301d100b001c1e1fe16c7si7130037plh.236.2023.09.23.10.49.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Sep 2023 10:49:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 6EED582E078C; Sat, 23 Sep 2023 10:49:56 -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 S232163AbjIWRtv (ORCPT + 99 others); Sat, 23 Sep 2023 13:49:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232199AbjIWRtn (ORCPT ); Sat, 23 Sep 2023 13:49:43 -0400 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3F385127 for ; Sat, 23 Sep 2023 10:49:37 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.03,171,1694703600"; d="scan'208";a="180730425" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 24 Sep 2023 02:49:36 +0900 Received: from localhost.localdomain (unknown [10.226.92.12]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 599A440061B8; Sun, 24 Sep 2023 02:49:34 +0900 (JST) From: Biju Das To: Lee Jones Cc: Biju Das , patches@opensource.cirrus.com, linux-kernel@vger.kernel.org, Biju Das , Andy Shevchenko , Charles Keepax Subject: [PATCH v4 1/4] mfd: arizona-i2c: Simplify obtaining I2C match data Date: Sat, 23 Sep 2023 18:49:25 +0100 Message-Id: <20230923174928.56824-2-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230923174928.56824-1-biju.das.jz@bp.renesas.com> References: <20230923174928.56824-1-biju.das.jz@bp.renesas.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no 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]); Sat, 23 Sep 2023 10:49:56 -0700 (PDT) X-Spam-Level: ** Simplify probe() by replacing device_get_match_data() and ID lookup for retrieving match data by i2c_get_match_data(). After this drop intializing the variable type. Signed-off-by: Biju Das Acked-by: Charles Keepax Tested-by: Charles Keepax --- Note: This patch is only compile tested. v3->v4: * Updated commit header and description. 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