diff mbox series

rtc: isl1208: Simplify probe()

Message ID 20230710114747.106496-1-biju.das.jz@bp.renesas.com
State Accepted
Headers show
Series rtc: isl1208: Simplify probe() | expand

Commit Message

Biju Das July 10, 2023, 11:47 a.m. UTC
Simplify the probe() by replacing of_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 <biju.das.jz@bp.renesas.com>
---
 drivers/rtc/rtc-isl1208.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

Comments

Geert Uytterhoeven July 10, 2023, 12:33 p.m. UTC | #1
On Mon, Jul 10, 2023 at 1:47 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> Simplify the probe() by replacing of_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 <biju.das.jz@bp.renesas.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert
Alexandre Belloni July 27, 2023, 9:08 p.m. UTC | #2
On Mon, 10 Jul 2023 12:47:47 +0100, Biju Das wrote:
> Simplify the probe() by replacing of_device_get_match_data() and
> i2c_match_id() by i2c_get_match_data() as we have similar I2C
> and DT-based matching table.
> 
> 

Applied, thanks!

[1/1] rtc: isl1208: Simplify probe()
      commit: b7f73b6e921b457a222e86cf53fe3950c6b5aed5

Best regards,
diff mbox series

Patch

diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c
index b0712b4e3648..57e77b55e484 100644
--- a/drivers/rtc/rtc-isl1208.c
+++ b/drivers/rtc/rtc-isl1208.c
@@ -862,17 +862,9 @@  isl1208_probe(struct i2c_client *client)
 	i2c_set_clientdata(client, isl1208);
 
 	/* Determine which chip we have */
-	if (client->dev.of_node) {
-		isl1208->config = of_device_get_match_data(&client->dev);
-		if (!isl1208->config)
-			return -ENODEV;
-	} else {
-		const struct i2c_device_id *id = i2c_match_id(isl1208_id, client);
-
-		if (!id)
-			return -ENODEV;
-		isl1208->config = (struct isl1208_config *)id->driver_data;
-	}
+	isl1208->config = i2c_get_match_data(client);
+	if (!isl1208->config)
+		return -ENODEV;
 
 	rc = isl1208_clk_present(client, "xin");
 	if (rc < 0)