* [PATCH] rtc: rx8581: Simplify probe()
@ 2023-08-28 9:08 Biju Das
2023-08-28 12:27 ` Alexandre Belloni
0 siblings, 1 reply; 4+ messages in thread
From: Biju Das @ 2023-08-28 9:08 UTC (permalink / raw)
To: Alessandro Zummo, Alexandre Belloni
Cc: Biju Das, linux-rtc, Geert Uytterhoeven, Andy Shevchenko,
Prabhakar Mahadev Lad, linux-renesas-soc
Make similar OF and ID table and simplify probe() by replacing
of_device_get_match_data()->i2c_get_match_data().
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
Note:
* This patch is only compile tested.
---
drivers/rtc/rtc-rx8581.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/rtc/rtc-rx8581.c b/drivers/rtc/rtc-rx8581.c
index 48efd61a114d..68dd8b9b52f9 100644
--- a/drivers/rtc/rtc-rx8581.c
+++ b/drivers/rtc/rtc-rx8581.c
@@ -250,8 +250,7 @@ static const struct rx85x1_config rx8571_config = {
static int rx8581_probe(struct i2c_client *client)
{
struct rx8581 *rx8581;
- const struct rx85x1_config *config = &rx8581_config;
- const void *data = of_device_get_match_data(&client->dev);
+ const struct rx85x1_config *config = i2c_get_match_data(client);
static struct nvmem_config nvmem_cfg[] = {
{
.name = "rx85x1-",
@@ -273,9 +272,6 @@ static int rx8581_probe(struct i2c_client *client)
dev_dbg(&client->dev, "%s\n", __func__);
- if (data)
- config = data;
-
rx8581 = devm_kzalloc(&client->dev, sizeof(struct rx8581), GFP_KERNEL);
if (!rx8581)
return -ENOMEM;
@@ -307,7 +303,7 @@ static int rx8581_probe(struct i2c_client *client)
}
static const struct i2c_device_id rx8581_id[] = {
- { "rx8581", 0 },
+ { "rx8581", (kernel_ulong_t)&rx8581_config },
{ }
};
MODULE_DEVICE_TABLE(i2c, rx8581_id);
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] rtc: rx8581: Simplify probe()
2023-08-28 9:08 [PATCH] rtc: rx8581: Simplify probe() Biju Das
@ 2023-08-28 12:27 ` Alexandre Belloni
2023-08-28 12:35 ` Biju Das
0 siblings, 1 reply; 4+ messages in thread
From: Alexandre Belloni @ 2023-08-28 12:27 UTC (permalink / raw)
To: Biju Das
Cc: Alessandro Zummo, linux-rtc, Geert Uytterhoeven, Andy Shevchenko,
Prabhakar Mahadev Lad, linux-renesas-soc
On 28/08/2023 10:08:28+0100, Biju Das wrote:
> Make similar OF and ID table and simplify probe() by replacing
> of_device_get_match_data()->i2c_get_match_data().
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> Note:
> * This patch is only compile tested.
As you have access to a rx8571, please actually test.
> ---
> drivers/rtc/rtc-rx8581.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/rtc/rtc-rx8581.c b/drivers/rtc/rtc-rx8581.c
> index 48efd61a114d..68dd8b9b52f9 100644
> --- a/drivers/rtc/rtc-rx8581.c
> +++ b/drivers/rtc/rtc-rx8581.c
> @@ -250,8 +250,7 @@ static const struct rx85x1_config rx8571_config = {
> static int rx8581_probe(struct i2c_client *client)
> {
> struct rx8581 *rx8581;
> - const struct rx85x1_config *config = &rx8581_config;
> - const void *data = of_device_get_match_data(&client->dev);
> + const struct rx85x1_config *config = i2c_get_match_data(client);
> static struct nvmem_config nvmem_cfg[] = {
> {
> .name = "rx85x1-",
> @@ -273,9 +272,6 @@ static int rx8581_probe(struct i2c_client *client)
>
> dev_dbg(&client->dev, "%s\n", __func__);
>
> - if (data)
> - config = data;
> -
> rx8581 = devm_kzalloc(&client->dev, sizeof(struct rx8581), GFP_KERNEL);
> if (!rx8581)
> return -ENOMEM;
> @@ -307,7 +303,7 @@ static int rx8581_probe(struct i2c_client *client)
> }
>
> static const struct i2c_device_id rx8581_id[] = {
> - { "rx8581", 0 },
> + { "rx8581", (kernel_ulong_t)&rx8581_config },
> { }
> };
> MODULE_DEVICE_TABLE(i2c, rx8581_id);
> --
> 2.25.1
>
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] rtc: rx8581: Simplify probe()
2023-08-28 12:27 ` Alexandre Belloni
@ 2023-08-28 12:35 ` Biju Das
2023-08-29 12:44 ` Biju Das
0 siblings, 1 reply; 4+ messages in thread
From: Biju Das @ 2023-08-28 12:35 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Alessandro Zummo, linux-rtc@vger.kernel.org, Geert Uytterhoeven,
Andy Shevchenko, Prabhakar Mahadev Lad,
linux-renesas-soc@vger.kernel.org
Hi Alexandre Belloni,
> Subject: Re: [PATCH] rtc: rx8581: Simplify probe()
>
> On 28/08/2023 10:08:28+0100, Biju Das wrote:
> > Make similar OF and ID table and simplify probe() by replacing
> > of_device_get_match_data()->i2c_get_match_data().
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > ---
> > Note:
> > * This patch is only compile tested.
>
> As you have access to a rx8571, please actually test.
You are right. I have RZ/G2E board that has this RTC.
I will test the same and confirm.
Cheers,
Biju
>
> > ---
> > drivers/rtc/rtc-rx8581.c | 8 ++------
> > 1 file changed, 2 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/rtc/rtc-rx8581.c b/drivers/rtc/rtc-rx8581.c index
> > 48efd61a114d..68dd8b9b52f9 100644
> > --- a/drivers/rtc/rtc-rx8581.c
> > +++ b/drivers/rtc/rtc-rx8581.c
> > @@ -250,8 +250,7 @@ static const struct rx85x1_config rx8571_config =
> > { static int rx8581_probe(struct i2c_client *client) {
> > struct rx8581 *rx8581;
> > - const struct rx85x1_config *config = &rx8581_config;
> > - const void *data = of_device_get_match_data(&client->dev);
> > + const struct rx85x1_config *config = i2c_get_match_data(client);
> > static struct nvmem_config nvmem_cfg[] = {
> > {
> > .name = "rx85x1-",
> > @@ -273,9 +272,6 @@ static int rx8581_probe(struct i2c_client *client)
> >
> > dev_dbg(&client->dev, "%s\n", __func__);
> >
> > - if (data)
> > - config = data;
> > -
> > rx8581 = devm_kzalloc(&client->dev, sizeof(struct rx8581),
> GFP_KERNEL);
> > if (!rx8581)
> > return -ENOMEM;
> > @@ -307,7 +303,7 @@ static int rx8581_probe(struct i2c_client *client)
> > }
> >
> > static const struct i2c_device_id rx8581_id[] = {
> > - { "rx8581", 0 },
> > + { "rx8581", (kernel_ulong_t)&rx8581_config },
> > { }
> > };
> > MODULE_DEVICE_TABLE(i2c, rx8581_id);
> > --
> > 2.25.1
> >
>
> --
> Alexandre Belloni, co-owner and COO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.c/
> om%2F&data=05%7C01%7Cbiju.das.jz%40bp.renesas.com%7Cce5fb3bf24764820b82e08d
> ba7c22022%7C53d82571da1947e49cb4625a166a4a2a%7C0%7C0%7C638288224433894702%7
> CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwi
> LCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=ckmh5KF7OTtDO4LRU9QPmuBmt8XOO4Q2i8wFPE
> yRqKs%3D&reserved=0
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] rtc: rx8581: Simplify probe()
2023-08-28 12:35 ` Biju Das
@ 2023-08-29 12:44 ` Biju Das
0 siblings, 0 replies; 4+ messages in thread
From: Biju Das @ 2023-08-29 12:44 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Alessandro Zummo, linux-rtc@vger.kernel.org, Geert Uytterhoeven,
Andy Shevchenko, Prabhakar Mahadev Lad,
linux-renesas-soc@vger.kernel.org
Hi Alexandre Belloni,
> Subject: RE: [PATCH] rtc: rx8581: Simplify probe()
>
> Hi Alexandre Belloni,
>
> > Subject: Re: [PATCH] rtc: rx8581: Simplify probe()
> >
> > On 28/08/2023 10:08:28+0100, Biju Das wrote:
> > > Make similar OF and ID table and simplify probe() by replacing
> > > of_device_get_match_data()->i2c_get_match_data().
> > >
> > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > ---
> > > Note:
> > > * This patch is only compile tested.
> >
> > As you have access to a rx8571, please actually test.
>
> You are right. I have RZ/G2E board that has this RTC.
> I will test the same and confirm.
I have tested this patch on RZ/G2E platform and confirm it works ok.
Cheers,
Biju
>
> >
> > > ---
> > > drivers/rtc/rtc-rx8581.c | 8 ++------
> > > 1 file changed, 2 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/drivers/rtc/rtc-rx8581.c b/drivers/rtc/rtc-rx8581.c
> > > index
> > > 48efd61a114d..68dd8b9b52f9 100644
> > > --- a/drivers/rtc/rtc-rx8581.c
> > > +++ b/drivers/rtc/rtc-rx8581.c
> > > @@ -250,8 +250,7 @@ static const struct rx85x1_config rx8571_config
> > > = { static int rx8581_probe(struct i2c_client *client) {
> > > struct rx8581 *rx8581;
> > > - const struct rx85x1_config *config = &rx8581_config;
> > > - const void *data = of_device_get_match_data(&client->dev);
> > > + const struct rx85x1_config *config = i2c_get_match_data(client);
> > > static struct nvmem_config nvmem_cfg[] = {
> > > {
> > > .name = "rx85x1-",
> > > @@ -273,9 +272,6 @@ static int rx8581_probe(struct i2c_client
> > > *client)
> > >
> > > dev_dbg(&client->dev, "%s\n", __func__);
> > >
> > > - if (data)
> > > - config = data;
> > > -
> > > rx8581 = devm_kzalloc(&client->dev, sizeof(struct rx8581),
> > GFP_KERNEL);
> > > if (!rx8581)
> > > return -ENOMEM;
> > > @@ -307,7 +303,7 @@ static int rx8581_probe(struct i2c_client
> > > *client) }
> > >
> > > static const struct i2c_device_id rx8581_id[] = {
> > > - { "rx8581", 0 },
> > > + { "rx8581", (kernel_ulong_t)&rx8581_config },
> > > { }
> > > };
> > > MODULE_DEVICE_TABLE(i2c, rx8581_id);
> > > --
> > > 2.25.1
> > >
> >
> > --
> > Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel
> > engineering
> > https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fboot
> > lin.c
> > om%2F&data=05%7C01%7Cbiju.das.jz%40bp.renesas.com%7Cce5fb3bf24764820b8
> > 2e08d
> > ba7c22022%7C53d82571da1947e49cb4625a166a4a2a%7C0%7C0%7C638288224433894
> > 702%7
> > CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1
> > haWwi
> > LCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=ckmh5KF7OTtDO4LRU9QPmuBmt8XOO4Q2i
> > 8wFPE
> > yRqKs%3D&reserved=0
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-08-29 12:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-28 9:08 [PATCH] rtc: rx8581: Simplify probe() Biju Das
2023-08-28 12:27 ` Alexandre Belloni
2023-08-28 12:35 ` Biju Das
2023-08-29 12:44 ` Biju Das
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox