Received: by 2002:a05:7412:f584:b0:e2:908c:2ebd with SMTP id eh4csp1379002rdb; Mon, 4 Sep 2023 11:45:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEKDoB3HBBemHwdr7d/1Ve8l81ut4CpldKUYHHTMbRjS2RLUzo+DifohP8hYAgWNKcvBOeJ X-Received: by 2002:a2e:b048:0:b0:2b6:da88:a2d0 with SMTP id d8-20020a2eb048000000b002b6da88a2d0mr8131602ljl.47.1693853111568; Mon, 04 Sep 2023 11:45:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693853111; cv=none; d=google.com; s=arc-20160816; b=ALQJvy2qntZ2I0lOmJb/Elxfc7yvCDcifFiPhHKUgr2CGnMZnI2fftY3dnQ8era7iK n+Pk1DXdKTrvtjexAr9UFMgU3WFXCM8ivOrMbrJvL5K9FXJ0NkkNmR2+qgCQpeSGgb56 CQu61RlifptdrqCtfG3fakHRgpvJRxK/GgE6U7BS+pKEtzNaVJNJKe/qEotn8DJAo+wM UMfuh1XAOZohNHOPhSvgZGeU3uZOLEX+kt7qrnidW7i4+a/combTiaFpI+e9dlj5MTwI /5Ad98Swg+cOyMbp4PP2NdoBewdZAhrsAB1/FI9EBCDlK1GdHm2uX0S/XrJuFVZ/cy5d Zizg== 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=8ZIxWaQtrbNlKFbrgpsUfAYIDR8u5h6KrkTLn1UmhgI=; fh=uzNpojW8oqASSXZfv8247G2iklAhiQXcsvJtcZeZcAI=; b=QsN2JFhpe77uofP42bTrQAFbYlHjO9iZf7Rc9BpN5dgzG6WKf8TPFRv4vyibZS07zj SshnNk4Dexb/iguLVQii8TC9qptRyThF0JTuiXcoEXhigIIw3ZVKft8y1y6huGcYEaf+ SeLB2rhCctobeZz+0k6Ttt75tM/9qFh6PLmTUxM+wrTIyObga/D1BTNQoqYla5ggCHQu PFWTY5tFFQmM263buOAHNIi0/rze41CVQe2IPT+3lpdlXROMSTLJp8Ac2rUTg5zMm6Ll f8jEb3QdTeZQpbaUymsUaZeIS9gVMSz6i/MdJoVRb8JpM7EqG1owpJQo0lOPH6OjHT5d zZ1w== 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 k9-20020a170906054900b009a1e1f41393si6171037eja.105.2023.09.04.11.44.42; Mon, 04 Sep 2023 11:45:11 -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 S242811AbjICPnI (ORCPT + 99 others); Sun, 3 Sep 2023 11:43:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229970AbjICPnH (ORCPT ); Sun, 3 Sep 2023 11:43:07 -0400 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7BFC798 for ; Sun, 3 Sep 2023 08:43:03 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.02,224,1688396400"; d="scan'208";a="178557873" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 04 Sep 2023 00:43:02 +0900 Received: from localhost.localdomain (unknown [10.226.92.30]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id A1B02400C0EB; Mon, 4 Sep 2023 00:43:00 +0900 (JST) From: Biju Das To: Laurent Pinchart Cc: Biju Das , Liam Girdwood , Mark Brown , linux-kernel@vger.kernel.org, Biju Das , Andy Shevchenko Subject: [PATCH v2] regulator: max20086: Make similar OF and ID table Date: Sun, 3 Sep 2023 16:42:57 +0100 Message-Id: <20230903154257.70800-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 Make similar OF and ID table to extend support for ID match using i2c_match_data(). Currently it works only for OF match tables as the driver_data is wrong for ID match. While at it, drop blank lines before MODULE_DEVICE_TABLE* and remove trailing comma in the terminator entry for OF/ID table. Signed-off-by: Biju Das --- Note: This patch is only compile tested. v1->v2: * Removed trailing comma in the terminator entry for OF/ID table. --- drivers/regulator/max20086-regulator.c | 65 ++++++++++++-------------- 1 file changed, 31 insertions(+), 34 deletions(-) diff --git a/drivers/regulator/max20086-regulator.c b/drivers/regulator/max20086-regulator.c index 32f47b896fd1..59eb23d467ec 100644 --- a/drivers/regulator/max20086-regulator.c +++ b/drivers/regulator/max20086-regulator.c @@ -223,7 +223,7 @@ static int max20086_i2c_probe(struct i2c_client *i2c) return -ENOMEM; chip->dev = &i2c->dev; - chip->info = device_get_match_data(chip->dev); + chip->info = i2c_get_match_data(i2c); i2c_set_clientdata(i2c, chip); @@ -275,45 +275,42 @@ static int max20086_i2c_probe(struct i2c_client *i2c) return 0; } -static const struct i2c_device_id max20086_i2c_id[] = { - { "max20086" }, - { "max20087" }, - { "max20088" }, - { "max20089" }, - { /* Sentinel */ }, +static const struct max20086_chip_info max20086_chip_info = { + .id = MAX20086_DEVICE_ID_MAX20086, + .num_outputs = 4, +}; + +static const struct max20086_chip_info max20087_chip_info = { + .id = MAX20086_DEVICE_ID_MAX20087, + .num_outputs = 4, +}; + +static const struct max20086_chip_info max20088_chip_info = { + .id = MAX20086_DEVICE_ID_MAX20088, + .num_outputs = 2, +}; + +static const struct max20086_chip_info max20089_chip_info = { + .id = MAX20086_DEVICE_ID_MAX20089, + .num_outputs = 2, }; +static const struct i2c_device_id max20086_i2c_id[] = { + { "max20086", (kernel_ulong_t)&max20086_chip_info }, + { "max20087", (kernel_ulong_t)&max20087_chip_info }, + { "max20088", (kernel_ulong_t)&max20088_chip_info }, + { "max20089", (kernel_ulong_t)&max20089_chip_info }, + { /* Sentinel */ } +}; MODULE_DEVICE_TABLE(i2c, max20086_i2c_id); static const struct of_device_id max20086_dt_ids[] __maybe_unused = { - { - .compatible = "maxim,max20086", - .data = &(const struct max20086_chip_info) { - .id = MAX20086_DEVICE_ID_MAX20086, - .num_outputs = 4, - } - }, { - .compatible = "maxim,max20087", - .data = &(const struct max20086_chip_info) { - .id = MAX20086_DEVICE_ID_MAX20087, - .num_outputs = 4, - } - }, { - .compatible = "maxim,max20088", - .data = &(const struct max20086_chip_info) { - .id = MAX20086_DEVICE_ID_MAX20088, - .num_outputs = 2, - } - }, { - .compatible = "maxim,max20089", - .data = &(const struct max20086_chip_info) { - .id = MAX20086_DEVICE_ID_MAX20089, - .num_outputs = 2, - } - }, - { /* Sentinel */ }, + { .compatible = "maxim,max20086", .data = &max20086_chip_info }, + { .compatible = "maxim,max20087", .data = &max20087_chip_info }, + { .compatible = "maxim,max20088", .data = &max20088_chip_info }, + { .compatible = "maxim,max20089", .data = &max20089_chip_info }, + { /* Sentinel */ } }; - MODULE_DEVICE_TABLE(of, max20086_dt_ids); static struct i2c_driver max20086_regulator_driver = { -- 2.25.1