Received: by 2002:a05:7412:3210:b0:e2:908c:2ebd with SMTP id eu16csp696656rdb; Fri, 1 Sep 2023 01:11:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEPOilEyQuFGq4MAZ996V4asNWfHC+MgJAPzlch0wBArvji1ehLCWKXGO7jJ3kQTzfYf0++ X-Received: by 2002:a05:6808:17a6:b0:3a7:250a:7948 with SMTP id bg38-20020a05680817a600b003a7250a7948mr2522871oib.13.1693555880098; Fri, 01 Sep 2023 01:11:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693555880; cv=none; d=google.com; s=arc-20160816; b=stvIxXzqcgYoHHiiBpiz0ZKcMBx0efEG1Gp/bDBo/0AEt/wQXpLqcMBL1KbnO/4LPS 8HWmVusArUKc2t/DAqN3zv31ySLL2OT4wjaFvsYpIu2W4OFyOb+NN4jT6E0QV//hBvTY dmCuTqGr7shpYKYYG/t2swUJN6zYYZqoA8WL0InZ9yM1re1feTPrdgOX90Jybxw91Ix0 s1jG4uGpCvvMxY3/pE6xbM3gC5D9lzrTKF1e1IE2sqtk6fdgJ+1BJkPuBsXzrT0EaQzK xawvhaayi6ApSzsx+H+hohKCN1WAY8aB/iLdCYvkGxIAOwz3YlnU1QwHJ8zVnZ8/eYGo LYww== 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=xTtCqVV6ZXVEFjQtdacNsSCrhpJOnpbPUSNjEC0IADk=; fh=pw+dqyfPdSov6fSSng5jSNKgho3EaeZzx+IVU5xkcn4=; b=0setNnm4W/7yB72YJb8kJ/KK2OF+0WMQ4GgNZJTyFFj0GrKJKjKwXmwwtXQUFvu+D8 bQ99VjVr9jPoI3Gr27XwzyaoFP5YrjZlZ10y9xks4XfN/8x46S3QQVqu9Fv7AjexvQ8r N48twaiZwKhq3T/PJYuwPXmjNk6Xcl63YHCIiAqAaQVU0DkiN1h0mxX4UgGuX1joYNhU H4PVHelu4IhAKLHvPI0xjnmoNdCeQiG704+EGiB3MmndYfuXoW946rWw1ojbJytKJSk/ sBHkA4YiiajfoQXGWODyG1jyCl5pv8u0h6U885mOFh77HgNiGK+wDjmjm+gGqHSWf0JH 2R+A== 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 y21-20020a634b15000000b00565bcc25856si2530849pga.816.2023.09.01.01.11.04; Fri, 01 Sep 2023 01:11:20 -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 S1348370AbjIAGYF (ORCPT + 99 others); Fri, 1 Sep 2023 02:24:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230011AbjIAGYE (ORCPT ); Fri, 1 Sep 2023 02:24:04 -0400 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 60D2910E6 for ; Thu, 31 Aug 2023 23:23:52 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.02,218,1688396400"; d="scan'208";a="178405245" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 01 Sep 2023 15:23:51 +0900 Received: from localhost.localdomain (unknown [10.226.92.203]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id D85C34193859; Fri, 1 Sep 2023 15:23:49 +0900 (JST) From: Biju Das To: Lee Jones Cc: Biju Das , linux-kernel@vger.kernel.org, Biju Das , Andy Shevchenko Subject: [PATCH v3 RESEND] mfd: max8998: Simplify probe() and drop max8998_i2c_get_driver_data() Date: Fri, 1 Sep 2023 07:23:44 +0100 Message-Id: <20230901062344.6089-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, RCVD_IN_DNSWL_BLOCKED,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 using i2c_get_match_data() instead of max8998_i2c_get_driver_data() for retrieving match data from OF/ID tables. Signed-off-by: Biju Das Reviewed-by: Andy Shevchenko --- Note: This patch is only compile tested. V2->v3: * Added Rb tag from Andy. v1->v2: * Used uintptr_t for enum casting. --- drivers/mfd/max8998.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/mfd/max8998.c b/drivers/mfd/max8998.c index 4cc426a6c767..6ba27171da28 100644 --- a/drivers/mfd/max8998.c +++ b/drivers/mfd/max8998.c @@ -152,18 +152,8 @@ static struct max8998_platform_data *max8998_i2c_parse_dt_pdata( return pd; } -static inline unsigned long max8998_i2c_get_driver_data(struct i2c_client *i2c, - const struct i2c_device_id *id) -{ - if (i2c->dev.of_node) - return (unsigned long)of_device_get_match_data(&i2c->dev); - - return id->driver_data; -} - static int max8998_i2c_probe(struct i2c_client *i2c) { - const struct i2c_device_id *id = i2c_client_get_device_id(i2c); struct max8998_platform_data *pdata = dev_get_platdata(&i2c->dev); struct max8998_dev *max8998; int ret = 0; @@ -183,7 +173,7 @@ static int max8998_i2c_probe(struct i2c_client *i2c) max8998->dev = &i2c->dev; max8998->i2c = i2c; max8998->irq = i2c->irq; - max8998->type = max8998_i2c_get_driver_data(i2c, id); + max8998->type = (uintptr_t)i2c_get_match_data(i2c); max8998->pdata = pdata; if (pdata) { max8998->ono = pdata->ono; -- 2.25.1