Received: by 2002:a05:7412:3210:b0:e2:908c:2ebd with SMTP id eu16csp484257rdb; Thu, 31 Aug 2023 15:43:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IERrhsyusnJ1pEFaV21+mKmFvsdh12xJOpx+eXgibNENd5sc0nsl6x6F9GnSt8zxg0hRwtq X-Received: by 2002:a9d:7f8e:0:b0:6bf:2476:a97e with SMTP id t14-20020a9d7f8e000000b006bf2476a97emr832065otp.5.1693521826705; Thu, 31 Aug 2023 15:43:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693521826; cv=none; d=google.com; s=arc-20160816; b=upBSmDmd+jEaFr55E71YP6AIh81rqR+I9+QSG82fooYsO8eqLNyv7Jt/c546XHx+Pu aiwLQmFf3pW1GUkY5LYQGV15CcsxWRzj9UvopYTgE1ZjmXM4t67t/MW5SNRlkEGcPvj1 czVU/avSng0rjBBvHeNJJzqftnz0P/CeBhq5tDnI6XIMvt/obsFwd5Lvjcz84He4XX+N IGVR6giWoH5EDWcsQe/g9J4lK2Z7AW13AO9E9cpO+mS1xjC2BxpJIiVsBOrltah/rTnn vpJLqnIQ5J7ktzR9tLCty9LpGhSv3xCUMbtQKFkPdPmjkPHtzWtKqNXtBxFVNHyIq9Bp Er1g== 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=1sRSWTQV/fMXst1+JTNVL/D00XULrNdpwzsEDjJKxIc=; fh=uHUQMY3ScCCKFoIkA2KaGBsmege9T5JuhXIcbF/hmCs=; b=KNxGjcEQChNI3YhwS6DVibJuQ0pr31+aJckHEDrHPcVJGDuiob1W9NH6u697Uw0lWA qcgMUglG0f6tLgXrI/Zpvgi43WDqAH4l9+xzZ2cepdktG1DRCMPCnMk3t/0SWBdeAaG9 O1KJJ41uRJ4Y1TkGsJ0jIpPU8OQprzD3GMSo85IYtb9k5cqWTWHiFPQMSxADFDEKvC86 TCuAoQY7hWvhywsXJ0XlADHql9nExs5LTm8oY4HdUwMSl9Zj6AYRn+xYzRTNZCQZ/vRH auUx6Tz+fNi580cQDXUQp11xzenzxTd4x83cP0D8jzmdA05sqXj8UG46OEPtxv1LGymw 7p6Q== 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 b26-20020a6567da000000b005578994f212si1776102pgs.425.2023.08.31.15.43.34; Thu, 31 Aug 2023 15:43:46 -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 S245275AbjHaSrD (ORCPT + 91 others); Thu, 31 Aug 2023 14:47:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346658AbjHaSrC (ORCPT ); Thu, 31 Aug 2023 14:47:02 -0400 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 33498E5D for ; Thu, 31 Aug 2023 11:46:58 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.02,217,1688396400"; d="scan'208";a="174628776" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 01 Sep 2023 03:46:57 +0900 Received: from localhost.localdomain (unknown [10.226.92.179]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 0E84E400F32C; Fri, 1 Sep 2023 03:46:55 +0900 (JST) From: Biju Das To: Lee Jones Cc: Biju Das , linux-kernel@vger.kernel.org, Andy Shevchenko Subject: [PATCH v3 RESEND] mfd: max8998: Simplify probe() and drop max8998_i2c_get_driver_data() Date: Thu, 31 Aug 2023 19:46:53 +0100 Message-Id: <20230831184653.67664-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 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 --- Note: This patch is only compile tested. v2->v3: * No change. v1->v2: * Restored error code -EINVAL. --- 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