Received: by 2002:a05:7412:3210:b0:e2:908c:2ebd with SMTP id eu16csp669344rdb; Fri, 1 Sep 2023 00:04:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHAPvJBLI9G8/ezO9b4XzTdM6zpGAqSd+8iGUNb+vEL1sebpiHmE7jKbfbN7rT4RvyE5CWm X-Received: by 2002:a05:6402:164a:b0:526:d6d2:aeb5 with SMTP id s10-20020a056402164a00b00526d6d2aeb5mr1372457edx.9.1693551841356; Fri, 01 Sep 2023 00:04:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693551841; cv=none; d=google.com; s=arc-20160816; b=ZXt6S3Qhhl5jkOGK3R0Kvu+6B2aLYpBPj1E5+gqikN3zYFGvEfjm2kb4QWurvyDIdE HNCL6hx6U+cHMERpJUEYTzVjwCKLzPOQ9JEh+r3hfQymUVYm3oLMJGtc9oxS5aI9S8Wo cllImzMBWMnVOmBRzW27OxdN5DYGj77zZt5RT4yy4PeBOdhMVoABIvhaLgaj7M17cHB3 zVHdr7IwUCle7vPCg6S39G029gAh9Y202TN9fBcN4JuFT86Wrn3xXQl22hhPF9jvzdDF f2l7cG54tGbUQxcyBZnKsrY2kCFJ2eWFTdjPNNK16IJPc4mBGQA4ReQGnaaJi/gj8oTA TpuA== 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=qVedZaVdyxu/uwqqzimPVwhJpaySWOz87+q9+5/mo8k=; fh=uHUQMY3ScCCKFoIkA2KaGBsmege9T5JuhXIcbF/hmCs=; b=F7jOmWsvjqJg6LPkxWWOD6X//2DGshtHPza9f+I1QqYzn00vIAKx+q/7GVRD2HC6NS V/8RjDD+jcnBvuSEA/n9Zn+CwhY3+38EVZ44oO8GvSyyTa4MJOOd3ZoU1JvM7BwcM5r6 60v6Yxs43SoE+IiWXJ6z8ZTB8p+8NsxXZloFKT69U1/X/yd4RdivkRc/0RliekcmpvzL c0o5h6LZ+/+ABILNkY8v9190nK3hUGA2xOgEQZBKVub7pOHKIVSsxYmfGDwUKWflwnSp iN/nPT7PMgfyh4+RfbHaYVR4dXrVyr/ZzW9y3KawONC10nKI9SL4JI4PR2O74WGrjEGx 8hgg== 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 w21-20020aa7cb55000000b00522467311e0si2266418edt.634.2023.09.01.00.03.35; Fri, 01 Sep 2023 00:04:01 -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 S232498AbjHaSnT (ORCPT + 93 others); Thu, 31 Aug 2023 14:43:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229691AbjHaSnS (ORCPT ); Thu, 31 Aug 2023 14:43:18 -0400 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2E45AE5D for ; Thu, 31 Aug 2023 11:43:15 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.02,217,1688396400"; d="scan'208";a="178336046" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 01 Sep 2023 03:43:14 +0900 Received: from localhost.localdomain (unknown [10.226.92.179]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id BB2F640029A1; Fri, 1 Sep 2023 03:43:12 +0900 (JST) From: Biju Das To: Lee Jones Cc: Biju Das , linux-kernel@vger.kernel.org, Andy Shevchenko Subject: [PATCH v3] mfd: max8998: Simplify probe() and drop max8998_i2c_get_driver_data() Date: Thu, 31 Aug 2023 19:43:09 +0100 Message-Id: <20230831184309.67507-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 --- Note: This patch is only compile tested. v2->v3: * Restored OF table. 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