From patchwork Sat Jul 22 20:07:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13323013 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F077C001DC for ; Sat, 22 Jul 2023 20:07:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229804AbjGVUH3 (ORCPT ); Sat, 22 Jul 2023 16:07:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbjGVUH2 (ORCPT ); Sat, 22 Jul 2023 16:07:28 -0400 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 65A9F1FDF; Sat, 22 Jul 2023 13:07:27 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.01,224,1684767600"; d="scan'208";a="174116633" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 23 Jul 2023 05:07:26 +0900 Received: from localhost.localdomain (unknown [10.226.92.35]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id D8F5B4004473; Sun, 23 Jul 2023 05:07:23 +0900 (JST) From: Biju Das To: Jonathan Cameron Cc: Biju Das , Lars-Peter Clausen , Michael Hennerich , Lucas Stankus , George Mois , linux-iio@vger.kernel.org, Geert Uytterhoeven , linux-renesas-soc@vger.kernel.org Subject: [PATCH v2 1/2] iio: accel: adxl313: Fix adxl313_i2c_id[] table Date: Sat, 22 Jul 2023 21:07:17 +0100 Message-Id: <20230722200718.142366-2-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230722200718.142366-1-biju.das.jz@bp.renesas.com> References: <20230722200718.142366-1-biju.das.jz@bp.renesas.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org The .driver_data in adxl313_i2c_id[] for adxl312 and adxl314 is wrong. Fix this issue by adding corresponding adxl31x_chip_info data. Reported-by: Jonathan Cameron Closes: https://patchwork.kernel.org/project/linux-renesas-soc/patch/20230716175218.130557-3-biju.das.jz@bp.renesas.com/#25436658 Fixes: a7a1c60bc4c9 ("drivers: iio: accel: adxl312 and adxl314 support") Signed-off-by: Biju Das Reviewed-by: Geert Uytterhoeven --- drivers/iio/accel/adxl313_i2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/accel/adxl313_i2c.c b/drivers/iio/accel/adxl313_i2c.c index 524327ea3663..e0a860ab9e58 100644 --- a/drivers/iio/accel/adxl313_i2c.c +++ b/drivers/iio/accel/adxl313_i2c.c @@ -40,8 +40,8 @@ static const struct regmap_config adxl31x_i2c_regmap_config[] = { static const struct i2c_device_id adxl313_i2c_id[] = { { .name = "adxl312", .driver_data = (kernel_ulong_t)&adxl31x_chip_info[ADXL312] }, - { .name = "adxl313", .driver_data = (kernel_ulong_t)&adxl31x_chip_info[ADXL312] }, - { .name = "adxl314", .driver_data = (kernel_ulong_t)&adxl31x_chip_info[ADXL312] }, + { .name = "adxl313", .driver_data = (kernel_ulong_t)&adxl31x_chip_info[ADXL313] }, + { .name = "adxl314", .driver_data = (kernel_ulong_t)&adxl31x_chip_info[ADXL314] }, { } }; From patchwork Sat Jul 22 20:07:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13323014 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B0F2C001E0 for ; Sat, 22 Jul 2023 20:07:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229821AbjGVUHb (ORCPT ); Sat, 22 Jul 2023 16:07:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229812AbjGVUHa (ORCPT ); Sat, 22 Jul 2023 16:07:30 -0400 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D0EA11FE1; Sat, 22 Jul 2023 13:07:29 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.01,224,1684767600"; d="scan'208";a="174116637" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 23 Jul 2023 05:07:29 +0900 Received: from localhost.localdomain (unknown [10.226.92.35]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 2F25C4005625; Sun, 23 Jul 2023 05:07:26 +0900 (JST) From: Biju Das To: Jonathan Cameron Cc: Biju Das , Lucas Stankus , Lars-Peter Clausen , Michael Hennerich , linux-iio@vger.kernel.org, Geert Uytterhoeven , linux-renesas-soc@vger.kernel.org Subject: [PATCH v2 2/2] iio: accel: adxl313: Use i2c_get_match_data Date: Sat, 22 Jul 2023 21:07:18 +0100 Message-Id: <20230722200718.142366-3-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230722200718.142366-1-biju.das.jz@bp.renesas.com> References: <20230722200718.142366-1-biju.das.jz@bp.renesas.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Replace device_get_match_data() and i2c_match_id() by i2c_get_match _data() as we have similar I2C and DT-based matching table. Signed-off-by: Biju Das Reviewed-by: Geert Uytterhoeven --- v1->v2: * Added Rb tag from Geert * Removed error check as all tables have data pointers. * retained Rb tag as the change is trivial. --- drivers/iio/accel/adxl313_i2c.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/iio/accel/adxl313_i2c.c b/drivers/iio/accel/adxl313_i2c.c index e0a860ab9e58..a4cf0cf2c5aa 100644 --- a/drivers/iio/accel/adxl313_i2c.c +++ b/drivers/iio/accel/adxl313_i2c.c @@ -65,9 +65,7 @@ static int adxl313_i2c_probe(struct i2c_client *client) * Retrieves device specific data as a pointer to a * adxl313_chip_info structure */ - chip_data = device_get_match_data(&client->dev); - if (!chip_data) - chip_data = (const struct adxl313_chip_info *)i2c_match_id(adxl313_i2c_id, client)->driver_data; + chip_data = i2c_get_match_data(client); regmap = devm_regmap_init_i2c(client, &adxl31x_i2c_regmap_config[chip_data->type]);